update
parent
8d89fa018d
commit
581f82c667
|
|
@ -6,11 +6,23 @@ use App\Models\Kuesioner;
|
||||||
use App\Models\KuesionerLog;
|
use App\Models\KuesionerLog;
|
||||||
use App\Models\Master\FormKriteria;
|
use App\Models\Master\FormKriteria;
|
||||||
use App\Models\Penilaian;
|
use App\Models\Penilaian;
|
||||||
|
use App\Models\PenilaianFile;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Master\Sekolah;
|
use App\Models\Master\Sekolah;
|
||||||
use App\Models\SK;
|
use App\Models\SK;
|
||||||
use App\Models\Master\MasterGroup;
|
use App\Models\Master\MasterGroup;
|
||||||
|
|
||||||
|
if (!function_exists('tahunKuesioner')) {
|
||||||
|
function tahunKuesioner($id){
|
||||||
|
$kuesioner = Kuesioner::find($id);
|
||||||
|
if($kuesioner->tahun >= '2026'){
|
||||||
|
$tahun = '2026';
|
||||||
|
}else{
|
||||||
|
$tahun = '2025';
|
||||||
|
}
|
||||||
|
return $tahun;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!function_exists('sekolah')) {
|
if (!function_exists('sekolah')) {
|
||||||
function sekolah($id){
|
function sekolah($id){
|
||||||
|
|
@ -346,7 +358,7 @@ if (!function_exists('checkPenilaian')) {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function checkPenilaian($page_number,$sekolah_id = null,$type = null)
|
function checkPenilaian($page_number,$sekolah_id = null,$type = null,$kuesionerId = null)
|
||||||
{
|
{
|
||||||
if(@$sekolah_id){
|
if(@$sekolah_id){
|
||||||
$idSekolah = @$sekolah_id;
|
$idSekolah = @$sekolah_id;
|
||||||
|
|
@ -355,11 +367,17 @@ if (!function_exists('checkPenilaian')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(@$type == 'kota'){
|
if(@$type == 'kota'){
|
||||||
$penilaian = Penilaian::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('status',1)->first();
|
$penilaian = Penilaian::whereHas('page',function($query) use ($kuesionerId){
|
||||||
|
$query->where('tahun',tahunKuesioner($kuesionerId));
|
||||||
|
})->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('status',1)->first();
|
||||||
}elseif(@$type == 'provinsi'){
|
}elseif(@$type == 'provinsi'){
|
||||||
$penilaian = Penilaian::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('status',2)->first();
|
$penilaian = Penilaian::whereHas('page',function($query) use ($kuesionerId){
|
||||||
|
$query->where('tahun',tahunKuesioner($kuesionerId));
|
||||||
|
})->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('status',2)->first();
|
||||||
}else{
|
}else{
|
||||||
$penilaian = Penilaian::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('status',0)->first();
|
$penilaian = Penilaian::whereHas('page',function($query) use ($kuesionerId){
|
||||||
|
$query->where('tahun',tahunKuesioner($kuesionerId));
|
||||||
|
})->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('status',0)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(session('group_alias') == 'sekolah'){
|
// if(session('group_alias') == 'sekolah'){
|
||||||
|
|
@ -755,9 +773,10 @@ if (!function_exists('formKriteria')) {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function formKriteria($page_number,$sekolah_id = null,$type = null)
|
function formKriteria($page_number,$sekolah_id = null,$type = null,$tahun = null)
|
||||||
{
|
{
|
||||||
$kriteria = FormKriteria::where('page_number',$page_number)->get();
|
//cek
|
||||||
|
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if(@$sekolah_id){
|
if(@$sekolah_id){
|
||||||
|
|
@ -766,7 +785,9 @@ if (!function_exists('formKriteria')) {
|
||||||
$idSekolah = session('sekolah_id');
|
$idSekolah = session('sekolah_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$kuesioner = Kuesioner::where('ms_sekolah_id',$idSekolah)->where('tahun',date('Y'))->first();
|
$kuesioner = Kuesioner::where('ms_sekolah_id',$idSekolah)->orderBy('tahun','DESC')->first();
|
||||||
|
|
||||||
|
$kriteria = FormKriteria::where('tahun',$tahun)->where('page_number',$page_number)->get();
|
||||||
|
|
||||||
if(session('group_alias') == 'sekolah'){
|
if(session('group_alias') == 'sekolah'){
|
||||||
$status = 0;
|
$status = 0;
|
||||||
|
|
@ -785,13 +806,13 @@ if (!function_exists('formKriteria')) {
|
||||||
foreach($kriteria as $keyKriteria => $data){
|
foreach($kriteria as $keyKriteria => $data){
|
||||||
|
|
||||||
if(@$type == 'kota'){
|
if(@$type == 'kota'){
|
||||||
$penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first();
|
$penilaian = Penilaian::where('tahun',$tahun)->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',($status-1))->first();
|
$penilaianOld = Penilaian::where('tahun',$tahun)->where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',($status-1))->first();
|
||||||
}elseif(@$type == 'provinsi'){
|
}elseif(@$type == 'provinsi'){
|
||||||
$penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first();
|
$penilaian = Penilaian::where('tahun',$tahun)->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',($status-1))->first();
|
$penilaianOld = Penilaian::where('tahun',$tahun)->where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',($status-1))->first();
|
||||||
}else{
|
}else{
|
||||||
$penilaian = Penilaian::where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first();
|
$penilaian = Penilaian::where('tahun',$tahun)->where('key',$data->key)->where('ms_sekolah_id',$idSekolah)->where('status',$status)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(session('group_alias') == 'sekolah'){
|
// if(session('group_alias') == 'sekolah'){
|
||||||
|
|
@ -813,7 +834,11 @@ if (!function_exists('formKriteria')) {
|
||||||
|
|
||||||
// dd();
|
// dd();
|
||||||
|
|
||||||
$html .= '<div class="card mb-2 removeFormKriteria">';
|
$html .= '<div class="removeFormKriteria">';
|
||||||
|
$html .= '<div class="alert bg-primary-light text-primary mb-2"> <i class="fal fa-info-circle"></i> Informasi <br>';
|
||||||
|
$html .= $kriteria[0]->keterangan;
|
||||||
|
$html .= '</div>';
|
||||||
|
$html .= '<div class="card mb-2">';
|
||||||
$html .= '<div class="card-body">';
|
$html .= '<div class="card-body">';
|
||||||
$html .= '<h6><b>'.$data->judul.'</b></h6>';
|
$html .= '<h6><b>'.$data->judul.'</b></h6>';
|
||||||
// $html .= '<input type="hidden" name="input_upload_files[]">';
|
// $html .= '<input type="hidden" name="input_upload_files[]">';
|
||||||
|
|
@ -912,6 +937,7 @@ if (!function_exists('formKriteria')) {
|
||||||
|
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
$html .= '</div>';
|
||||||
|
|
||||||
if($data->active_lainnya == 1){
|
if($data->active_lainnya == 1){
|
||||||
if(session('group_alias') == 'sekolah'){
|
if(session('group_alias') == 'sekolah'){
|
||||||
|
|
@ -950,7 +976,11 @@ if (!function_exists('formKriteria')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = Penilaian::where('key','upload_files')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first();
|
$link = Penilaian::where('key','upload_files')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first();
|
||||||
$valueLink = json_decode(@$link->value);
|
$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);
|
||||||
|
|
||||||
|
$valueLink = PenilaianFile::where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->where('tahun',date('Y'))->orderBy('key_option','ASC')->get();
|
||||||
|
|
||||||
$catatan = Penilaian::where('key','catatan')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first();
|
$catatan = Penilaian::where('key','catatan')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first();
|
||||||
$valueCatatan = json_decode(@$catatan->value);
|
$valueCatatan = json_decode(@$catatan->value);
|
||||||
|
|
@ -963,11 +993,11 @@ if (!function_exists('formKriteria')) {
|
||||||
$html .= '<div class="card-body">';
|
$html .= '<div class="card-body">';
|
||||||
$html .= '<div class="d-flex justify-content-between align-items-center mb-3">';
|
$html .= '<div class="d-flex justify-content-between align-items-center mb-3">';
|
||||||
$html .= '<h6><b>Upload File Bukti</b></h6>';
|
$html .= '<h6><b>Upload File Bukti</b></h6>';
|
||||||
// $html .= '<a class="btn btn-primary text-white"><i class="fal fa-plus"></i> Tambah File</a>';
|
$html .= '<i class="text-danger">Hapus File Jika Ingin Merubah/Mengupload Kembali</i>';
|
||||||
|
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
$html .= '<div class="form-group">';
|
$html .= '<div class="form-group">';
|
||||||
$html .= '<div id="dynamic-file-container"></div>';
|
// $html .= '<div id="dynamic-file-container"></div>';
|
||||||
|
|
||||||
if(($kriteriaFirst->type == 'textarea') || ($kriteriaFirst->type == 'number')){
|
if(($kriteriaFirst->type == 'textarea') || ($kriteriaFirst->type == 'number')){
|
||||||
// $html .= '<div class="mb-3 file-item">';
|
// $html .= '<div class="mb-3 file-item">';
|
||||||
|
|
@ -977,27 +1007,44 @@ if (!function_exists('formKriteria')) {
|
||||||
// $html .= '</div>';
|
// $html .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '<div style="border: 2px dashed #0087F7; padding: 20px;" class="dropzone d-none" id="my-dropzone">
|
$html .= '
|
||||||
<div class="dz-message">
|
<div id="dynamic-file-container" style="margin-top: 20px;">';
|
||||||
Drop PDF files here or click to upload
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="uploaded-files" style="margin-top: 20px;">
|
|
||||||
<ul id="file-list" data-file="'.(@$valueLink ? count(@$valueLink) > 0 ? 'true' : 'false' : 'false').'">';
|
|
||||||
if(@$valueLink){
|
if(@$valueLink){
|
||||||
if(is_array(@$valueLink)){
|
|
||||||
foreach(@$valueLink as $kuy => $file){
|
foreach(@$valueLink as $kuy => $file){
|
||||||
$html .= '<li class="">
|
if(count(@$valueLink) > 1){
|
||||||
<a class="" target="_blank" href="'.asset($file).'">File '.($kuy+1).'</a>
|
$html .= '<div class="mb-3 file-item" id="file_'.$file->key.'">
|
||||||
</li>';
|
<label class="fw-500">Upload Dokumen '.str_replace('_',' ',ucwords($file->key)).'</label>
|
||||||
}
|
<input type="hidden" name="input_upload_files_label[]" value="'.$file->key.'">
|
||||||
}else{
|
<div class="input-group border-none">
|
||||||
$html .= '<li><a target="_blank" href="'.asset(@$valueLink).'">File 1</a></li>';
|
<div class="input-group-prepend ">
|
||||||
}
|
<a target="_blank" class="text-white input-group-text border-none bg-primary" href="'.asset($file->value).'"><i class="fal fa-download"></i></a>
|
||||||
}
|
<a data-href="'.url('usulan/adiwiyata/kriteria/deleteFile/'.encode_id($file->PenilaianFileId)).'/'.encode_id($page_number).'" class="text-white input-group-text border-none bg-danger btnDeletFile" href="#"><i class="fal fa-trash"></i></a>
|
||||||
$html .= '</ul>
|
|
||||||
</div>
|
</div>
|
||||||
';
|
<input type="file" accept=".pdf,.png,.jpeg,.jpg" name="input_upload_files[]" data-replace-index="'.$kuy.'" class="removeFormKriteria form-control" disabled>
|
||||||
|
</div>
|
||||||
|
<span class="text-danger"><i>Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg</i></span>
|
||||||
|
</div>';
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$html .= '<div class="mb-3 file-item" id="file_'.@$valueLink[0]->key.'">
|
||||||
|
<label class="fw-500">Upload Dokumen '.str_replace('_',' ',ucwords(@$valueLink[0]->key)).'</label>
|
||||||
|
<input type="hidden" name="input_upload_files_label[]" value="'.@$valueLink[0]->key.'">
|
||||||
|
<div class="input-group border-none">
|
||||||
|
<div class="input-group-prepend ">
|
||||||
|
<a target="_blank" class="input-group-text border-none bg-primary text-white" href="'.asset(@$valueLink[0]->value).'"><i class="fal fa-download"></i></a>
|
||||||
|
<a data-href="'.url('usulan/adiwiyata/kriteria/deleteFile/'.encode_id($valueLink[0]->PenilaianFileId)).'/'.encode_id($page_number).'" class="text-white input-group-text border-none bg-danger btnDeletFile" href="#"><i class="fal fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
<input type="file" accept=".pdf,.png,.jpeg,.jpg" name="input_upload_files" data-replace-index="0" class="removeFormKriteria form-control" disabled>
|
||||||
|
</div>
|
||||||
|
<span class="text-danger"><i>Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg</i></span>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$html .= '</div>';
|
||||||
// $html .= '<input type="file" class="form-control" name="input_link_grdive" placeholder="Link Google Drive (folder penyimpanan bukti)" value="'.@$valueLink.'">';
|
// $html .= '<input type="file" class="form-control" name="input_link_grdive" placeholder="Link Google Drive (folder penyimpanan bukti)" value="'.@$valueLink.'">';
|
||||||
// $html .= '<small><i>Contoh link : https://example.com</i></small>';
|
// $html .= '<small><i>Contoh link : https://example.com</i></small>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
@ -1020,7 +1067,7 @@ if (!function_exists('formKriteria')) {
|
||||||
$html .= '<div class="card-body">';
|
$html .= '<div class="card-body">';
|
||||||
$html .= '<h6><b>Bukti File</b></h6>';
|
$html .= '<h6><b>Bukti File</b></h6>';
|
||||||
$html .= '<div class="form-group">';
|
$html .= '<div class="form-group">';
|
||||||
$html .= '<div id="uploaded-files" style="margin-top: 20px;">
|
$html .= '<div id="dynamic-file-container" style="margin-top: 20px;">
|
||||||
<ul id="file-list">';
|
<ul id="file-list">';
|
||||||
if(@$valueLink){
|
if(@$valueLink){
|
||||||
if(is_array(@$valueLink)){
|
if(is_array(@$valueLink)){
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,8 @@ class AjaxController extends Controller
|
||||||
$sekolahId = session('sekolah_id');
|
$sekolahId = session('sekolah_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = formKriteria($request->page,$sekolahId,@$request->type);
|
$title = FormKriteria::select('kategori')->where('tahun',tahunKuesioner($request->kuesionerId))->where('page_number',$request->page)->first();
|
||||||
$title = FormKriteria::select('kategori')->where('page_number',$request->page)->first();
|
$data = formKriteria($request->page,$sekolahId,@$request->type,tahunKuesioner($request->kuesionerId));
|
||||||
$nilai_sekolah = Penilaian::where('ms_sekolah_id',$sekolahId)
|
$nilai_sekolah = Penilaian::where('ms_sekolah_id',$sekolahId)
|
||||||
->where('page_number',$request->page)
|
->where('page_number',$request->page)
|
||||||
->where('skor','!=',0)
|
->where('skor','!=',0)
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class HomeController extends Controller
|
||||||
$data['penilaian'] = Penilaian::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->count();
|
$data['penilaian'] = Penilaian::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->count();
|
||||||
$data['sk'] = SK::where('tahun',date('Y'))->where('sekolah','like','%'.session('sekolah_id').'%')->first();
|
$data['sk'] = SK::where('tahun',date('Y'))->where('sekolah','like','%'.session('sekolah_id').'%')->first();
|
||||||
$data['log'] = KuesionerLog::where('kuesioner_id',@$data['kuesioner']->KuesionerId)->orderBy('created_at','DESC')->first();
|
$data['log'] = KuesionerLog::where('kuesioner_id',@$data['kuesioner']->KuesionerId)->orderBy('created_at','DESC')->first();
|
||||||
|
$data['dok'] = DokumenAdministrasi::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->first();
|
||||||
|
|
||||||
$series = SampahTerkelola::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->orderBy('bulan','ASC')->get();
|
$series = SampahTerkelola::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->orderBy('bulan','ASC')->get();
|
||||||
$organik = array_fill(1, 12, 0);
|
$organik = array_fill(1, 12, 0);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class FormKriteriaController extends Controller
|
||||||
public function grid(Request $request)
|
public function grid(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = FormKriteria::orderBy('page_number','ASC')->get();
|
$data = FormKriteria::orderBy('page_number','ASC')->where('tahun',date('Y'))->get();
|
||||||
$_data = [];
|
$_data = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -100,6 +100,7 @@ class FormKriteriaController extends Controller
|
||||||
$insert->page_number = $request->page_number;
|
$insert->page_number = $request->page_number;
|
||||||
$insert->key = $request->key;
|
$insert->key = $request->key;
|
||||||
$insert->kategori = $request->kategori;
|
$insert->kategori = $request->kategori;
|
||||||
|
$insert->keterangan = $request->keterangan;
|
||||||
$insert->judul = $request->judul;
|
$insert->judul = $request->judul;
|
||||||
$insert->type = $request->type;
|
$insert->type = $request->type;
|
||||||
$insert->option = json_encode($request->jawaban);
|
$insert->option = json_encode($request->jawaban);
|
||||||
|
|
@ -107,6 +108,7 @@ class FormKriteriaController extends Controller
|
||||||
$insert->judul_lainnya = $request->judul_lainnya;
|
$insert->judul_lainnya = $request->judul_lainnya;
|
||||||
$insert->number_answer_lainnya = $request->number_answer_lainnya;
|
$insert->number_answer_lainnya = $request->number_answer_lainnya;
|
||||||
$insert->active = 1;
|
$insert->active = 1;
|
||||||
|
$insert->tahun = date('Y');
|
||||||
$insert->save();
|
$insert->save();
|
||||||
|
|
||||||
logActivity($request, __('Create',['val' => strtolower(__('Title',['val' => 'Form Kriteria']))]));
|
logActivity($request, __('Create',['val' => strtolower(__('Title',['val' => 'Form Kriteria']))]));
|
||||||
|
|
@ -115,6 +117,7 @@ class FormKriteriaController extends Controller
|
||||||
$insert->page_number = $request->page_number;
|
$insert->page_number = $request->page_number;
|
||||||
$insert->key = $request->key;
|
$insert->key = $request->key;
|
||||||
$insert->kategori = $request->kategori;
|
$insert->kategori = $request->kategori;
|
||||||
|
$insert->keterangan = $request->keterangan;
|
||||||
$insert->judul = $request->judul;
|
$insert->judul = $request->judul;
|
||||||
$insert->type = $request->type;
|
$insert->type = $request->type;
|
||||||
$insert->option = json_encode($request->jawaban);
|
$insert->option = json_encode($request->jawaban);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ use App\Models\Kuesioner;
|
||||||
use App\Models\Master\FormKriteria;
|
use App\Models\Master\FormKriteria;
|
||||||
use App\Models\Master\Sekolah;
|
use App\Models\Master\Sekolah;
|
||||||
use App\Models\Penilaian;
|
use App\Models\Penilaian;
|
||||||
|
use App\Models\PenilaianFile;
|
||||||
use App\Models\KuesionerLog;
|
use App\Models\KuesionerLog;
|
||||||
use App\Models\DokumenAdministrasi;
|
use App\Models\DokumenAdministrasi;
|
||||||
|
|
||||||
|
|
@ -65,7 +66,7 @@ class KriteriaController extends Controller
|
||||||
$data['title'] = $this->title;
|
$data['title'] = $this->title;
|
||||||
$data['route'] = $this->route;
|
$data['route'] = $this->route;
|
||||||
$data['kuesioner'] = $kuesioner;
|
$data['kuesioner'] = $kuesioner;
|
||||||
$data['page'] = FormKriteria::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->toArray();
|
$data['page'] = FormKriteria::select('page_number')->groupBy('page_number')->where('tahun',tahunKuesioner($kuesioner->KuesionerId))->orderBy('page_number','ASC')->pluck('page_number')->toArray();
|
||||||
|
|
||||||
return view($this->template.'.form',$data);
|
return view($this->template.'.form',$data);
|
||||||
}
|
}
|
||||||
|
|
@ -96,12 +97,14 @@ class KriteriaController extends Controller
|
||||||
|
|
||||||
return view($this->template.'.progress',$data);
|
return view($this->template.'.progress',$data);
|
||||||
}
|
}
|
||||||
public function store(Request $request)
|
public function store2026(Request $request)
|
||||||
{
|
{
|
||||||
// dd($request);
|
// dd($request);
|
||||||
$data = $request['data'];
|
$data = $request->all();
|
||||||
$_value = [];
|
$_value = [];
|
||||||
|
|
||||||
|
$kuesioner = decode_id($data['secure_id']);
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
if (strpos($key, 'input_') === 0) {
|
if (strpos($key, 'input_') === 0) {
|
||||||
$_value[$key] = $value;
|
$_value[$key] = $value;
|
||||||
|
|
@ -245,45 +248,138 @@ class KriteriaController extends Controller
|
||||||
$idSekolah = session('sekolah_id');
|
$idSekolah = session('sekolah_id');
|
||||||
$sekolah = Sekolah::find($idSekolah);
|
$sekolah = Sekolah::find($idSekolah);
|
||||||
}
|
}
|
||||||
// dd(request()->all());
|
|
||||||
|
// dd(request()->input_upload_files,request()->all());
|
||||||
|
|
||||||
if($key == 'input_upload_files'){
|
if($key == 'input_upload_files'){
|
||||||
|
|
||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
|
|
||||||
if(is_array($value)){
|
if(is_array($value)){
|
||||||
foreach ($value as $file) {
|
$old = Penilaian::where('key','upload_files')->where('page_number',decode_id($data['key']))->where('ms_sekolah_id',$idSekolah)->first();
|
||||||
$tempPath = storage_path('app/tmp_uploads/' . $file);
|
$oldFiles = json_decode($old->value ?? '[]', true);
|
||||||
|
if (!is_array($oldFiles)) {
|
||||||
|
$oldFiles = [];
|
||||||
|
}
|
||||||
|
foreach ($value as $k => $file) {
|
||||||
|
|
||||||
|
$destinationPath = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
|
$path = $destinationPath;
|
||||||
|
$fileName = $file->getClientOriginalName();
|
||||||
|
$fileMime = $file->getClientMimeType();
|
||||||
|
$fileExtension = $file->getClientOriginalExtension();
|
||||||
|
$fileSize = $file->getSize();
|
||||||
|
|
||||||
|
$newFilename = $idSekolah.'_'.session('uid').'_'.uniqid('file_') . '.' . $fileExtension;
|
||||||
|
|
||||||
if (file_exists($tempPath)) {
|
|
||||||
$path = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
|
||||||
if (!File::exists($path)) {
|
if (!File::exists($path)) {
|
||||||
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/'.$file;
|
$newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/' . $newFilename;
|
||||||
copy($tempPath, public_path($newPath));
|
$uploaded = $file->move($path, $newFilename);
|
||||||
$filePaths[] = $newPath;
|
$filePaths[] = $newPath;
|
||||||
|
|
||||||
|
$insertFile[$k] = PenilaianFile::updateOrCreate([
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][$k],
|
||||||
|
'key_option' => $k,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
],[
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][$k],
|
||||||
|
'key_option' => $k,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'value' => $newPath,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $tempPath = storage_path('app/tmp_uploads/' . $file);
|
||||||
|
// // dd($tempPath);
|
||||||
|
|
||||||
|
// if (file_exists($tempPath)) {
|
||||||
|
// $path = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
|
// if (!File::exists($path)) {
|
||||||
|
// File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/'.$file;
|
||||||
|
// copy($tempPath, public_path($newPath));
|
||||||
|
// $filePaths[] = $newPath;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// $value = array_values(array_unique(
|
||||||
|
// array_merge($oldFiles, $filePaths)
|
||||||
|
// ));
|
||||||
}else{
|
}else{
|
||||||
$tempPath = storage_path('app/tmp_uploads/' . $value);
|
|
||||||
|
|
||||||
if (file_exists($tempPath)) {
|
$destinationPath = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
$path = 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)) {
|
if (!File::exists($path)) {
|
||||||
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/'.$value;
|
$newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/' . $newFilename;
|
||||||
copy($tempPath, public_path($newPath));
|
$uploaded = $value->move($path, $newFilename);
|
||||||
$filePaths[] = $newPath;
|
$filePaths[] = $newPath;
|
||||||
}
|
// dd($data['input_upload_files_label']);
|
||||||
|
|
||||||
|
$insertFile = PenilaianFile::updateOrCreate([
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][0],
|
||||||
|
'key_option' => 0,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
],[
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][0],
|
||||||
|
'key_option' => 0,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'value' => $newPath,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $tempPath = storage_path('app/tmp_uploads/' . $value);
|
||||||
|
|
||||||
|
// if (file_exists($tempPath)) {
|
||||||
|
// $path = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
|
// if (!File::exists($path)) {
|
||||||
|
// File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/'.$value;
|
||||||
|
// copy($tempPath, public_path($newPath));
|
||||||
|
// $filePaths[] = $newPath;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $value = $filePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $filePaths;
|
|
||||||
|
|
||||||
|
|
||||||
|
// dd($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$nilai_kota = Penilaian::where('ms_sekolah_id',$idSekolah)
|
$nilai_kota = Penilaian::where('ms_sekolah_id',$idSekolah)
|
||||||
->where('page_number',decode_id($data['key']))
|
->where('page_number',decode_id($data['key']))
|
||||||
->where('skor','!=',0)
|
->where('skor','!=',0)
|
||||||
|
|
@ -298,10 +394,6 @@ class KriteriaController extends Controller
|
||||||
->where('status',2) //inputan kota
|
->where('status',2) //inputan kota
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$kuesioner = decode_id($data['secure_id']);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$penilaian[$key] = Penilaian::updateOrCreate([
|
$penilaian[$key] = Penilaian::updateOrCreate([
|
||||||
'kuesioner_id' => $kuesioner,
|
'kuesioner_id' => $kuesioner,
|
||||||
'tahun' => date('Y'),
|
'tahun' => date('Y'),
|
||||||
|
|
@ -324,7 +416,332 @@ class KriteriaController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['status' => true,'data' => $_value,'message' => 'Berhasil Update Data','page' => $data['key'],'nilai_kota' => @$nilai_kota ? @$nilai_kota->skor : 0,
|
return response()->json(['status' => true,'data' => $_value,'message' => 'Berhasil Update Data','page' => $data['key'],'page_number' => decode_id($data['key']),'nilai_kota' => @$nilai_kota ? @$nilai_kota->skor : 0,
|
||||||
|
'nilai_prov' => @$nilai_prov ? @$nilai_prov->skor : 0]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store2025(Request $request)
|
||||||
|
{
|
||||||
|
// dd($request);
|
||||||
|
$data = $request->all();
|
||||||
|
$_value = [];
|
||||||
|
|
||||||
|
$kuesioner = decode_id($data['secure_id']);
|
||||||
|
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if (strpos($key, 'input_') === 0) {
|
||||||
|
$_value[$key] = $value;
|
||||||
|
|
||||||
|
if($key == 'input_unsur_warga_partisipasi'){
|
||||||
|
$skor = hitungSkor(str_replace('input_','','input_unsur_warga_partisipasi'),$value,$data['input_lainnya']);
|
||||||
|
}elseif($key == 'input_jumlah_timbulan'){
|
||||||
|
$sebelum = $data['input_jumlah_timbulan'];
|
||||||
|
$sekarang = $data['input_ratarata_jumlah_timbulan'];
|
||||||
|
$pengurangan = $sebelum - $sekarang;
|
||||||
|
$persentase = ($pengurangan / $sebelum) * 100;
|
||||||
|
if($persentase > 80){
|
||||||
|
$skor = 5;
|
||||||
|
}elseif(($persentase > 60) || ($persentase <= 80)){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif(($persentase > 40) || ($persentase <= 60)){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif(($persentase > 20) || ($persentase <= 40)){
|
||||||
|
$skor = 2;
|
||||||
|
}else{
|
||||||
|
$skor = 1;
|
||||||
|
}
|
||||||
|
}elseif($key == 'input_jumlah_rpp'){
|
||||||
|
|
||||||
|
$rpp = $data['input_jumlah_rpp'];
|
||||||
|
$sekolah = $data['input_tingkat_pendidikan'];
|
||||||
|
|
||||||
|
//SMP dan SMA
|
||||||
|
if(($sekolah == 'SMP/sederajat') || ($sekolah == 'SMA/sederajat')){
|
||||||
|
if($rpp == 1){
|
||||||
|
$skor = 1;
|
||||||
|
}elseif($rpp == 2){
|
||||||
|
$skor = 2;
|
||||||
|
}elseif($rpp == 3){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif($rpp == 4){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif($rpp == 5){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif($rpp == 6){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif($rpp >= 7){
|
||||||
|
$skor = 5;
|
||||||
|
}else{
|
||||||
|
$skor = 0;
|
||||||
|
}
|
||||||
|
}else{ //SD
|
||||||
|
if($rpp == 1){
|
||||||
|
$skor = 1;
|
||||||
|
}elseif($rpp == 2){
|
||||||
|
$skor = 2;
|
||||||
|
}elseif($rpp == 3){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif($rpp == 4){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif($rpp >= 5){
|
||||||
|
$skor = 5;
|
||||||
|
}else{
|
||||||
|
$skor = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}elseif($key == 'input_jumlah_pohon'){
|
||||||
|
$pohon = $data['input_jumlah_pohon'];
|
||||||
|
$warga = $data['input_jumlah_warga_sekolah'];
|
||||||
|
$persentase = ($pohon / $warga) * 100;
|
||||||
|
|
||||||
|
if($persentase > 80){
|
||||||
|
$skor = 5;
|
||||||
|
}elseif(($persentase > 60) || ($persentase <= 80)){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif(($persentase > 40) || ($persentase <= 60)){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif(($persentase > 20) || ($persentase <= 40)){
|
||||||
|
$skor = 2;
|
||||||
|
}else{
|
||||||
|
$skor = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}elseif($key == 'input_jumlah_kader'){
|
||||||
|
$kader = $data['input_jumlah_kader'];
|
||||||
|
$pesertadidik = $data['input_jumlah_peserta_didik'];
|
||||||
|
$persentase = ($kader / $pesertadidik) * 100;
|
||||||
|
// dd($persentase);
|
||||||
|
|
||||||
|
if($persentase > 20){
|
||||||
|
$skor = 5;
|
||||||
|
}elseif($persentase > 15){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif($persentase > 10){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif($persentase > 5){
|
||||||
|
$skor = 2;
|
||||||
|
}else{
|
||||||
|
$skor = 1;
|
||||||
|
}
|
||||||
|
}elseif($key == 'input_rencana_kegiatan_pblhs'){
|
||||||
|
|
||||||
|
$rencana = $data['input_rencana_kegiatan_pblhs'];
|
||||||
|
$jumlahKegiatan = $data['input_jumlah_rencana_kegiatan_pblhs'];
|
||||||
|
$persentase = ($rencana / $jumlahKegiatan) * 100;
|
||||||
|
|
||||||
|
if($persentase > 80){
|
||||||
|
$skor = 5;
|
||||||
|
}elseif($persentase > 60){
|
||||||
|
$skor = 4;
|
||||||
|
}elseif($persentase > 40){
|
||||||
|
$skor = 3;
|
||||||
|
}elseif($persentase > 20){
|
||||||
|
$skor = 2;
|
||||||
|
}else{
|
||||||
|
$skor = 1;
|
||||||
|
}
|
||||||
|
}elseif($key == 'input_kondisi_kebersihan'){
|
||||||
|
$kebersihan = $data['input_kondisi_kebersihan'];
|
||||||
|
$drainase = $data['input_kondisi_drainase'];
|
||||||
|
|
||||||
|
if ($kebersihan == "Bersih" && $drainase == "Bersih") {
|
||||||
|
$skor = 3; // Lingkungan bersih dan drainase berfungsi
|
||||||
|
} elseif (($kebersihan == "Bersih" && $drainase == "Kurang Bersih") || ($kebersihan == "Kurang Bersih" && $drainase == "Bersih")) {
|
||||||
|
$skor = 2; // Salah satu kondisi kurang baik
|
||||||
|
} else {
|
||||||
|
$skor = 1; // Lingkungan kurang bersih dan drainase tidak berfungsi
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$skor = hitungSkor(str_replace('input_','',$key),$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(session('group_alias') == 'sekolah'){
|
||||||
|
$status = 0;
|
||||||
|
}elseif(session('group_alias') == 'penilai_kota'){
|
||||||
|
$status = 1;
|
||||||
|
}elseif(session('group_alias') == 'penilai_provinsi'){
|
||||||
|
$status = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(@$request['sekolah']){
|
||||||
|
$idSekolah = decode_id(@$request['sekolah']);
|
||||||
|
$sekolah = Sekolah::find($idSekolah);
|
||||||
|
}else{
|
||||||
|
$idSekolah = session('sekolah_id');
|
||||||
|
$sekolah = Sekolah::find($idSekolah);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd(request()->input_upload_files,request()->all());
|
||||||
|
|
||||||
|
if($key == 'input_upload_files'){
|
||||||
|
|
||||||
|
$filePaths = [];
|
||||||
|
|
||||||
|
if(is_array($value)){
|
||||||
|
$old = Penilaian::where('key','upload_files')->where('page_number',decode_id($data['key']))->where('ms_sekolah_id',$idSekolah)->first();
|
||||||
|
$oldFiles = json_decode($old->value ?? '[]', true);
|
||||||
|
if (!is_array($oldFiles)) {
|
||||||
|
$oldFiles = [];
|
||||||
|
}
|
||||||
|
foreach ($value as $k => $file) {
|
||||||
|
|
||||||
|
$destinationPath = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
|
$path = $destinationPath;
|
||||||
|
$fileName = $file->getClientOriginalName();
|
||||||
|
$fileMime = $file->getClientMimeType();
|
||||||
|
$fileExtension = $file->getClientOriginalExtension();
|
||||||
|
$fileSize = $file->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 = $file->move($path, $newFilename);
|
||||||
|
$filePaths[] = $newPath;
|
||||||
|
|
||||||
|
$insertFile[$k] = PenilaianFile::updateOrCreate([
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][$k],
|
||||||
|
'key_option' => $k,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
],[
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][$k],
|
||||||
|
'key_option' => $k,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'value' => $newPath,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $tempPath = storage_path('app/tmp_uploads/' . $file);
|
||||||
|
// // dd($tempPath);
|
||||||
|
|
||||||
|
// if (file_exists($tempPath)) {
|
||||||
|
// $path = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
|
// if (!File::exists($path)) {
|
||||||
|
// File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/'.$file;
|
||||||
|
// copy($tempPath, public_path($newPath));
|
||||||
|
// $filePaths[] = $newPath;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// $value = array_values(array_unique(
|
||||||
|
// array_merge($oldFiles, $filePaths)
|
||||||
|
// ));
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$filePaths[] = $newPath;
|
||||||
|
// dd($data['input_upload_files_label']);
|
||||||
|
|
||||||
|
$insertFile = PenilaianFile::updateOrCreate([
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][0],
|
||||||
|
'key_option' => 0,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
],[
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $idSekolah,
|
||||||
|
'key' => $data['input_upload_files_label'][0],
|
||||||
|
'key_option' => 0,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'value' => $newPath,
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// $tempPath = storage_path('app/tmp_uploads/' . $value);
|
||||||
|
|
||||||
|
// if (file_exists($tempPath)) {
|
||||||
|
// $path = public_path('uploads/kriteria/' . date('Y').'/'.$idSekolah . '/' .decode_id($data['key']) );
|
||||||
|
// if (!File::exists($path)) {
|
||||||
|
// File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $newPath = 'uploads/kriteria/'.date('Y').'/'.$idSekolah.'/'.decode_id($data['key']).'/'.$value;
|
||||||
|
// copy($tempPath, public_path($newPath));
|
||||||
|
// $filePaths[] = $newPath;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $value = $filePaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// dd($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$nilai_kota = Penilaian::where('ms_sekolah_id',$idSekolah)
|
||||||
|
->where('page_number',decode_id($data['key']))
|
||||||
|
->where('skor','!=',0)
|
||||||
|
->where('tahun',date('Y'))
|
||||||
|
->where('status',1) //inputan kota
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$nilai_prov = Penilaian::where('ms_sekolah_id',$idSekolah)
|
||||||
|
->where('page_number',decode_id($data['key']))
|
||||||
|
->where('skor','!=',0)
|
||||||
|
->where('tahun',date('Y'))
|
||||||
|
->where('status',2) //inputan kota
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$penilaian[$key] = Penilaian::updateOrCreate([
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
'ms_sekolah_id' => $sekolah->MsSekolahId,
|
||||||
|
'npsn' => $sekolah->npsn,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'key' => str_replace('input_','',$key),
|
||||||
|
'status' => $status,
|
||||||
|
],[
|
||||||
|
'kuesioner_id' => $kuesioner,
|
||||||
|
'ms_sekolah_id' => $sekolah->MsSekolahId,
|
||||||
|
'npsn' => $sekolah->npsn,
|
||||||
|
'page_number' => decode_id($data['key']),
|
||||||
|
'key' => str_replace('input_','',$key),
|
||||||
|
'value' => json_encode($value),
|
||||||
|
'skor' => $skor,
|
||||||
|
'tahun' => date('Y'),
|
||||||
|
'created_by' => auth()->user()->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => true,'data' => $_value,'message' => 'Berhasil Update Data','page' => $data['key'],'page_number' => decode_id($data['key']),'nilai_kota' => @$nilai_kota ? @$nilai_kota->skor : 0,
|
||||||
'nilai_prov' => @$nilai_prov ? @$nilai_prov->skor : 0]);
|
'nilai_prov' => @$nilai_prov ? @$nilai_prov->skor : 0]);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -358,4 +775,12 @@ class KriteriaController extends Controller
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deletFile($id,$pagenumber) {
|
||||||
|
|
||||||
|
$file = PenilaianFile::find(decode_id($id));
|
||||||
|
$file->delete();
|
||||||
|
|
||||||
|
return response()->json(['status' => true,'message' => 'Data Berhasil Di Update','type' => 'success','page' =>decode_id($pagenumber)]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class PenilaianFile extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $table = 'penilaian_file';
|
||||||
|
protected $guarded = [];
|
||||||
|
protected $primaryKey = 'PenilaianFileId';
|
||||||
|
|
||||||
|
public function sekolah()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\App\Models\Master\Sekolah::class,'ms_sekolah_id','MsSekolahId');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function page()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\App\Models\Master\FormKriteria::class,'page_number','page_number');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,8 @@ return new class extends Migration
|
||||||
$table->string('judul_lainnya')->nullable();
|
$table->string('judul_lainnya')->nullable();
|
||||||
$table->integer('number_answer_lainnya')->nullable();
|
$table->integer('number_answer_lainnya')->nullable();
|
||||||
$table->integer('active')->default(0);
|
$table->integer('active')->default(0);
|
||||||
|
$table->year('tahun')->nullable();
|
||||||
|
$table->text('keterangan')->nullable();
|
||||||
$table->timestampsTz();
|
$table->timestampsTz();
|
||||||
$table->softDeletesTz();
|
$table->softDeletesTz();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('penilaian_file', function (Blueprint $table) {
|
||||||
|
$table->id('PenilaianFileId');
|
||||||
|
$table->integer('kuesioner_id');
|
||||||
|
$table->integer('ms_sekolah_id');
|
||||||
|
$table->string('key')->nullable();
|
||||||
|
$table->string('key_option')->nullable();
|
||||||
|
$table->integer('page_number');
|
||||||
|
$table->text('value')->nullable();
|
||||||
|
$table->year('tahun')->nullable();
|
||||||
|
$table->integer('created_by');
|
||||||
|
$table->timestampsTz();
|
||||||
|
$table->softdeletesTz();
|
||||||
|
|
||||||
|
$table->foreign('created_by')->references('id')->on('users')->cascadeOnDelete();
|
||||||
|
$table->foreign('ms_sekolah_id')->references('MsSekolahId')->on('ms_sekolah')->cascadeOnDelete();
|
||||||
|
$table->foreign('kuesioner_id')->references('KuesionerId')->on('kuesioner')->cascadeOnDelete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('penilaian_files');
|
||||||
|
}
|
||||||
|
};
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,15 @@
|
||||||
$jumlah = json_decode(@$profile->data_jumlah);
|
$jumlah = json_decode(@$profile->data_jumlah);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@if(@$dok->status == 1)
|
||||||
|
<div class="card mb-2 bg-success-light text-success">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="fw-500"><i class="fal fa-info-circle"></i> Verifikasi Kuesioner Leveling</h4>
|
||||||
|
<p>Kuesioner Anda telah di-approve dan dinyatakan valid. Silakan melanjutkan ke tahapan berikutnya.</p>
|
||||||
|
<a href="{{ url('usulan/adiwiyata/kriteria') }}" class="btn btn-info">Pemenuhan Kriteria <i class="fal fa-arrow-right"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-6 mb-2">
|
<div class="col-md-6 mb-2">
|
||||||
<div class="card h-100">
|
<div class="card h-100">
|
||||||
|
|
@ -173,9 +182,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-2">
|
<div class="col-md-6 mb-2">
|
||||||
<div class="card h-100">
|
<div class="card h-100">
|
||||||
<div class="card-header bg-primary-light text-primary">
|
{{-- <div class="card-header bg-primary-light text-primary">
|
||||||
<h5 class="fw-500 mb-0"><i class="fal fa-trophy"></i> Riwayat Usulan</h5>
|
<h5 class="fw-500 mb-0"><i class="fal fa-trophy"></i> Riwayat Usulan</h5>
|
||||||
</div>
|
</div> --}}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="">
|
<div class="">
|
||||||
@if(@$kuesioner || (@$kuesioner->status == 1))
|
@if(@$kuesioner || (@$kuesioner->status == 1))
|
||||||
|
|
@ -190,88 +199,68 @@
|
||||||
$textLevel = 'Mandiri';
|
$textLevel = 'Mandiri';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="alert bg-success-light text-success mb-3">
|
<div class="alert bg-primary-light text-primary mb-3">
|
||||||
Sekolah diusulan untuk menjadi CSA (Calon Sekolah Adiwiyata) {{@$textLevel}}
|
<i class="fal fa-info-circle"></i> Sekolah diusulan untuk menjadi CSA (Calon Sekolah Adiwiyata) {{@$textLevel}}
|
||||||
</div>
|
</div>
|
||||||
@else
|
<h5 class="fw-500 mb-3"><i class="fal fa-trophy"></i> Riwayat Usulan</h5>
|
||||||
<div class="alert alert-danger">
|
<div class="d-flex flex-column gap-2">
|
||||||
Belum ada data usulan
|
<div class="d-flex justify-content-between">
|
||||||
|
<div>Status Usulan</div>
|
||||||
|
<div>{!! kuesionerLogStatus(@$kuesioner->KuesionerId) !!}</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
<div class="d-flex justify-content-between">
|
||||||
</div>
|
<div>Penghargaan Terakhir</div>
|
||||||
<div class="d-none">
|
<div>
|
||||||
<ul class="liststyle">
|
|
||||||
<li>
|
|
||||||
<div class="d-flex gap-2 flex-row">
|
|
||||||
<div class="bg-success-light rounded-circle p-1"><i class="fal fa-check text-success"></i></div>
|
|
||||||
<div>Pendaftaran</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="d-flex gap-2 flex-row">
|
|
||||||
<div class="bg-primary-light rounded-circle p-1"><i class="fal fa-recycle text-primary"></i></div>
|
|
||||||
<div>Pengajuan</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="d-flex gap-2 flex-row">
|
|
||||||
<div class="bg-secondary rounded-circle p-1"><i class="fal fa-clock"></i></div>
|
|
||||||
<div class="text-muted">Verifikasi</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@if(@$kuesioner)
|
|
||||||
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<tr class="bg-success text-white">
|
|
||||||
<th><b>Status Usulan</b></th>
|
|
||||||
<th><b>Penghargaan Terakhir</b></th>
|
|
||||||
<th><b>Tanggal Penetapan SK</b></th>
|
|
||||||
<th><b>Lampiran SK</b></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="vertical-align: middle;">
|
|
||||||
{!! kuesionerLogStatus(@$kuesioner->KuesionerId) !!}
|
|
||||||
{{-- <span class="badge badge-warning">{{str_replace('_',' ',\Str::title($log->step))}}</span> --}}
|
|
||||||
</td>
|
|
||||||
<td style="vertical-align: middle;">
|
|
||||||
@if(@getPenghargaanTerakhir(session('sekolah_id')) == 'Belum Pernah')
|
@if(@getPenghargaanTerakhir(session('sekolah_id')) == 'Belum Pernah')
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(@$sk->jenis_usulan == 0){
|
if(@$sk->jenis_usulan == 0){
|
||||||
$penghargaan = '<span>Belum Pernah</span>';
|
$penghargaan = '<span class="badge bg-success text-white">Belum Pernah</span>';
|
||||||
}elseif(@$sk->jenis_usulan == 1){
|
}elseif(@$sk->jenis_usulan == 1){
|
||||||
$penghargaan = '<span>Adiwiyata Kab/Kota</span>';
|
$penghargaan = '<span class="badge bg-success text-white">Adiwiyata Kab/Kota</span>';
|
||||||
}elseif(@$sk->jenis_usulan == 2){
|
}elseif(@$sk->jenis_usulan == 2){
|
||||||
$penghargaan = '<span>Adiwiyata Provinsi</span>';
|
$penghargaan = '<span class="badge bg-success text-white">Adiwiyata Provinsi</span>';
|
||||||
}elseif(@$sk->jenis_usulan == 3){
|
}elseif(@$sk->jenis_usulan == 3){
|
||||||
$penghargaan = '<span>Adiwiyata Nasional</span>';
|
$penghargaan = '<span class="badge bg-success text-white">Adiwiyata Nasional</span>';
|
||||||
}elseif(@$sk->jenis_usulan == 4){
|
}elseif(@$sk->jenis_usulan == 4){
|
||||||
$penghargaan = '<span>Adiwiyata Mandiri</span>';
|
$penghargaan = '<span class="badge bg-success text-white">Adiwiyata Mandiri</span>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
{!!$penghargaan!!}
|
{!!$penghargaan!!}
|
||||||
@else
|
@else
|
||||||
{{@getPenghargaanTerakhir(session('sekolah_id'))}}
|
{{@getPenghargaanTerakhir(session('sekolah_id'))}}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</div>
|
||||||
<td style="vertical-align: middle;">{{@$sk->tanggal_penetapan}}</td>
|
</div>
|
||||||
<td style="vertical-align: middle;">
|
<div class="d-flex justify-content-between">
|
||||||
|
<div>Tanggal Penetapan SK</div>
|
||||||
|
<div>{{@$sk ? @$sk->tanggal_penetapan : '-'}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div>Lampiran SK</div>
|
||||||
|
<div>
|
||||||
@if(@$sk)
|
@if(@$sk)
|
||||||
<a download href="{{ asset('uploads/'.@$sk->file) }}" class="btn btn-sm btn-warning" style="width: 100%;"><i class="fal fa-download"></i> SK Adiwiyata</a>
|
<a download href="{{ asset('uploads/'.@$sk->file) }}" class="btn btn-sm btn-warning" style="width: 100%;"><i class="fal fa-download"></i> SK Adiwiyata</a>
|
||||||
|
@else
|
||||||
|
-
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="alert alert-danger text-danger">
|
||||||
|
<i class="fal fa-info-circle"></i> Belum ada data usulan
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@section('page-js')
|
@section('page-js')
|
||||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
<script src="{{ asset('assets/js/highcharts.js') }}"></script>
|
||||||
<script>
|
<script>
|
||||||
let series = @json($series);
|
let series = @json($series);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@
|
||||||
<div class="col-12 pr-1">
|
<div class="col-12 pr-1">
|
||||||
<select name="kategori" class="form-control form-control-sm @error('kategori') is-invalid @enderror" required>
|
<select name="kategori" class="form-control form-control-sm @error('kategori') is-invalid @enderror" required>
|
||||||
<option value="">-- Pilih Kategori --</option>
|
<option value="">-- Pilih Kategori --</option>
|
||||||
|
<option {{@$item->kategori == 'I' ? 'selected' : ''}} value="I">I</option>
|
||||||
|
<option {{@$item->kategori == 'II' ? 'selected' : ''}} value="II">II</option>
|
||||||
|
<option {{@$item->kategori == 'III' ? 'selected' : ''}} value="III">III</option>
|
||||||
|
<option {{@$item->kategori == 'IV' ? 'selected' : ''}} value="IV">IV</option>
|
||||||
<option {{@$item->kategori == 'I.Perencanaan Gerakan PBLHS' ? 'selected' : ''}} value="I.Perencanaan Gerakan PBLHS">I.Perencanaan Gerakan PBLHS</option>
|
<option {{@$item->kategori == 'I.Perencanaan Gerakan PBLHS' ? 'selected' : ''}} value="I.Perencanaan Gerakan PBLHS">I.Perencanaan Gerakan PBLHS</option>
|
||||||
<option {{@$item->kategori == 'II.Pelaksanaan Gerakan PBLHS' ? 'selected' : ''}} value="II.Pelaksanaan Gerakan PBLHS">II.Pelaksanaan Gerakan PBLHS</option>
|
<option {{@$item->kategori == 'II.Pelaksanaan Gerakan PBLHS' ? 'selected' : ''}} value="II.Pelaksanaan Gerakan PBLHS">II.Pelaksanaan Gerakan PBLHS</option>
|
||||||
<option {{@$item->kategori == 'III.Pemantauan dan Evaluasi Gerakan PBLHS' ? 'selected' : ''}} value="III.Pemantauan dan Evaluasi Gerakan PBLHS">III.Pemantauan dan Evaluasi Gerakan PBLHS</option>
|
<option {{@$item->kategori == 'III.Pemantauan dan Evaluasi Gerakan PBLHS' ? 'selected' : ''}} value="III.Pemantauan dan Evaluasi Gerakan PBLHS">III.Pemantauan dan Evaluasi Gerakan PBLHS</option>
|
||||||
|
|
@ -82,6 +86,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12 mb-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Keterangan</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<textarea name="keterangan" class="form-control form-control-sm @error('keterangan') is-invalid @enderror" id="" cols="30" rows="10">{{@$item->keterangan}}</textarea>
|
||||||
|
@error('keterangan')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$hide = '';
|
$hide = '';
|
||||||
if(@$item){
|
if(@$item){
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="pageNumber row gap-1 justify-content-center">
|
<div class="pageNumber row gap-1 justify-content-center">
|
||||||
@foreach($page as $hal)
|
@foreach($page as $hal)
|
||||||
<div class="col-3 text-center page {{ (checkPenilaian($hal) == true ? 'bg-success-light text-success border-success rounded' : 'border-secondary rounded' )}}" data-number={{$hal}}>
|
<div class="col-3 text-center page {{ (checkPenilaian($hal,null,null,$kuesioner->KuesionerId) == true ? 'bg-success-light text-success border-success rounded' : 'border-secondary rounded' )}}" data-number={{$hal}}>
|
||||||
<span>{{$hal}}</span>
|
<span>{{$hal}}</span>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
@ -93,7 +93,7 @@
|
||||||
<img src="{{ asset('assets/spinner.gif') }}" alt="Loading..." width="20">
|
<img src="{{ asset('assets/spinner.gif') }}" alt="Loading..." width="20">
|
||||||
</div>
|
</div>
|
||||||
<div class="changeForm">
|
<div class="changeForm">
|
||||||
{!! formKriteria(1) !!}
|
{!! formKriteria(1,null,null,tahunKuesioner($kuesioner->KuesionerId)) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
@ -167,6 +167,7 @@
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).on('change', '.checklistInput[type="radio"]', function () {
|
$(document).on('change', '.checklistInput[type="radio"]', function () {
|
||||||
const value = $(this).data('value');
|
const value = $(this).data('value');
|
||||||
|
|
@ -180,8 +181,8 @@
|
||||||
<div class="mb-3 file-item" id="file_${value}">
|
<div class="mb-3 file-item" id="file_${value}">
|
||||||
<label class="fw-500">Upload Dokumen ${label}</label>
|
<label class="fw-500">Upload Dokumen ${label}</label>
|
||||||
<input type="hidden" name="input_upload_files_label[]" value="${value}">
|
<input type="hidden" name="input_upload_files_label[]" value="${value}">
|
||||||
<input type="file" name="input_upload_files[]" class="removeFormKriteria is-required form-control">
|
<input type="file" accept=".pdf,.png,.jpeg,.jpg" name="input_upload_files" class="removeFormKriteria is-required form-control">
|
||||||
<span><i>Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg</i></span>
|
<span class="text-danger"><i>Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg</i></span>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
@ -199,7 +200,7 @@
|
||||||
<div class="mb-3 file-item" id="file_${value}">
|
<div class="mb-3 file-item" id="file_${value}">
|
||||||
<label class="fw-500">Upload Dokumen ${label}</label>
|
<label class="fw-500">Upload Dokumen ${label}</label>
|
||||||
<input type="hidden" name="input_upload_files_label[]" value="${value}">
|
<input type="hidden" name="input_upload_files_label[]" value="${value}">
|
||||||
<input type="file" name="input_upload_files[]" class="removeFormKriteria is-required form-control">
|
<input type="file" accept=".pdf,.png,.jpeg,.jpg" name="input_upload_files[]" class="removeFormKriteria is-required form-control">
|
||||||
<span><i>Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg</i></span>
|
<span><i>Ukuran Maksimal File : 10MB, Ekstension File : .pdf,.png,.jpeg,.jpg</i></span>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
|
|
@ -209,14 +210,9 @@
|
||||||
$('#file_' + value).remove();
|
$('#file_' + value).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.page').on('click',function(e){
|
|
||||||
e.preventDefault();
|
|
||||||
let number = $(this).data('number');
|
|
||||||
let base_url = "{{url('/')}}";
|
|
||||||
// Tambahkan kelas active dan hapus dari yang lain
|
|
||||||
$('.page').removeClass('bg-primary-light border-primary text-primary');
|
|
||||||
$(this).addClass('bg-primary-light border-primary text-primary');
|
|
||||||
|
|
||||||
|
function getForm(number){
|
||||||
|
let base_url = "{{url('/')}}";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: base_url+'/getForm', // Ganti dengan URL API-mu
|
url: base_url+'/getForm', // Ganti dengan URL API-mu
|
||||||
type: 'POST', // Bisa juga 'POST' kalau perlu
|
type: 'POST', // Bisa juga 'POST' kalau perlu
|
||||||
|
|
@ -225,7 +221,8 @@
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
_token:'{{csrf_token()}}',
|
_token:'{{csrf_token()}}',
|
||||||
page: number
|
page: number,
|
||||||
|
kuesionerId: '{{ $kuesioner->KuesionerId }}'
|
||||||
}, // Kirim number sebagai parameter
|
}, // Kirim number sebagai parameter
|
||||||
dataType: 'json', // Format respons JSON
|
dataType: 'json', // Format respons JSON
|
||||||
beforeSend: function () {
|
beforeSend: function () {
|
||||||
|
|
@ -240,58 +237,49 @@
|
||||||
$('.numberInput').on('input', function() {
|
$('.numberInput').on('input', function() {
|
||||||
this.value = this.value.replace(/[^0-9]/g, ''); // Hanya angka 0-9
|
this.value = this.value.replace(/[^0-9]/g, ''); // Hanya angka 0-9
|
||||||
});
|
});
|
||||||
const myDropzone = new Dropzone(".dropzone", {
|
|
||||||
url: "{{ url('uploadTemp') }}", // URL ke controller kamu
|
$('.btnDeletFile').on('click',function(){
|
||||||
method: "POST",
|
var base_url = $(this).attr('data-href');
|
||||||
|
var id = $(this).attr('data-id');
|
||||||
|
swal({
|
||||||
|
title: "Hapus File!",
|
||||||
|
text: "Apa anda yakin ingin hapus Dokumen ini ?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#BF3131",
|
||||||
|
confirmButtonText: "Hapus Sekarang",
|
||||||
|
cancelButtonText: "Batal",
|
||||||
|
closeOnConfirm: true,
|
||||||
|
closeOnCancel: true
|
||||||
|
},
|
||||||
|
function(isConfirm) {
|
||||||
|
if(isConfirm){
|
||||||
|
|
||||||
|
request = $.ajax({
|
||||||
|
url: base_url,
|
||||||
xhrFields: {
|
xhrFields: {
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
},
|
},
|
||||||
headers: {
|
type: "GET",
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
},
|
|
||||||
// maxFilesize: 1, // dalam MB
|
|
||||||
acceptedFiles: ".pdf",
|
|
||||||
paramName: "file", // nama input file yang dikirim ke controller
|
|
||||||
params: {
|
|
||||||
_token: document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
||||||
},
|
|
||||||
uploadMultiple: true,
|
|
||||||
init: function() {
|
|
||||||
this.on("successmultiple", function(files, response) {
|
|
||||||
console.log('Upload success multiple:', response);
|
|
||||||
|
|
||||||
const fileList = document.getElementById('file-list');
|
|
||||||
|
|
||||||
response.files.forEach(function(fileInfo) {
|
|
||||||
const li = document.createElement('li');
|
|
||||||
li.innerHTML = `<a>${fileInfo.filename}</a>`;
|
|
||||||
fileList.appendChild(li);
|
|
||||||
|
|
||||||
// Tambahkan ke hidden input kalau perlu
|
|
||||||
const hiddenInput = document.createElement('input');
|
|
||||||
hiddenInput.type = 'hidden';
|
|
||||||
hiddenInput.name = 'input_upload_files[]';
|
|
||||||
hiddenInput.class = 'removeFormKriteria';
|
|
||||||
hiddenInput.value = fileInfo.filename;
|
|
||||||
var elem = '<input type="hidden" name="input_upload_files[]" value="'+fileInfo.filename+'" class="removeFormKriteria uploadedFiles is-required">';
|
|
||||||
$('.changeForm').append(elem);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("error", function(file, response) {
|
// Callback handler that will be called on success
|
||||||
console.error('Upload error:', response);
|
request.done(function(response, textStatus, jqXHR){
|
||||||
toastr.error(response, 'Error!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
console.log(response);
|
||||||
this.removeFile(file);
|
getForm(response.page);
|
||||||
|
toastr.success("Berhasil Update Data", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Callback handler that will be called on failure
|
||||||
|
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||||
|
toastr.error(
|
||||||
|
"Gagal "+textStatus, errorThrown
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return false;
|
||||||
@if(session('group_alias') == 'sekolah')
|
});
|
||||||
@if(($kuesioner->status != 1) && ($kuesioner->status != 5))
|
|
||||||
$('.dropzone').remove();
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error('AJAX Error:', status, error);
|
console.error('AJAX Error:', status, error);
|
||||||
|
|
@ -301,6 +289,18 @@
|
||||||
$('#loading-spinner').hide(); // Sembunyikan spinner setelah request selesai
|
$('#loading-spinner').hide(); // Sembunyikan spinner setelah request selesai
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.page').on('click',function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
let number = $(this).data('number');
|
||||||
|
|
||||||
|
// Tambahkan kelas active dan hapus dari yang lain
|
||||||
|
$('.page').removeClass('bg-primary-light border-primary text-primary');
|
||||||
|
$(this).addClass('bg-primary-light border-primary text-primary');
|
||||||
|
|
||||||
|
getForm(number);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.resume').on('click',function(e){
|
$('.resume').on('click',function(e){
|
||||||
|
|
@ -311,8 +311,174 @@
|
||||||
window.location.href = "{{url('usulan/adiwiyata/kriteria/progress/'.encode_id(session('sekolah_id')))}}";
|
window.location.href = "{{url('usulan/adiwiyata/kriteria/progress/'.encode_id(session('sekolah_id')))}}";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.btnDeletFile').on('click',function(){
|
||||||
|
var base_url = $(this).attr('data-href');
|
||||||
|
var id = $(this).attr('data-id');
|
||||||
|
swal({
|
||||||
|
title: "Hapus File!",
|
||||||
|
text: "Apa anda yakin ingin hapus Dokumen ini ?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#BF3131",
|
||||||
|
confirmButtonText: "Hapus Sekarang",
|
||||||
|
cancelButtonText: "Batal",
|
||||||
|
closeOnConfirm: true,
|
||||||
|
closeOnCancel: true
|
||||||
|
},
|
||||||
|
function(isConfirm) {
|
||||||
|
if(isConfirm){
|
||||||
|
|
||||||
|
request = $.ajax({
|
||||||
|
url: base_url,
|
||||||
|
xhrFields: {
|
||||||
|
withCredentials: true
|
||||||
|
},
|
||||||
|
type: "GET",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Callback handler that will be called on success
|
||||||
|
request.done(function(response, textStatus, jqXHR){
|
||||||
|
alert(response.page);
|
||||||
|
console.log(response);
|
||||||
|
getForm(response.page);
|
||||||
|
toastr.success("Berhasil Update Data", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Callback handler that will be called on failure
|
||||||
|
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||||
|
toastr.error(
|
||||||
|
"Gagal "+textStatus, errorThrown
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
$('#btnSave').on('click', function (e) {
|
$('#btnSave').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
let isValid = true;
|
||||||
|
let isMultiple = true;
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// VALIDASI FIELD REQUIRED
|
||||||
|
// =========================
|
||||||
|
$('.is-required').each(function () {
|
||||||
|
let type = $(this).attr('type');
|
||||||
|
let name = $(this).attr('name');
|
||||||
|
let value = $(this).val()?.trim();
|
||||||
|
|
||||||
|
if (type === 'radio') {
|
||||||
|
if ($(`input[name="${name}"]:checked`).length === 0) {
|
||||||
|
isValid = false;
|
||||||
|
$(`input[name="${name}"]`).addClass("is-invalid");
|
||||||
|
} else {
|
||||||
|
$(`input[name="${name}"]`).removeClass("is-invalid");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (type === 'checkbox') {
|
||||||
|
let checkedCount = $(`input[name="${name}"]:checked`).length;
|
||||||
|
|
||||||
|
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;
|
||||||
|
$(this).addClass("is-invalid");
|
||||||
|
} else {
|
||||||
|
$(this).removeClass("is-invalid");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (!value) {
|
||||||
|
isValid = false;
|
||||||
|
$(this).addClass("is-invalid");
|
||||||
|
} else {
|
||||||
|
$(this).removeClass("is-invalid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
toastr.error(
|
||||||
|
"Harap isi semua field yang wajib diisi",
|
||||||
|
"Error!",
|
||||||
|
{ positionClass: 'toast-bottom-right' }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// FORM DATA (AUTO FILE + INPUT)
|
||||||
|
// =========================
|
||||||
|
let formElement = document.getElementById('form');
|
||||||
|
let number = $('.page').data('number');
|
||||||
|
let formData = new FormData(formElement);
|
||||||
|
|
||||||
|
let replaceIndex = $('input[type="file"][data-replace-index]').data('replace-index');
|
||||||
|
|
||||||
|
if (replaceIndex !== undefined) {
|
||||||
|
formData.append('replace_index', replaceIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// OPTIONAL: debug isi FormData
|
||||||
|
/*
|
||||||
|
for (let pair of formData.entries()) {
|
||||||
|
console.log(pair[0]+ ':', pair[1]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// AJAX SUBMIT
|
||||||
|
// =========================
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route($route.'.store') }}",
|
||||||
|
type: "POST",
|
||||||
|
data: formData,
|
||||||
|
processData: false, // WAJIB
|
||||||
|
contentType: false, // WAJIB
|
||||||
|
beforeSend: function () {
|
||||||
|
$('#loading-spinner').show();
|
||||||
|
},
|
||||||
|
success: function (response) {
|
||||||
|
toastr.success(
|
||||||
|
"Berhasil menyimpan data",
|
||||||
|
"Success!",
|
||||||
|
{ positionClass: 'toast-bottom-right' }
|
||||||
|
);
|
||||||
|
|
||||||
|
$('.page')
|
||||||
|
.closest('.bg-primary-light')
|
||||||
|
.addClass('bg-success-light border-success text-success')
|
||||||
|
.removeClass('bg-primary-light border-primary border-secondary text-primary');
|
||||||
|
|
||||||
|
getForm(response.page_number);
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
toastr.error(
|
||||||
|
"Maaf terjadi kesalahan saat menyimpan data",
|
||||||
|
"Error!",
|
||||||
|
{ positionClass: 'toast-bottom-right' }
|
||||||
|
);
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
$('#loading-spinner').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#btnSave1').on('click',function(e){
|
||||||
|
e.preventDefault();
|
||||||
let currentForm = $("#form").serializeArray();
|
let currentForm = $("#form").serializeArray();
|
||||||
// console.log(currentForm);
|
// console.log(currentForm);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,8 @@ Route::name('usulan_adiwiyata.')->prefix('usulan/adiwiyata')->group(function ()
|
||||||
Route::get('/resume/{sekolah_id}',[KriteriaController::class,'resume'])->name('resume');
|
Route::get('/resume/{sekolah_id}',[KriteriaController::class,'resume'])->name('resume');
|
||||||
Route::get('/progress/{sekolah_id}',[KriteriaController::class,'progress'])->name('progress');
|
Route::get('/progress/{sekolah_id}',[KriteriaController::class,'progress'])->name('progress');
|
||||||
Route::post('/kirimData/{sekolah_id}/{kuesioner_id}',[KriteriaController::class,'kirimData'])->name('kirimData');
|
Route::post('/kirimData/{sekolah_id}/{kuesioner_id}',[KriteriaController::class,'kirimData'])->name('kirimData');
|
||||||
Route::post('/store',[KriteriaController::class,'store'])->name('store');
|
Route::get('/deleteFile/{id}/{pagenumber}',[KriteriaController::class,'deletFile'])->name('deletFile');
|
||||||
|
Route::post('/store',[KriteriaController::class,'store2026'])->name('store');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::name('binaan.')->prefix('binaan')->group(function () {
|
Route::name('binaan.')->prefix('binaan')->group(function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue