fix: resolve client-side table search limitation across all 7 paginated views with global server search and per-page selector
This commit is contained in:
@@ -143,7 +143,12 @@ class EmployeeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
$employees = $this->getFilteredEmployees($request)->paginate(20)->withQueryString();
|
$perPage = (int) $request->input('per_page', 20);
|
||||||
|
if (!in_array($perPage, [20, 50, 100])) {
|
||||||
|
$perPage = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
$employees = $this->getFilteredEmployees($request)->paginate($perPage)->withQueryString();
|
||||||
|
|
||||||
$employeeTypes = Employee::whereNotNull('employee_type')
|
$employeeTypes = Employee::whereNotNull('employee_type')
|
||||||
->where('employee_type', '!=', '')
|
->where('employee_type', '!=', '')
|
||||||
|
|||||||
@@ -122,7 +122,12 @@ class VerificationLogController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
$activities = $this->getVerificationLogsQuery($request)->paginate(20)->withQueryString();
|
$perPage = (int) $request->input('per_page', 20);
|
||||||
|
if (!in_array($perPage, [20, 50, 100])) {
|
||||||
|
$perPage = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
$activities = $this->getVerificationLogsQuery($request)->paginate($perPage)->withQueryString();
|
||||||
$gates = Gate::where('is_active', true)->orderBy('name')->get();
|
$gates = Gate::where('is_active', true)->orderBy('name')->get();
|
||||||
$guards = SecurityGuard::orderBy('name')->get();
|
$guards = SecurityGuard::orderBy('name')->get();
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,12 @@ class ActivityLogController extends Controller
|
|||||||
$startDate = $request->input('start_date', $today);
|
$startDate = $request->input('start_date', $today);
|
||||||
$endDate = $request->input('end_date', $today);
|
$endDate = $request->input('end_date', $today);
|
||||||
|
|
||||||
$activities = $this->getFilteredActivityQuery($request)->paginate(20)->withQueryString();
|
$perPage = (int) $request->input('per_page', 20);
|
||||||
|
if (!in_array($perPage, [20, 50, 100])) {
|
||||||
|
$perPage = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
$activities = $this->getFilteredActivityQuery($request)->paginate($perPage)->withQueryString();
|
||||||
$gates = Gate::where('is_active', true)->orderBy('name')->get();
|
$gates = Gate::where('is_active', true)->orderBy('name')->get();
|
||||||
|
|
||||||
return view('qma.activity_log', compact('activities', 'gates', 'startDate', 'endDate'));
|
return view('qma.activity_log', compact('activities', 'gates', 'startDate', 'endDate'));
|
||||||
|
|||||||
@@ -58,7 +58,12 @@ class P2hInspectionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
$records = $this->getFilteredP2hQuery($request)->paginate(15)->withQueryString();
|
$perPage = (int) $request->input('per_page', 15);
|
||||||
|
if (!in_array($perPage, [15, 50, 100])) {
|
||||||
|
$perPage = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
$records = $this->getFilteredP2hQuery($request)->paginate($perPage)->withQueryString();
|
||||||
|
|
||||||
// Statistik Ringkasan P2H
|
// Statistik Ringkasan P2H
|
||||||
$totalP2h = P2hRecord::count();
|
$totalP2h = P2hRecord::count();
|
||||||
|
|||||||
@@ -125,8 +125,13 @@ class SupportTimesheetController extends Controller
|
|||||||
|
|
||||||
// Jika user belum mengisi filter tanggal dan ingin semua, bisa dikosongkan.
|
// Jika user belum mengisi filter tanggal dan ingin semua, bisa dikosongkan.
|
||||||
// Tapi default awal memuat hari ini agar cepat dan relevan.
|
// Tapi default awal memuat hari ini agar cepat dan relevan.
|
||||||
|
$perPage = (int) $request->input('per_page', 15);
|
||||||
|
if (!in_array($perPage, [15, 50, 100])) {
|
||||||
|
$perPage = 15;
|
||||||
|
}
|
||||||
|
|
||||||
$query = $this->getFilteredQuery($request);
|
$query = $this->getFilteredQuery($request);
|
||||||
$timesheets = $query->paginate(15)->withQueryString();
|
$timesheets = $query->paginate($perPage)->withQueryString();
|
||||||
|
|
||||||
// KPI Ringkasan Data Terfilter
|
// KPI Ringkasan Data Terfilter
|
||||||
$statsQuery = clone $this->getFilteredQuery($request);
|
$statsQuery = clone $this->getFilteredQuery($request);
|
||||||
|
|||||||
@@ -115,7 +115,12 @@ class VehicleController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function indexLv(Request $request): View
|
public function indexLv(Request $request): View
|
||||||
{
|
{
|
||||||
$vehicles = $this->getFilteredLvQuery($request)->paginate(15)->withQueryString();
|
$perPage = (int) $request->input('per_page', 15);
|
||||||
|
if (!in_array($perPage, [15, 50, 100])) {
|
||||||
|
$perPage = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
$vehicles = $this->getFilteredLvQuery($request)->paginate($perPage)->withQueryString();
|
||||||
|
|
||||||
// Statistik Ringkasan Khusus LV
|
// Statistik Ringkasan Khusus LV
|
||||||
$totalLv = Vehicle::lightVehicles()->count();
|
$totalLv = Vehicle::lightVehicles()->count();
|
||||||
@@ -303,7 +308,12 @@ class VehicleController extends Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$vehicles = $query->orderBy('code')->paginate(15)->withQueryString();
|
$perPage = (int) $request->input('per_page', 15);
|
||||||
|
if (!in_array($perPage, [15, 50, 100])) {
|
||||||
|
$perPage = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
$vehicles = $query->orderBy('code')->paginate($perPage)->withQueryString();
|
||||||
|
|
||||||
// Statistik Ringkasan Khusus Heavy Equipment
|
// Statistik Ringkasan Khusus Heavy Equipment
|
||||||
$totalSupport = Vehicle::unitSupportCategories()->count();
|
$totalSupport = Vehicle::unitSupportCategories()->count();
|
||||||
@@ -386,7 +396,12 @@ class VehicleController extends Controller
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$units = $query->paginate(15)->withQueryString();
|
$perPage = (int) $request->input('per_page', 15);
|
||||||
|
if (!in_array($perPage, [15, 50, 100])) {
|
||||||
|
$perPage = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
$units = $query->paginate($perPage)->withQueryString();
|
||||||
|
|
||||||
$totalUnits = $category->units()->count();
|
$totalUnits = $category->units()->count();
|
||||||
$totalOperation = $category->units()->where('status', 'Operation')->count();
|
$totalOperation = $category->units()->where('status', 'Operation')->count();
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Kotak Pencarian & Filter Status Simper (Tanpa Card Wrapper, Format Referensi) -->
|
<!-- Kotak Pencarian & Filter Status Simper (Tanpa Card Wrapper, Format Referensi) -->
|
||||||
<form method="GET" action="{{ route('hse.employees.index') }}" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
|
<form method="GET" action="{{ route('hse.employees.index') }}" id="employeeFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
|
||||||
<!-- Pencarian Cepat di Kiri -->
|
<!-- Pencarian Cepat di Kiri -->
|
||||||
<div class="relative w-full sm:max-w-md">
|
<div class="relative w-full sm:max-w-md">
|
||||||
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
class="w-full text-xs pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition">
|
class="w-full text-xs pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Filter di Kanan (Pada Mobile: Sejajar 2 Kolom di Bawah Search Bar) -->
|
<!-- Filter di Kanan (Pada Mobile: Sejajar di Bawah Search Bar) -->
|
||||||
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-2 sm:gap-2.5 w-full sm:w-auto">
|
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-2 sm:gap-2.5 w-full sm:w-auto">
|
||||||
<div class="grid grid-cols-2 gap-2 sm:flex sm:items-center sm:gap-2.5 w-full sm:w-auto">
|
<div class="grid grid-cols-2 gap-2 sm:flex sm:items-center sm:gap-2.5 w-full sm:w-auto">
|
||||||
<!-- Filter Jenis Personil / Karyawan -->
|
<!-- Filter Jenis Personil / Karyawan -->
|
||||||
@@ -118,11 +118,25 @@
|
|||||||
<option value="expiring_soon" {{ request('simper_status') === 'expiring_soon' ? 'selected' : '' }}>Segera Habis (≤ 30 Hari)</option>
|
<option value="expiring_soon" {{ request('simper_status') === 'expiring_soon' ? 'selected' : '' }}>Segera Habis (≤ 30 Hari)</option>
|
||||||
<option value="expired" {{ request('simper_status') === 'expired' ? 'selected' : '' }}>Kedaluwarsa (Expired)</option>
|
<option value="expired" {{ request('simper_status') === 'expired' ? 'selected' : '' }}>Kedaluwarsa (Expired)</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- Filter Tampilan Per Halaman -->
|
||||||
|
<select name="per_page"
|
||||||
|
onchange="this.form.submit()"
|
||||||
|
class="w-full sm:w-auto text-xs rounded-xl border border-slate-200 bg-white px-2.5 sm:px-3 py-2.5 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition truncate">
|
||||||
|
<option value="20" {{ request('per_page', '20') == '20' ? 'selected' : '' }}>20 / Hal</option>
|
||||||
|
<option value="50" {{ request('per_page') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- Tombol Submit Pencarian -->
|
||||||
|
<button type="submit" class="px-4 py-2.5 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-sm cursor-pointer whitespace-nowrap col-span-2 sm:col-span-1">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tombol Reset Filter (Sesuai Referensi Merah / Rose Clean Text) -->
|
<!-- Tombol Reset Filter (Sesuai Referensi Merah / Rose Clean Text) -->
|
||||||
<div id="simperResetContainer">
|
<div id="simperResetContainer">
|
||||||
@if(request()->anyFilled(['search', 'employee_type', 'driver_status', 'simper_status']))
|
@if(request()->anyFilled(['search', 'employee_type', 'driver_status', 'simper_status', 'per_page']))
|
||||||
<a href="{{ route('hse.employees.index') }}"
|
<a href="{{ route('hse.employees.index') }}"
|
||||||
id="simperResetBtn"
|
id="simperResetBtn"
|
||||||
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2">
|
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2">
|
||||||
@@ -1217,87 +1231,22 @@
|
|||||||
document.getElementById('renewModal').classList.remove('hidden');
|
document.getElementById('renewModal').classList.remove('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter Pencarian Instan Real-time
|
// Pencarian Server-side Otomatis (Global ke seluruh database)
|
||||||
|
const employeeFilterForm = document.getElementById('employeeFilterForm');
|
||||||
const searchInput = document.getElementById('simperSearchInput');
|
const searchInput = document.getElementById('simperSearchInput');
|
||||||
const resetContainer = document.getElementById('simperResetContainer');
|
let searchDebounce = null;
|
||||||
const tableBody = document.getElementById('simperTableBody');
|
|
||||||
const hasServerFilters = {{ request()->anyFilled(['search', 'driver_status', 'simper_status']) ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
function escapeHtml(str) {
|
if (searchInput && searchInput.value) {
|
||||||
const div = document.createElement('div');
|
searchInput.focus();
|
||||||
div.textContent = str;
|
const len = searchInput.value.length;
|
||||||
return div.innerHTML;
|
searchInput.setSelectionRange(len, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchInput?.addEventListener('input', function(e) {
|
searchInput?.addEventListener('input', function() {
|
||||||
const rawValue = e.target.value;
|
clearTimeout(searchDebounce);
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchDebounce = setTimeout(function() {
|
||||||
const rows = document.querySelectorAll('#simperTableBody tr.simper-row');
|
employeeFilterForm?.submit();
|
||||||
let visibleCount = 0;
|
}, 500);
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
const match = text.includes(query);
|
|
||||||
row.style.display = match ? '' : 'none';
|
|
||||||
if (match) visibleCount++;
|
|
||||||
});
|
|
||||||
|
|
||||||
const serverEmptyRow = document.getElementById('serverSimperEmptyRow');
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hapus baris pesan kosong pencarian jika ada sebelumnya
|
|
||||||
const existingEmptyRow = document.getElementById('simperEmptySearchRow');
|
|
||||||
if (existingEmptyRow) {
|
|
||||||
existingEmptyRow.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tampilkan pesan jika tidak ada data yang cocok di tabel
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'simperEmptySearchRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="8" class="py-12 text-center text-slate-400">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">
|
|
||||||
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan ejaan NIK atau nama karyawan yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('simperSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody?.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tampilkan/sembunyikan tombol Reset Filter secara real-time saat mengetik
|
|
||||||
let resetBtn = document.getElementById('simperResetBtn');
|
|
||||||
if (query.length > 0) {
|
|
||||||
if (!resetBtn && resetContainer) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.id = 'simperResetBtn';
|
|
||||||
resetBtn.href = "{{ route('hse.employees.index') }}";
|
|
||||||
resetBtn.className = "text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2";
|
|
||||||
const resetIcon = document.createElement('i');
|
|
||||||
resetIcon.className = "fa-solid fa-rotate-left text-[11px]";
|
|
||||||
const resetText = document.createElement('span');
|
|
||||||
resetText.textContent = "Reset Filter";
|
|
||||||
resetBtn.appendChild(resetIcon);
|
|
||||||
resetBtn.appendChild(resetText);
|
|
||||||
resetContainer.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else if (!hasServerFilters && resetBtn) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle Menu Dropdown Ekspor Simper (Format it.allrole.web.id)
|
// Toggle Menu Dropdown Ekspor Simper (Format it.allrole.web.id)
|
||||||
|
|||||||
@@ -64,10 +64,10 @@
|
|||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<!-- Form Filter & Pencarian Cepat (Aturan Standar: Separated Search Bar & Collapsible Filter Card) -->
|
<!-- Form Filter & Pencarian Cepat (Aturan Standar: Separated Search Bar & Collapsible Filter Card) -->
|
||||||
<form method="GET" action="{{ route('pg.logs.index') }}" class="space-y-3">
|
<form method="GET" action="{{ route('pg.logs.index') }}" id="verificationLogFilterForm" class="space-y-3">
|
||||||
<!-- Level 1: Quick Search Bar Mandiri di Luar Card Filter & Tombol Toggle -->
|
<!-- Level 1: Quick Search Bar Mandiri di Luar Card Filter & Tombol Toggle -->
|
||||||
<div class="flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
|
<div class="flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
|
||||||
<!-- Search Bar Utama (Real-Time) -->
|
<!-- Search Bar Utama (Real-Time Server Search) -->
|
||||||
<div class="relative flex-1">
|
<div class="relative flex-1">
|
||||||
<div class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
<div class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||||
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
||||||
@@ -80,8 +80,22 @@
|
|||||||
class="w-full text-xs rounded-xl border border-slate-200 bg-white hover:border-slate-300 focus:bg-white pl-9 pr-3.5 py-2.5 text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition shadow-2xs">
|
class="w-full text-xs rounded-xl border border-slate-200 bg-white hover:border-slate-300 focus:bg-white pl-9 pr-3.5 py-2.5 text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition shadow-2xs">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tombol Buka/Tutup Filter Card & Reset Filter -->
|
<!-- Tombol Buka/Tutup Filter Card & Pilihan Per Halaman -->
|
||||||
<div class="flex items-center gap-2.5 self-end sm:self-auto w-full sm:w-auto justify-between sm:justify-start">
|
<div class="flex items-center gap-2.5 self-end sm:self-auto w-full sm:w-auto justify-between sm:justify-start">
|
||||||
|
<!-- Filter Tampilan Per Halaman -->
|
||||||
|
<select name="per_page"
|
||||||
|
onchange="this.form.submit()"
|
||||||
|
class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] shadow-2xs transition truncate">
|
||||||
|
<option value="20" {{ request('per_page', '20') == '20' ? 'selected' : '' }}>20 / Hal</option>
|
||||||
|
<option value="50" {{ request('per_page', '50') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page', '100') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- Tombol Submit Pencarian -->
|
||||||
|
<button type="submit" class="px-4 py-2.5 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-2xs cursor-pointer whitespace-nowrap">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="button"
|
<button type="button"
|
||||||
id="filterToggleBtn"
|
id="filterToggleBtn"
|
||||||
onclick="toggleFilterCard()"
|
onclick="toggleFilterCard()"
|
||||||
@@ -97,7 +111,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div id="headerResetFilterContainer">
|
<div id="headerResetFilterContainer">
|
||||||
@if(request()->anyFilled(['search', 'team', 'security_guard_id', 'gate_id', 'direction', 'status', 'start_date', 'end_date']))
|
@if(request()->anyFilled(['search', 'team', 'security_guard_id', 'gate_id', 'direction', 'status', 'start_date', 'end_date', 'per_page']))
|
||||||
<a href="{{ route('pg.logs.index') }}"
|
<a href="{{ route('pg.logs.index') }}"
|
||||||
id="headerResetFilterBtn"
|
id="headerResetFilterBtn"
|
||||||
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100">
|
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100">
|
||||||
@@ -629,99 +643,22 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const searchInput = document.getElementById('verificationLogSearchInput');
|
const searchInput = document.getElementById('verificationLogSearchInput');
|
||||||
const tableBody = document.getElementById('verificationLogTableBody');
|
const filterForm = document.getElementById('verificationLogFilterForm');
|
||||||
const resetContainer = document.getElementById('headerResetFilterContainer');
|
let searchDebounce = null;
|
||||||
const hasServerFilters = {{ request()->anyFilled($filterKeys) ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
if (searchInput && tableBody) {
|
if (searchInput && searchInput.value) {
|
||||||
searchInput.addEventListener('input', function (e) {
|
searchInput.focus();
|
||||||
const rawValue = e.target.value;
|
const len = searchInput.value.length;
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchInput.setSelectionRange(len, len);
|
||||||
const rows = tableBody.querySelectorAll('tr.verification-row');
|
|
||||||
let visibleCount = 0;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
const match = text.includes(query);
|
|
||||||
row.style.display = match ? '' : 'none';
|
|
||||||
if (match) visibleCount++;
|
|
||||||
});
|
|
||||||
|
|
||||||
const serverEmptyRow = document.getElementById('serverVerificationEmptyRow');
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hapus baris pesan kosong pencarian jika ada sebelumnya
|
|
||||||
const existingEmptyRow = document.getElementById('verificationEmptySearchRow');
|
|
||||||
if (existingEmptyRow) {
|
|
||||||
existingEmptyRow.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tampilkan pesan instan jika tidak ada baris yang cocok di tabel
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'verificationEmptySearchRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="10" class="py-12 text-center text-slate-400">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">
|
|
||||||
<span class="inline-block mr-1">🔍</span>Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan ejaan nomor transaksi, nomor plat, nama driver, atau petugas satpam yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('verificationLogSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
|
|
||||||
let resetBtn = document.getElementById('headerResetFilterBtn');
|
|
||||||
if (query.length > 0) {
|
|
||||||
if (!resetBtn && resetContainer) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.href = "{{ route('pg.logs.index') }}";
|
|
||||||
resetBtn.id = 'headerResetFilterBtn';
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100';
|
|
||||||
|
|
||||||
const resetIcon = document.createElement('i');
|
|
||||||
resetIcon.className = 'fa-solid fa-rotate-left text-[11px]';
|
|
||||||
const resetText = document.createElement('span');
|
|
||||||
resetText.textContent = 'Reset Filter';
|
|
||||||
|
|
||||||
resetBtn.appendChild(resetIcon);
|
|
||||||
resetBtn.appendChild(resetText);
|
|
||||||
resetContainer.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else if (!hasServerFilters && resetBtn) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset filter click handler saat hanya input client-side tanpa server filter
|
searchInput?.addEventListener('input', function() {
|
||||||
if (resetContainer) {
|
clearTimeout(searchDebounce);
|
||||||
resetContainer.addEventListener('click', function(e) {
|
searchDebounce = setTimeout(function() {
|
||||||
const btn = e.target.closest('#headerResetFilterBtn');
|
filterForm?.submit();
|
||||||
if (btn && !hasServerFilters) {
|
}, 500);
|
||||||
e.preventDefault();
|
});
|
||||||
if (searchInput) {
|
});
|
||||||
searchInput.value = '';
|
|
||||||
searchInput.dispatchEvent(new Event('input'));
|
|
||||||
searchInput.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Panduan Halaman Modal
|
// Panduan Halaman Modal
|
||||||
|
|||||||
@@ -63,10 +63,10 @@
|
|||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<!-- Form Filter & Pencarian Cepat -->
|
<!-- Form Filter & Pencarian Cepat -->
|
||||||
<form method="GET" action="{{ route('qma.activity.log') }}" class="space-y-3">
|
<form method="GET" action="{{ route('qma.activity.log') }}" id="activityLogFilterForm" class="space-y-3">
|
||||||
<!-- Baris Atas: Search Bar Mandiri di Luar Card Filter & Tombol Toggle -->
|
<!-- Baris Atas: Search Bar Mandiri di Luar Card Filter & Tombol Toggle -->
|
||||||
<div class="flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
|
<div class="flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
|
||||||
<!-- Search Bar Utama (Real-Time) -->
|
<!-- Search Bar Utama (Real-Time Server Search) -->
|
||||||
<div class="relative flex-1">
|
<div class="relative flex-1">
|
||||||
<div class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
<div class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||||
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
||||||
@@ -79,8 +79,22 @@
|
|||||||
class="w-full text-xs rounded-xl border border-slate-200 bg-white hover:border-slate-300 focus:bg-white pl-9 pr-3.5 py-2.5 text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition shadow-2xs">
|
class="w-full text-xs rounded-xl border border-slate-200 bg-white hover:border-slate-300 focus:bg-white pl-9 pr-3.5 py-2.5 text-slate-800 placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition shadow-2xs">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tombol Buka/Tutup Filter Card & Reset Filter -->
|
<!-- Tombol Buka/Tutup Filter Card & Pilihan Per Halaman -->
|
||||||
<div class="flex items-center gap-2.5 self-end sm:self-auto w-full sm:w-auto justify-between sm:justify-start">
|
<div class="flex items-center gap-2.5 self-end sm:self-auto w-full sm:w-auto justify-between sm:justify-start">
|
||||||
|
<!-- Filter Tampilan Per Halaman -->
|
||||||
|
<select name="per_page"
|
||||||
|
onchange="this.form.submit()"
|
||||||
|
class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2.5 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] shadow-2xs transition truncate">
|
||||||
|
<option value="20" {{ request('per_page', '20') == '20' ? 'selected' : '' }}>20 / Hal</option>
|
||||||
|
<option value="50" {{ request('per_page', '50') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page', '100') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- Tombol Submit Pencarian -->
|
||||||
|
<button type="submit" class="px-4 py-2.5 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-2xs cursor-pointer whitespace-nowrap">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="button"
|
<button type="button"
|
||||||
id="filterToggleBtn"
|
id="filterToggleBtn"
|
||||||
onclick="toggleFilterCard()"
|
onclick="toggleFilterCard()"
|
||||||
@@ -96,7 +110,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div id="headerResetFilterContainer">
|
<div id="headerResetFilterContainer">
|
||||||
@if(request()->anyFilled(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status']))
|
@if(request()->anyFilled(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status', 'per_page']))
|
||||||
<a href="{{ route('qma.activity.log') }}"
|
<a href="{{ route('qma.activity.log') }}"
|
||||||
id="headerResetFilterBtn"
|
id="headerResetFilterBtn"
|
||||||
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100">
|
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition px-3 py-2 rounded-xl hover:bg-rose-50 border border-transparent hover:border-rose-100">
|
||||||
@@ -449,88 +463,21 @@ function escapeHtml(str) {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const searchInput = document.getElementById('activityLogSearchInput');
|
const searchInput = document.getElementById('activityLogSearchInput');
|
||||||
const tableBody = document.getElementById('activityLogTableBody');
|
const filterForm = document.getElementById('activityLogFilterForm');
|
||||||
const resetContainer = document.getElementById('headerResetFilterContainer');
|
let searchDebounce = null;
|
||||||
const paginationContainer = document.getElementById('activityPaginationContainer');
|
|
||||||
const serverEmptyRow = document.getElementById('serverActivityEmptyRow');
|
|
||||||
const hasServerFilters = {{ request()->anyFilled(['start_date', 'end_date', 'gate_id', 'direction', 'status']) ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
if (searchInput && tableBody) {
|
if (searchInput && searchInput.value) {
|
||||||
searchInput.addEventListener('input', function (e) {
|
searchInput.focus();
|
||||||
const rawValue = e.target.value;
|
const len = searchInput.value.length;
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchInput.setSelectionRange(len, len);
|
||||||
const rows = tableBody.querySelectorAll('tr.activity-row');
|
|
||||||
let visibleCount = 0;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
if (text.includes(query)) {
|
|
||||||
row.style.display = '';
|
|
||||||
visibleCount++;
|
|
||||||
} else {
|
|
||||||
row.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (paginationContainer) {
|
|
||||||
paginationContainer.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const existingEmptyRow = document.getElementById('clientSearchEmptyRow');
|
|
||||||
if (existingEmptyRow) existingEmptyRow.remove();
|
|
||||||
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'clientSearchEmptyRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="11" class="py-12 px-4 text-center">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">
|
|
||||||
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan kata kunci yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('activityLogSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetContainer) {
|
|
||||||
let resetBtn = document.getElementById('headerResetFilterBtn');
|
|
||||||
if (query.length > 0 || hasServerFilters) {
|
|
||||||
if (!resetBtn) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.href = "{{ route('qma.activity.log') }}";
|
|
||||||
resetBtn.id = 'headerResetFilterBtn';
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center space-x-1 transition';
|
|
||||||
const resetIcon = document.createElement('i');
|
|
||||||
resetIcon.className = 'fa-solid fa-rotate-left text-[11px]';
|
|
||||||
const resetText = document.createElement('span');
|
|
||||||
resetText.textContent = 'Reset Filter';
|
|
||||||
|
|
||||||
resetBtn.appendChild(resetIcon);
|
|
||||||
resetBtn.appendChild(resetText);
|
|
||||||
resetContainer.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else if (!hasServerFilters && resetBtn) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchInput?.addEventListener('input', function() {
|
||||||
|
clearTimeout(searchDebounce);
|
||||||
|
searchDebounce = setTimeout(function() {
|
||||||
|
filterForm?.submit();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle Card Filter Lanjutan
|
// Toggle Card Filter Lanjutan
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Kotak Pencarian & Filter Status P2H (Tanpa Card Pembungkus Sesuai Gambar Referensi) -->
|
<!-- Kotak Pencarian & Filter Status P2H (Tanpa Card Pembungkus Sesuai Gambar Referensi) -->
|
||||||
<form method="GET" action="{{ route('qma.p2h.index') }}" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
<form method="GET" action="{{ route('qma.p2h.index') }}" id="p2hFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
||||||
@if(request('date'))
|
@if(request('date'))
|
||||||
<input type="hidden" name="date" value="{{ request('date') }}">
|
<input type="hidden" name="date" value="{{ request('date') }}">
|
||||||
@endif
|
@endif
|
||||||
@@ -95,8 +95,20 @@
|
|||||||
<option value="has_defect" {{ request('summary_condition') === 'has_defect' ? 'selected' : '' }}>Ada Temuan Rusak</option>
|
<option value="has_defect" {{ request('summary_condition') === 'has_defect' ? 'selected' : '' }}>Ada Temuan Rusak</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- Filter Jumlah Per Halaman -->
|
||||||
|
<select name="per_page" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] shadow-sm">
|
||||||
|
<option value="15" {{ request('per_page', '15') == '15' ? 'selected' : '' }}>15 / Hal</option>
|
||||||
|
<option value="50" {{ request('per_page') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- Tombol Submit Pencarian -->
|
||||||
|
<button type="submit" class="px-4 py-2 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-sm cursor-pointer whitespace-nowrap">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
|
|
||||||
<div id="p2hResetWrapper">
|
<div id="p2hResetWrapper">
|
||||||
@if(request('search') || request('validation_status') || request('summary_condition') || request('date'))
|
@if(request()->anyFilled(['search', 'validation_status', 'summary_condition', 'date', 'per_page']))
|
||||||
<a id="p2hResetBtn" href="{{ route('qma.p2h.index') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1" title="Reset Semua Filter">
|
<a id="p2hResetBtn" href="{{ route('qma.p2h.index') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1" title="Reset Semua Filter">
|
||||||
<i class="fa-solid fa-rotate-left"></i>
|
<i class="fa-solid fa-rotate-left"></i>
|
||||||
<span>Reset</span>
|
<span>Reset</span>
|
||||||
@@ -243,94 +255,21 @@ function escapeHtml(str) {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const searchInput = document.getElementById('p2hSearchInput');
|
const searchInput = document.getElementById('p2hSearchInput');
|
||||||
const tableBody = document.getElementById('p2hTableBody');
|
const filterForm = document.getElementById('p2hFilterForm');
|
||||||
const resetWrapper = document.getElementById('p2hResetWrapper');
|
let searchDebounce = null;
|
||||||
const serverEmptyRow = document.getElementById('serverEmptyRow');
|
|
||||||
const paginationContainer = document.getElementById('p2hPaginationContainer');
|
|
||||||
const hasServerFilters = {{ request()->anyFilled(['validation_status', 'summary_condition', 'date']) ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
if (searchInput && tableBody) {
|
if (searchInput && searchInput.value) {
|
||||||
searchInput.addEventListener('input', function (e) {
|
searchInput.focus();
|
||||||
const rawValue = e.target.value;
|
const len = searchInput.value.length;
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchInput.setSelectionRange(len, len);
|
||||||
const rows = tableBody.querySelectorAll('tr.p2h-row');
|
|
||||||
let visibleCount = 0;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
if (text.includes(query)) {
|
|
||||||
row.style.display = '';
|
|
||||||
visibleCount++;
|
|
||||||
} else {
|
|
||||||
row.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Sembunyikan pagination saat client-side search aktif
|
|
||||||
if (paginationContainer) {
|
|
||||||
paginationContainer.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const existingEmptyRow = document.getElementById('clientSearchEmptyRow');
|
|
||||||
if (existingEmptyRow) existingEmptyRow.remove();
|
|
||||||
|
|
||||||
// Sembunyikan server empty row saat mengetik jika ada
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tampilkan pesan kosong jika tidak ada baris yang cocok
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'clientSearchEmptyRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="10" class="py-16 text-center">
|
|
||||||
<p class="text-sm font-bold text-slate-700">
|
|
||||||
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan kata kunci yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('p2hSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center px-4 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tampilkan atau sembunyikan tombol Reset Filter secara real-time
|
|
||||||
if (resetWrapper) {
|
|
||||||
let resetBtn = document.getElementById('p2hResetBtn');
|
|
||||||
if (query.length > 0 || hasServerFilters) {
|
|
||||||
if (!resetBtn) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.id = 'p2hResetBtn';
|
|
||||||
resetBtn.href = "{{ route('qma.p2h.index') }}";
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1';
|
|
||||||
resetBtn.title = 'Reset Semua Filter';
|
|
||||||
|
|
||||||
const resetIcon = document.createElement('i');
|
|
||||||
resetIcon.className = 'fa-solid fa-rotate-left';
|
|
||||||
const resetText = document.createElement('span');
|
|
||||||
resetText.textContent = 'Reset';
|
|
||||||
|
|
||||||
resetBtn.appendChild(resetIcon);
|
|
||||||
resetBtn.appendChild(resetText);
|
|
||||||
resetWrapper.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (resetBtn && !hasServerFilters) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchInput?.addEventListener('input', function() {
|
||||||
|
clearTimeout(searchDebounce);
|
||||||
|
searchDebounce = setTimeout(function() {
|
||||||
|
filterForm?.submit();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function openGuideModal() {
|
function openGuideModal() {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Kotak Pencarian & Filter Status Timesheet (Tanpa Card Wrapper, Format Persis HSE Employees) -->
|
<!-- Kotak Pencarian & Filter Status Timesheet (Tanpa Card Wrapper, Format Persis HSE Employees) -->
|
||||||
<form method="GET" action="{{ url()->current() }}" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
|
<form method="GET" action="{{ url()->current() }}" id="timesheetFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
|
||||||
<!-- Pencarian Cepat di Kiri dengan Tombol Cari -->
|
<!-- Pencarian Cepat di Kiri dengan Tombol Cari -->
|
||||||
<div class="relative w-full sm:max-w-md flex items-center">
|
<div class="relative w-full sm:max-w-md flex items-center">
|
||||||
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400 z-10">
|
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400 z-10">
|
||||||
@@ -172,11 +172,20 @@
|
|||||||
<option value="Karyawan" {{ request('operator_type') === 'Karyawan' ? 'selected' : '' }}>Karyawan</option>
|
<option value="Karyawan" {{ request('operator_type') === 'Karyawan' ? 'selected' : '' }}>Karyawan</option>
|
||||||
<option value="Sukon" {{ request('operator_type') === 'Sukon' ? 'selected' : '' }}>Sukon</option>
|
<option value="Sukon" {{ request('operator_type') === 'Sukon' ? 'selected' : '' }}>Sukon</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- Filter Tampilan Per Halaman -->
|
||||||
|
<select name="per_page"
|
||||||
|
onchange="this.form.submit()"
|
||||||
|
class="w-full sm:w-auto text-xs rounded-xl border border-slate-200 bg-white px-2.5 sm:px-3 py-2.5 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 shadow-sm transition truncate">
|
||||||
|
<option value="15" {{ request('per_page', '15') == '15' ? 'selected' : '' }}>15 / Hal</option>
|
||||||
|
<option value="50" {{ request('per_page', '50') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page', '100') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tombol Reset Filter -->
|
<!-- Tombol Reset Filter -->
|
||||||
<div id="timesheetResetContainer">
|
<div id="timesheetResetContainer">
|
||||||
@if(request()->anyFilled(['search', 'vehicle_id', 'shift', 'operator_type']) || (request('start_date') && request('start_date') !== now()->toDateString()) || (request('end_date') && request('end_date') !== now()->toDateString()))
|
@if(request()->anyFilled(['search', 'vehicle_id', 'shift', 'operator_type', 'per_page']) || (request('start_date') && request('start_date') !== now()->toDateString()) || (request('end_date') && request('end_date') !== now()->toDateString()))
|
||||||
<a href="{{ url()->current() }}"
|
<a href="{{ url()->current() }}"
|
||||||
id="timesheetResetBtn"
|
id="timesheetResetBtn"
|
||||||
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2">
|
class="text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2">
|
||||||
@@ -1626,68 +1635,22 @@
|
|||||||
document.getElementById('addMeterType')?.addEventListener('change', () => updateMeterUnitLabels('add'));
|
document.getElementById('addMeterType')?.addEventListener('change', () => updateMeterUnitLabels('add'));
|
||||||
document.getElementById('editMeterType')?.addEventListener('change', () => updateMeterUnitLabels('edit'));
|
document.getElementById('editMeterType')?.addEventListener('change', () => updateMeterUnitLabels('edit'));
|
||||||
|
|
||||||
// 8. Filter Pencarian Instan Real-Time (Persis Standar HSE Employees)
|
// 8. Pencarian Server-Side Otomatis (Global ke seluruh database)
|
||||||
|
const timesheetFilterForm = document.getElementById('timesheetFilterForm');
|
||||||
const timesheetSearchInput = document.getElementById('timesheetSearchInput');
|
const timesheetSearchInput = document.getElementById('timesheetSearchInput');
|
||||||
const timesheetResetContainer = document.getElementById('timesheetResetContainer');
|
let timesheetSearchDebounce = null;
|
||||||
const timesheetTableBody = document.getElementById('timesheetTableBody');
|
|
||||||
|
|
||||||
timesheetSearchInput?.addEventListener('input', function(e) {
|
if (timesheetSearchInput && timesheetSearchInput.value) {
|
||||||
const query = e.target.value.toLowerCase().trim();
|
timesheetSearchInput.focus();
|
||||||
const cleanQuery = query.replace(/[\s\-_]/g, '');
|
const len = timesheetSearchInput.value.length;
|
||||||
const rows = document.querySelectorAll('#timesheetTableBody tr.timesheet-row');
|
timesheetSearchInput.setSelectionRange(len, len);
|
||||||
let visibleCount = 0;
|
}
|
||||||
|
|
||||||
rows.forEach(row => {
|
timesheetSearchInput?.addEventListener('input', function() {
|
||||||
const text = row.innerText.toLowerCase();
|
clearTimeout(timesheetSearchDebounce);
|
||||||
const cleanText = text.replace(/[\s\-_]/g, '');
|
timesheetSearchDebounce = setTimeout(function() {
|
||||||
const match = query === '' || text.includes(query) || (cleanQuery.length > 0 && cleanText.includes(cleanQuery));
|
timesheetFilterForm?.submit();
|
||||||
if (match) {
|
}, 500);
|
||||||
row.style.display = '';
|
|
||||||
visibleCount++;
|
|
||||||
} else {
|
|
||||||
row.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Dynamic empty state
|
|
||||||
const existingEmptyTr = document.getElementById('timesheetClientEmptyRow');
|
|
||||||
if (existingEmptyTr) existingEmptyTr.remove();
|
|
||||||
|
|
||||||
if (visibleCount === 0 && rows.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'timesheetClientEmptyRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="9" class="py-12 text-center text-slate-400">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">Tidak ada timesheet yang cocok</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Tidak ditemukan data dengan kata kunci "${escapeHtml(query)}" pada halaman ini.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('timesheetSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
timesheetTableBody?.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dynamic reset button
|
|
||||||
let resetBtn = document.getElementById('timesheetResetBtn');
|
|
||||||
if (query.length > 0) {
|
|
||||||
if (!resetBtn && timesheetResetContainer) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.id = 'timesheetResetBtn';
|
|
||||||
resetBtn.href = window.location.pathname;
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-700 font-semibold flex items-center justify-center sm:justify-start space-x-1.5 transition whitespace-nowrap py-1 sm:py-0 sm:ml-2';
|
|
||||||
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left text-[11px]"></i><span>Reset Filter</span>';
|
|
||||||
timesheetResetContainer.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Kotak Pencarian & Filter Status -->
|
<!-- Kotak Pencarian & Filter Status -->
|
||||||
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
<form method="GET" action="{{ route('qma.vehicles.lv') }}" id="lvFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
||||||
<div class="relative w-full max-w-sm sm:max-w-md">
|
<div class="relative w-full max-w-sm sm:max-w-md">
|
||||||
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||||
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
||||||
@@ -76,21 +76,26 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<form method="GET" action="{{ route('qma.vehicles.lv') }}">
|
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||||
@if(request('search'))
|
<option value="">Semua Status Operasi</option>
|
||||||
<input type="hidden" name="search" value="{{ request('search') }}">
|
<option value="Operation" {{ request('status') === 'Operation' ? 'selected' : '' }}>Operation (Siap Jalan)</option>
|
||||||
@endif
|
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
|
||||||
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
|
||||||
<option value="">Semua Status Operasi</option>
|
<option value="Maintenance" {{ request('status') === 'Maintenance' ? 'selected' : '' }}>Maintenance</option>
|
||||||
<option value="Operation" {{ request('status') === 'Operation' ? 'selected' : '' }}>Operation (Siap Jalan)</option>
|
</select>
|
||||||
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
|
|
||||||
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
|
<select name="per_page" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||||
<option value="Maintenance" {{ request('status') === 'Maintenance' ? 'selected' : '' }}>Maintenance</option>
|
<option value="15" {{ request('per_page', '15') == '15' ? 'selected' : '' }}>15 / Hal</option>
|
||||||
</select>
|
<option value="50" {{ request('per_page', '50') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
</form>
|
<option value="100" {{ request('per_page', '100') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button type="submit" class="px-4 py-2 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-sm cursor-pointer whitespace-nowrap">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
|
|
||||||
<div id="lvResetWrapper" class="flex items-center">
|
<div id="lvResetWrapper" class="flex items-center">
|
||||||
@if(request('search') || request('status'))
|
@if(request()->anyFilled(['search', 'status', 'per_page']))
|
||||||
<a id="lvResetBtn" href="{{ route('qma.vehicles.lv') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-2">
|
<a id="lvResetBtn" href="{{ route('qma.vehicles.lv') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-2">
|
||||||
<i class="fa-solid fa-rotate-left"></i>
|
<i class="fa-solid fa-rotate-left"></i>
|
||||||
<span>Reset Filter</span>
|
<span>Reset Filter</span>
|
||||||
@@ -98,7 +103,7 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
<!-- Tabel Data Light Vehicle (Header Navy Solid #06213f) -->
|
<!-- Tabel Data Light Vehicle (Header Navy Solid #06213f) -->
|
||||||
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
||||||
@@ -1018,82 +1023,21 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const searchInput = document.getElementById('lvSearchInput');
|
const searchInput = document.getElementById('lvSearchInput');
|
||||||
const tableBody = document.getElementById('lvTableBody');
|
const filterForm = document.getElementById('lvFilterForm');
|
||||||
const resetWrapper = document.getElementById('lvResetWrapper');
|
let searchDebounce = null;
|
||||||
const paginationContainer = document.getElementById('lvPaginationContainer');
|
|
||||||
const serverEmptyRow = document.getElementById('serverLvEmptyRow');
|
|
||||||
const hasServerFilters = {{ request()->filled('status') ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
if (searchInput && tableBody) {
|
if (searchInput && searchInput.value) {
|
||||||
searchInput.addEventListener('input', function (e) {
|
searchInput.focus();
|
||||||
const rawValue = e.target.value;
|
const len = searchInput.value.length;
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchInput.setSelectionRange(len, len);
|
||||||
const rows = tableBody.querySelectorAll('tr.lv-row');
|
|
||||||
let visibleCount = 0;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
if (text.includes(query)) {
|
|
||||||
row.style.display = '';
|
|
||||||
visibleCount++;
|
|
||||||
} else {
|
|
||||||
row.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (paginationContainer) {
|
|
||||||
paginationContainer.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const existingEmptyRow = document.getElementById('clientLvEmptyRow');
|
|
||||||
if (existingEmptyRow) existingEmptyRow.remove();
|
|
||||||
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'clientLvEmptyRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="10" class="py-12 text-center text-slate-400">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">
|
|
||||||
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan kata kunci yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('lvSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetWrapper) {
|
|
||||||
let resetBtn = document.getElementById('lvResetBtn');
|
|
||||||
if (query.length > 0 || hasServerFilters) {
|
|
||||||
if (!resetBtn) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.id = 'lvResetBtn';
|
|
||||||
resetBtn.href = "{{ route('qma.vehicles.lv') }}";
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-2';
|
|
||||||
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left"></i><span>Reset Filter</span>';
|
|
||||||
resetWrapper.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else if (!hasServerFilters && resetBtn) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchInput?.addEventListener('input', function() {
|
||||||
|
clearTimeout(searchDebounce);
|
||||||
|
searchDebounce = setTimeout(function() {
|
||||||
|
filterForm?.submit();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@if($errors->any())
|
@if($errors->any())
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Kotak Pencarian & Filter Kategori Alat Berat -->
|
<!-- Kotak Pencarian & Filter Kategori Alat Berat -->
|
||||||
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
<form method="GET" action="{{ route('qma.vehicles.support') }}" id="supportFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
||||||
<div class="relative w-full max-w-sm sm:max-w-md">
|
<div class="relative w-full max-w-sm sm:max-w-md">
|
||||||
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||||
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
||||||
@@ -77,20 +77,26 @@
|
|||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<!-- Filter Kategori Alat Berat -->
|
<!-- Filter Kategori Alat Berat -->
|
||||||
<form method="GET" action="{{ route('qma.vehicles.support') }}" class="flex items-center space-x-2">
|
<select name="unit_category" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||||
@if(request('search'))
|
<option value="">Semua Kategori Alat</option>
|
||||||
<input type="hidden" name="search" value="{{ request('search') }}">
|
@foreach($availableCategories as $cat)
|
||||||
@endif
|
<option value="{{ $cat }}" {{ request('unit_category') === $cat ? 'selected' : '' }}>{{ $cat }}</option>
|
||||||
<select name="unit_category" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
@endforeach
|
||||||
<option value="">Semua Kategori Alat</option>
|
</select>
|
||||||
@foreach($availableCategories as $cat)
|
|
||||||
<option value="{{ $cat }}" {{ request('unit_category') === $cat ? 'selected' : '' }}>{{ $cat }}</option>
|
<!-- Filter Jumlah Per Halaman -->
|
||||||
@endforeach
|
<select name="per_page" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||||
</select>
|
<option value="15" {{ request('per_page', '15') == '15' ? 'selected' : '' }}>15 / Hal</option>
|
||||||
</form>
|
<option value="50" {{ request('per_page', '50') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page', '100') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button type="submit" class="px-4 py-2 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-sm cursor-pointer whitespace-nowrap">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
|
|
||||||
<div id="supportResetWrapper" class="flex items-center">
|
<div id="supportResetWrapper" class="flex items-center">
|
||||||
@if(request('search') || request('unit_category'))
|
@if(request()->anyFilled(['search', 'unit_category', 'per_page']))
|
||||||
<a id="supportResetBtn" href="{{ route('qma.vehicles.support') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
|
<a id="supportResetBtn" href="{{ route('qma.vehicles.support') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
|
||||||
<i class="fa-solid fa-rotate-left"></i>
|
<i class="fa-solid fa-rotate-left"></i>
|
||||||
<span>Reset</span>
|
<span>Reset</span>
|
||||||
@@ -98,7 +104,7 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
<!-- Tabel Data Kategori Heavy Equipment (Header Navy Solid #06213f) -->
|
<!-- Tabel Data Kategori Heavy Equipment (Header Navy Solid #06213f) -->
|
||||||
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
||||||
@@ -633,82 +639,21 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const searchInput = document.getElementById('supportSearchInput');
|
const searchInput = document.getElementById('supportSearchInput');
|
||||||
const tableBody = document.getElementById('supportTableBody');
|
const filterForm = document.getElementById('supportFilterForm');
|
||||||
const resetWrapper = document.getElementById('supportResetWrapper');
|
let searchDebounce = null;
|
||||||
const paginationContainer = document.getElementById('supportPaginationContainer');
|
|
||||||
const serverEmptyRow = document.getElementById('serverSupportEmptyRow');
|
|
||||||
const hasServerFilters = {{ request()->anyFilled(['status', 'unit_category']) ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
if (searchInput && tableBody) {
|
if (searchInput && searchInput.value) {
|
||||||
searchInput.addEventListener('input', function (e) {
|
searchInput.focus();
|
||||||
const rawValue = e.target.value;
|
const len = searchInput.value.length;
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchInput.setSelectionRange(len, len);
|
||||||
const rows = tableBody.querySelectorAll('tr.support-row');
|
|
||||||
let visibleCount = 0;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
if (text.includes(query)) {
|
|
||||||
row.style.display = '';
|
|
||||||
visibleCount++;
|
|
||||||
} else {
|
|
||||||
row.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (paginationContainer) {
|
|
||||||
paginationContainer.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const existingEmptyRow = document.getElementById('clientSupportEmptyRow');
|
|
||||||
if (existingEmptyRow) existingEmptyRow.remove();
|
|
||||||
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'clientSupportEmptyRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="8" class="py-12 text-center text-slate-400">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">
|
|
||||||
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan kata kunci yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('supportSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetWrapper) {
|
|
||||||
let resetBtn = document.getElementById('supportResetBtn');
|
|
||||||
if (query.length > 0 || hasServerFilters) {
|
|
||||||
if (!resetBtn) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.id = 'supportResetBtn';
|
|
||||||
resetBtn.href = "{{ route('qma.vehicles.support') }}";
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1';
|
|
||||||
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left"></i><span>Reset</span>';
|
|
||||||
resetWrapper.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else if (!hasServerFilters && resetBtn) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchInput?.addEventListener('input', function() {
|
||||||
|
clearTimeout(searchDebounce);
|
||||||
|
searchDebounce = setTimeout(function() {
|
||||||
|
filterForm?.submit();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Daftar semua kode kendaraan heavy equipment yang sudah terdaftar di sistem
|
// Daftar semua kode kendaraan heavy equipment yang sudah terdaftar di sistem
|
||||||
|
|||||||
@@ -86,11 +86,8 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<!-- Kotak Pencarian & Filter Status Unit Fisik -->
|
<!-- Kotak Pencarian & Filter Status Unit Fisik -->
|
||||||
<div class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
<form method="GET" action="{{ route('qma.vehicles.support.units', $category->id) }}" id="unitFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
||||||
<form method="GET" action="{{ route('qma.vehicles.support.units', $category->id) }}" class="relative w-full max-w-sm sm:max-w-md">
|
<div class="relative w-full max-w-sm sm:max-w-md">
|
||||||
@if(request('status'))
|
|
||||||
<input type="hidden" name="status" value="{{ request('status') }}">
|
|
||||||
@endif
|
|
||||||
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||||
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
||||||
</span>
|
</span>
|
||||||
@@ -100,25 +97,31 @@
|
|||||||
value="{{ request('search') }}"
|
value="{{ request('search') }}"
|
||||||
placeholder="Cari kode unit fisik, lokasi, SILO..."
|
placeholder="Cari kode unit fisik, lokasi, SILO..."
|
||||||
class="w-full text-xs pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-emerald-600 focus:ring-2 focus:ring-emerald-600/10 shadow-sm transition">
|
class="w-full text-xs pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-emerald-600 focus:ring-2 focus:ring-emerald-600/10 shadow-sm transition">
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<!-- Filter Status Dropdown -->
|
<!-- Filter Status Dropdown -->
|
||||||
<form method="GET" action="{{ route('qma.vehicles.support.units', $category->id) }}" class="flex items-center space-x-2">
|
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] shadow-sm cursor-pointer">
|
||||||
@if(request('search'))
|
<option value="">Semua Status</option>
|
||||||
<input type="hidden" name="search" value="{{ request('search') }}">
|
<option value="Operation" {{ request('status') === 'Operation' ? 'selected' : '' }}>Operation</option>
|
||||||
@endif
|
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
|
||||||
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] shadow-sm cursor-pointer">
|
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
|
||||||
<option value="">Semua Status</option>
|
<option value="Maintenance" {{ request('status') === 'Maintenance' ? 'selected' : '' }}>Maintenance</option>
|
||||||
<option value="Operation" {{ request('status') === 'Operation' ? 'selected' : '' }}>Operation</option>
|
</select>
|
||||||
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
|
|
||||||
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
|
<!-- Filter Jumlah Per Halaman -->
|
||||||
<option value="Maintenance" {{ request('status') === 'Maintenance' ? 'selected' : '' }}>Maintenance</option>
|
<select name="per_page" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20] shadow-sm cursor-pointer">
|
||||||
</select>
|
<option value="15" {{ request('per_page', '15') == '15' ? 'selected' : '' }}>15 / Hal</option>
|
||||||
</form>
|
<option value="50" {{ request('per_page', '50') == '50' ? 'selected' : '' }}>50 / Hal</option>
|
||||||
|
<option value="100" {{ request('per_page', '100') == '100' ? 'selected' : '' }}>Semua (100)</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<button type="submit" class="px-4 py-2 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold rounded-xl transition shadow-sm cursor-pointer whitespace-nowrap">
|
||||||
|
Cari
|
||||||
|
</button>
|
||||||
|
|
||||||
<div id="unitResetWrapper" class="flex items-center">
|
<div id="unitResetWrapper" class="flex items-center">
|
||||||
@if(request('search') || request('status'))
|
@if(request()->anyFilled(['search', 'status', 'per_page']))
|
||||||
<a id="unitResetBtn" href="{{ route('qma.vehicles.support.units', $category->id) }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
|
<a id="unitResetBtn" href="{{ route('qma.vehicles.support.units', $category->id) }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
||||||
<span>Reset Filter</span>
|
<span>Reset Filter</span>
|
||||||
@@ -126,7 +129,7 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
|
||||||
<!-- Tabel Data Unit Fisik (Header Navy Solid #06213f) -->
|
<!-- Tabel Data Unit Fisik (Header Navy Solid #06213f) -->
|
||||||
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
||||||
@@ -958,87 +961,21 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const searchInput = document.getElementById('unitSearchInput');
|
const searchInput = document.getElementById('unitSearchInput');
|
||||||
const tableBody = document.getElementById('unitsTableBody');
|
const filterForm = document.getElementById('unitFilterForm');
|
||||||
const resetWrapper = document.getElementById('unitResetWrapper');
|
let searchDebounce = null;
|
||||||
const paginationContainer = document.getElementById('unitsPaginationContainer');
|
|
||||||
const serverEmptyRow = document.getElementById('serverUnitEmptyRow');
|
|
||||||
const hasServerFilters = {{ request()->anyFilled(['status']) ? 'true' : 'false' }};
|
|
||||||
|
|
||||||
if (searchInput && tableBody) {
|
if (searchInput && searchInput.value) {
|
||||||
searchInput.addEventListener('input', function (e) {
|
searchInput.focus();
|
||||||
const rawValue = e.target.value;
|
const len = searchInput.value.length;
|
||||||
const query = rawValue.toLowerCase().trim();
|
searchInput.setSelectionRange(len, len);
|
||||||
const rows = tableBody.querySelectorAll('tr.unit-row');
|
|
||||||
let visibleCount = 0;
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
if (text.includes(query)) {
|
|
||||||
row.style.display = '';
|
|
||||||
visibleCount++;
|
|
||||||
} else {
|
|
||||||
row.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (paginationContainer) {
|
|
||||||
paginationContainer.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const existingEmptyRow = document.getElementById('clientUnitEmptyRow');
|
|
||||||
if (existingEmptyRow) existingEmptyRow.remove();
|
|
||||||
|
|
||||||
if (serverEmptyRow) {
|
|
||||||
serverEmptyRow.style.display = query.length > 0 ? 'none' : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visibleCount === 0 && query.length > 0) {
|
|
||||||
const emptyTr = document.createElement('tr');
|
|
||||||
emptyTr.id = 'clientUnitEmptyRow';
|
|
||||||
emptyTr.innerHTML = `
|
|
||||||
<td colspan="10" class="py-12 text-center text-slate-400">
|
|
||||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
|
||||||
<p class="text-sm font-semibold text-slate-700">
|
|
||||||
Data "<span class="text-rose-600 font-bold">${escapeHtml(rawValue)}</span>" tidak ditemukan di tabel
|
|
||||||
</p>
|
|
||||||
<p class="text-xs text-slate-400 mt-1">
|
|
||||||
Pastikan kata kunci yang dicari sudah benar.
|
|
||||||
</p>
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="button"
|
|
||||||
onclick="const inp = document.getElementById('unitSearchInput'); if(inp){ inp.value=''; inp.dispatchEvent(new Event('input')); inp.focus(); }"
|
|
||||||
class="inline-flex items-center space-x-1.5 px-3.5 py-2 rounded-xl text-xs font-semibold text-rose-600 bg-rose-50 border border-rose-200 hover:bg-rose-100 transition cursor-pointer">
|
|
||||||
<i class="fa-solid fa-rotate-left text-[11px]"></i>
|
|
||||||
<span>Hapus Pencarian</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tableBody.appendChild(emptyTr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resetWrapper) {
|
|
||||||
let resetBtn = document.getElementById('unitResetBtn');
|
|
||||||
if (query.length > 0 || hasServerFilters) {
|
|
||||||
if (!resetBtn) {
|
|
||||||
resetBtn = document.createElement('a');
|
|
||||||
resetBtn.id = 'unitResetBtn';
|
|
||||||
resetBtn.href = "{{ route('qma.vehicles.support.units', $category->id) }}";
|
|
||||||
resetBtn.className = 'text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1';
|
|
||||||
resetBtn.innerHTML = '<i class="fa-solid fa-rotate-left text-[11px]"></i><span>Reset Filter</span>';
|
|
||||||
resetWrapper.appendChild(resetBtn);
|
|
||||||
}
|
|
||||||
} else if (!hasServerFilters && resetBtn) {
|
|
||||||
resetBtn.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Trigger saat awal memuat halaman jika ada nilai pencarian dari SSR
|
|
||||||
if (searchInput.value.trim() !== '') {
|
|
||||||
searchInput.dispatchEvent(new Event('input'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchInput?.addEventListener('input', function() {
|
||||||
|
clearTimeout(searchDebounce);
|
||||||
|
searchDebounce = setTimeout(function() {
|
||||||
|
filterForm?.submit();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dropdown Menu Ekspor Heavy Equipment Kategori Ini
|
// Dropdown Menu Ekspor Heavy Equipment Kategori Ini
|
||||||
|
|||||||
Reference in New Issue
Block a user