119 lines
3.4 KiB
PHP
119 lines
3.4 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;
|
|
|
|
class CSAMController extends Controller
|
|
{
|
|
private $template = 'modules.usulan.csam';
|
|
private $route = 'modules.usulan.csam';
|
|
private $title = 'Usulan CSAM';
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$data['route'] = $this->route;
|
|
$data['title'] = $this->title;
|
|
$data['provinsi'] = Provinsi::where('kode_wilayah','010000')->get();
|
|
|
|
return view($this->template.'.index',$data);
|
|
}
|
|
|
|
public function grid(Request $request)
|
|
{
|
|
$kuesioner = Kuesioner::where('level',3)->orderBy('created_at','DESC')->get();
|
|
foreach ($kuesioner as $key => $row) {
|
|
|
|
$action = '';
|
|
|
|
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
|
$action .= '<a href="'.url('kuesioner/update/'.encode_id($row->ms_sekolah_id)).'" data-toggle="tooltip" title="Resume" class="btn btn-xs btn-block btn-primary"><i class="fal fa-eye 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';
|
|
}
|
|
|
|
$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,
|
|
'wilayah' => $row->sekolah->kabupaten->name,
|
|
'penghargaan' => $penghargaan,
|
|
'action' => $action,
|
|
];
|
|
|
|
}
|
|
|
|
return response()->json($_data);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* 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)
|
|
{
|
|
//
|
|
}
|
|
}
|