Commit feafb781 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #17812 TIME 0:40 add delegation msg for actions request and validate parallel opinion

parent 5ce093a7
......@@ -15,6 +15,6 @@
<img src="assets/spinner.gif"/>
</div>
</app-root>
<script src="runtime-es2015.497d8eb67297abf47895.js" type="module"></script><script src="runtime-es5.497d8eb67297abf47895.js" nomodule defer></script><script src="polyfills-es5.c174c1516561194600a5.js" nomodule defer></script><script src="polyfills-es2015.b86be9c6fde12488a69f.js" type="module"></script><script src="scripts.b9f328a06b6423d59d32.js" defer></script><script src="main-es2015.e8f82aa66d3b23a7ede4.js" type="module"></script><script src="main-es5.e8f82aa66d3b23a7ede4.js" nomodule defer></script></body>
<script src="runtime-es2015.497d8eb67297abf47895.js" type="module"></script><script src="runtime-es5.497d8eb67297abf47895.js" nomodule defer></script><script src="polyfills-es5.c174c1516561194600a5.js" nomodule defer></script><script src="polyfills-es2015.b86be9c6fde12488a69f.js" type="module"></script><script src="scripts.b9f328a06b6423d59d32.js" defer></script><script src="main-es2015.bc27b4ab2d62c8810b28.js" type="module"></script><script src="main-es5.bc27b4ab2d62c8810b28.js" nomodule defer></script></body>
</html>
\ No newline at end of file
......@@ -14,9 +14,9 @@
<b *ngIf="data.resIds.length > 1" color="primary" class="highlight">{{data.resIds.length}}
{{'lang.elements' | translate}}</b> ?
</div>
<div mat-line *ngIf="delegation.isDelegated && !noResourceToProcess" class="delegationMsg">
<app-maarch-message style="margin-bottom: -15px;" *ngIf="delegation.isDelegated && !noResourceToProcess" mode="danger">
{{'lang.signInsteadOf' | translate}}&nbsp;<b style="overflow: hidden;text-overflow: ellipsis;" [title]="delegation.userDelegated">{{ delegation.userDelegated }}</b>
</div>
</app-maarch-message>
<div class="alert-message alert-message-info" *ngIf="data.resIds.length == 1 && !noResourceToProcess"
role="alert" style="margin-top: 30px;"
[innerHTML]="'<b>' + ownerOpinion + '</b> '+ ('lang.askOpinionUser' | translate) + ' :<br/><br/>' + opinionContent">
......
......@@ -97,7 +97,8 @@ export class SendAvisParallelComponent implements AfterViewInit {
}
executeAction(realResSelected: number[]) {
const noteContent: string = `[${this.translate.instant('lang.avisUserAsk').toUpperCase()}] ${this.noteEditor.getNoteContent()}`;
const opinionUserState: string = this.translate.instant('lang.requestedOpinion').concat(' ', this.delegation.userDelegated);
const noteContent: string = this.delegation.isDelegated ? `[${this.translate.instant('lang.avisUserAsk').toUpperCase()}] ${this.noteEditor.getNoteContent()}${opinionUserState}` : `[${this.translate.instant('lang.avisUserAsk').toUpperCase()}] ${this.noteEditor.getNoteContent()}`;
this.noteEditor.setNoteContent(noteContent);
this.http.put(this.data.processActionRoute, { resources: realResSelected, note: this.noteEditor.getNote(), data: { opinionLimitDate: this.functions.formatDateObjectToDateString(this.opinionLimitDate, true, 'yyyy-mm-dd'), opinionCircuit : this.appAvisWorkflow.getWorkflow() } }).pipe(
tap((data: any) => {
......
......@@ -33,6 +33,11 @@ export class ValidateAvisParallelComponent implements OnInit, AfterViewInit {
availableRoles: any[] = [];
delegation: any = {
isDelegated: false,
userDelegated: null
};
@ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent;
@ViewChild('appAvisWorkflow', { static: false }) appAvisWorkflow: AvisWorkflowComponent;
......@@ -47,6 +52,15 @@ export class ValidateAvisParallelComponent implements OnInit, AfterViewInit {
ngOnInit() {
this.checkAvisCircuit();
const userId: number = parseInt(this.data.userId, 10);
if (userId !== this.headerService.user.id && !this.noResourceToProcess) {
this.delegation.isDelegated = true;
this.http.get('../rest/users/' + userId).pipe(
tap((user: any) => {
this.delegation.userDelegated = `${user.firstname} ${user.lastname}`;
})
).subscribe();
}
}
checkAvisCircuit() {
......@@ -94,7 +108,9 @@ export class ValidateAvisParallelComponent implements OnInit, AfterViewInit {
}
executeAction(realResSelected: number[]) {
const noteContent: string = `[${this.translate.instant('lang.avisUserAsk').toUpperCase()}] ${this.noteEditor.getNoteContent()}${this.translate.instant('lang.validateBy')} ${this.headerService.user.firstname} ${this.headerService.user.lastname}`;
const insteadOfMsg: string = `${this.translate.instant('lang.insteadOf').replace(/^.{1}/g, this.translate.instant('lang.insteadOf')[0].toLowerCase())} ${this.delegation.userDelegated}`;
const validatedOpinionMsg: string = `[${this.translate.instant('lang.avisUserAsk').toUpperCase()}] ${this.noteEditor.getNoteContent()}${this.translate.instant('lang.validateBy')} ${this.headerService.user.firstname} ${this.headerService.user.lastname}`;
const noteContent: string = !this.delegation.isDelegated ? validatedOpinionMsg : `${validatedOpinionMsg} ${insteadOfMsg}`;
this.noteEditor.setNoteContent(noteContent);
this.http.put(this.data.processActionRoute, { resources: realResSelected, data: { note: this.noteEditor.getNote(), opinionLimitDate: this.functions.formatDateObjectToDateString(this.opinionLimitDate, true), opinionCircuit: this.appAvisWorkflow.getWorkflow() } }).pipe(
tap((data: any) => {
......
......@@ -2489,5 +2489,6 @@
"interconnectionFailed": "<b>Interconnection with Maarch RM failed.</b> Error when calling Maarch RM server",
"interconnectionSuccess": "<b>Successful interconnection with Maarch RM.</b>",
"startTest": "Start the test",
"delegatedOpinion": "Opinion given instead of"
"delegatedOpinion": "Opinion given instead of",
"requestedOpinion": "Opinion requested instead of"
}
......@@ -2484,5 +2484,6 @@
"interconnectionFailed": "<b>L'interconnexion avec Maarch RM a échouée.</b> Erreur lors de l'appel au serveur Maarch RM",
"interconnectionSuccess": "<b>Interconnexion réussie avec Maarch RM.</b>",
"startTest": "Lancer le test",
"delegatedOpinion": "Avis donné à la place de"
"delegatedOpinion": "Avis donné à la place de",
"requestedOpinion": "Avis demandé à la place de"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment