feat: implement flexible hse simper types, multi-simper personil, and mobile heavy timesheet integration

This commit is contained in:
Ray1111-aa
2026-10-25 22:34:11 +07:00
parent c2116712e7
commit 9897404f61
25 changed files with 2096 additions and 70 deletions
+253 -11
View File
@@ -219,10 +219,24 @@
@endif
</td>
<!-- Masa Berlaku SIMPER -->
<td class="py-3.5 px-4 text-center whitespace-nowrap">
<!-- Masa Berlaku SIMPER & Multi-SIMPER Badges -->
<td class="py-3.5 px-4 text-center">
@if(!$emp->is_operator)
<span class="text-slate-400 italic text-[11px]">-</span>
@elseif($emp->simpers && $emp->simpers->isNotEmpty())
<div class="flex flex-col gap-1 items-center">
@foreach($emp->simpers as $sm)
@php
$smValid = $sm->isValid();
$smCode = $sm->simperType?->code ?: 'SIMPER';
$shortCode = str_replace('SIMPER-', '', $smCode);
@endphp
<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold font-mono {{ $smValid ? 'bg-emerald-50 text-emerald-800 border border-emerald-200' : 'bg-rose-50 text-rose-700 border border-rose-200' }}" title="{{ $sm->simperType?->name }}: s/d {{ $sm->expired_at ? $sm->expired_at->format('d/m/Y') : '-' }}">
<i class="fa-solid {{ $smValid ? 'fa-circle-check text-emerald-600' : 'fa-circle-xmark text-rose-600' }} mr-1 text-[8px]"></i>
{{ $shortCode }}: {{ $sm->expired_at ? $sm->expired_at->format('d/m/y') : '-' }}
</span>
@endforeach
</div>
@elseif($isValid)
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-[11px] font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200 font-mono">
<i class="fa-solid fa-circle-check mr-1.5 text-emerald-600 text-[10px]"></i>
@@ -414,10 +428,61 @@
<option value="0">TIDAK (Bukan Driver)</option>
</select>
</div>
<div id="addSimperDateWrapper">
<label class="block text-xs font-bold text-slate-800 mb-1.5">Masa Berlaku SIMPER</label>
<input type="date" name="simper_expired_at" id="addSimperDateInput"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] transition">
<div id="addSimperDateWrapper" class="col-span-1 sm:col-span-2 space-y-2">
<div class="flex items-center justify-between">
<label class="block text-xs font-bold text-slate-800">
Izin SIMPER yang Diberikan <span class="text-rose-500">*</span>
</label>
<span class="text-[10px] text-slate-400">Centang jenis izin & tentukan masa berlakunya</span>
</div>
<input type="hidden" name="simper_expired_at" id="addSimperDateInput">
@if(isset($availableSimperTypes) && count($availableSimperTypes) > 0)
<div class="space-y-2 max-h-48 overflow-y-auto pr-1">
@foreach($availableSimperTypes as $st)
<div class="p-2.5 rounded-xl border border-slate-200 bg-slate-50/70 hover:bg-slate-50 transition">
<div class="flex items-center justify-between">
<label class="flex items-center space-x-2 text-xs font-bold text-slate-800 cursor-pointer">
<input type="checkbox"
name="simper_assignments[{{ $st->id }}][enabled]"
value="1"
id="addSimperCheck_{{ $st->id }}"
onchange="toggleAddSimperFields({{ $st->id }})"
class="w-4 h-4 rounded text-emerald-700 border-slate-300 focus:ring-emerald-500">
<span>{{ $st->name }} ({{ $st->code }})</span>
</label>
<span class="text-[9px] font-mono px-1.5 py-0.5 rounded bg-slate-200 text-slate-700 font-bold uppercase">
{{ str_replace('_', ' ', $st->category_scope) }}
</span>
</div>
<div id="addSimperFields_{{ $st->id }}" class="hidden grid grid-cols-1 sm:grid-cols-2 gap-2 mt-2 pt-2 border-t border-slate-200/60">
<div>
<label class="block text-[10px] font-bold text-slate-500 mb-1">Nomor Registrasi SIMPER</label>
<input type="text"
name="simper_assignments[{{ $st->id }}][simper_number]"
id="addSimperNum_{{ $st->id }}"
placeholder="Contoh: SMP-LV-001"
class="w-full text-xs px-2.5 py-1.5 rounded-lg border border-slate-200 bg-white text-slate-800 font-mono">
</div>
<div>
<label class="block text-[10px] font-bold text-slate-500 mb-1">Masa Berlaku SIMPER <span class="text-rose-500">*</span></label>
<input type="date"
name="simper_assignments[{{ $st->id }}][expired_at]"
id="addSimperExp_{{ $st->id }}"
onchange="syncAddPrimarySimperDate()"
class="w-full text-xs px-2.5 py-1.5 rounded-lg border border-slate-200 bg-white text-slate-800">
</div>
</div>
</div>
@endforeach
</div>
@else
<div>
<input type="date" name="simper_expired_at" id="addSimperDateLegacy"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] transition">
</div>
@endif
</div>
</div>
@@ -667,11 +732,61 @@
<option value="0">TIDAK (Bukan Driver)</option>
</select>
</div>
<div>
<label class="block text-sm font-bold text-slate-800 mb-2">Masa Berlaku SIMPER</label>
<input type="date" name="simper_expired_at" id="editSimperDate"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
<p class="text-[11px] text-slate-400 mt-1">Kosongkan jika bukan driver atau belum memiliki SIMPER.</p>
<div id="editSimperWrapper" class="space-y-2">
<div class="flex items-center justify-between">
<label class="block text-sm font-bold text-slate-800">
Izin SIMPER yang Dimiliki <span class="text-rose-500">*</span>
</label>
<span class="text-[11px] text-slate-400">Pilih izin & perbarui masa berlakunya</span>
</div>
<input type="hidden" name="simper_expired_at" id="editSimperDate">
@if(isset($availableSimperTypes) && count($availableSimperTypes) > 0)
<div class="space-y-2.5 max-h-56 overflow-y-auto pr-1">
@foreach($availableSimperTypes as $st)
<div class="p-3 rounded-2xl border border-slate-200 bg-slate-50/70 hover:bg-slate-50 transition">
<div class="flex items-center justify-between">
<label class="flex items-center space-x-2.5 text-xs font-bold text-slate-800 cursor-pointer">
<input type="checkbox"
name="simper_assignments[{{ $st->id }}][enabled]"
value="1"
id="editSimperCheck_{{ $st->id }}"
onchange="toggleEditSimperFields({{ $st->id }})"
class="w-4 h-4 rounded text-emerald-700 border-slate-300 focus:ring-emerald-500">
<span>{{ $st->name }} ({{ $st->code }})</span>
</label>
<span class="text-[10px] font-mono px-2 py-0.5 rounded bg-slate-200 text-slate-700 font-bold uppercase">
{{ str_replace('_', ' ', $st->category_scope) }}
</span>
</div>
<div id="editSimperFields_{{ $st->id }}" class="hidden grid grid-cols-1 sm:grid-cols-2 gap-2 mt-2 pt-2 border-t border-slate-200/60">
<div>
<label class="block text-[10px] font-bold text-slate-500 mb-1">Nomor Registrasi SIMPER</label>
<input type="text"
name="simper_assignments[{{ $st->id }}][simper_number]"
id="editSimperNum_{{ $st->id }}"
placeholder="No. SIMPER"
class="w-full text-xs px-2.5 py-1.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-mono font-bold">
</div>
<div>
<label class="block text-[10px] font-bold text-slate-500 mb-1">Masa Berlaku SIMPER</label>
<input type="date"
name="simper_assignments[{{ $st->id }}][expired_at]"
id="editSimperExp_{{ $st->id }}"
onchange="syncEditPrimarySimperDate()"
class="w-full text-xs px-2.5 py-1.5 rounded-xl border border-slate-200 bg-white text-slate-800 font-semibold">
</div>
</div>
</div>
@endforeach
</div>
@else
<div>
<input type="date" name="simper_expired_at" id="editSimperDateLegacy"
class="w-full text-sm px-4 py-3 rounded-2xl border border-slate-200 bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] focus:ring-2 focus:ring-[#1b5e20]/10 transition">
</div>
@endif
</div>
<!-- Footer Tombol -->
@@ -821,6 +936,10 @@
if (type === 'edit') {
opSelect = document.getElementById('editOperator');
dateInput = document.getElementById('editSimperDate');
const wrapper = document.getElementById('editSimperWrapper');
if (wrapper) {
wrapper.style.display = opSelect.value === '0' ? 'none' : 'block';
}
} else if (type === 'renew') {
opSelect = document.getElementById('renewOperator');
dateInput = document.getElementById('renewDate');
@@ -843,6 +962,70 @@
}
}
// Toggle Field Multi-SIMPER Tambah
function toggleAddSimperFields(id) {
const check = document.getElementById(`addSimperCheck_${id}`);
const fields = document.getElementById(`addSimperFields_${id}`);
if (check && fields) {
if (check.checked) {
fields.classList.remove('hidden');
} else {
fields.classList.add('hidden');
const expInp = document.getElementById(`addSimperExp_${id}`);
if (expInp) expInp.value = '';
}
}
syncAddPrimarySimperDate();
}
function syncAddPrimarySimperDate() {
let maxDate = '';
const expInputs = document.querySelectorAll('[id^="addSimperExp_"]');
expInputs.forEach(inp => {
const id = inp.id.replace('addSimperExp_', '');
const check = document.getElementById(`addSimperCheck_${id}`);
if (check && check.checked && inp.value) {
if (!maxDate || inp.value > maxDate) {
maxDate = inp.value;
}
}
});
const primaryInp = document.getElementById('addSimperDateInput');
if (primaryInp) primaryInp.value = maxDate;
}
// Toggle Field Multi-SIMPER Edit
function toggleEditSimperFields(id) {
const check = document.getElementById(`editSimperCheck_${id}`);
const fields = document.getElementById(`editSimperFields_${id}`);
if (check && fields) {
if (check.checked) {
fields.classList.remove('hidden');
} else {
fields.classList.add('hidden');
const expInp = document.getElementById(`editSimperExp_${id}`);
if (expInp) expInp.value = '';
}
}
syncEditPrimarySimperDate();
}
function syncEditPrimarySimperDate() {
let maxDate = '';
const expInputs = document.querySelectorAll('[id^="editSimperExp_"]');
expInputs.forEach(inp => {
const id = inp.id.replace('editSimperExp_', '');
const check = document.getElementById(`editSimperCheck_${id}`);
if (check && check.checked && inp.value) {
if (!maxDate || inp.value > maxDate) {
maxDate = inp.value;
}
}
});
const primaryInp = document.getElementById('editSimperDate');
if (primaryInp) primaryInp.value = maxDate;
}
function previewEmployeeImage(input, imgId, placeholderId) {
if (input.files && input.files[0]) {
const reader = new FileReader();
@@ -891,6 +1074,45 @@
expDate = emp.simper_expired_at.substring(0, 10);
}
document.getElementById('editSimperDate').value = expDate;
// Reset semua checklist SIMPER di editModal
document.querySelectorAll('[id^="editSimperCheck_"]').forEach(cb => {
cb.checked = false;
const id = cb.id.replace('editSimperCheck_', '');
const fields = document.getElementById(`editSimperFields_${id}`);
if (fields) fields.classList.add('hidden');
const num = document.getElementById(`editSimperNum_${id}`);
if (num) num.value = '';
const exp = document.getElementById(`editSimperExp_${id}`);
if (exp) exp.value = '';
});
// Isi checklist SIMPER dari data emp.simpers
if (emp.simpers && emp.simpers.length > 0) {
emp.simpers.forEach(s => {
const cb = document.getElementById(`editSimperCheck_${s.simper_type_id}`);
const fields = document.getElementById(`editSimperFields_${s.simper_type_id}`);
const num = document.getElementById(`editSimperNum_${s.simper_type_id}`);
const exp = document.getElementById(`editSimperExp_${s.simper_type_id}`);
if (cb) {
cb.checked = true;
if (fields) fields.classList.remove('hidden');
if (num) num.value = s.simper_number || '';
if (exp && s.expired_at) exp.value = s.expired_at.substring(0, 10);
}
});
} else if (emp.is_operator && expDate) {
const firstCb = document.querySelector('[id^="editSimperCheck_"]');
if (firstCb) {
firstCb.checked = true;
const id = firstCb.id.replace('editSimperCheck_', '');
const fields = document.getElementById(`editSimperFields_${id}`);
if (fields) fields.classList.remove('hidden');
const exp = document.getElementById(`editSimperExp_${id}`);
if (exp) exp.value = expDate;
}
}
syncEditPrimarySimperDate();
// Set jenis personil
const editTypeSelect = document.getElementById('editEmployeeType');
@@ -1074,6 +1296,18 @@
addTypeSelect.value = 'Karyawan';
toggleCustomEmployeeType('Karyawan', 'add');
}
document.querySelectorAll('[id^="addSimperCheck_"]').forEach(cb => {
cb.checked = false;
const id = cb.id.replace('addSimperCheck_', '');
const fields = document.getElementById(`addSimperFields_${id}`);
if (fields) fields.classList.add('hidden');
const num = document.getElementById(`addSimperNum_${id}`);
if (num) num.value = '';
const exp = document.getElementById(`addSimperExp_${id}`);
if (exp) exp.value = '';
});
const addSimperDateInp = document.getElementById('addSimperDateInput');
if (addSimperDateInp) addSimperDateInp.value = '';
if (modal) modal.classList.remove('hidden');
}
function closeAddKaryawanModal() {
@@ -1089,6 +1323,14 @@
} else {
wrapper.style.display = 'none';
if (input) input.value = '';
document.querySelectorAll('[id^="addSimperCheck_"]').forEach(cb => {
cb.checked = false;
const id = cb.id.replace('addSimperCheck_', '');
const fields = document.getElementById(`addSimperFields_${id}`);
if (fields) fields.classList.add('hidden');
const exp = document.getElementById(`addSimperExp_${id}`);
if (exp) exp.value = '';
});
}
}
}
@@ -0,0 +1,496 @@
@extends('layouts.app')
@section('title', 'Master Jenis SIMPER - Admin HSE | PT Kerinci Merangin Hidro')
@section('content')
<div class="w-full space-y-6">
<!-- Header Judul & Tombol Aksi -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<div class="flex items-center space-x-1.5 mb-1">
<span class="text-xs font-bold uppercase tracking-wider text-[#1b5e20]">
MANAJEMEN HSE
</span>
<button type="button"
onclick="openSimperTypeGuideModal()"
class="w-3.5 h-3.5 rounded-full bg-slate-200/90 hover:bg-slate-300 text-slate-500 hover:text-slate-800 text-[8px] inline-flex items-center justify-center font-bold transition shadow-2xs cursor-pointer focus:outline-none"
title="Panduan Jenis SIMPER">
<i class="fa-solid fa-info"></i>
</button>
</div>
<h2 class="text-3xl sm:text-4xl font-extrabold text-slate-900 tracking-tight">
Jenis SIMPER
</h2>
<p class="text-xs text-slate-500 mt-1">
Kelola kategori izin mengemudi (SIMPER) dan cakupan kendaraan yang diizinkan untuk personil.
</p>
</div>
<div class="flex items-center gap-2.5 sm:gap-3 w-full sm:w-auto">
<a href="{{ route('hse.employees.index') }}"
class="w-full sm:w-auto border border-slate-200 bg-white hover:bg-slate-50 text-slate-700 px-3.5 py-2.5 rounded-xl text-xs font-bold flex items-center justify-center space-x-2 transition shadow-xs">
<i class="fa-solid fa-arrow-left text-slate-400"></i>
<span>Kembali ke Data Personil</span>
</a>
@can('hse.employees.edit')
<button type="button"
onclick="openAddSimperTypeModal()"
class="w-full sm:w-auto bg-[#1b5e20] hover:bg-[#144919] text-white px-4 py-2.5 rounded-xl text-xs font-bold flex items-center justify-center space-x-2 transition shadow-sm cursor-pointer">
<i class="fa-solid fa-plus text-xs"></i>
<span>Tambah Jenis SIMPER</span>
</button>
@endcan
</div>
</div>
<!-- Alert Notifikasi -->
@if(session('success'))
<div class="p-3.5 rounded-2xl bg-emerald-50 border border-emerald-200 text-emerald-800 text-xs font-semibold flex items-center justify-between shadow-2xs">
<div class="flex items-center space-x-2.5">
<i class="fa-solid fa-circle-check text-emerald-600 text-base"></i>
<span>{{ session('success') }}</span>
</div>
<button type="button" onclick="this.parentElement.remove()" class="text-emerald-500 hover:text-emerald-800 p-1">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</div>
@endif
@if(session('error'))
<div class="p-3.5 rounded-2xl bg-rose-50 border border-rose-200 text-rose-800 text-xs font-semibold flex items-center justify-between shadow-2xs">
<div class="flex items-center space-x-2.5">
<i class="fa-solid fa-triangle-exclamation text-rose-600 text-base"></i>
<span>{{ session('error') }}</span>
</div>
<button type="button" onclick="this.parentElement.remove()" class="text-rose-500 hover:text-rose-800 p-1">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</div>
@endif
@if($errors->any())
<div class="p-3.5 rounded-2xl bg-rose-50 border border-rose-200 text-rose-800 text-xs font-semibold flex items-center justify-between shadow-2xs">
<div class="flex items-center space-x-2.5">
<i class="fa-solid fa-circle-exclamation text-rose-600 text-base"></i>
<span>{{ $errors->first() }}</span>
</div>
<button type="button" onclick="this.parentElement.remove()" class="text-rose-500 hover:text-rose-800 p-1">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</div>
@endif
<!-- Kartu KPI Ringkasan -->
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
<div class="bg-white rounded-2xl border border-slate-200 p-4 shadow-xs flex items-center space-x-3.5">
<div class="w-11 h-11 rounded-xl bg-emerald-50 text-[#1b5e20] flex items-center justify-center text-lg flex-shrink-0">
<i class="fa-solid fa-id-card"></i>
</div>
<div>
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider">Total Kategori</p>
<p class="text-xl font-extrabold text-slate-900 mt-0.5">{{ count($simperTypes) }} Jenis</p>
</div>
</div>
<div class="bg-white rounded-2xl border border-slate-200 p-4 shadow-xs flex items-center space-x-3.5">
<div class="w-11 h-11 rounded-xl bg-blue-50 text-blue-700 flex items-center justify-center text-lg flex-shrink-0">
<i class="fa-solid fa-users-gear"></i>
</div>
<div>
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider">Pemegang Aktif</p>
<p class="text-xl font-extrabold text-slate-900 mt-0.5">
{{ $simperTypes->sum('active_holders_count') }} Personil
</p>
</div>
</div>
<div class="bg-white rounded-2xl border border-slate-200 p-4 shadow-xs flex items-center space-x-3.5">
<div class="w-11 h-11 rounded-xl bg-amber-50 text-amber-700 flex items-center justify-center text-lg flex-shrink-0">
<i class="fa-solid fa-shield-halved"></i>
</div>
<div>
<p class="text-[11px] font-bold text-slate-400 uppercase tracking-wider">Status Fleksibilitas</p>
<p class="text-sm font-extrabold text-slate-800 mt-0.5">Siap Dikustomisasi HSE</p>
</div>
</div>
</div>
<!-- Tabel Data Master Jenis SIMPER -->
<div class="bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<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 whitespace-nowrap">KODE</th>
<th class="py-3.5 px-4 whitespace-nowrap min-w-[200px]">NAMA JENIS SIMPER</th>
<th class="py-3.5 px-4 whitespace-nowrap">CAKUPAN KENDARAAN</th>
<th class="py-3.5 px-4 text-center whitespace-nowrap">PEMEGANG AKTIF</th>
<th class="py-3.5 px-4 text-center whitespace-nowrap">STATUS</th>
<th class="py-3.5 px-4 whitespace-nowrap min-w-[220px]">KETERANGAN</th>
<th class="py-3.5 px-4 text-center whitespace-nowrap w-24">AKSI</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 text-slate-700 bg-white font-medium">
@forelse($simperTypes as $idx => $st)
<tr class="hover:bg-slate-50/80 transition">
<td class="py-3 px-4 text-center text-slate-400 font-mono">{{ $idx + 1 }}</td>
<td class="py-3 px-4">
<span class="font-mono font-extrabold text-xs text-emerald-800 bg-emerald-50 px-2 py-0.5 rounded border border-emerald-200">
{{ $st->code }}
</span>
</td>
<td class="py-3 px-4">
<span class="font-bold text-slate-900 text-xs">{{ $st->name }}</span>
</td>
<td class="py-3 px-4">
@if($st->category_scope === 'light_vehicle')
<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold bg-blue-50 text-blue-700 border border-blue-200">
<i class="fa-solid fa-car-side mr-1"></i> Light Vehicle (LV)
</span>
@elseif($st->category_scope === 'unit_support_mobile')
<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200">
<i class="fa-solid fa-truck-moving mr-1"></i> Heavy Mobile / Dump Truck
</span>
@elseif($st->category_scope === 'unit_support_heavy')
<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
<i class="fa-solid fa-trowel-bricks mr-1"></i> Alat Berat Operasional
</span>
@else
<span class="inline-flex items-center px-2 py-0.5 rounded text-[10px] font-bold bg-purple-50 text-purple-700 border border-purple-200">
<i class="fa-solid fa-shapes mr-1"></i> Semua Kategori
</span>
@endif
</td>
<td class="py-3 px-4 text-center font-bold">
<span class="font-mono text-slate-800 bg-slate-100 px-2 py-0.5 rounded">
{{ $st->active_holders_count }} Personil
</span>
</td>
<td class="py-3 px-4 text-center">
@if($st->is_active)
<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">
Aktif
</span>
@else
<span class="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-slate-100 text-slate-500 border border-slate-200">
Nonaktif
</span>
@endif
</td>
<td class="py-3 px-4 text-slate-500 text-[11px] line-clamp-2">
{{ $st->description ?: '-' }}
</td>
<td class="py-3 px-4 text-center whitespace-nowrap">
<div class="flex items-center justify-center space-x-1">
@can('hse.employees.edit')
<button type="button"
onclick="openEditSimperTypeModal({{ json_encode($st) }})"
class="p-1.5 rounded-lg text-amber-600 hover:text-amber-800 hover:bg-amber-50 transition cursor-pointer"
title="Edit Jenis SIMPER">
<i class="fa-regular fa-pen-to-square text-xs"></i>
</button>
@if($st->total_holders_count == 0)
<button type="button"
onclick="openDeleteSimperTypeModal({{ $st->id }}, '{{ $st->name }}')"
class="p-1.5 rounded-lg text-rose-600 hover:text-rose-800 hover:bg-rose-50 transition cursor-pointer"
title="Hapus Jenis SIMPER">
<i class="fa-regular fa-trash-can text-xs"></i>
</button>
@endif
@endcan
</div>
</td>
</tr>
@empty
<tr>
<td colspan="8" class="py-12 text-center text-slate-400">
<i class="fa-solid fa-id-card text-3xl mb-2 block text-slate-300"></i>
<p class="text-sm font-semibold text-slate-700">Belum ada data jenis SIMPER</p>
<p class="text-xs text-slate-400 mt-1">Klik tombol "+ Tambah Jenis SIMPER" untuk membuat kategori baru.</p>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<!-- ========================================================================= -->
<!-- MODAL: TAMBAH JENIS SIMPER -->
<!-- ========================================================================= -->
<div id="addSimperTypeModal" onclick="if(event.target === this) closeAddSimperTypeModal()" class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
<div class="bg-white rounded-3xl shadow-2xl max-w-lg w-full p-6 sm:p-7 border border-slate-100 overflow-hidden animate-scale-in">
<div class="flex items-center justify-between pb-4 border-b border-slate-100">
<div>
<h3 class="text-lg font-bold text-slate-900 tracking-tight flex items-center gap-2">
<i class="fa-solid fa-id-card text-emerald-700"></i>
<span>Tambah Jenis SIMPER</span>
</h3>
<p class="text-xs text-slate-500 mt-0.5">Definisikan kategori izin mengemudi dan cakupan unitnya.</p>
</div>
<button type="button" onclick="closeAddSimperTypeModal()" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<form action="{{ route('hse.simper_types.store') }}" method="POST" class="mt-4 space-y-4">
@csrf
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kode SIMPER <span class="text-rose-500">*</span></label>
<input type="text" name="code" required placeholder="Contoh: SIMPER-CRANE"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-[#1b5e20] transition uppercase">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Cakupan Kendaraan <span class="text-rose-500">*</span></label>
<select name="category_scope" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] transition">
@foreach($categoryScopes as $scopeKey => $scopeLabel)
<option value="{{ $scopeKey }}">{{ $scopeLabel }}</option>
@endforeach
</select>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Nama Jenis SIMPER <span class="text-rose-500">*</span></label>
<input type="text" name="name" required placeholder="Contoh: SIMPER Mobile Crane & Rigging"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 font-bold focus:outline-none focus:border-[#1b5e20] transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Keterangan / Persyaratan K3 <span class="text-slate-400 font-normal">(Opsional)</span></label>
<textarea name="description" rows="2" placeholder="Catatan kualifikasi SIO, sertifikasi Kemnaker, atau jenis unit spesifik..."
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] transition resize-none"></textarea>
</div>
<div class="flex items-center space-x-2 pt-1">
<input type="checkbox" name="is_active" id="addSimperActive" value="1" checked
class="w-4 h-4 rounded text-emerald-700 border-slate-300 focus:ring-emerald-500">
<label for="addSimperActive" class="text-xs font-bold text-slate-700 cursor-pointer">
Aktifkan jenis SIMPER ini untuk penugasan ke personil
</label>
</div>
<div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5">
<button type="button" onclick="closeAddSimperTypeModal()" class="px-4 py-2.5 rounded-xl border border-slate-200 bg-slate-100 hover:bg-slate-200 text-slate-600 font-bold text-xs transition">
Batal
</button>
<button type="submit" class="px-5 py-2.5 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white font-bold text-xs transition shadow-sm">
Simpan Jenis SIMPER
</button>
</div>
</form>
</div>
</div>
<!-- ========================================================================= -->
<!-- MODAL: EDIT JENIS SIMPER -->
<!-- ========================================================================= -->
<div id="editSimperTypeModal" onclick="if(event.target === this) closeEditSimperTypeModal()" class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
<div class="bg-white rounded-3xl shadow-2xl max-w-lg w-full p-6 sm:p-7 border border-slate-100 overflow-hidden animate-scale-in">
<div class="flex items-center justify-between pb-4 border-b border-slate-100">
<div>
<h3 class="text-lg font-bold text-slate-900 tracking-tight flex items-center gap-2">
<i class="fa-solid fa-pen-to-square text-amber-600"></i>
<span>Edit Jenis SIMPER</span>
</h3>
<p class="text-xs text-slate-500 mt-0.5">Perbarui informasi dan cakupan kendaraan izin SIMPER.</p>
</div>
<button type="button" onclick="closeEditSimperTypeModal()" class="text-slate-400 hover:text-slate-600 transition p-1">
<i class="fa-solid fa-xmark text-lg"></i>
</button>
</div>
<form id="editSimperTypeForm" action="" method="POST" class="mt-4 space-y-4">
@csrf
@method('PUT')
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Kode SIMPER <span class="text-rose-500">*</span></label>
<input type="text" name="code" id="editSimperCode" required
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 font-mono font-bold focus:outline-none focus:border-[#1b5e20] transition uppercase">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Cakupan Kendaraan <span class="text-rose-500">*</span></label>
<select name="category_scope" id="editSimperScope" required class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 font-semibold focus:outline-none focus:border-[#1b5e20] transition">
@foreach($categoryScopes as $scopeKey => $scopeLabel)
<option value="{{ $scopeKey }}">{{ $scopeLabel }}</option>
@endforeach
</select>
</div>
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Nama Jenis SIMPER <span class="text-rose-500">*</span></label>
<input type="text" name="name" id="editSimperName" required
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 font-bold focus:outline-none focus:border-[#1b5e20] transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-800 mb-1.5">Keterangan / Persyaratan K3 <span class="text-slate-400 font-normal">(Opsional)</span></label>
<textarea name="description" id="editSimperDescription" rows="2"
class="w-full text-xs px-3.5 py-2.5 rounded-xl border border-slate-200 bg-slate-50 focus:bg-white text-slate-800 focus:outline-none focus:border-[#1b5e20] transition resize-none"></textarea>
</div>
<div class="flex items-center space-x-2 pt-1">
<input type="checkbox" name="is_active" id="editSimperActive" value="1"
class="w-4 h-4 rounded text-emerald-700 border-slate-300 focus:ring-emerald-500">
<label for="editSimperActive" class="text-xs font-bold text-slate-700 cursor-pointer">
Aktifkan jenis SIMPER ini
</label>
</div>
<div class="pt-4 border-t border-slate-100 flex items-center justify-end gap-2.5">
<button type="button" onclick="closeEditSimperTypeModal()" class="px-4 py-2.5 rounded-xl border border-slate-200 bg-slate-100 hover:bg-slate-200 text-slate-600 font-bold text-xs transition">
Batal
</button>
<button type="submit" class="px-5 py-2.5 rounded-xl bg-amber-600 hover:bg-amber-700 text-white font-bold text-xs transition shadow-sm">
Simpan Perubahan
</button>
</div>
</form>
</div>
</div>
<!-- ========================================================================= -->
<!-- MODAL: HAPUS JENIS SIMPER -->
<!-- ========================================================================= -->
<div id="deleteSimperTypeModal" onclick="if(event.target === this) closeDeleteSimperTypeModal()" class="hidden fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-sm flex items-center justify-center p-4">
<div class="bg-white rounded-3xl shadow-2xl max-w-sm w-full p-6 border border-slate-100 text-center animate-scale-in">
<div class="w-12 h-12 rounded-full bg-rose-100 text-rose-600 flex items-center justify-center text-xl mx-auto mb-3">
<i class="fa-solid fa-triangle-exclamation"></i>
</div>
<h3 class="text-sm font-bold text-slate-900 mb-1">Hapus Jenis SIMPER?</h3>
<p class="text-xs text-slate-500 mb-4">
Apakah Anda yakin ingin menghapus jenis SIMPER <strong id="deleteSimperTypeName" class="text-slate-800"></strong>?
</p>
<form id="deleteSimperTypeForm" action="" method="POST" class="flex items-center justify-center gap-2">
@csrf
@method('DELETE')
<button type="button" onclick="closeDeleteSimperTypeModal()" class="px-4 py-2 rounded-xl text-xs font-bold text-slate-600 hover:bg-slate-100 transition">
Batal
</button>
<button type="submit" class="bg-rose-600 hover:bg-rose-700 text-white px-5 py-2 rounded-xl text-xs font-bold transition shadow-xs">
Ya, Hapus
</button>
</form>
</div>
</div>
<!-- ========================================================================= -->
<!-- MODAL: PANDUAN HALAMAN MASTER SIMPER -->
<!-- ========================================================================= -->
<div id="simperTypeGuideModal" onclick="if(event.target === this) closeSimperTypeGuideModal()" class="hidden fixed inset-0 z-50 bg-slate-900/60 backdrop-blur-sm flex items-center justify-center p-4 overflow-y-auto">
<div class="bg-white rounded-3xl shadow-2xl max-w-lg w-full p-6 sm:p-7 border border-slate-100">
<div class="flex items-center justify-between pb-4 border-b border-slate-100">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 rounded-2xl bg-emerald-50 text-[#1b5e20] flex items-center justify-center text-lg shadow-2xs">
<i class="fa-solid fa-book-open"></i>
</div>
<div>
<h3 class="text-base font-extrabold text-slate-900 tracking-tight">Panduan Master SIMPER</h3>
<p class="text-xs text-slate-500 font-medium">Pengelolaan izin mengemudi & pengoperasian unit proyek</p>
</div>
</div>
<button type="button" onclick="closeSimperTypeGuideModal()" class="w-8 h-8 rounded-full bg-slate-100 hover:bg-slate-200 text-slate-400 hover:text-slate-600 flex items-center justify-center transition">
<i class="fa-solid fa-xmark text-sm"></i>
</button>
</div>
<div class="py-5 space-y-3.5 text-xs text-slate-600 leading-relaxed max-h-[60vh] overflow-y-auto pr-1">
<div class="p-3.5 rounded-2xl bg-emerald-50/60 border border-emerald-100/80">
<h4 class="font-bold text-[#1b5e20] text-xs flex items-center mb-1">
<i class="fa-solid fa-car-side mr-1.5"></i> 1. SIMPER Light Vehicle (LV)
</h4>
<p class="text-slate-600">
Diperuntukkan bagi driver armada ringan (Hilux, Triton, Avanza, dsb.) yang melintasi gerbang proyek untuk mobilisasi harian.
</p>
</div>
<div class="p-3.5 rounded-2xl bg-amber-50/60 border border-amber-100/80">
<h4 class="font-bold text-amber-800 text-xs flex items-center mb-1">
<i class="fa-solid fa-truck-moving mr-1.5"></i> 2. SIMPER Dump Truck / Heavy Mobile
</h4>
<p class="text-slate-600">
Diperuntukkan bagi operator/driver armada berat yang bergerak aktif di jalan proyek melintasi pos gerbang (Dump Truck, Mixer, Fuel Truck, Water Truck, Manhaul, dsb.).
</p>
</div>
<div class="p-3.5 rounded-2xl bg-slate-50 border border-slate-100">
<h4 class="font-bold text-slate-800 text-xs flex items-center mb-1">
<i class="fa-solid fa-trowel-bricks mr-1.5 text-emerald-700"></i> 3. SIMPER Alat Berat Operasional
</h4>
<p class="text-slate-600">
Diperuntukkan bagi operator alat berat galian, tambang, atau lifting (Excavator, Bulldozer, Wheel Loader, Crane) yang jam kerjanya dicatat terpusat di modul QMA.
</p>
</div>
</div>
<div class="pt-4 border-t border-slate-100 flex justify-end">
<button type="button" onclick="closeSimperTypeGuideModal()" class="px-5 py-2.5 rounded-xl bg-[#1b5e20] hover:bg-[#144919] text-white text-xs font-bold transition shadow-sm">
Saya Mengerti
</button>
</div>
</div>
</div>
@endsection
@section('scripts')
<script>
function openAddSimperTypeModal() {
const modal = document.getElementById('addSimperTypeModal');
if (modal) modal.classList.remove('hidden');
}
function closeAddSimperTypeModal() {
const modal = document.getElementById('addSimperTypeModal');
if (modal) modal.classList.add('hidden');
}
function openEditSimperTypeModal(st) {
document.getElementById('editSimperCode').value = st.code || '';
document.getElementById('editSimperName').value = st.name || '';
document.getElementById('editSimperScope').value = st.category_scope || 'all';
document.getElementById('editSimperDescription').value = st.description || '';
document.getElementById('editSimperActive').checked = Boolean(st.is_active);
const form = document.getElementById('editSimperTypeForm');
form.action = `/hse/simper-types/${st.id}`;
const modal = document.getElementById('editSimperTypeModal');
if (modal) modal.classList.remove('hidden');
}
function closeEditSimperTypeModal() {
const modal = document.getElementById('editSimperTypeModal');
if (modal) modal.classList.add('hidden');
}
function openDeleteSimperTypeModal(id, name) {
document.getElementById('deleteSimperTypeName').textContent = name;
const form = document.getElementById('deleteSimperTypeForm');
form.action = `/hse/simper-types/${id}`;
const modal = document.getElementById('deleteSimperTypeModal');
if (modal) modal.classList.remove('hidden');
}
function closeDeleteSimperTypeModal() {
const modal = document.getElementById('deleteSimperTypeModal');
if (modal) modal.classList.add('hidden');
}
function openSimperTypeGuideModal() {
const modal = document.getElementById('simperTypeGuideModal');
if (modal) modal.classList.remove('hidden');
}
function closeSimperTypeGuideModal() {
const modal = document.getElementById('simperTypeGuideModal');
if (modal) modal.classList.add('hidden');
}
</script>
@endsection
+11
View File
@@ -264,6 +264,11 @@
<i class="fa-solid fa-id-card text-base w-5 text-center"></i>
<span>Data Simper</span>
</a>
<a href="{{ route('hse.simper_types.index') }}"
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('hse.simper_types.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-sliders text-base w-5 text-center"></i>
<span>Jenis SIMPER</span>
</a>
</nav>
</div>
@endcan
@@ -636,6 +641,10 @@
<i class="fa-solid fa-id-card w-5 text-center"></i>
<span>Data Simper</span>
</a>
<a href="{{ route('hse.simper_types.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('hse.simper_types.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
<i class="fa-solid fa-sliders w-5 text-center"></i>
<span>Jenis SIMPER</span>
</a>
</nav>
</div>
@endcan
@@ -902,6 +911,8 @@
Dashboard
@elseif(request()->routeIs('hse.employees.*'))
Data Simper
@elseif(request()->routeIs('hse.simper_types.*'))
Jenis SIMPER
@elseif(request()->routeIs('qma.vehicles.lv'))
Light Vehicle
@elseif(request()->routeIs('qma.vehicles.support.units*'))
+37 -8
View File
@@ -9,10 +9,10 @@
<div class="min-w-0">
<div class="flex items-center flex-wrap gap-2.5">
<h1 class="text-lg sm:text-xl font-black text-slate-900 tracking-tight">
Timesheet Kendaraan Ringan
Timesheet Kendaraan Ringan & Armada Mobile
</h1>
<span class="px-2.5 py-1 rounded-lg text-xs font-black bg-emerald-50 text-emerald-800 border border-emerald-200">
Kendaraan Ringan (LV)
Kendaraan Ringan (LV) & Heavy Mobile
</span>
</div>
<div class="text-sm sm:text-base text-slate-600 font-medium truncate mt-1 flex items-center flex-wrap gap-1.5">
@@ -33,8 +33,25 @@
</div>
</div>
<!-- Segmented Filter Tab: Semua Armada / LV / Heavy Mobile -->
<div class="flex items-center space-x-1 sm:space-x-2 border-b border-slate-200/80 overflow-x-auto pb-px">
<a href="{{ route('mobilisasi.index', array_filter(['search' => request('search'), 'type' => 'all'])) }}"
class="px-4 py-2 text-xs font-bold rounded-t-xl transition whitespace-nowrap {{ ($type ?? 'all') === 'all' ? 'bg-[#1b5e20] text-white shadow-xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i class="fa-solid fa-layer-group mr-1.5"></i>Semua Armada
</a>
<a href="{{ route('mobilisasi.index', array_filter(['search' => request('search'), 'type' => 'light_vehicle'])) }}"
class="px-4 py-2 text-xs font-bold rounded-t-xl transition whitespace-nowrap {{ ($type ?? '') === 'light_vehicle' ? 'bg-[#1b5e20] text-white shadow-xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i class="fa-solid fa-car-side mr-1.5"></i>Light Vehicle (LV)
</a>
<a href="{{ route('mobilisasi.index', array_filter(['search' => request('search'), 'type' => 'unit_support'])) }}"
class="px-4 py-2 text-xs font-bold rounded-t-xl transition whitespace-nowrap {{ ($type ?? '') === 'unit_support' ? 'bg-[#1b5e20] text-white shadow-xs' : 'text-slate-600 hover:text-slate-900 hover:bg-slate-100' }}">
<i class="fa-solid fa-truck-moving mr-1.5"></i>Heavy Equipment Mobile
</a>
</div>
<!-- Filter & Search Bar (Tanpa Card Wrapper, Format Referensi Sesuai Standar) -->
<form method="GET" action="{{ route('mobilisasi.index') }}" id="lvFilterForm" class="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2.5 sm:gap-3">
<input type="hidden" name="type" value="{{ $type ?? 'all' }}">
<!-- Pencarian Cepat di Kiri -->
<div class="relative w-full sm:max-w-md">
<span class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
@@ -68,9 +85,15 @@
<div>
<!-- Badge Kategori & Status -->
<div class="flex items-center justify-between mb-3">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-200">
Kendaraan Ringan (LV)
</span>
@if($v->isLightVehicle())
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-200">
<i class="fa-solid fa-car-side mr-1 text-emerald-600"></i> LV
</span>
@else
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-[11px] font-bold bg-amber-50 text-amber-800 border border-amber-200">
<i class="fa-solid fa-truck-moving mr-1 text-amber-600"></i> Heavy Mobile
</span>
@endif
@php
$statusBadge = match($v->status) {
@@ -122,9 +145,15 @@
<span>Unit Sedang Breakdown</span>
</div>
@else
<a href="{{ route('vehicle.activity.form', ['code' => $v->code]) }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-4 rounded-xl shadow-sm transition text-center block text-xs">
Isi Form Mobilisasi LV
</a>
@if($v->isLightVehicle())
<a href="{{ route('vehicle.activity.form', ['code' => $v->code]) }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-4 rounded-xl shadow-sm transition text-center block text-xs">
Isi Form Mobilisasi LV
</a>
@else
<a href="{{ route('vehicle.activity.form', ['code' => $v->code]) }}" class="w-full bg-[#1b5e20] hover:bg-[#144918] active:scale-[0.99] text-white font-bold py-2.5 px-4 rounded-xl shadow-sm transition text-center block text-xs">
Isi Form Mobilisasi Unit
</a>
@endif
@endif
</div>
</div>
@@ -348,8 +348,15 @@
</div>
@endif
<div class="min-w-0">
<div class="font-bold text-slate-900 truncate">
{{ $item->driver->name }}
<div class="font-bold text-slate-900 truncate flex items-center gap-1.5 flex-wrap">
<span>{{ $item->driver->name }}</span>
@if($item->driver->simpers && $item->driver->simpers->isNotEmpty())
@foreach($item->driver->simpers->take(2) as $s)
<span class="inline-flex items-center px-1.5 py-0.2 rounded text-[9px] font-mono font-bold bg-emerald-50 text-emerald-700 border border-emerald-200">
{{ $s->simperType?->code ?? 'SIMPER' }}
</span>
@endforeach
@endif
</div>
<div class="text-[11px] text-slate-500 font-mono truncate">
{{ $item->driver->nik }}
@@ -9,7 +9,7 @@
@if(auth()->check())
<a href="{{ route('mobilisasi.index') }}" class="inline-flex items-center space-x-1.5 text-xs font-bold text-slate-600 hover:text-[#1b5e20] transition bg-white px-3 py-1.5 rounded-xl border border-slate-200 shadow-sm">
<i class="fa-solid fa-arrow-left text-[11px]"></i>
<span>Kembali ke Katalog LV</span>
<span>Kembali ke Katalog Armada</span>
</a>
@else
<div></div>
@@ -20,9 +20,15 @@
<!-- Header Info Kendaraan (Readonly Card) -->
<div class="bg-gradient-to-r from-slate-800 to-slate-900 text-white p-5 rounded-2xl shadow-sm border border-slate-700">
<div class="flex items-center justify-between mb-3">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">
<i class="fa-solid fa-car mr-1.5"></i> Kendaraan Ringan (LV)
</span>
@if($vehicle->isLightVehicle())
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">
<i class="fa-solid fa-car mr-1.5"></i> Kendaraan Ringan (LV)
</span>
@else
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold bg-amber-500/20 text-amber-300 border border-amber-500/30">
<i class="fa-solid fa-truck-moving mr-1.5"></i> Heavy Equipment Mobile
</span>
@endif
<span class="text-xs text-slate-400 flex items-center">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse mr-1.5"></span>
Scan QR Code Aktif
@@ -44,7 +50,8 @@
<div><span class="text-slate-400 font-medium">Nopol:</span> <span class="font-bold text-amber-300 text-sm ml-1">{{ $vehicle->license_plate ?? '-' }}</span></div>
<div class="col-span-1 sm:col-span-2"><span class="text-slate-400 font-medium">Merk / Tipe:</span> <span class="text-white ml-1">{{ $vehicle->brand_type }}</span></div>
<div><span class="text-slate-400 font-medium">Penanggung Jawab:</span> <span class="text-slate-200 ml-1">{{ $vehicle->ownership ?? '-' }}</span></div>
<div><span class="text-slate-400 font-medium">KM Sebelumnya:</span> <span class="font-bold text-emerald-400 text-sm ml-1">{{ number_format($vehicle->current_km, 0, ',', '.') }} KM</span></div>
<div><span class="text-slate-400 font-medium">Odometer Sebelumnya:</span> <span class="font-bold text-emerald-400 text-sm ml-1">{{ number_format($vehicle->current_km, 0, ',', '.') }} KM</span></div>
<div class="col-span-1 sm:col-span-2"><span class="text-slate-400 font-medium">Wajib SIMPER:</span> <span class="font-bold text-amber-300 ml-1">{{ $vehicle->requiredSimperType ? $vehicle->requiredSimperType->name : ($vehicle->isLightVehicle() ? 'SIMPER LV' : 'SIMPER Dump Truck / Heavy Mobile') }}</span></div>
</div>
</div>
+10 -1
View File
@@ -255,7 +255,16 @@
<!-- Driver -->
<td class="py-3.5 px-4">
<div class="font-bold text-slate-900">{{ $act->driver?->name ?? '-' }}</div>
<div class="font-bold text-slate-900 flex items-center gap-1.5 flex-wrap">
<span>{{ $act->driver?->name ?? '-' }}</span>
@if($act->driver && $act->driver->simpers && $act->driver->simpers->isNotEmpty())
@foreach($act->driver->simpers->take(2) as $s)
<span class="inline-flex items-center px-1.5 py-0.2 rounded text-[9px] font-mono font-bold bg-emerald-50 text-emerald-700 border border-emerald-200" title="{{ $s->simperType?->name }}">
{{ $s->simperType?->code ?? 'SIMPER' }}
</span>
@endforeach
@endif
</div>
<div class="text-[10px] text-slate-400 font-normal">{{ $act->driver?->division ?? '-' }}</div>
</td>
@@ -165,6 +165,11 @@
<span class="bg-blue-50 text-blue-800 px-2.5 py-1 rounded-lg border border-blue-200 font-bold">
{{ $u->code }}
</span>
@if($u->is_timesheet_mobile)
<span class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-bold bg-amber-50 text-amber-700 border border-amber-200" title="Unit ini aktif di Timesheet Mobilisasi Karyawan">
<i class="fa-solid fa-route mr-1"></i>Mobile
</span>
@endif
</div>
</td>
@@ -492,7 +497,30 @@
</div>
</div>
<!-- Tombol Aksi Batal & Simpan Unit (Sesuai Desain Mockup) -->
<!-- Pengaturan Timesheet Mobilisasi & Izin SIMPER -->
<div class="p-3.5 bg-slate-50 border border-slate-200 rounded-xl space-y-3">
<div class="flex items-center space-x-2">
<input type="checkbox" name="is_timesheet_mobile" id="add_is_timesheet_mobile" value="1"
class="rounded border-slate-300 text-emerald-600 focus:ring-emerald-500 w-4 h-4 cursor-pointer"
onchange="toggleSimperReq('add')">
<label for="add_is_timesheet_mobile" class="text-xs font-bold text-slate-800 cursor-pointer">
Izinkan Unit untuk Timesheet Mobilisasi Karyawan & Gerbang Pos Satpam
</label>
</div>
<div id="add_simper_container" class="hidden">
<label class="block text-xs font-bold text-slate-700 mb-1">
Wajib Jenis SIMPER untuk Driver / Operator
</label>
<select name="required_simper_type_id" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium focus:outline-none focus:border-emerald-600">
<option value="">-- Standar (Sesuai Kategori / Default) --</option>
@foreach($simperTypes ?? [] as $st)
<option value="{{ $st->id }}">{{ $st->name }} ({{ $st->code }})</option>
@endforeach
</select>
<p class="text-[11px] text-slate-500 mt-1">Driver yang mobilisasi unit ini wajib memiliki izin SIMPER aktif yang sesuai.</p>
</div>
</div>
<div class="pt-4 flex items-center justify-end space-x-3">
<button type="button"
onclick="closeAddUnitModal()"
@@ -602,6 +630,30 @@
</div>
</div>
<!-- Pengaturan Timesheet Mobilisasi & Izin SIMPER -->
<div class="p-3.5 bg-slate-50 border border-slate-200 rounded-xl space-y-3">
<div class="flex items-center space-x-2">
<input type="checkbox" name="is_timesheet_mobile" id="edit_is_timesheet_mobile" value="1"
class="rounded border-slate-300 text-emerald-600 focus:ring-emerald-500 w-4 h-4 cursor-pointer"
onchange="toggleSimperReq('edit')">
<label for="edit_is_timesheet_mobile" class="text-xs font-bold text-slate-800 cursor-pointer">
Izinkan Unit untuk Timesheet Mobilisasi Karyawan & Gerbang Pos Satpam
</label>
</div>
<div id="edit_simper_container" class="hidden">
<label class="block text-xs font-bold text-slate-700 mb-1">
Wajib Jenis SIMPER untuk Driver / Operator
</label>
<select name="required_simper_type_id" id="edit_required_simper_type_id" class="w-full text-xs px-3.5 py-2 rounded-xl border border-slate-200 bg-white text-slate-800 font-medium focus:outline-none focus:border-emerald-600">
<option value="">-- Standar (Sesuai Kategori / Default) --</option>
@foreach($simperTypes ?? [] as $st)
<option value="{{ $st->id }}">{{ $st->name }} ({{ $st->code }})</option>
@endforeach
</select>
<p class="text-[11px] text-slate-500 mt-1">Driver yang mobilisasi unit ini wajib memiliki izin SIMPER aktif yang sesuai.</p>
</div>
</div>
<div class="pt-4 flex items-center justify-end space-x-3">
<button type="button" onclick="closeEditModal()" class="px-5 py-2.5 text-xs font-bold text-slate-700 bg-white border border-slate-300 rounded-xl hover:bg-slate-50 transition cursor-pointer">Batal</button>
<button type="submit" class="px-5 py-2.5 text-xs font-bold text-white bg-[#1b5e20] hover:bg-[#144919] rounded-xl transition shadow-sm cursor-pointer">Simpan Perubahan</button>
@@ -714,6 +766,18 @@
<script>
const categoryCode = "{{ $category->code }}";
function toggleSimperReq(prefix) {
const chk = document.getElementById(prefix + '_is_timesheet_mobile');
const container = document.getElementById(prefix + '_simper_container');
if (chk && container) {
if (chk.checked) {
container.classList.remove('hidden');
} else {
container.classList.add('hidden');
}
}
}
function previewUnitImage(input, imgId, placeholderId) {
if (input.files && input.files[0]) {
const reader = new FileReader();
@@ -747,6 +811,9 @@
if (addPhotoPlaceholder) {
addPhotoPlaceholder.classList.remove('hidden');
}
const addMobileChk = document.getElementById('add_is_timesheet_mobile');
if (addMobileChk) addMobileChk.checked = false;
toggleSimperReq('add');
document.getElementById('unitNumberInput').focus();
}
@@ -812,6 +879,16 @@
if (editPhotoPlaceholder) editPhotoPlaceholder.classList.remove('hidden');
}
const isMobileChk = document.getElementById('edit_is_timesheet_mobile');
if (isMobileChk) {
isMobileChk.checked = !!(unit.is_timesheet_mobile == 1 || unit.is_timesheet_mobile === true);
}
const simperSelect = document.getElementById('edit_required_simper_type_id');
if (simperSelect) {
simperSelect.value = unit.required_simper_type_id || '';
}
toggleSimperReq('edit');
const modal = document.getElementById('editModal');
modal.classList.remove('hidden');
modal.style.display = 'block';