diff --git a/lang/fr.json b/lang/fr.json index de6c88b1693db279650a071271f394c3be88da81..27c7ded44f1aa945202f408d0a0c4935e2b9b037 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -324,7 +324,7 @@ "inca_card": "Carte agent", "eidas": "Eidas", "rgs_2stars": "Rgs**", - "noAssociatedGroup": "L'utilisateur appartient à aucun groupe", + "noAssociatedGroup": "L'utilisateur n'appartient à aucun groupe", "docToSign": "Document à signer", "attachDocToSign": "Annexe attaché au(x) document(s) à signer", "titleSearch": "Sujet du document à signer", diff --git a/src/app/document/controllers/DocumentController.php b/src/app/document/controllers/DocumentController.php index 628db305d3af7d8ad639a9a550e6458b92e8e65b..a9ae4a8aef4d33ac8ceac6d69994ad8f68cb65c9 100755 --- a/src/app/document/controllers/DocumentController.php +++ b/src/app/document/controllers/DocumentController.php @@ -171,7 +171,7 @@ class DocumentController } } - $workflow = WorkflowModel::getByDocumentId(['select' => ['user_id', 'mode', 'process_date', 'signature_mode', 'status'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]); + $workflow = WorkflowModel::getByDocumentId(['select' => ['user_id', 'mode', 'process_date', 'signature_mode', 'status', 'note'], 'documentId' => $args['id'], 'orderBy' => ['"order"']]); $currentFound = false; foreach ($workflow as $value) { if (!empty($value['process_date'])) { @@ -187,7 +187,8 @@ class DocumentController 'processDate' => $value['process_date'], 'current' => !$currentFound && empty($value['status']), 'signatureMode' => $value['signature_mode'], - 'userSignatureModes' => json_decode($userSignaturesModes['signature_modes'], true) + 'userSignatureModes' => json_decode($userSignaturesModes['signature_modes'], true), + 'note' => $value['note'] ]; if (empty($value['status'])) { $currentFound = true; @@ -239,6 +240,8 @@ class DocumentController $content = DocumentController::getContentPath(['id' => $args['id'], 'eSignDocument' => $queryParams['eSignDocument']]); if (!empty($content['errors'])) { return $response->withStatus($content['code'])->withJson(['errors' => $content['errors']]); + } elseif (empty($content['path'])) { + return $response->withStatus(404)->withJson(['encodedDocument' => null]); } $pathToDocument = $content['path']; diff --git a/src/frontend/app/document/document.component.html b/src/frontend/app/document/document.component.html index 823ee4201cdb6870ddc3fbbaabe5145d96defe4e..d6724986b1a119feb08a23fca5f6a9637e9f1982 100755 --- a/src/frontend/app/document/document.component.html +++ b/src/frontend/app/document/document.component.html @@ -48,7 +48,7 @@ <ion-label style="font-size: 13px;">{{'lang.convertingDocument' | translate}}</ion-label> </ion-toolbar> <ion-content *ngIf="!loadingdocument" #mainContent> - <ng-container *ngIf="mainDocument.notes !== undefined && mainDocument.notes !== null"> + <ng-container *ngIf="(mainDocument.notes !== undefined && mainDocument.notes !== null) || hasWorkflowNotes"> <ion-fab-button *ngIf="!expandedNote" ngDraggable [bounds]="myBounds" [inBounds]="true" (movingOffset)="signaturesService.dragging=true" (endOffset)="signaturesService.dragging=false" [title]="'lang.expandNote' | translate" (click)="expandedNote = true;" @@ -63,12 +63,24 @@ <i class="fa fa-minus-square" style="cursor: pointer;" (click)="expandedNote = false;" [title]="'lang.collapseNote' | translate"></i> </div> - <div class="note-creator"> - {{mainDocument.notes.creator}} : - </div> - <div class="note-content"> - {{mainDocument.notes.value}} - </div> + <ng-container *ngIf="mainDocument.notes !== undefined && mainDocument.notes !== null"> + <div class="note-creator"> + {{mainDocument.notes.creator}} ({{mainDocument.notes.creationDate}}) : + </div> + <div class="note-content"> + {{mainDocument.notes.value}} + </div> + </ng-container> + <ng-container *ngFor="let step of mainDocument.workflow"> + <div *ngIf="step.note"> + <div class="note-creator"> + {{step.userDisplay}} ({{step.processDate}}) : + </div> + <div class="note-content"> + {{step.note}} + </div> + </div> + </ng-container> </div> </ng-container> <div style="display: contents;"> diff --git a/src/frontend/app/document/document.component.scss b/src/frontend/app/document/document.component.scss index a2ddfdcbef887c0c732b4c96039c514dfdff54a1..7ee034ad6de82ee29b0931e387ad4c0e9ecedcf9 100644 --- a/src/frontend/app/document/document.component.scss +++ b/src/frontend/app/document/document.component.scss @@ -344,7 +344,7 @@ button.disabled { } &-content { - padding: 10px; + padding: 0 10px 10px 10px; color: #4F4F4F; } } diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index 49e6fa18aea19998e3e114451c9d619f171d5957..932c1db3fb27c791db856fe20512e1a027888591 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -10,9 +10,7 @@ import { HttpClient } from '@angular/common/http'; import { NotificationService } from '../service/notification.service'; import { CookieService } from 'ngx-cookie-service'; import { DocumentNotePadComponent } from '../documentNotePad/document-note-pad.component'; -import { WarnModalComponent } from '../modal/warn-modal.component'; import { RejectInfoBottomSheetComponent } from '../modal/reject-info.component'; -import { ConfirmModalComponent } from '../modal/confirm-modal.component'; import { SuccessInfoValidBottomSheetComponent } from '../modal/success-info-valid.component'; import { TranslateService } from '@ngx-translate/core'; import { DocumentListComponent } from './document-list/document-list.component'; @@ -20,10 +18,9 @@ import { AuthService } from '../service/auth.service'; import { LocalStorageService } from '../service/local-storage.service'; import { ActionSheetController, AlertController, LoadingController, MenuController, ModalController } from '@ionic/angular'; import { NgxExtendedPdfViewerService } from 'ngx-extended-pdf-viewer'; -import { catchError, finalize, tap } from 'rxjs/operators'; +import { catchError, tap } from 'rxjs/operators'; import { of } from 'rxjs'; - @Component({ selector: 'app-document', templateUrl: 'document.component.html', @@ -78,6 +75,7 @@ export class DocumentComponent implements OnInit { loadingUI: any = false; expandedNote: boolean = true; + hasWorkflowNotes: boolean = false; currentTool = 'info'; load: HTMLIonLoadingElement = null; dragging: boolean = false; @@ -308,6 +306,9 @@ export class DocumentComponent implements OnInit { this.mainDocument = data.document; this.mainDocument.workflow = this.mainDocument.workflow.map((item: any) => { + if (item.note) { + this.hasWorkflowNotes = true; + } item.userSignatureModes.unshift('visa'); return { ...item, @@ -583,13 +584,13 @@ export class DocumentComponent implements OnInit { buttons: [ { text: this.translate.instant('lang.rejectDocument'), - handler: () => { + handler: (data: any) => { this.loadingController.create({ message: this.translate.instant('lang.processing') + ' ...', spinner: 'dots' }).then(async (load: HTMLIonLoadingElement) => { load.present(); - const res = await this.sendDocument(); + const res = await this.sendDocument({'note': data.paragraph}); if (res) { const config: MatBottomSheetConfig = { disableClose: true, @@ -623,13 +624,13 @@ export class DocumentComponent implements OnInit { buttons: [ { text: this.translate.instant('lang.validate'), - handler: () => { + handler: (data: any) => { this.loadingController.create({ message: this.translate.instant('lang.processing') + ' ...', spinner: 'dots' }).then(async (load: HTMLIonLoadingElement) => { load.present(); - const res = await this.sendDocument(); + const res = await this.sendDocument({'note': data.paragraph}); if (res) { const config: MatBottomSheetConfig = { disableClose: true, @@ -648,7 +649,7 @@ export class DocumentComponent implements OnInit { await alert.present(); } - sendDocument() { + sendDocument(data: any) { return new Promise((resolve) => { const signatures: any[] = []; if (this.signaturesService.currentAction > 0) { @@ -683,7 +684,7 @@ export class DocumentComponent implements OnInit { } } - this.http.put('../rest/documents/' + this.signaturesService.mainDocumentId + '/actions/' + this.signaturesService.currentAction, { 'signatures': signatures }) + this.http.put('../rest/documents/' + this.signaturesService.mainDocumentId + '/actions/' + this.signaturesService.currentAction, { 'signatures': signatures, 'note': data.note }) .pipe( tap(() => { if (this.signaturesService.documentsList[this.signaturesService.indexDocumentsList] !== undefined) {