feat: tambah fitur impor excel karyawan hse, perapian sidebar pg, dan bel notifikasi suara asisten verifikasi gerbang
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Matriks Role & Permission (RBAC) - Super Admin RKM')
|
||||
@section('title', 'Matriks Peran & Hak Akses Pengguna - Super Admin | PT Kerinci Merangin Hidro')
|
||||
|
||||
@section('content')
|
||||
<div class="space-y-6">
|
||||
@@ -9,10 +9,10 @@
|
||||
<div>
|
||||
<h1 class="text-2xl font-black text-slate-800 tracking-tight flex items-center gap-2.5">
|
||||
<span class="w-2.5 h-7 rounded-full bg-indigo-600 inline-block"></span>
|
||||
Matriks Role & Hak Akses (RBAC)
|
||||
Matriks Peran & Hak Akses Pengguna
|
||||
</h1>
|
||||
<p class="text-xs text-slate-500 mt-1">
|
||||
Konfigurasi izin wewenang (permissions) untuk setiap role pengguna menggunakan paket Spatie Laravel Permission.
|
||||
Atur wewenang dan batasan menu untuk setiap jabatan atau peran pengguna di lingkungan PT Kerinci Merangin Hidro.
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5">
|
||||
@@ -61,9 +61,9 @@
|
||||
<i class="fa-solid fa-crown"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="font-bold text-indigo-950">Privilese Khusus Super Administrator (Gate::before Bypass)</h2>
|
||||
<h2 class="font-bold text-indigo-950">Hak Akses Penuh Super Administrator</h2>
|
||||
<p class="text-indigo-800/80 mt-0.5 leading-relaxed">
|
||||
Role <strong>super_admin</strong> secara otomatis memiliki hak akses tak terbatas ke seluruh modul sistem (HSE, QMA, PG, dan Pengaturan RBAC) melalui interceptor gerbang Laravel. Matriks centang di bawah ini berlaku aktif untuk role operasional lainnya.
|
||||
Akun dengan peran <strong>Super Administrator</strong> secara otomatis memiliki akses penuh ke seluruh menu dan modul sistem tanpa batasan. Pilihan centang di bawah ini digunakan untuk mengatur batasan akses pada peran staf operasional lainnya.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,16 +94,16 @@
|
||||
<i class="fa-solid fa-trash-can text-xs"></i>
|
||||
</button>
|
||||
@else
|
||||
<span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider">Core</span>
|
||||
<span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider">Peran Utama</span>
|
||||
@endif
|
||||
</div>
|
||||
<h2 class="text-xs font-bold text-slate-800 capitalize">{{ str_replace('_', ' ', $role->name) }}</h2>
|
||||
<p class="text-[10px] text-slate-400 mt-0.5 font-mono">{{ $role->name }}</p>
|
||||
</div>
|
||||
<div class="mt-3 pt-2.5 border-t border-slate-100 flex items-center justify-between text-[11px]">
|
||||
<span class="text-slate-500">Izin Aktif:</span>
|
||||
<span class="text-slate-500">Jumlah Hak Akses:</span>
|
||||
<span class="font-bold text-indigo-700">
|
||||
{{ $role->name === 'super_admin' ? 'Semua' : $role->permissions->count() }}
|
||||
{{ $role->name === 'super_admin' ? 'Akses Lengkap' : $role->permissions->count() . ' Izin' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -121,12 +121,12 @@
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-sm font-bold text-slate-900 capitalize flex items-center gap-2">
|
||||
<span>Role: {{ str_replace('_', ' ', $role->name) }}</span>
|
||||
<span>Peran: {{ str_replace('_', ' ', $role->name) }}</span>
|
||||
@if($role->name === 'super_admin')
|
||||
<span class="px-2 py-0.5 rounded-full text-[9px] font-black bg-indigo-100 text-indigo-800">UNRESTRICTED</span>
|
||||
<span class="px-2 py-0.5 rounded-full text-[9px] font-black bg-indigo-100 text-indigo-800">AKSES LENGKAP</span>
|
||||
@endif
|
||||
</h2>
|
||||
<p class="text-[11px] text-slate-400">Atur centang hak akses yang diizinkan untuk peran pengguna ini.</p>
|
||||
<p class="text-[11px] text-slate-400">Atur centang hak akses menu yang diizinkan untuk peran pengguna ini.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
<i class="{{ $module['icon'] }} text-indigo-600 text-xs"></i>
|
||||
<span>{{ $module['name'] }}</span>
|
||||
</span>
|
||||
<span class="text-[10px] text-slate-400 font-semibold">{{ count($module['permissions']) }} izin</span>
|
||||
<span class="text-[10px] text-slate-400 font-semibold">{{ count($module['permissions']) }} hak akses</span>
|
||||
</h3>
|
||||
|
||||
<div class="space-y-2">
|
||||
|
||||
@@ -66,9 +66,13 @@
|
||||
|
||||
<!-- Card Filter & Pencarian -->
|
||||
<div class="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-sm">
|
||||
<form method="GET" action="{{ route('admin.users.index') }}" class="flex flex-col sm:flex-row gap-3">
|
||||
<form id="usersFilterForm" method="GET" action="{{ route('admin.users.index') }}" class="flex flex-col sm:flex-row gap-3 items-stretch sm:items-center">
|
||||
<input type="hidden" name="sort" id="userSortInput" value="{{ request('sort', 'latest') }}">
|
||||
|
||||
<div class="flex-1 relative">
|
||||
<i class="fa-solid fa-magnifying-glass absolute left-3.5 top-1/2 -translate-y-1/2 text-slate-400 text-xs"></i>
|
||||
<button type="submit" class="absolute left-3.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-indigo-600 transition text-xs" title="Cari pengguna">
|
||||
<i class="fa-solid fa-magnifying-glass"></i>
|
||||
</button>
|
||||
<input type="text"
|
||||
name="search"
|
||||
value="{{ request('search') }}"
|
||||
@@ -77,7 +81,7 @@
|
||||
</div>
|
||||
|
||||
<div class="w-full sm:w-48">
|
||||
<select name="role" class="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:ring-2 focus:ring-indigo-500 focus:bg-white transition">
|
||||
<select name="role" onchange="document.getElementById('usersFilterForm').submit()" class="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:ring-2 focus:ring-indigo-500 focus:bg-white transition cursor-pointer">
|
||||
<option value="">-- Semua Role --</option>
|
||||
@foreach($roles as $role)
|
||||
<option value="{{ $role->name }}" {{ request('role') === $role->name ? 'selected' : '' }}>
|
||||
@@ -87,14 +91,89 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<button type="submit" class="px-4 py-2 bg-slate-800 hover:bg-slate-900 text-white rounded-xl text-xs font-bold transition flex items-center gap-2">
|
||||
<i class="fa-solid fa-filter"></i>
|
||||
<span>Filter</span>
|
||||
<!-- Tombol Menu Urutkan (Sorting Popover) -->
|
||||
<div class="relative flex items-center gap-2" id="sortDropdownContainer">
|
||||
@php
|
||||
$currentSort = request('sort', 'latest');
|
||||
$sortLabels = [
|
||||
'latest' => 'Terbaru',
|
||||
'oldest' => 'Terlama',
|
||||
'name_asc' => 'Nama (A-Z)',
|
||||
'name_desc' => 'Nama (Z-A)',
|
||||
];
|
||||
$activeSortLabel = $sortLabels[$currentSort] ?? 'Terbaru';
|
||||
$isCustomSort = $currentSort !== 'latest';
|
||||
@endphp
|
||||
|
||||
<button type="button"
|
||||
id="sortDropdownBtn"
|
||||
onclick="toggleSortDropdown()"
|
||||
class="w-full sm:w-auto px-3.5 py-2 {{ $isCustomSort ? 'bg-indigo-50 border-indigo-200 text-indigo-700 shadow-sm' : 'bg-slate-800 hover:bg-slate-900 text-white' }} border rounded-xl text-xs font-bold transition flex items-center justify-between sm:justify-start gap-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<i class="fa-solid fa-arrow-down-wide-short {{ $isCustomSort ? 'text-indigo-600' : 'text-slate-300' }}"></i>
|
||||
<span>Urutkan: <strong class="{{ $isCustomSort ? 'text-indigo-800 font-black' : 'text-white' }}">{{ $activeSortLabel }}</strong></span>
|
||||
</div>
|
||||
<i id="sortDropdownChevron" class="fa-solid fa-chevron-down text-[10px] {{ $isCustomSort ? 'text-indigo-500' : 'text-slate-300' }} transition-transform duration-200"></i>
|
||||
</button>
|
||||
@if(request()->hasAny(['search', 'role']))
|
||||
<a href="{{ route('admin.users.index') }}" class="px-3 py-2 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-semibold transition" title="Reset Filter">
|
||||
|
||||
<!-- Menu Popover Dropdown Urutkan -->
|
||||
<div id="sortDropdownMenu"
|
||||
class="hidden absolute right-0 top-full mt-2 w-56 bg-white border border-slate-200 rounded-2xl shadow-xl z-30 py-2 divide-y divide-slate-100 animate-scale-in">
|
||||
<div class="px-3 py-1.5 text-[10px] font-bold text-slate-400 uppercase tracking-wider">
|
||||
Kriteria Pengurutan
|
||||
</div>
|
||||
<div class="py-1">
|
||||
<button type="button"
|
||||
onclick="applyUserSort('latest')"
|
||||
class="w-full px-3.5 py-2 text-left text-xs flex items-center justify-between hover:bg-slate-50 transition {{ $currentSort === 'latest' ? 'text-indigo-600 font-bold bg-indigo-50/50' : 'text-slate-700 font-medium' }}">
|
||||
<span class="flex items-center gap-2">
|
||||
<i class="fa-solid fa-clock-rotate-left text-slate-400 text-[11px]"></i>
|
||||
<span>Terdaftar Terbaru</span>
|
||||
</span>
|
||||
@if($currentSort === 'latest')
|
||||
<i class="fa-solid fa-check text-indigo-600 text-[10px]"></i>
|
||||
@endif
|
||||
</button>
|
||||
<button type="button"
|
||||
onclick="applyUserSort('oldest')"
|
||||
class="w-full px-3.5 py-2 text-left text-xs flex items-center justify-between hover:bg-slate-50 transition {{ $currentSort === 'oldest' ? 'text-indigo-600 font-bold bg-indigo-50/50' : 'text-slate-700 font-medium' }}">
|
||||
<span class="flex items-center gap-2">
|
||||
<i class="fa-regular fa-clock text-slate-400 text-[11px]"></i>
|
||||
<span>Terdaftar Terlama</span>
|
||||
</span>
|
||||
@if($currentSort === 'oldest')
|
||||
<i class="fa-solid fa-check text-indigo-600 text-[10px]"></i>
|
||||
@endif
|
||||
</button>
|
||||
<button type="button"
|
||||
onclick="applyUserSort('name_asc')"
|
||||
class="w-full px-3.5 py-2 text-left text-xs flex items-center justify-between hover:bg-slate-50 transition {{ $currentSort === 'name_asc' ? 'text-indigo-600 font-bold bg-indigo-50/50' : 'text-slate-700 font-medium' }}">
|
||||
<span class="flex items-center gap-2">
|
||||
<i class="fa-solid fa-arrow-down-a-z text-slate-400 text-[11px]"></i>
|
||||
<span>Nama Pengguna (A → Z)</span>
|
||||
</span>
|
||||
@if($currentSort === 'name_asc')
|
||||
<i class="fa-solid fa-check text-indigo-600 text-[10px]"></i>
|
||||
@endif
|
||||
</button>
|
||||
<button type="button"
|
||||
onclick="applyUserSort('name_desc')"
|
||||
class="w-full px-3.5 py-2 text-left text-xs flex items-center justify-between hover:bg-slate-50 transition {{ $currentSort === 'name_desc' ? 'text-indigo-600 font-bold bg-indigo-50/50' : 'text-slate-700 font-medium' }}">
|
||||
<span class="flex items-center gap-2">
|
||||
<i class="fa-solid fa-arrow-down-z-a text-slate-400 text-[11px]"></i>
|
||||
<span>Nama Pengguna (Z → A)</span>
|
||||
</span>
|
||||
@if($currentSort === 'name_desc')
|
||||
<i class="fa-solid fa-check text-indigo-600 text-[10px]"></i>
|
||||
@endif
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(request()->anyFilled(['search', 'role']) || request('sort', 'latest') !== 'latest')
|
||||
<a href="{{ route('admin.users.index') }}" class="px-3 py-2 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-semibold transition flex items-center gap-1.5" title="Reset Filter & Urutan">
|
||||
<i class="fa-solid fa-arrow-rotate-left"></i>
|
||||
<span class="hidden sm:inline">Reset</span>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
@@ -486,5 +565,37 @@
|
||||
document.getElementById('deleteUserModal').classList.add('hidden');
|
||||
document.documentElement.classList.remove('modal-open');
|
||||
}
|
||||
|
||||
function toggleSortDropdown() {
|
||||
const menu = document.getElementById('sortDropdownMenu');
|
||||
const chevron = document.getElementById('sortDropdownChevron');
|
||||
if (menu) {
|
||||
menu.classList.toggle('hidden');
|
||||
}
|
||||
if (chevron) {
|
||||
chevron.classList.toggle('rotate-180');
|
||||
}
|
||||
}
|
||||
|
||||
function applyUserSort(sortValue) {
|
||||
const sortInput = document.getElementById('userSortInput');
|
||||
const form = document.getElementById('usersFilterForm');
|
||||
if (sortInput && form) {
|
||||
sortInput.value = sortValue;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('click', function(e) {
|
||||
const container = document.getElementById('sortDropdownContainer');
|
||||
const menu = document.getElementById('sortDropdownMenu');
|
||||
const chevron = document.getElementById('sortDropdownChevron');
|
||||
if (container && menu && !container.contains(e.target)) {
|
||||
menu.classList.add('hidden');
|
||||
if (chevron) {
|
||||
chevron.classList.remove('rotate-180');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user