From b48a3a9a9b34d6c373d7737f74944414b3d6a371 Mon Sep 17 00:00:00 2001 From: Ilham Wara Nugroho Date: Mon, 18 May 2026 11:11:22 +0700 Subject: [PATCH] update --- app/Helpers/custom.php | 2 +- .../modules/usulan/kriteria/form.blade.php | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index 9015fc1..771c886 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -1607,7 +1607,7 @@ if (!function_exists('formKriteria')) { for($i = 1; $i <= $data->number_answer_lainnya; $i++){ $html .= '
'; - $html .= ''; + $html .= ''; $html .= '
'; } $html .= ''; diff --git a/resources/views/modules/usulan/kriteria/form.blade.php b/resources/views/modules/usulan/kriteria/form.blade.php index cdb8f28..a6712c9 100644 --- a/resources/views/modules/usulan/kriteria/form.blade.php +++ b/resources/views/modules/usulan/kriteria/form.blade.php @@ -459,16 +459,35 @@ } else if (type === 'checkbox') { let checkedCount = $(`input[name="${name}"]:checked`).length; - if (checkedCount === 0) { + // Cek apakah ada textbox "Kegiatan Lainnya" yang terisi + let isLainnyaFilled = $('.kegiatan-lainnya').filter(function () { + return $(this).val()?.trim() !== ''; + }).length > 0; + + // Jika checkbox kosong DAN textbox lainnya juga kosong + if (checkedCount === 0 && !isLainnyaFilled) { isValid = false; $(`input[name="${name}"]`).addClass("is-invalid"); - } else if (checkedCount === 1) { + + // Validasi existing milik Anda + } else if (checkedCount === 1 && !isLainnyaFilled) { isMultiple = false; $(`input[name="${name}"]`).addClass("is-invalid"); + } else { $(`input[name="${name}"]`).removeClass("is-invalid"); } + // if (checkedCount === 0) { + // isValid = false; + // $(`input[name="${name}"]`).addClass("is-invalid"); + // } else if (checkedCount === 1) { + // isMultiple = false; + // $(`input[name="${name}"]`).addClass("is-invalid"); + // } else { + // $(`input[name="${name}"]`).removeClass("is-invalid"); + // } + } else if (type === 'file') { if (this.files.length === 0) { isValid = false;