mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 23:35:45 +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 Link from 'next/link';
|
||||||
import { Icon } from '@iconify/react';
|
import { Icon } from '@iconify/react';
|
||||||
import { Document } from '@/types/api/api-general';
|
import { Document } from '@/types/api/api-general';
|
||||||
|
import RequirePermission from '@/components/helper/RequirePermission';
|
||||||
|
|
||||||
interface ChecklistDetailRow {
|
interface ChecklistDetailRow {
|
||||||
checklist_id: string;
|
checklist_id: string;
|
||||||
@@ -593,25 +594,27 @@ export function DetailDailyChecklistContent() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{header.status === 'SUBMITTED' && (
|
{header.status === 'SUBMITTED' && (
|
||||||
<div className='flex gap-2'>
|
<RequirePermission permissions='lti.daily_checklist.create'>
|
||||||
<Button
|
<div className='flex gap-2'>
|
||||||
onClick={handleApprove}
|
<Button
|
||||||
disabled={actionLoading}
|
onClick={handleApprove}
|
||||||
className='bg-green-600 hover:bg-green-700 text-white'
|
disabled={actionLoading}
|
||||||
>
|
className='bg-green-600 hover:bg-green-700 text-white'
|
||||||
<CheckCircle className='w-4 h-4 mr-2' />
|
>
|
||||||
Approve
|
<CheckCircle className='w-4 h-4 mr-2' />
|
||||||
</Button>
|
Approve
|
||||||
<Button
|
</Button>
|
||||||
onClick={handleReject}
|
<Button
|
||||||
disabled={actionLoading}
|
onClick={handleReject}
|
||||||
variant='destructive'
|
disabled={actionLoading}
|
||||||
className='bg-red-600 hover:bg-red-700 text-white'
|
variant='destructive'
|
||||||
>
|
className='bg-red-600 hover:bg-red-700 text-white'
|
||||||
<XCircle className='w-4 h-4 mr-2' />
|
>
|
||||||
Reject
|
<XCircle className='w-4 h-4 mr-2' />
|
||||||
</Button>
|
Reject
|
||||||
</div>
|
</Button>
|
||||||
|
</div>
|
||||||
|
</RequirePermission>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user