feat: implement Dashboard for Admin PG matching reference design and fix active sidebar menu bug

This commit is contained in:
Wahyudin
2026-10-13 15:17:41 +07:00
parent 18d548df79
commit 621802c23a
7 changed files with 319 additions and 17 deletions
+5 -3
View File
@@ -77,7 +77,7 @@ class AuthenticationTest extends TestCase
'password' => 'password',
]);
$response->assertRedirect('/pg/guards');
$response->assertRedirect('/pg/dashboard');
$this->assertAuthenticated();
$user = auth()->user();
@@ -124,15 +124,17 @@ class AuthenticationTest extends TestCase
$this->actingAs($qmaUser)->get('/hse/employees')->assertStatus(403);
$this->actingAs($qmaUser)->get('/pg/guards')->assertStatus(403);
// 4. Admin PG dapat akses modul PG guards & log verifikasi, ditolak dari pos gerbang verifikasi & HSE
// 4. Admin PG dapat akses modul PG dashboard, guards & log verifikasi, ditolak dari pos gerbang verifikasi & HSE
$this->actingAs($pgUser)->get('/pg/dashboard')->assertStatus(200);
$this->actingAs($pgUser)->get('/pg/guards')->assertStatus(200);
$this->actingAs($pgUser)->get('/pg/verification-logs')->assertStatus(200);
$this->actingAs($pgUser)->get('/pg/gate-inspection')->assertStatus(403);
$this->actingAs($pgUser)->get('/hse/employees')->assertStatus(403);
// 5. Petugas Satpam Pos Gerbang dapat akses verifikasi pos gerbang, ditolak dari master guards & logs
// 5. Petugas Satpam Pos Gerbang dapat akses verifikasi pos gerbang, ditolak dari master guards & logs & dashboard
$gateOfficer = User::where('role', 'gate_officer')->first();
$this->actingAs($gateOfficer)->get('/pg/gate-inspection')->assertStatus(200);
$this->actingAs($gateOfficer)->get('/pg/dashboard')->assertStatus(403);
$this->actingAs($gateOfficer)->get('/pg/guards')->assertStatus(403);
$this->actingAs($gateOfficer)->get('/pg/verification-logs')->assertStatus(403);
}
+15
View File
@@ -291,4 +291,19 @@ class VehicleActivityTest extends TestCase
$filterResponse->assertStatus(200);
$filterResponse->assertSee('TRX-LOG-PG-001');
}
public function test_admin_pg_can_view_dashboard_with_summary_metrics(): void
{
$pgUser = User::where('role', 'pg_admin')->first();
$response = $this->actingAs($pgUser)->get(route('pg.dashboard'));
$response->assertStatus(200);
$response->assertSee('TOTAL SATPAM');
$response->assertSee('SATPAM AKTIF');
$response->assertSee('POS GERBANG');
$response->assertSee('VERIFIKASI HARI INI');
$response->assertSee('PENOLAKAN GERBANG');
$response->assertSee('Log Verifikasi Gerbang Terkini');
$response->assertSee('Petugas Satpam per Regu');
}
}