mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
chore: implement permission guard for approve/reject button
This commit is contained in:
+22
-19
@@ -23,6 +23,7 @@ import { isResponseError } from '@/lib/api-helper';
|
||||
import Link from 'next/link';
|
||||
import { Icon } from '@iconify/react';
|
||||
import { Document } from '@/types/api/api-general';
|
||||
import RequirePermission from '@/components/helper/RequirePermission';
|
||||
|
||||
interface ChecklistDetailRow {
|
||||
checklist_id: string;
|
||||
@@ -593,25 +594,27 @@ export function DetailDailyChecklistContent() {
|
||||
</p>
|
||||
</div>
|
||||
{header.status === 'SUBMITTED' && (
|
||||
<div className='flex gap-2'>
|
||||
<Button
|
||||
onClick={handleApprove}
|
||||
disabled={actionLoading}
|
||||
className='bg-green-600 hover:bg-green-700 text-white'
|
||||
>
|
||||
<CheckCircle className='w-4 h-4 mr-2' />
|
||||
Approve
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleReject}
|
||||
disabled={actionLoading}
|
||||
variant='destructive'
|
||||
className='bg-red-600 hover:bg-red-700 text-white'
|
||||
>
|
||||
<XCircle className='w-4 h-4 mr-2' />
|
||||
Reject
|
||||
</Button>
|
||||
</div>
|
||||
<RequirePermission permissions='lti.daily_checklist.create'>
|
||||
<div className='flex gap-2'>
|
||||
<Button
|
||||
onClick={handleApprove}
|
||||
disabled={actionLoading}
|
||||
className='bg-green-600 hover:bg-green-700 text-white'
|
||||
>
|
||||
<CheckCircle className='w-4 h-4 mr-2' />
|
||||
Approve
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleReject}
|
||||
disabled={actionLoading}
|
||||
variant='destructive'
|
||||
className='bg-red-600 hover:bg-red-700 text-white'
|
||||
>
|
||||
<XCircle className='w-4 h-4 mr-2' />
|
||||
Reject
|
||||
</Button>
|
||||
</div>
|
||||
</RequirePermission>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user