feat: add export functionality and simplify laporan user report

refactor: update laporan user service and views for simplified report
style: improve daftar pustaka views and remove unused code
fix: correct date field names in laporan sla penilai service
This commit is contained in:
majid
2025-07-11 17:01:50 +07:00
parent 027c698a11
commit 3f57d361f9
13 changed files with 560 additions and 975 deletions

View File

@@ -4,6 +4,7 @@
{{-- {{ Breadcrumbs::render(request()->route()->getName()) }} --}}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@@ -22,17 +23,36 @@
</div>
</div>
<div class="card-body grid gap-5">
<div
class=" min-w-3xl w-[1280px] h-[768px]">
<div class=" min-w-3xl">
<div class="p-4 h-full flex flex-col">
<div class="flex justify-between items-center mb-4">
<button type="button" id="downloadBtn" class="btn btn-primary btn-sm">
<a href="{{ asset('storage/' . $daftarPustaka->attachment)}}" class="btn btn-primary btn-sm">
<i class="ki-duotone ki-cloud-download me-1"><span class="path1"></span><span
class="path2"></span></i>
Download File
</button>
</a>
</div>
<div id="previewContent" class="flex-grow"></div>
@php
$fileExtension = pathinfo($daftarPustaka->attachment, PATHINFO_EXTENSION);
// cek extension
$isPdf = $fileExtension == 'pdf';
$imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
$isImage = in_array(strtolower($fileExtension), $imageExtensions);
$fileUrl = asset('storage/' . $daftarPustaka->attachment);
@endphp
@if ($isPdf)
<iframe src="{{$fileUrl}}"
width="100%" height="600px" frameborder="0"></iframe>
@elseif ($isImage)
<img src="{{ $fileUrl }}" class="w-full object-contain rounded" />
@else
<p class="text-red-500">File tidak bisa ditampilkan, silakan <a href="{{ $fileUrl }}"
class="text-blue-500 underline" download>unduh di sini</a>.</p>
@endif
</div>
</div>
@@ -47,7 +67,7 @@
</div>
@endsection
@push('scripts')
{{-- @push('scripts')
<script src="{{ asset('vendor/pdfobject.min.js') }}"></script>
<script>
@@ -61,7 +81,12 @@
const urlStorage = 'storage' + '/' + url;
if (['pdf'].includes(fileExtension)) {
PDFObject.embed(urlStorage, "#previewContent");
if (window.innerWidth < 768) {
document.getElementById('pdfFrame').style.display = 'block';
document.getElementById('pdfFrame').src = urlStorage;
} else {
PDFObject.embed(urlStorage, "#previewContent");
}
} else if (['jpg', 'jpeg', 'png', 'gif'].includes(fileExtension)) {
previewContent.innerHTML =
`<img src="${urlStorage}" alt="Preview" class="max-w-full max-h-full object-contain">`;
@@ -70,4 +95,4 @@
}
});
</script>
@endpush
@endpush --}}