mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
fix: set initialPricePerConvertion to unit_price
This commit is contained in:
+24
-12
@@ -61,14 +61,18 @@ const SalesOrderProductForm = ({
|
||||
Number(initialValues.total_peti)
|
||||
: 0;
|
||||
|
||||
const initialPricePerConvertion =
|
||||
initialValues?.total_price &&
|
||||
initialValues?.total_peti &&
|
||||
Number(initialValues.total_peti) !== 0
|
||||
? (Number(initialValues.total_price) -
|
||||
initialSisaBerat * Number(initialValues.unit_price || 0)) /
|
||||
Number(initialValues.total_peti)
|
||||
: 0;
|
||||
// const initialPricePerConvertion =
|
||||
// initialValues?.total_price &&
|
||||
// initialValues?.total_peti &&
|
||||
// Number(initialValues.total_peti) !== 0
|
||||
// ? (Number(initialValues.total_price) -
|
||||
// initialSisaBerat * Number(initialValues.unit_price || 0)) /
|
||||
// Number(initialValues.total_peti)
|
||||
// : 0;
|
||||
|
||||
const initialPricePerConvertion = initialValues?.unit_price
|
||||
? Number(initialValues?.unit_price)
|
||||
: 0;
|
||||
|
||||
const initialPriceSisaBerat =
|
||||
initialValues?.total_price && initialValues?.total_peti
|
||||
@@ -135,6 +139,11 @@ const SalesOrderProductForm = ({
|
||||
);
|
||||
}, [selectedProductWarehouse, formik.values.marketing_type]);
|
||||
|
||||
console.log({
|
||||
initialValues,
|
||||
values: formik.values,
|
||||
});
|
||||
|
||||
// ===== Options =====
|
||||
const {
|
||||
options: warehouseOptions,
|
||||
@@ -523,7 +532,7 @@ const SalesOrderProductForm = ({
|
||||
<input
|
||||
type='radio'
|
||||
checked={
|
||||
formik.values.convertion_unit?.value ===
|
||||
formik.values.convertion_unit?.value.toLowerCase() ===
|
||||
option.value
|
||||
}
|
||||
onChange={() => null}
|
||||
@@ -546,7 +555,9 @@ const SalesOrderProductForm = ({
|
||||
} per ${formik.values.convertion_unit?.value}`}
|
||||
value={formik.values.weight_per_convertion ?? ''}
|
||||
onChange={(e) => {
|
||||
const value = Number(e.target.value);
|
||||
const value = Number(e.target.value)
|
||||
? Number(e.target.value)
|
||||
: '';
|
||||
handleFieldChange('weight_per_convertion', value, () =>
|
||||
setCurrentInput(e.target.name)
|
||||
);
|
||||
@@ -699,7 +710,8 @@ const SalesOrderProductForm = ({
|
||||
formik.values.convertion_unit?.value.toLowerCase() === 'kg') && (
|
||||
<NumberInput
|
||||
required
|
||||
label={`Harga / ${formik.values.convertion_unit?.label ?? 'Produk'} (Rp)`}
|
||||
// TODO: delete 'asdf' later
|
||||
label={`asdf Harga / ${formik.values.convertion_unit?.label ?? 'Produk'} (Rp)`}
|
||||
name='price_per_convertion'
|
||||
value={formik.values.price_per_convertion ?? undefined}
|
||||
onChange={(e) => {
|
||||
@@ -745,7 +757,7 @@ const SalesOrderProductForm = ({
|
||||
formik.values.convertion_unit?.value.toLowerCase() !== 'kg' && (
|
||||
<NumberInput
|
||||
required
|
||||
label={`Harga / ${formik.values.convertion_unit?.label !== 'qty' ? 'Kg' : (selectedProductWarehouse?.product?.uom?.name ?? 'Produk')} (Rp)`}
|
||||
label={`asdff Harga / ${formik.values.convertion_unit?.label !== 'qty' ? 'Kg' : (selectedProductWarehouse?.product?.uom?.name ?? 'Produk')} (Rp)`}
|
||||
name='unit_price'
|
||||
value={formik.values.unit_price}
|
||||
onChange={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user