fix: perbaiki navigasi back di halaman laporan penilai dan tampilkan gambar/pdf pada daftar pustaka

This commit is contained in:
majid
2025-07-08 17:04:19 +07:00
parent 05f87f4767
commit 027c698a11
5 changed files with 122 additions and 36 deletions

View File

@@ -58,11 +58,13 @@
const fileExtension = url.split('.').pop().toLowerCase();
const previewContent = document.getElementById('previewContent');
const urlStorage = 'storage' + '/' + url;
if (['pdf'].includes(fileExtension)) {
PDFObject.embed(url, "#previewContent");
PDFObject.embed(urlStorage, "#previewContent");
} else if (['jpg', 'jpeg', 'png', 'gif'].includes(fileExtension)) {
previewContent.innerHTML =
`<img src="${url}" alt="Preview" class="max-w-full max-h-full object-contain">`;
`<img src="${urlStorage}" alt="Preview" class="max-w-full max-h-full object-contain">`;
} else {
previewContent.innerHTML = '<p class="text-center">Unsupported file type</p>';
}