141 lines
4.6 KiB
PHP
141 lines
4.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Modules\Usulan;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Master\Provinsi;
|
|
use App\Models\Kuesioner;
|
|
use App\Models\KuesionerLog;
|
|
use App\Models\Master\Sekolah;
|
|
use App\Models\Master\FormKriteria;
|
|
use App\Models\DokumenAdministrasi;
|
|
|
|
class SKController extends Controller
|
|
{
|
|
|
|
private $template = 'modules.usulan.sk';
|
|
private $route = 'modules.usulan.sk';
|
|
private $title = 'Penetapan SK';
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
permission('is_read', $this->route, 'module',true);
|
|
$data['title'] = $this->title;
|
|
$data['route'] = $this->route;
|
|
$data['provinsi'] = Provinsi::where('kode_wilayah','010000')->get();
|
|
|
|
return view($this->template.'.index',$data);
|
|
}
|
|
|
|
public function grid(Request $request)
|
|
{
|
|
$kuesioner = Kuesioner::where('level',0)->orderBy('created_at','DESC')->get();
|
|
foreach ($kuesioner as $key => $row) {
|
|
|
|
$action = '';
|
|
|
|
// if($row->status == 4){
|
|
// $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';
|
|
}elseif($row->level == 1){
|
|
$penghargaan = '<i class="fal fa-trophy"></i> Adiwiyata Kab/Kota';
|
|
}elseif($row->level == 2){
|
|
$penghargaan = '<i class="fal fa-trophy"></i> Adiwiyata Provinsi';
|
|
}elseif($row->level == 3){
|
|
$penghargaan = '<i class="fal fa-trophy"></i> Adiwiyata Nasional';
|
|
}elseif($row->level == 4){
|
|
$penghargaan = '<i class="fal fa-trophy"></i> Adiwiyata Mandiri';
|
|
}
|
|
|
|
$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>';
|
|
|
|
$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>';
|
|
|
|
$sekolah = '';
|
|
$sekolah .= @$row->sekolah->nama_sekolah.'<br>';
|
|
$sekolah .= '<span class="badge badge-success">'.@$row->profile->tingkat->name.'</span> ';
|
|
$sekolah .= '<span class="badge badge-primary">'.@$row->profile->status_sekolah.'</span> ';
|
|
|
|
$_data[] = [
|
|
'no' => $key+1,
|
|
'id' => encode_id($row->id),
|
|
'npsn' => $row->sekolah->npsn,
|
|
'nama' => $sekolah,
|
|
'status_level' => '<span style="width:100%" class="badge badge-secondary">Level '.levelAdiwiyata($row->npsn).'</span>',
|
|
'wilayah' => $row->sekolah->kabupaten->name,
|
|
'penghargaan' => $penghargaan,
|
|
'penilaian' => $penilaian,
|
|
'progress' => $progress,
|
|
'action' => $action,
|
|
];
|
|
|
|
}
|
|
|
|
return response()->json($_data);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
permission('is_create', $this->route, 'module',true);
|
|
|
|
$data['title'] = $this->title;
|
|
$data['route'] = $this->route;
|
|
|
|
return view($this->template.'.form',$data);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(string $id)
|
|
{
|
|
//
|
|
}
|
|
}
|