feat(qma): route heavy equipment update in unit management directly to transfer form

This commit is contained in:
Ray1111-aa
2026-10-21 14:39:34 +07:00
parent 4eb713aafb
commit c510991ff0
5 changed files with 36 additions and 6 deletions
@@ -396,10 +396,19 @@
<div class="flex items-center justify-center space-x-1.5">
<!-- Tombol Update Posisi -->
@can('qma.vehicles.edit')
@if($u->isUnitSupport())
<a href="{{ route('qma.unit_transfers.create', ['vehicle_id' => $u->id]) }}"
class="inline-flex items-center space-x-1 text-emerald-700 hover:text-emerald-900 bg-emerald-50 hover:bg-emerald-100 px-2.5 py-1.5 rounded-lg transition font-bold text-[11px] cursor-pointer"
title="Transfer Pemindahan Alat Berat">
<i class="fa-solid fa-truck-moving text-xs"></i>
<span>Update</span>
</a>
@else
<button type="button"
data-unit="{{ json_encode([
'id' => $u->id,
'code' => $u->code,
'category' => $u->category,
'brand_type' => $u->brand_type,
'license_plate' => $u->license_plate,
'serial_number' => $u->serial_number,
@@ -414,6 +423,7 @@
<i class="fa-solid fa-location-pen text-xs"></i>
<span>Update</span>
</button>
@endif
@endcan
<!-- Tombol Riwayat Posisi -->
@@ -889,6 +899,11 @@
}
function openUpdateLocationModal(unit) {
if (unit.category === 'unit_support') {
window.location.href = `/qma/unit-transfers/create?vehicle_id=${unit.id}`;
return;
}
const modal = document.getElementById('updateLocationModal');
const form = document.getElementById('updateLocationForm');
form.action = `/qma/unit-management/${unit.id}/location`;
@@ -72,7 +72,7 @@
required
onchange="onHeavyUnitSelected(this)"
class="w-full px-3.5 py-2.5 text-xs rounded-xl border border-slate-200 focus:outline-none focus:ring-2 focus:ring-[#1b5e20]/20 focus:border-[#1b5e20] transition bg-white text-slate-800 font-semibold">
<option value="" disabled {{ old('vehicle_id') ? '' : 'selected' }}>-- Pilih Unit Alat Berat / Support Unit --</option>
<option value="" disabled {{ old('vehicle_id', $selectedVehicleId) ? '' : 'selected' }}>-- Pilih Unit Alat Berat / Support Unit --</option>
@foreach($heavyUnits as $unit)
<option value="{{ $unit->id }}"
data-code="{{ $unit->code }}"
@@ -81,7 +81,7 @@
data-location="{{ $unit->location ?: 'Site Kerinci' }}"
data-site-status="{{ $unit->site_status ?? 'inside_site' }}"
data-photo="{{ $unit->photo_url }}"
{{ old('vehicle_id') == $unit->id ? 'selected' : '' }}>
{{ old('vehicle_id', $selectedVehicleId) == $unit->id ? 'selected' : '' }}>
{{ $unit->code }} - {{ $unit->brand_type }} (Lokasi Saat Ini: {{ $unit->location ?: 'Site Kerinci' }})
</option>
@endforeach