From f15cb0cd0529721c5e2e59f4012369b624b518d1 Mon Sep 17 00:00:00 2001 From: Alex Orluc <alex.orluc@maarch.org> Date: Thu, 15 Mar 2018 14:40:45 +0100 Subject: [PATCH] FEAT #152 add toggle role --- .../Views/entities-administration.component.html | 14 +++++++++++++- .../entities-administration.component.ts | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/maarch_entreprise/Views/entities-administration.component.html b/apps/maarch_entreprise/Views/entities-administration.component.html index cd47b83fe91..c6649431764 100644 --- a/apps/maarch_entreprise/Views/entities-administration.component.html +++ b/apps/maarch_entreprise/Views/entities-administration.component.html @@ -23,6 +23,18 @@ </a> </mat-nav-list> <mat-divider></mat-divider> + <mat-nav-list> + <h3 mat-subheader>Role(s) disponible(s)</h3> + <a mat-list-item *ngFor="let role of currentEntity.roles; let i = index"> + <mat-icon color="primary" mat-list-icon style="margin-bottom: 20px;"> + <mat-slide-toggle [(ngModel)]="role.available" [checked]="role.available" color="primary" [ngStyle]="{'opacity': role.available ? '' : '0.5'}" (change)="toggleRole(role)"></mat-slide-toggle> + </mat-icon> + <p mat-line> + {{role.label}} + </p> + </a> + </mat-nav-list> + <mat-divider></mat-divider> <menu-app></menu-app> </mat-sidenav> <mat-sidenav-content> @@ -204,7 +216,7 @@ </mat-form-field> <mat-list> <span *ngFor="let role of currentEntity.roles; let i = index"> - <h3 *ngIf="role.available" mat-subheader style="font-weight:bold;" color="primary"><mat-slide-toggle [checked]="role.available" color="primary" [ngStyle]="{'opacity': role.available ? '' : '0.5'}">{{role.label}}</mat-slide-toggle></h3> + <h3 *ngIf="role.available" mat-subheader style="font-weight:bold;" color="primary">{{role.label}}</h3> <span *ngIf="role.available" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="currentEntity.listTemplate[role.id]"> <div style="min-height:30px;"> <mat-list-item disableRipple="true" *ngFor="let template of currentEntity.listTemplate[role.id]; let i = index" title="{{lang.move}}" diff --git a/apps/maarch_entreprise/js/angular/app/administration/entities-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/entities-administration.component.ts index 47408556240..74fc417055b 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/entities-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/entities-administration.component.ts @@ -611,6 +611,15 @@ export class EntitiesAdministrationComponent extends AutoCompletePlugin implemen }); } } + + toggleRole(role:any) { + this.http.put(this.coreUrl + "rest/listTemplates/types/roles",{"roles":this.currentEntity.roles,"typeId":"entity_id"}) + .subscribe((data: any) => { + this.notify.success(this.lang.entityUpdated); + }, (err) => { + this.notify.error(err.error.errors); + }); + } } @Component({ templateUrl: "../../../../Views/entities-administration-redirect-modal.component.html" -- GitLab