From ec14714a9fac1ba7856677e801e783d7b6803587 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Fri, 7 Jun 2019 20:58:45 +0200 Subject: [PATCH] FEAT #8925 TIME 1:20 add avatar external profile --- .../app/visa/visa-workflow.component.html | 4 +- .../app/visa/visa-workflow.component.scss | 9 ++++ .../app/visa/visa-workflow.component.ts | 46 ++++++++++++------- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/frontend/app/visa/visa-workflow.component.html b/src/frontend/app/visa/visa-workflow.component.html index fa252017a84..7ef77640520 100644 --- a/src/frontend/app/visa/visa-workflow.component.html +++ b/src/frontend/app/visa/visa-workflow.component.html @@ -16,7 +16,9 @@ <mat-list-item *ngFor="let diffusion of visaWorkflow.items;let i=index" cdkDrag class="columns workflow" [cdkDragDisabled]="!injectDatas.editable" [class.notDraggable]="!injectDatas.editable" [class.notEditable]="!injectDatas.editable" [class.processed]="diffusion.process_date != null"> - <mat-icon mat-list-icon class="fa fa-user fa-2x" color="primary"></mat-icon> + <mat-icon *ngIf="!injectDatas.editable" mat-list-icon class="fa fa-user fa-2x" color="primary"></mat-icon> + <mat-icon *ngIf="injectDatas.editable" class="avatar" mat-list-icon color="primary" + [style.background-image]="'url('+diffusion.picture+')'"></mat-icon> <ng-container *ngIf="!injectDatas.editable"> <mat-icon mat-list-icon class="fa fa-hourglass fa-2x" [ngClass]="{'fa-hourglass': diffusion.process_date == null,'fa-check': diffusion.process_date != null}" diff --git a/src/frontend/app/visa/visa-workflow.component.scss b/src/frontend/app/visa/visa-workflow.component.scss index 68990b47629..c81b026a725 100644 --- a/src/frontend/app/visa/visa-workflow.component.scss +++ b/src/frontend/app/visa/visa-workflow.component.scss @@ -100,4 +100,13 @@ text-align: left; font-size: 90%; } +} + +.avatar { + border: solid 3px #F99830; + height: 45px !important; + width: 45px !important; + background-size: cover; + background-repeat: no-repeat; + background-position: center; } \ No newline at end of file diff --git a/src/frontend/app/visa/visa-workflow.component.ts b/src/frontend/app/visa/visa-workflow.component.ts index 334d3258a86..587707f6480 100644 --- a/src/frontend/app/visa/visa-workflow.component.ts +++ b/src/frontend/app/visa/visa-workflow.component.ts @@ -17,8 +17,8 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit lang: any = LANG; visaWorkflow: any = { - roles: ['sign','visa'], - items : [] + roles: ['sign', 'visa'], + items: [] }; loading: boolean = false; data: any; @@ -27,7 +27,7 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit constructor(public http: HttpClient, private notify: NotificationService) { super(http, ['signatureBookUsers']); - } + } ngOnInit(): void { } @@ -44,10 +44,17 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit this.http.get("../../rest/listTemplates/entities/" + entityId) .subscribe((data: any) => { - data.listTemplate.forEach((element:any) => { + data.listTemplate.forEach((element: any, index : number) => { if (element.object_type === 'VISA_CIRCUIT') { - element.requested_signature = (element.item_mode === 'visa' ? false : true); - this.visaWorkflow.items.push(element); + this.http.get("../../rest/maarchParapheur/user/" + element.externalId.maarchParapheur + "/picture") + .subscribe((data: any) => { + element.picture = data.picture + element.requested_signature = (element.item_mode === 'visa' ? false : true); + this.visaWorkflow.items.push(element); + }, (err: any) => { + this.notify.handleErrors(err); + }); + } }); this.loading = false; @@ -58,14 +65,14 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit this.loading = true; this.visaWorkflow.items = []; this.http.get("../../rest/res/" + resId + "/visaCircuit") - .subscribe((data: any) => { - data.forEach((element:any) => { - this.visaWorkflow.items.push(element); + .subscribe((data: any) => { + data.forEach((element: any) => { + this.visaWorkflow.items.push(element); + }); + this.loading = false; + }, (err: any) => { + this.notify.handleErrors(err); }); - this.loading = false; - }, (err: any) => { - this.notify.handleErrors(err); - }); } deleteItem(index: number) { @@ -94,15 +101,22 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit return usersMissing; } - + addItem(event: any) { const user = { 'externalId': event.option.value.externalId, - 'labelToDisplay' : event.option.value.idToDisplay, - 'requested_signature' : false, + 'labelToDisplay': event.option.value.idToDisplay, + 'requested_signature': false, + 'picture': '' } this.visaWorkflow.items.push(user); $j('#availableUsers').blur(); this.userCtrl.setValue(''); + this.http.get("../../rest/maarchParapheur/user/" + user.externalId.maarchParapheur + "/picture") + .subscribe((data: any) => { + this.visaWorkflow.items[this.visaWorkflow.items.length - 1].picture = data.picture; + }, (err: any) => { + this.notify.handleErrors(err); + }); } } \ No newline at end of file -- GitLab