feat: show reset button only when filters are actively applied
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
<span class="text-slate-800 font-bold text-xs uppercase tracking-wider">
|
<span class="text-slate-800 font-bold text-xs uppercase tracking-wider">
|
||||||
Filter & Pencarian Log Audit
|
Filter & Pencarian Log Audit
|
||||||
</span>
|
</span>
|
||||||
@if(request()->hasAny(['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']))
|
||||||
<a href="{{ route('pg.logs.index') }}" class="text-xs text-rose-600 hover:text-rose-700 font-semibold transition">
|
<a href="{{ route('pg.logs.index') }}" class="text-xs text-rose-600 hover:text-rose-700 font-semibold transition">
|
||||||
<span>Reset Semua Filter</span>
|
<span>Reset Semua Filter</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -36,11 +36,6 @@
|
|||||||
<span class="text-slate-800 font-bold text-xs uppercase tracking-wider">
|
<span class="text-slate-800 font-bold text-xs uppercase tracking-wider">
|
||||||
Filter & Pencarian Log
|
Filter & Pencarian Log
|
||||||
</span>
|
</span>
|
||||||
@if(request()->hasAny(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status']))
|
|
||||||
<a href="{{ route('qma.activity.log') }}" class="text-xs text-rose-600 hover:text-rose-700 font-semibold transition">
|
|
||||||
<span>Reset Semua Filter</span>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Baris Input Filter (Grid Responsif 12 Kolom) -->
|
<!-- Baris Input Filter (Grid Responsif 12 Kolom) -->
|
||||||
@@ -124,12 +119,14 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tombol Reset -->
|
<!-- Tombol Reset (Hanya tampil jika filter digunakan) -->
|
||||||
<div class="flex items-center space-x-2 justify-end">
|
@if(request()->anyFilled(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status']))
|
||||||
<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">
|
<div class="flex items-center space-x-2 justify-end">
|
||||||
<span>Reset</span>
|
<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">
|
||||||
</a>
|
<span>Reset</span>
|
||||||
</div>
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -261,7 +258,7 @@
|
|||||||
<p class="text-xs text-slate-400 max-w-sm">
|
<p class="text-xs text-slate-400 max-w-sm">
|
||||||
Tidak ditemukan catatan aktivitas kendaraan yang sesuai dengan kriteria filter saat ini.
|
Tidak ditemukan catatan aktivitas kendaraan yang sesuai dengan kriteria filter saat ini.
|
||||||
</p>
|
</p>
|
||||||
@if(request()->hasAny(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status']))
|
@if(request()->anyFilled(['search', 'start_date', 'end_date', 'gate_id', 'direction', 'status']))
|
||||||
<a href="{{ route('qma.activity.log') }}" class="mt-2 inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold text-[#1b5e20] bg-emerald-50 border border-emerald-200 hover:bg-emerald-100 transition">
|
<a href="{{ route('qma.activity.log') }}" class="mt-2 inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold text-[#1b5e20] bg-emerald-50 border border-emerald-200 hover:bg-emerald-100 transition">
|
||||||
<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>
|
||||||
|
|||||||
@@ -183,6 +183,26 @@ class VehicleActivityTest extends TestCase
|
|||||||
$response->assertSee('Aktivitas');
|
$response->assertSee('Aktivitas');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_qma_log_reset_button_shown_only_when_filtered(): void
|
||||||
|
{
|
||||||
|
$qmaAdmin = User::where('role', 'qma_admin')->first();
|
||||||
|
|
||||||
|
// 1. Unfiltered request should NOT see Reset button
|
||||||
|
$response = $this->actingAs($qmaAdmin)->get('/qma/activity-log');
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertDontSee('<span>Reset</span>', false);
|
||||||
|
|
||||||
|
// 2. Request with empty filter params should NOT see Reset button
|
||||||
|
$responseEmpty = $this->actingAs($qmaAdmin)->get('/qma/activity-log?search=&direction=&gate_id=');
|
||||||
|
$responseEmpty->assertStatus(200);
|
||||||
|
$responseEmpty->assertDontSee('<span>Reset</span>', false);
|
||||||
|
|
||||||
|
// 3. Request with active filter should see Reset button
|
||||||
|
$responseFiltered = $this->actingAs($qmaAdmin)->get('/qma/activity-log?direction=in');
|
||||||
|
$responseFiltered->assertStatus(200);
|
||||||
|
$responseFiltered->assertSee('<span>Reset</span>', false);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_admin_pg_can_store_security_guard_and_creates_login_account(): void
|
public function test_admin_pg_can_store_security_guard_and_creates_login_account(): void
|
||||||
{
|
{
|
||||||
$adminPg = User::where('role', 'pg_admin')->first();
|
$adminPg = User::where('role', 'pg_admin')->first();
|
||||||
|
|||||||
Reference in New Issue
Block a user