refactor(admin): remove pos penempatan from super admin user forms and table

This commit is contained in:
Ray1111-aa
2026-10-22 09:06:40 +07:00
parent f73c22ee9e
commit 8e23cffed8
2 changed files with 19 additions and 51 deletions
@@ -184,7 +184,7 @@ class UserController extends Controller
$user->username = $validated['username']; $user->username = $validated['username'];
$user->email = $validated['email']; $user->email = $validated['email'];
$user->role = $validated['role']; $user->role = $validated['role'];
$user->gate_id = $validated['gate_id'] ?? null; $user->gate_id = array_key_exists('gate_id', $validated) ? $validated['gate_id'] : $user->gate_id;
$passwordUpdated = false; $passwordUpdated = false;
if (!empty($validated['password'])) { if (!empty($validated['password'])) {
+3 -35
View File
@@ -189,7 +189,6 @@
<th class="py-3 px-4">Pengguna</th> <th class="py-3 px-4">Pengguna</th>
<th class="py-3 px-4">Email</th> <th class="py-3 px-4">Email</th>
<th class="py-3 px-4">Role RBAC</th> <th class="py-3 px-4">Role RBAC</th>
<th class="py-3 px-4">Penempatan Pos</th>
<th class="py-3 px-4">Terdaftar</th> <th class="py-3 px-4">Terdaftar</th>
<th class="py-3 px-4 text-center">Aksi</th> <th class="py-3 px-4 text-center">Aksi</th>
</tr> </tr>
@@ -239,16 +238,6 @@
@endif @endif
</div> </div>
</td> </td>
<td class="py-3 px-4 text-slate-600">
@if($user->gate)
<span class="inline-flex items-center gap-1.5 text-xs text-slate-700">
<i class="fa-solid fa-location-dot text-slate-400"></i>
{{ $user->gate->name }}
</span>
@else
<span class="text-slate-400 text-[11px]">-</span>
@endif
</td>
<td class="py-3 px-4 text-slate-500 text-[11px]"> <td class="py-3 px-4 text-slate-500 text-[11px]">
{{ $user->created_at->format('d M Y') }} {{ $user->created_at->format('d M Y') }}
</td> </td>
@@ -274,7 +263,7 @@
</tr> </tr>
@empty @empty
<tr> <tr>
<td colspan="6" class="py-8 text-center text-slate-400"> <td colspan="5" class="py-8 text-center text-slate-400">
<i class="fa-solid fa-user-slash text-2xl mb-2 text-slate-300 block"></i> <i class="fa-solid fa-user-slash text-2xl mb-2 text-slate-300 block"></i>
Tidak ada data pengguna yang sesuai kriteria pencarian. Tidak ada data pengguna yang sesuai kriteria pencarian.
</td> </td>
@@ -350,7 +339,6 @@
</div> </div>
</div> </div>
<div class="grid grid-cols-2 gap-3">
<div> <div>
<label class="block text-xs font-bold text-slate-700 mb-1">Role RBAC *</label> <label class="block text-xs font-bold text-slate-700 mb-1">Role RBAC *</label>
<select name="role" required 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"> <select name="role" required 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">
@@ -360,16 +348,6 @@
@endforeach @endforeach
</select> </select>
</div> </div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1">Penempatan Pos Gerbang</label>
<select name="gate_id" 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">
<option value="">-- Tanpa Pos Gerbang --</option>
@foreach($gates as $gate)
<option value="{{ $gate->id }}">{{ $gate->name }} ({{ $gate->code }})</option>
@endforeach
</select>
</div>
</div>
<div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5"> <div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5">
<button type="button" onclick="closeCreateUserModal()" class="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-bold transition"> <button type="button" onclick="closeCreateUserModal()" class="px-4 py-2 bg-slate-100 hover:bg-slate-200 text-slate-600 rounded-xl text-xs font-bold transition">
@@ -443,7 +421,6 @@
</div> </div>
</div> </div>
<div class="grid grid-cols-2 gap-3">
<div> <div>
<label class="block text-xs font-bold text-slate-700 mb-1">Role RBAC *</label> <label class="block text-xs font-bold text-slate-700 mb-1">Role RBAC *</label>
<select id="edit_role" name="role" required onchange="updatePermissionCheckboxes()" 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"> <select id="edit_role" name="role" required onchange="updatePermissionCheckboxes()" 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">
@@ -452,16 +429,6 @@
@endforeach @endforeach
</select> </select>
</div> </div>
<div>
<label class="block text-xs font-bold text-slate-700 mb-1">Penempatan Pos Gerbang</label>
<select id="edit_gate_id" name="gate_id" 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">
<option value="">-- Tanpa Pos Gerbang --</option>
@foreach($gates as $gate)
<option value="{{ $gate->id }}">{{ $gate->name }} ({{ $gate->code }})</option>
@endforeach
</select>
</div>
</div>
<!-- Accordion: Izin Tambahan Khusus (Direct Permissions) --> <!-- Accordion: Izin Tambahan Khusus (Direct Permissions) -->
<div class="border border-slate-200 rounded-xl overflow-hidden bg-slate-50/50"> <div class="border border-slate-200 rounded-xl overflow-hidden bg-slate-50/50">
@@ -704,7 +671,8 @@
document.getElementById('edit_username').value = user.username; document.getElementById('edit_username').value = user.username;
document.getElementById('edit_email').value = user.email; document.getElementById('edit_email').value = user.email;
document.getElementById('edit_role').value = primaryRole; document.getElementById('edit_role').value = primaryRole;
document.getElementById('edit_gate_id').value = user.gate_id || ''; const editGateEl = document.getElementById('edit_gate_id');
if (editGateEl) editGateEl.value = user.gate_id || '';
const editPhotoPreview = document.getElementById('editUserPhotoPreview'); const editPhotoPreview = document.getElementById('editUserPhotoPreview');
const editPhotoPlaceholder = document.getElementById('editUserPhotoPlaceholder'); const editPhotoPlaceholder = document.getElementById('editUserPhotoPlaceholder');