refactor(FE): Fix form error list visibility and field touch handling

This commit is contained in:
rstubryan
2026-02-26 14:12:11 +07:00
parent da0be9cb52
commit 5cd24f2c46
@@ -412,8 +412,8 @@ const InventoryAdjustmentForm = ({
const subtypeOption = val as OptionType | null;
const selectedSubtype = subtypeOption?.value as string;
formik.setFieldValue('transaction_subtype', selectedSubtype);
formik.setFieldTouched('transaction_subtype', true);
formik.setFieldValue('transaction_subtype', selectedSubtype);
setSelectedTransactionSubtype(subtypeOption);
};
@@ -748,7 +748,11 @@ const InventoryAdjustmentForm = ({
readOnly={type === 'detail'}
/>
</div>
<AlertErrorList formErrorList={formErrorList} onClose={close} />
<section
className={`${formErrorList.length > 0 ? 'block' : 'hidden'} mt-4`}
>
<AlertErrorList formErrorList={formErrorList} onClose={close} />
</section>
<div className='flex flex-col sm:flex-row sm:justify-end gap-2 mt-4'>
{type !== 'detail' && (
<>