From 720426d6be04f13431943c2f179dab8c4fb81fee Mon Sep 17 00:00:00 2001 From: Ilham Wara Nugroho Date: Wed, 4 Feb 2026 14:46:55 +0700 Subject: [PATCH] update --- app/Helpers/custom.php | 21 ++++++++----------- .../Modules/Usulan/KriteriaController.php | 19 +++++++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index bfc8689..c3a05e4 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -1754,12 +1754,11 @@ if (!function_exists('formKriteria')) { $html .= ''; $html .= ''; - $checkFile = PenilaianFile::where('page_number',$page_number) - ->where('ms_sekolah_id',$idSekolah) - ->where('tahun',$kuesioner->tahun) - ->where('key',$page_number) + $checkFile = Penilaian::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah) + ->where('key','input_upload_files_penilai') ->first(); - $extension = explode('.',@$checkFile->value); + $valueFile = json_decode(@$checkFile->value); + $extension = explode('.',@$valueFile->value); $html .= '
'; $html .= ''; @@ -1771,26 +1770,24 @@ if (!function_exists('formKriteria')) { $html .= '
'; $html .= ''; - if(@$checkFile){ + if(@$valueFile){ $html .= '
-
- +
- +
Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg
'; }else{ - $html .='
+ $html .='
- - + Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg
'; diff --git a/app/Http/Controllers/Modules/Usulan/KriteriaController.php b/app/Http/Controllers/Modules/Usulan/KriteriaController.php index 9385901..70a6b9e 100644 --- a/app/Http/Controllers/Modules/Usulan/KriteriaController.php +++ b/app/Http/Controllers/Modules/Usulan/KriteriaController.php @@ -517,6 +517,25 @@ class KriteriaController extends Controller // dd(request()->input_upload_files,request()->all()); + if($key == 'input_upload_files_penilai'){ + $destinationPath = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) ); + $path = $destinationPath; + $fileName = $value->getClientOriginalName(); + $fileMime = $value->getClientMimeType(); + $fileExtension = $value->getClientOriginalExtension(); + $fileSize = $value->getSize(); + + $newFilename = $idSekolah.'_'.session('uid').'_'.uniqid('file_') . '.' . $fileExtension; + + if (!File::exists($path)) { + File::isDirectory($path) or File::makeDirectory($path, 0777, true, true); + } + + $newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/' . $newFilename; + $uploaded = $value->move($path, $newFilename); + $value[] = $newPath; + } + if($key == 'input_upload_files'){ $filePaths = [];