diff --git a/apps/maarch_entreprise/Views/parameter-administration.component.html b/apps/maarch_entreprise/Views/parameter-administration.component.html index 05b69d5fa57112479a6945f78342c4a2b194aed5..ebb343fad7c66e5016399d00a2b7c2569e714ad7 100755 --- a/apps/maarch_entreprise/Views/parameter-administration.component.html +++ b/apps/maarch_entreprise/Views/parameter-administration.component.html @@ -1,6 +1,7 @@ <div class="page-header"> - <h1 *ngIf="!creationMode">{{lang.parameterModification}} <small>{{parameter.id}}</small></h1> - <h1 *ngIf="creationMode">{{lang.parameterCreation}} <small>{{parameter.id}}</small></h1> + <h1>{{lang.administration}} {{lang.parameter}} + <small>{{parameter.id}}</small> + </h1> </div> <div *ngIf="loading"> <mat-spinner style="margin:auto;"></mat-spinner> @@ -8,11 +9,11 @@ <div *ngIf="!loading" class="container-fluid"> <div class="container-fluid"> <div class="col-md-6 col-md-offset-3"> - <form class="form-horizontal" (ngSubmit)="onSubmit()" #parameterFormUp="ngForm"> + <form class="form-horizontal" (ngSubmit)="onSubmit()" #parameterForm="ngForm"> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput [(ngModel)]="parameter.id" [disabled]="!creationMode" required name="id" id="id" title="{{lang.id}}" type="text" placeholder="{{lang.id}}" required> + <input matInput [(ngModel)]="parameter.id" [disabled]="!creationMode" name="id" title="{{lang.id}}" type="text" placeholder="{{lang.id}}" pattern="^[\w-]*$" required> </mat-form-field> </div> </div> @@ -26,7 +27,7 @@ <div class="form-group"> <div class="col-sm-6"> <mat-form-field> - <mat-select id="type" name="type" title="{{lang.type}}" placeholder="{{lang.type}}" [(ngModel)]="type" [disabled]="!creationMode" required> + <mat-select name="type" placeholder="{{lang.type}}" [(ngModel)]="type" [disabled]="!creationMode" required> <mat-option value="string"> {{lang.string}} </mat-option> @@ -40,21 +41,21 @@ </mat-form-field> </div> <div class="col-sm-6"> - <mat-form-field *ngIf = "type == 'string'"> - <input matInput [(ngModel)]="parameter.param_value_string" name="paramValue" id="paramValue" title="{{lang.value}}" type="text" placeholder="{{lang.value}}"> + <mat-form-field *ngIf="type == 'string'"> + <input matInput [(ngModel)]="parameter.param_value_string" name="paramValueString" type="text" placeholder="{{lang.value}}"> </mat-form-field> - <mat-form-field *ngIf = "type == 'int'"> - <input matInput [(ngModel)]="parameter.param_value_int" name="paramValue" id="paramValue" title="{{lang.value}}" type="text" placeholder="{{lang.value}}"> + <mat-form-field *ngIf="type == 'int'"> + <input matInput [(ngModel)]="parameter.param_value_int" name="paramValueInt" type="number" placeholder="{{lang.value}}"> </mat-form-field> - <mat-form-field *ngIf = "type == 'date'"> - <input name="paramValue" id="paramValue" matInput [(ngModel)]="parameter.param_value_date" [matDatepicker]="picker" title="{{lang.value}}" placeholder="lang.value"> + <mat-form-field *ngIf="type == 'date'"> + <input matInput [(ngModel)]="parameter.param_value_date" name="paramValueDate" [matDatepicker]="picker" placeholder="{{lang.date}}"> <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle> <mat-datepicker #picker startView="month"></mat-datepicker> </mat-form-field> </div> </div> <div class="col-sm-12" style="text-align:center;"> - <button mat-raised-button color="primary" type="submit" [disabled]="!parameterFormUp.form.valid" >{{lang.validate}}</button> + <button mat-raised-button color="primary" type="submit" [disabled]="!parameterForm.form.valid">{{lang.save}}</button> <button mat-raised-button routerLink='/administration/parameters'>{{lang.cancel}}</button> </div> </form> diff --git a/apps/maarch_entreprise/Views/parameters-administration.component.html b/apps/maarch_entreprise/Views/parameters-administration.component.html index 9999986162b5e4da9b73804b113cddf0c87cb6c9..f07179201c2164f4a6cfdaf1d0401f7c9dc97b49 100755 --- a/apps/maarch_entreprise/Views/parameters-administration.component.html +++ b/apps/maarch_entreprise/Views/parameters-administration.component.html @@ -1,6 +1,6 @@ <div class="page-header"> <h1>{{lang.administration}} {{lang.parameters}} - <small>{{data.length}} {{lang.parameters}}</small> + <small>{{parameters.length}} {{lang.parameters}}</small> </h1> </div> <div *ngIf="loading"> @@ -33,17 +33,9 @@ <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.description}}</mat-header-cell> <mat-cell *matCellDef="let element"> {{element.description}} </mat-cell> </ng-container> - <ng-container matColumnDef="param_value_string"> + <ng-container matColumnDef="value"> <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.value}}</mat-header-cell> - <mat-cell *matCellDef="let element"> {{element.param_value_string}} </mat-cell> - </ng-container> - <ng-container matColumnDef="param_value_int"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.value}}</mat-header-cell> - <mat-cell *matCellDef="let element"> {{element.param_value_int}} </mat-cell> - </ng-container> - <ng-container matColumnDef="param_value_date"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.value}}</mat-header-cell> - <mat-cell *matCellDef="let element"> {{element.param_value_date}} </mat-cell> + <mat-cell *matCellDef="let element"> {{element.value}} </mat-cell> </ng-container> <ng-container matColumnDef="actions"> <mat-header-cell *matHeaderCellDef></mat-header-cell> diff --git a/apps/maarch_entreprise/css/parameters-administration.component.css b/apps/maarch_entreprise/css/parameters-administration.component.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.js index 407a48267b91c1fa299c3d9cbe08183c13fbbfd0..75b829a66827070378b94d7a5dd8fa70db243cf0 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.js @@ -21,46 +21,37 @@ var ParameterAdministrationComponent = /** @class */ (function () { this.router = router; this.notify = notify; this.lang = translate_component_1.LANG; - this._search = ''; this.parameter = {}; this.loading = false; } - ParameterAdministrationComponent.prototype.prepareParameter = function () { - $j('#inner_content').remove(); - }; ParameterAdministrationComponent.prototype.updateBreadcrumb = function (applicationName) { - var breadCrumb = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + "</a> > <a onclick='location.hash = \"/administration/parameters\"' style='cursor: pointer'>" + this.lang.parameters + "</a> > "; - if (this.creationMode == true) { - breadCrumb += this.lang.parameterCreation; - } - else { - breadCrumb += this.lang.parameterModification; - } - $j('#ariane')[0].innerHTML = breadCrumb; + $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + "</a> > <a onclick='location.hash = \"/administration/parameters\"' style='cursor: pointer'>" + this.lang.parameters + "</a>"; }; ParameterAdministrationComponent.prototype.ngOnInit = function () { var _this = this; - this.loading = true; this.coreUrl = angularGlobals.coreUrl; + this.loading = true; this.route.params.subscribe(function (params) { if (typeof params['id'] == "undefined") { _this.creationMode = true; - _this.http.get(_this.coreUrl + 'rest/administration/parameters/new') - .subscribe(function (data) { - _this.type = 'string'; - _this.updateBreadcrumb(angularGlobals.applicationName); - _this.loading = false; - }, function () { - location.href = "index.php"; - }); + _this.updateBreadcrumb(angularGlobals.applicationName); + _this.loading = false; } else { _this.creationMode = false; - _this.http.get(_this.coreUrl + 'rest/administration/parameters/' + params['id']) + _this.http.get(_this.coreUrl + "rest/parameters/" + params['id']) .subscribe(function (data) { _this.parameter = data.parameter; - _this.type = data.type; _this.updateBreadcrumb(angularGlobals.applicationName); + if (_this.parameter.param_value_int) { + _this.type = "int"; + } + else if (_this.parameter.param_value_date) { + _this.type = "date"; + } + else { + _this.type = "string"; + } _this.loading = false; }, function () { location.href = "index.php"; @@ -86,7 +77,7 @@ var ParameterAdministrationComponent = /** @class */ (function () { this.http.post(this.coreUrl + 'rest/parameters', this.parameter) .subscribe(function (data) { _this.router.navigate(['administration/parameters']); - _this.notify.success(_this.lang.parameterAdded + ' « ' + _this.parameter.id + ' »'); + _this.notify.success(_this.lang.parameterAdded); }, function (err) { _this.notify.error(err.error.errors); }); @@ -95,7 +86,7 @@ var ParameterAdministrationComponent = /** @class */ (function () { this.http.put(this.coreUrl + 'rest/parameters/' + this.parameter.id, this.parameter) .subscribe(function (data) { _this.router.navigate(['administration/parameters']); - _this.notify.success(_this.lang.parameterUpdated + ' « ' + _this.parameter.id + ' »'); + _this.notify.success(_this.lang.parameterUpdated); }, function (err) { _this.notify.error(err.error.errors); }); @@ -104,7 +95,6 @@ var ParameterAdministrationComponent = /** @class */ (function () { ParameterAdministrationComponent = __decorate([ core_1.Component({ templateUrl: angularGlobals['parameter-administrationView'], - styleUrls: [], providers: [notification_service_1.NotificationService] }), __metadata("design:paramtypes", [http_1.HttpClient, router_1.ActivatedRoute, router_1.Router, notification_service_1.NotificationService]) diff --git a/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.ts index 43c763d1eb7946805094ece8460693cb1e8177be..563dcdadb5c8320896cb8ec722c080223a6a4aca 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/parameter-administration.component.ts @@ -8,77 +8,64 @@ declare function $j(selector: any) : any; declare var angularGlobals : any; + @Component({ templateUrl : angularGlobals['parameter-administrationView'], - styleUrls : [], providers : [NotificationService] }) export class ParameterAdministrationComponent implements OnInit { coreUrl : string; - lang : any = LANG; - _search : string = ''; - creationMode : boolean; type : string; - parameter : any = {}; - paramDateTemp : string; + parameter : any = {}; - loading : boolean = false; + creationMode : boolean; + loading : boolean = false; - constructor(public http: HttpClient, private route: ActivatedRoute, private router: Router, private notify: NotificationService) { - } - prepareParameter() { - $j('#inner_content').remove(); + constructor(public http: HttpClient, private route: ActivatedRoute, private router: Router, private notify: NotificationService) { } updateBreadcrumb(applicationName: string) { - var breadCrumb = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>"+this.lang.administration+"</a> > <a onclick='location.hash = \"/administration/parameters\"' style='cursor: pointer'>"+this.lang.parameters+"</a> > "; - - if(this.creationMode == true){ - breadCrumb += this.lang.parameterCreation; - } else { - breadCrumb += this.lang.parameterModification; - } - $j('#ariane')[0].innerHTML = breadCrumb; + $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>"+this.lang.administration+"</a> > <a onclick='location.hash = \"/administration/parameters\"' style='cursor: pointer'>"+this.lang.parameters+"</a>"; } + ngOnInit(): void { - this.loading = true; this.coreUrl = angularGlobals.coreUrl; + this.loading = true; + this.route.params.subscribe((params) => { if (typeof params['id'] == "undefined"){ this.creationMode = true; - - this.http.get(this.coreUrl + 'rest/administration/parameters/new') - .subscribe((data : any) => { - this.type = 'string'; - this.updateBreadcrumb(angularGlobals.applicationName); - this.loading = false; - - }, () => { - location.href = "index.php"; - }); + this.updateBreadcrumb(angularGlobals.applicationName); + this.loading = false; } else { this.creationMode = false; - this.http.get(this.coreUrl + 'rest/administration/parameters/'+params['id']) + this.http.get(this.coreUrl + "rest/parameters/" + params['id']) .subscribe((data : any) => { this.parameter = data.parameter; - this.type = data.type; this.updateBreadcrumb(angularGlobals.applicationName); - this.loading = false; + if (this.parameter.param_value_int) { + this.type = "int"; + } else if (this.parameter.param_value_date) { + this.type = "date"; + } else { + this.type = "string"; + } + + this.loading = false; }, () => { location.href = "index.php"; }); } }); - } onSubmit() { - if(this.type=='date'){ + if(this.type == 'date'){ this.parameter.param_value_int=null; this.parameter.param_value_string=null; } @@ -93,21 +80,20 @@ export class ParameterAdministrationComponent implements OnInit { if(this.creationMode == true){ this.http.post(this.coreUrl + 'rest/parameters', this.parameter) - .subscribe((data : any) => { - this.router.navigate(['administration/parameters']); - this.notify.success(this.lang.parameterAdded+' « '+this.parameter.id+' »'); - - },(err) => { - this.notify.error(err.error.errors); - }); + .subscribe((data : any) => { + this.router.navigate(['administration/parameters']); + this.notify.success(this.lang.parameterAdded); + },(err) => { + this.notify.error(err.error.errors); + }); } else if(this.creationMode == false){ - this.http.put(this.coreUrl+'rest/parameters/'+this.parameter.id,this.parameter) - .subscribe((data : any) => { - this.router.navigate(['administration/parameters']); - this.notify.success(this.lang.parameterUpdated+' « '+this.parameter.id+' »'); - },(err) => { - this.notify.error(err.error.errors); - }); + this.http.put(this.coreUrl + 'rest/parameters/' + this.parameter.id, this.parameter) + .subscribe((data : any) => { + this.router.navigate(['administration/parameters']); + this.notify.success(this.lang.parameterUpdated); + },(err) => { + this.notify.error(err.error.errors); + }); } } } diff --git a/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.js index ed55c112683352953389c21eaa764a3ee2fae93d..66f1606a99a3286df077999026327bdd458eb561 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.js @@ -19,54 +19,49 @@ var ParametersAdministrationComponent = /** @class */ (function () { this.http = http; this.notify = notify; this.lang = translate_component_1.LANG; - this.resultInfo = ""; + this.parameters = {}; this.loading = false; - this.data = []; - this.displayedColumns = ['id', 'description', 'param_value_string', 'param_value_int', 'param_value_date', 'actions']; - this.dataSource = new material_1.MatTableDataSource(this.data); + this.displayedColumns = ['id', 'description', 'value', 'actions']; } - ParametersAdministrationComponent.prototype.applyFilter = function (filterValue) { - filterValue = filterValue.trim(); // Remove whitespace - filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches - this.dataSource.filter = filterValue; - }; ParametersAdministrationComponent.prototype.updateBreadcrumb = function (applicationName) { if ($j('#ariane')[0]) { $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + "</a> > " + this.lang.parameters; } }; + ParametersAdministrationComponent.prototype.applyFilter = function (filterValue) { + filterValue = filterValue.trim(); // Remove whitespace + filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches + this.dataSource.filter = filterValue; + }; ParametersAdministrationComponent.prototype.ngOnInit = function () { var _this = this; this.updateBreadcrumb(angularGlobals.applicationName); this.coreUrl = angularGlobals.coreUrl; - this.http.get(this.coreUrl + 'rest/administration/parameters') + this.loading = true; + this.http.get(this.coreUrl + 'rest/parameters') .subscribe(function (data) { - _this.parametersList = data.parametersList; - _this.data = _this.parametersList; + _this.parameters = data.parameters; setTimeout(function () { - _this.dataSource = new material_1.MatTableDataSource(_this.data); + _this.dataSource = new material_1.MatTableDataSource(_this.parameters); _this.dataSource.paginator = _this.paginator; _this.dataSource.sort = _this.sort; }, 0); _this.loading = false; }); }; - ParametersAdministrationComponent.prototype.goUrl = function () { - location.href = 'index.php?admin=parameters&page=control_param_technic'; - }; ParametersAdministrationComponent.prototype.deleteParameter = function (paramId) { var _this = this; - var resp = confirm(this.lang.confirmAction + ' ' + this.lang.delete + ' « ' + paramId + ' »'); - if (resp) { + var r = confirm(this.lang.deleteMsg); + if (r) { this.http.delete(this.coreUrl + 'rest/parameters/' + paramId) .subscribe(function (data) { - _this.data = data.parameters; - _this.dataSource = new material_1.MatTableDataSource(_this.data); + _this.parameters = data.parameters; + _this.dataSource = new material_1.MatTableDataSource(_this.parameters); _this.dataSource.paginator = _this.paginator; _this.dataSource.sort = _this.sort; - _this.notify.success(_this.lang.parameterDeleted + ' « ' + paramId + ' »'); + _this.notify.success(_this.lang.parameterDeleted); }, function (err) { - _this.notify.error(JSON.parse(err._body).errors); + _this.notify.error(err.error.errors); }); } }; @@ -81,7 +76,6 @@ var ParametersAdministrationComponent = /** @class */ (function () { ParametersAdministrationComponent = __decorate([ core_1.Component({ templateUrl: angularGlobals["parameters-administrationView"], - styleUrls: ['css/parameters-administration.component.css'], providers: [notification_service_1.NotificationService] }), __metadata("design:paramtypes", [http_1.HttpClient, notification_service_1.NotificationService]) diff --git a/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts index 799921b2ca25ee59cf97531251d93f1c7b2a8e37..bdeea269cd604b220e5608fbcd7daa1cb3923e98 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/parameters-administration.component.ts @@ -8,32 +8,24 @@ declare function $j(selector: any) : any; declare var angularGlobals : any; + @Component({ templateUrl : angularGlobals["parameters-administrationView"], - styleUrls : ['css/parameters-administration.component.css'], providers : [NotificationService] }) - export class ParametersAdministrationComponent implements OnInit { coreUrl : string; - lang : any = LANG; - parametersList : any; + parameters : any = {}; - resultInfo : string = ""; loading : boolean = false; - data : Parameter[] = []; - displayedColumns = ['id','description','param_value_string','param_value_int','param_value_date','actions']; - dataSource = new MatTableDataSource(this.data); + displayedColumns = ['id', 'description', 'value', 'actions']; + dataSource : any; @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; - applyFilter(filterValue: string) { - filterValue = filterValue.trim(); // Remove whitespace - filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches - this.dataSource.filter = filterValue; - } + constructor(public http: HttpClient, private notify: NotificationService) { } @@ -44,48 +36,46 @@ export class ParametersAdministrationComponent implements OnInit { } } + applyFilter(filterValue: string) { + filterValue = filterValue.trim(); // Remove whitespace + filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches + this.dataSource.filter = filterValue; + } + ngOnInit(): void { this.updateBreadcrumb(angularGlobals.applicationName); this.coreUrl = angularGlobals.coreUrl; - - this.http.get(this.coreUrl + 'rest/administration/parameters') + + this.loading = true; + + this.http.get(this.coreUrl + 'rest/parameters') .subscribe((data : any) => { - this.parametersList = data.parametersList; - this.data = this.parametersList; + this.parameters = data.parameters; + setTimeout(() => { - this.dataSource = new MatTableDataSource(this.data); + this.dataSource = new MatTableDataSource(this.parameters); this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; }, 0); - this.loading = false; + this.loading = false; }); } - goUrl(){ - location.href = 'index.php?admin=parameters&page=control_param_technic'; - } + deleteParameter(paramId : string) { + let r = confirm(this.lang.deleteMsg); - deleteParameter(paramId : string){ - let resp = confirm(this.lang.confirmAction+' '+this.lang.delete+' « '+paramId+' »'); - if (resp) { - this.http.delete(this.coreUrl + 'rest/parameters/'+paramId) + if (r) { + this.http.delete(this.coreUrl + 'rest/parameters/' + paramId) .subscribe((data : any) => { - this.data = data.parameters; - this.dataSource = new MatTableDataSource(this.data); + this.parameters = data.parameters; + this.dataSource = new MatTableDataSource(this.parameters); this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; - this.notify.success(this.lang.parameterDeleted+' « '+paramId+' »'); - },(err) => { - this.notify.error(JSON.parse(err._body).errors); + this.notify.success(this.lang.parameterDeleted); + }, (err) => { + this.notify.error(err.error.errors); }); } } } -export interface Parameter { - id: string; - description: string; - param_value_string: string; - param_value_int: number; - param_value_date: Date; -} \ No newline at end of file diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.js b/apps/maarch_entreprise/js/angular/lang/lang-en.js index 2d79fa033b48de46a03259cc4c8c9b7b6adbfb41..cef06dea62bd1f3cfc4d2e9acdbcb493b0b2b819 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.js +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.js @@ -68,6 +68,11 @@ exports.LANG_EN = { "newPsw": "New password", "newSignature": "New signature", "no": "No", + "parameters": "Parameters", + "parameter": "Parameter", + "parameterAdded": "Parameter added", + "parameterDeleted": "Parameter deleted", + "parameterUpdated": "Parameter updated", "phoneNumber": "Phone number", "primaryEntity": "Primary entity", "priorityAdded": "Priority added", diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts index 85dec404bb05986aea691b0031e35354272ee617..071a57079814d6f906f2cd170188f28257273528 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts @@ -1,107 +1,112 @@ export const LANG_EN = { - "abs" : "Absent", - "activateAbsence" : "Activate absence", - "active" : "Active", - "add" : "Add", - "addStatus" : "Add a status", - "administration" : "Administration", - "application" : "Application", - "authorize" : "Authorize", - "autoLogoutAbsence" : "You are going to be automaticaly disconnected after your redirections", - "back" : "Back", - "basket" : "Basket", - "basketAdded" : "Basket added", - "basketDeleted" : "Basket deleted", - "baskets" : "Baskets", - "basketUpdated" : "Basket updated", - "canBeModified" : "Index modification", - "canBeSearched" : "Searchable", - "cancel" : "Cancel", - "changeMyPassword" : "Change my password", - "chooseBasket" : "Choose a basket", - "chooseEntity" : "Choose a entity", - "chooseGroup" : "Choose a group", - "clause" : "Clause", - "clickOn" : "Click on", - "color" : "Color", - "currentPsw" : "Current password", - "deactivateAbsence" : "Deactivate absence", - "delete" : "Delete", - "deleteMsg" : "Do you really want to delete this element", - "description" : "Description", - "email" : "Email", - "emailSignatures" : "Email signatures", - "entities" : "Entities", - "entityAdded" : "Entité added", - "entityDeleted" : "Entité deleted", - "entityTooglePrimary" : "Pass to primary entity", - "entityUpdated" : "Entité updated", - "fingerprint" : "Digital fingerprint", - "firstname" : "Firstname", - "folders" : "Folders", - "for" : "for", - "groupAdded" : "Group added", - "groupCreation" : "Create group", - "groupModification" : "Modify group", - "groupDeleted" : "Group deleted", - "groups" : "Groups", - "groupUpdated" : "Group updated", - "history" : "Historique", - "id" : "Login", - "imgRelated" : "Associated image", - "inactive" : "Inactive", - "informations" : "Informations", - "initials" : "Initials", - "isFolderStatus" : "Folder status", - "label" : "Label", - "lastname" : "Lastname", - "maarchApplication" : "Maarch App", - "manageAbsences" : "Manage absences", - "manageSignatures" : "Manage signatures", - "modificationSaved" : "Modification has been saved", - "module" : "Module", - "modules" : "Modules", - "myProfile" : "My profile", - "newElement" : "New element", - "newPsw" : "New password", - "newSignature" : "New signature", - "no" : "No", - "phoneNumber" : "Phone number", - "primaryEntity" : "Primary entity", - "priorityAdded" : "Priority added", - "priorityDeleted" : "Priority deleted", - "priorityUpdated" : "Priority updated", - "processDelay" : "Process delay", - "reinitPassword" : "Reset password", - "renewPsw" : "Enter the password again", - "reports" : "Reports", - "role" : "Role", - "save" : "Save", - "sbSignatures" : "Signature Book Signatures", - "secondaryEntity" : "Secondary entity", - "selectAll" : "Select all", - "statusAdded" : "Status added", - "statusCreation" : "Status creation", - "statusDeleted" : "Status deleted", - "statuses" : "Statuses", - "statusModification" : "Status modification", - "statusUpdated" : "Status updated", - "suspend" : "Suspend", - "system" : "System", - "systemParameters" : "System parameters", - "to" : "to", - "tooltipFolderStatus" : "If <b>checked</b>,<br/>status can be used for <b>folder baskets</b>", - "tooltipIndexStatus" : "If <b>checked</b>,<br/>you can <b>edit</b> metadatas of the documents having this status", - "tooltipSearchStatus" : "If <b>checked</b>,<br/>the status will be <b>offered</b> in the search criteria STATUS of the advanced search", - "unselectAll" : "Unselect all", - "update" : "Update", - "updateStatus" : "Document status modification", - "updateStatusInformations": "When typing the chrono or the GED number of a document, you will modify its status. The document will be present in the basket depending of the status you have chosen.", - "user" : "user", - "userCreation" : "User Creation", - "userModification" : "User Modification", - "validate" : "Validate", - "value" : "value", - "workingDays" : "Working days", - "yes" : "Yes", + "abs" : "Absent", + "activateAbsence" : "Activate absence", + "active" : "Active", + "add" : "Add", + "addStatus" : "Add a status", + "administration" : "Administration", + "application" : "Application", + "authorize" : "Authorize", + "autoLogoutAbsence" : "You are going to be automaticaly disconnected after your redirections", + "back" : "Back", + "basket" : "Basket", + "basketAdded" : "Basket added", + "basketDeleted" : "Basket deleted", + "baskets" : "Baskets", + "basketUpdated" : "Basket updated", + "canBeModified" : "Index modification", + "canBeSearched" : "Searchable", + "cancel" : "Cancel", + "changeMyPassword" : "Change my password", + "chooseBasket" : "Choose a basket", + "chooseEntity" : "Choose a entity", + "chooseGroup" : "Choose a group", + "clause" : "Clause", + "clickOn" : "Click on", + "color" : "Color", + "currentPsw" : "Current password", + "deactivateAbsence" : "Deactivate absence", + "delete" : "Delete", + "deleteMsg" : "Do you really want to delete this element", + "description" : "Description", + "email" : "Email", + "emailSignatures" : "Email signatures", + "entities" : "Entities", + "entityAdded" : "Entité added", + "entityDeleted" : "Entité deleted", + "entityTooglePrimary" : "Pass to primary entity", + "entityUpdated" : "Entité updated", + "fingerprint" : "Digital fingerprint", + "firstname" : "Firstname", + "folders" : "Folders", + "for" : "for", + "groupAdded" : "Group added", + "groupCreation" : "Create group", + "groupModification" : "Modify group", + "groupDeleted" : "Group deleted", + "groups" : "Groups", + "groupUpdated" : "Group updated", + "history" : "Historique", + "id" : "Login", + "imgRelated" : "Associated image", + "inactive" : "Inactive", + "informations" : "Informations", + "initials" : "Initials", + "isFolderStatus" : "Folder status", + "label" : "Label", + "lastname" : "Lastname", + "maarchApplication" : "Maarch App", + "manageAbsences" : "Manage absences", + "manageSignatures" : "Manage signatures", + "modificationSaved" : "Modification has been saved", + "module" : "Module", + "modules" : "Modules", + "myProfile" : "My profile", + "newElement" : "New element", + "newPsw" : "New password", + "newSignature" : "New signature", + "no" : "No", + "parameters" : "Parameters", + "parameter" : "Parameter", + "parameterAdded" : "Parameter added", + "parameterDeleted" : "Parameter deleted", + "parameterUpdated" : "Parameter updated", + "phoneNumber" : "Phone number", + "primaryEntity" : "Primary entity", + "priorityAdded" : "Priority added", + "priorityDeleted" : "Priority deleted", + "priorityUpdated" : "Priority updated", + "processDelay" : "Process delay", + "reinitPassword" : "Reset password", + "renewPsw" : "Enter the password again", + "reports" : "Reports", + "role" : "Role", + "save" : "Save", + "sbSignatures" : "Signature Book Signatures", + "secondaryEntity" : "Secondary entity", + "selectAll" : "Select all", + "statusAdded" : "Status added", + "statusCreation" : "Status creation", + "statusDeleted" : "Status deleted", + "statuses" : "Statuses", + "statusModification" : "Status modification", + "statusUpdated" : "Status updated", + "suspend" : "Suspend", + "system" : "System", + "systemParameters" : "System parameters", + "to" : "to", + "tooltipFolderStatus" : "If <b>checked</b>,<br/>status can be used for <b>folder baskets</b>", + "tooltipIndexStatus" : "If <b>checked</b>,<br/>you can <b>edit</b> metadatas of the documents having this status", + "tooltipSearchStatus" : "If <b>checked</b>,<br/>the status will be <b>offered</b> in the search criteria STATUS of the advanced search", + "unselectAll" : "Unselect all", + "update" : "Update", + "updateStatus" : "Document status modification", + "updateStatusInformations" : "When typing the chrono or the GED number of a document, you will modify its status. The document will be present in the basket depending of the status you have chosen.", + "user" : "user", + "userCreation" : "User Creation", + "userModification" : "User Modification", + "validate" : "Validate", + "value" : "value", + "workingDays" : "Working days", + "yes" : "Yes", }; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.js b/apps/maarch_entreprise/js/angular/lang/lang-fr.js index 50a52f417c3580e45b973298b5c4071fd6a05e4c..70edf5ebcc1f16974c8323a45374ca796f2a05d9 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.js +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.js @@ -108,12 +108,11 @@ exports.LANG_FR = { "noResult": "Aucun résultat", "outOf": "sur", "page": "Page", + "parameters": "Paramètres", + "parameter": "Paramètre", "parameterAdded": "Paramètre ajouté", - "parameterCreation": "Création d'un paramètre", - "parameterDeleted": "Paramètre supprimé", - "parameterModification": "Modification du paramètre", - "parameters": "Paramètre(s)", "parameterUpdated": "Paramètre modifié", + "parameterDeleted": "Paramètre supprimé", "phoneNumber": "Numéro de téléphone", "previous": "Précecdent", "primaryEntity": "Entité primaire", diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index e5ecf82067e6148badcc407a5f58febcf08a736a..9dd2857ae38aef1d25afc931128732a74944a2be 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -1,11 +1,11 @@ export const LANG_FR = { - "abs" : "Absent", - "absOff" : "Absence désactivé", - "absOn" : "Absence activé", - "action" : "Action", - "actionAdded" : "Action ajoutée", - "actionCreation" : "Création d'une action", - "actionDeleted" : "Action supprimée", + "abs" : "Absent", + "absOff" : "Absence désactivé", + "absOn" : "Absence activé", + "action" : "Action", + "actionAdded" : "Action ajoutée", + "actionCreation" : "Création d'une action", + "actionDeleted" : "Action supprimée", "actionHistory" : "Tracer l'action", "actionHistoryDesc" : "Permet tracer cette action dans l'historique du document. Il est fortement recommandé de cocher cette option.", "actionModification" : "Modification de l'action", @@ -16,8 +16,8 @@ export const LANG_FR = { "activateAbs" : "Activer l'absence", "activateAbsence" : "Activer l'absence", "active" : "Actif", - "add" : "Ajouter", - "addStatus" : "Ajouter un statut", + "add" : "Ajouter", + "addStatus" : "Ajouter un statut", "administration" : "Administration", "application" : "Application", "associatedStatus" : "Statut associé", @@ -36,7 +36,7 @@ export const LANG_FR = { "changeMyPassword" : "Modifier mon mot de passe", "chooseBasket" : "Choisissez une banette", "chooseCategoryAssociation" : "Choisissez une ou plusieurs catégories associée", - "chooseCategoryAssociationHelp": "Si aucune catégorie sélectionnée alors l'action est valable pour toute les catégories", + "chooseCategoryAssociationHelp" : "Si aucune catégorie sélectionnée alors l'action est valable pour toute les catégories", "chooseEntity" : "Choisissez une entité", "chooseGroup" : "Choisissez un groupe", "clause" : "Clause", @@ -106,15 +106,14 @@ export const LANG_FR = { "noResult" : "Aucun résultat", "outOf" : "sur", "page" : "Page", - "parameterAdded" : "Paramètre ajouté", - "parameterCreation" : "Création d'un paramètre", - "parameterDeleted" : "Paramètre supprimé", - "parameterModification" : "Modification du paramètre", - "parameters" : "Paramètre(s)", - "parameterUpdated" : "Paramètre modifié", - "phoneNumber" : "Numéro de téléphone", - "previous" : "Précecdent", - "primaryEntity" : "Entité primaire", + "parameters" : "Paramètres", + "parameter" : "Paramètre", + "parameterAdded" : "Paramètre ajouté", + "parameterUpdated" : "Paramètre modifié", + "parameterDeleted" : "Paramètre supprimé", + "phoneNumber" : "Numéro de téléphone", + "previous" : "Précecdent", + "primaryEntity" : "Entité primaire", "priorityAdded" : "Priorité ajoutée", "priorityDeleted" : "Priorité supprimée", "priorityUpdated" : "Priorité modifiée", diff --git a/src/app/parameter/controllers/ParameterController.php b/src/app/parameter/controllers/ParameterController.php index b8c774783a320fe31d5286f9de57ade495cae7ed..a3a3ce2aeae9cd1a3aa6c29cfcfbcffe734147e0 100644 --- a/src/app/parameter/controllers/ParameterController.php +++ b/src/app/parameter/controllers/ParameterController.php @@ -27,7 +27,19 @@ class ParameterController { public function get(Request $request, Response $response) { - return $response->withJson(['parameters' => ParameterModel::get()]); + $parameters = ParameterModel::get(); + + foreach ($parameters as $key => $parameter) { + if (!empty($parameter['param_value_string'])) { + $parameters[$key]['value'] = $parameter['param_value_string']; + } elseif (!empty($parameter['param_value_int'])) { + $parameters[$key]['value'] = $parameter['param_value_int']; + } elseif (!empty($parameter['param_value_date'])) { + $parameters[$key]['value'] = $parameter['param_value_date']; + } + } + + return $response->withJson(['parameters' => $parameters]); } public function getById(Request $request, Response $response, array $aArgs) @@ -66,12 +78,12 @@ class ParameterController } $parameter = ParameterModel::getById(['id' => $aArgs['id']]); - if (empty($parameter)) { return $response->withStatus(400)->withJson(['errors' => 'Parameter not found']); } $data = $request->getParams(); + $data['id'] = $aArgs['id']; ParameterModel::update($data); diff --git a/src/app/parameter/models/ParameterModelAbstract.php b/src/app/parameter/models/ParameterModelAbstract.php index a4a92cc1f5e61b0b63d380a99d83e156f5907130..fe20c2dd70e3b822a1a729732231d623278515b7 100644 --- a/src/app/parameter/models/ParameterModelAbstract.php +++ b/src/app/parameter/models/ParameterModelAbstract.php @@ -68,7 +68,7 @@ class ParameterModelAbstract 'description' => $aArgs['description'], 'param_value_string' => $aArgs['param_value_string'], 'param_value_int' => $aArgs['param_value_int'], - 'param_value_date' => $aArgs['param_value_date'], + 'param_value_date' => $aArgs['param_value_date'] ] ]); @@ -78,11 +78,17 @@ class ParameterModelAbstract public static function update(array $aArgs) { ValidatorModel::notEmpty($aArgs, ['id']); - ValidatorModel::stringType($aArgs, ['id']); + ValidatorModel::stringType($aArgs, ['id', 'description', 'param_value_string']); + ValidatorModel::intVal($aArgs, ['param_value_int']); DatabaseModel::update([ 'table' => 'parameters', - 'set' => $aArgs, + 'set' => [ + 'description' => $aArgs['description'], + 'param_value_string' => $aArgs['param_value_string'], + 'param_value_int' => $aArgs['param_value_int'], + 'param_value_date' => $aArgs['param_value_date'] + ], 'where' => ['id = ?'], 'data' => [$aArgs['id']] ]);