fix: make convertion unit support QTY when hitting update/create API

This commit is contained in:
ValdiANS
2026-04-07 16:55:23 +07:00
parent 922a93414f
commit 2dc3bcf9f0
@@ -195,7 +195,9 @@ const SalesOrderFormModal = ({
product.marketing_type?.value?.toLowerCase() === 'telur'
? convertionUnitValue === 'PETI'
? 'PETI'
: 'KG' // termasuk "QTY" dan "KG"
: convertionUnitValue === 'QTY'
? 'QTY'
: 'KG'
: undefined;
// Jika value dari data product ada week, kirim "AYAM_PULLET, jika tidak ada kirim "AYAM"
@@ -205,10 +207,15 @@ const SalesOrderFormModal = ({
marketingTypeValue = product.week ? 'AYAM_PULLET' : 'AYAM';
}
const formattedUnitPrice =
convertionUnitValue === 'QTY'
? parseFloat(String(product.price_per_qty || 0))
: parseFloat(String(product.unit_price || 0));
return {
vehicle_number: product.vehicle_number as string,
product_warehouse_id: product.product_warehouse_id as number,
unit_price: parseFloat(String(product.unit_price || 0)),
unit_price: formattedUnitPrice,
total_weight: parseFloat(String(product.total_weight || 0)),
qty: parseFloat(String(product.qty || 0)),
avg_weight: parseFloat(String(product.avg_weight || 0)),