refactor(FE): Fix form reset and selection handling in

SalesOrderFormModal
This commit is contained in:
rstubryan
2026-02-09 11:49:08 +07:00
parent 862cf38f92
commit ba0753428d
2 changed files with 11 additions and 2 deletions
@@ -394,7 +394,7 @@ const SalesOrderFormModal = ({
}
formik.setFieldValue('sales_order', updatedProducts);
console.log(formik.values);
setSelectedMarketingProduct(null);
nextButtonHandler();
},
[memoSalesOrder, nextButtonHandler]
@@ -418,6 +418,15 @@ const SalesOrderFormModal = ({
if (modalAction === 'add' || modalAction === 'edit') {
setCurrentModalAction(modalAction);
formModal.openModal();
if (modalAction === 'add') {
formik.resetForm();
setStep(1);
setSelectedMarketingProduct(null);
setSelectedDeliveryProduct(null);
setFormErrorMessage('');
setFormErrorList([]);
}
}
}, [modalAction]);
@@ -49,7 +49,7 @@ const DeliveryOrderProductTable = ({
return (
<>
<tr className='border-b border-t border-tools-table-outline border-base-content/5'>
<tr className='border-b border-tools-table-outline border-base-content/5'>
<th className='w-1/3 text-start not-first:font-medium text-base-content/50 text-sm px-4 py-3'>
Label
</th>