Commit 3e57817c authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #17812 TIME 0:10 use headerService + data from the back + wording

parent b66b4bd5
......@@ -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.2b8be0ef5318730b3eed.js" type="module"></script><script src="main-es5.2b8be0ef5318730b3eed.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.792585df43ad12e9807f.js" type="module"></script><script src="main-es5.792585df43ad12e9807f.js" nomodule defer></script></body>
</html>
\ No newline at end of file
......@@ -80,7 +80,7 @@ export class ContinueAvisCircuitActionComponent implements OnInit {
}
executeAction(realResSelected: number[]) {
const noteContent: string = `[${this.translate.instant('lang.avisUserState')}] ${this.noteEditor.getNoteContent()}`;
const noteContent: string = `[${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) => {
......
......@@ -7,6 +7,7 @@ import { NoteEditorComponent } from '../../notes/note-editor.component';
import { tap, finalize, catchError } from 'rxjs/operators';
import { of } from 'rxjs';
import { FunctionsService } from '@service/functions.service';
import { HeaderService } from '@service/header.service';
@Component({
templateUrl: 'give-avis-parallel-action.component.html',
......@@ -40,10 +41,11 @@ export class GiveAvisParallelActionComponent implements OnInit {
private notify: NotificationService,
public dialogRef: MatDialogRef<GiveAvisParallelActionComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
public functions: FunctionsService) { }
public functions: FunctionsService,
public headerService: HeaderService
) { }
async ngOnInit() {
await this.isRedirected();
ngOnInit() {
this.checkAvisParallel();
}
......@@ -68,6 +70,11 @@ export class GiveAvisParallelActionComponent implements OnInit {
this.opinionLimitDate = new Date(data.resourcesInformations.success[0].opinionLimitDate);
this.opinionLimitDate = this.functions.formatDateObjectToDateString(this.opinionLimitDate);
}
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.delegation.userDelegated = data.resourcesInformations.success[0].delegatingUser;
}
}),
finalize(() => this.loading = false),
catchError((err: any) => {
......@@ -85,8 +92,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 avisUserState: string = this.delegation.isDelegated ? `${this.translate.instant('lang.avisUserState').toUpperCase()} ${delegateMsg} ${this.delegation.userDelegated}` : this.translate.instant('lang.avisUserState');
const noteContent: string = `[${avisUserState}] ${this.noteEditor.getNoteContent()}`;
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()}`;
this.noteEditor.setNoteContent(noteContent);
this.http.put(this.data.processActionRoute, { resources: realResSelected, note: this.noteEditor.getNote()}).pipe(
tap((data: any) => {
......@@ -108,27 +115,4 @@ export class GiveAvisParallelActionComponent implements OnInit {
isValidAction() {
return !this.noResourceToProcess && !this.functions.empty(this.noteEditor.getNoteContent());
}
isRedirected() {
return new Promise((resolve) => {
this.http.get('../rest/currentUser/profile').pipe(
tap((data: any) => {
const userId: number = parseInt(this.data.userId, 10);
this.delegation.isDelegated = userId !== data.id ? true : false;
if (this.delegation.isDelegated) {
this.http.get('../rest/users/' + userId).pipe(
tap((user: any) => {
this.delegation.userDelegated = `${user.firstname} ${user.lastname}`;
})
).subscribe();
}
resolve(true);
}),
catchError((err: any) => {
this.notify.handleErrors(err);
return of(false);
})
).subscribe();
});
}
}
......@@ -55,7 +55,7 @@ export class NoteEditorComponent implements OnInit {
if (this.upMode) {
this.content = this.noteContent;
if (this.content.startsWith(`[${this.translate.instant('lang.avisUserState')}]`) || this.content.startsWith(`[${this.translate.instant('lang.avisUserAsk').toUpperCase()}]`)) {
if (this.content.startsWith(`[${this.translate.instant('lang.opinionUserState')}]`) || this.content.startsWith(`[${this.translate.instant('lang.avisUserAsk').toUpperCase()}]`)) {
this.disableRestriction = true;
}
this.entitiesRestriction = this.entitiesNoteRestriction;
......
......@@ -206,7 +206,7 @@
"avisAnswerDesc": "Allow this group to appear in the counsellor's list (sequential and parallel opinion workflow)",
"avisSent": "Opinion given",
"avisUserAsk": "for opinion",
"avisUserState": "opinion",
"opinionUserState": "opinion",
"avisWorkflowDeleted": "Opinion workflow deleted",
"avisWorkflowUpdated": "Opinion workflow updated",
"back": "Back",
......
......@@ -212,7 +212,7 @@
"avisAnswerDesc": "Permet à ce groupe d'apparaître dans la liste des personnes pouvant donner son avis (parallèle et séquentiel)",
"avisSent": "Avis donné",
"avisUserAsk": "pour avis",
"avisUserState": "avis",
"opinionUserState": "avis",
"avisWorkflowDeleted": "Circuit d'avis supprimé",
"avisWorkflowUpdated": "Circuit d'avis modifié",
"back": "Retour",
......
......@@ -1471,7 +1471,7 @@
"askOpinion": "Several users ask your opinion__TO_TRANSLATE",
"askOpinionUser": "ask your opinion__TO_TRANSLATE",
"avisUserAsk": "for opinion__TO_TRANSLATE",
"avisUserState": "opinion__TO_TRANSLATE",
"opinionUserState": "opinion__TO_TRANSLATE",
"userNotInDiffusionList": "You are not in opinion diffusion list__TO_TRANSLATE",
"noOpinionLimitDate": "The opinion limit date is not defined__TO_TRANSLATE",
"noOpinionNote": "The reason is not defined__TO_TRANSLATE",
......
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