diff --git a/core/xml/actions_pages.xml b/core/xml/actions_pages.xml index 6ecd12ea91686e5514054964caf84b567c84f08b..ffb627bb595a7ff66e1255dbd92954329505e5ab 100755 --- a/core/xml/actions_pages.xml +++ b/core/xml/actions_pages.xml @@ -165,11 +165,24 @@ An action page is described in a ACTIONPAGE tag : </COLLECTIONS> </ACTIONPAGE> <ACTIONPAGE> - <ID>send_acknowledgement_receipt</ID> - <LABEL>_SEND_ACKNOWLEDGEMENT_RECEIPT</LABEL> - <NAME>send_acknowledgement_receipt</NAME> - <DESC>_SEND_ACKNOWLEDGEMENT_RECEIPT</DESC> - <component>sendAcknowledgementReceiptAction</component> + <ID>create_acknowledgement_receipt</ID> + <LABEL>_CREATE_ACKNOWLEDGEMENT_RECEIPT</LABEL> + <NAME>create_acknowledgement_receipt</NAME> + <DESC>_CREATE_ACKNOWLEDGEMENT_RECEIPT</DESC> + <component>createAcknowledgementReceiptsAction</component> + <ORIGIN>apps</ORIGIN> + <MODULE></MODULE> + <FLAG_CREATE>false</FLAG_CREATE> + <COLLECTIONS> + <COLL_ID>letterbox_coll</COLL_ID> + </COLLECTIONS> + </ACTIONPAGE> + <ACTIONPAGE> + <ID>update_acknowledgement_send_date</ID> + <LABEL>_UPDATE_ACKNOWLEDGEMENT_SEND_DATE</LABEL> + <NAME>update_acknowledgement_send_date</NAME> + <DESC>_UPDATE_ACKNOWLEDGEMENT_SEND_DATE</DESC> + <component>updateAcknowledgementSendDateAction</component> <ORIGIN>apps</ORIGIN> <MODULE></MODULE> <FLAG_CREATE>false</FLAG_CREATE> diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php index 0cf9fbb6638466340d76bd2b10afa4d49d690c6a..a7ff99e528bbb6d30fd4f5b7a616d26166d9eab4 100644 --- a/src/app/action/controllers/ActionMethodController.php +++ b/src/app/action/controllers/ActionMethodController.php @@ -35,7 +35,7 @@ class ActionMethodController 'disabledBasketPersistenceAction' => 'disabledBasketPersistenceAction', 'resMarkAsReadAction' => 'resMarkAsReadAction', 'createAcknowledgementReceiptsAction' => 'createAcknowledgementReceipts', - 'sendAcknowledgementReceiptAction' => 'sendAcknowledgementReceiptAction' + 'updateAcknowledgementSendDateAction' => 'updateAcknowledgementSendDateAction' ]; public static function terminateAction(array $aArgs) @@ -149,7 +149,7 @@ class ActionMethodController return true; } - public static function sendAcknowledgementReceiptAction(array $aArgs) + public static function updateAcknowledgementSendDateAction(array $aArgs) { ValidatorModel::notEmpty($aArgs, ['resId', 'data']); ValidatorModel::intVal($aArgs, ['resId']); diff --git a/src/core/lang/lang-en.php b/src/core/lang/lang-en.php index 32bef4a71357d2ad99b5999969d587e8a4427d21..08f903d0a20153f02a6a58261de42fbdf48f494d 100755 --- a/src/core/lang/lang-en.php +++ b/src/core/lang/lang-en.php @@ -444,4 +444,5 @@ define('_ACTION_DATE', 'Action date'); define('_USER_CREATED_IN_MAARCHPARAPHEUR', 'User created in Maarch Parapheur'); -define('_SEND_ACKNOWLEDGEMENT_RECEIPT', 'Send acknowledgement receipt'); +define('_CREATE_ACKNOWLEDGEMENT_RECEIPT', 'Create acknowledgement receipt'); +define('_UPDATE_ACKNOWLEDGEMENT_SEND_DATE', 'update acknowledgement send date'); diff --git a/src/core/lang/lang-fr.php b/src/core/lang/lang-fr.php index 691869ff70011fad37c5e9a5f5a19b235f1496cb..f62d5382a68dceca25a1231ef317da5b2d8ca96a 100755 --- a/src/core/lang/lang-fr.php +++ b/src/core/lang/lang-fr.php @@ -443,4 +443,6 @@ define('_CLOSING_DATE', 'Date de clôture'); define('_ACTION_DATE', 'Date d\'action'); define('_USER_CREATED_IN_MAARCHPARAPHEUR', 'Utilisateur créé dans Maarch Parapheur'); -define('_SEND_ACKNOWLEDGEMENT_RECEIPT', 'Envoyer les accusés de réception'); + +define('_CREATE_ACKNOWLEDGEMENT_RECEIPT', 'Créer les accusés de réception'); +define('_UPDATE_ACKNOWLEDGEMENT_SEND_DATE', 'Mettre à jour la date d\'envoi des accusés de réception'); diff --git a/src/core/lang/lang-nl.php b/src/core/lang/lang-nl.php index a0d6fd7d3e12138f709f3d6e7c562484caaae35d..29fc02136ecc85349fd6c24be9bf05d7b30942a2 100644 --- a/src/core/lang/lang-nl.php +++ b/src/core/lang/lang-nl.php @@ -443,6 +443,7 @@ define('_ACTION_DATE', 'Action date_TO_TRANSLATE'); define('_USER_CREATED_IN_MAARCHPARAPHEUR', 'User created in Maarch Parapheur_TO_TRANSLATE'); -define('_SEND_ACKNOWLEDGEMENT_RECEIPT', 'Send acknowledgement receipt_TO_TRANSLATE'); +define('_CREATE_ACKNOWLEDGEMENT_RECEIPT', 'Create acknowledgement receipt_TO_TRANSLATE'); +define('_UPDATE_ACKNOWLEDGEMENT_SEND_DATE', 'update acknowledgement send date_TO_TRANSLATE'); define('_AR_DISPLAYING', 'Displaying acknowledgement receipt_TO_TRANSLATE'); diff --git a/src/frontend/app/actions/actions-list.component.ts b/src/frontend/app/actions/actions-list.component.ts index 2aa9f2b9c211182be4ff10f7090e6bf7e4799449..9fac171484093dd3cb3ca788cfb7df47f082f3d7 100644 --- a/src/frontend/app/actions/actions-list.component.ts +++ b/src/frontend/app/actions/actions-list.component.ts @@ -9,7 +9,8 @@ import { EnabledBasketPersistenceActionComponent } from './enabled-basket-persis import { DisabledBasketPersistenceActionComponent } from './disabled-basket-persistence-action/disabled-basket-persistence-action.component'; import { ResMarkAsReadActionComponent } from './res-mark-as-read-action/res-mark-as-read-action.component'; import { CloseMailActionComponent } from './close-mail-action/close-mail-action.component'; -import { SendAcknowledgementReceiptActionComponent } from './send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component'; +import { UpdateAcknowledgementSendDateActionComponent } from './update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component'; +import { CreateAcknowledgementReceiptActionComponent } from './create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component'; import { CloseAndIndexActionComponent } from './close-and-index-action/close-and-index-action.component'; import { UpdateDepartureDateActionComponent } from './update-departure-date-action/update-departure-date-action.component'; // import { ProcessActionComponent } from './process-action/process-action.component'; @@ -165,8 +166,28 @@ export class ActionsListComponent implements OnInit { }); } - sendAcknowledgementReceiptAction() { - const dialogRef = this.dialog.open(SendAcknowledgementReceiptActionComponent, { + updateAcknowledgementSendDateAction() { + const dialogRef = this.dialog.open(UpdateAcknowledgementSendDateActionComponent, { + width: '500px', + data: { + contextMode: this.contextMode, + contextChrono: this.contextMenuTitle, + selectedRes: this.selectedRes, + action: this.currentAction, + currentBasketInfo: this.currentBasketInfo + } + }); + dialogRef.afterClosed().subscribe(result => { + this.unlock(); + + if (result == 'success') { + this.endAction(); + } + }); + } + + createAcknowledgementReceiptAction() { + const dialogRef = this.dialog.open(CreateAcknowledgementReceiptActionComponent, { width: '500px', data: { contextMode: this.contextMode, diff --git a/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.html b/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.html new file mode 100644 index 0000000000000000000000000000000000000000..b271561a6804955507c2992f5a137559c83e0256 --- /dev/null +++ b/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.html @@ -0,0 +1,20 @@ +<h1 mat-dialog-title>Confirmer "{{data.action.label_action}}"</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"> + <div class="col-md-12"> + {{lang.makeActionOn}} + <b *ngIf="data.contextMode" color="primary" class="highlight">{{data.contextChrono}}</b> + <b *ngIf="!data.contextMode" color="primary" class="highlight">{{data.selectedRes.length}} {{lang.elements}}</b> ? + </div> + <div class="col-md-12"> + <app-note-editor #noteEditor></app-note-editor> + </div> + </div> +</div> +<div mat-dialog-actions class="actions"> + <button mat-raised-button mat-button color="primary" [disabled]="loading" (click)="onSubmit()">{{lang.validate}}</button> + <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button> +</div> diff --git a/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.scss b/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..6de958ac477b05058fa3e5eeab40d680f58533a5 --- /dev/null +++ b/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.scss @@ -0,0 +1,24 @@ +.mat-dialog-content { + position: relative; +} + +.mat-dialog-actions, .mat-dialog-title { + justify-content: center; + text-align: center; +} + +.highlight { + font-size: 110%; +} + +.loading { + display:flex; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #ffffffb3; + z-index: 1; + overflow: hidden; +} diff --git a/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.ts b/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..402bc523eb407176202ca11b3995e7474b42a364 --- /dev/null +++ b/src/frontend/app/actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component.ts @@ -0,0 +1,79 @@ +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'; +import { HttpClient } from '@angular/common/http'; +import { NoteEditorComponent } from '../../notes/note-editor.component'; + +@Component({ + templateUrl: "create-acknowledgement-receipt-action.component.html", + styleUrls: ['create-acknowledgement-receipt-action.component.scss'], + providers: [NotificationService], +}) +export class CreateAcknowledgementReceiptActionComponent implements OnInit { + + lang: any = LANG; + loading: boolean = false; + + @ViewChild('noteEditor') noteEditor: NoteEditorComponent; + loadingExport: boolean; + + constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<CreateAcknowledgementReceiptActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } + + ngOnInit(): void { + this.http.post("../../rest/resourcesList/users/' + this.data.ownerId + '/groups/' + this.data.groupId + '/baskets/' + this.data.basketId + '/checkAcknowledgement", {resources : this.data.selectedRes}) + .subscribe(() => { + + }, (err) => { + this.notify.error(err.error.errors); + }); + } + + onSubmit(): void { + this.loading = true; + this.http.put('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/actions/' + this.data.action.id, {resources : this.data.selectedRes, note : this.noteEditor.getNoteContent()}) + .subscribe((data: any) => { + if(data != null){ + this.downloadAcknowledgementReceipt(data); + } + this.loading = false; + this.dialogRef.close('success'); + }, (err: any) => { + this.notify.handleErrors(err); + this.loading = false; + }); + } + + downloadAcknowledgementReceipt(data : any) { + this.loadingExport = true; + this.http.put('../../rest/resourcesList/users/' + this.data.ownerId + '/groups/' + this.data.groupId + '/baskets/' + this.data.basketId + '/acknowledgementReceipt', { 'resources' : data }) + .subscribe((data) => { + let downloadLink = document.createElement('a'); + downloadLink.href = window.URL.createObjectURL(data); + let today: any; + let dd: any; + let mm: any; + let yyyy: any; + + today = new Date(); + dd = today.getDate(); + mm = today.getMonth() + 1; + yyyy = today.getFullYear(); + + if (dd < 10) { + dd = '0' + dd; + } + if (mm < 10) { + mm = '0' + mm; + } + today = dd + '-' + mm + '-' + yyyy; + downloadLink.setAttribute('download', "acknowledgement_receipt_maarch_" + today + ".pdf"); + document.body.appendChild(downloadLink); + downloadLink.click(); + this.loadingExport = false; + }, (err: any) => { + this.notify.handleErrors(err); + }); + } + +} diff --git a/src/frontend/app/actions/send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component.html b/src/frontend/app/actions/update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component.html similarity index 100% rename from src/frontend/app/actions/send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component.html rename to src/frontend/app/actions/update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component.html diff --git a/src/frontend/app/actions/send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component.ts b/src/frontend/app/actions/update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component.ts similarity index 84% rename from src/frontend/app/actions/send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component.ts rename to src/frontend/app/actions/update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component.ts index d1415188ee5f17639bbabf407dddeedafde30a5f..018807c205f94f0d1ee8cc626dc0ed30a03b8838 100644 --- a/src/frontend/app/actions/send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component.ts +++ b/src/frontend/app/actions/update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component.ts @@ -6,11 +6,11 @@ import { HttpClient } from '@angular/common/http'; import { NoteEditorComponent } from '../../notes/note-editor.component'; @Component({ - templateUrl: "send-acknowledgement-receipt-action.component.html", + templateUrl: "update-acknowledgement-send-date-action.component.html", styleUrls: ['../close-mail-action/close-mail-action.component.scss'], providers: [NotificationService], }) -export class SendAcknowledgementReceiptActionComponent implements OnInit { +export class UpdateAcknowledgementSendDateActionComponent implements OnInit { lang: any = LANG; loading: boolean = false; @@ -20,7 +20,7 @@ export class SendAcknowledgementReceiptActionComponent implements OnInit { acknowledgementSendDate : Date = new Date(); acknowledgementSendDateEnd : Date = new Date(); - constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<SendAcknowledgementReceiptActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } + constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<UpdateAcknowledgementSendDateActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } ngOnInit(): void { } diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index 34de88bf6dc292b46e93c365a104daef9314fd1a..c2dcf3abbf98c6db8e31dceb9738a6e50a34874f 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -29,7 +29,8 @@ import { DisabledBasketPersistenceActionComponent } from './actions/disabled-bas import { EnabledBasketPersistenceActionComponent } from './actions/enabled-basket-persistence-action/enabled-basket-persistence-action.component'; import { ResMarkAsReadActionComponent } from './actions/res-mark-as-read-action/res-mark-as-read-action.component'; import { CloseMailActionComponent } from './actions/close-mail-action/close-mail-action.component'; -import { SendAcknowledgementReceiptActionComponent } from './actions/send-acknowledgement-receipt-action/send-acknowledgement-receipt-action.component'; +import { UpdateAcknowledgementSendDateActionComponent } from './actions/update-acknowledgement-send-date-action/update-acknowledgement-send-date-action.component'; +import { CreateAcknowledgementReceiptActionComponent } from './actions/create-acknowledgement-receipt-action/create-acknowledgement-receipt-action.component'; import { CloseAndIndexActionComponent } from './actions/close-and-index-action/close-and-index-action.component'; import { UpdateDepartureDateActionComponent } from './actions/update-departure-date-action/update-departure-date-action.component'; import { ProcessActionComponent } from './actions/process-action/process-action.component'; @@ -80,7 +81,8 @@ import { DiffusionsListComponent } from './diffusions/diffusions-lis EnabledBasketPersistenceActionComponent, DisabledBasketPersistenceActionComponent, CloseAndIndexActionComponent, - SendAcknowledgementReceiptActionComponent, + UpdateAcknowledgementSendDateActionComponent, + CreateAcknowledgementReceiptActionComponent, CloseMailActionComponent, UpdateDepartureDateActionComponent, ProcessActionComponent, @@ -101,7 +103,8 @@ import { DiffusionsListComponent } from './diffusions/diffusions-lis EnabledBasketPersistenceActionComponent, DisabledBasketPersistenceActionComponent, CloseAndIndexActionComponent, - SendAcknowledgementReceiptActionComponent, + UpdateAcknowledgementSendDateActionComponent, + CreateAcknowledgementReceiptActionComponent, CloseMailActionComponent, UpdateDepartureDateActionComponent, ProcessActionComponent,