Adapted front with back update

This commit is contained in:
2026-05-25 10:53:32 +01:00
parent b03196ce0f
commit d2ca8b1bf2
8 changed files with 12 additions and 16 deletions
@@ -35,7 +35,7 @@
@for (product of purchaseOrder.products; track product.productId) {
<tr>
<td>{{ product.productName }}</td>
<td>{{ product.productReferences }}</td>
<td>{{ product.productReference }}</td>
<td>Prix €€€€</td>
<td>{{ product.quantity }}</td>
<td>
@@ -8,17 +8,14 @@ import {ModalButton} from "../modal-button/modal-button";
import {
CreateDeliveryNoteDto,
DeliverynotesService,
GetDeliveryNoteDto, GetProductDeliveryDto,
GetPurchaseOrderDto,
GetPurchaseProductDto,
PurchaseordersService,
PurchaseproductsService
} from "../../services/api";
import {NzNotificationService} from "ng-zorro-antd/notification";
import {firstValueFrom} from "rxjs";
import {FileService} from "../../services/file.service";
import {QuantityForm} from "../quantity-form/quantity-form";
import {PurchaseOrder} from "../../pages/purchase-order/purchase-order";
@Component({
selector: 'app-purchase-order-table',
@@ -38,7 +35,6 @@ export class PurchaseOrderTable implements OnInit {
private purchaseOrdersService = inject(PurchaseordersService);
private notificationService = inject(NzNotificationService);
private fileService = inject(FileService);
private purchaseProductService = inject(PurchaseproductsService);
private deliveryNoteService = inject(DeliverynotesService);
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
purchaseOrdersLoading = signal<boolean>(false);
@@ -164,7 +160,7 @@ export class PurchaseOrderTable implements OnInit {
async deleteProduct(productId: number, purchaseOrderId: number) {
this.purchaseOrdersLoading.set(true)
try {
await firstValueFrom(this.purchaseProductService.deletePurchaseProductEndpoint(productId, purchaseOrderId))
await firstValueFrom(this.purchaseOrdersService.deleteProductFromPurchaseOrderEndpoint(productId, purchaseOrderId))
this.notificationService.success(
'Success',
'Suppression effectuée'
@@ -190,7 +186,7 @@ export class PurchaseOrderTable implements OnInit {
try {
const quantity = updateQuantityComponent.quantityForm.getRawValue();
await firstValueFrom(this.purchaseProductService.patchPurchaseProductQuantityEndpoint(productId, purchaseOrderId, quantity))
await firstValueFrom(this.purchaseOrdersService.patchPurchaseProductQuantityEndpoint(productId, purchaseOrderId, quantity))
this.notificationService.success('Success', 'Quantité modifiée')
} catch (e) {
@@ -34,7 +34,7 @@
<tbody class="text-center">
@for (product of quotation.products; track product.productId) {
<tr>
<td>{{ product.productReferences }}</td>
<td>{{ product.productReference }}</td>
<td>{{ product.productName }}</td>
<td>Price ???</td>
<td>{{ product.quantity }}</td>
@@ -8,7 +8,6 @@ import {QuotationForm} from "../quotation-form/quotation-form";
import {
GetQuotationDto,
GetQuotationProductDto,
QuotationproductsService,
QuotationsService
} from "../../services/api";
import {NzNotificationService} from "ng-zorro-antd/notification";
@@ -34,7 +33,6 @@ import {QuantityForm} from "../quantity-form/quantity-form";
export class QuotationTable implements OnInit {
private quotationsService = inject(QuotationsService);
private notificationService = inject(NzNotificationService);
private quotationProductsService = inject(QuotationproductsService)
private fileService = inject(FileService);
quotations = signal<GetQuotationDto[]>([]);
quotationsLoading = signal<boolean>(false);
@@ -114,7 +112,7 @@ export class QuotationTable implements OnInit {
async deleteProduct(productId: number, quotationId: number) {
this.quotationsLoading.set(true)
try {
await firstValueFrom(this.quotationProductsService.deleteQuotationProductEndpoint(productId, quotationId))
await firstValueFrom(this.quotationsService.deleteProductFromQuotationEndpoint(productId, quotationId))
this.notificationService.success(
'Success',
'Suppression effectuée'
@@ -140,7 +138,7 @@ export class QuotationTable implements OnInit {
try {
const quantity = updateQuantityComponent.quantityForm.getRawValue();
await firstValueFrom(this.quotationProductsService.patchQuotationProductQuantityEndpoint(productId, quotationId, quantity))
await firstValueFrom(this.quotationsService.patchQuotationProductQuantityEndpoint(productId, quotationId, quantity))
this.notificationService.success('Success', 'Quantité modifiée')
} catch (e) {
@@ -159,7 +159,7 @@ export class SupplierTable implements OnInit {
async deleteProduct(idProduct: number, idSupplier: number) {
try {
await firstValueFrom(this.pricesService.deletePriceEndpoint(idProduct, idSupplier));
await firstValueFrom(this.suppliersService.deleteProductToSupplierEndpoint(idProduct, idSupplier));
this.notificationService.success('Succès', 'Produit supprimé');
await this.fetchSuppliers();
} catch (e) {
+3 -3
View File
@@ -59,9 +59,9 @@ In your Angular project:
```typescript
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '';
import {ApplicationConfig} from '@angular/core';
import {provideHttpClient} from '@angular/common/http';
import {provideApi} from '';
export const appConfig: ApplicationConfig = {
providers: [
@@ -22,6 +22,7 @@ export interface GetPurchaseProductDto {
productLink?: string | null;
productMinimalQuantity?: number;
productPrice?: number;
purchaseOrderId?: number;
quantity?: number;
}
@@ -22,5 +22,6 @@ export interface GetQuotationProductDto {
productImage?: string | null;
productLink?: string | null;
productMinimalQuantity?: number;
quotationId?: number;
}