update
parent
ae64d2f19b
commit
31b307ed8f
|
@ -98,25 +98,81 @@ if (!function_exists('getNilaiAll')) {
|
|||
*/
|
||||
function getNilaiAll($type,$sekolah_id)
|
||||
{
|
||||
$countSoal = FormKriteria::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->count();
|
||||
// $countSoal = FormKriteria::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->count();
|
||||
if($type == 'sekolah'){
|
||||
$nilai = Penilaian::where('ms_sekolah_id',$sekolah_id)
|
||||
// III = ((SUM(D246:D252)/11)*20)
|
||||
// II = ((SUM(D35:D243)/89)*60)
|
||||
// I = ((SUM(D9:D30)/19)*20)
|
||||
|
||||
$kriteria1 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','I.Perencanaan Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai1 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria1)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',0) //inputan sekolah
|
||||
->sum('skor');
|
||||
|
||||
$kriteria2 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','II.Pelaksanaan Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai2 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria2)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',0) //inputan sekolah
|
||||
->sum('skor');
|
||||
|
||||
$kriteria3 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','III.Pemantauan dan Evaluasi Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai3 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria3)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',0) //inputan sekolah
|
||||
->sum('skor');
|
||||
|
||||
$nilai = (($nilai3/11)*20)+(($nilai2/89)*60)+(($nilai1/19)*20);
|
||||
|
||||
}elseif($type == 'kota'){
|
||||
$nilai = Penilaian::where('ms_sekolah_id',$sekolah_id)
|
||||
$kriteria1 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','I.Perencanaan Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai1 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria1)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',1) //inputan sekolah
|
||||
->where('status',1) //inputan Kota
|
||||
->sum('skor');
|
||||
|
||||
$kriteria2 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','II.Pelaksanaan Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai2 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria2)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',1) //inputan Kota
|
||||
->sum('skor');
|
||||
|
||||
$kriteria3 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','III.Pemantauan dan Evaluasi Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai3 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria3)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',1) //inputan Kota
|
||||
->sum('skor');
|
||||
|
||||
$nilai = (($nilai3/11)*20)+(($nilai2/89)*60)+(($nilai1/19)*20);
|
||||
}elseif($type == 'provinsi'){
|
||||
$nilai = Penilaian::where('ms_sekolah_id',$sekolah_id)
|
||||
$kriteria1 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','I.Perencanaan Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai1 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria1)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',2) //inputan sekolah
|
||||
->where('status',2) //inputan provinsi
|
||||
->sum('skor');
|
||||
|
||||
$kriteria2 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','II.Pelaksanaan Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai2 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria2)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',2) //inputan provinsi
|
||||
->sum('skor');
|
||||
|
||||
$kriteria3 = FormKriteria::select('page_number')->groupBy('page_number')->where('kategori','III.Pemantauan dan Evaluasi Gerakan PBLHS')->pluck('page_number')->toArray();
|
||||
$nilai3 = Penilaian::where('ms_sekolah_id',$sekolah_id)->whereIn('page_number',$kriteria3)
|
||||
->where('skor','!=',0)
|
||||
->where('tahun',date('Y'))
|
||||
->where('status',2) //inputan provinsi
|
||||
->sum('skor');
|
||||
|
||||
$nilai = (($nilai3/11)*20)+(($nilai2/89)*60)+(($nilai1/19)*20);
|
||||
}
|
||||
|
||||
return @$nilai ? round(@$nilai) : 0;
|
||||
|
@ -614,6 +670,7 @@ if (!function_exists('formKriteria')) {
|
|||
$html .= '<div class="card mb-2 removeFormKriteria">';
|
||||
$html .= '<div class="card-body">';
|
||||
$html .= '<h6><b>'.$data->judul.'</b></h6>';
|
||||
// $html .= '<input type="hidden" name="input_upload_files[]">';
|
||||
|
||||
//QUESTION
|
||||
if($data->type == 'textarea'){
|
||||
|
@ -697,7 +754,7 @@ if (!function_exists('formKriteria')) {
|
|||
}
|
||||
}
|
||||
|
||||
$link = Penilaian::where('key','link_grdive')->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);
|
||||
|
||||
$catatan = Penilaian::where('key','catatan')->where('page_number',$page_number)->where('ms_sekolah_id',$idSekolah)->first();
|
||||
|
@ -707,14 +764,61 @@ if (!function_exists('formKriteria')) {
|
|||
$html .= '<div class="card mb-2 removeFormKriteria">';
|
||||
$html .= '<input type="hidden" name="key" value="'.encode_id($page_number).'">';
|
||||
$html .= '<div class="card-body">';
|
||||
$html .= '<h6><b>Link Google Drive (folder/File penyimpanan bukti)</b></h6>';
|
||||
$html .= '<h6><b>Upload File Bukti</b></h6>';
|
||||
$html .= '<div class="form-group">';
|
||||
$html .= '<input type="text" 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 .= '<div style="border: 2px dashed #0087F7; padding: 20px;" class="dropzone" id="my-dropzone">
|
||||
<div class="dz-message">
|
||||
Drop PDF files here or click to upload
|
||||
<br>
|
||||
Max File 1MB
|
||||
</div>
|
||||
</div>
|
||||
<div id="uploaded-files" style="margin-top: 20px;">
|
||||
<ul id="file-list">';
|
||||
if(@$valueLink){
|
||||
if(is_array(@$valueLink)){
|
||||
foreach(@$valueLink as $kuy => $file){
|
||||
$html .= '<li class="">
|
||||
<a class="" target="_blank" href="'.asset($file).'">File '.($kuy+1).'</a>
|
||||
</li>';
|
||||
}
|
||||
}else{
|
||||
$html .= '<li><a target="_blank" href="'.asset(@$valueLink).'">File 1</a></li>';
|
||||
}
|
||||
}
|
||||
$html .= '</ul>
|
||||
</div>
|
||||
';
|
||||
// $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 .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
}else{
|
||||
|
||||
$html .= '<div class="card mb-2 removeFormKriteria">';
|
||||
$html .= '<div class="card-body">';
|
||||
$html .= '<h6><b>Bukti File</b></h6>';
|
||||
$html .= '<div class="form-group">';
|
||||
$html .= '<div id="uploaded-files" style="margin-top: 20px;">
|
||||
<ul id="file-list">';
|
||||
if(@$valueLink){
|
||||
if(is_array(@$valueLink)){
|
||||
foreach(@$valueLink as $kuy => $file){
|
||||
$html .= '<li class="">
|
||||
<a class="" target="_blank" href="'.asset($file).'">File '.($kuy+1).'</a>
|
||||
</li>';
|
||||
}
|
||||
}else{
|
||||
$html .= '<li><a target="_blank" href="'.asset(@$valueLink).'">File 1</a></li>';
|
||||
}
|
||||
}
|
||||
$html .= '</ul>
|
||||
</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="card mb-2 removeFormKriteria">';
|
||||
$html .= '<input type="hidden" name="key" value="'.encode_id($page_number).'">';
|
||||
$html .= '<div class="card-body">';
|
||||
|
|
|
@ -13,6 +13,36 @@ use App\Models\Kuesioner;
|
|||
|
||||
class AjaxController extends Controller
|
||||
{
|
||||
public function uploadTemp(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'file.*' => 'required|file|mimes:pdf|max:5120',
|
||||
]);
|
||||
|
||||
$uploadedFiles = [];
|
||||
|
||||
if ($request->hasFile('file')) {
|
||||
foreach ($request->file('file') as $file) {
|
||||
$filename = uniqid() . '-' . time() . '.' . $file->getClientOriginalExtension();
|
||||
$path = $file->storeAs('tmp_uploads', $filename);
|
||||
|
||||
$uploadedFiles[] = [
|
||||
'filename' => $filename,
|
||||
'url' => asset('storage/tmp_uploads/' . $filename),
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'files' => $uploadedFiles, // Kembalikan semua file
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Upload failed.',
|
||||
]);
|
||||
}
|
||||
public function sekolahNpsn(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
|
|
|
@ -103,7 +103,7 @@ class CSAKController extends Controller
|
|||
$penilaian = '';
|
||||
$penilaian .= '<span style="width:100%;" class="text-left badge badge-secondary"> Sekolah : '.getNilaiAll('sekolah',$row->ms_sekolah_id).'</span></br>';
|
||||
$penilaian .= '<span style="width:100%;" class="text-left badge badge-primary"> Kota : '.getNilaiAll('kota',$row->ms_sekolah_id).'</span></br>';
|
||||
$penilaian .= '<span style="width:100%;" class="text-left badge badge-success"> Provinsi : '.getNilaiAll('provinsi',$row->ms_sekolah_id).'</span></br>';
|
||||
// $penilaian .= '<span style="width:100%;" class="text-left badge badge-success"> Provinsi : '.getNilaiAll('provinsi',$row->ms_sekolah_id).'</span></br>';
|
||||
|
||||
$log = KuesionerLog::where('kuesioner_id',$row->KuesionerId)->orderBy('created_at','DESC')->first();
|
||||
$progress = '<span class="badge badge-warning">'.str_replace('_',' ',\Str::title($log->step)).'</span>';
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Modules\Usulan;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use App\Models\Kuesioner;
|
||||
use App\Models\Master\FormKriteria;
|
||||
use App\Models\Master\Sekolah;
|
||||
|
@ -90,7 +91,7 @@ class KriteriaController extends Controller
|
|||
}
|
||||
public function store(Request $request)
|
||||
{
|
||||
// dd($request['sekolah']);
|
||||
// dd($request);
|
||||
$data = $request['data'];
|
||||
$_value = [];
|
||||
|
||||
|
@ -164,6 +165,44 @@ class KriteriaController extends Controller
|
|||
$sekolah = Sekolah::find($idSekolah);
|
||||
}
|
||||
|
||||
if($key == 'input_upload_files'){
|
||||
|
||||
$filePaths = [];
|
||||
if(is_array($value)){
|
||||
foreach ($value as $file) {
|
||||
$tempPath = storage_path('app/tmp_uploads/' . $file);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$nilai_kota = Penilaian::where('ms_sekolah_id',$idSekolah)
|
||||
->where('page_number',decode_id($data['key']))
|
||||
->where('skor','!=',0)
|
||||
|
@ -180,6 +219,8 @@ class KriteriaController extends Controller
|
|||
|
||||
$kuesioner = decode_id($data['secure_id']);
|
||||
|
||||
|
||||
|
||||
$penilaian[$key] = Penilaian::updateOrCreate([
|
||||
'kuesioner_id' => $kuesioner,
|
||||
'tahun' => date('Y'),
|
||||
|
|
|
@ -27,4 +27,9 @@ class Penilaian extends Model
|
|||
// 'created_by',
|
||||
// 'level_adiwiyata',
|
||||
// ];
|
||||
|
||||
public function page()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Master\FormKriteria::class,'page_number','page_number');
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -86,7 +86,7 @@
|
|||
<div class="col-md-12" style="background: rgba(23, 162, 184, 0.2) !important;">
|
||||
<ul class="nav nav-pills" role="tablist">
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#profile">Profile Sekolah</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#dokumen">Dokumen Administrasi</a></li>
|
||||
<!-- <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#dokumen">Dokumen Administrasi</a></li> -->
|
||||
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#kriteria">Pemenuhan Kriteria</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#usulan">Usulan CSA</a></li>
|
||||
</ul>
|
||||
|
@ -313,7 +313,7 @@
|
|||
<br>
|
||||
<h4 class="nilai_kota">{{getNilai('kota',1,$sekolah->MsSekolahId)}}</h4>
|
||||
</a>
|
||||
<a href="#" class="btn btn-outline-danger mr-2 ">
|
||||
<a href="#" class="btn btn-outline-danger mr-2 d-none">
|
||||
Provinsi
|
||||
<br>
|
||||
<h4 class="nilai_provinsi">{{getNilai('provinsi',1,$sekolah->MsSekolahId)}}</h4>
|
||||
|
@ -336,21 +336,6 @@
|
|||
<td>Jenis Usulan CSA</td>
|
||||
<td>{{getUsulan($sekolah->MsSekolahId)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2" class="table-info">Penghargaan</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Penghargaan Terakhir</td>
|
||||
<td>{{getPenghargaanTerakhir($sekolah->MsSekolahId)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nomor SK</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tanggal Penetapan SK</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2" class="table-info">Berdasarkan data usulan yang dilengkapi, dinyatakan bahwa {{@$sekolah->nama_sekolah}} :</th>
|
||||
</tr>
|
||||
|
@ -367,7 +352,7 @@
|
|||
<td>
|
||||
<select class="form-control select2" id="validasi" name="validasi">
|
||||
<option value="">- Pilih Validasi -</option>
|
||||
<option {{@$kuesioner->status == '4' ? 'selected' : ''}} value="1">Diteruskan</option>
|
||||
<option {{@$kuesioner->status == '4' ? 'selected' : ''}} value="1">Selesai</option>
|
||||
<option {{@$kuesioner->status == '5' ? 'selected' : ''}} value="2">Dikembalikan</option>
|
||||
</select>
|
||||
</td>
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
@section('page-css')
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/datagrid/datatables/datatables.bundle.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('assets/css/formplugins/dropzone/dropzone.css')}}">
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.css"> -->
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script> -->
|
||||
|
||||
<style type="text/css">
|
||||
.listItem{
|
||||
list-style: none;
|
||||
|
@ -39,6 +43,13 @@
|
|||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
/* #file-list{ margin: 0px; padding: 0px; width: 40%;}*/
|
||||
#file-list > li{
|
||||
/* padding: 10px;*/
|
||||
/* border: 1px solid #ddd;*/
|
||||
/* border-radius: 5px;*/
|
||||
/* margin: 5px 0px;*/
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
@section('content')
|
||||
|
@ -118,7 +129,7 @@
|
|||
</div>
|
||||
<div class="card-footer">
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
@if($kuesioner->status == 2)
|
||||
@if($kuesioner->status == 1)
|
||||
<button id="btnSave" class="btn btn-success"><i class="fal fa-save"></i> Simpan Data</button>
|
||||
@endif
|
||||
@endif
|
||||
|
@ -126,10 +137,64 @@
|
|||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('page-js')
|
||||
<script type="text/javascript" src="{{asset('assets/js/formplugins/dropzone/dropzone.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
@if($kuesioner->status != 1)
|
||||
$('.dropzone').remove();
|
||||
@endif
|
||||
@endif
|
||||
// $('.dropzone').on('click',function(){
|
||||
// Dropzone.autoDiscover = false; // Penting supaya tidak auto-initialize!
|
||||
const myDropzone = new Dropzone(".dropzone", {
|
||||
url: "{{ url('uploadTemp') }}", // URL ke controller kamu
|
||||
method: "POST",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': "{{csrf_token()}}"
|
||||
},
|
||||
maxFilesize: 1, // dalam MB
|
||||
acceptedFiles: ".pdf",
|
||||
paramName: "file", // nama input file yang dikirim ke controller
|
||||
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.value = fileInfo.filename;
|
||||
hiddenInput.class = 'removeFormKriteria';
|
||||
var elem = '<input type="hidden" name="input_upload_files[]" value="'+fileInfo.filename+'" class="removeFormKriteria">';
|
||||
$('.changeForm').append(elem);
|
||||
});
|
||||
});
|
||||
|
||||
this.on("error", function(file, response) {
|
||||
console.error('Upload error:', response);
|
||||
toastr.error(response, 'Error!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
this.removeFile(file);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// });
|
||||
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$('.page').on('click',function(e){
|
||||
e.preventDefault();
|
||||
|
@ -159,6 +224,51 @@
|
|||
$('.numberInput').on('input', function() {
|
||||
this.value = this.value.replace(/[^0-9]/g, ''); // Hanya angka 0-9
|
||||
});
|
||||
const myDropzone = new Dropzone(".dropzone", {
|
||||
url: "{{ url('uploadTemp') }}", // URL ke controller kamu
|
||||
method: "POST",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': "{{csrf_token()}}"
|
||||
},
|
||||
maxFilesize: 1, // dalam MB
|
||||
acceptedFiles: ".pdf",
|
||||
paramName: "file", // nama input file yang dikirim ke controller
|
||||
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">';
|
||||
$('.changeForm').append(elem);
|
||||
});
|
||||
});
|
||||
|
||||
this.on("error", function(file, response) {
|
||||
console.error('Upload error:', response);
|
||||
toastr.error(response, 'Error!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
this.removeFile(file);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
@if($kuesioner->status != 1)
|
||||
$('.dropzone').remove();
|
||||
@endif
|
||||
@endif
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error('AJAX Error:', status, error);
|
||||
|
|
|
@ -287,7 +287,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
@if($kuesioner->status == 2)
|
||||
@if($kuesioner->status == 1)
|
||||
<div class="custom-control custom-checkbox m-2">
|
||||
<input type="checkbox" class="custom-control-input is-required check" id="true" value="1" name="check">
|
||||
<label class="custom-control-label" for="true">Dengan ini menyatakan bahwa kelengkapan data sudah benar.</label>
|
||||
|
|
|
@ -32,6 +32,8 @@ Route::post('profile-sekolah',[ProfileController::class,'store'])->name('profile
|
|||
Route::post('getForm',[AjaxController::class,'getForm'])->name('getForm');
|
||||
Route::post('getSekolahSK',[AjaxController::class,'getSekolahSK'])->name('getSekolahSK');
|
||||
Route::post('getSekolahUsulan',[AjaxController::class,'getSekolahUsulan'])->name('getSekolahUsulan');
|
||||
Route::post('/uploadTemp', [AjaxController::class, 'uploadTemp'])->name('uploadTemp');
|
||||
|
||||
|
||||
Route::name('master.')->prefix('master')->group(function () {
|
||||
Route::resource('indikator',IndikatorController::class);
|
||||
|
|
Loading…
Reference in New Issue