update
parent
414a2817b7
commit
ff118b0a53
|
@ -3,6 +3,10 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Kuesioner;
|
||||
use App\Models\ProfileSekolah;
|
||||
use App\Models\Master\FormKriteria;
|
||||
use App\Models\Penilaian;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
@ -33,6 +37,11 @@ class HomeController extends Controller
|
|||
$data['title'] = 'Dashboard';
|
||||
$data['group'] = session('group_alias');
|
||||
if(session('group_alias') == 'sekolah'){
|
||||
$data['usulan'] = Kuesioner::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->first();
|
||||
$data['profile'] = ProfileSekolah::where('ms_sekolah_id',session('sekolah_id'))->first();
|
||||
$data['page'] = FormKriteria::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();
|
||||
|
||||
return view($this->template.'.sekolah', $data);
|
||||
}else{
|
||||
return view($this->template.'.admin', $data);
|
||||
|
|
|
@ -9,7 +9,9 @@ use Illuminate\Support\Facades\Auth;
|
|||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\ProfileSekolah as Profile;
|
||||
use App\Models\Kuesioner;
|
||||
use App\Models\KuesionerLog;
|
||||
use App\Models\Master\Provinsi;
|
||||
use App\Models\Master\Sekolah;
|
||||
|
||||
class KuesionerController extends Controller
|
||||
{
|
||||
|
@ -19,7 +21,18 @@ class KuesionerController extends Controller
|
|||
public function index()
|
||||
{
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
if(auth()->user()->group->alias == 'sekolah'){
|
||||
|
||||
|
||||
if(session('group_alias') == 'sekolah'){
|
||||
|
||||
$data['profile'] = Profile::where('ms_sekolah_id',session('sekolah_id'))->first();
|
||||
if(!@$data['profile']->data_jumlah && !@$data['profile']->penghematan_air && !@$data['profile']->penghematan_listrik){
|
||||
return redirect('profile-sekolah/')->with([
|
||||
'message' => 'Silahkan lengkapi data profile sekolah',
|
||||
'type' => 'error',
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect('kuesioner/update/'.encode_id(session('sekolah_id')));
|
||||
}
|
||||
|
||||
|
@ -88,11 +101,13 @@ class KuesionerController extends Controller
|
|||
$data['kuesioner'] = $kuesioner;
|
||||
}
|
||||
|
||||
$data['nama_sekolah'] = $kuesioner->sekolah->nama_sekolah;
|
||||
$data['npsn'] = $kuesioner->sekolah->npsn;
|
||||
$data['status'] = $kuesioner->sekolah->status;
|
||||
$data['alamat_sekolah'] = $kuesioner->profile->alamat_sekolah;
|
||||
$data['tingkat'] = $kuesioner->profile->tingkat->name;
|
||||
$sekolah = Sekolah::where('MsSekolahId',$keyId)->first();
|
||||
|
||||
$data['nama_sekolah'] = @$sekolah->nama_sekolah;
|
||||
$data['npsn'] = @$sekolah->npsn;
|
||||
$data['status'] = @$sekolah->status;
|
||||
$data['alamat_sekolah'] = @$sekolah->profile->alamat_sekolah;
|
||||
$data['tingkat'] = @$sekolah->profile->tingkat->name;
|
||||
|
||||
$media = json_decode(@$kuesioner->media);
|
||||
$data['selectedMediaValues'] = collect($media)->pluck('value')->toArray(); // Ambil value yang dipilih
|
||||
|
@ -298,6 +313,19 @@ class KuesionerController extends Controller
|
|||
$insert->tim_adiwiyata_link = @$request->tim_adiwiyata_link;
|
||||
$insert->save();
|
||||
|
||||
|
||||
//kuesioner log
|
||||
$log = new KuesionerLog;
|
||||
$log->kuesioner_id = $insert->KuesionerId;
|
||||
$log->ms_sekolah_id = session('sekolah_id');
|
||||
$log->npsn = session('npsn');
|
||||
$log->ms_group_id = session('group_id');
|
||||
$log->step = 'create_kuesioner';
|
||||
$log->status = 0;
|
||||
$log->created_by = auth()->user()->id;
|
||||
$log->save();
|
||||
|
||||
|
||||
logActivity($request, __('Create',['val' => strtolower(__('Title',['val' => 'Kuesioner Leveling User ID : '.auth()->user()->id]))]));
|
||||
|
||||
return redirect()->back()->with([
|
||||
|
|
|
@ -47,6 +47,7 @@ class UserSekolahController extends Controller
|
|||
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
||||
$action .= '<a href="'.url('management/user_sekolah/update/'.encode_id($row->id)).'" data-toggle="tooltip" title="Edit Data" class="btn btn-xs btn-block btn-primary"><i class="fal fa-pencil text-white"></i></a>';
|
||||
if(session('group_id') == 1){
|
||||
$action .= '<a href="#" data-href="'.url('management/user/forcelogin/'.encode_id($row->id)).'" data-toggle="tooltip" title="Force Login" class="forcelogin btn btn-xs btn-block btn-success"><i class="fal fa-user text-white"></i></a>';
|
||||
$action .= '<a href="#" data-href="'.url('management/user_sekolah/delete/'.encode_id($row->id)).'" data-toggle="tooltip" title="Edit Data" class="remove_data btn btn-xs btn-block btn-danger"><i class="fal fa-trash text-white"></i></a>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,13 @@ class KriteriaController extends Controller
|
|||
{
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
|
||||
if(Kuesioner::where('ms_sekolah_id',session('sekolah_id'))->where('tahun',date('Y'))->count() == 0){
|
||||
return redirect('kuesioner/update/'.encode_id(session('sekolah_id')))->with([
|
||||
'message' => 'Maaf anda belum melakukan isi kuesioner, silahkan isi terlebih dahulu',
|
||||
'type' => 'error',
|
||||
]);
|
||||
}
|
||||
|
||||
$data['title'] = $this->title;
|
||||
$data['route'] = $this->route;
|
||||
$data['page'] = FormKriteria::select('page_number')->groupBy('page_number')->orderBy('page_number','ASC')->pluck('page_number')->toArray();
|
||||
|
|
|
@ -5,7 +5,11 @@ namespace App\Models;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Usulan extends Model
|
||||
class KuesionerLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'kuesioner_log';
|
||||
protected $primaryKey = 'KuesionerLogId';
|
||||
protected $guarded = [];
|
||||
}
|
|
@ -24,6 +24,11 @@ class Sekolah extends Model
|
|||
'long',
|
||||
];
|
||||
|
||||
public function profile()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\ProfileSekolah::class,'MsSekolahId','ms_sekolah_id');
|
||||
}
|
||||
|
||||
public function provinsi()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Master\Provinsi::class,'ms_provinsi_id','MsProvinsiId');
|
||||
|
|
|
@ -11,16 +11,20 @@ class Penilaian extends Model
|
|||
|
||||
protected $table = 'penilaian';
|
||||
protected $primaryKey = 'PenilaianId';
|
||||
protected $fillable = [
|
||||
'ms_sekolah_id',
|
||||
'npsn',
|
||||
// 'ms_form_kriteria_id',
|
||||
'key',
|
||||
'page_number',
|
||||
'value',
|
||||
'skor',
|
||||
'status',
|
||||
'tahun',
|
||||
'created_by',
|
||||
];
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
// protected $fillable = [
|
||||
// 'ms_sekolah_id',
|
||||
// 'npsn',
|
||||
// // 'ms_form_kriteria_id',
|
||||
// 'key',
|
||||
// 'page_number',
|
||||
// 'value',
|
||||
// 'skor',
|
||||
// 'status',
|
||||
// 'tahun',
|
||||
// 'created_by',
|
||||
// 'level_adiwiyata',
|
||||
// ];
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ return new class extends Migration
|
|||
$table->json('value')->nullable();
|
||||
$table->integer('skor')->default(0);
|
||||
$table->integer('status')->nullable();
|
||||
$table->integer('level_adiwiyata')->default(0);
|
||||
$table->year('tahun')->nullable();
|
||||
$table->integer('created_by');
|
||||
$table->timestamps();
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<?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('usulans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('usulans');
|
||||
}
|
||||
};
|
|
@ -1,27 +0,0 @@
|
|||
<?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_approvals', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('usulan_approvals');
|
||||
}
|
||||
};
|
|
@ -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('kuesioner_log', function (Blueprint $table) {
|
||||
$table->id('KuesionerLogId');
|
||||
$table->integer('kuesioner_id');
|
||||
$table->integer('ms_sekolah_id');
|
||||
$table->integer('npsn');
|
||||
$table->integer('ms_group_id');
|
||||
$table->string('step')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->integer('status');
|
||||
$table->integer('created_by');
|
||||
$table->timestampsTz();
|
||||
|
||||
$table->foreign('kuesioner_id')->references('KuesionerId')->on('kuesioner')->onDelete('cascade');
|
||||
$table->foreign('ms_sekolah_id')->references('MsSekolahId')->on('ms_sekolah')->onDelete('cascade');
|
||||
$table->foreign('ms_group_id')->references('MsGroupId')->on('ms_group')->onDelete('cascade');
|
||||
$table->foreign('created_by')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('kuesioner_log');
|
||||
}
|
||||
};
|
|
@ -40,25 +40,40 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="">
|
||||
<div class="">
|
||||
<div class="row">
|
||||
<div class="col-md-12 p-0">
|
||||
<div class="col-md-12">
|
||||
<ul class="listItem">
|
||||
<li>
|
||||
<h6><div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> Registrasi Akun</h6>
|
||||
<li class="bg-success text-white">
|
||||
<h6 class="m-0">
|
||||
<!-- <div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> -->
|
||||
Registrasi Akun
|
||||
</h6>
|
||||
</li>
|
||||
<li class="profile">
|
||||
<h6><div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> Melengkapi Data Profile</h6>
|
||||
<li class="profile {{@$profile->data_jumlah && @$profile->penghematan_air && @$profile->penghematan_listrik ? 'bg-success text-white' : ''}}">
|
||||
<h6 class="m-0">
|
||||
<!-- <div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> -->
|
||||
Melengkapi Data Profile
|
||||
</h6>
|
||||
</li>
|
||||
<li class="kuesioner">
|
||||
<h6><div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> Mengisi Kuesioner Leveling</h6>
|
||||
<li class="kuesioner {{@$kuesioner ? 'bg-success text-white' : ''}}">
|
||||
<h6 class="m-0">
|
||||
<!-- <div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> -->
|
||||
Mengisi Kuesioner Leveling
|
||||
</h6>
|
||||
</li>
|
||||
<li>
|
||||
<h6><div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> Menunggu Diusulkan CSA</h6>
|
||||
<li class="{{@$kuesioner->status == 1 ? 'bg-success text-white' : ''}}">
|
||||
<h6 class="m-0">
|
||||
<!-- <div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> -->
|
||||
Menunggu Diusulkan CSA
|
||||
</h6>
|
||||
</li>
|
||||
<li>
|
||||
<h6><div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> Melengkapi Data CSA</h6>
|
||||
<li class="{{@$page == @$penilaian ? 'bg-success text-white' : ''}}">
|
||||
<h6 class="m-0">
|
||||
<!-- <div class="rounded-circle bg-fusion-50 width-1 height-1 text-center d-inline-block bg-success"><i class="mt-1 fal fa-check text-white"></i></div> -->
|
||||
Melengkapi Data CSA
|
||||
</h6>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -109,9 +124,27 @@
|
|||
<div class="card-body">
|
||||
<div class="mb-4">
|
||||
<h4><b>Status Usulan</b></h4>
|
||||
<p>Sekolah diusulan untuk menjadi CSA (Calon Sekolah Adiwiyata) Nasional</p>
|
||||
@if(@$usulan && (@$usulan->status == 1))
|
||||
<?php
|
||||
if(@$usulan->level == 0){
|
||||
$textLevel = 'Kabupaten/Kota';
|
||||
}elseif(@$usulan->level == 1){
|
||||
$textLevel = 'Provinsi';
|
||||
}elseif(@$usulan->level == 2){
|
||||
$textLevel = 'Nasional';
|
||||
}elseif(@$usulan->level == 3){
|
||||
$textLevel = 'Mandiri';
|
||||
}
|
||||
?>
|
||||
<p>Sekolah diusulan untuk menjadi CSA (Calon Sekolah Adiwiyata) {{@$textLevel}}</p>
|
||||
<span class="text-danger">Silahkan lengkapi data pada menu Usulan Adiwiyata.</span>
|
||||
@else
|
||||
<div class="alert alert-danger">
|
||||
Belum ada data usulan
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if(@$usulan)
|
||||
<table class="table table-bordered">
|
||||
<tr class="bg-success text-white">
|
||||
<th colspan="2"><b>Penghargaan Terakhir</b></th>
|
||||
|
@ -130,6 +163,7 @@
|
|||
<td style="vertical-align: middle;">--</td>
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -74,7 +74,10 @@
|
|||
<td colspan="2"><h4><b>{{@$nama_sekolah}}</b></h4></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="badge badge-primary">{{@$tingkat}}</span> <span class="badge badge-success">{{$status}}</span></td>
|
||||
<td colspan="2">
|
||||
<span class="badge badge-primary">{{@$tingkat}}</span>
|
||||
<span class="badge badge-success">{{@$status}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><p>{{@$alamat_sekolah}}</p></td>
|
||||
|
|
|
@ -66,6 +66,49 @@
|
|||
@endsection
|
||||
@section('page-js')
|
||||
<script type="text/javascript">
|
||||
$("#grid-data").on("click", ".forcelogin", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
swal({
|
||||
title: "Force Login!",
|
||||
text: "Apa anda yakin ingin login sebagai akun ini ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3F7D58",
|
||||
confirmButtonText: "Ya Masuk Sekarang",
|
||||
cancelButtonText: "Tidak",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
},
|
||||
function(isConfirm) {
|
||||
if(isConfirm){
|
||||
|
||||
request = $.ajax({
|
||||
url: base_url,
|
||||
type: "GET",
|
||||
});
|
||||
|
||||
// Callback handler that will be called on success
|
||||
request.done(function(response, textStatus, jqXHR){
|
||||
console.log(response);
|
||||
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
window.location.href = '{{url("/dashboard")}}';
|
||||
history.pushState(null, null, location.href);
|
||||
window.onpopstate = function () {
|
||||
history.go(1);
|
||||
};
|
||||
});
|
||||
|
||||
// Callback handler that will be called on failure
|
||||
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||
toastr.error(
|
||||
"Gagal "+textStatus, errorThrown
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$("#grid-data").on("click", ".remove_data", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
|
|
Loading…
Reference in New Issue