fix(sidebar): group employee menus under dedicated portal karyawan section
This commit is contained in:
@@ -139,6 +139,10 @@ class User extends Authenticatable
|
|||||||
|
|
||||||
public function isEmployee(): bool
|
public function isEmployee(): bool
|
||||||
{
|
{
|
||||||
|
if ($this->isSuperAdmin()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->role === 'employee'
|
return $this->role === 'employee'
|
||||||
|| $this->hasRole('employee')
|
|| $this->hasRole('employee')
|
||||||
|| $this->can('employee.dashboard')
|
|| $this->can('employee.dashboard')
|
||||||
|
|||||||
@@ -220,22 +220,6 @@
|
|||||||
<span>Dashboard</span>
|
<span>Dashboard</span>
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@can('employee.p2h')
|
|
||||||
<a href="{{ route('p2h.index') }}"
|
|
||||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
|
||||||
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
|
||||||
<span>Pemeriksaan P2H</span>
|
|
||||||
</a>
|
|
||||||
@endcan
|
|
||||||
|
|
||||||
@can('employee.timesheet')
|
|
||||||
<a href="{{ route('timesheet.index') }}"
|
|
||||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
|
||||||
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
|
||||||
<span>Timesheet</span>
|
|
||||||
</a>
|
|
||||||
@endcan
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -410,6 +394,40 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<!-- Grup: Portal Karyawan & Driver -->
|
||||||
|
@if(auth()->user()->canAny(['employee.dashboard', 'employee.p2h', 'employee.timesheet']))
|
||||||
|
<div>
|
||||||
|
<p class="px-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-2">
|
||||||
|
PORTAL KARYAWAN & DRIVER
|
||||||
|
</p>
|
||||||
|
<nav class="space-y-1">
|
||||||
|
@if(auth()->user()->isSuperAdmin() || (!auth()->user()->isEmployee() && auth()->user()->can('employee.dashboard')))
|
||||||
|
<a href="{{ route('employee.dashboard') }}"
|
||||||
|
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('employee.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
<i class="fa-solid fa-id-badge text-base w-5 text-center"></i>
|
||||||
|
<span>Portal Karyawan</span>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@can('employee.p2h')
|
||||||
|
<a href="{{ route('p2h.index') }}"
|
||||||
|
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
||||||
|
<span>Pemeriksaan P2H</span>
|
||||||
|
</a>
|
||||||
|
@endcan
|
||||||
|
|
||||||
|
@can('employee.timesheet')
|
||||||
|
<a href="{{ route('timesheet.index') }}"
|
||||||
|
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
||||||
|
<span>Timesheet</span>
|
||||||
|
</a>
|
||||||
|
@endcan
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<!-- Grup: Pengaturan Akun -->
|
<!-- Grup: Pengaturan Akun -->
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<p class="px-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-2">
|
<p class="px-3 text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-2">
|
||||||
@@ -520,20 +538,6 @@
|
|||||||
<span>Dashboard</span>
|
<span>Dashboard</span>
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@can('employee.p2h')
|
|
||||||
<a href="{{ route('p2h.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
|
||||||
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
|
||||||
<span>Pemeriksaan P2H</span>
|
|
||||||
</a>
|
|
||||||
@endcan
|
|
||||||
|
|
||||||
@can('employee.timesheet')
|
|
||||||
<a href="{{ route('timesheet.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
|
||||||
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
|
||||||
<span>Timesheet</span>
|
|
||||||
</a>
|
|
||||||
@endcan
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -691,6 +695,37 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<!-- Grup: Portal Karyawan & Driver Mobile -->
|
||||||
|
@if(auth()->user()->canAny(['employee.dashboard', 'employee.p2h', 'employee.timesheet']))
|
||||||
|
<div>
|
||||||
|
<p class="px-2 text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-2">
|
||||||
|
PORTAL KARYAWAN & DRIVER
|
||||||
|
</p>
|
||||||
|
<nav class="space-y-1">
|
||||||
|
@if(auth()->user()->isSuperAdmin() || (!auth()->user()->isEmployee() && auth()->user()->can('employee.dashboard')))
|
||||||
|
<a href="{{ route('employee.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('employee.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
<i class="fa-solid fa-id-badge w-5 text-center"></i>
|
||||||
|
<span>Portal Karyawan</span>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@can('employee.p2h')
|
||||||
|
<a href="{{ route('p2h.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
<i class="fa-solid fa-clipboard-check w-5 text-center"></i>
|
||||||
|
<span>Pemeriksaan P2H</span>
|
||||||
|
</a>
|
||||||
|
@endcan
|
||||||
|
|
||||||
|
@can('employee.timesheet')
|
||||||
|
<a href="{{ route('timesheet.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
<i class="fa-solid fa-car w-5 text-center"></i>
|
||||||
|
<span>Timesheet</span>
|
||||||
|
</a>
|
||||||
|
@endcan
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider px-2 mt-4">PENGATURAN</p>
|
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider px-2 mt-4">PENGATURAN</p>
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<a href="{{ route('profile.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('profile.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
<a href="{{ route('profile.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('profile.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ class SuperAdminRbacTest extends TestCase
|
|||||||
$response = $this->actingAs($superAdmin)->get(route('admin.dashboard'));
|
$response = $this->actingAs($superAdmin)->get(route('admin.dashboard'));
|
||||||
$response->assertOk();
|
$response->assertOk();
|
||||||
$response->assertSee('Dashboard Super Admin');
|
$response->assertSee('Dashboard Super Admin');
|
||||||
|
$response->assertSee('PORTAL KARYAWAN');
|
||||||
|
$response->assertSee('Pemeriksaan P2H');
|
||||||
|
$response->assertSee('Timesheet');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_non_super_admin_cannot_access_admin_dashboard(): void
|
public function test_non_super_admin_cannot_access_admin_dashboard(): void
|
||||||
|
|||||||
Reference in New Issue
Block a user