When closing modal it patch delivery

This commit is contained in:
Cristiano
2025-12-18 16:48:08 +01:00
parent 2796c46625
commit 750fc19d46
2 changed files with 36 additions and 25 deletions

View File

@@ -11,30 +11,28 @@
</div> </div>
<app-modal-nav name="Valider la livraison" nameIcon="check" (click)="validate(deliveryItem.id)"> <app-modal-nav name="Valider la livraison" nameIcon="check" (click)="validate(deliveryItem.id)">
<nz-table <div style="max-height: 400px; overflow-y: auto;">
#productsTable <nz-table [nzData]="filteredDeliveries()"
[nzData]="deliveryItem.products" [nzFrontPagination]="false">
[nzBordered]="true" <thead>
[nzShowPagination]="false" <tr class="text-center">
nzSize="small"> <th>Réference</th>
<th>Nom</th>
<th>Quantité</th>
</tr>
</thead>
<tbody class="text-center">
@for (product of deliveryItem.products; track product.productId) {
<tr>
<td>{{product.productReference}}</td>
<td>{{product.productName}}</td>
<td>{{product.quantity}}</td>
</tr>
}
</tbody>
</nz-table>
</div>
<thead>
<tr>
<th>Produit</th>
<th class="text-right">Quantité</th>
</tr>
</thead>
<tbody>
@for (p of productsTable.data; track p) {
<tr>
<td>{{ p.productName }}</td>
<td class="text-right">{{ p.quantity }}</td>
</tr>
}
</tbody>
</nz-table>
</app-modal-nav> </app-modal-nav>

View File

@@ -7,6 +7,7 @@ import {NzNotificationService} from "ng-zorro-antd/notification";
import {ModalButton} from "../modal-button/modal-button"; import {ModalButton} from "../modal-button/modal-button";
import {ModalNav} from "../modal-nav/modal-nav"; import {ModalNav} from "../modal-nav/modal-nav";
import {NzTableComponent} from "ng-zorro-antd/table"; import {NzTableComponent} from "ng-zorro-antd/table";
import {format} from "date-fns";
@Component({ @Component({
selector: 'app-delivery-validator', selector: 'app-delivery-validator',
@@ -59,7 +60,19 @@ export class DeliveryValidator implements OnInit {
validate(id) { async validate(id) {
this 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',
)
}
} }
} }