Commit 34ccc9d9 authored by Alex ORLUC's avatar Alex ORLUC

FEAT #11902 TIME 2:30 begin reconcile action

parent a5cfd757
......@@ -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");
......@@ -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");
......@@ -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
......@@ -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();
}
}
<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
.highlight {
font-size: 110%;
}
\ No newline at end of file
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);
}
}
......@@ -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>
......
......@@ -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);
......
......@@ -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 ]
......
......@@ -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",
};
......@@ -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",
};
......@@ -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
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment