From 750fc19d4622ef135c6ffb7a3eddb4796f00ed51 Mon Sep 17 00:00:00 2001 From: Cristiano Date: Thu, 18 Dec 2025 16:48:08 +0100 Subject: [PATCH] When closing modal it patch delivery --- .../delivery-validator.html | 44 +++++++++---------- .../delivery-validator/delivery-validator.ts | 17 ++++++- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/app/components/delivery-validator/delivery-validator.html b/src/app/components/delivery-validator/delivery-validator.html index c703698..bc01e30 100644 --- a/src/app/components/delivery-validator/delivery-validator.html +++ b/src/app/components/delivery-validator/delivery-validator.html @@ -11,30 +11,28 @@ - +
+ + + + Réference + Nom + Quantité + + + + @for (product of deliveryItem.products; track product.productId) { + + {{product.productReference}} + {{product.productName}} + {{product.quantity}} + + } + + +
- - - Produit - Quantité - - - - - @for (p of productsTable.data; track p) { - - {{ p.productName }} - {{ p.quantity }} - - } - - -
diff --git a/src/app/components/delivery-validator/delivery-validator.ts b/src/app/components/delivery-validator/delivery-validator.ts index 49feb6f..4851438 100644 --- a/src/app/components/delivery-validator/delivery-validator.ts +++ b/src/app/components/delivery-validator/delivery-validator.ts @@ -7,6 +7,7 @@ import {NzNotificationService} from "ng-zorro-antd/notification"; import {ModalButton} from "../modal-button/modal-button"; import {ModalNav} from "../modal-nav/modal-nav"; import {NzTableComponent} from "ng-zorro-antd/table"; +import {format} from "date-fns"; @Component({ selector: 'app-delivery-validator', @@ -59,7 +60,19 @@ export class DeliveryValidator implements OnInit { - validate(id) { - this + async validate(id) { + try{ + const PatchRealDate = { + realDeliveryDate: format(new Date(), 'yyyy-MM-dd') + }; + await firstValueFrom(this.deliveriesService.patchRealDeliveryDateEndpoint(id, PatchRealDate)); + } + catch(e) { + this.notificationsService.error( + 'Error', + 'Error validateing delivery', + ) + } + } }