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 .= '';
            // }
            if($row->level == 0){
                $penghargaan = ' Belum Pernah';
            }elseif($row->level == 1){
                $penghargaan = ' Adiwiyata Kab/Kota';
            }elseif($row->level == 2){
                $penghargaan = ' Adiwiyata Provinsi';
            }elseif($row->level == 3){
                $penghargaan = ' Adiwiyata Nasional';
            }elseif($row->level == 4){
                $penghargaan = ' Adiwiyata Mandiri';
            }
            $penilaian = '';
            $penilaian .= ' Sekolah : '.getNilaiAll('sekolah',$row->ms_sekolah_id).'';
            $penilaian .= ' Kota : '.getNilaiAll('kota',$row->ms_sekolah_id).'';
            $penilaian .= ' Provinsi : '.getNilaiAll('provinsi',$row->ms_sekolah_id).'';
            $log  = KuesionerLog::where('kuesioner_id',$row->KuesionerId)->orderBy('created_at','DESC')->first();
            $progress = ''.str_replace('_',' ',\Str::title($log->step)).'';
            $sekolah = '';
            $sekolah .= @$row->sekolah->nama_sekolah.'
';
            $sekolah .= ''.@$row->profile->tingkat->name.' ';
            $sekolah .= ''.@$row->profile->status_sekolah.' ';
            $_data[] = [
                'no'                => $key+1,
                'id'                => encode_id($row->id),
                'npsn'              => $row->sekolah->npsn,
                'nama'              => $sekolah,
                'status_level'      => 'Level '.levelAdiwiyata($row->npsn).'',
                '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)
    {
        //
    }
}