feat: enable auto-submit on filter selection and remove manual submit button

This commit is contained in:
Wahyudin
2026-10-13 16:33:30 +07:00
parent c8eedac460
commit b6692afb57
2 changed files with 15 additions and 21 deletions
+9 -14
View File
@@ -65,7 +65,7 @@
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Regu Satpam
</label>
<select name="team" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="team" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Regu</option>
<option value="1" {{ request('team') == '1' ? 'selected' : '' }}>Regu 1</option>
<option value="2" {{ request('team') == '2' ? 'selected' : '' }}>Regu 2</option>
@@ -78,7 +78,7 @@
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Petugas Satpam
</label>
<select name="security_guard_id" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="security_guard_id" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Petugas Satpam</option>
@foreach($guards as $guard)
<option value="{{ $guard->id }}" {{ request('security_guard_id') == $guard->id ? 'selected' : '' }}>
@@ -93,7 +93,7 @@
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Pos Gerbang
</label>
<select name="gate_id" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="gate_id" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Gerbang</option>
@foreach($gates as $g)
<option value="{{ $g->id }}" {{ request('gate_id') == $g->id ? 'selected' : '' }}>{{ $g->name }}</option>
@@ -102,11 +102,11 @@
</div>
<!-- Filter Arah Gerbang -->
<div class="lg:col-span-2">
<div class="lg:col-span-3">
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Arah Gerbang
</label>
<select name="direction" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="direction" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Arah</option>
<option value="in" {{ request('direction') === 'in' ? 'selected' : '' }}>Masuk (In)</option>
<option value="out" {{ request('direction') === 'out' ? 'selected' : '' }}>Keluar (Out)</option>
@@ -114,11 +114,11 @@
</div>
<!-- Filter Status Verifikasi -->
<div class="lg:col-span-2">
<div class="lg:col-span-3">
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Status
</label>
<select name="status" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="status" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Status</option>
<option value="approved" {{ request('status') === 'approved' ? 'selected' : '' }}>Disetujui (Approved)</option>
<option value="rejected" {{ request('status') === 'rejected' ? 'selected' : '' }}>Ditolak (Rejected)</option>
@@ -134,6 +134,7 @@
<input type="date"
name="start_date"
value="{{ request('start_date') }}"
onchange="this.form.submit()"
class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
</div>
@@ -145,15 +146,9 @@
<input type="date"
name="end_date"
value="{{ request('end_date') }}"
onchange="this.form.submit()"
class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
</div>
<!-- Tombol Submit Terapkan Filter -->
<div class="lg:col-span-2 flex items-end">
<button type="submit" class="w-full bg-[#1b5e20] hover:bg-[#144919] text-white py-2.5 px-4 rounded-xl text-xs font-bold flex items-center justify-center shadow-sm transition">
<span>Terapkan</span>
</button>
</div>
</div>
</form>
</div>
+6 -7
View File
@@ -67,6 +67,7 @@
<input type="date"
name="start_date"
value="{{ request('start_date') }}"
onchange="this.form.submit()"
class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
</div>
@@ -78,6 +79,7 @@
<input type="date"
name="end_date"
value="{{ request('end_date') }}"
onchange="this.form.submit()"
class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
</div>
@@ -86,7 +88,7 @@
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Pos Gerbang
</label>
<select name="gate_id" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="gate_id" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Gerbang</option>
@foreach($gates as $g)
<option value="{{ $g->id }}" {{ request('gate_id') == $g->id ? 'selected' : '' }}>{{ $g->name }}</option>
@@ -99,7 +101,7 @@
<label class="block text-xs font-bold text-slate-700 mb-1.5">
Arah Akses
</label>
<select name="direction" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="direction" onchange="this.form.submit()" class="w-full text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-2.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Arah</option>
<option value="in" {{ request('direction') === 'in' ? 'selected' : '' }}>MASUK (In)</option>
<option value="out" {{ request('direction') === 'out' ? 'selected' : '' }}>KELUAR (Out)</option>
@@ -114,7 +116,7 @@
<span class="text-xs font-bold text-slate-600 whitespace-nowrap">
Status PG:
</span>
<select name="status" class="text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-1.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-slate-50/50 hover:bg-white focus:bg-white px-3 py-1.5 text-slate-800 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition">
<option value="">Semua Status</option>
<option value="approved" {{ request('status') === 'approved' ? 'selected' : '' }}>Disetujui</option>
<option value="pending" {{ request('status') === 'pending' ? 'selected' : '' }}>Menunggu PG</option>
@@ -122,14 +124,11 @@
</select>
</div>
<!-- Tombol Submit & Reset -->
<!-- Tombol Reset -->
<div class="flex items-center space-x-2 justify-end">
<a href="{{ route('qma.activity.log') }}" class="px-4 py-2 rounded-xl text-xs font-semibold text-slate-600 bg-slate-100 hover:bg-slate-200 border border-slate-200 transition">
<span>Reset</span>
</a>
<button type="submit" class="px-5 py-2 rounded-xl text-xs font-bold text-white bg-[#06213f] hover:bg-[#0b315b] shadow-sm transition">
<span>Filter</span>
</button>
</div>
</div>
</form>