diff --git a/frontend/app/pages/dashboard/admin/internships/edit/[id].vue b/frontend/app/pages/dashboard/admin/internships/edit/[id].vue index 11a5f93..0c15a7d 100644 --- a/frontend/app/pages/dashboard/admin/internships/edit/[id].vue +++ b/frontend/app/pages/dashboard/admin/internships/edit/[id].vue @@ -42,6 +42,36 @@ 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 +}