feat(FE-331): implement permission guard in closing

This commit is contained in:
ValdiANS
2025-12-24 09:41:48 +07:00
parent f41899dbc9
commit 9d9b9d93db
+13 -10
View File
@@ -15,6 +15,8 @@ import SelectInput, {
import RowDropdownOptions from '@/components/table/RowDropdownOptions'; import RowDropdownOptions from '@/components/table/RowDropdownOptions';
import RowCollapseOptions from '@/components/table/RowCollapseOptions'; import RowCollapseOptions from '@/components/table/RowCollapseOptions';
import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper'; import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper';
import RequirePermission from '@/components/helper/RequirePermission';
import { cn, formatCurrency, formatDate } from '@/lib/helper'; import { cn, formatCurrency, formatDate } from '@/lib/helper';
import { isResponseSuccess } from '@/lib/api-helper'; import { isResponseSuccess } from '@/lib/api-helper';
import { useTableFilter } from '@/services/hooks/useTableFilter'; import { useTableFilter } from '@/services/hooks/useTableFilter';
@@ -43,17 +45,18 @@ const RowOptionsMenu = ({
}) => { }) => {
return ( return (
<RowOptionsMenuWrapper type={type}> <RowOptionsMenuWrapper type={type}>
{/* TODO: apply RBAC */}
<div className='w-full max-h-40 overflow-auto flex flex-col gap-1'> <div className='w-full max-h-40 overflow-auto flex flex-col gap-1'>
<Button <RequirePermission permissions='lti.closing.detail'>
href={`/closing/detail/?closingId=${props.row.original.id}`} <Button
variant='ghost' href={`/closing/detail/?closingId=${props.row.original.id}`}
color='primary' variant='ghost'
className='justify-start text-sm' color='primary'
> className='justify-start text-sm'
<Icon icon='mdi:eye-outline' width={16} height={16} /> >
Detail <Icon icon='mdi:eye-outline' width={16} height={16} />
</Button> Detail
</Button>
</RequirePermission>
</div> </div>
</RowOptionsMenuWrapper> </RowOptionsMenuWrapper>
); );