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

FIX #17812 TIME 0:57 display delegation message in sendAvisParallel action + translate

parent b420cdbe
......@@ -120,7 +120,7 @@
.delegationMsg {
color: var(--maarch-color-danger);;
font-size: 12px;
font-size: 14px;
margin-top: 20px;
display: flex !important;
}
......@@ -91,9 +91,8 @@ export class GiveAvisParallelActionComponent implements OnInit {
}
executeAction(realResSelected: number[]) {
const delegateMsg: string = this.translate.instant('lang.insteadOf').replace(/^.{1}/g, this.translate.instant('lang.insteadOf')[0].toLowerCase());
const opinionUserState: string = this.delegation.isDelegated ? `${this.translate.instant('lang.opinionUserState').toUpperCase()} ${delegateMsg} ${this.delegation.userDelegated}` : this.translate.instant('lang.opinionUserState');
const noteContent: string = `[${opinionUserState}] ${this.noteEditor.getNoteContent()}`;
const opinionUserState: string = this.translate.instant('lang.delegatedOpinion').concat(' ', this.delegation.userDelegated);
const noteContent: string = this.delegation.isDelegated ? `[${this.translate.instant('lang.opinionUserState')}] ${this.noteEditor.getNoteContent()}${opinionUserState}` : `[${this.translate.instant('lang.opinionUserState')}] ${this.noteEditor.getNoteContent()}`;
this.noteEditor.setNoteContent(noteContent);
this.http.put(this.data.processActionRoute, { resources: realResSelected, note: this.noteEditor.getNote()}).pipe(
tap((data: any) => {
......
......@@ -14,6 +14,9 @@
<b *ngIf="data.resIds.length > 1" color="primary" class="highlight">{{data.resIds.length}}
{{'lang.elements' | translate}}</b> ?
</div>
<app-maarch-message *ngIf="delegation.isDelegated && !noResourceToProcess" mode="danger">
{{'lang.signInsteadOf' | translate}}&nbsp;<b style="overflow: hidden;text-overflow: ellipsis;" [title]="delegation.userDelegated">{{ delegation.userDelegated }}</b>
</app-maarch-message>
<div *ngIf="resourcesError.length > 0" class="alert-message alert-message-danger mailList" role="alert">
<p>
{{'lang.canNotMakeAction' | translate}} :
......
......@@ -8,6 +8,7 @@ import { tap, finalize, catchError } from 'rxjs/operators';
import { of } from 'rxjs';
import { FunctionsService } from '@service/functions.service';
import { AvisWorkflowComponent } from '../../avis/avis-workflow.component';
import { HeaderService } from '@service/header.service';
@Component({
templateUrl: 'send-avis-parallel-action.component.html',
......@@ -30,11 +31,17 @@ export class SendAvisParallelComponent implements AfterViewInit {
availableRoles: any[] = [];
delegation: any = {
isDelegated: false,
userDelegated: null
};
constructor(
public translate: TranslateService,
public http: HttpClient,
private notify: NotificationService,
public dialogRef: MatDialogRef<SendAvisParallelComponent>,
public headerService: HeaderService,
@Inject(MAT_DIALOG_DATA) public data: any,
public functions: FunctionsService) { }
......@@ -44,6 +51,15 @@ export class SendAvisParallelComponent implements AfterViewInit {
if (this.appAvisWorkflow.emptyWorkflow()) {
this.appAvisWorkflow.loadDefaultWorkflow(this.data.resIds[0]);
}
const userId: number = parseInt(this.data.userId, 10);
this.delegation.isDelegated = userId !== this.headerService.user.id ? true : false;
if (this.delegation.isDelegated && !this.noResourceToProcess) {
this.http.get('../rest/users/' + userId).pipe(
tap((user: any) => {
this.delegation.userDelegated = `${user.firstname} ${user.lastname}`;
})
).subscribe();
}
}
}
......
......@@ -2519,5 +2519,6 @@
"updateOtp": "Edit external user",
"contactsParameters_sector": "Sector",
"company": "Company",
"noRecipient": "No associated recipient."
"noRecipient": "No associated recipient.",
"delegatedOpinion": "Opinion given instead of"
}
......@@ -2517,5 +2517,6 @@
"otpVisaUser": "L'utilisateur sera notifié par <b>courriel</b> au moment de son tour dans le circuit.",
"mustSign": "La position de signature pour les utilisateurs externes est obligatoire.",
"company": "Organisation",
"noRecipient": "Aucun destinataire associé."
"noRecipient": "Aucun destinataire associé.",
"delegatedOpinion": "Avis donné à 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