From f917fc5131cd70a0b69d4762762dce526c588121 Mon Sep 17 00:00:00 2001 From: ilhamwara Date: Tue, 8 Jul 2025 10:06:28 +0700 Subject: [PATCH] update --- app/Helpers/custom.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index b994dcc..38d098f 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -789,14 +789,22 @@ if (!function_exists('formKriteria')) { $valueOld = json_decode(@$penilaianOld->value); foreach($option as $keyOption => $dataOption){ - if(@$value){ - if(in_array($dataOption, (is_array(@$value) ? @$value : array(@$value)))){ - $checked = 'checked'; - } - }else{ - if(in_array($dataOption, (is_array(@$valueOld) ? @$valueOld : array(@$valueOld)))){ - $checked = 'checked'; - } + // if(@$value){ + // if(in_array($dataOption, (is_array(@$value) ? @$value : array(@$value)))){ + // $checked = 'checked'; + // } + // }else{ + // if(in_array($dataOption, (is_array(@$valueOld) ? @$valueOld : array(@$valueOld)))){ + // $checked = 'checked'; + // } + // } + + $checked = ''; + + $selectedValues = is_array($value) ? $value : (isset($value) ? [$value] : (is_array($valueOld) ? $valueOld : [$valueOld])); + + if (in_array($dataOption, $selectedValues)) { + $checked = 'checked'; } $key = 'number_'.$keyKriteria.'_'.$keyOption;