diff --git a/app/Http/Requests/PermohonanRequest.php b/app/Http/Requests/PermohonanRequest.php index 3f2f252..a3a579f 100644 --- a/app/Http/Requests/PermohonanRequest.php +++ b/app/Http/Requests/PermohonanRequest.php @@ -23,7 +23,7 @@ 'status' => 'nullable|string', 'jenis_fasilitas_kredit_id' => 'required|exists:jenis_fasilitas_kredit,id', 'nilai_plafond_id' => 'required|exists:nilai_plafond,id', - 'status_bayar' => 'required|string', + 'status_bayar' => 'nullable|string', 'nilai_njop' => 'nullable|numeric' ]; diff --git a/resources/views/permohonan/form.blade.php b/resources/views/permohonan/form.blade.php index 3b7b6af..f5e8371 100644 --- a/resources/views/permohonan/form.blade.php +++ b/resources/views/permohonan/form.blade.php @@ -64,7 +64,7 @@ @endphp @foreach($formFields as $field => $config) -
+
@if($config['type'] === 'select') @@ -114,6 +114,7 @@ const tujuanPenilaianSelect = document.getElementById('tujuan_penilaian_id'); const nilaiPlafondSelect = document.getElementById('nilai_plafond_id'); const statusBayarSelect = document.getElementById('status_bayar'); + const statusBayarWrapper = document.getElementById('status_bayar_wrapper'); // Initialize TomSelect const statusBayarTomSelect = new window.TomSelect(statusBayarSelect, { @@ -131,16 +132,15 @@ if (tujuanPenilaianValue === '2' && (nilaiPlafondValue === '2' || nilaiPlafondValue === '3')) { statusBayarTomSelect.setValue('sudah_bayar'); - statusBayarTomSelect.disable(); + statusBayarWrapper.style.display = 'none'; } else { @if(isset($permohonan)) statusBayarTomSelect.setValue('{{$permohonan->status_bayar ?? ''}}'); @else statusBayarTomSelect.setValue(''); @endif - statusBayarTomSelect.enable(); + statusBayarWrapper.style.display = 'flex'; } - console.log('Status Bayar:', statusBayarTomSelect.getValue()); }