Skip to content
Snippets Groups Projects
Commit bea05191 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #15052 TIME 1:20 front check reply record management

parent debab4be
No related branches found
No related tags found
No related merge requests found
...@@ -476,4 +476,14 @@ An action page is described in a ACTIONPAGE tag : ...@@ -476,4 +476,14 @@ An action page is described in a ACTIONPAGE tag :
<MODULE>recordManagement</MODULE> <MODULE>recordManagement</MODULE>
<FLAG_CREATE>false</FLAG_CREATE> <FLAG_CREATE>false</FLAG_CREATE>
</ACTIONPAGE> </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> </ROOT>
...@@ -486,3 +486,6 @@ define('_REGISTERED_MAIL_NOT_DISTRIBUTED', 'Accusé de réception reçu : recomm ...@@ -486,3 +486,6 @@ define('_REGISTERED_MAIL_NOT_DISTRIBUTED', 'Accusé de réception reçu : recomm
define('_CONFIGURATION_UPDATED', 'Configuration modifiée'); define('_CONFIGURATION_UPDATED', 'Configuration modifiée');
define('_SEND_TO_RECORD_MANAGEMENT', 'Envoyer dans un Système d\'Archivage Électronique'); 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('_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
...@@ -42,6 +42,7 @@ import { SaveAndIndexRegisteredMailActionComponent } from './save-and-index-regi ...@@ -42,6 +42,7 @@ import { SaveAndIndexRegisteredMailActionComponent } from './save-and-index-regi
import { PrintRegisteredMailActionComponent } from './print-registered-mail-action/print-registered-mail-action.component'; 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 { PrintDepositListActionComponent } from './print-deposit-list-action/print-deposit-list-action.component';
import { SendToRecordManagementComponent } from './send-to-record-management/send-to-record-management.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() @Injectable()
export class ActionsService implements OnDestroy { export class ActionsService implements OnDestroy {
...@@ -1120,4 +1121,27 @@ export class ActionsService implements OnDestroy { ...@@ -1120,4 +1121,27 @@ export class ActionsService implements OnDestroy {
}) })
).subscribe(); ).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();
}
} }
<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>&nbsp;{{'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
.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
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();
}
}
...@@ -3,18 +3,17 @@ import { TranslateService } from '@ngx-translate/core'; ...@@ -3,18 +3,17 @@ import { TranslateService } from '@ngx-translate/core';
import { NotificationService } from '@service/notification/notification.service'; import { NotificationService } from '@service/notification/notification.service';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { NoteEditorComponent } from '../../notes/note-editor.component';
import { tap, exhaustMap, finalize, catchError } from 'rxjs/operators'; import { tap, exhaustMap, finalize, catchError } from 'rxjs/operators';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { FunctionsService } from '@service/functions.service'; import { FunctionsService } from '@service/functions.service';
import { NoteEditorComponent } from '@appRoot/notes/note-editor.component';
@Component({ @Component({
templateUrl: "close-mail-action.component.html", templateUrl: 'close-mail-action.component.html',
styleUrls: ['close-mail-action.component.scss'], styleUrls: ['close-mail-action.component.scss'],
}) })
export class CloseMailActionComponent implements OnInit { export class CloseMailActionComponent implements OnInit {
loading: boolean = false; loading: boolean = false;
@ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent; @ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent;
...@@ -25,14 +24,14 @@ export class CloseMailActionComponent implements OnInit { ...@@ -25,14 +24,14 @@ export class CloseMailActionComponent implements OnInit {
constructor( constructor(
public translate: TranslateService, public translate: TranslateService,
public http: HttpClient, public http: HttpClient,
private notify: NotificationService, private notify: NotificationService,
public dialogRef: MatDialogRef<CloseMailActionComponent>, public dialogRef: MatDialogRef<CloseMailActionComponent>,
@Inject(MAT_DIALOG_DATA) public data: any, @Inject(MAT_DIALOG_DATA) public data: any,
public functions: FunctionsService public functions: FunctionsService
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
if (this.data.resIds.length > 0) { if (this.data.resIds.length > 0) {
this.loading = true; this.loading = true;
this.checkClose(); this.checkClose();
...@@ -52,13 +51,13 @@ export class CloseMailActionComponent implements OnInit { ...@@ -52,13 +51,13 @@ export class CloseMailActionComponent implements OnInit {
let emptyFields: Array<any> = []; let emptyFields: Array<any> = [];
this.requiredFields.forEach((element: any) => { this.requiredFields.forEach((element: any) => {
for (let key of Object.keys(this.data.resource.customFields)) { 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); emptyFields.push(this.customFields.filter(elem => elem.id == key)[0].label);
} }
} }
}); });
if (!this.functions.empty(emptyFields)) { if (!this.functions.empty(emptyFields)) {
this.emptyMandatoryFields.push({'fields': emptyFields.join(", ")}); this.emptyMandatoryFields.push({ 'fields': emptyFields.join(', ') });
this.canCloseResIds = []; this.canCloseResIds = [];
} else { } else {
this.canCloseResIds = [1]; this.canCloseResIds = [1];
...@@ -68,7 +67,7 @@ export class CloseMailActionComponent implements OnInit { ...@@ -68,7 +67,7 @@ export class CloseMailActionComponent implements OnInit {
this.notify.handleSoftErrors(err); this.notify.handleSoftErrors(err);
return of(false); return of(false);
}) })
).subscribe() ).subscribe();
} }
checkClose() { checkClose() {
...@@ -82,12 +81,12 @@ export class CloseMailActionComponent implements OnInit { ...@@ -82,12 +81,12 @@ export class CloseMailActionComponent implements OnInit {
this.notify.handleSoftErrors(err); this.notify.handleSoftErrors(err);
return of(false); return of(false);
}) })
).subscribe() ).subscribe();
} }
onSubmit() { onSubmit() {
this.loading = true; this.loading = true;
if ( this.data.resIds.length === 0) { if (this.data.resIds.length === 0) {
this.indexDocumentAndExecuteAction(); this.indexDocumentAndExecuteAction();
} else { } else {
this.executeAction(); this.executeAction();
...@@ -99,7 +98,7 @@ export class CloseMailActionComponent implements OnInit { ...@@ -99,7 +98,7 @@ export class CloseMailActionComponent implements OnInit {
tap((data: any) => { tap((data: any) => {
this.data.resIds = [data.resId]; 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(() => { tap(() => {
this.dialogRef.close(this.data.resIds); this.dialogRef.close(this.data.resIds);
}), }),
...@@ -108,11 +107,11 @@ export class CloseMailActionComponent implements OnInit { ...@@ -108,11 +107,11 @@ export class CloseMailActionComponent implements OnInit {
this.notify.handleSoftErrors(err); this.notify.handleSoftErrors(err);
return of(false); return of(false);
}) })
).subscribe() ).subscribe();
} }
executeAction() { 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(() => { tap(() => {
this.dialogRef.close(this.canCloseResIds); this.dialogRef.close(this.canCloseResIds);
}), }),
......
...@@ -65,6 +65,7 @@ import { SaveAndPrintRegisteredMailActionComponent } from './actions/save-and-pr ...@@ -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 { 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 { 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 { 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 // PROCESS
...@@ -234,6 +235,7 @@ export class MyHammerConfig extends HammerGestureConfig { ...@@ -234,6 +235,7 @@ export class MyHammerConfig extends HammerGestureConfig {
PrintDepositListActionComponent, PrintDepositListActionComponent,
ReconcileActionComponent, ReconcileActionComponent,
SendToRecordManagementComponent, SendToRecordManagementComponent,
CheckReplyRecordManagementComponent,
], ],
exports : [ exports : [
SharedModule SharedModule
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
.mat-dialog-content { .mat-dialog-content {
height: 100%; height: 100%;
min-height: 150px;
max-height: 100% !important; max-height: 100% !important;
margin: 0px; margin: 0px;
position: relative; position: relative;
...@@ -107,6 +108,7 @@ ...@@ -107,6 +108,7 @@
.mat-dialog-content { .mat-dialog-content {
height: 100%; height: 100%;
min-height: 150px;
max-height: 100% !important; max-height: 100% !important;
margin: 0px; margin: 0px;
position: relative; position: relative;
......
...@@ -2066,5 +2066,7 @@ ...@@ -2066,5 +2066,7 @@
"sirenNumber": "Numéro SIREN", "sirenNumber": "Numéro SIREN",
"senderArchiveEntity": "Service versant", "senderArchiveEntity": "Service versant",
"descriptionLevel": "Niveau de description", "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"
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment