When closing modal it patch delivery
This commit is contained in:
@@ -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"
|
|
||||||
[nzShowPagination]="false"
|
|
||||||
nzSize="small">
|
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr class="text-center">
|
||||||
<th>Produit</th>
|
<th>Réference</th>
|
||||||
<th class="text-right">Quantité</th>
|
<th>Nom</th>
|
||||||
|
<th>Quantité</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
<tbody class="text-center">
|
||||||
<tbody>
|
@for (product of deliveryItem.products; track product.productId) {
|
||||||
@for (p of productsTable.data; track p) {
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ p.productName }}</td>
|
<td>{{product.productReference}}</td>
|
||||||
<td class="text-right">{{ p.quantity }}</td>
|
<td>{{product.productName}}</td>
|
||||||
|
<td>{{product.quantity}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
</app-modal-nav>
|
</app-modal-nav>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user