From 4be719b9d82eab7b42b3f6276478ab29c51cbbcb Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Fri, 26 Dec 2025 16:21:22 +0700 Subject: [PATCH] feat(FE-331): implement permission guard in purchase --- .../pages/purchase/PurchaseTable.tsx | 71 ++++++----- .../order/PurchaseOrderStaffApprovalForm.tsx | 34 +++--- .../purchase/order/PurchaseOrderDetail.tsx | 111 +++++++++++------- 3 files changed, 128 insertions(+), 88 deletions(-) diff --git a/src/components/pages/purchase/PurchaseTable.tsx b/src/components/pages/purchase/PurchaseTable.tsx index a77e1158..81f45cc9 100644 --- a/src/components/pages/purchase/PurchaseTable.tsx +++ b/src/components/pages/purchase/PurchaseTable.tsx @@ -15,6 +15,7 @@ import SelectInput, { OptionType } from '@/components/input/SelectInput'; import RowDropdownOptions from '@/components/table/RowDropdownOptions'; import RowCollapseOptions from '@/components/table/RowCollapseOptions'; import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper'; +import RequirePermission from '@/components/helper/RequirePermission'; import { cn, formatDate } from '@/lib/helper'; import { isResponseSuccess } from '@/lib/api-helper'; @@ -38,15 +39,17 @@ const RowOptionsMenu = ({ }: RowOptionsMenuProps) => { return ( - + + + {/**/} - + + + ); }; @@ -227,15 +232,17 @@ const PurchaseTable = () => {
- + + +
{canUpdatePurchaseItems && canShowDeleteAddButtons && ( - + + + )}
diff --git a/src/components/pages/purchase/order/PurchaseOrderDetail.tsx b/src/components/pages/purchase/order/PurchaseOrderDetail.tsx index 35d9e104..de07ee52 100644 --- a/src/components/pages/purchase/order/PurchaseOrderDetail.tsx +++ b/src/components/pages/purchase/order/PurchaseOrderDetail.tsx @@ -39,19 +39,22 @@ import { toast } from 'react-hot-toast'; import { useSearchParams } from 'next/navigation'; import { formatCurrency, formatNumber, formatDate } from '@/lib/helper'; import { PURCHASE_ORDER_APPROVAL_LINE } from '@/config/approval-line'; +import RequirePermission from '@/components/helper/RequirePermission'; const ItemPembelianDropdown = ({ onEdit }: { onEdit: () => void }) => { return ( - + + + ); }; @@ -59,15 +62,17 @@ const ItemPembelianDropdown = ({ onEdit }: { onEdit: () => void }) => { const PenerimaanBarangDropdown = ({ onEdit }: { onEdit: () => void }) => { return ( - + + + ); }; @@ -496,14 +501,16 @@ const PurchaseOrderDetail = ({ }; return ( - + + + ); }, }, @@ -632,25 +639,45 @@ const PurchaseOrderDetail = ({ {showApprovalButton && (
- + + - + +
)}