mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
feat: show existing document
This commit is contained in:
+37
@@ -20,6 +20,9 @@ import { toast } from 'sonner';
|
|||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { DailyChecklistApi } from '@/services/api/daily-checklist/daily-checklist';
|
import { DailyChecklistApi } from '@/services/api/daily-checklist/daily-checklist';
|
||||||
import { isResponseError } from '@/lib/api-helper';
|
import { isResponseError } from '@/lib/api-helper';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import { Icon } from '@iconify/react';
|
||||||
|
import { Document } from '@/types/api/api-general';
|
||||||
|
|
||||||
interface ChecklistDetailRow {
|
interface ChecklistDetailRow {
|
||||||
checklist_id: string;
|
checklist_id: string;
|
||||||
@@ -125,6 +128,7 @@ export function DetailDailyChecklistContent() {
|
|||||||
const [employees, setEmployees] = useState<{ id: string; name: string }[]>(
|
const [employees, setEmployees] = useState<{ id: string; name: string }[]>(
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
const [documents, setDocuments] = useState<Document[]>([]);
|
||||||
|
|
||||||
// Modals
|
// Modals
|
||||||
const [showApproveModal, setShowApproveModal] = useState(false);
|
const [showApproveModal, setShowApproveModal] = useState(false);
|
||||||
@@ -160,6 +164,8 @@ export function DetailDailyChecklistContent() {
|
|||||||
|
|
||||||
const rawDetailChecklist = checklistDataRes?.data;
|
const rawDetailChecklist = checklistDataRes?.data;
|
||||||
|
|
||||||
|
setDocuments(rawDetailChecklist?.document_urls || []);
|
||||||
|
|
||||||
const checklistData = {
|
const checklistData = {
|
||||||
id: rawDetailChecklist?.id,
|
id: rawDetailChecklist?.id,
|
||||||
date: rawDetailChecklist?.date,
|
date: rawDetailChecklist?.date,
|
||||||
@@ -842,6 +848,37 @@ export function DetailDailyChecklistContent() {
|
|||||||
Tidak ada data aktivitas
|
Tidak ada data aktivitas
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{documents.length > 0 && (
|
||||||
|
<div className='mt-6'>
|
||||||
|
<h3 className='font-semibold text-gray-900 mb-2'>
|
||||||
|
Dokumen yang telah diupload
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<ul className='list-disc pl-4'>
|
||||||
|
{documents.map((existingDocument, existingDocumentIdx) => (
|
||||||
|
<li key={existingDocumentIdx}>
|
||||||
|
<div className='w-full flex flex-wrap justify-between'>
|
||||||
|
<Link
|
||||||
|
href={existingDocument.url}
|
||||||
|
target='_blank'
|
||||||
|
rel='noopener noreferrer'
|
||||||
|
className='text-blue-500 underline'
|
||||||
|
>
|
||||||
|
{existingDocument.name}{' '}
|
||||||
|
<Icon
|
||||||
|
icon='cuida:open-in-new-tab-outline'
|
||||||
|
width={12}
|
||||||
|
height={12}
|
||||||
|
className='inline'
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user