mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-311): Use latest_approval instead of approval
This commit is contained in:
@@ -61,7 +61,7 @@ const PurchaseOrderStaffApprovalForm = ({
|
||||
return 'add';
|
||||
}
|
||||
|
||||
const currentStep = initialValues?.approval?.step_number || 1;
|
||||
const currentStep = initialValues?.latest_approval?.step_number || 1;
|
||||
|
||||
switch (currentStep) {
|
||||
case 1:
|
||||
@@ -77,7 +77,7 @@ const PurchaseOrderStaffApprovalForm = ({
|
||||
// Step 4+ (Penerimaan Barang dan selesai), tidak boleh edit kalau sudah disetujui
|
||||
return 'edit';
|
||||
}
|
||||
}, [rawDataApprovals, propType, initialValues?.approval?.step_number]);
|
||||
}, [rawDataApprovals, propType, initialValues?.latest_approval?.step_number]);
|
||||
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
@@ -93,16 +93,16 @@ const PurchaseOrderStaffApprovalForm = ({
|
||||
|
||||
// ===== UTILITY FUNCTIONS =====
|
||||
const canUpdatePurchaseItems = useMemo(() => {
|
||||
if (!initialValues?.approval) return false;
|
||||
if (!initialValues?.latest_approval) return false;
|
||||
|
||||
const currentStep = initialValues.approval.step_number;
|
||||
const currentStep = initialValues.latest_approval.step_number;
|
||||
return currentStep >= 3;
|
||||
}, [initialValues?.approval]);
|
||||
}, [initialValues?.latest_approval]);
|
||||
|
||||
const canShowDeleteAddButtons = useMemo(() => {
|
||||
if (!initialValues?.approval) return false;
|
||||
if (!initialValues?.latest_approval) return false;
|
||||
|
||||
const currentStep = initialValues.approval.step_number;
|
||||
const currentStep = initialValues.latest_approval.step_number;
|
||||
|
||||
// Step 2 (Staff Purchase) dengan mode 'add' tidak boleh add/delete items
|
||||
// User hanya boleh input harga dan total harga untuk items yang sudah ada
|
||||
@@ -112,7 +112,7 @@ const PurchaseOrderStaffApprovalForm = ({
|
||||
|
||||
// Step 3 (Manager Purchase) boleh add/delete items
|
||||
return currentStep === 3;
|
||||
}, [initialValues?.approval, type]);
|
||||
}, [initialValues?.latest_approval, type]);
|
||||
|
||||
const isRepeaterInputError = (
|
||||
idx: number,
|
||||
|
||||
Vendored
-1
@@ -61,7 +61,6 @@ export type BasePurchase = {
|
||||
location?: Location;
|
||||
warehouse?: Warehouse;
|
||||
items?: PurchaseItem[];
|
||||
approval?: BaseApproval;
|
||||
latest_approval?: BaseApproval;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user