diff --git a/src/app/components/purchase-order-table/purchase-order-table.html b/src/app/components/purchase-order-table/purchase-order-table.html index 7b9e7e0..8a32d6a 100644 --- a/src/app/components/purchase-order-table/purchase-order-table.html +++ b/src/app/components/purchase-order-table/purchase-order-table.html @@ -35,7 +35,7 @@ @for (product of purchaseOrder.products; track product.productId) { {{ product.productName }} - {{ product.productReferences }} + {{ product.productReference }} Prix €€€€ {{ product.quantity }} diff --git a/src/app/components/purchase-order-table/purchase-order-table.ts b/src/app/components/purchase-order-table/purchase-order-table.ts index 61788a1..c087fca 100644 --- a/src/app/components/purchase-order-table/purchase-order-table.ts +++ b/src/app/components/purchase-order-table/purchase-order-table.ts @@ -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([]); purchaseOrdersLoading = signal(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) { diff --git a/src/app/components/quotation-table/quotation-table.html b/src/app/components/quotation-table/quotation-table.html index 78604db..0591d24 100644 --- a/src/app/components/quotation-table/quotation-table.html +++ b/src/app/components/quotation-table/quotation-table.html @@ -34,7 +34,7 @@ @for (product of quotation.products; track product.productId) { - {{ product.productReferences }} + {{ product.productReference }} {{ product.productName }} Price ??? {{ product.quantity }} diff --git a/src/app/components/quotation-table/quotation-table.ts b/src/app/components/quotation-table/quotation-table.ts index 120c8cc..07b0b43 100644 --- a/src/app/components/quotation-table/quotation-table.ts +++ b/src/app/components/quotation-table/quotation-table.ts @@ -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([]); quotationsLoading = signal(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) { diff --git a/src/app/components/supplier-table/supplier-table.ts b/src/app/components/supplier-table/supplier-table.ts index a60b085..20c44d3 100644 --- a/src/app/components/supplier-table/supplier-table.ts +++ b/src/app/components/supplier-table/supplier-table.ts @@ -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) { diff --git a/src/app/services/api/README.md b/src/app/services/api/README.md index 29f22fe..4d71313 100644 --- a/src/app/services/api/README.md +++ b/src/app/services/api/README.md @@ -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: [ diff --git a/src/app/services/api/model/get-purchase-product-dto.ts b/src/app/services/api/model/get-purchase-product-dto.ts index deaff53..5b3a7a1 100644 --- a/src/app/services/api/model/get-purchase-product-dto.ts +++ b/src/app/services/api/model/get-purchase-product-dto.ts @@ -22,6 +22,7 @@ export interface GetPurchaseProductDto { productLink?: string | null; productMinimalQuantity?: number; productPrice?: number; + purchaseOrderId?: number; quantity?: number; } diff --git a/src/app/services/api/model/get-quotation-product-dto.ts b/src/app/services/api/model/get-quotation-product-dto.ts index 2641f2f..b60dab7 100644 --- a/src/app/services/api/model/get-quotation-product-dto.ts +++ b/src/app/services/api/model/get-quotation-product-dto.ts @@ -22,5 +22,6 @@ export interface GetQuotationProductDto { productImage?: string | null; productLink?: string | null; productMinimalQuantity?: number; + quotationId?: number; }