From f32ce9fc99fe4e4f5e535d8bcd88292bc2c892cb Mon Sep 17 00:00:00 2001 From: br0kenpixel <23280129+br0kenpixel@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:23:13 +0100 Subject: [PATCH] feat: simplify internship document viewer and add support for reports --- .../components/InternshipDocumentViewer.vue | 61 +++++++++ .../dashboard/admin/internships/edit/[id].vue | 118 +----------------- frontend/app/types/internships.ts | 2 + 3 files changed, 64 insertions(+), 117 deletions(-) create mode 100644 frontend/app/components/InternshipDocumentViewer.vue diff --git a/frontend/app/components/InternshipDocumentViewer.vue b/frontend/app/components/InternshipDocumentViewer.vue new file mode 100644 index 0000000..5e96484 --- /dev/null +++ b/frontend/app/components/InternshipDocumentViewer.vue @@ -0,0 +1,61 @@ + + + diff --git a/frontend/app/pages/dashboard/admin/internships/edit/[id].vue b/frontend/app/pages/dashboard/admin/internships/edit/[id].vue index 0c15a7d..df93096 100644 --- a/frontend/app/pages/dashboard/admin/internships/edit/[id].vue +++ b/frontend/app/pages/dashboard/admin/internships/edit/[id].vue @@ -42,36 +42,6 @@ async function handleUpdateOfBasicInfo(internship: NewInternship) { } const { data, error, refresh } = await useSanctumFetch(`/api/internships/${route.params.id}`); - -// ---- helpery pre sekciu Dokumenty ---- -const docs = computed(() => { - const d: any = data.value ?? {} - return { - contract: d.documents?.contract ?? d.contract ?? null, - report: d.documents?.report ?? d.report ?? null, - } -}) - -function docUrl(doc: any) { - return doc?.url ?? doc?.download_url ?? doc?.link ?? null -} -function docName(doc: any) { - return doc?.fileName ?? doc?.filename ?? doc?.name ?? 'dokument.pdf' -} -function docSize(doc: any) { - const bytes = doc?.size ?? doc?.filesize ?? null - if (!bytes && bytes !== 0) return null - if (bytes < 1024) return `${bytes} B` - if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB` - return `${(bytes / (1024 * 1024)).toFixed(1)} MB` -} -function docDate(doc: any) { - const dt = doc?.uploadedAt ?? doc?.created_at ?? doc?.uploaded_at ?? null - return dt ? new Date(dt).toLocaleString() : null -} -function docBy(doc: any) { - return doc?.uploadedBy?.name ?? doc?.uploaded_by?.name ?? doc?.uploaded_by ?? null -}