mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
refactor(FE-208,212): enhance PurchaseOrderDetail and PurchaseOrderStaffApprovalForm to conditionally allow updates based on approval step
This commit is contained in:
@@ -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).'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user