diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index dc9f8d5..02a2659 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -710,16 +710,24 @@ if (!function_exists('formKriteria')) { $kuesioner = Kuesioner::where('ms_sekolah_id',$idSekolah)->where('tahun',date('Y'))->first(); + if(session('group_alias') == 'sekolah'){ + $status = 0; + }elseif(session('group_alias') == 'penilai_kota'){ + $status = 1; + }elseif(session('group_alias') == 'penilai_provinsi'){ + $status = 2; + } + foreach($kriteria as $keyKriteria => $data){ if(@$type == 'kota'){ - $penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',1)->first(); + $penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first(); $penilaianOld = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',0)->first(); }elseif(@$type == 'provinsi'){ - $penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',2)->first(); + $penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first(); $penilaianOld = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',1)->first(); }else{ - $penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',0)->first(); + $penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first(); } // if(session('group_alias') == 'sekolah'){