Compare commits

...

1 Commits

Author SHA1 Message Date
Nino
16b047f2da #4534 Goods In Out Order Edit Always Show Price with Two Decimal Places 2024-01-04 10:25:53 +01:00

View File

@@ -152,10 +152,7 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
name: fb.control(item.product?.name),
ean: fb.control(item.product?.ean, [Validators.required]),
quantity: fb.control({ value: item.quantity + ' x', disabled: true }),
price: fb.control(item.price ? String(item.price).replace('.', ',') : '', [
Validators.required,
Validators.pattern(/^\d+([\,]\d{1,2})?$/),
]),
price: fb.control(this.formatPrice(item?.price), [Validators.required, Validators.pattern(/^\d+([\,]\d{1,2})?$/)]),
currency: fb.control(item.currency),
targetBranch: fb.control({ value: item.targetBranch, disabled: true }),
supplier: fb.control({ value: item.supplier, disabled: true }),
@@ -208,6 +205,15 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
return this.omsService.getOrderSource(+orderId).toPromise();
}
formatPrice(price: number) {
if (!price) {
return '';
}
const priceWithTwoDecimalPlaces = price.toFixed(2);
return String(priceWithTwoDecimalPlaces).replace('.', ',');
}
changeEstimatedDeliveryDate(date: Date, item: OrderItemListItemDTO) {
if (!date) {
return;