When closing modal it patch delivery
This commit is contained in:
@@ -11,30 +11,28 @@
|
||||
</div>
|
||||
|
||||
<app-modal-nav name="Valider la livraison" nameIcon="check" (click)="validate(deliveryItem.id)">
|
||||
<nz-table
|
||||
#productsTable
|
||||
[nzData]="deliveryItem.products"
|
||||
[nzBordered]="true"
|
||||
[nzShowPagination]="false"
|
||||
nzSize="small">
|
||||
|
||||
<div style="max-height: 400px; overflow-y: auto;">
|
||||
<nz-table [nzData]="filteredDeliveries()"
|
||||
[nzFrontPagination]="false">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Produit</th>
|
||||
<th class="text-right">Quantité</th>
|
||||
<tr class="text-center">
|
||||
<th>Réference</th>
|
||||
<th>Nom</th>
|
||||
<th>Quantité</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@for (p of productsTable.data; track p) {
|
||||
<tbody class="text-center">
|
||||
@for (product of deliveryItem.products; track product.productId) {
|
||||
<tr>
|
||||
<td>{{ p.productName }}</td>
|
||||
<td class="text-right">{{ p.quantity }}</td>
|
||||
<td>{{product.productReference}}</td>
|
||||
<td>{{product.productName}}</td>
|
||||
<td>{{product.quantity}}</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</div>
|
||||
|
||||
</app-modal-nav>
|
||||
|
||||
|
||||
|
||||
@@ -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',
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user