diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php index a3f1d908c8bafc7af550cbf1171caa229bd692c4..99be5394e77d7187a6b8ba0853d5153b5f4399c3 100755 --- a/src/core/lang/lang-en.php +++ b/src/core/lang/lang-en.php @@ -469,3 +469,4 @@ define("_SENT_BY", "Sent by"); define('_TO_CCI', 'On copy hidden'); define('_PRIMARY_INFORMATION', 'Primary information'); define("_EMPTY_SUBJECT", "Empty subject"); +define("_RECONCILE", "Convert mail into signed version for another mail"); diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index eb894324f789c4c84bf68f84052e088df3976fd6..7742ad454937354c38c407b90067105e3c1ceb7d 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -469,3 +469,4 @@ define("_SENT_BY", "Envoyé par"); define('_TO_CCI', 'En copie caché'); define('_PRIMARY_INFORMATION', 'Informations principales'); define("_EMPTY_SUBJECT", "Objet vide"); +define("_RECONCILE", "Convertir le courrier en version signée d'un autre courrier"); diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php index 49fa4b2cf894d7362de6cd1be1b4ae4058d478a8..ca2b052019fdcbd7999df19b09a309c17341f106 100755 --- a/src/core/lang/lang-nl.php +++ b/src/core/lang/lang-nl.php @@ -475,3 +475,4 @@ define("_SENT_BY", "Sent by"); //TO TRANSLATE define('_TO_CCI', 'On copy hidden'); //TO TRANSLATE define('_PRIMARY_INFORMATION', 'Primary information'); //TO TRANSLATE define("_EMPTY_SUBJECT", "Empty subject"); //TO TRANSLATE +define("_RECONCILE", "Convert mail into signed version for another mail"); //TO TRANSLATE diff --git a/src/frontend/app/actions/actions.service.ts b/src/frontend/app/actions/actions.service.ts index 6e56e4f360e02be7f19cf9c9765da5cce3253197..dca8ef654f8fce5fb7f9c2ec91bb2b2d89cb2613 100644 --- a/src/frontend/app/actions/actions.service.ts +++ b/src/frontend/app/actions/actions.service.ts @@ -34,6 +34,7 @@ import { GiveAvisParallelActionComponent } from './avis-give-parallel-action/giv import { ValidateAvisParallelComponent } from './avis-parallel-validate-action/validate-avis-parallel-action.component'; import { HeaderService } from '../../service/header.service'; import { FunctionsService } from '../../service/functions.service'; +import { ReconcileActionComponent } from './reconciliation-action/reconcile-action.component'; @Injectable() export class ActionsService { @@ -900,5 +901,26 @@ export class ActionsService { ).subscribe(); } - + reconciliationAction(options: any = null) { + const dialogRef = this.dialog.open(ReconcileActionComponent, { + panelClass: 'maarch-modal', + autoFocus: false, + disableClose: true, + data: this.setDatasActionToSend() + }); + dialogRef.afterClosed().pipe( + /* tap((resIds: any) => { + this.unlockResourceAfterActionModal(resIds); + }),*/ + filter((resIds: any) => !this.functions.empty(resIds)), + tap((resIds: any) => { + this.endAction(resIds); + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } } diff --git a/src/frontend/app/actions/reconciliation-action/reconcile-action.component.html b/src/frontend/app/actions/reconciliation-action/reconcile-action.component.html new file mode 100644 index 0000000000000000000000000000000000000000..aff37a8864b6535b69eb2b33d0434d37f6d3542f --- /dev/null +++ b/src/frontend/app/actions/reconciliation-action/reconcile-action.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="loading" class="loading" style="display:flex;height:100%;"> + <mat-spinner style="margin:auto;"></mat-spinner> + </div> + <div class="row"> + <ng-container *ngIf="data.resIds.length > 0"> + <div class="col-md-12"> + {{lang.makeActionOn}} + <b *ngIf="data.resIds.length === 0" color="primary" + class="highlight">{{lang.currentIndexingMail}}</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}}</b> ? + <div class="alert-message alert-message-info" role="alert" style="margin-top: 30px;max-width: 100%;" + [innerHTML]="lang.reconcileMsg"> + </div> + <div class="alert-message alert-message-info" role="alert" style="margin-top: 30px;max-width: 100%;" + [innerHTML]="lang.selectMailToReconcile + ' : '"> + </div> + </div> + <div *ngIf="resourcesErrors.length > 0" class="alert-message alert-message-danger mailList" + role="alert"> + <p> + {{lang.canNotMakeAction}} : + </p> + <ul> + <li *ngFor="let ressource of resourcesErrors"> + <b>{{ressource.alt_identifier}}</b> : {{lang[ressource.reason]}} + </li> + </ul> + </div> + <div class="col-md-12"> + <app-criteria-tool (searchUrlGenerated)="launchSearch($event)" + [defaultCriteria]="['resourceField','contactField']"></app-criteria-tool> + <search-adv-list #appSearchAdvList [singleMode]="true"></search-adv-list> + </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 || (appSearchAdvList !== undefined && appSearchAdvList.getSelectedRessources().length === 0)" + (click)="onSubmit()">{{lang.validate}}</button> + <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button> + </div> +</div> \ No newline at end of file diff --git a/src/frontend/app/actions/reconciliation-action/reconcile-action.component.scss b/src/frontend/app/actions/reconciliation-action/reconcile-action.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..70c84987f8a9f73fb0d3c9ed740e00cad2d9a129 --- /dev/null +++ b/src/frontend/app/actions/reconciliation-action/reconcile-action.component.scss @@ -0,0 +1,3 @@ +.highlight { + font-size: 110%; +} \ No newline at end of file diff --git a/src/frontend/app/actions/reconciliation-action/reconcile-action.component.ts b/src/frontend/app/actions/reconciliation-action/reconcile-action.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..d63fbf0161d6d436440fb68cd1c77e2e882e760f --- /dev/null +++ b/src/frontend/app/actions/reconciliation-action/reconcile-action.component.ts @@ -0,0 +1,87 @@ +import { Component, OnInit, Inject, ViewChild } from '@angular/core'; +import { LANG } from '../../translate.component'; +import { NotificationService } from '../../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 { SearchAdvListComponent } from '../../adv-search/list/search-adv-list.component'; + +@Component({ + templateUrl: "reconcile-action.component.html", + styleUrls: ['reconcile-action.component.scss'], +}) +export class ReconcileActionComponent implements OnInit { + + lang: any = LANG; + loading: boolean = false; + + @ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent; + @ViewChild('appSearchAdvList', { static: false }) appSearchAdvList: SearchAdvListComponent; + + searchUrl: string = ''; + resourcesErrors: any[] = []; + selectedRes: number[] = []; + + constructor( + public http: HttpClient, + private notify: NotificationService, + public dialogRef: MatDialogRef<ReconcileActionComponent>, + @Inject(MAT_DIALOG_DATA) public data: any, + public functions: FunctionsService + ) { } + + ngOnInit(): void { + //this.checkReconcile(); + } + + onSubmit() { + this.loading = true; + + this.executeAction(); + } + + checkReconcile() { + this.resourcesErrors = []; + + return new Promise((resolve, reject) => { + this.http.post('../../rest/resourcesList/users/' + this.data.userId + '/groups/' + this.data.groupId + '/baskets/' + this.data.basketId + '/actions/' + this.data.action.id + '/checkReconcile', { resources: this.data.resIds }) + .subscribe((data: any) => { + if(!this.functions.empty(data.resourcesInformations.error)) { + this.resourcesErrors = data.resourcesInformations.error; + } + if (data.resourcesInformations.success) { + data.resourcesInformations.success.forEach((value: any) => { + this.selectedRes.push(value); + }); + } + resolve(true); + }, (err: any) => { + this.notify.handleSoftErrors(err); + this.dialogRef.close(); + }); + }); + } + + executeAction() { + console.log(this.appSearchAdvList.getSelectedRessources()); + + /*this.http.put(this.data.processActionRoute, { resources: this.selectedRes }).pipe( + tap(() => { + this.dialogRef.close(this.selectedRes); + }), + finalize(() => this.loading = false), + catchError((err: any) => { + this.notify.handleSoftErrors(err); + return of(false); + }) + ).subscribe();*/ + } + + launchSearch(value: any) { + this.searchUrl = value; + this.appSearchAdvList.refreshDao(value); + } +} diff --git a/src/frontend/app/adv-search/list/search-adv-list.component.html b/src/frontend/app/adv-search/list/search-adv-list.component.html index 53656359fd7911059507731b7d9b27cfcc9e989b..d0519daf50096048d1bb295a2994eb83d8fd8ac2 100644 --- a/src/frontend/app/adv-search/list/search-adv-list.component.html +++ b/src/frontend/app/adv-search/list/search-adv-list.component.html @@ -19,6 +19,7 @@ <ng-container matColumnDef="action"> <mat-header-cell *matHeaderCellDef style="width: 70px;flex: initial;"> <mat-checkbox color="primary" + *ngIf="!singleMode" [checked]="selectedRes.length == allResInSearch.length && selectedRes.length > 0" [indeterminate]="selectedRes.length > 0 && selectedRes.length < allResInSearch.length" title="{{lang.selectAllResInBasket}}" (change)="toggleAllRes($event)"></mat-checkbox> diff --git a/src/frontend/app/adv-search/list/search-adv-list.component.ts b/src/frontend/app/adv-search/list/search-adv-list.component.ts index 20fe58545011cfe8b6bb6e6bab57bd8752febe82..0e6cf42cd20b14ee41c6bdea35c3ecb7c7a4967d 100644 --- a/src/frontend/app/adv-search/list/search-adv-list.component.ts +++ b/src/frontend/app/adv-search/list/search-adv-list.component.ts @@ -39,6 +39,7 @@ export class SearchAdvListComponent implements OnInit { @Input('search') search: string = ''; @Input('currentResId') currentResId: number; + @Input('singleMode') singleMode: boolean = false; @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; @ViewChild('tableResourceListSort', { static: true }) sort: MatSort; @@ -114,6 +115,9 @@ export class SearchAdvListComponent implements OnInit { } toggleRes(e: any, row: any) { + if (this.singleMode) { + this.selectedRes = []; + } if (e.checked) { if (this.selectedRes.indexOf(row.resId) === -1) { this.selectedRes.push(row.resId); diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 3935366f3f98fc87bbf64bd5363857392b1b90f4..843ab08ca3bd0ffa6989c036827f4fb3220f839a 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -67,6 +67,7 @@ import { SendAvisWorkflowComponent } from './actions/avis-workflow import { SendAvisParallelComponent } from './actions/avis-parallel-send-action/send-avis-parallel-action.component'; import { GiveAvisParallelActionComponent } from './actions/avis-give-parallel-action/give-avis-parallel-action.component'; import { ValidateAvisParallelComponent } from './actions/avis-parallel-validate-action/validate-avis-parallel-action.component'; +import { ReconcileActionComponent } from './actions/reconciliation-action/reconcile-action.component'; import { FiltersListComponent } from './list/filters/filters-list.component'; import { FiltersToolComponent } from './list/filters/filters-tool.component'; @@ -210,7 +211,8 @@ import { FolderCreateModalComponent } from './folder/folder-create-modal/folder- SentResourcePageComponent, PrintedFolderModalComponent, SentNumericPackagePageComponent, - FolderCreateModalComponent + FolderCreateModalComponent, + ReconcileActionComponent ], entryComponents: [ InfoChangePasswordModalComponent, @@ -256,7 +258,8 @@ import { FolderCreateModalComponent } from './folder/folder-create-modal/folder- SentResourcePageComponent, PrintedFolderModalComponent, SentNumericPackagePageComponent, - FolderCreateModalComponent + FolderCreateModalComponent, + ReconcileActionComponent ], providers: [ FiltersListService, FoldersService, ActionsService, PrivilegeService ], bootstrap: [ AppComponent ] diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index a0f888b867378880dee42cc6bc9af8d67af640cd..879d68ad44d09d24ab235e86b838ab260073c3c5 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1622,4 +1622,6 @@ export const LANG_EN = { "downloadNumericPackage" : "Download the numeric package", "actionsHistory" : "Actions history", "noActionProcessed": "No action processed", + "reconcileMsg": "The mails will be converted into <b>signed version</b> and linked to selected new mail.", + "selectMailToReconcile": "Please, select a mail to reconcile", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index 8c1318fbbca9f229025fe570716d366eec2421d8..1f4fa8221babec3c0d80eae768dfdc0c37db8e96 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1661,4 +1661,6 @@ export const LANG_FR = { "downloadNumericPackage" : "Télécharger le pli numérique", "actionsHistory" : "Historique des actions", "noActionProcessed": "Aucune action effectuée", + "reconcileMsg": "Les courriers seront convertis en tant que <b>version signée</b> et liés au courrier qui sera sélectionnée.", + "selectMailToReconcile": "Veuillez sélectionner le courrier cible de la reconciliation", }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 5cea37278863e216c9b62558aec2247a6a96251a..1d9513a17249d9ee0cf85f55eb6b11e104174692 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1647,4 +1647,6 @@ export const LANG_NL = { "downloadNumericPackage" : "Download the numeric package", //_TO_TRANSLATE "actionsHistory" : "Actions history", //_TO_TRANSLATE "noActionProcessed": "No action processed", //_TO_TRANSLATE + "reconcileMsg": "The mails will be converted into <b>signed version</b> and linked to selected new mail.", //_TO_TRANSLATE + "selectMailToReconcile": "Please, select a mail to reconcile", //_TO_TRANSLATE };