From dcebf7032ad9da1e8feb8809b4b49e436f83ef05 Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Tue, 25 Feb 2020 18:00:01 +0100 Subject: [PATCH] FEAT #12091 TIME 1:30 disable note restriction in avis --- .../continue-avis-circuit-action.component.html | 2 +- .../continue-avis-circuit-action.component.ts | 2 +- .../give-avis-parallel-action.component.html | 2 +- .../send-avis-parallel-action.component.html | 4 ++-- .../validate-avis-parallel-action.component.html | 4 ++-- .../send-avis-workflow-action.component.html | 4 ++-- ...close-mail-with-attachments-or-notes-action.component.html | 2 +- .../close-mail-with-attachments-or-notes-action.component.ts | 2 +- src/frontend/app/notes/note-editor.component.html | 2 +- src/frontend/app/notes/note-editor.component.ts | 4 ++++ 10 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.html b/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.html index eb239746b35..f4e26f2940a 100644 --- a/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.html +++ b/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.html @@ -51,7 +51,7 @@ readonly style="cursor:pointer;" disabled> </mat-form-field> - <app-note-editor #noteEditor [title]="lang.addOpinion" [resIds]="data.resIds"></app-note-editor> + <app-note-editor #noteEditor [title]="lang.addOpinion" [resIds]="data.resIds" [disableRestriction]="true"></app-note-editor> <app-avis-workflow *ngIf="data.resIds.length == 1" [adminMode]="false" [resId]="data.resIds[0]" #appAvisWorkflow> </app-avis-workflow> diff --git a/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.ts b/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.ts index 3e0764e92a2..bc181182fca 100644 --- a/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.ts +++ b/src/frontend/app/actions/avis-continue-circuit-action/continue-avis-circuit-action.component.ts @@ -79,7 +79,7 @@ export class ContinueAvisCircuitActionComponent implements OnInit { } executeAction(realResSelected: number[]) { - const noteContent: string = `[avis] ${this.noteEditor.getNoteContent()}`; + const noteContent: string = `[${this.lang.avisUserState}] ${this.noteEditor.getNoteContent()}`; this.noteEditor.setNoteContent(noteContent); this.http.put(this.data.processActionRoute, {resources : realResSelected, note: this.noteEditor.getNote()}).pipe( tap((data: any) => { diff --git a/src/frontend/app/actions/avis-give-parallel-action/give-avis-parallel-action.component.html b/src/frontend/app/actions/avis-give-parallel-action/give-avis-parallel-action.component.html index b8f5809ab56..67a3c663cc7 100644 --- a/src/frontend/app/actions/avis-give-parallel-action/give-avis-parallel-action.component.html +++ b/src/frontend/app/actions/avis-give-parallel-action/give-avis-parallel-action.component.html @@ -46,7 +46,7 @@ readonly style="cursor:pointer;" disabled> </mat-form-field> - <app-note-editor #noteEditor [title]="lang.addOpinion" [resIds]="data.resIds"></app-note-editor> + <app-note-editor #noteEditor [title]="lang.addOpinion" [resIds]="data.resIds" [disableRestriction]="true"></app-note-editor> </mat-sidenav-content> </mat-sidenav-container> </div> diff --git a/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.html b/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.html index f5982e0a980..83078a21933 100644 --- a/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.html +++ b/src/frontend/app/actions/avis-parallel-send-action/send-avis-parallel-action.component.html @@ -35,7 +35,7 @@ </mat-icon> </button> </mat-form-field> - <app-note-editor #noteEditor [title]="lang.addOpinionReason" [resIds]="data.resIds"></app-note-editor> + <app-note-editor #noteEditor [title]="lang.addOpinionReason" [resIds]="data.resIds" [disableRestriction]="true"></app-note-editor> <app-avis-workflow *ngIf="data.resIds.length == 1 || (!noResourceToProcess && data.resIds.length > 1)" [adminMode]="true" [mode]="'parallel'" #appAvisWorkflow> </app-avis-workflow> @@ -46,4 +46,4 @@ <button mat-raised-button mat-button color="primary" [disabled]="loading || !isValidAction()" (click)="onSubmit()">{{lang.validate}}</button> <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button> -</div> \ No newline at end of file +</div> diff --git a/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.html b/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.html index 70b3fb63550..94255e76dbc 100644 --- a/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.html +++ b/src/frontend/app/actions/avis-parallel-validate-action/validate-avis-parallel-action.component.html @@ -45,7 +45,7 @@ </mat-icon> </button> </mat-form-field> - <app-note-editor *ngIf="data.resIds.length === 1 && !noResourceToProcess" #noteEditor [title]="lang.addOpinionReason" [content]="opinionContent" [resIds]="data.resIds"></app-note-editor> + <app-note-editor *ngIf="data.resIds.length === 1 && !noResourceToProcess" #noteEditor [title]="lang.addOpinionReason" [content]="opinionContent" [resIds]="data.resIds" [disableRestriction]="true"></app-note-editor> <app-avis-workflow *ngIf="data.resIds.length === 1 && !noResourceToProcess" [adminMode]="true" [mode]="'parallel'" #appAvisWorkflow> </app-avis-workflow> @@ -56,4 +56,4 @@ <button mat-raised-button mat-button color="primary" [disabled]="loading || !isValidAction()" (click)="onSubmit()">{{lang.validate}}</button> <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button> -</div> \ No newline at end of file +</div> diff --git a/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.html b/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.html index 7b65e8093b5..463126d2dd7 100644 --- a/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.html +++ b/src/frontend/app/actions/avis-workflow-send-action/send-avis-workflow-action.component.html @@ -35,7 +35,7 @@ </mat-icon> </button> </mat-form-field> - <app-note-editor #noteEditor [title]="lang.addOpinionReason" [resIds]="data.resIds"></app-note-editor> + <app-note-editor #noteEditor [title]="lang.addOpinionReason" [resIds]="data.resIds" [disableRestriction]="true"></app-note-editor> <app-avis-workflow *ngIf="data.resIds.length == 1 || (!noResourceToProcess && data.resIds.length > 1)" [adminMode]="true" #appAvisWorkflow> </app-avis-workflow> @@ -46,4 +46,4 @@ <button mat-raised-button mat-button color="primary" [disabled]="loading || !isValidAction()" (click)="onSubmit()">{{lang.validate}}</button> <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button> -</div> \ No newline at end of file +</div> diff --git a/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.html b/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.html index dc57b1a6b8c..b844452d495 100644 --- a/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.html +++ b/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.html @@ -36,7 +36,7 @@ </div> <div mat-dialog-actions class="actions"> <button mat-raised-button mat-button color="primary" - [disabled]="loading || (resourcesInfo.noAttachmentsNotes.length > 0 && !checkNote())" + [disabled]="loading || (resourcesInfo.noAttachmentsNotes !== undefined && resourcesInfo.noAttachmentsNotes.length > 0 && !checkNote())" (click)="onSubmit()">{{lang.validate}}</button> <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button> </div> diff --git a/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.ts b/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.ts index ad50d8d8767..fd6d73af81b 100644 --- a/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.ts +++ b/src/frontend/app/actions/close-mail-with-attachments-or-notes-action/close-mail-with-attachments-or-notes-action.component.ts @@ -46,7 +46,7 @@ export class closeMailWithAttachmentsOrNotesActionComponent implements OnInit { checkNote () { if (this.noteEditor) { - if (this.noteEditor.getNote()) { + if (this.noteEditor.getNoteContent()) { return true; } } diff --git a/src/frontend/app/notes/note-editor.component.html b/src/frontend/app/notes/note-editor.component.html index 4ee88a9758d..e8dcd4b92d7 100644 --- a/src/frontend/app/notes/note-editor.component.html +++ b/src/frontend/app/notes/note-editor.component.html @@ -7,7 +7,7 @@ <button mat-menu-item [matMenuTriggerFor]="menuTemplates" (menuOpened)="getTemplatesNote()"> <span>{{lang.noteTemplates}}</span> </button> - <button mat-menu-item [matMenuTriggerFor]="menuEntities"> + <button mat-menu-item [matMenuTriggerFor]="menuEntities" *ngIf="!disableRestriction"> <span>{{lang.visibleBy}}</span> </button> </mat-menu> diff --git a/src/frontend/app/notes/note-editor.component.ts b/src/frontend/app/notes/note-editor.component.ts index 3333794abb1..6b8b25efc11 100644 --- a/src/frontend/app/notes/note-editor.component.ts +++ b/src/frontend/app/notes/note-editor.component.ts @@ -34,6 +34,7 @@ export class NoteEditorComponent implements OnInit { @Input('entitiesNoteRestriction') entitiesNoteRestriction: string[]; @Input('noteId') noteId: number; @Input('defaultRestriction') defaultRestriction: boolean; + @Input('disableRestriction') disableRestriction: boolean = false; @Output('refreshNotes') refreshNotes = new EventEmitter<string>(); searchTerm: FormControl = new FormControl(); @@ -55,6 +56,9 @@ export class NoteEditorComponent implements OnInit { if (this.upMode) { this.content = this.noteContent; + if (this.content.startsWith(`[${this.lang.avisUserState}]`) || this.content.startsWith(`[${this.lang.avisUserAsk.toUpperCase()}]`)) { + this.disableRestriction = true; + } this.entitiesRestriction = this.entitiesNoteRestriction; } -- GitLab