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
committed by putrakuningan
parent 07589370df
commit 3eb402ae08
13 changed files with 560 additions and 971 deletions

View File

@@ -5,6 +5,15 @@
@endsection
@section('content')
<style>
@media (max-width: 768px) {
#previewContent {
height: 400px;
overflow: auto;
}
}
</style>
<div class="flex flex-col items-stretch gap-7">
<div class="flex items-center gap-3 w-full">
@@ -66,10 +75,12 @@
@if (isset($daftar_pustaka))
@foreach ($daftar_pustaka as $item)
<div class="card border shadow-none ">
<a class="show-pustaka h-[300px] w-full block" href="{{ route('daftar-pustaka.show', $item->id) }}"
<a class="show-pustaka h-[300px] bg-gray-200 w-full block" href="{{ route('daftar-pustaka.show', $item->id) }}"
data-url="{{ $item->attachment }}">
<div class="p-4 h-full w-full flex items-center justify-center overflow-hidden">
<div class="preview-content h-full w-full"></div>
<div class=" text-red-500 flex items-center justify-center rounded">
<i class="ki-filled ki-document text-3xl"></i>
</div>
</div>
</a>
@@ -84,18 +95,18 @@
</p>
</a>
<div class="flex justify-between items-center gap-2.5 mt-2">
<p class="badge rounded-full badge-sm badge-outline badge-success text-xs text-gray-700">
<p class="badge rounded-full badge-xs badge-outline badge-success text-xs text-gray-700">
# {{ $item->category->name }}</p>
@auth
@if (auth()->user()->hasRole(['administrator', 'admin']))
<div>
<a class="btn btn-sm btn-danger" onclick="deleteData({{ $item->id }})">
<a class="btn btn-xs btn-danger" onclick="deleteData({{ $item->id }})">
<i class="ki-filled ki-trash">
</i>
Hapus
</a>
<a class="btn btn-sm btn-info"
<a class="btn btn-xs btn-info"
href="{{ route('daftar-pustaka.edit', $item->id) }}">
<i class="ki-filled ki-pencil">
</i>
@@ -120,22 +131,24 @@
<div class="card-body flex items-center flex-wrap justify-between p-2 pe-5 gap-4.5">
<div class="flex items-center gap-3.5">
<div
class="kt-card flex items-center justify-center bg-accent/50 h-[70px] w-[90px] shadow-none">
class="card bg-gray-200 flex items-center justify-center bg-accent/50 h-[70px] w-[90px] shadow-none">
<a class="show-pustaka h-[90px] w-full block"
href="{{ route('daftar-pustaka.show', $item->id) }}"
data-url="{{ $item->attachment }}">
<div class="p-4 h-full w-full flex items-center justify-center overflow-hidden">
<div class="preview-content h-full w-full"></div>
<div class=" text-red-500 flex items-center justify-center rounded">
<i class="ki-filled ki-document text-3xl"></i>
</div>
</div>
</a>
</div>
<a href="{{ route('daftar-pustaka.show', $item->id) }}">
<div class="flex flex-col gap-2 cursor-pointer">
<a href="{{ route('daftar-pustaka.show', $item->id) }}">
<div class="flex items-center mt-1">
<a class="hover:text-primary text-sm font-medium text-mono leading-5.5">
{{ $item->judul }}
</a>
</div>
</div>
</a>
<div class="flex items-center flex-wrap gap-3">
<span class="kt-badge kt-badge-warning kt-badge-sm rounded-full gap-1">
<span class="text-xs font-medium text-foreground">
@@ -144,8 +157,8 @@
</span>
</div>
</a>
</div>
</div>
</a>
</div>
<div class="flex items-center gap-1.5">
<p class="badge rounded-full badge-sm badge-outline badge-success text-xs text-gray-700">
@@ -202,7 +215,6 @@
@endsection
@push('scripts')
<script src="{{ asset('vendor/pdfobject.min.js') }}"></script>
<script type="text/javascript">
function deleteData(data) {
Swal.fire({
@@ -236,30 +248,7 @@
}
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.show-pustaka').forEach(function(element) {
const url = element.getAttribute('data-url');
const previewContent = element.querySelector('.preview-content');
if (!previewContent || !url) return;
const fileExtension = url.split('.').pop().toLowerCase();
if (fileExtension === 'pdf') {
PDFObject.embed(url, previewContent, {
height: "100%",
width: "100%"
});
} else if (['jpg', 'jpeg', 'png', 'gif'].includes(fileExtension)) {
previewContent.innerHTML = `
<img src="${url}" alt="Preview"
class="w-full h-full object-cover rounded" />
`;
} else {
previewContent.innerHTML = '<p class="text-center">Unsupported file type</p>';
}
});
});
function showGrid() {
document.getElementById("daftar_pustaka_grid").classList.remove("hidden");