feat: timesheet auto hm, sync excel vehicle locations, heavy equipment grouped by type, 2-party bast signature, and compact role permission ui
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<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>
|
||||
<span>Matriks Peran & Hak Akses Pengguna</span>
|
||||
<span>Matriks Role & Hak Akses Pengguna</span>
|
||||
<!-- Tooltip Super Admin Priviledge -->
|
||||
<div class="relative group/tip inline-flex">
|
||||
<button type="button"
|
||||
@@ -75,167 +75,294 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Ringkasan Role Cards -->
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3">
|
||||
@foreach($roles as $role)
|
||||
@php
|
||||
$isCoreRole = in_array($role->name, ['super_admin', 'hse_admin', 'qma_admin', 'pg_admin', 'gate_officer']);
|
||||
$badgeColor = match($role->name) {
|
||||
'super_admin' => 'bg-indigo-600 text-white',
|
||||
'hse_admin' => 'bg-emerald-600 text-white',
|
||||
'qma_admin' => 'bg-blue-600 text-white',
|
||||
'pg_admin' => 'bg-purple-600 text-white',
|
||||
'gate_officer' => 'bg-amber-600 text-white',
|
||||
default => 'bg-slate-700 text-white'
|
||||
};
|
||||
@endphp
|
||||
<div class="bg-white border border-slate-200/80 rounded-2xl p-4 shadow-sm flex flex-col justify-between">
|
||||
<div>
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<span class="w-2.5 h-2.5 rounded-full {{ $badgeColor }}"></span>
|
||||
@if(!$isCoreRole)
|
||||
<button type="button"
|
||||
onclick='openDeleteRoleModal({{ $role->id }}, "{{ $role->name }}")'
|
||||
class="text-slate-400 hover:text-rose-600 transition"
|
||||
title="Hapus Role Kustom">
|
||||
<i class="fa-solid fa-trash-can text-xs"></i>
|
||||
</button>
|
||||
<!-- Selector Tab Role Interaktif (Compact & User Friendly) -->
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-xs font-bold uppercase tracking-wider text-slate-500 flex items-center gap-1.5">
|
||||
<i class="fa-solid fa-id-badge text-indigo-600"></i>
|
||||
<span>Pilih Peran Pengguna (Role):</span>
|
||||
</span>
|
||||
<span class="text-[11px] text-slate-400">Pilih salah satu peran untuk melihat dan mengatur izinnya</span>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3">
|
||||
@foreach($roles as $role)
|
||||
@php
|
||||
$isCoreRole = in_array($role->name, ['super_admin', 'hse_admin', 'qma_admin', 'pg_admin', 'gate_officer']);
|
||||
$dotColor = match($role->name) {
|
||||
'super_admin' => 'bg-indigo-600',
|
||||
'hse_admin' => 'bg-emerald-600',
|
||||
'qma_admin' => 'bg-blue-600',
|
||||
'pg_admin' => 'bg-purple-600',
|
||||
'gate_officer' => 'bg-amber-600',
|
||||
default => 'bg-slate-700'
|
||||
};
|
||||
@endphp
|
||||
<button type="button"
|
||||
onclick="switchRoleTab({{ $role->id }})"
|
||||
id="tab-btn-{{ $role->id }}"
|
||||
class="role-tab-btn text-left p-3.5 rounded-2xl border transition duration-200 relative group flex flex-col justify-between {{ $loop->first ? 'border-indigo-600 bg-indigo-50/60 ring-2 ring-indigo-500/20 shadow-sm' : 'border-slate-200/80 bg-white hover:bg-slate-50 hover:border-slate-300' }}">
|
||||
<div class="w-full">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<span class="w-2.5 h-2.5 rounded-full {{ $dotColor }}"></span>
|
||||
@if(!$isCoreRole)
|
||||
<span onclick="event.stopPropagation(); openDeleteRoleModal({{ $role->id }}, '{{ $role->name }}')"
|
||||
class="text-slate-300 hover:text-rose-600 p-1 -mr-1 transition"
|
||||
title="Hapus Role Kustom">
|
||||
<i class="fa-solid fa-trash-can text-xs"></i>
|
||||
</span>
|
||||
@else
|
||||
<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 leading-snug">
|
||||
{{ str_replace('_', ' ', $role->name) }}
|
||||
</h2>
|
||||
<p class="text-[10px] text-slate-400 font-mono mt-0.5 truncate">{{ $role->name }}</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 pt-2 border-t border-slate-100 flex items-center justify-between text-[11px] w-full">
|
||||
<span class="text-slate-500">Izin Akses:</span>
|
||||
@if($role->name === 'super_admin')
|
||||
<span class="font-black text-indigo-700 flex items-center gap-1">
|
||||
<i class="fa-solid fa-crown text-[9px] text-amber-500"></i>
|
||||
<span>Penuh</span>
|
||||
</span>
|
||||
@else
|
||||
<span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider">Peran Utama</span>
|
||||
<span class="font-bold text-indigo-700 role-perm-badge-count" data-role-id="{{ $role->id }}">
|
||||
{{ $role->permissions->count() }} Izin
|
||||
</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">Jumlah Hak Akses:</span>
|
||||
@if($role->name === 'super_admin')
|
||||
<div class="relative group/tip inline-flex">
|
||||
<span class="font-bold text-indigo-700 cursor-help flex items-center gap-1">
|
||||
<span>Akses Lengkap</span>
|
||||
<i class="fa-solid fa-circle-info text-[10px] text-indigo-400"></i>
|
||||
</span>
|
||||
<div class="absolute right-0 bottom-full mb-2 hidden group-hover/tip:block z-50 w-72 p-3 bg-slate-900 text-white text-xs rounded-xl shadow-xl pointer-events-none">
|
||||
<div class="flex items-start gap-2">
|
||||
<i class="fa-solid fa-crown text-amber-400 text-xs mt-0.5 flex-shrink-0"></i>
|
||||
<div>
|
||||
<strong class="font-bold text-white text-xs block">Hak Akses Penuh Super Administrator</strong>
|
||||
<p class="text-slate-300 text-[11px] mt-0.5 leading-relaxed">
|
||||
Secara otomatis memiliki akses penuh ke seluruh menu dan modul sistem tanpa batasan.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute -bottom-1 right-3 w-2 h-2 bg-slate-900 rotate-45"></div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<span class="font-bold text-indigo-700">
|
||||
{{ $role->permissions->count() . ' Izin' }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</button>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Matriks Role & Permissions Table -->
|
||||
<!-- Kontainer Panel Hak Akses Per Role (Hanya Role Aktif yang Ditampilkan) -->
|
||||
<div class="space-y-6">
|
||||
@foreach($roles as $role)
|
||||
<div class="bg-white border border-slate-200/80 rounded-2xl shadow-sm overflow-hidden">
|
||||
<div class="px-5 py-3.5 bg-slate-50 border-b border-slate-100 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-8 h-8 rounded-xl bg-indigo-50 border border-indigo-100 text-indigo-700 flex items-center justify-center font-bold text-xs">
|
||||
@php
|
||||
$rolePermNames = $role->permissions->pluck('name')->toArray();
|
||||
$isSuperAdmin = $role->name === 'super_admin';
|
||||
@endphp
|
||||
<div id="role-panel-{{ $role->id }}"
|
||||
class="role-panel bg-white border border-slate-200/80 rounded-2xl shadow-sm overflow-hidden {{ $loop->first ? '' : 'hidden' }}">
|
||||
|
||||
<!-- Panel Header Sticky/Top Bar -->
|
||||
<div class="px-5 py-4 bg-slate-50/80 border-b border-slate-200/70 flex flex-col md:flex-row md:items-center md:justify-between gap-4">
|
||||
<div class="flex items-start sm:items-center gap-3">
|
||||
<div class="w-10 h-10 rounded-xl bg-indigo-600 text-white flex items-center justify-center font-bold text-sm shadow-sm flex-shrink-0">
|
||||
<i class="fa-solid fa-shield-halved"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="text-sm font-bold text-slate-900 capitalize flex items-center gap-2">
|
||||
<span>Peran: {{ str_replace('_', ' ', $role->name) }}</span>
|
||||
@if($role->name === 'super_admin')
|
||||
<div class="relative group/satip inline-flex">
|
||||
<span class="px-2 py-0.5 rounded-full text-[9px] font-black bg-indigo-100 text-indigo-800 flex items-center gap-1 cursor-help">
|
||||
<i class="fa-solid fa-crown text-[8px]"></i>
|
||||
<span>AKSES LENGKAP</span>
|
||||
<i class="fa-solid fa-circle-info text-[9px] text-indigo-500"></i>
|
||||
</span>
|
||||
<div class="absolute left-0 top-full mt-2 hidden group-hover/satip:block z-50 w-72 sm:w-80 p-3 bg-slate-900 text-white text-xs rounded-xl shadow-xl pointer-events-none">
|
||||
<div class="flex items-start gap-2.5">
|
||||
<i class="fa-solid fa-crown text-amber-400 text-xs mt-0.5 flex-shrink-0"></i>
|
||||
<div>
|
||||
<strong class="font-bold text-white text-xs block">Hak Akses Penuh Super Administrator</strong>
|
||||
<p class="text-slate-300 text-[11px] mt-0.5 leading-relaxed">
|
||||
Akun dengan peran <strong>Super Administrator</strong> secara otomatis memiliki akses penuh ke seluruh menu dan modul sistem tanpa batasan. Pilihan centang di bawah digunakan untuk mengatur batasan akses peran staf operasional lainnya.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute -top-1 left-4 w-2 h-2 bg-slate-900 rotate-45"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<h2 class="text-base font-extrabold text-slate-800 capitalize">
|
||||
Pengaturan Hak Akses: {{ str_replace('_', ' ', $role->name) }}
|
||||
</h2>
|
||||
@if($isSuperAdmin)
|
||||
<span class="px-2.5 py-0.5 rounded-full text-[10px] font-black bg-amber-100 text-amber-800 border border-amber-200 inline-flex items-center gap-1">
|
||||
<i class="fa-solid fa-crown text-[9px]"></i>
|
||||
<span>BYPASS PENUH</span>
|
||||
</span>
|
||||
@else
|
||||
<span class="px-2.5 py-0.5 rounded-full text-[10px] font-bold bg-indigo-100 text-indigo-800 border border-indigo-200">
|
||||
Peran: <code class="font-mono">{{ $role->name }}</code>
|
||||
</span>
|
||||
@endif
|
||||
</h2>
|
||||
<p class="text-[11px] text-slate-400">Atur centang hak akses menu yang diizinkan untuk peran pengguna ini.</p>
|
||||
</div>
|
||||
<p class="text-xs text-slate-500 mt-0.5">
|
||||
@if($isSuperAdmin)
|
||||
Peran ini adalah tingkat tertinggi sistem. Seluruh hak akses otomatis aktif secara permanen.
|
||||
@else
|
||||
Centang fitur atau menu yang boleh diakses dan dijalankan oleh pengguna dengan peran ini.
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($role->name !== 'super_admin')
|
||||
<button type="submit"
|
||||
form="form-role-{{ $role->id }}"
|
||||
class="inline-flex items-center gap-1.5 px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-bold shadow-sm transition self-end sm:self-auto">
|
||||
<i class="fa-solid fa-floppy-disk"></i>
|
||||
<span>Simpan Hak Akses</span>
|
||||
</button>
|
||||
@endif
|
||||
<!-- Tombol Aksi & Simpan -->
|
||||
<div class="flex items-center gap-2 self-end md:self-auto flex-wrap">
|
||||
@if(!$isSuperAdmin)
|
||||
<button type="button"
|
||||
onclick="toggleAllRolePermissions({{ $role->id }}, true)"
|
||||
class="px-3 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl text-xs font-bold transition flex items-center gap-1.5"
|
||||
title="Centang semua hak akses untuk peran ini">
|
||||
<i class="fa-solid fa-check-double text-indigo-600"></i>
|
||||
<span>Pilih Semua</span>
|
||||
</button>
|
||||
<button type="button"
|
||||
onclick="toggleAllRolePermissions({{ $role->id }}, false)"
|
||||
class="px-3 py-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl text-xs font-bold transition flex items-center gap-1.5"
|
||||
title="Hilangkan semua centang untuk peran ini">
|
||||
<i class="fa-solid fa-rotate-left text-slate-500"></i>
|
||||
<span>Kosongkan</span>
|
||||
</button>
|
||||
<button type="submit"
|
||||
form="form-role-{{ $role->id }}"
|
||||
class="inline-flex items-center gap-2 px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-bold shadow-md shadow-indigo-600/20 transition">
|
||||
<i class="fa-solid fa-floppy-disk"></i>
|
||||
<span>Simpan Perubahan</span>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($isSuperAdmin)
|
||||
<!-- Notifikasi Super Admin Bypass -->
|
||||
<div class="m-5 p-4 rounded-xl bg-amber-50/70 border border-amber-200/80 flex items-start gap-3 text-amber-900 text-xs">
|
||||
<i class="fa-solid fa-circle-exclamation text-amber-600 text-base mt-0.5 flex-shrink-0"></i>
|
||||
<div>
|
||||
<strong class="font-bold block">Hak Akses Super Administrator Tidak Terbatas</strong>
|
||||
<p class="text-amber-800 text-[11px] mt-0.5 leading-relaxed">
|
||||
Sesuai arsitektur keamanan Spatie RBAC, pengguna dengan peran <code>super_admin</code> memiliki hak <em>Gate::before bypass</em> yang mengizinkan akses ke seluruh API, controller, rute, dan menu tanpa perlu diverifikasi satu per satu.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<!-- Search Filter Bar per Role -->
|
||||
<div class="px-5 pt-4 pb-2 flex flex-col sm:flex-row items-center justify-between gap-3 border-b border-slate-100">
|
||||
<div class="relative w-full sm:w-80">
|
||||
<i class="fa-solid fa-magnifying-glass absolute left-3.5 top-1/2 -translate-y-1/2 text-slate-400 text-xs"></i>
|
||||
<input type="text"
|
||||
id="search-role-{{ $role->id }}"
|
||||
oninput="filterRolePermissions({{ $role->id }}, this.value)"
|
||||
placeholder="Cari izin / nama menu (misal: p2h, simper, gate)..."
|
||||
class="w-full pl-9 pr-8 py-2 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:ring-2 focus:ring-indigo-500 focus:bg-white focus:border-indigo-500 transition">
|
||||
<button type="button"
|
||||
onclick="clearRoleSearch({{ $role->id }})"
|
||||
id="clear-search-{{ $role->id }}"
|
||||
class="absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 hidden text-xs">
|
||||
<i class="fa-solid fa-circle-xmark"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="text-[11px] text-slate-500 flex items-center gap-2">
|
||||
<span class="w-2 h-2 rounded-full bg-emerald-500"></span>
|
||||
<span>Total Terpilih:</span>
|
||||
<strong class="font-bold text-slate-800" id="selected-stat-{{ $role->id }}">{{ count($rolePermNames) }}</strong>
|
||||
<span class="text-slate-400">izin aktif</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Form Modul & Permission Checklists -->
|
||||
<form id="form-role-{{ $role->id }}"
|
||||
action="{{ route('admin.roles.permissions.update', $role->id) }}"
|
||||
method="POST"
|
||||
class="p-5">
|
||||
@csrf
|
||||
|
||||
@php
|
||||
$rolePermNames = $role->permissions->pluck('name')->toArray();
|
||||
@endphp
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div id="module-grid-{{ $role->id }}" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5">
|
||||
@foreach($modules as $moduleKey => $module)
|
||||
<div class="bg-slate-50/70 border border-slate-200/60 rounded-xl p-4 space-y-3">
|
||||
<h3 class="text-xs font-bold text-slate-800 flex items-center justify-between pb-2 border-b border-slate-200/60">
|
||||
<span class="flex items-center gap-1.5">
|
||||
<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']) }} hak akses</span>
|
||||
</h3>
|
||||
|
||||
<div class="space-y-2">
|
||||
@foreach($module['permissions'] as $permKey => $permMeta)
|
||||
@php
|
||||
$isChecked = $role->name === 'super_admin' || in_array($permKey, $rolePermNames);
|
||||
@endphp
|
||||
<label class="flex items-start gap-2.5 text-xs text-slate-700 cursor-pointer select-none group p-2 rounded-lg hover:bg-white hover:shadow-xs border border-transparent hover:border-slate-200/60 transition">
|
||||
<input type="checkbox"
|
||||
name="permissions[]"
|
||||
value="{{ $permKey }}"
|
||||
{{ $isChecked ? 'checked' : '' }}
|
||||
{{ $role->name === 'super_admin' ? 'disabled' : '' }}
|
||||
class="mt-1 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500 transition">
|
||||
<div>
|
||||
<span class="text-xs font-bold text-slate-800 group-hover:text-indigo-600 transition block">
|
||||
{{ $permMeta['label'] }}
|
||||
</span>
|
||||
<p class="text-[11px] text-slate-500 mt-0.5 leading-snug">
|
||||
{{ $permMeta['description'] }}
|
||||
</p>
|
||||
<span class="font-mono text-[10px] text-slate-400 mt-1 block">
|
||||
{{ $permKey }}
|
||||
</span>
|
||||
@php
|
||||
$totalInModule = count($module['permissions']);
|
||||
$activeInModule = 0;
|
||||
foreach($module['permissions'] as $pKey => $pMeta) {
|
||||
if ($isSuperAdmin || in_array($pKey, $rolePermNames)) {
|
||||
$activeInModule++;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<div class="perm-module-card bg-slate-50/70 border border-slate-200/70 rounded-xl p-4 flex flex-col justify-between space-y-3 transition"
|
||||
data-module-key="{{ $moduleKey }}">
|
||||
<div>
|
||||
<!-- Header Modul -->
|
||||
<div class="flex items-center justify-between pb-2.5 border-b border-slate-200/60 mb-2.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-6 h-6 rounded-lg bg-indigo-50 text-indigo-600 flex items-center justify-center text-xs">
|
||||
<i class="{{ $module['icon'] }}"></i>
|
||||
</div>
|
||||
</label>
|
||||
@endforeach
|
||||
<h3 class="text-xs font-bold text-slate-800 leading-snug">
|
||||
{{ $module['name'] }}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-[10px] font-bold text-slate-500 bg-white px-2 py-0.5 rounded-md border border-slate-200/80 module-counter"
|
||||
id="mod-count-{{ $role->id }}-{{ $moduleKey }}">
|
||||
{{ $activeInModule }}/{{ $totalInModule }}
|
||||
</span>
|
||||
|
||||
@if(!$isSuperAdmin)
|
||||
<div class="flex items-center space-x-1">
|
||||
<button type="button"
|
||||
onclick="toggleModuleCheckboxes({{ $role->id }}, '{{ $moduleKey }}', true)"
|
||||
class="text-[10px] font-bold text-indigo-600 hover:text-indigo-800 px-1 py-0.5 hover:bg-indigo-50 rounded transition"
|
||||
title="Centang semua di modul ini">
|
||||
Semua
|
||||
</button>
|
||||
<span class="text-slate-300 text-[10px]">|</span>
|
||||
<button type="button"
|
||||
onclick="toggleModuleCheckboxes({{ $role->id }}, '{{ $moduleKey }}', false)"
|
||||
class="text-[10px] font-bold text-slate-500 hover:text-slate-700 px-1 py-0.5 hover:bg-slate-200/50 rounded transition"
|
||||
title="Batalkan centang modul ini">
|
||||
Batal
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Daftar Permission -->
|
||||
<div class="space-y-1.5">
|
||||
@foreach($module['permissions'] as $permKey => $permMeta)
|
||||
@php
|
||||
$isChecked = $isSuperAdmin || in_array($permKey, $rolePermNames);
|
||||
@endphp
|
||||
<label class="perm-item flex items-start gap-2.5 text-xs text-slate-700 cursor-pointer select-none group p-2 rounded-lg hover:bg-white hover:shadow-xs border border-transparent hover:border-slate-200/60 transition {{ $isChecked ? 'bg-indigo-50/20' : '' }}"
|
||||
data-search-text="{{ strtolower($permMeta['label'] . ' ' . $permMeta['description'] . ' ' . $permKey . ' ' . $module['name']) }}">
|
||||
<input type="checkbox"
|
||||
name="permissions[]"
|
||||
value="{{ $permKey }}"
|
||||
data-module="{{ $moduleKey }}"
|
||||
onchange="onPermissionChange({{ $role->id }}, '{{ $moduleKey }}')"
|
||||
{{ $isChecked ? 'checked' : '' }}
|
||||
{{ $isSuperAdmin ? 'disabled' : '' }}
|
||||
class="perm-checkbox-{{ $role->id }} mt-0.5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500 transition">
|
||||
<div class="flex-1 min-w-0">
|
||||
<span class="text-xs font-bold text-slate-800 group-hover:text-indigo-600 transition block">
|
||||
{{ $permMeta['label'] }}
|
||||
</span>
|
||||
<p class="text-[11px] text-slate-500 mt-0.5 leading-snug">
|
||||
{{ $permMeta['description'] }}
|
||||
</p>
|
||||
<span class="font-mono text-[9px] text-slate-400 mt-0.5 block truncate">
|
||||
{{ $permKey }}
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<!-- Empty Search Result State -->
|
||||
<div id="empty-search-{{ $role->id }}" class="hidden py-12 text-center">
|
||||
<div class="w-12 h-12 rounded-full bg-slate-100 text-slate-400 flex items-center justify-center mx-auto mb-2 text-base">
|
||||
<i class="fa-solid fa-magnifying-glass"></i>
|
||||
</div>
|
||||
<h4 class="text-xs font-bold text-slate-700">Tidak ada hak akses yang cocok</h4>
|
||||
<p class="text-[11px] text-slate-400 mt-0.5">Coba gunakan kata kunci pencarian yang lain.</p>
|
||||
<button type="button" onclick="clearRoleSearch({{ $role->id }})" class="mt-3 px-3 py-1.5 bg-indigo-50 text-indigo-600 hover:bg-indigo-100 rounded-lg text-xs font-bold transition">
|
||||
Reset Pencarian
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if(!$isSuperAdmin)
|
||||
<!-- Bottom Action Bar -->
|
||||
<div class="mt-6 pt-4 border-t border-slate-100 flex items-center justify-between">
|
||||
<p class="text-xs text-slate-400">
|
||||
Pastikan klik tombol <strong>Simpan Perubahan</strong> untuk menerapkan hak akses ke pengguna terkait.
|
||||
</p>
|
||||
<button type="submit"
|
||||
class="inline-flex items-center gap-2 px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl text-xs font-bold shadow-md shadow-indigo-600/20 transition">
|
||||
<i class="fa-solid fa-floppy-disk"></i>
|
||||
<span>Simpan Perubahan</span>
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -306,6 +433,164 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Tab switching antar Role
|
||||
function switchRoleTab(roleId) {
|
||||
// Sembunyikan semua panel role
|
||||
document.querySelectorAll('.role-panel').forEach(panel => {
|
||||
panel.classList.add('hidden');
|
||||
});
|
||||
|
||||
// Non-aktifkan semua styling tombol tab
|
||||
document.querySelectorAll('.role-tab-btn').forEach(btn => {
|
||||
btn.classList.remove('border-indigo-600', 'bg-indigo-50/60', 'ring-2', 'ring-indigo-500/20', 'shadow-sm');
|
||||
btn.classList.add('border-slate-200/80', 'bg-white');
|
||||
});
|
||||
|
||||
// Tampilkan panel role terpilih
|
||||
const activePanel = document.getElementById(`role-panel-${roleId}`);
|
||||
if (activePanel) {
|
||||
activePanel.classList.remove('hidden');
|
||||
}
|
||||
|
||||
// Aktifkan styling tab terpilih
|
||||
const activeBtn = document.getElementById(`tab-btn-${roleId}`);
|
||||
if (activeBtn) {
|
||||
activeBtn.classList.remove('border-slate-200/80', 'bg-white');
|
||||
activeBtn.classList.add('border-indigo-600', 'bg-indigo-50/60', 'ring-2', 'ring-indigo-500/20', 'shadow-sm');
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle semua checkbox untuk role tertentu
|
||||
function toggleAllRolePermissions(roleId, checked) {
|
||||
const checkboxes = document.querySelectorAll(`.perm-checkbox-${roleId}`);
|
||||
checkboxes.forEach(cb => {
|
||||
if (!cb.disabled) {
|
||||
cb.checked = checked;
|
||||
}
|
||||
});
|
||||
updateRoleStats(roleId);
|
||||
}
|
||||
|
||||
// Toggle checkbox per modul
|
||||
function toggleModuleCheckboxes(roleId, moduleKey, checked) {
|
||||
const checkboxes = document.querySelectorAll(`#form-role-${roleId} input[data-module="${moduleKey}"]`);
|
||||
checkboxes.forEach(cb => {
|
||||
if (!cb.disabled) {
|
||||
cb.checked = checked;
|
||||
}
|
||||
});
|
||||
onPermissionChange(roleId, moduleKey);
|
||||
}
|
||||
|
||||
// Handler ketika ada checkbox yang berubah
|
||||
function onPermissionChange(roleId, moduleKey) {
|
||||
// Update counter per modul
|
||||
const modCheckboxes = document.querySelectorAll(`#form-role-${roleId} input[data-module="${moduleKey}"]`);
|
||||
const checkedInMod = Array.from(modCheckboxes).filter(cb => cb.checked).length;
|
||||
const totalInMod = modCheckboxes.length;
|
||||
|
||||
const counterEl = document.getElementById(`mod-count-${roleId}-${moduleKey}`);
|
||||
if (counterEl) {
|
||||
counterEl.textContent = `${checkedInMod}/${totalInMod}`;
|
||||
}
|
||||
|
||||
updateRoleStats(roleId);
|
||||
}
|
||||
|
||||
// Update counter total hak akses aktif untuk suatu role
|
||||
function updateRoleStats(roleId) {
|
||||
const allCheckboxes = document.querySelectorAll(`.perm-checkbox-${roleId}`);
|
||||
const totalChecked = Array.from(allCheckboxes).filter(cb => cb.checked).length;
|
||||
|
||||
// Update badge di header panel
|
||||
const statEl = document.getElementById(`selected-stat-${roleId}`);
|
||||
if (statEl) {
|
||||
statEl.textContent = totalChecked;
|
||||
}
|
||||
|
||||
// Update badge di tombol tab atas
|
||||
const tabBadge = document.querySelector(`.role-perm-badge-count[data-role-id="${roleId}"]`);
|
||||
if (tabBadge) {
|
||||
tabBadge.textContent = `${totalChecked} Izin`;
|
||||
}
|
||||
|
||||
// Update semua counter modul
|
||||
const modules = new Set();
|
||||
allCheckboxes.forEach(cb => {
|
||||
const m = cb.getAttribute('data-module');
|
||||
if (m) modules.add(m);
|
||||
});
|
||||
|
||||
modules.forEach(m => {
|
||||
const modCheckboxes = document.querySelectorAll(`#form-role-${roleId} input[data-module="${m}"]`);
|
||||
const checkedInMod = Array.from(modCheckboxes).filter(cb => cb.checked).length;
|
||||
const totalInMod = modCheckboxes.length;
|
||||
const counterEl = document.getElementById(`mod-count-${roleId}-${m}`);
|
||||
if (counterEl) {
|
||||
counterEl.textContent = `${checkedInMod}/${totalInMod}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Live Search Filter Hak Akses
|
||||
function filterRolePermissions(roleId, rawKeyword) {
|
||||
const keyword = (rawKeyword || '').toLowerCase().trim();
|
||||
const clearBtn = document.getElementById(`clear-search-${roleId}`);
|
||||
if (clearBtn) {
|
||||
clearBtn.classList.toggle('hidden', keyword.length === 0);
|
||||
}
|
||||
|
||||
const panel = document.getElementById(`role-panel-${roleId}`);
|
||||
if (!panel) return;
|
||||
|
||||
const moduleCards = panel.querySelectorAll('.perm-module-card');
|
||||
let totalVisibleCards = 0;
|
||||
|
||||
moduleCards.forEach(card => {
|
||||
const items = card.querySelectorAll('.perm-item');
|
||||
let visibleInCard = 0;
|
||||
|
||||
items.forEach(item => {
|
||||
const text = item.getAttribute('data-search-text') || '';
|
||||
if (!keyword || text.includes(keyword)) {
|
||||
item.classList.remove('hidden');
|
||||
visibleInCard++;
|
||||
} else {
|
||||
item.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
if (visibleInCard > 0) {
|
||||
card.classList.remove('hidden');
|
||||
totalVisibleCards++;
|
||||
} else {
|
||||
card.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
const emptyState = document.getElementById(`empty-search-${roleId}`);
|
||||
const moduleGrid = document.getElementById(`module-grid-${roleId}`);
|
||||
if (emptyState && moduleGrid) {
|
||||
if (totalVisibleCards === 0 && keyword.length > 0) {
|
||||
emptyState.classList.remove('hidden');
|
||||
moduleGrid.classList.add('hidden');
|
||||
} else {
|
||||
emptyState.classList.add('hidden');
|
||||
moduleGrid.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearRoleSearch(roleId) {
|
||||
const input = document.getElementById(`search-role-${roleId}`);
|
||||
if (input) {
|
||||
input.value = '';
|
||||
filterRolePermissions(roleId, '');
|
||||
input.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Modal Manajemen Role
|
||||
function openCreateRoleModal() {
|
||||
document.getElementById('createRoleModal').classList.remove('hidden');
|
||||
document.documentElement.classList.add('modal-open');
|
||||
|
||||
@@ -301,11 +301,23 @@
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<!-- Odometer Awal -->
|
||||
<!-- Odometer Awal & Akhir -->
|
||||
<td class="py-3.5 px-4 text-center font-mono whitespace-nowrap">
|
||||
<span class="text-xs font-bold text-slate-900 bg-slate-100 px-2.5 py-1 rounded-lg border border-slate-200">
|
||||
{{ number_format($ts->start_meter, 1, ',', '.') }} {{ $ts->meter_type }}
|
||||
</span>
|
||||
<div class="text-xs font-bold text-slate-900 bg-slate-100 px-2.5 py-1 rounded-lg border border-slate-200 inline-block">
|
||||
{{ number_format($ts->start_meter, 1, ',', '.') }} {{ $ts->meter_type }}@if($ts->effective_end_meter) <span class="text-slate-400 font-normal">s/d</span> <span class="text-emerald-700">{{ number_format($ts->effective_end_meter, 1, ',', '.') }} {{ $ts->meter_type }}</span>@endif
|
||||
</div>
|
||||
@if($ts->effective_operating_hours !== null && $ts->effective_operating_hours > 0)
|
||||
<div class="text-[10px] text-emerald-700 font-semibold font-sans mt-0.5">
|
||||
+{{ number_format($ts->effective_operating_hours, 1, ',', '.') }} Jam Operasi
|
||||
</div>
|
||||
@elseif($ts->effective_end_meter)
|
||||
<div class="text-[10px] text-slate-400 font-sans mt-0.5">0.0 Jam</div>
|
||||
@else
|
||||
<div class="text-[10px] text-amber-600 font-sans mt-0.5 flex items-center justify-center gap-1">
|
||||
<span class="w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"></span>
|
||||
<span>Berjalan (Finish Otomatis)</span>
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<!-- Lokasi & Aktivitas -->
|
||||
@@ -361,9 +373,9 @@
|
||||
'operator_type' => $ts->operator?->employee_type ?: 'Karyawan',
|
||||
'operator_nik' => $ts->operator?->nik ?: '-',
|
||||
'start_meter' => number_format($ts->start_meter, 1, ',', '.'),
|
||||
'end_meter' => number_format($ts->end_meter, 1, ',', '.'),
|
||||
'end_meter' => $ts->effective_end_meter !== null ? number_format($ts->effective_end_meter, 1, ',', '.') : '-',
|
||||
'meter_type' => $ts->meter_type,
|
||||
'operating_hours' => number_format($ts->operating_hours, 1, ',', '.'),
|
||||
'operating_hours' => $ts->effective_operating_hours !== null ? number_format($ts->effective_operating_hours, 1, ',', '.') : '-',
|
||||
'standby_hours' => number_format($ts->standby_hours, 1, ',', '.'),
|
||||
'breakdown_hours' => number_format($ts->breakdown_hours, 1, ',', '.'),
|
||||
'fuel_liters' => $ts->fuel_liters ? number_format($ts->fuel_liters, 0, ',', '.') : '-',
|
||||
@@ -479,37 +491,37 @@
|
||||
<!-- Baris 1: Lokasi Kerja & Heavy Equipment -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Lokasi Kerja <span class="text-rose-500">*</span>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
|
||||
<span>Lokasi Kerja <span class="text-rose-500">*</span></span>
|
||||
<span class="sr-only">Tentukan Lokasi Dulu</span>
|
||||
<span class="text-[10px] text-emerald-700 font-semibold">Bisa ketik / pilih</span>
|
||||
</label>
|
||||
<select id="addLocationSelect"
|
||||
required
|
||||
onchange="onTimesheetLocationChanged(this.value, 'add')"
|
||||
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<option value="" disabled selected>-- Pilih Lokasi Kerja --</option>
|
||||
<option value="ALL">[Semua Lokasi / Semua Unit]</option>
|
||||
@foreach($unitLocations as $locName => $count)
|
||||
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
|
||||
@endforeach
|
||||
@if(isset($otherLocations) && count($otherLocations))
|
||||
<optgroup label="Lokasi Lainnya di Site">
|
||||
@foreach($otherLocations as $otherLoc)
|
||||
<option value="{{ $otherLoc }}">{{ $otherLoc }} (0 Unit)</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endif
|
||||
<option value="__CUSTOM__">+ Ketik Lokasi Baru...</option>
|
||||
</select>
|
||||
<div id="addCustomLocationWrapper" class="hidden mt-2">
|
||||
<div class="relative">
|
||||
<input type="text"
|
||||
id="addCustomLocationInput"
|
||||
name="custom_location"
|
||||
placeholder="Ketik nama lokasi kerja baru..."
|
||||
oninput="onCustomLocationTyped(this.value, 'add')"
|
||||
class="w-full text-xs px-3.5 py-2 rounded-xl border border-emerald-300 bg-emerald-50/40 text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||
id="addLocationInput"
|
||||
name="location"
|
||||
list="addLocationsDatalist"
|
||||
required
|
||||
autocomplete="off"
|
||||
placeholder="Pilih atau ketik lokasi kerja..."
|
||||
oninput="onTimesheetLocationTyped(this.value, 'add')"
|
||||
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<datalist id="addLocationsDatalist">
|
||||
<option value="[Semua Unit]">[Semua Lokasi / Tampilkan Semua Unit]</option>
|
||||
@foreach($unitLocations as $locName => $count)
|
||||
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
|
||||
@endforeach
|
||||
@foreach($locationSuggestions as $suggLoc)
|
||||
@if(!isset($unitLocations[$suggLoc]))
|
||||
<option value="{{ $suggLoc }}">{{ $suggLoc }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</datalist>
|
||||
</div>
|
||||
<input type="hidden" name="location" id="addFinalLocation" required>
|
||||
<input type="hidden" id="addFinalLocation" value="">
|
||||
<p class="text-[10px] text-slate-400 mt-1">
|
||||
Pilih dari daftar atau ketik lokasi baru (otomatis tersimpan ke database).
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -626,7 +638,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baris 4: Meter Awal & Satuan Meteran -->
|
||||
<!-- Baris 4: Meter Awal & Meter Akhir (Finish HM) -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
@@ -644,6 +656,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
|
||||
<span>Meter Akhir (Finish HM/KM)</span>
|
||||
<span class="text-[10px] text-emerald-700 font-semibold">Otomatis / Opsional</span>
|
||||
</label>
|
||||
<div class="relative">
|
||||
<input type="number"
|
||||
step="0.01"
|
||||
name="end_meter"
|
||||
id="addEndMeter"
|
||||
placeholder="Dihitung otomatis jika kosong"
|
||||
class="w-full text-xs pl-3.5 pr-14 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<span id="addEndMeterUnitLabel" class="absolute right-3.5 top-1/2 -translate-y-1/2 text-xs font-extrabold text-slate-400">HM</span>
|
||||
</div>
|
||||
<p class="text-[10px] text-slate-400 mt-1">
|
||||
<i class="fa-solid fa-clock text-emerald-600 mr-0.5"></i> 1 HM = 1 Jam. Dihitung otomatis saat entri berikutnya diinput.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baris 4b: Satuan Meteran & Status Akhir Unit -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Satuan Meteran <span class="text-rose-500">*</span>
|
||||
@@ -653,21 +687,21 @@
|
||||
<option value="KM">KM (Odometer)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Status Akhir Unit <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select name="status" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<option value="Operation">Operation (Siap Jalan)</option>
|
||||
<option value="Standby">Standby (Tersedia / Siaga)</option>
|
||||
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
|
||||
<option value="Maintenance">Maintenance (Servis Rutin)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baris 5: Status Akhir Unit (Shift diset otomatis) -->
|
||||
<input type="hidden" name="shift" value="Shift Siang">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Status Akhir Unit <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select name="status" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<option value="Operation">Operation (Siap Jalan)</option>
|
||||
<option value="Standby">Standby (Tersedia / Siaga)</option>
|
||||
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
|
||||
<option value="Maintenance">Maintenance (Servis Rutin)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Baris 6: Rincian Tugas & Catatan -->
|
||||
<div>
|
||||
@@ -811,37 +845,37 @@
|
||||
<!-- Baris 1: Lokasi Kerja & Heavy Equipment -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Lokasi Kerja <span class="text-rose-500">*</span>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
|
||||
<span>Lokasi Kerja <span class="text-rose-500">*</span></span>
|
||||
<span class="sr-only">Tentukan Lokasi Dulu</span>
|
||||
<span class="text-[10px] text-emerald-700 font-semibold">Bisa ketik / pilih</span>
|
||||
</label>
|
||||
<select id="editLocationSelect"
|
||||
required
|
||||
onchange="onTimesheetLocationChanged(this.value, 'edit')"
|
||||
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<option value="" disabled selected>-- Pilih Lokasi Kerja --</option>
|
||||
<option value="ALL">[Semua Lokasi / Semua Unit]</option>
|
||||
@foreach($unitLocations as $locName => $count)
|
||||
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
|
||||
@endforeach
|
||||
@if(isset($otherLocations) && count($otherLocations))
|
||||
<optgroup label="Lokasi Lainnya di Site">
|
||||
@foreach($otherLocations as $otherLoc)
|
||||
<option value="{{ $otherLoc }}">{{ $otherLoc }} (0 Unit)</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endif
|
||||
<option value="__CUSTOM__">+ Ketik Lokasi Baru...</option>
|
||||
</select>
|
||||
<div id="editCustomLocationWrapper" class="hidden mt-2">
|
||||
<div class="relative">
|
||||
<input type="text"
|
||||
id="editCustomLocationInput"
|
||||
name="custom_location"
|
||||
placeholder="Ketik nama lokasi kerja baru..."
|
||||
oninput="onCustomLocationTyped(this.value, 'edit')"
|
||||
class="w-full text-xs px-3.5 py-2 rounded-xl border border-emerald-300 bg-emerald-50/40 text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||
id="editLocationInput"
|
||||
name="location"
|
||||
list="editLocationsDatalist"
|
||||
required
|
||||
autocomplete="off"
|
||||
placeholder="Pilih atau ketik lokasi kerja..."
|
||||
oninput="onTimesheetLocationTyped(this.value, 'edit')"
|
||||
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<datalist id="editLocationsDatalist">
|
||||
<option value="[Semua Unit]">[Semua Lokasi / Tampilkan Semua Unit]</option>
|
||||
@foreach($unitLocations as $locName => $count)
|
||||
<option value="{{ $locName }}">{{ $locName }} ({{ $count }} Unit Ready)</option>
|
||||
@endforeach
|
||||
@foreach($locationSuggestions as $suggLoc)
|
||||
@if(!isset($unitLocations[$suggLoc]))
|
||||
<option value="{{ $suggLoc }}">{{ $suggLoc }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</datalist>
|
||||
</div>
|
||||
<input type="hidden" name="location" id="editFinalLocation" required>
|
||||
<input type="hidden" id="editFinalLocation" value="">
|
||||
<p class="text-[10px] text-slate-400 mt-1">
|
||||
Pilih dari daftar atau ketik lokasi baru (otomatis tersimpan).
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -956,7 +990,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baris 4: Meter Awal & Satuan Meteran -->
|
||||
<!-- Baris 4: Meter Awal & Meter Akhir (Finish HM) -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
@@ -974,6 +1008,28 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5 flex items-center justify-between">
|
||||
<span>Meter Akhir (Finish HM/KM)</span>
|
||||
<span class="text-[10px] text-emerald-700 font-semibold">Otomatis / Opsional</span>
|
||||
</label>
|
||||
<div class="relative">
|
||||
<input type="number"
|
||||
step="0.01"
|
||||
name="end_meter"
|
||||
id="editEndMeter"
|
||||
placeholder="Dihitung otomatis jika kosong"
|
||||
class="w-full text-xs pl-3.5 pr-14 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<span id="editEndMeterUnitLabel" class="absolute right-3.5 top-1/2 -translate-y-1/2 text-xs font-extrabold text-slate-400">HM</span>
|
||||
</div>
|
||||
<p class="text-[10px] text-slate-400 mt-1">
|
||||
<i class="fa-solid fa-clock text-emerald-600 mr-0.5"></i> 1 HM = 1 Jam. Dihitung otomatis saat entri berikutnya diinput.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baris 4b: Satuan Meteran & Status Akhir Unit -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Satuan Meteran <span class="text-rose-500">*</span>
|
||||
@@ -983,21 +1039,22 @@
|
||||
<option value="KM">KM (Odometer)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Status Akhir Unit <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select name="status" id="editStatus" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<option value="Operation">Operation (Siap Jalan)</option>
|
||||
<option value="Standby">Standby (Tersedia / Siaga)</option>
|
||||
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
|
||||
<option value="Maintenance">Maintenance (Servis Rutin)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baris 5: Status Akhir Unit (Shift disimpan secara otomatis) -->
|
||||
<!-- Baris 5: Shift (disimpan otomatis) -->
|
||||
<input type="hidden" name="shift" id="editShift" value="Shift Siang">
|
||||
<div>
|
||||
<label class="block text-xs font-bold text-slate-700 mb-1.5">
|
||||
Status Akhir Unit <span class="text-rose-500">*</span>
|
||||
</label>
|
||||
<select name="status" id="editStatus" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] focus:ring-1 focus:ring-[#1b5e20] transition">
|
||||
<option value="Operation">Operation (Siap Jalan)</option>
|
||||
<option value="Standby">Standby (Tersedia / Siaga)</option>
|
||||
<option value="Breakdown">Breakdown (Kendala / Rusak)</option>
|
||||
<option value="Maintenance">Maintenance (Servis Rutin)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Baris 6: Deskripsi & Catatan -->
|
||||
<div>
|
||||
@@ -1318,23 +1375,15 @@
|
||||
const modal = document.getElementById('addTimesheetModal');
|
||||
if (modal) {
|
||||
// Reset form pilihan lokasi & unit
|
||||
const addLocSelect = document.getElementById('addLocationSelect');
|
||||
if (addLocSelect) addLocSelect.selectedIndex = 0;
|
||||
const customWrap = document.getElementById('addCustomLocationWrapper');
|
||||
if (customWrap) customWrap.classList.add('hidden');
|
||||
const customInput = document.getElementById('addCustomLocationInput');
|
||||
if (customInput) customInput.value = '';
|
||||
const addLocInput = document.getElementById('addLocationInput');
|
||||
if (addLocInput) addLocInput.value = '';
|
||||
const finalLoc = document.getElementById('addFinalLocation');
|
||||
if (finalLoc) finalLoc.value = '';
|
||||
|
||||
const vehSelect = document.getElementById('addVehicleSelect');
|
||||
if (vehSelect) {
|
||||
vehSelect.innerHTML = '<option value="" disabled selected>-- Pilih Lokasi Kerja Terlebih Dahulu --</option>';
|
||||
}
|
||||
const counter = document.getElementById('addUnitCounterBadge');
|
||||
if (counter) counter.classList.add('hidden');
|
||||
const preview = document.getElementById('addVehiclePreview');
|
||||
if (preview) preview.classList.add('hidden');
|
||||
const endMeter = document.getElementById('addEndMeter');
|
||||
if (endMeter) endMeter.value = '';
|
||||
|
||||
onTimesheetLocationTyped('', 'add');
|
||||
|
||||
const startMeter = document.getElementById('addStartMeter');
|
||||
if (startMeter) startMeter.value = '';
|
||||
@@ -1424,37 +1473,14 @@
|
||||
document.getElementById('editTimesheetSubtitle').textContent = `No: ${ts.timesheet_no} (${unitCode || '-'})`;
|
||||
|
||||
// 1. Sinkronisasi Lokasi Kerja
|
||||
const locSelect = document.getElementById('editLocationSelect');
|
||||
const locInput = document.getElementById('editLocationInput');
|
||||
const finalLoc = document.getElementById('editFinalLocation');
|
||||
const customWrap = document.getElementById('editCustomLocationWrapper');
|
||||
const targetLoc = ts.location || '';
|
||||
|
||||
finalLoc.value = targetLoc;
|
||||
|
||||
let matched = false;
|
||||
if (locSelect) {
|
||||
for (let i = 0; i < locSelect.options.length; i++) {
|
||||
if (locSelect.options[i].value.toLowerCase() === targetLoc.toLowerCase()) {
|
||||
locSelect.selectedIndex = i;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched && targetLoc) {
|
||||
// Tambahkan option lokasi baru jika belum terdaftar
|
||||
const newOpt = document.createElement('option');
|
||||
newOpt.value = targetLoc;
|
||||
newOpt.textContent = `${targetLoc} (Lokasi Riwayat)`;
|
||||
locSelect.appendChild(newOpt);
|
||||
locSelect.value = targetLoc;
|
||||
}
|
||||
}
|
||||
|
||||
if (customWrap) customWrap.classList.add('hidden');
|
||||
if (locInput) locInput.value = targetLoc;
|
||||
if (finalLoc) finalLoc.value = targetLoc;
|
||||
|
||||
// Filter unit pada lokasi ini dengan memilih ts.vehicle_id
|
||||
onTimesheetLocationChanged(locSelect ? locSelect.value : targetLoc, 'edit', ts.vehicle_id);
|
||||
onTimesheetLocationTyped(targetLoc, 'edit', ts.vehicle_id);
|
||||
|
||||
// Cari jenis operator yang sedang diedit untuk mengaktifkan filter yang sesuai
|
||||
let selectedOpType = 'all';
|
||||
@@ -1487,6 +1513,10 @@
|
||||
document.getElementById('editMeterType').value = ts.meter_type || 'HM';
|
||||
|
||||
document.getElementById('editStartMeter').value = ts.start_meter;
|
||||
const editEndMeter = document.getElementById('editEndMeter');
|
||||
if (editEndMeter) {
|
||||
editEndMeter.value = (ts.end_meter && ts.end_meter !== '-') ? ts.end_meter.replace('.', '').replace(',', '.') : '';
|
||||
}
|
||||
|
||||
document.getElementById('editActivityType').value = ts.activity_type;
|
||||
document.getElementById('editStatus').value = ts.status || 'Operation';
|
||||
@@ -1520,10 +1550,17 @@
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
|
||||
// 5. Handler saat Lokasi Kerja Dipilih (Filter Heavy Equipment yang Ready di Lokasi tersebut)
|
||||
// 5. Handler saat Lokasi Kerja Diketik / Dipilih via Datalist Input
|
||||
function onTimesheetLocationTyped(val, prefix, preselectVehicleId = null) {
|
||||
const trimmed = (val || '').trim();
|
||||
const finalLoc = document.getElementById(`${prefix}FinalLocation`);
|
||||
if (finalLoc) {
|
||||
finalLoc.value = (trimmed === '[Semua Unit]' || trimmed === 'ALL') ? '' : trimmed;
|
||||
}
|
||||
onTimesheetLocationChanged(trimmed, prefix, preselectVehicleId);
|
||||
}
|
||||
|
||||
function onTimesheetLocationChanged(selectedLoc, prefix, preselectVehicleId = null) {
|
||||
const customWrapper = document.getElementById(`${prefix}CustomLocationWrapper`);
|
||||
const customInput = document.getElementById(`${prefix}CustomLocationInput`);
|
||||
const finalLocation = document.getElementById(`${prefix}FinalLocation`);
|
||||
const vehicleSelect = document.getElementById(`${prefix}VehicleSelect`);
|
||||
const counterBadge = document.getElementById(`${prefix}UnitCounterBadge`);
|
||||
@@ -1531,56 +1568,40 @@
|
||||
|
||||
if (!vehicleSelect) return;
|
||||
|
||||
// Tangani pilihan custom atau ALL
|
||||
if (selectedLoc === '__CUSTOM__') {
|
||||
if (customWrapper) customWrapper.classList.remove('hidden');
|
||||
if (customInput) {
|
||||
customInput.focus();
|
||||
if (finalLocation) finalLocation.value = customInput.value.trim();
|
||||
}
|
||||
} else {
|
||||
if (customWrapper) customWrapper.classList.add('hidden');
|
||||
if (finalLocation) {
|
||||
finalLocation.value = (selectedLoc === 'ALL' || !selectedLoc) ? '' : selectedLoc;
|
||||
}
|
||||
if (finalLocation) {
|
||||
finalLocation.value = (selectedLoc === 'ALL' || selectedLoc === '[Semua Unit]' || !selectedLoc) ? '' : selectedLoc;
|
||||
}
|
||||
|
||||
const allUnits = window.unitSupportsData || [];
|
||||
let filteredUnits = [];
|
||||
|
||||
if (!selectedLoc) {
|
||||
vehicleSelect.innerHTML = '<option value="" disabled selected>-- Pilih Lokasi Kerja Terlebih Dahulu --</option>';
|
||||
if (counterBadge) counterBadge.classList.add('hidden');
|
||||
if (previewEl) previewEl.classList.add('hidden');
|
||||
filterOperatorSelect('all', prefix);
|
||||
return;
|
||||
} else if (selectedLoc === 'ALL' || selectedLoc === '__CUSTOM__') {
|
||||
if (!selectedLoc || selectedLoc === 'ALL' || selectedLoc === '[Semua Unit]') {
|
||||
filteredUnits = allUnits;
|
||||
} else {
|
||||
const norm = selectedLoc.trim().toLowerCase();
|
||||
filteredUnits = allUnits.filter(u => {
|
||||
const uLoc = (u.location || 'Site Kerinci').trim().toLowerCase();
|
||||
return uLoc === norm;
|
||||
return uLoc === norm || uLoc.includes(norm);
|
||||
});
|
||||
// Jika lokasi yang diketik adalah lokasi baru, tetap tampilkan semua unit agar bisa dipilih
|
||||
if (filteredUnits.length === 0) {
|
||||
filteredUnits = allUnits;
|
||||
}
|
||||
}
|
||||
|
||||
// Jika dalam mode edit dan preselectVehicleId tidak ditemukan di lokasi ini (misal unit berpindah setelah ts dicatat), sertakan unit tersebut
|
||||
if (preselectVehicleId) {
|
||||
const foundInFiltered = filteredUnits.some(u => String(u.id) === String(preselectVehicleId));
|
||||
if (!foundInFiltered) {
|
||||
const extra = allUnits.find(u => String(u.id) === String(preselectVehicleId));
|
||||
if (extra) filteredUnits.unshift(extra);
|
||||
}
|
||||
// Jika dalam mode edit dan preselectVehicleId tidak ditemukan di lokasi ini, sertakan unit tersebut
|
||||
if (preselectVehicleId) {
|
||||
const foundInFiltered = filteredUnits.some(u => String(u.id) === String(preselectVehicleId));
|
||||
if (!foundInFiltered) {
|
||||
const extra = allUnits.find(u => String(u.id) === String(preselectVehicleId));
|
||||
if (extra) filteredUnits.unshift(extra);
|
||||
}
|
||||
}
|
||||
|
||||
// Update badge counter
|
||||
if (counterBadge) {
|
||||
counterBadge.classList.remove('hidden');
|
||||
if (selectedLoc === 'ALL' || selectedLoc === '__CUSTOM__') {
|
||||
counterBadge.textContent = `${filteredUnits.length} Total Unit`;
|
||||
} else {
|
||||
counterBadge.textContent = `${filteredUnits.length} Unit Ready`;
|
||||
}
|
||||
counterBadge.textContent = `${filteredUnits.length} Unit Ready`;
|
||||
}
|
||||
|
||||
// Render option heavy equipment
|
||||
@@ -1590,7 +1611,7 @@
|
||||
defaultPrompt.disabled = true;
|
||||
defaultPrompt.textContent = filteredUnits.length > 0
|
||||
? `-- Pilih Heavy Equipment (${filteredUnits.length} Unit Ready) --`
|
||||
: `-- Tidak ada unit di lokasi ini (Pilih 'Semua Unit') --`;
|
||||
: `-- Tidak ada unit (${allUnits.length} Unit Total) --`;
|
||||
vehicleSelect.appendChild(defaultPrompt);
|
||||
|
||||
let hasSelected = false;
|
||||
@@ -1670,10 +1691,13 @@
|
||||
updateMeterUnitLabels(prefix);
|
||||
}
|
||||
|
||||
// Jika lokasi kerja dipilih 'ALL', sinkronkan finalLocation ke lokasi unit
|
||||
const locSelect = document.getElementById(`${prefix}LocationSelect`);
|
||||
// Jika lokasi kerja dipilih 'ALL' atau kosong, sinkronkan ke lokasi unit
|
||||
const locInput = document.getElementById(`${prefix}LocationInput`);
|
||||
const finalLoc = document.getElementById(`${prefix}FinalLocation`);
|
||||
if (locSelect && locSelect.value === 'ALL' && finalLoc && !finalLoc.value) {
|
||||
if (locInput && (!locInput.value || locInput.value === 'ALL' || locInput.value === '[Semua Unit]')) {
|
||||
locInput.value = unitLocation;
|
||||
}
|
||||
if (finalLoc && (!finalLoc.value || finalLoc.value === 'ALL' || finalLoc.value === '[Semua Unit]')) {
|
||||
finalLoc.value = unitLocation;
|
||||
}
|
||||
|
||||
@@ -1690,6 +1714,10 @@
|
||||
if (label) {
|
||||
label.textContent = unit;
|
||||
}
|
||||
const endLabel = document.getElementById(`${prefix}EndMeterUnitLabel`);
|
||||
if (endLabel) {
|
||||
endLabel.textContent = unit;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('addMeterType')?.addEventListener('change', () => updateMeterUnitLabels('add'));
|
||||
|
||||
@@ -233,62 +233,34 @@
|
||||
Demikian Berita Acara ini dibuat dengan sebenarnya dalam rangkap yang sah untuk dipergunakan sebagaimana mestinya dalam tertib administrasi aset dan operasional alat berat proyek Kerinci Merangin Hidro.
|
||||
</p>
|
||||
|
||||
<!-- KOLOM TANDA TANGAN (4 PIHAK) -->
|
||||
<!-- KOLOM TANDA TANGAN (2 PIHAK) -->
|
||||
<div class="pt-6">
|
||||
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4 text-center text-xs">
|
||||
<!-- 1. Yang Menyerahkan (Driver / Pengangkut) -->
|
||||
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
|
||||
<p class="font-bold text-slate-600 text-[11px]">Yang Menyerahkan / Pengangkut,</p>
|
||||
<div class="py-6">
|
||||
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-8 text-center text-xs max-w-2xl mx-auto">
|
||||
<!-- 1. Yang Melakukan / Mencatat Pemindahan -->
|
||||
<div class="flex flex-col justify-between min-h-[150px] p-4 border border-slate-200 rounded-xl bg-slate-50/40 shadow-sm">
|
||||
<p class="font-bold text-slate-700 text-xs uppercase tracking-wider">Yang Mencatat Pemindahan,</p>
|
||||
<div class="py-8">
|
||||
<span class="text-[11px] text-slate-400 italic">( Tanda Tangan )</span>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
|
||||
{{ $transfer->transporter_driver_name ?: 'Driver Pengangkut' }}
|
||||
<p class="font-bold text-slate-900 border-t border-slate-300 pt-2 text-sm">
|
||||
{{ $transfer->user?->name ?? $transfer->reported_by }}
|
||||
</p>
|
||||
<p class="text-[10px] text-slate-400">Pengemudi / Operator</p>
|
||||
<p class="text-[11px] text-slate-500 font-medium">Petugas Pemindahan / Pelapor</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. Yang Melaporkan (Petugas QMA) -->
|
||||
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
|
||||
<p class="font-bold text-slate-600 text-[11px]">Yang Melaporkan,</p>
|
||||
<div class="py-6">
|
||||
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
|
||||
<!-- 2. Admin QMA (Mengetahui / Menyetujui) -->
|
||||
<div class="flex flex-col justify-between min-h-[150px] p-4 border border-slate-200 rounded-xl bg-slate-50/40 shadow-sm">
|
||||
<p class="font-bold text-slate-700 text-xs uppercase tracking-wider">Mengetahui / Menyetujui,</p>
|
||||
<div class="py-8">
|
||||
<span class="text-[11px] text-slate-400 italic">( Tanda Tangan )</span>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
|
||||
{{ $transfer->reported_by }}
|
||||
</p>
|
||||
<p class="text-[10px] text-slate-400">Petugas QMA Field</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 3. Yang Menerima (Penanggung Jawab Lokasi Baru) -->
|
||||
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
|
||||
<p class="font-bold text-slate-600 text-[11px]">Yang Menerima,</p>
|
||||
<div class="py-6">
|
||||
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
|
||||
<p class="font-bold text-slate-900 border-t border-slate-300 pt-2 text-sm">
|
||||
( .................................... )
|
||||
</p>
|
||||
<p class="text-[10px] text-slate-400">PIC {{ $transfer->to_location }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 4. Mengetahui (Superintendent / Site Manager) -->
|
||||
<div class="flex flex-col justify-between min-h-[140px] p-2 border border-slate-200 rounded-xl bg-slate-50/40">
|
||||
<p class="font-bold text-slate-600 text-[11px]">Mengetahui,</p>
|
||||
<div class="py-6">
|
||||
<span class="text-[10px] text-slate-300 italic">(Tanda Tangan)</span>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-bold text-slate-900 border-t border-slate-300 pt-1">
|
||||
( .................................... )
|
||||
</p>
|
||||
<p class="text-[10px] text-slate-400">Superintendent QMA</p>
|
||||
<p class="text-[11px] text-slate-500 font-medium">Admin QMA</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,8 +61,46 @@
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Kotak Pencarian & Filter Kategori Alat Berat -->
|
||||
<!-- Top Banner jika sedang melihat unit dalam tipe tertentu -->
|
||||
@if(isset($selectedType) && $selectedType)
|
||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 bg-emerald-50/80 border border-emerald-200 rounded-2xl shadow-2xs">
|
||||
<div class="flex items-center space-x-3">
|
||||
<a href="{{ route('qma.vehicles.support') }}" class="px-3.5 py-2 rounded-xl bg-white border border-emerald-300 hover:bg-emerald-100/60 text-[#1b5e20] text-xs font-bold transition flex items-center gap-1.5 shadow-2xs">
|
||||
<i class="fa-solid fa-arrow-left text-[11px]"></i>
|
||||
<span>Semua Tipe Alat</span>
|
||||
</a>
|
||||
<div>
|
||||
<h3 class="text-sm sm:text-base font-extrabold text-slate-900 flex items-center gap-2">
|
||||
<span>Tipe: {{ $selectedType }}</span>
|
||||
<span class="px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-600 text-white">{{ $totalUnitsOfType ?? $typeUnits->total() }} Unit Fisik</span>
|
||||
</h3>
|
||||
<p class="text-[11px] text-emerald-800 font-medium mt-0.5">
|
||||
Daftar unit alat berat spesifik di bawah tipe {{ $selectedType }}.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-1.5 text-[11px]">
|
||||
<span class="px-2.5 py-1 rounded-lg font-bold bg-emerald-100 text-emerald-800 border border-emerald-200">
|
||||
{{ $opCount ?? 0 }} Operation
|
||||
</span>
|
||||
<span class="px-2.5 py-1 rounded-lg font-bold bg-amber-100 text-amber-800 border border-amber-200">
|
||||
{{ $stCount ?? 0 }} Standby
|
||||
</span>
|
||||
<span class="px-2.5 py-1 rounded-lg font-bold bg-rose-100 text-rose-800 border border-rose-200">
|
||||
{{ $bdCount ?? 0 }} Breakdown
|
||||
</span>
|
||||
<span class="px-2.5 py-1 rounded-lg font-bold bg-blue-100 text-blue-800 border border-blue-200">
|
||||
{{ $insideCount ?? 0 }} Site / {{ $outsideCount ?? 0 }} Luar
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Kotak Pencarian & Filter Alat Berat -->
|
||||
<form method="GET" action="{{ route('qma.vehicles.support') }}" id="supportFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3">
|
||||
@if(isset($selectedType) && $selectedType)
|
||||
<input type="hidden" name="type" value="{{ $selectedType }}">
|
||||
@endif
|
||||
<div class="relative w-full max-w-sm sm:max-w-md">
|
||||
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
|
||||
<i class="fa-solid fa-magnifying-glass text-xs"></i>
|
||||
@@ -71,18 +109,33 @@
|
||||
id="supportSearchInput"
|
||||
name="search"
|
||||
value="{{ request('search') }}"
|
||||
placeholder="Cari kode unit, model, tipe, lokasi, dokumen..."
|
||||
placeholder="{{ isset($selectedType) && $selectedType ? 'Cari kode unit, seri, model, lokasi di ' . $selectedType . '...' : 'Cari tipe alat berat (Boomlift, Excavator, Dump Truck)...' }}"
|
||||
class="w-full text-xs pl-10 pr-4 py-2.5 rounded-xl border border-slate-200 bg-white text-slate-800 placeholder-slate-400 focus:outline-none focus:border-emerald-600 focus:ring-2 focus:ring-emerald-600/10 shadow-sm transition">
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@if(!isset($selectedType) || !$selectedType)
|
||||
<!-- Filter Kategori Alat Berat -->
|
||||
<select name="unit_category" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||
<option value="">Semua Kategori Alat</option>
|
||||
<option value="">Semua Kategori (Handling, Support, Hauling...)</option>
|
||||
@foreach($availableCategories as $cat)
|
||||
<option value="{{ $cat }}" {{ request('unit_category') === $cat ? 'selected' : '' }}>{{ $cat }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<!-- Filter Status Operasional untuk Drilldown Unit -->
|
||||
<select name="status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||
<option value="">Semua Status Operasi</option>
|
||||
<option value="Operation" {{ request('status') === 'Operation' ? 'selected' : '' }}>Operation</option>
|
||||
<option value="Standby" {{ request('status') === 'Standby' ? 'selected' : '' }}>Standby</option>
|
||||
<option value="Breakdown" {{ request('status') === 'Breakdown' ? 'selected' : '' }}>Breakdown</option>
|
||||
</select>
|
||||
<select name="site_status" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||
<option value="">Semua Area</option>
|
||||
<option value="inside_site" {{ request('site_status') === 'inside_site' ? 'selected' : '' }}>Di Dalam Site</option>
|
||||
<option value="outside_site" {{ request('site_status') === 'outside_site' ? 'selected' : '' }}>Di Luar Site</option>
|
||||
</select>
|
||||
@endif
|
||||
|
||||
<!-- Filter Jumlah Per Halaman -->
|
||||
<select name="per_page" onchange="this.form.submit()" class="text-xs rounded-xl border border-slate-200 bg-white px-3 py-2 text-slate-700 font-semibold focus:outline-none focus:border-[#1b5e20]">
|
||||
@@ -96,8 +149,8 @@
|
||||
</button>
|
||||
|
||||
<div id="supportResetWrapper" class="flex items-center">
|
||||
@if(request()->anyFilled(['search', 'unit_category', 'per_page']))
|
||||
<a id="supportResetBtn" href="{{ route('qma.vehicles.support') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
|
||||
@if(request()->anyFilled(['search', 'unit_category', 'status', 'site_status', 'per_page']))
|
||||
<a id="supportResetBtn" href="{{ isset($selectedType) && $selectedType ? route('qma.vehicles.support', ['type' => $selectedType]) : route('qma.vehicles.support') }}" class="text-xs text-rose-600 hover:text-rose-800 font-semibold flex items-center space-x-1 whitespace-nowrap ml-1">
|
||||
<i class="fa-solid fa-rotate-left"></i>
|
||||
<span>Reset</span>
|
||||
</a>
|
||||
@@ -106,19 +159,125 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Tabel Data Kategori Heavy Equipment (Header Navy Solid #06213f) -->
|
||||
<!-- Tabel Data Heavy Equipment (Header Navy Solid #06213f) -->
|
||||
<div class="bg-white rounded-none sm:rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
@if(isset($selectedType) && $selectedType)
|
||||
<!-- TABEL 1: DAFTAR UNIT FISIK SPESIFIK TIPE INI -->
|
||||
<table class="min-w-full text-xs text-left border-collapse">
|
||||
<thead class="bg-[#06213f] text-white font-bold text-[11px] uppercase tracking-wider">
|
||||
<tr>
|
||||
<th class="py-3.5 px-4 text-center w-12">NO</th>
|
||||
<th class="py-3.5 px-4">KODE KATEGORI</th>
|
||||
<th class="py-3.5 px-4">KATEGORI ALAT</th>
|
||||
<th class="py-3.5 px-4 text-center">JUMLAH (QTY)</th>
|
||||
<th class="py-3.5 px-4">KODE UNIT</th>
|
||||
<th class="py-3.5 px-4">MEREK & MODEL</th>
|
||||
<th class="py-3.5 px-4">SPESIFIKASI</th>
|
||||
<th class="py-3.5 px-4">DIVISI & KEPEMILIKAN</th>
|
||||
<th class="py-3.5 px-4">NO. SERI / RANGKA</th>
|
||||
<th class="py-3.5 px-4 text-center">TAHUN</th>
|
||||
<th class="py-3.5 px-4">LOKASI SAAT INI</th>
|
||||
<th class="py-3.5 px-4 text-center">AREA</th>
|
||||
<th class="py-3.5 px-4 text-center">STATUS</th>
|
||||
<th class="py-3.5 px-4 text-center">AKSI</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100 text-slate-700 bg-white">
|
||||
@forelse($typeUnits as $index => $u)
|
||||
<tr class="hover:bg-slate-50/70 transition">
|
||||
<td class="py-3.5 px-4 text-center font-medium text-slate-400">
|
||||
{{ $typeUnits->firstItem() + $index }}
|
||||
</td>
|
||||
<td class="py-3.5 px-4 font-bold text-slate-900 font-mono text-xs whitespace-nowrap">
|
||||
<span class="bg-blue-50 text-blue-800 px-2.5 py-1 rounded border border-blue-200">
|
||||
{{ $u->code }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-3.5 px-4">
|
||||
<div class="font-bold text-slate-900">{{ $u->brand_type ?: ($u->brand ?: '-') }}</div>
|
||||
@if($u->model_number)
|
||||
<div class="text-[10px] text-slate-400 font-mono mt-0.5">Model: {{ $u->model_number }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-3.5 px-4 font-mono text-slate-600">
|
||||
{{ $u->serial_number ?: '-' }}
|
||||
</td>
|
||||
<td class="py-3.5 px-4 text-center text-slate-600">
|
||||
{{ $u->production_year ?: '-' }}
|
||||
</td>
|
||||
<td class="py-3.5 px-4 font-semibold text-slate-800">
|
||||
<div class="flex items-center space-x-1">
|
||||
<i class="fa-solid fa-location-dot text-emerald-600 text-[10px]"></i>
|
||||
<span>{{ $u->location ?: 'Site Kerinci' }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<span class="px-2 py-0.5 rounded text-[10px] font-bold {{ $u->isOutsideSite() ? 'bg-amber-50 text-amber-800 border border-amber-200' : 'bg-emerald-50 text-emerald-800 border border-emerald-200' }}">
|
||||
{{ $u->site_status_label }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
@if($u->status === 'Operation')
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
|
||||
Operation
|
||||
</span>
|
||||
@elseif($u->status === 'Standby')
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200">
|
||||
Standby
|
||||
</span>
|
||||
@elseif($u->status === 'Breakdown')
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-rose-50 text-rose-700 border border-rose-200">
|
||||
Breakdown
|
||||
</span>
|
||||
@else
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-slate-100 text-slate-600">
|
||||
{{ $u->status }}
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<div class="flex items-center justify-center space-x-1.5">
|
||||
<button onclick='openDetailModal(@json($u))'
|
||||
class="inline-flex items-center space-x-1 text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-2 py-1 rounded-lg transition"
|
||||
title="Lihat Detail Unit">
|
||||
<i class="fa-regular fa-eye text-sm"></i>
|
||||
</button>
|
||||
@can('qma.vehicles.edit')
|
||||
<button onclick='openEditModal(@json($u))'
|
||||
class="inline-flex items-center space-x-1 text-amber-600 hover:text-amber-800 hover:bg-amber-50 px-2 py-1 rounded-lg transition"
|
||||
title="Edit Data Unit">
|
||||
<i class="fa-regular fa-pen-to-square text-sm"></i>
|
||||
</button>
|
||||
@endcan
|
||||
@can('qma.vehicles.delete')
|
||||
<button type="button"
|
||||
onclick="openDeleteModal('{{ $u->id }}', '{{ $u->code }}', '{{ addslashes($u->brand_type ?? '') }}')"
|
||||
class="inline-flex items-center space-x-1 text-rose-600 hover:text-rose-800 hover:bg-rose-50 px-2 py-1 rounded-lg transition"
|
||||
title="Hapus Unit">
|
||||
<i class="fa-regular fa-trash-can text-sm"></i>
|
||||
</button>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="9" class="py-12 text-center text-slate-400">
|
||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
||||
<p class="text-sm font-semibold text-slate-700">Tidak ada unit fisik untuk tipe {{ $selectedType }}</p>
|
||||
<p class="text-xs text-slate-400 mt-1">Belum ada unit terdaftar atau sesuai kriteria filter.</p>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
@else
|
||||
<!-- TABEL 2: PENGELOMPOKAN BERDASARKAN TIPE HEAVY EQUIPMENT -->
|
||||
<table class="min-w-full text-xs text-left border-collapse">
|
||||
<thead class="bg-[#06213f] text-white font-bold text-[11px] uppercase tracking-wider">
|
||||
<tr>
|
||||
<th class="py-3.5 px-4 text-center w-12">NO</th>
|
||||
<th class="py-3.5 px-4">TIPE ALAT BERAT</th>
|
||||
<th class="py-3.5 px-4">KATEGORI</th>
|
||||
<th class="py-3.5 px-4 text-center">JUMLAH (QTY)</th>
|
||||
<th class="py-3.5 px-4">STATUS OPERASIONAL</th>
|
||||
<th class="py-3.5 px-4">DISTRIBUSI AREA</th>
|
||||
<th class="py-3.5 px-4 text-center">AKSI</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -129,84 +288,66 @@
|
||||
{{ $vehicles->firstItem() + $index }}
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4 font-bold text-slate-900 font-mono text-xs whitespace-nowrap">
|
||||
<span class="bg-blue-50 text-blue-800 px-2.5 py-1 rounded border border-blue-200">
|
||||
{{ $v->code }}
|
||||
</span>
|
||||
<td class="py-3.5 px-4 font-bold text-slate-900 text-xs whitespace-nowrap">
|
||||
<a href="{{ route('qma.vehicles.support', ['type' => $v->unit_type]) }}" class="hover:text-[#1b5e20] transition flex items-center space-x-2.5">
|
||||
<div class="w-8 h-8 rounded-lg bg-emerald-50 text-emerald-800 border border-emerald-200 flex items-center justify-center flex-shrink-0">
|
||||
<i class="fa-solid fa-truck-monster text-xs"></i>
|
||||
</div>
|
||||
<div>
|
||||
<span class="font-extrabold text-slate-900 block text-xs">{{ $v->unit_type }}</span>
|
||||
@if(isset($v->sample_brand_type) && $v->sample_brand_type)
|
||||
<span class="text-[10px] text-slate-400 font-normal block">{{ $v->sample_brand_type }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4 whitespace-nowrap">
|
||||
<div class="flex items-center space-x-3">
|
||||
@if($v->photo_path)
|
||||
<img src="{{ $v->photo_url }}" alt="{{ $v->code }}" class="w-9 h-9 rounded-lg object-cover border border-slate-200 shadow-2xs flex-shrink-0 cursor-pointer" onclick='openDetailModal(@json($v))'>
|
||||
@else
|
||||
<div class="w-9 h-9 rounded-lg bg-slate-100 border border-slate-200 flex items-center justify-center text-slate-400 flex-shrink-0">
|
||||
<i class="fa-solid fa-truck-monster text-xs"></i>
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
<span class="font-bold text-slate-900 block text-xs">{{ $v->unit_category ?? 'Alat Berat' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="px-2.5 py-1 rounded-md text-[10px] font-bold bg-slate-100 text-slate-700 border border-slate-200 uppercase tracking-wider">
|
||||
{{ $v->unit_category ?? 'SUPPORT' }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<a href="{{ route('qma.vehicles.support.units', $v->id) }}"
|
||||
class="inline-flex items-center space-x-1.5 px-3.5 py-1.5 rounded-full text-xs font-bold bg-[#e8f8f0] text-[#00897b] border border-[#a7f3d0] hover:bg-[#d1fae5] transition shadow-2xs group cursor-pointer"
|
||||
title="Buka daftar {{ $v->units_count ?? 0 }} unit fisik">
|
||||
<a href="{{ route('qma.vehicles.support', ['type' => $v->unit_type]) }}"
|
||||
class="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-full text-xs font-bold bg-[#e8f8f0] text-[#00897b] border border-[#a7f3d0] hover:bg-[#d1fae5] transition shadow-2xs group cursor-pointer"
|
||||
title="Buka daftar {{ $v->units_count ?? 0 }} unit fisik tipe {{ $v->unit_type }}">
|
||||
<span>{{ $v->units_count ?? 0 }} Unit</span>
|
||||
<i class="fa-solid fa-chevron-right text-[10px] ml-1 transition group-hover:translate-x-0.5"></i>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4">
|
||||
<div class="font-bold text-slate-900">{{ $v->brand_type }}</div>
|
||||
@if($v->model_number)
|
||||
<div class="text-[10px] text-slate-500 font-mono mt-0.5">Model: {{ $v->model_number }}</div>
|
||||
@endif
|
||||
<div class="flex items-center space-x-2 text-[10px] font-bold">
|
||||
<span class="text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded border border-emerald-200">
|
||||
{{ $v->total_operation ?? 0 }} Operasi
|
||||
</span>
|
||||
<span class="text-amber-700 bg-amber-50 px-2 py-0.5 rounded border border-amber-200">
|
||||
{{ $v->total_standby ?? 0 }} Standby
|
||||
</span>
|
||||
<span class="text-rose-700 bg-rose-50 px-2 py-0.5 rounded border border-rose-200">
|
||||
{{ $v->total_breakdown ?? 0 }} Breakdown
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4 text-slate-700">
|
||||
@if($v->unit_type)
|
||||
<span class="font-medium text-xs">{{ $v->unit_type }}</span>
|
||||
@else
|
||||
<span class="text-slate-300">-</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4 text-slate-600">
|
||||
<div class="font-medium text-slate-800">{{ $v->division ?? '-' }}</div>
|
||||
<span class="text-[10px] text-slate-400 block">{{ $v->ownership ?? 'PT Kerinci Merangin Hidro' }}</span>
|
||||
<td class="py-3.5 px-4 text-slate-600 text-[11px]">
|
||||
<span class="font-medium text-emerald-800">{{ $v->inside_site_count ?? 0 }} Di Dalam Site</span>
|
||||
<span class="text-slate-300 mx-1">•</span>
|
||||
<span class="text-slate-500">{{ $v->outside_site_count ?? 0 }} Di Luar Site</span>
|
||||
</td>
|
||||
|
||||
<td class="py-3.5 px-4 text-center whitespace-nowrap">
|
||||
<div class="flex items-center justify-center space-x-1.5">
|
||||
<button onclick='openDetailModal(@json($v))'
|
||||
class="inline-flex items-center space-x-1 text-slate-600 hover:text-slate-900 hover:bg-slate-100 px-2 py-1 rounded-lg transition"
|
||||
title="Lihat Spesifikasi Kategori">
|
||||
<i class="fa-regular fa-eye text-sm"></i>
|
||||
</button>
|
||||
@can('qma.vehicles.edit')
|
||||
<button onclick='openEditModal(@json($v))'
|
||||
class="inline-flex items-center space-x-1 text-amber-600 hover:text-amber-800 hover:bg-amber-50 px-2 py-1 rounded-lg transition"
|
||||
title="Edit Data Kategori">
|
||||
<i class="fa-regular fa-pen-to-square text-sm"></i>
|
||||
</button>
|
||||
@endcan
|
||||
@can('qma.vehicles.delete')
|
||||
<button type="button"
|
||||
onclick="openDeleteModal('{{ $v->id }}', '{{ $v->code }}', '{{ addslashes($v->brand_type ?? '') }}')"
|
||||
class="inline-flex items-center space-x-1 text-rose-600 hover:text-rose-800 hover:bg-rose-50 px-2 py-1 rounded-lg transition"
|
||||
title="Hapus Kategori / Unit">
|
||||
<i class="fa-regular fa-trash-can text-sm"></i>
|
||||
</button>
|
||||
@endcan
|
||||
</div>
|
||||
<a href="{{ route('qma.vehicles.support', ['type' => $v->unit_type]) }}"
|
||||
class="inline-flex items-center space-x-1.5 px-3 py-1.5 bg-[#1b5e20] hover:bg-[#144919] text-white rounded-xl text-xs font-bold transition shadow-2xs">
|
||||
<i class="fa-regular fa-folder-open text-xs"></i>
|
||||
<span>Buka Unit</span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr id="serverSupportEmptyRow">
|
||||
<td colspan="8" class="py-12 text-center text-slate-400">
|
||||
<td colspan="7" class="py-12 text-center text-slate-400">
|
||||
<i class="fa-solid fa-magnifying-glass text-3xl mb-3 block text-slate-300"></i>
|
||||
@if(request('search'))
|
||||
<p class="text-sm font-semibold text-slate-700">
|
||||
@@ -222,18 +363,23 @@
|
||||
</a>
|
||||
</div>
|
||||
@else
|
||||
<p class="text-sm font-semibold text-slate-700">Belum ada unit alat berat</p>
|
||||
<p class="text-xs text-slate-400 mt-0.5">Belum ada unit alat berat yang sesuai dengan filter.</p>
|
||||
<p class="text-sm font-semibold text-slate-700">Belum ada tipe alat berat</p>
|
||||
<p class="text-xs text-slate-400 mt-0.5">Belum ada tipe alat berat yang sesuai dengan filter.</p>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div id="supportPaginationContainer" class="p-4 bg-slate-50 border-t border-slate-200">
|
||||
{{ $vehicles->links() }}
|
||||
@if(isset($selectedType) && $selectedType)
|
||||
{{ $typeUnits->links() }}
|
||||
@else
|
||||
{{ $vehicles->links() }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user