feat(qma): show BAST document section only for outside site unit transfers
This commit is contained in:
@@ -210,6 +210,7 @@
|
||||
name="to_site_status"
|
||||
value="inside_site"
|
||||
id="radio_inside_site"
|
||||
onchange="onSiteStatusChanged(this.value)"
|
||||
{{ old('to_site_status', 'inside_site') === 'inside_site' ? 'checked' : '' }}
|
||||
class="text-[#1b5e20] focus:ring-[#1b5e20]">
|
||||
<div class="text-left">
|
||||
@@ -223,6 +224,7 @@
|
||||
name="to_site_status"
|
||||
value="outside_site"
|
||||
id="radio_outside_site"
|
||||
onchange="onSiteStatusChanged(this.value)"
|
||||
{{ old('to_site_status') === 'outside_site' ? 'checked' : '' }}
|
||||
class="text-amber-600 focus:ring-amber-500">
|
||||
<div class="text-left">
|
||||
@@ -392,15 +394,16 @@
|
||||
|
||||
<!-- ============================================================= -->
|
||||
<!-- BAGIAN 3: BERITA ACARA SERAH TERIMA (BAST) -->
|
||||
<!-- Hanya muncul untuk Pemindahan ke Luar Site (outside_site) -->
|
||||
<!-- ============================================================= -->
|
||||
<div class="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-5 sm:p-6 space-y-5">
|
||||
<div id="bastSectionCard" class="bg-white rounded-2xl border border-slate-200/80 shadow-xs p-5 sm:p-6 space-y-5 transition-all">
|
||||
<div class="flex items-center space-x-3 pb-3 border-b border-slate-100">
|
||||
<div class="w-9 h-9 rounded-xl bg-amber-50 text-amber-700 flex items-center justify-center font-bold text-base shrink-0">
|
||||
<i class="fa-solid fa-file-contract"></i>
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-base font-extrabold text-slate-900">3. Berita Acara Serah Terima (BAST)</h3>
|
||||
<p class="text-xs text-slate-500">Nomor surat, perihal, dan berkas lampiran berita acara resmi pemindahan alat berat.</p>
|
||||
<p class="text-xs text-slate-500">Nomor surat, perihal, dan berkas lampiran berita acara resmi pemindahan alat berat ke luar site.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -417,7 +420,6 @@
|
||||
name="document_number"
|
||||
id="document_number"
|
||||
value="{{ old('document_number', $defaultDocNumber) }}"
|
||||
required
|
||||
placeholder="Contoh: 014/BAST-AB/QMA-KMH/X/2026"
|
||||
class="w-full pl-9 pr-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-mono font-bold">
|
||||
</div>
|
||||
@@ -437,8 +439,7 @@
|
||||
name="document_title"
|
||||
id="document_title"
|
||||
value="{{ old('document_title', 'Berita Acara Pemindahan & Relokasi Unit Alat Berat') }}"
|
||||
required
|
||||
placeholder="Contoh: Berita Acara Pemindahan Excavator ke Area Adit 2"
|
||||
placeholder="Contoh: Berita Acara Pemindahan Excavator ke Workshop Luar"
|
||||
class="w-full pl-9 pr-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">
|
||||
</div>
|
||||
@error('document_title')
|
||||
@@ -471,9 +472,10 @@
|
||||
Batal
|
||||
</a>
|
||||
<button type="submit"
|
||||
id="submitBtn"
|
||||
class="px-6 py-2.5 text-xs font-bold text-white bg-[#1b5e20] hover:bg-[#144919] rounded-xl transition shadow-sm cursor-pointer inline-flex items-center space-x-2">
|
||||
<i class="fa-solid fa-check"></i>
|
||||
<span>Simpan & Terbitkan BAST</span>
|
||||
<span id="submitBtnText">Simpan Pemindahan Unit</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -507,8 +509,62 @@
|
||||
if (originSelect && originSelect.value) {
|
||||
onOriginLocationChanged(originSelect.value, "{{ old('vehicle_id', $selectedVehicleId ?? '') }}");
|
||||
}
|
||||
|
||||
// Inisialisasi tampilan BAST berdasarkan status site awal
|
||||
const currentSiteStatus = document.querySelector('input[name="to_site_status"]:checked')?.value || 'inside_site';
|
||||
onSiteStatusChanged(currentSiteStatus);
|
||||
});
|
||||
|
||||
/**
|
||||
* Handler untuk Area Tujuan (Di Dalam Site vs Di Luar Site)
|
||||
* Nomor BAST dan Dokumen hanya muncul saat transfer ke LUAR site.
|
||||
*/
|
||||
function onSiteStatusChanged(status) {
|
||||
const bastSection = document.getElementById('bastSectionCard');
|
||||
const docNumberInput = document.getElementById('document_number');
|
||||
const docTitleInput = document.getElementById('document_title');
|
||||
const docFileInput = document.getElementById('document_file');
|
||||
const submitBtnText = document.getElementById('submitBtnText');
|
||||
|
||||
if (status === 'outside_site') {
|
||||
if (bastSection) {
|
||||
bastSection.classList.remove('hidden');
|
||||
}
|
||||
if (docNumberInput) {
|
||||
docNumberInput.removeAttribute('disabled');
|
||||
docNumberInput.setAttribute('required', 'required');
|
||||
}
|
||||
if (docTitleInput) {
|
||||
docTitleInput.removeAttribute('disabled');
|
||||
docTitleInput.setAttribute('required', 'required');
|
||||
}
|
||||
if (docFileInput) {
|
||||
docFileInput.removeAttribute('disabled');
|
||||
}
|
||||
if (submitBtnText) {
|
||||
submitBtnText.textContent = 'Simpan & Terbitkan BAST';
|
||||
}
|
||||
} else {
|
||||
if (bastSection) {
|
||||
bastSection.classList.add('hidden');
|
||||
}
|
||||
if (docNumberInput) {
|
||||
docNumberInput.removeAttribute('required');
|
||||
docNumberInput.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
if (docTitleInput) {
|
||||
docTitleInput.removeAttribute('required');
|
||||
docTitleInput.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
if (docFileInput) {
|
||||
docFileInput.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
if (submitBtnText) {
|
||||
submitBtnText.textContent = 'Simpan Pemindahan Unit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler ketika Lokasi Awal (Asal) berubah
|
||||
* Memfilter unit alat berat yang posisinya berada di lokasi tersebut
|
||||
|
||||
@@ -210,17 +210,23 @@
|
||||
|
||||
<!-- 3. Berita Acara -->
|
||||
<td class="py-3.5 px-3.5 min-w-[200px]">
|
||||
<div class="font-bold text-slate-900 leading-tight">
|
||||
{{ $t->document_number }}
|
||||
</div>
|
||||
<div class="text-[11px] text-slate-500 mt-0.5 line-clamp-1" title="{{ $t->document_title }}">
|
||||
{{ $t->document_title }}
|
||||
</div>
|
||||
@if($t->document_file_path)
|
||||
<a href="{{ $t->document_file_url }}" target="_blank" class="inline-flex items-center space-x-1 text-[10px] font-bold text-emerald-700 hover:text-emerald-900 mt-1">
|
||||
<i class="fa-solid fa-paperclip"></i>
|
||||
<span>Lihat Lampiran</span>
|
||||
</a>
|
||||
@if($t->document_number)
|
||||
<div class="font-bold text-slate-900 leading-tight font-mono text-xs">
|
||||
{{ $t->document_number }}
|
||||
</div>
|
||||
<div class="text-[11px] text-slate-500 mt-0.5 line-clamp-1" title="{{ $t->document_title }}">
|
||||
{{ $t->document_title }}
|
||||
</div>
|
||||
@if($t->document_file_path)
|
||||
<a href="{{ $t->document_file_url }}" target="_blank" class="inline-flex items-center space-x-1 text-[10px] font-bold text-emerald-700 hover:text-emerald-900 mt-1">
|
||||
<i class="fa-solid fa-paperclip"></i>
|
||||
<span>Lihat Lampiran</span>
|
||||
</a>
|
||||
@endif
|
||||
@else
|
||||
<span class="inline-flex items-center space-x-1 px-2 py-0.5 rounded text-[11px] font-medium text-slate-500 bg-slate-100 border border-slate-200">
|
||||
<span>Tanpa BAST (Internal Site)</span>
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Berita Acara Transfer Unit - ' . $transfer->document_number . ' | PT Kerinci Merangin Hidro')
|
||||
@section('title', ($transfer->document_number ? 'Berita Acara Transfer Unit - ' . $transfer->document_number : 'Detail Transfer Unit - ' . $transfer->transfer_no) . ' | PT Kerinci Merangin Hidro')
|
||||
|
||||
@section('content')
|
||||
<div class="w-full max-w-4xl mx-auto space-y-6 pb-16">
|
||||
@@ -35,7 +35,7 @@
|
||||
onclick="window.print()"
|
||||
class="px-4 py-2 rounded-xl bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold transition shadow-sm inline-flex items-center space-x-1.5 cursor-pointer">
|
||||
<i class="fa-solid fa-print"></i>
|
||||
<span>Cetak BAST</span>
|
||||
<span>{{ $transfer->document_number ? 'Cetak BAST' : 'Cetak Bukti Transfer' }}</span>
|
||||
</button>
|
||||
|
||||
<!-- Tombol Buat Baru -->
|
||||
@@ -95,14 +95,22 @@
|
||||
<!-- JUDUL & NOMOR BERITA ACARA -->
|
||||
<div class="text-center space-y-1.5">
|
||||
<h2 class="text-lg sm:text-xl font-black text-slate-900 uppercase tracking-wide">
|
||||
BERITA ACARA SERAH TERIMA & PEMINDAHAN ALAT BERAT
|
||||
{{ $transfer->document_title ?: 'BUKTI PEMINDAHAN INTERNAL ALAT BERAT' }}
|
||||
</h2>
|
||||
@if($transfer->document_number)
|
||||
<p class="font-mono text-xs sm:text-sm font-bold text-slate-700">
|
||||
Nomor: {{ $transfer->document_number }}
|
||||
</p>
|
||||
@else
|
||||
<p class="font-mono text-xs sm:text-sm font-bold text-emerald-800 bg-emerald-50 inline-block px-3 py-1 rounded-md border border-emerald-200">
|
||||
Pemindahan Di Dalam Site (Tanpa BAST)
|
||||
</p>
|
||||
@endif
|
||||
@if($transfer->document_title)
|
||||
<div class="inline-block mt-1 px-3 py-0.5 rounded-full text-xs font-semibold bg-emerald-50 text-emerald-800 border border-emerald-200">
|
||||
Perihal: {{ $transfer->document_title }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- PARAGRAF PEMBUKA -->
|
||||
|
||||
Reference in New Issue
Block a user