fix(FE): Fix marketing type value logic in SalesOrderFormModal

This commit is contained in:
rstubryan
2026-02-09 17:01:28 +07:00
parent c86f0379b5
commit 4cf2f77265
@@ -198,6 +198,13 @@ const SalesOrderFormModal = ({
: 'KG' // termasuk "QTY" dan "KG" : 'KG' // termasuk "QTY" dan "KG"
: undefined; : undefined;
// Jika value dari data product ada week, kirim "AYAM_PULLET, jika tidak ada kirim "AYAM"
let marketingTypeValue =
product.marketing_type?.value?.toUpperCase() || '';
if (marketingTypeValue === 'AYAM,AYAM_PULLET') {
marketingTypeValue = product.week ? 'AYAM_PULLET' : 'AYAM';
}
return { return {
vehicle_number: product.vehicle_number as string, vehicle_number: product.vehicle_number as string,
kandang_id: product.kandang_id as number, kandang_id: product.kandang_id as number,
@@ -207,8 +214,7 @@ const SalesOrderFormModal = ({
qty: parseFloat(String(product.qty || 0)), qty: parseFloat(String(product.qty || 0)),
avg_weight: parseFloat(String(product.avg_weight || 0)), avg_weight: parseFloat(String(product.avg_weight || 0)),
total_price: parseFloat(String(product.total_price || 0)), total_price: parseFloat(String(product.total_price || 0)),
marketing_type: marketing_type: marketingTypeValue,
product.marketing_type?.value?.toUpperCase() || '',
convertion_unit: normalizedConvertionUnit, convertion_unit: normalizedConvertionUnit,
weight_per_convertion: weight_per_convertion:
product.weight_per_convertion ?? undefined, product.weight_per_convertion ?? undefined,