✨ feat(lpj): Perbaiki ekspor, pencarian, validasi tanggal, transaksi, logging, dan UI
- ActivityController: tambah default order `nomor_registrasi` desc; rapikan komentar & alur sorting - LaporanHasilPenilaianJaminanInternalExternalController: pencarian debitur case-insensitive via `LOWER(name)`; normalisasi angka LPJ (luas_tanah, nilai_bangunan, likuidasi, NPW); perapihan spacing - LaporanPenilaiJaminanController: validasi `start_date`/`end_date` dan buat nama file ekspor dinamis via `createNameLaporan`; gunakan `LaporanPenilaiJaminanExport($request)`; helper `getBranchId` - LaporanPenilaianJaminanController: standarisasi respons JSON datatables; tambah `export(Request)` dengan nama `laporan_penilaian_jaminan_<start>_<end>.xlsx` - NilaiPlafondController: bungkus proses datatables dalam transaksi DB (commit/rollback) dengan try/catch; tambah logging info/error; rapikan dan standarisasi respons JSON - PenilaiController: map data pembanding ke `pembanding1/2/3`; tambah `print_out_laporan` dan `showLaporanInspeksi` (penentuan route back); stub `showInspectionReportReview`; perapihan minor - Views debitur/components/debitur: perbaiki closing textarea, konsistensi event listener `function ()`, rapikan markup error - Views debitur/components/jaminan: fallback `dokumen_nomor[$index] ?? ''` untuk hindari undefined index - Views laporan/index: akses aman dengan optional chaining `?.`, fallback tanggal pada `formatDate`, akses `nilaiPlafond` aman - Views laporan-penilai-jaminan/index + show: JS toggle tab (Laporan vs Hasil Inspeksi), CSS `hidden-tab`, gaya floating button, perapihan - Views debitur/index: rapikan directive `@if` spacing pada tombol tambah - Views noc/penyelesaian: perbaiki route key ke `noc.datatables.penyelesaian`
This commit is contained in:
@@ -44,111 +44,119 @@
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
||||
<div class="grid gap-5 mx-auto w-full lg:gap-7.5">
|
||||
|
||||
|
||||
<!-- Filter Card -->
|
||||
<div class="border card border-agi-100">
|
||||
<div class="py-5 card-header bg-agi-50">
|
||||
<h3 class="card-title">Filter Laporan</h3>
|
||||
</div>
|
||||
<div class="grid gap-4 card-body">
|
||||
<!-- Search field at the top, full width -->
|
||||
<div class="flex flex-col w-full">
|
||||
<label class="mb-1 text-sm font-medium">Pencarian</label>
|
||||
<label class="input input-sm">
|
||||
<i class="ki-filled ki-magnifier"></i>
|
||||
<input placeholder="Search Laporan Penilaian Jaminan" id="search" type="text" value="">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Other filter fields in grid layout -->
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||
<div class="flex flex-col">
|
||||
<label class="mb-1 text-base font-medium">Tanggal Awal</label>
|
||||
<label class="input">
|
||||
<input placeholder="Tanggal Awal" id="start_date" type="date">
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label class="mb-1 text-base font-medium">Tanggal Akhir</label>
|
||||
<label class="input">
|
||||
<input placeholder="Tanggal Akhir" id="end_date" type="date">
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label class="mb-1 text-base font-medium">Cabang</label>
|
||||
<select class="select tomselect" id="branch_filter">
|
||||
<option value="">Semua Cabang</option>
|
||||
@foreach (\Modules\Basicdata\Models\Branch::where('status', 1)->get() as $branch)
|
||||
<option value="{{ $branch->id }}">{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
|
||||
<label class="mb-1 text-base font-medium">Laporan</label>
|
||||
<select class="select tomselect" name="laporan[]" id="laporan" multiple>
|
||||
<option value="">Semua Laporan</option>
|
||||
@php
|
||||
$status_laporan = ['Standar', 'Sederhana', 'Memo', 'Resume', 'Call Report', 'RAP'];
|
||||
@endphp
|
||||
@foreach ($status_laporan as $item)
|
||||
<option value="{{ strtolower($item) }}">{{ $item }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Buttons row at the bottom -->
|
||||
<div class="grid grid-cols-1 gap-4 mt-2 md:grid-cols-2">
|
||||
<button class="btn btn-sm btn-primary" id="filter_tanggal">
|
||||
<i class="ki-outline ki-filter fs-2 me-1"></i>
|
||||
Terapkan Filter
|
||||
</button>
|
||||
<button class="btn btn-sm btn-light" id="export-btn">
|
||||
<i class="ki-outline ki-file-down fs-2 me-1"></i>
|
||||
Export to Excel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="min-w-full border card border-agi-100 card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||
data-datatable-state-save="false" id="laporan-penilai-jaminan-table"
|
||||
data-api-url="{{ route('laporan-penilai-jaminan.datatables') }}">
|
||||
<div class="card-header bg-agi-50 py-5 flex-wrap">
|
||||
<div class="flex-wrap py-5 card-header bg-agi-50">
|
||||
<h3 class="card-title">
|
||||
Daftar Laporan Penilai Jaminan
|
||||
</h3>
|
||||
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||
<div class="flex">
|
||||
<label class="input">
|
||||
Start Date
|
||||
<input placeholder="Tanggal Awal" id="tanggal_awal" type="date">
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<label class="input">
|
||||
End Date
|
||||
<input placeholder="Tanggal Akhir" id="tanggal_akhir" type="date">
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<button class="btn btn-primary" id="filter_tanggal">Filter</button>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<label class="input "> <i class="ki-filled ki-magnifier"> </i>
|
||||
<input placeholder="Search Laporan" id="search" type="text" value="">
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<!-- Custom dropdown for status filter -->
|
||||
<div class="dropdown" data-dropdown="true" data-dropdown-trigger="click">
|
||||
<button class="dropdowns-toggle btn btn-light inline-flex justify-between w-full items-center">
|
||||
Pilih Type Laporan
|
||||
<i class="ki-outline ki-down dropdown-open:hidden">
|
||||
</i>
|
||||
<i class="ki-outline ki-up hidden dropdown-open:block">
|
||||
</i>
|
||||
</button>
|
||||
<div
|
||||
class="dropdowns-content w-full max-w-56 py-2 absolute mt-2 origin-top-right z-50 bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5">
|
||||
<div class="menu menu-default flex flex-col w-full">
|
||||
<!-- Checkbox untuk All Status -->
|
||||
<div class="menu-item">
|
||||
<label class="menu-link flex items-center px-4 py-2 text-sm text-gray-700">
|
||||
<input id="select-all" type="checkbox"
|
||||
class="form-checkbox h-4 w-4 text-blue-600">
|
||||
<span class="ml-2">All Status</span>
|
||||
</label>
|
||||
</div>
|
||||
<!-- Dinamis Status dari Backend -->
|
||||
@php
|
||||
$status_laporan = [
|
||||
'Standar',
|
||||
'Sederhana',
|
||||
'Memo',
|
||||
'Resume',
|
||||
'Call Report',
|
||||
'RAP',
|
||||
];
|
||||
@endphp
|
||||
@foreach ($status_laporan as $item)
|
||||
<div class="menu-item">
|
||||
<label class="menu-link flex items-center px-4 py-2 text-sm text-gray-700">
|
||||
<input type="checkbox"
|
||||
class="form-checkbox status-checkbox h-4 w-4 text-blue-600"
|
||||
value="{{ strtolower($item) }}">
|
||||
<span class="ml-2">{{ $item }}</span>
|
||||
</label>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2.5">
|
||||
<div class="h-[24px] border border-r-gray-200"></div>
|
||||
<button class="btn btn-light" id="export-button">
|
||||
Export Excel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="scrollable-x-auto">
|
||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
||||
<table class="table text-sm font-medium text-gray-700 align-middle table-auto table-border"
|
||||
data-datatable-table="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-14">
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"
|
||||
id="check-all" />
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||
<span class="sort"><span class="sort-label">Nomor Registrasi</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||
<span class="sort"> <span class="sort-label"> Tanggal Permohonan </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="branch">
|
||||
<span class="sort"> <span class="sort-label"> Cabang </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||
<span class="sort"><span class="sort-label">User Pemohon</span>
|
||||
<span class="sort"><span class="sort-label">Pemohon</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||
<span class="sort"><span class="sort-label">Debitur</span>
|
||||
<span class="sort"><span class="sort-label">Nama Debitur</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
@@ -157,29 +165,34 @@
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"><span class="sort-label">Jenis Jaminan</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
<th class="min-w-[150px]" data-datatable-column="jenis_agunan">
|
||||
<span class="sort"> <span class="sort-label"> Jenis Jaminan </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
|
||||
<th class="min-w-[150px]" data-datatable-column="laporan">
|
||||
<span class="sort"><span class="sort-label">Laporan</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
|
||||
<th class="" data-datatable-column="actions">
|
||||
<span class="sort"><span class="sort-label">Actions</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div
|
||||
class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
|
||||
<div class="flex items-center gap-2">
|
||||
class="flex-col gap-3 justify-center font-medium text-gray-600 card-footer md:justify-between md:flex-row text-2sm">
|
||||
<div class="flex gap-2 items-center">
|
||||
Show
|
||||
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per
|
||||
<select class="w-16 select select-sm" data-datatable-size="true" name="perpage"> </select> per
|
||||
page
|
||||
</div>
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex gap-4 items-center">
|
||||
<span data-datatable-info="true"> </span>
|
||||
<div class="pagination" data-datatable-pagination="true">
|
||||
</div>
|
||||
@@ -191,34 +204,49 @@
|
||||
|
||||
<!-- Form tersembunyi untuk export -->
|
||||
<form id="export-form" action="{{ route('laporan-penilai-jaminan.export') }}" method="GET" class="hidden">
|
||||
<input type="hidden" name="tanggal_awal" id="export_tanggal_awal">
|
||||
<input type="hidden" name="tanggal_akhir" id="export_tanggal_akhir">
|
||||
<input type="hidden" name="start_date" id="export_tanggal_awal">
|
||||
<input type="hidden" name="end_date" id="export_tanggal_akhir">
|
||||
<input type="hidden" name="status" id="export_status">
|
||||
<input type="hidden" name="branch_id" id="export_branch_id">
|
||||
<input type="hidden" name="laporan" id="export_laporan">
|
||||
<input type="hidden" name="selected_ids" id="export_selected_ids">
|
||||
<input type="hidden" name="export_type" id="export_type" value="all">
|
||||
<input type="hidden" id="export_search" name="search">
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
|
||||
@push('scripts')
|
||||
<script type="module">
|
||||
const element = document.querySelector('#laporan-penilai-jaminan-table');
|
||||
|
||||
const searchInput = document.getElementById('search');
|
||||
const tanggalAwalInput = document.getElementById('tanggal_awal');
|
||||
const tanggalAkhirInput = document.getElementById('tanggal_akhir');
|
||||
const startDateInput = document.getElementById('start_date');
|
||||
const endDateInput = document.getElementById('end_date');
|
||||
const branchFilter = document.getElementById('branch_filter');
|
||||
const laporanFilter = document.getElementById('laporan');
|
||||
const filterTanggalButton = document.getElementById('filter_tanggal');
|
||||
const selectAllCheckbox = document.getElementById('select-all');
|
||||
const exportButton = document.getElementById('export-btn');
|
||||
|
||||
const selectAllCheckbox = document.getElementById('check-all');
|
||||
const statusCheckboxes = document.querySelectorAll('.status-checkbox');
|
||||
|
||||
// Export elements
|
||||
const exportForm = document.getElementById('export-form');
|
||||
const exportButton = document.getElementById('export-button');
|
||||
const exportTanggalAwal = document.getElementById('export_tanggal_awal');
|
||||
const exportTanggalAkhir = document.getElementById('export_tanggal_akhir');
|
||||
const exportStartDate = document.getElementById('export_tanggal_awal');
|
||||
const exportEndDate = document.getElementById('export_tanggal_akhir');
|
||||
const exportBranchId = document.getElementById('export_branch_id');
|
||||
const exportLaporan = document.getElementById('export_laporan');
|
||||
const exportStatus = document.getElementById('export_status');
|
||||
const exportSelectedIds = document.getElementById('export_selected_ids');
|
||||
const exportType = document.getElementById('export_type');
|
||||
|
||||
const exportSearch = document.getElementById('export_search');
|
||||
const apiUrl = element.getAttribute('data-api-url');
|
||||
|
||||
// Simple pagination state management
|
||||
let currentPage = 1;
|
||||
let isReturningFromDetail = false;
|
||||
|
||||
const dataTableOptions = {
|
||||
apiEndpoint: apiUrl,
|
||||
pageSize: 5,
|
||||
@@ -245,12 +273,24 @@
|
||||
nomor_registrasi: {
|
||||
title: 'Nomor Registrasi',
|
||||
},
|
||||
|
||||
tanggal_permohonan: {
|
||||
title: 'Tanggal Permohonan',
|
||||
render: (item, data) => {
|
||||
return data.tanggal_permohonan ? window.formatTanggalIndonesia(data.tanggal_permohonan) :
|
||||
'-';
|
||||
},
|
||||
},
|
||||
branch: {
|
||||
title: 'Cabang',
|
||||
render: (item, data) => {
|
||||
return data.branch && data.branch.name ? `${data.branch.name}` : '-';
|
||||
},
|
||||
},
|
||||
user_id: {
|
||||
title: 'User Pemohon',
|
||||
render: (item, data) => {
|
||||
return data.user && data.user.name ? `${data.user.name}` : '-';
|
||||
},
|
||||
return data?.user?.name ?? data?.mig_nama_ao ?? '-';
|
||||
}
|
||||
},
|
||||
debitur_id: {
|
||||
title: 'Debitur',
|
||||
@@ -265,18 +305,18 @@
|
||||
`${data.tujuan_penilaian.name}` : '-';
|
||||
},
|
||||
},
|
||||
jenis_jaminan_id: {
|
||||
jenis_agunan: {
|
||||
title: 'Jenis Jaminan',
|
||||
render: (item, data) => {
|
||||
const jenisJaminan = data.dokumenjaminan.map(d => d.jenis_jaminan.name).join(', ');
|
||||
return jenisJaminan || '-';
|
||||
}
|
||||
return data.dokumenjaminan.map((item) => {
|
||||
return item.jenis_jaminan ? item.jenis_jaminan.name : '-';
|
||||
}).join(', ');
|
||||
},
|
||||
},
|
||||
laporan: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
let badgeClass = '';
|
||||
|
||||
const statusLaporan = data.penilai?.type_penilai || '-';
|
||||
|
||||
switch (statusLaporan.toLowerCase()) {
|
||||
@@ -302,17 +342,114 @@
|
||||
return `<span class="badge ${badgeClass}">${statusLaporan}</span>`;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
title: 'Action',
|
||||
render: (item, data) => {
|
||||
const status = data.status;
|
||||
const dokumenjaminan = data.dokumenjaminan || [];
|
||||
|
||||
return `
|
||||
<div class="flex flex-nowrap gap-1 justify-center">
|
||||
${
|
||||
['done'].includes(status) ?
|
||||
dokumenjaminan.map(dokumen => {
|
||||
return `
|
||||
<a class="btn btn-sm btn-primary" href="surveyor/print-out-inspeksi/${data.id}/${dokumen.id}/${dokumen.jenis_jaminan_id}">
|
||||
<i class="ki-outline ki-printer"></i>Inspeksi
|
||||
</a>
|
||||
<a class="btn btn-sm btn-info detail-btn" href="laporan-penilai-jaminan/show/${data.id}/${dokumen.id}/${dokumen.jenis_jaminan_id}">
|
||||
<i class="ki-filled ki-eye"></i>Lihat
|
||||
</a>
|
||||
<a class="btn btn-sm btn-success" href="penilai/print-out-laporan/${data.id}/${dokumen.id}/${dokumen.jenis_jaminan_id}">
|
||||
<i class="ki-filled ki-printer"></i>Laporan
|
||||
</a>
|
||||
`;
|
||||
}).join('') : ''
|
||||
}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
const fromDetail = true;
|
||||
if (fromDetail) {
|
||||
isReturningFromDetail = true;
|
||||
console.log('Returning from detail page');
|
||||
// Remove the parameter from URL
|
||||
window.history.replaceState({}, document.title, window.location.pathname);
|
||||
setTimeout(() => {
|
||||
restoreCurrentPage();
|
||||
isReturningFromDetail = false;
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function getCurrentPageFromDOM() {
|
||||
const activePage = document.querySelector('.pagination .btn.active');
|
||||
if (activePage) {
|
||||
const pageText = activePage.textContent.trim();
|
||||
const pageNum = parseInt(pageText);
|
||||
return isNaN(pageNum) ? 1 : pageNum;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
function saveCurrentPage() {
|
||||
const page = getCurrentPageFromDOM();
|
||||
currentPage = page;
|
||||
sessionStorage.setItem('currentTablePage', currentPage.toString());
|
||||
}
|
||||
|
||||
function restoreCurrentPage() {
|
||||
const savedPage = sessionStorage.getItem('currentTablePage');
|
||||
if (savedPage && savedPage !== '1') {
|
||||
currentPage = parseInt(savedPage);
|
||||
console.log('Restoring to page:', currentPage);
|
||||
|
||||
// Use the goPage method to navigate to the saved page
|
||||
dataTable.goPage(currentPage);
|
||||
}
|
||||
}
|
||||
|
||||
// Listen for pagination events to track current page
|
||||
element.addEventListener('pagination', function(e) {
|
||||
const page = e.detail.page;
|
||||
currentPage = page;
|
||||
console.log('Page changed to:', page);
|
||||
});
|
||||
|
||||
// Alternative: Listen for pagination button clicks
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target.matches('.pagination .btn') && !e.target.closest('.detail-btn')) {
|
||||
setTimeout(() => {
|
||||
currentPage = getCurrentPageFromDOM();
|
||||
console.log('Current page updated to:', currentPage);
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
// Detail page redirection
|
||||
document.addEventListener('click', function(e) {
|
||||
if (e.target.closest('.detail-btn')) {
|
||||
e.preventDefault();
|
||||
|
||||
// Save current page before navigating
|
||||
const currentPageNum = getCurrentPageFromDOM();
|
||||
currentPage = currentPageNum;
|
||||
sessionStorage.setItem('currentTablePage', currentPage.toString());
|
||||
console.log('Saving page before detail navigation:', currentPage);
|
||||
|
||||
const link = e.target.closest('.detail-btn');
|
||||
const href = link.getAttribute('href');
|
||||
window.location.href = href;
|
||||
}
|
||||
});
|
||||
|
||||
// Search functionality
|
||||
searchInput.addEventListener('input', function() {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
applyDateFilter();
|
||||
});
|
||||
|
||||
// Filter by date range
|
||||
@@ -321,20 +458,30 @@
|
||||
});
|
||||
|
||||
function applyDateFilter() {
|
||||
const tanggalAwal = tanggalAwalInput.value;
|
||||
const tanggalAkhir = tanggalAkhirInput.value;
|
||||
const startDate = startDateInput.value;
|
||||
const endDate = endDateInput.value;
|
||||
const branch = branchFilter.value;
|
||||
const laporan = Array.from(laporanFilter.selectedOptions).map(option => option.value);
|
||||
|
||||
let filters = {};
|
||||
if (searchInput.value) {
|
||||
filters.search = searchInput.value;
|
||||
}
|
||||
|
||||
if (tanggalAwal) {
|
||||
filters.tanggal_awal = tanggalAwal
|
||||
if (startDate) {
|
||||
filters.start_date = startDate;
|
||||
}
|
||||
|
||||
if (tanggalAkhir) {
|
||||
filters.tanggal_akhir = tanggalAkhir
|
||||
if (endDate) {
|
||||
filters.end_date = endDate;
|
||||
}
|
||||
|
||||
if (branch) {
|
||||
filters.branch_id = branch;
|
||||
}
|
||||
|
||||
if (laporan.length > 0) {
|
||||
filters.laporan = laporan;
|
||||
}
|
||||
|
||||
dataTable.search(filters);
|
||||
@@ -361,10 +508,8 @@
|
||||
|
||||
if (selectedStatuses.length === 0) {
|
||||
dataTable.search('');
|
||||
console.log(selectedStatuses);
|
||||
} else {
|
||||
dataTable.search(selectedStatuses.join(','), true);
|
||||
console.log(selectedStatuses);
|
||||
}
|
||||
|
||||
dataTable.reload();
|
||||
@@ -374,30 +519,33 @@
|
||||
selectAllCheckbox.checked = allChecked;
|
||||
}
|
||||
|
||||
// Single export button functionality
|
||||
// Export functionality
|
||||
exportButton.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Check if any rows are selected
|
||||
const selectedIds = getSelectedRowIds();
|
||||
|
||||
// Determine export type based on context
|
||||
if (selectedIds.length > 0) {
|
||||
// If rows are selected, export those
|
||||
exportData({
|
||||
selected_ids: selectedIds,
|
||||
export_type: 'selected'
|
||||
});
|
||||
} else if (tanggalAwalInput.value && tanggalAkhirInput.value || getSelectedStatuses().length > 0) {
|
||||
// If filters are applied but no rows selected, export filtered data
|
||||
} else if (startDateInput.value && endDateInput.value || getSelectedStatuses().length > 0) {
|
||||
exportData({
|
||||
tanggal_awal: tanggalAwalInput.value,
|
||||
tanggal_akhir: tanggalAkhirInput.value,
|
||||
start_date: startDateInput.value,
|
||||
end_date: endDateInput.value,
|
||||
branch_id: branchFilter.value,
|
||||
laporan: Array.from(laporanFilter.selectedOptions).map(option => option.value),
|
||||
status: getSelectedStatuses(),
|
||||
search: searchInput.value,
|
||||
export_type: 'filtered'
|
||||
});
|
||||
} else if (searchInput.value) {
|
||||
exportData({
|
||||
search: searchInput.value,
|
||||
export_type: 'filtered'
|
||||
});
|
||||
} else {
|
||||
// If no selection and no filters, export all
|
||||
exportData({
|
||||
export_type: 'all'
|
||||
});
|
||||
@@ -405,14 +553,14 @@
|
||||
});
|
||||
|
||||
function exportData(filters = {}) {
|
||||
// Set filter values in the hidden form
|
||||
exportTanggalAwal.value = filters.tanggal_awal || '';
|
||||
exportTanggalAkhir.value = filters.tanggal_akhir || '';
|
||||
exportStartDate.value = filters.start_date || '';
|
||||
exportEndDate.value = filters.end_date || '';
|
||||
exportStatus.value = filters.status ? filters.status.join(',') : '';
|
||||
exportBranchId.value = filters.branch_id || '';
|
||||
exportLaporan.value = filters.laporan ? filters.laporan.join(',') : '';
|
||||
exportSelectedIds.value = filters.selected_ids ? filters.selected_ids.join(',') : '';
|
||||
exportType.value = filters.export_type || 'all';
|
||||
|
||||
// Submit the form
|
||||
exportSearch.value = filters.search || '';
|
||||
exportForm.submit();
|
||||
}
|
||||
|
||||
@@ -426,5 +574,12 @@
|
||||
const checkboxes = document.querySelectorAll('[data-datatable-row-check="true"]:checked');
|
||||
return Array.from(checkboxes).map(checkbox => checkbox.value);
|
||||
}
|
||||
|
||||
// Save page before leaving (only when not going to detail)
|
||||
window.addEventListener('beforeunload', function() {
|
||||
if (!isReturningFromDetail) {
|
||||
saveCurrentPage();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
117
resources/views/laporan-penilai-jaminan/show.blade.php
Normal file
117
resources/views/laporan-penilai-jaminan/show.blade.php
Normal file
@@ -0,0 +1,117 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{-- {{ Breadcrumbs::render(request()->route()->getName()) }} --}}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card">
|
||||
<div class="card-header py-5 flex-wrap">
|
||||
<div class="card-title flex flex-row gap-1.5">
|
||||
<button id="tab-laporan" class="btn btn-sm btn-primary">Laporan</button>
|
||||
<button id="tab-hasil" class="btn btn-sm btn-light">Hasil Inspeksi</button>
|
||||
</div>
|
||||
<div class="flex items-wrap gap-2.5">
|
||||
<a href="{{ route('laporan-penilai-jaminan.index') }}" class="btn btn-xs btn-info"><i
|
||||
class="ki-filled ki-exit-left"></i>
|
||||
Back</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@php
|
||||
$permohonan_id = request()->segment(3);
|
||||
$dokumen_id = request()->segment(4);
|
||||
$jenis_jaminan_id = request()->segment(5);
|
||||
@endphp
|
||||
|
||||
<div id="laporan" class="tab-content">
|
||||
<div class="floating-button">
|
||||
<a href="penilai/print-out-laporan/{{ $permohonan_id }}/{{ $dokumen_id }}/{{ $jenis_jaminan_id }}" class="btn btn-primary">
|
||||
Cetak Laporan
|
||||
<i class="ki-filled ki-printer"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$laporan = [
|
||||
'sederhana' => 'lpj::penilai.components.print-out-sederhana',
|
||||
'standar' => 'lpj::penilai.components.print-out-standar',
|
||||
'resume' => 'lpj::penilai.components.print-resume',
|
||||
'memo' => 'lpj::penilai.components.print-memo',
|
||||
'rap' => 'lpj::penilai.components.print-out-rap',
|
||||
'call-report' => 'penilai.components.print-out-call-report',
|
||||
];
|
||||
@endphp
|
||||
@if (array_key_exists($lpj->type_penilai, $laporan))
|
||||
@include($laporan[$lpj->type_penilai])
|
||||
@else
|
||||
<p>Tipe laporan tidak ditemukan.</p>
|
||||
@endif
|
||||
</div>
|
||||
<div id="hasil-inspeksi" class="tab-content hidden-tab">
|
||||
<div class="floating-button">
|
||||
<a href="surveyor/print-out-inspeksi/{{ $permohonan_id }}/{{ $dokumen_id }}/{{ $jenis_jaminan_id }}"
|
||||
class="btn btn-primary">
|
||||
Cetak Laporan
|
||||
<i class="ki-filled ki-printer"></i>
|
||||
</a>
|
||||
</div>
|
||||
@include('lpj::surveyor.components.print-out.main')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const tabLaporan = document.getElementById('tab-laporan');
|
||||
const tabHasil = document.getElementById('tab-hasil');
|
||||
const laporanContent = document.getElementById('laporan');
|
||||
const hasilContent = document.getElementById('hasil-inspeksi');
|
||||
|
||||
tabLaporan.addEventListener('click', () => {
|
||||
tabLaporan.classList.add('btn-primary');
|
||||
tabLaporan.classList.remove('btn-light');
|
||||
tabHasil.classList.add('btn-light');
|
||||
tabHasil.classList.remove('btn-primary');
|
||||
laporanContent.classList.remove('hidden-tab');
|
||||
hasilContent.classList.add('hidden-tab');
|
||||
});
|
||||
|
||||
tabHasil.addEventListener('click', () => {
|
||||
tabHasil.classList.add('btn-primary');
|
||||
tabHasil.classList.remove('btn-light');
|
||||
tabLaporan.classList.add('btn-light');
|
||||
tabLaporan.classList.remove('btn-primary');
|
||||
laporanContent.classList.add('hidden-tab');
|
||||
hasilContent.classList.remove('hidden-tab');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.hidden-tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.floating-button {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.floating-button .btn {
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 50px;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.floating-button .btn:hover {
|
||||
transform: scale(1.05);
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
</style>
|
||||
|
||||
{{-- @include('lpj::surveyor.js.utils') --}}
|
||||
@endsection
|
||||
Reference in New Issue
Block a user