update
parent
11b7d848f5
commit
e2dea891b7
|
@ -137,7 +137,9 @@ if (!function_exists('status_kuesioner')) {
|
|||
function status_kuesioner()
|
||||
{
|
||||
//0 = Belum di Verifikasi Dinas
|
||||
//1 = Sudah di Verifikasi Dinas
|
||||
//1 = Sudah Diusulkan Oleh Dinas atau Sudin
|
||||
|
||||
//1 = Sudah di Verifikasi Dinas -> Hold Menunggu Usulan
|
||||
//2 = Ditolak Oleh Dinas
|
||||
//3 = selesai kelengkapan data
|
||||
//4 = Validasi Diteruskan
|
||||
|
|
|
@ -39,6 +39,17 @@ class AjaxController extends Controller
|
|||
|
||||
return response()->json($data);
|
||||
}
|
||||
public function getSekolahUsulan(Request $request)
|
||||
{
|
||||
$kuesioner = Kuesioner::where('level',($request->data-1))->where('tahun',date('Y'))->where('status',0)->get();
|
||||
$data = [];
|
||||
foreach ($kuesioner as $key => $value) {
|
||||
$data[$key]['id'] = encode_id($value->ms_sekolah_id);
|
||||
$data[$key]['name'] = $value->sekolah->nama_sekolah;
|
||||
}
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
public function getForm(Request $request)
|
||||
{
|
||||
if(@$request->sekolah){
|
||||
|
|
|
@ -180,6 +180,7 @@ class KuesionerController extends Controller
|
|||
$kegiatanFormatted = [];
|
||||
$pihakKegiatanFormatted = [];
|
||||
|
||||
if(@$media){
|
||||
//ISIAN MEDIA
|
||||
foreach ($media as $value) {
|
||||
if ($value == 1) {
|
||||
|
@ -214,8 +215,9 @@ class KuesionerController extends Controller
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(@$materi){
|
||||
//ISIAN MATERI
|
||||
foreach ($materi as $value) {
|
||||
if ($value == 1) {
|
||||
|
@ -250,7 +252,9 @@ class KuesionerController extends Controller
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(@$komitmen){
|
||||
//ISIAN KOMITMEN
|
||||
foreach ($komitmen as $value) {
|
||||
if ($value == 1) {
|
||||
|
@ -267,7 +271,9 @@ class KuesionerController extends Controller
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(@$kegiatan_lingkungan){
|
||||
//ISIAN KEGIATAN
|
||||
foreach ($kegiatan_lingkungan as $value) {
|
||||
if ($value == 1) {
|
||||
|
@ -302,7 +308,9 @@ class KuesionerController extends Controller
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(@$pihak_kegiatan_lingkungan){
|
||||
//ISIAN PIHAK KEGIATAN
|
||||
foreach ($pihak_kegiatan_lingkungan as $value) {
|
||||
if ($value == 1) {
|
||||
|
@ -319,6 +327,7 @@ class KuesionerController extends Controller
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//rumus level adiwiyata
|
||||
$level = 0;
|
||||
|
@ -351,7 +360,7 @@ class KuesionerController extends Controller
|
|||
$insert->info_pblhs = @$request->info_pblhs;
|
||||
$insert->media = json_encode(@$mediaFormatted);
|
||||
$insert->materi = json_encode(@$materiFormatted);
|
||||
$insert->komitmen = json_encode($komitmenFormatted);
|
||||
$insert->komitmen = json_encode(@$komitmenFormatted);
|
||||
$insert->kegiatan_lingkungan = json_encode(@$kegiatanFormatted);
|
||||
$insert->pihak_kegiatan_lingkungan = json_encode(@$pihakKegiatanFormatted);
|
||||
$insert->tahun = date('Y');
|
||||
|
|
|
@ -3,10 +3,14 @@
|
|||
namespace App\Http\Controllers\Modules\Usulan;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Master\Provinsi;
|
||||
use App\Models\Kuesioner;
|
||||
use App\Models\DokumenAdministrasi;
|
||||
use App\Models\Usulan;
|
||||
|
||||
class AdministrasiController extends Controller
|
||||
{
|
||||
|
@ -49,20 +53,30 @@ class AdministrasiController extends Controller
|
|||
$jenis_usulan = 'Keputusan Gubernur tentang penetapan Sekolah Adiwiyata Mandiri';
|
||||
}
|
||||
|
||||
$usulan = Usulan::where('sekolah','like','%'.$row->ms_sekolah_id.'%')->first();
|
||||
|
||||
$dok = DokumenAdministrasi::where('ms_sekolah_id',$row->ms_sekolah_id)->where('tahun',date('Y'))->first();
|
||||
|
||||
if(session('group_alias') == 'sekolah'){
|
||||
if(@$dok->status == 0){
|
||||
$action .= '<a href="#" data-link="'.@$dok->link.'" data-secureid="'.encode_id($row->KuesionerId).'" data-toggle="modal" data-target="#modal" title="View Data" data-jenisusulan="'.$jenis_usulan.'" class="btn btn-xs btn-block btn-primary btnModal"><i class="fal fa-pencil text-white"></i></a>';
|
||||
$action .= '<a href="#" data-link="'.@$dok->link.'" data-level="'.$row->level.'" data-secureid="'.encode_id($row->KuesionerId).'" data-toggle="modal" data-target="#modal" title="View Data" data-jenisusulan="'.$jenis_usulan.'" class="btn btn-xs btn-block btn-primary btnModal"><i class="fal fa-pencil text-white"></i></a>';
|
||||
}
|
||||
}
|
||||
$action .= '<a href="#" data-link="'.@$dok->link.'" data-jenisusulan="'.$jenis_usulan.'" class="btn btn-xs btn-block btn-secondary toggle-row" data-toggle="tooltip" data-placement="top" title="JUDUL"><i class="fal fa-list text-white"></i></a>';
|
||||
if(session('group_alias') == 'dinas'){
|
||||
if($dok->status == 0){
|
||||
if(@$dok){
|
||||
if(@$dok->status == 0){
|
||||
$action .= '<a href="#" data-href="'.url('usulan/administrasi/verifikasi/'.encode_id($dok->DokumenAdministrasiId)).'" data-toggle="tooltip" title="Verifikasi Data" class="btn btn-xs btn-block btn-success verifikasi"><i class="fal fa-check text-white"></i></a>';
|
||||
$action .= '<a href="#" data-href="'.url('usulan/administrasi/tolak/'.encode_id($dok->DokumenAdministrasiId)).'" data-toggle="tooltip" title="Verifikasi Data" class="btn btn-xs btn-block btn-danger tolak"><i class="fal fa-times text-white"></i></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(@$usulan){
|
||||
$fileUsulan = '<a download href="'.asset('uploads/'.@$usulan->file).'" class="btn btn-xs btn-block btn-success"><i class="fal fa-download text-white"></i> Surat Usulan</a>';
|
||||
}else{
|
||||
$fileUsulan = '';
|
||||
}
|
||||
|
||||
if($row->level == 0){
|
||||
$penghargaan = '<i class="fal fa-trophy"></i> Belum Pernah';
|
||||
|
@ -115,6 +129,7 @@ class AdministrasiController extends Controller
|
|||
'wilayah' => $row->sekolah->kabupaten->name,
|
||||
'penghargaan' => $penghargaan,
|
||||
'jenis_usulan' => '<span class="badge badge-success">'.$jenis_usulan.'</span>',
|
||||
'usulan' => $fileUsulan,
|
||||
'action' => $action,
|
||||
];
|
||||
|
||||
|
@ -142,9 +157,10 @@ class AdministrasiController extends Controller
|
|||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request['data'];
|
||||
// dd($request->all());
|
||||
// $data = $request['data'];
|
||||
|
||||
$keyId = decode_id($data['secure_id']);
|
||||
$keyId = decode_id($request->secure_id);
|
||||
|
||||
if(!@$keyId){
|
||||
return response()->json(['status' => false,'message' => 'Maaf Terjadi Kesalahan','type' => 'error']);
|
||||
|
@ -156,6 +172,82 @@ class AdministrasiController extends Controller
|
|||
return response()->json(['status' => false,'message' => 'Dokumen Sudah di verifikasi','type' => 'info']);
|
||||
}
|
||||
|
||||
if (@$request->hasFile('file')) {
|
||||
$file = $request->file('file');
|
||||
$destinationPath = public_path('uploads/file');
|
||||
$current = Carbon::now()->format('Y/m/d');
|
||||
$path = $destinationPath . '/' . $current;
|
||||
$fileName = $file->getClientOriginalName();
|
||||
$fileMime = $file->getClientMimeType();
|
||||
$fileExtension = $file->getClientOriginalExtension();
|
||||
$fileSize = $file->getSize();
|
||||
if($fileExtension != 'pdf'){
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Maaf File Harus Berupa PDF!',
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
$newFilename = session('uid').'_'.uniqid('file_') . '.' . $fileExtension;
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||
}
|
||||
|
||||
$filePath = 'file/' . $current . '/' . $newFilename;
|
||||
$uploaded = $file->move($path, $newFilename);
|
||||
}
|
||||
|
||||
if (@$request->hasFile('sk_tim_adiwiyata')) {
|
||||
$file = $request->file('sk_tim_adiwiyata');
|
||||
$destinationPath = public_path('uploads/file_sk_tim');
|
||||
$current = Carbon::now()->format('Y/m/d');
|
||||
$path = $destinationPath . '/' . $current;
|
||||
$fileName = $file->getClientOriginalName();
|
||||
$fileMime = $file->getClientMimeType();
|
||||
$fileExtension = $file->getClientOriginalExtension();
|
||||
$fileSize = $file->getSize();
|
||||
if($fileExtension != 'pdf'){
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Maaf File Harus Berupa PDF!',
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
$newFilename = session('uid').'_'.uniqid('file_sk_tim_') . '.' . $fileExtension;
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||
}
|
||||
|
||||
$filePathTim = 'file_sk_tim/' . $current . '/' . $newFilename;
|
||||
$uploaded = $file->move($path, $newFilename);
|
||||
}
|
||||
|
||||
if (@$request->hasFile('surat_usulan')) {
|
||||
$file = $request->file('surat_usulan');
|
||||
$destinationPath = public_path('uploads/file_usulan');
|
||||
$current = Carbon::now()->format('Y/m/d');
|
||||
$path = $destinationPath . '/' . $current;
|
||||
$fileName = $file->getClientOriginalName();
|
||||
$fileMime = $file->getClientMimeType();
|
||||
$fileExtension = $file->getClientOriginalExtension();
|
||||
$fileSize = $file->getSize();
|
||||
if($fileExtension != 'pdf'){
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Maaf File Harus Berupa PDF!',
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
$newFilename = session('uid').'_'.uniqid('file_usulan_') . '.' . $fileExtension;
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||
}
|
||||
|
||||
$filePathUsulan = 'file_usulan/' . $current . '/' . $newFilename;
|
||||
$uploaded = $file->move($path, $newFilename);
|
||||
}
|
||||
// dd($filePathUsulan);
|
||||
|
||||
$dok = DokumenAdministrasi::updateOrCreate([
|
||||
'kuesioner_id' => $keyId,
|
||||
'ms_sekolah_id' => session('sekolah_id'),
|
||||
|
@ -168,7 +260,9 @@ class AdministrasiController extends Controller
|
|||
'npsn' => session('npsn'),
|
||||
'created_by' => auth()->user()->id,
|
||||
'tahun' => date('Y'),
|
||||
'link' => $data['file'],
|
||||
'link' => @$filePath,
|
||||
'file_sk_tim' => @$filePathTim,
|
||||
'file_usulan' => @$filePathUsulan,
|
||||
'status' => 0,
|
||||
]);
|
||||
|
||||
|
|
|
@ -82,8 +82,10 @@ class CSAKController extends Controller
|
|||
$action = '';
|
||||
|
||||
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
||||
if($row->status == 3){
|
||||
$action .= '<a href="'.url('usulan/csak/update/'.encode_id($row->ms_sekolah_id)).'" data-toggle="tooltip" title="View Data" class="btn btn-xs btn-block btn-primary"><i class="fal fa-edit text-white"></i></a>';
|
||||
}
|
||||
}
|
||||
|
||||
if($row->level == 0){
|
||||
$penghargaan = '<i class="fal fa-trophy"></i> Belum Pernah';
|
||||
|
|
|
@ -29,6 +29,13 @@ class KriteriaController extends Controller
|
|||
}
|
||||
|
||||
if(Kuesioner::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->value('status') == 0){
|
||||
return redirect('kuesioner/update/'.encode_id(session('sekolah_id')))->with([
|
||||
'message' => 'Menunggu Usulan dari Dinas/Sudin',
|
||||
'type' => 'error',
|
||||
]);
|
||||
}
|
||||
|
||||
if(Kuesioner::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->value('status') == 1){
|
||||
return redirect('kuesioner/update/'.encode_id(session('sekolah_id')))->with([
|
||||
'message' => 'Maaf usulan anda belum diverifikasi oleh Dinas',
|
||||
'type' => 'error',
|
||||
|
|
|
@ -4,7 +4,13 @@ namespace App\Http\Controllers\Modules\Usulan;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Master\Provinsi;
|
||||
use App\Models\Usulan;
|
||||
use App\Models\Kuesioner;
|
||||
use App\Models\KuesionerLog;
|
||||
|
||||
class SuratController extends Controller
|
||||
{
|
||||
|
@ -43,7 +49,125 @@ class SuratController extends Controller
|
|||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
// dd($request->all());
|
||||
try {
|
||||
Validator::make($request->all(), [
|
||||
'judul' => 'max:200',
|
||||
'jenis_usulan' => 'required',
|
||||
'sekolah' => 'required',
|
||||
'file' => 'required',
|
||||
])->validate();
|
||||
|
||||
if($request->jenis_usulan == '1'){
|
||||
$usulan = 'Adiwiyata Kab/Kota';
|
||||
}elseif($request->jenis_usulan == '2'){
|
||||
$usulan = 'Adiwiyata Provinsi';
|
||||
}elseif($request->jenis_usulan == '3'){
|
||||
$usulan = 'Adiwiyata Nasional';
|
||||
}else{
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Maaf Kesalahan Input Data!',
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
|
||||
if(Usulan::where('tahun',date('Y'))->where('jenis_usulan',$request->jenis_usulan)->count() > 0){
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Maaf Usulan Tahun '.date('Y').' Untuk Usulan '.$usulan.' Sudah Ada',
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
|
||||
if ($request->hasFile('file')) {
|
||||
$file = $request->file('file');
|
||||
$destinationPath = public_path('uploads/usulan');
|
||||
$current = Carbon::now()->format('Y/m/d');
|
||||
$path = $destinationPath . '/' . $current;
|
||||
$fileName = $file->getClientOriginalName();
|
||||
$fileMime = $file->getClientMimeType();
|
||||
$fileExtension = $file->getClientOriginalExtension();
|
||||
$fileSize = $file->getSize();
|
||||
if($fileExtension != 'pdf'){
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Maaf File Harus Berupa PDF!',
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
$newFilename = session('uid').'_'.uniqid('usulan_') . '.' . $fileExtension;
|
||||
|
||||
if (!File::exists($path)) {
|
||||
File::isDirectory($path) or File::makeDirectory($path, 0777, true, true);
|
||||
}
|
||||
|
||||
$filePath = 'usulan/' . $current . '/' . $newFilename;
|
||||
$uploaded = $file->move($path, $newFilename);
|
||||
}
|
||||
|
||||
$decoded = collect($request->sekolah)->map(function($id) {
|
||||
return decode_id($id);
|
||||
})->toArray();
|
||||
|
||||
// dd($decoded);
|
||||
|
||||
if(@$request->file){
|
||||
$usulan = Usulan::updateOrCreate([
|
||||
'tahun' => date('Y'),
|
||||
'jenis_usulan' => $request->jenis_usulan,
|
||||
],[
|
||||
'tahun' => date('Y'),
|
||||
'nama' => @$request->nama,
|
||||
'jenis_usulan' => $request->jenis_usulan,
|
||||
'file' => $filePath,
|
||||
'deskripsi' => @$request->deskripsi,
|
||||
'created_by' => auth()->user()->id,
|
||||
'sekolah' => json_encode($decoded),
|
||||
]);
|
||||
}else{
|
||||
$usulan = Usulan::updateOrCreate([
|
||||
'tahun' => date('Y'),
|
||||
'jenis_usulan' => $request->jenis_usulan,
|
||||
],[
|
||||
'tahun' => date('Y'),
|
||||
'nama' => @$request->nama,
|
||||
'jenis_usulan' => $request->jenis_usulan,
|
||||
'deskripsi' => @$request->deskripsi,
|
||||
'created_by' => auth()->user()->id,
|
||||
'sekolah' => json_encode($decoded),
|
||||
]);
|
||||
}
|
||||
|
||||
foreach($request->sekolah as $sekolah){
|
||||
|
||||
$kuesioner = Kuesioner::where('ms_sekolah_id',decode_id($sekolah))->where('status',0)->where('tahun',date('Y'))->first();
|
||||
$kuesioner->status = 1;
|
||||
$kuesioner->save();
|
||||
|
||||
//kuesioner log
|
||||
$log = new KuesionerLog;
|
||||
$log->kuesioner_id = $kuesioner->KuesionerId;
|
||||
$log->ms_sekolah_id = $kuesioner->ms_sekolah_id;
|
||||
$log->npsn = $kuesioner->npsn;
|
||||
$log->ms_group_id = session('group_id');
|
||||
$log->step = 'diusulkan';
|
||||
$log->status = 1;
|
||||
$log->created_by = auth()->user()->id;
|
||||
$log->save();
|
||||
}
|
||||
|
||||
logActivity($request, __('Create',['val' => strtolower(__('Title',['val' => 'Penetapan SK Usulan '.$usulan.' tahun '.date('Y').' oleh '.auth()->user()->id]))]));
|
||||
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Berhasil update data',
|
||||
'type' => 'success',
|
||||
]);
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with([
|
||||
'message' => $e->getMessage(),
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Usulan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'usulan';
|
||||
protected $primaryKey = 'UsulanId';
|
||||
protected $guarded = [];
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?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('usulan', function (Blueprint $table) {
|
||||
$table->id('UsulanId');
|
||||
$table->string('nama')->nullable();
|
||||
$table->json('sekolah');
|
||||
$table->year('tahun');
|
||||
$table->integer('jenis_usulan');
|
||||
$table->string('file');
|
||||
$table->text('deskripsi')->nullable();
|
||||
$table->integer('status')->default(0);
|
||||
$table->integer('created_by');
|
||||
$table->timestampsTz();
|
||||
$table->softdeletesTz();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('usulans');
|
||||
}
|
||||
};
|
|
@ -0,0 +1,29 @@
|
|||
<?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::table('penilaian', function (Blueprint $table) {
|
||||
$table->integer('kuesioner_id');
|
||||
$table->foreign('kuesioner_id')->references('KuesionerId')->on('kuesioner')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('penilaian', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
|
@ -0,0 +1,29 @@
|
|||
<?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::table('dokumen_administrasi', function (Blueprint $table) {
|
||||
$table->string('file_sk_tim')->nullable()->after('link');
|
||||
$table->string('file_usulan')->nullable()->after('link');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('dokumen_administrasi', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
|
@ -43,7 +43,7 @@
|
|||
<div class="">
|
||||
<div class="">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12 d-none">
|
||||
<ul class="listItem">
|
||||
<li class="bg-success text-white">
|
||||
<h6 class="m-0">
|
||||
|
|
|
@ -143,6 +143,7 @@
|
|||
<th data-field="npsn">NPSN</th>
|
||||
<th data-field="nama">Nama Sekolah</th>
|
||||
<th data-field="wilayah">Wilayah</th>
|
||||
<th data-field="usulan">File Usulan</th>
|
||||
<th data-field="labelDok">Status Dokumen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -157,7 +158,7 @@
|
|||
|
||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||
<form action="#" method="POST" enctype="multipart/form-data" id="form">
|
||||
<form action="#" method="POST" enctype="multipart/form-data" id="form" style="width: 100%;">
|
||||
{{csrf_field()}}
|
||||
<input type="hidden" name="secure_id" class="secure_id" value="">
|
||||
<div class="modal-content">
|
||||
|
@ -168,20 +169,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-nobordered wrap">
|
||||
<tr>
|
||||
<td width="50%">
|
||||
<div class="jenisusulan"></div>
|
||||
<small class="text-primary">(Link Google Drive)</small>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control is-required" name="file" required>
|
||||
<small class="text-primary">Contoh link : https://example.com</small>
|
||||
<br>
|
||||
<a href="#" class="btn btn-primary btn-xs link mt-2" style="display: none;" target="_blank"><i class="fal fa-link"></i> Link Lampiran</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="bodyModal"></div>
|
||||
</div>
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
<div class="modal-footer">
|
||||
|
@ -198,11 +186,6 @@
|
|||
<script src="{{asset('assets/js/datagrid/datatables/datatables.bundle.js')}}"></script>
|
||||
<script src="{{asset('assets/js/bootstrap-table.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
// <tr class="extra-row" style="display: none;">
|
||||
// <td colspan="8">
|
||||
// <strong>Detail Tambahan:</strong> Informasi tambahan lainnya.
|
||||
// </td>
|
||||
// </tr>
|
||||
$("#grid-data").on("click", ".toggle-row", function() {
|
||||
let btn = $(this);
|
||||
let row = btn.closest("tr");
|
||||
|
@ -320,6 +303,44 @@
|
|||
$('.jenisusulan').html($(this).attr('data-jenisusulan'));
|
||||
$('.secure_id').val($(this).attr('data-secureid'));
|
||||
var link = $(this).attr('data-link');
|
||||
var level = $(this).attr('data-level');
|
||||
var div = '';
|
||||
div += '<table class="table deleted table-nobordered wrap">';
|
||||
if(level == 0){
|
||||
div += '<tr>';
|
||||
div += '<td width="20%">';
|
||||
div += '<div>SK Tim Adiwiyata</div>';
|
||||
div += '</td>';
|
||||
div += '<td>';
|
||||
div += '<input type="file" accept=".pdf" class="form-control is-required" name="sk_tim_adiwiyata" required>';
|
||||
div += '<small class="text-danger">Format : .pdf, Maksimal File : 2MB</small>';
|
||||
div += '</td>';
|
||||
div += '</tr>';
|
||||
div += '<tr>';
|
||||
div += '<td width="20%">';
|
||||
div += '<div>Surat Usulan</div>';
|
||||
div += '</td>';
|
||||
div += '<td>';
|
||||
div += '<input type="file" accept=".pdf" class="form-control is-required" name="surat_usulan" required>';
|
||||
div += '<small class="text-danger">Format : .pdf, Maksimal File : 2MB</small>';
|
||||
div += '</td>';
|
||||
div += '</tr>';
|
||||
}else{
|
||||
div += '<tr>';
|
||||
div += '<td width="50%">';
|
||||
div += '<div>'+$(this).attr('data-jenisusulan')+'</div>';
|
||||
div += '</td>';
|
||||
div += '<td>';
|
||||
div += '<input type="file" accept=".pdf" class="form-control is-required" name="file" required>';
|
||||
div += '<small class="text-danger">Format : .pdf, Maksimal File : 2MB</small>';
|
||||
div += '</td>';
|
||||
div += '</tr>';
|
||||
}
|
||||
div += '</table>';
|
||||
|
||||
$('.bodyModal').html(div);
|
||||
|
||||
|
||||
if(link != ''){
|
||||
$('.link').show();
|
||||
$('.link').attr('href',link);
|
||||
|
@ -330,32 +351,13 @@
|
|||
});
|
||||
$('#btnSave').on('click',function(e){
|
||||
e.preventDefault();
|
||||
let currentForm = $("#form").serializeArray();
|
||||
console.log(currentForm);
|
||||
|
||||
let formData = {};
|
||||
let allData = {};
|
||||
let form = $('#form')[0];
|
||||
let formData = new FormData(form);
|
||||
let isValid = true; // Flag validasi
|
||||
|
||||
currentForm.forEach(field => {
|
||||
let name = field.name.replace(/\[\]$/, ''); // Hapus "[]" di akhir nama input
|
||||
|
||||
if (allData[name]) {
|
||||
if (!Array.isArray(allData[name])) {
|
||||
allData[name] = [allData[name]];
|
||||
}
|
||||
allData[name].push(field.value);
|
||||
} else {
|
||||
allData[name] = field.value;
|
||||
}
|
||||
});
|
||||
|
||||
// Validasi manual field required
|
||||
$('.is-required').each(function () {
|
||||
let type = $(this).attr('type');
|
||||
let name = $(this).attr('name');
|
||||
let value = $(this).val()?.trim(); // Pastikan nilai di-trim untuk menghindari spasi kosong
|
||||
|
||||
// Validasi input teks atau lainnya
|
||||
let value = $(this).val()?.trim();
|
||||
if (!value) {
|
||||
isValid = false;
|
||||
$(this).addClass("is-invalid");
|
||||
|
@ -364,20 +366,17 @@
|
|||
}
|
||||
});
|
||||
|
||||
// Jika validasi gagal, hentikan submit
|
||||
if (!isValid) {
|
||||
toastr.error("Harap isi semua field yang wajib diisi", 'Error!', { positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right' });
|
||||
// alert(".");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "{{route($route.'.store')}}", // Ganti dengan URL API-mu
|
||||
type: 'POST', // Bisa juga 'POST' kalau perlu
|
||||
data: {
|
||||
_token:'{{csrf_token()}}',
|
||||
data: allData
|
||||
}, // Kirim number sebagai parameter
|
||||
data: formData,
|
||||
processData: false, // Penting untuk FormData
|
||||
contentType: false, // Penting untuk FormData
|
||||
dataType: 'json', // Format respons JSON
|
||||
beforeSend: function () {
|
||||
$('#loading-spinner').show(); // Menampilkan spinner
|
||||
|
@ -397,7 +396,6 @@
|
|||
$('#loading-spinner').hide(); // Sembunyikan spinner setelah request selesai
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
$('select').on("select2:selecting", function(e) {
|
||||
var selectorOrigin = this.id;
|
||||
|
|
|
@ -518,7 +518,7 @@
|
|||
}
|
||||
|
||||
$.ajax({
|
||||
url: "{{route('modules.usulan.administrasi.update')}}", // Ganti dengan URL API-mu
|
||||
url: "{{route('modules.usulan_adiwiyata.administrasi.update')}}", // Ganti dengan URL API-mu
|
||||
type: 'POST', // Bisa juga 'POST' kalau perlu
|
||||
data: {
|
||||
_token:'{{csrf_token()}}',
|
||||
|
@ -602,7 +602,7 @@
|
|||
}
|
||||
|
||||
$.ajax({
|
||||
url: "{{route('modules.usulan.kriteria.store')}}", // Ganti dengan URL API-mu
|
||||
url: "{{route('modules.usulan_adiwiyata.kriteria.store')}}", // Ganti dengan URL API-mu
|
||||
type: 'POST', // Bisa juga 'POST' kalau perlu
|
||||
data: {
|
||||
_token:'{{csrf_token()}}',
|
||||
|
|
|
@ -27,9 +27,12 @@
|
|||
<label class="label">Jenis Usulan</label>
|
||||
<select class="select2 form-control usulan" name="jenis_usulan" required>
|
||||
<option value="">Pilih Jenis Usulan</option>
|
||||
@if(session('group_alias') == 'suku_dinas')
|
||||
<option value="1">Adiwiyata Kab/Kota</option>
|
||||
<option value="2">Adiwiyata Provinsi</option>
|
||||
@else
|
||||
<option value="3">Adiwiyata Nasional</option>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -57,7 +60,7 @@
|
|||
var jenis_usulan = $(this).find(':selected').val();
|
||||
let base_url = "{{url('/')}}";
|
||||
$.ajax({
|
||||
url: base_url+'/getSekolahSK', // Ganti dengan URL API-mu
|
||||
url: base_url+'/getSekolahUsulan', // Ganti dengan URL API-mu
|
||||
type: 'POST', // Bisa juga 'POST' kalau perlu
|
||||
data: {
|
||||
_token:'{{csrf_token()}}',
|
||||
|
|
|
@ -31,6 +31,7 @@ Route::get('profile-sekolah/grid',[ProfileController::class,'grid'])->name('prof
|
|||
Route::post('profile-sekolah',[ProfileController::class,'store'])->name('profile.store');
|
||||
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::name('master.')->prefix('master')->group(function () {
|
||||
Route::resource('indikator',IndikatorController::class);
|
||||
|
|
Loading…
Reference in New Issue