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"
: 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 {
vehicle_number: product.vehicle_number as string,
kandang_id: product.kandang_id as number,
@@ -207,8 +214,7 @@ const SalesOrderFormModal = ({
qty: parseFloat(String(product.qty || 0)),
avg_weight: parseFloat(String(product.avg_weight || 0)),
total_price: parseFloat(String(product.total_price || 0)),
marketing_type:
product.marketing_type?.value?.toUpperCase() || '',
marketing_type: marketingTypeValue,
convertion_unit: normalizedConvertionUnit,
weight_per_convertion:
product.weight_per_convertion ?? undefined,