mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
fix: return total_peti, weight_per_convertion, and price_per_convertion in DeliveryProductToFieldValues function
This commit is contained in:
@@ -151,6 +151,25 @@ export const DeliveryProductToFieldValues = (
|
|||||||
value: item.product_warehouse.warehouse.id,
|
value: item.product_warehouse.warehouse.id,
|
||||||
label: item.product_warehouse.warehouse.name,
|
label: item.product_warehouse.warehouse.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initialSisaBerat =
|
||||||
|
item?.total_weight &&
|
||||||
|
salesOrder?.weight_per_convertion &&
|
||||||
|
salesOrder?.total_peti
|
||||||
|
? Number(item.total_weight) -
|
||||||
|
Number(salesOrder.weight_per_convertion) *
|
||||||
|
Number(salesOrder.total_peti)
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
const initialPricePerConvertion =
|
||||||
|
item?.total_price &&
|
||||||
|
salesOrder?.total_peti &&
|
||||||
|
Number(salesOrder.total_peti) !== 0
|
||||||
|
? (Number(item.total_price) -
|
||||||
|
initialSisaBerat * Number(item.unit_price || 0)) /
|
||||||
|
Number(salesOrder.total_peti)
|
||||||
|
: Number(item?.unit_price || 0);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: salesOrder?.id,
|
id: salesOrder?.id,
|
||||||
unit_price: item.unit_price,
|
unit_price: item.unit_price,
|
||||||
@@ -193,6 +212,9 @@ export const DeliveryProductToFieldValues = (
|
|||||||
avg_weight: item.avg_weight,
|
avg_weight: item.avg_weight,
|
||||||
total_price: item.total_price,
|
total_price: item.total_price,
|
||||||
},
|
},
|
||||||
|
total_peti: salesOrder?.total_peti,
|
||||||
|
weight_per_convertion: salesOrder?.weight_per_convertion,
|
||||||
|
price_per_convertion: initialPricePerConvertion,
|
||||||
} as DeliveryOrderProductFormValues;
|
} as DeliveryOrderProductFormValues;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user