Index: src/stock-adjustment-mobile/edit-product-page/edit-product-page.jsx
===================================================================
diff -u -N -rf88f8b7d1f2a79ab3a66389d30d09caceffcda5e -r0f27e4111baccf6dba30207bd168429576fa830f
--- src/stock-adjustment-mobile/edit-product-page/edit-product-page.jsx (.../edit-product-page.jsx) (revision f88f8b7d1f2a79ab3a66389d30d09caceffcda5e)
+++ src/stock-adjustment-mobile/edit-product-page/edit-product-page.jsx (.../edit-product-page.jsx) (revision 0f27e4111baccf6dba30207bd168429576fa830f)
@@ -26,7 +26,7 @@
import SelectField from '../../react-components/form-fields/select-field';
import ReadOnlyField from '../../react-components/form-fields/read-only-field';
import confirmAlertCustom from '../../react-components/modals/confirm';
-import { formatLot, formatDate, formatDateISO, toastProperties, formatProductName } from '../format-utils';
+import { formatLot, formatDate, formatDateISO, toastProperties, isQuantityNotFilled, formatProductName } from '../format-utils';
import AddButton from '../../react-components/buttons/add-button';
import { setAdjustment } from '../reducers/adjustment';
import { setToastList } from '../reducers/toasts';
@@ -61,7 +61,9 @@
stockOnHand: (productVal, itemsVal) => {
const orderable = itemsVal.items[0]?.product ?? [];
if (itemsVal.items[0].hasOwnProperty('lot')) {
- delete itemsVal.items[0].lot;
+ let copiedItemData = Object.assign({}, itemsVal.items[0]);
+ delete copiedItemData.lot;
+ itemsVal = update(itemsVal.items, { [0] : {$set: copiedItemData} })
}
const lotCode = null;
const stockOnHand = getStockOnHand(orderable, lotCode);
@@ -82,10 +84,6 @@
}
), []);
- const isQuantityNotFilled = (quantity) => {
- return _.isUndefined(quantity) || _.isNull(quantity) || _.isNaN(quantity) || quantity === "";
- }
-
const validate = values => {
const errors = { items: [] };
@@ -136,10 +134,10 @@
};
const deleteProduct = () => {
- const adjustmentLenght = adjustment.length;
+ const adjustmentLength = adjustment.length;
dispatch(setAdjustment(update(adjustment, { $splice: [[indexOfProductToEdit, 1]] } )));
showToast('success');
- if (adjustmentLenght > 1) {
+ if (adjustmentLength > 1) {
history.goBack();
}
else{
@@ -206,7 +204,7 @@
options={options}
objectKey="id"
defaultOption={noOptions ? 'Product has no lots' : 'No lot defined'}
- disabled={true}
+ disabled
containerClass='field-full-width'
/>
);
@@ -232,7 +230,7 @@
cancel()}
+ onClick={cancel}
/>
@@ -247,7 +245,7 @@
options={productOptions}
objectKey={[0, 'orderable', 'id']}
containerClass='field-full-width'
- disabled={true}
+ disabled
/>
{renderLotSelect(name, values.items[index].product, values.items[index])}