Skip to content
Snippets Groups Projects
Commit 3973f277 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #10604 TIME 0:30 fix substitution message

parent 19c04673
No related branches found
No related tags found
No related merge requests found
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<img [src]="diffusion.userPicture"> <img [src]="diffusion.userPicture">
</ion-avatar> </ion-avatar>
<ion-label> <ion-label>
<p class="secondary" *ngIf="diffusion.current && (diffusion.userId !== null && diffusion.userId !== authService.user.id)"> <p class="secondary" *ngIf="userDelegated">
{{'lang.substituteMsg' | translate}}</p> {{'lang.substituteMsg' | translate}}</p>
<h2 [class.interrupt]="diffusion.noConnector !== undefined && diffusion.noConnector === true" [title]="diffusion.userDisplay" *ngIf="diffusion.userDisplay !== ''">{{diffusion.userDisplay}}</h2> <h2 [class.interrupt]="diffusion.noConnector !== undefined && diffusion.noConnector === true" [title]="diffusion.userDisplay" *ngIf="diffusion.userDisplay !== ''">{{diffusion.userDisplay}}</h2>
<h2 [title]="diffusion.userDisplay" class="danger" *ngIf="diffusion.userDisplay === ''"> <h2 [title]="diffusion.userDisplay" class="danger" *ngIf="diffusion.userDisplay === ''">
......
...@@ -34,6 +34,7 @@ export class VisaWorkflowComponent implements OnInit { ...@@ -34,6 +34,7 @@ export class VisaWorkflowComponent implements OnInit {
}; };
roles: any[] = []; roles: any[] = [];
hasConnector: boolean = false; hasConnector: boolean = false;
userDelegated: boolean = false;
constructor( constructor(
public http: HttpClient, public http: HttpClient,
...@@ -54,6 +55,8 @@ export class VisaWorkflowComponent implements OnInit { ...@@ -54,6 +55,8 @@ export class VisaWorkflowComponent implements OnInit {
}); });
if (this.editMode) { if (this.editMode) {
await this.getConnectors(); await this.getConnectors();
} else {
await this.checkSubstitute();
} }
} }
...@@ -195,7 +198,6 @@ export class VisaWorkflowComponent implements OnInit { ...@@ -195,7 +198,6 @@ export class VisaWorkflowComponent implements OnInit {
modal.onDidDismiss() modal.onDidDismiss()
.then(async (result: any) => { .then(async (result: any) => {
console.log(result);
if (result.data === 'cancel' && userId !== null) { if (result.data === 'cancel' && userId !== null) {
this.visaWorkflow[position].role = 'visa'; this.visaWorkflow[position].role = 'visa';
} else if (typeof result.data === 'object') { } else if (typeof result.data === 'object') {
...@@ -385,4 +387,24 @@ export class VisaWorkflowComponent implements OnInit { ...@@ -385,4 +387,24 @@ export class VisaWorkflowComponent implements OnInit {
return mode; return mode;
} }
} }
checkSubstitute() {
return new Promise((resolve) => {
const userId = this.visaWorkflow.find((user: any) => user.current).userId;
if (userId !== null) {
this.http.get('../rest/users/' + userId).pipe(
tap((data: any) => {
this.userDelegated = data.user.substitute === this.authService.user.id ? true : false;
}),
catchError((err: any) => {
this.notificationService.handleErrors(err);
return of(false);
})
).subscribe();
} else {
this.userDelegated = false;
}
resolve(true);
});
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment