From c902754ca012c5454dabcdadfe874bfefecb5c68 Mon Sep 17 00:00:00 2001 From: Ilham Wara Nugroho Date: Wed, 28 Jan 2026 16:16:55 +0700 Subject: [PATCH] update --- app/Helpers/custom.php | 155 +++++++++--------- .../Modules/Usulan/KriteriaController.php | 9 +- .../modules/usulan/kriteria/form.blade.php | 30 ++-- .../usulan/kriteria/progress.blade.php | 2 +- 4 files changed, 98 insertions(+), 98 deletions(-) diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index f3b1d9e..7d0a2ba 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -1435,9 +1435,9 @@ if (!function_exists('formKriteria')) { $link = Penilaian::where('key','upload_files')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first(); $linkLabel = Penilaian::where('key','upload_files_label')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first(); // $valueLink = json_decode(@$link->value); - $valueLinkLabel = json_decode(@$linkLabel->value); + // $valueLinkLabel = json_decode(@$linkLabel->value); - $valueLink = PenilaianFile::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('tahun',$kuesioner->tahun)->orderBy('key_option','ASC')->get(); + // $valueLink = PenilaianFile::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('tahun',$kuesioner->tahun)->orderBy('key_option','ASC')->get(); $catatan = Penilaian::where('key','catatan')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first(); $valueCatatan = json_decode(@$catatan->value); @@ -1450,85 +1450,88 @@ if (!function_exists('formKriteria')) { $html .= '
'; $html .= '
'; $html .= '
Upload File Bukti
'; - $html .= 'Hapus File Jika Ingin Merubah/Mengupload Kembali'; + $html .= 'Upload File Kembali Jika Ingin Merubah Data'; $html .= '
'; $html .= '
'; - // $html .= '
'; - if(($kriteriaFirst->type == 'textarea') || ($kriteriaFirst->type == 'number')){ - // $html .= '
'; - // $html .= ''; - // $html .= ''; - // $html .= 'Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg'; - // $html .= '
'; - foreach($kriteria as $keyKriteria => $data){ - if(count(@$valueLink) > 0){ - $html .= '
- - -
-
- - -
- -
- Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg -
'; - }else{ - $html .= '
- - -
- -
- Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg -
'; - } - } - } + if(($kriteriaFirst->type == 'textarea') || ($kriteriaFirst->type == 'number')){ + // $html .= '
'; + // $html .= ''; + // $html .= ''; + // $html .= 'Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg'; + // $html .= '
'; + foreach($kriteria as $keyKriteria => $data){ + $checkFile = PenilaianFile::where('page_number',$page_number) + ->where('ms_sekolah_id',$idSekolah) + ->where('tahun',$kuesioner->tahun) + ->where('key',$data->key) + ->first(); - $html .= ' -
'; - - if(@$valueLink){ - - foreach(@$valueLink as $kuy => $file){ - if(count(@$valueLink) > 1){ - $html .= '
- - + if(@$checkFile){ + $html .= '
+ +
- - +
- +
- Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg + Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg +
'; + }else{ + $html .= '
+ + +
+ +
+ Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg
'; - }else{ - - $html .= '
- - -
-
- - -
- -
- Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg -
'; - } - } - } - $html .= '
'; - // $html .= ''; - // $html .= 'Contoh link : https://example.com'; + } + + }else{ + foreach($kriteria as $keyKriteria => $data){ + $option = json_decode($data->option); + foreach($option as $keyOption => $dataOption){ + if(($dataOption == 'Tidak Ada Prasarana dan Sarana Terkait Hemat dan Konservasi Energi') || ($dataOption == 'Tidak Ada Prasarana dan Sarana Terkait Hemat dan Konservasi Air') || ($dataOption == 'Tidak Ada Prasarana dan Sarana Pembelajaran Keanekaraganan Hayati') || ($dataOption == 'Tidak ada prasarana dan sarana pengelolaan sampah dan limbah padat') || ($dataOption == 'Tidak ada prasarana dan sarana sanitasi') || ($dataOption == 'Prasarana dan Sarana yang dimanfaatkan menjadi media pembelajaran tidak terkait 5 aspek lingkungan') || ($dataOption == 'Tidak Ada Kerjasama dengan pihak lain terkait lingkungan') || ($dataOption == 'Tidak Ada Kegiatan Diinisiasi Sekolah') || ($dataOption == 'Tidak Ada Kegiatan Pemberdayaan Kader') || ($dataOption == 'Tidak Ada Media Publikasi') || ($dataOption == 'Tidak Ada Kegiatan Kampanye/Publikasi') || ($dataOption == 'Tidak Ada Aspek Lingkungan') || ($dataOption == 'Tidak Ada Program Rutin') || ($dataOption == 'Tidak Ada Aspek Rutin Terkait Aspek Lingkungan') || ($dataOption == 'Tidak Ada Hasil Karya Siswa yang terkait Aspek Lingkungan') || ($dataOption == 'Jurnal Ekstrakurikuler Tidak Terkait Aspek Lingkungan') || ($dataOption == 'Jurnal Guru dan RPP Tidak Terkait Aspek Lingkungan') || ($dataOption == 'Bahan Informasi lingkungan di sekolah tidak terkait 5 aspek lingkungan') || ($dataOption == 'Visi, Misi dan Tujuan Sekolah Tidak Terkait Aspek Lingkungan') || ($dataOption == 'SK/Tatib Tidak Terkait Aspek Lingkungan')){ + }else{ + $checkFile = PenilaianFile::where('page_number',$page_number) + ->where('ms_sekolah_id',$idSekolah) + ->where('tahun',$kuesioner->tahun) + ->where('key',preg_replace('/[^a-z0-9]+/', '_', strtolower($dataOption))) + ->first(); + + if(@$checkFile){ + $html .= '
+ + +
+
+ + +
+ +
+ Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg +
'; + }else{ + $html .='
+ + + + Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg +
'; + } + + } + } + } + } + + $html .= '
'; $html .= '
'; $html .= '
'; @@ -1551,17 +1554,7 @@ if (!function_exists('formKriteria')) { $html .= '
'; $html .= '
    '; - if(@$valueLink){ - if(is_array(@$valueLink)){ - foreach(@$valueLink as $kuy => $file){ - $html .= '
  • - File '.($kuy+1).' -
  • '; - } - }else{ - $html .= '
  • File 1
  • '; - } - } + $html .= '
'; $html .= '
'; diff --git a/app/Http/Controllers/Modules/Usulan/KriteriaController.php b/app/Http/Controllers/Modules/Usulan/KriteriaController.php index 2e64503..0bb30e9 100644 --- a/app/Http/Controllers/Modules/Usulan/KriteriaController.php +++ b/app/Http/Controllers/Modules/Usulan/KriteriaController.php @@ -89,11 +89,12 @@ class KriteriaController extends Controller $data['title'] = $this->title; $data['route'] = $this->route; $data['secure_id'] = $id; - $data['page'] = FormKriteria::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->toArray(); - $data['log'] = KuesionerLog::where('ms_sekolah_id',$keyId)->orderBy('created_at','ASC')->get(); $data['kuesioner'] = Kuesioner::where('ms_sekolah_id',$keyId)->where('tahun',date('Y'))->first(); - $data['dok'] = DokumenAdministrasi::where('ms_sekolah_id',$keyId)->where('tahun',date('Y'))->first(); - $data['penilaian'] = Penilaian::where('ms_sekolah_id',$keyId)->where('tahun',date('Y'))->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->toArray(); + $data['page'] = FormKriteria::select('page_number')->where('tahun',tahunKuesioner($data['kuesioner']->KuesionerId))->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->toArray(); + $data['log'] = KuesionerLog::where('ms_sekolah_id',$keyId)->orderBy('created_at','ASC')->get(); + + $data['dok'] = DokumenAdministrasi::where('ms_sekolah_id',$keyId)->where('tahun',$data['kuesioner']->tahun)->first(); + $data['penilaian'] = Penilaian::where('ms_sekolah_id',$keyId)->where('tahun',$data['kuesioner']->tahun)->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->toArray(); return view($this->template.'.progress',$data); } diff --git a/resources/views/modules/usulan/kriteria/form.blade.php b/resources/views/modules/usulan/kriteria/form.blade.php index 1206393..e60b98a 100644 --- a/resources/views/modules/usulan/kriteria/form.blade.php +++ b/resources/views/modules/usulan/kriteria/form.blade.php @@ -173,7 +173,8 @@ if ($(this).is(':checked')) { // uncheck semua checkbox KECUALI checkbox terakhir ini $('.checklistInput').not(this).prop('checked', false); - $('.file-item').remove(); + $('.file-item').addClass('d-none'); + $('.file-itemInput').removeClass('is-required'); } }); @@ -209,20 +210,25 @@ if ($(this).is(':checked')) { + $('.'+value).removeClass('d-none'); + $('.'+value+'Class').addClass('is-required'); + // Cegah double insert - if ($('#file_' + value).length === 0) { - container.append(` -
- - - - Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg -
- `); - } + // if ($('#file_' + value).length === 0) { + // container.append(` + //
+ // + // + // + // Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg + //
+ // `); + // } } else { - $('#file_' + value).remove(); + $('.'+value).addClass('d-none'); + $('.'+value+'Class').removeClass('is-required'); + // $('#file_' + value).remove(); } }); diff --git a/resources/views/modules/usulan/kriteria/progress.blade.php b/resources/views/modules/usulan/kriteria/progress.blade.php index 5673e98..826226d 100644 --- a/resources/views/modules/usulan/kriteria/progress.blade.php +++ b/resources/views/modules/usulan/kriteria/progress.blade.php @@ -170,7 +170,7 @@ @if(session('group_alias') == 'sekolah') @if(count(@$penilaian) == count(@$page)) @if(($kuesioner->status == 1) || ($kuesioner->status == 5)) - @if(getNilaiAll('sekolah',$kuesioner->ms_sekolah_id) > 70) + @if(getNilaiAll('sekolah',$kuesioner->ms_sekolah_id) > 80)