diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index 9e26703122ab96e6548880809c1d32d326e347d6..c1fc6c52f60a16e098ba3cf1d16eac4101073485 100755 --- a/core/xml/actions_pages.xml +++ b/core/xml/actions_pages.xml @@ -476,4 +476,14 @@ An action page is described in a ACTIONPAGE tag : <MODULE>recordManagement</MODULE> <FLAG_CREATE>false</FLAG_CREATE> </ACTIONPAGE> + <ACTIONPAGE> + <ID>checkReplyRecordManagement</ID> + <LABEL>_CHECK_REPLY_RECORD_MANAGEMENT</LABEL> + <NAME>checkReplyRecordManagement</NAME> + <DESC>_CHECK_REPLY_RECORD_MANAGEMENT_DESC</DESC> + <component>checkReplyRecordManagementAction</component> + <ORIGIN>apps</ORIGIN> + <MODULE>recordManagement</MODULE> + <FLAG_CREATE>false</FLAG_CREATE> + </ACTIONPAGE> </ROOT> diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index a2f114cc290259c030200ac2d4fc0216234e54b1..3c657978255cca48c2325f04d8668c5332ee6da4 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -486,3 +486,6 @@ define('_REGISTERED_MAIL_NOT_DISTRIBUTED', 'Accusé de réception reçu : recomm define('_CONFIGURATION_UPDATED', 'Configuration modifiée'); define('_SEND_TO_RECORD_MANAGEMENT', 'Envoyer dans un Système d\'Archivage Électronique'); define('_SEND_TO_RECORD_MANAGEMENT_DESC', 'Envoyer dans un Système d\'Archivage Électronique'); + +define('_CHECK_REPLY_RECORD_MANAGEMENT', 'Vérification de la réponse au transfert'); +define('_CHECK_REPLY_RECORD_MANAGEMENT_DESC', 'Vérification de la réponse au transfert'); \ No newline at end of file diff --git a/src/frontend/app/actions/actions.service.ts b/src/frontend/app/actions/actions.service.ts index fc8afe9e30eaccbdabd5ef869d0ba8175ff9c199..0804f7c7ea2323ded3e672dc362c88649025bae3 100644 --- a/src/frontend/app/actions/actions.service.ts +++ b/src/frontend/app/actions/actions.service.ts @@ -42,6 +42,7 @@ import { SaveAndIndexRegisteredMailActionComponent } from './save-and-index-regi import { PrintRegisteredMailActionComponent } from './print-registered-mail-action/print-registered-mail-action.component'; import { PrintDepositListActionComponent } from './print-deposit-list-action/print-deposit-list-action.component'; import { SendToRecordManagementComponent } from './send-to-record-management/send-to-record-management.component'; +import { CheckReplyRecordManagementComponent } from './check-reply-record-management/check-reply-record-management.component'; @Injectable() export class ActionsService implements OnDestroy { @@ -1120,4 +1121,27 @@ export class ActionsService implements OnDestroy { }) ).subscribe(); } + + checkReplyRecordManagementAction(options: any = null) { + const dialogRef = this.dialog.open(CheckReplyRecordManagementComponent, { + panelClass: 'maarch-modal', + autoFocus: false, + disableClose: true, + data: this.setDatasActionToSend() + }); + dialogRef.afterClosed().pipe( + tap((data: any) => { + this.unlockResourceAfterActionModal(data); + }), + filter((data: string) => data === 'success'), + tap((result: any) => { + this.endAction(result); + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } } diff --git a/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.html b/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.html new file mode 100644 index 0000000000000000000000000000000000000000..feed343fd65c6be281de2560f2aec0fd3d10710e --- /dev/null +++ b/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.html @@ -0,0 +1,48 @@ +<div class="mat-dialog-content-container"> + <h1 mat-dialog-title>{{data.action.label}}</h1> + <div mat-dialog-content> + <div *ngIf="checking" class="checking" color="primary" style="display:flex;height:100%;justify-content: center;padding: 30px;"> + <mat-spinner diameter="24"></mat-spinner> {{'lang.checkInProgress' | translate}} ... + </div> + <div *ngIf="loading" class="loading" color="primary"> + <mat-spinner></mat-spinner> + </div> + <div class="row" *ngIf="!checking"> + <div class="alert-message alert-message-info" role="alert" style="margin-top: 0px;" [innerHTML]="'lang.checkReplyRecordManagementDesc' | translate"></div> + <ng-container *ngIf="data.resIds.length > 0"> + <div class="col-md-12"> + {{'lang.makeActionOn' | translate}} + <b *ngIf="data.resIds.length === 0" color="primary" + class="highlight">{{'lang.currentIndexingMail' | translate}}</b> + <b *ngIf="data.resIds.length === 1" color="primary" class="highlight">{{data.resource.chrono}}</b> + <b *ngIf="data.resIds.length > 1" color="primary" class="highlight">{{data.resIds.length}} + {{'lang.elements' | translate}}</b> ? + </div> + <div class="col-md-12"> + <div *ngIf="resourcesErrors.length > 0" class="alert-message alert-message-danger mailList" + style="max-width: 100%;"> + <p> + {{'lang.canNotMakeAction' | translate}} : + </p> + <ul> + <li *ngFor="let ressource of resourcesErrors"> + <b>{{ressource.alt_identifier}}</b> : {{'lang.' + ressource.reason | translate}} + </li> + </ul> + </div> + </div> + <div *ngIf="!selectedRes.length === 0" class="col-md-12"> + <div class="alert-message alert-message-info" role="alert" style="max-width: 100%;" + [innerHTML]="data.resIds.length === 1 ? this.translate.instant('lang.reconcileMsg') : this.translate.instant('lang.reconcileMsg') + '<br/>' + this.translate.instant('lang.reconcileMsg2')"> + </div> + </div> + </ng-container> + </div> + </div> + <span class="divider-modal"></span> + <div mat-dialog-actions class="actions"> + <button mat-raised-button mat-button color="primary" [disabled]="loading || selectedRes.length == 0" + (click)="onSubmit()">{{'lang.validate' | translate}}</button> + <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{'lang.cancel' | translate}}</button> + </div> +</div> \ No newline at end of file diff --git a/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.scss b/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..f978990ea48d1a45ad7ede579a2f45df704671b6 --- /dev/null +++ b/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.scss @@ -0,0 +1,20 @@ +.loading { + position: absolute; + display: flex; + height: 100%; + justify-content: center; + width: 100%; + left: 0px; + top: 0px; + align-items: center; + z-index: 1; + background: rgba(255, 255, 255, 0.8); +} + +.checking { + display: flex; + height: 100%; + justify-content: center; + align-items: center; + padding: 30px; +} \ No newline at end of file diff --git a/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.ts b/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..0fa4d1541e02fcbac9b3626afbfba3e81f847f91 --- /dev/null +++ b/src/frontend/app/actions/check-reply-record-management/check-reply-record-management.component.ts @@ -0,0 +1,81 @@ +import { HttpClient } from '@angular/common/http'; +import { Component, Inject, OnInit, ViewChild } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { NoteEditorComponent } from '@appRoot/notes/note-editor.component'; +import { TranslateService } from '@ngx-translate/core'; +import { FunctionsService } from '@service/functions.service'; +import { NotificationService } from '@service/notification/notification.service'; +import { of } from 'rxjs'; +import { catchError, finalize, tap } from 'rxjs/operators'; + +@Component({ + selector: 'app-check-reply-record-management', + templateUrl: './check-reply-record-management.component.html', + styleUrls: ['./check-reply-record-management.component.scss'] +}) +export class CheckReplyRecordManagementComponent implements OnInit { + + loading: boolean = false; + checking: boolean = true; + resourcesErrors: any[] = []; + selectedRes: number[] = []; + + @ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent; + + constructor( + public translate: TranslateService, + public http: HttpClient, + private notify: NotificationService, + public dialogRef: MatDialogRef<CheckReplyRecordManagementComponent>, + @Inject(MAT_DIALOG_DATA) public data: any, + public functions: FunctionsService + ) { } + + ngOnInit(): void { + // this.checkReply(); + + // FOR TEST + setTimeout(() => { + this.checking = false; + this.selectedRes = this.data.resIds; + }, 2000); + } + + checkReply() { + this.http.post(`../rest/resourcesList/users/${this.data.userId}/groups/${this.data.groupId}/baskets/${this.data.basketId}/actions/${this.data.action.id}/checkCloseWithFieldsAction`, { resources: this.data.resIds }).pipe( + tap((data: any) => { + // TO DO + this.resourcesErrors = data.errors; + this.selectedRes = data.success; + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleSoftErrors(err); + return of(false); + }) + ).subscribe(); + } + + onSubmit() { + this.loading = true; + // this.executeAction(); + + // FOR TEST + setTimeout(() => { + this.loading = false; + }, 3000); + } + + executeAction() { + this.http.put(this.data.processActionRoute, { resources: this.selectedRes, note: this.noteEditor.getNote() }).pipe( + tap(() => { + this.dialogRef.close(this.selectedRes); + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleSoftErrors(err); + return of(false); + }) + ).subscribe(); + } +} diff --git a/src/frontend/app/actions/close-mail-action/close-mail-action.component.ts b/src/frontend/app/actions/close-mail-action/close-mail-action.component.ts index 87aca5498ff74d317a3b16dbff0711dc7a63642f..508a9b21a58c41119743d5c95291a310f2b08a09 100644 --- a/src/frontend/app/actions/close-mail-action/close-mail-action.component.ts +++ b/src/frontend/app/actions/close-mail-action/close-mail-action.component.ts @@ -3,18 +3,17 @@ import { TranslateService } from '@ngx-translate/core'; import { NotificationService } from '@service/notification/notification.service'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { HttpClient } from '@angular/common/http'; -import { NoteEditorComponent } from '../../notes/note-editor.component'; import { tap, exhaustMap, finalize, catchError } from 'rxjs/operators'; import { of } from 'rxjs'; import { FunctionsService } from '@service/functions.service'; +import { NoteEditorComponent } from '@appRoot/notes/note-editor.component'; @Component({ - templateUrl: "close-mail-action.component.html", + templateUrl: 'close-mail-action.component.html', styleUrls: ['close-mail-action.component.scss'], }) export class CloseMailActionComponent implements OnInit { - loading: boolean = false; @ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent; @@ -25,14 +24,14 @@ export class CloseMailActionComponent implements OnInit { constructor( public translate: TranslateService, - public http: HttpClient, - private notify: NotificationService, + public http: HttpClient, + private notify: NotificationService, public dialogRef: MatDialogRef<CloseMailActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any, public functions: FunctionsService ) { } - ngOnInit(): void { + ngOnInit(): void { if (this.data.resIds.length > 0) { this.loading = true; this.checkClose(); @@ -52,13 +51,13 @@ export class CloseMailActionComponent implements OnInit { let emptyFields: Array<any> = []; this.requiredFields.forEach((element: any) => { for (let key of Object.keys(this.data.resource.customFields)) { - if (element == 'indexingCustomField_' + key && this.functions.empty(this.data.resource.customFields[key])) { + if (element === 'indexingCustomField_' + key && this.functions.empty(this.data.resource.customFields[key])) { emptyFields.push(this.customFields.filter(elem => elem.id == key)[0].label); } } }); if (!this.functions.empty(emptyFields)) { - this.emptyMandatoryFields.push({'fields': emptyFields.join(", ")}); + this.emptyMandatoryFields.push({ 'fields': emptyFields.join(', ') }); this.canCloseResIds = []; } else { this.canCloseResIds = [1]; @@ -68,7 +67,7 @@ export class CloseMailActionComponent implements OnInit { this.notify.handleSoftErrors(err); return of(false); }) - ).subscribe() + ).subscribe(); } checkClose() { @@ -82,12 +81,12 @@ export class CloseMailActionComponent implements OnInit { this.notify.handleSoftErrors(err); return of(false); }) - ).subscribe() + ).subscribe(); } onSubmit() { this.loading = true; - if ( this.data.resIds.length === 0) { + if (this.data.resIds.length === 0) { this.indexDocumentAndExecuteAction(); } else { this.executeAction(); @@ -99,7 +98,7 @@ export class CloseMailActionComponent implements OnInit { tap((data: any) => { this.data.resIds = [data.resId]; }), - exhaustMap(() => this.http.put(this.data.indexActionRoute, {resource : this.data.resIds[0], note : this.noteEditor.getNote()})), + exhaustMap(() => this.http.put(this.data.indexActionRoute, { resource: this.data.resIds[0], note: this.noteEditor.getNote() })), tap(() => { this.dialogRef.close(this.data.resIds); }), @@ -108,11 +107,11 @@ export class CloseMailActionComponent implements OnInit { this.notify.handleSoftErrors(err); return of(false); }) - ).subscribe() + ).subscribe(); } executeAction() { - this.http.put(this.data.processActionRoute, {resources : this.canCloseResIds, note : this.noteEditor.getNote()}).pipe( + this.http.put(this.data.processActionRoute, { resources: this.canCloseResIds, note: this.noteEditor.getNote() }).pipe( tap(() => { this.dialogRef.close(this.canCloseResIds); }), diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index fb8eb18e317b801c1917856a255379ef2260db3a..4183df23cc9cfebe313f2d5b9f722e89ae4392ef 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -65,6 +65,7 @@ import { SaveAndPrintRegisteredMailActionComponent } from './actions/save-and-pr import { PrintRegisteredMailActionComponent } from './actions/print-registered-mail-action/print-registered-mail-action.component'; import { PrintDepositListActionComponent } from './actions/print-deposit-list-action/print-deposit-list-action.component'; import { SendToRecordManagementComponent } from './actions/send-to-record-management/send-to-record-management.component'; +import { CheckReplyRecordManagementComponent } from './actions/check-reply-record-management/check-reply-record-management.component'; // PROCESS @@ -234,6 +235,7 @@ export class MyHammerConfig extends HammerGestureConfig { PrintDepositListActionComponent, ReconcileActionComponent, SendToRecordManagementComponent, + CheckReplyRecordManagementComponent, ], exports : [ SharedModule diff --git a/src/frontend/css/maarch-material-modal.scss b/src/frontend/css/maarch-material-modal.scss index 0daf9d1e2541dc858b69c8e1df7bceb6fdd6f738..54fd4313ac38677164ac850e032b78c8f939765e 100644 --- a/src/frontend/css/maarch-material-modal.scss +++ b/src/frontend/css/maarch-material-modal.scss @@ -53,6 +53,7 @@ .mat-dialog-content { height: 100%; + min-height: 150px; max-height: 100% !important; margin: 0px; position: relative; @@ -107,6 +108,7 @@ .mat-dialog-content { height: 100%; + min-height: 150px; max-height: 100% !important; margin: 0px; position: relative; diff --git a/src/lang/lang-fr.json b/src/lang/lang-fr.json index bbb07f4f402ee0064377e8ff38a5ebed2bcd77c0..ceda8d33cc01824ef3424c22d090b27df25f9055 100644 --- a/src/lang/lang-fr.json +++ b/src/lang/lang-fr.json @@ -2066,5 +2066,7 @@ "sirenNumber": "Numéro SIREN", "senderArchiveEntity": "Service versant", "descriptionLevel": "Niveau de description", - "archiveId": "Identifiant de l'archive" + "archiveId": "Identifiant de l'archive", + "checkReplyRecordManagementDesc": "Vérifie les <b>réponses</b> des paquets transférés au <b>système d'archivage</b>", + "checkInProgress": "Vérification en cours" }