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