refactor(FE-208,212): enhance PurchaseOrderDetail and PurchaseOrderStaffApprovalForm to conditionally allow updates based on approval step

This commit is contained in:
rstubryan
2025-11-18 22:46:46 +07:00
parent f6afb741af
commit 3a431352ed
2 changed files with 15 additions and 6 deletions
@@ -39,7 +39,7 @@ const PurchaseOrderStaffApprovalForm = ({
useState('');
// ===== UTILITY FUNCTIONS =====
const canUpdatePurchase = useMemo(() => {
const canUpdatePurchaseItems = useMemo(() => {
if (!initialValues?.approval) return false;
const currentStep = initialValues.approval.step_number;
@@ -125,7 +125,7 @@ const PurchaseOrderStaffApprovalForm = ({
validateOnChange: true,
validateOnBlur: true,
onSubmit: async (values) => {
if (type === 'edit' && !canUpdatePurchase) {
if (type === 'edit' && !canUpdatePurchaseItems) {
setPurchaseOrderFormErrorMessage(
'Tidak bisa diupdate. Harus melewati step 4 dahulu (Tahapan Penerimaan Produk).'
);