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:
@@ -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");
|
||||
|
||||
@@ -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>
|
||||
@@ -59,7 +79,12 @@
|
||||
const previewContent = document.getElementById('previewContent');
|
||||
|
||||
if (['pdf'].includes(fileExtension)) {
|
||||
PDFObject.embed(url, "#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="${url}" alt="Preview" class="max-w-full max-h-full object-contain">`;
|
||||
@@ -68,4 +93,4 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endpush --}}
|
||||
|
||||
Reference in New Issue
Block a user