Fixed error to function to create quotation
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
(ok)="onModalQuotationOk()"
|
||||
(cancel)="onModalQuotationCancel()">
|
||||
<app-create-quotation-form #quotationForm
|
||||
[suppliers]="suppliers()"
|
||||
[products]="selectedProducts()">
|
||||
</app-create-quotation-form>
|
||||
</app-modal-button>
|
||||
|
||||
@@ -4,7 +4,7 @@ import {ModalButton} from "../../components/modal-button/modal-button";
|
||||
import {CreatePurchaseorderForm} from "../../components/create-purchaseorder-form/create-purchaseorder-form";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {
|
||||
CreatePurchaseOrderDto,
|
||||
CreatePurchaseOrderDto, CreateQuotationDto,
|
||||
GetProductDto,
|
||||
GetSupplierDto,
|
||||
PurchaseordersService,
|
||||
@@ -123,17 +123,19 @@ export class Stock implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
const quotation = {
|
||||
message: this.createQuotation().createQuotationForm.get('message')!.value,
|
||||
purchaseConditions: this.createQuotation().createQuotationForm.get('purchaseConditions')!.value,
|
||||
const quotation: CreateQuotationDto = {
|
||||
message: this.createQuotation().createQuotationForm.value.message,
|
||||
conditionsSale: this.createQuotation().createQuotationForm.value.conditionsSale,
|
||||
customerId: this.createQuotation().createQuotationForm.value.customerId,
|
||||
supplierId: this.createQuotation().createQuotationForm.value.supplierId,
|
||||
products: orderLines
|
||||
};
|
||||
|
||||
try {
|
||||
await firstValueFrom(this.quotationsService.createQuotationEndpoint(quotation));
|
||||
this.notificationService.success('Succès', 'Bon de commande créé');
|
||||
this.notificationService.success('Succès', 'Devis créé');
|
||||
} catch {
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la création du bon de commande.');
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la création du devis.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user