Files
2026-09-23 12:45:02 +07:00

71 lines
4.7 KiB
PHP

<x-app-layout>
<div class="py-12">
{{-- Lebar kontainer ditingkatkan ke 6xl agar tabel memiliki ruang lebih --}}
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white shadow-xl rounded-[2rem] overflow-hidden border border-slate-100">
{{-- Header Card --}}
<div class="p-6 md:p-8 border-b border-slate-100 flex flex-col md:flex-row justify-between items-start md:items-center bg-slate-50/50 gap-4">
<div>
<h2 class="text-2xl font-black text-slate-900 tracking-tight">Konfigurasi Hak Akses</h2>
<p class="text-slate-500 font-medium text-sm">
Hak akses: <span class="text-indigo-600 font-bold uppercase tracking-widest">{{ $role->name }}</span>
</p>
</div>
<a href="{{ route('admin.roles.index') }}" class="text-xs font-bold text-slate-400 hover:text-slate-600 transition-colors uppercase tracking-widest italic flex items-center">
<i class="fas fa-arrow-left mr-2"></i> Kembali
</a>
</div>
<form action="{{ route('admin.roles.update', $role->id) }}" method="POST" class="p-6 md:p-8">
@csrf
{{-- Wrapper untuk Horizontal Scroll agar tidak terpotong di Mobile --}}
<div class="overflow-x-auto rounded-2xl border border-slate-200 shadow-sm mb-8">
<table class="w-full text-sm text-left border-collapse min-w-[600px]">
<thead class="bg-slate-900 text-white uppercase text-xs font-black tracking-widest">
<tr>
{{-- Padding disesuaikan (py-4 px-6) agar seimbang --}}
<th class="py-4 px-6 whitespace-nowrap">Modul Sistem</th>
<th class="py-4 px-6 text-center whitespace-nowrap">Read</th>
<th class="py-4 px-6 text-center whitespace-nowrap">Create</th>
<th class="py-4 px-6 text-center whitespace-nowrap">Update</th>
<th class="py-4 px-6 text-center whitespace-nowrap">Delete</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@foreach($modules as $slug => $label)
<tr class="group hover:bg-indigo-50/40 transition-all">
<td class="py-4 px-6">
<span class="font-bold text-slate-700 block">{{ $label }}</span>
<span class="text-[10px] text-slate-400 font-mono uppercase">{{ $slug }}</span>
</td>
@foreach(['read', 'create', 'update', 'delete'] as $action)
<td class="py-4 px-6 text-center">
<div class="flex justify-center">
<input type="checkbox"
name="perms[{{ $slug }}][{{ $action }}]"
value="1"
class="w-5 h-5 rounded-lg border-slate-300 text-indigo-600 shadow-sm focus:ring-4 focus:ring-indigo-500/10 cursor-pointer transition-all"
{{ $role->hasPermission($slug, 'can_'.$action) ? 'checked' : '' }}>
</div>
</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</div>
{{-- Tombol Simpan --}}
<div class="flex justify-end pt-4 border-t border-slate-100">
<button type="submit" class="w-full sm:w-auto px-12 py-4 bg-slate-900 text-white rounded-2xl font-black text-xs uppercase tracking-[0.2em] hover:bg-indigo-700 shadow-xl shadow-indigo-600/20 transition-all active:scale-95 flex items-center justify-center">
<i class="fas fa-save mr-3"></i> Simpan Perubahan Izin
</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>