<?php

use Illuminate\Support\Facades\Route;
use App\Http\Middleware\Session;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\AjaxController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\KuesionerController;
use App\Http\Controllers\SampahController;
use App\Http\Controllers\Master\IndikatorController;
use App\Http\Controllers\Master\KomponenController;
use App\Http\Controllers\Master\FormKriteriaController;
use App\Http\Controllers\Management\UserController;
use App\Http\Controllers\Management\UserSekolahController;
use App\Http\Controllers\Management\RoleController;
use App\Http\Controllers\Management\AksesController;
use App\Http\Controllers\Modules\Usulan\AdministrasiController;
use App\Http\Controllers\Modules\Usulan\KriteriaController;
use App\Http\Controllers\Modules\Usulan\ProgressController;
use App\Http\Controllers\Modules\Usulan\SekolahBinaanController;
use App\Http\Controllers\Modules\Usulan\CSAKController;
use App\Http\Controllers\Modules\Usulan\CSAPController;
use App\Http\Controllers\Modules\Usulan\CSAMController;
use App\Http\Controllers\Modules\Usulan\CSANController;
use App\Http\Controllers\Modules\Usulan\SuratController;
use App\Http\Controllers\Modules\Usulan\SKController;
use App\Http\Controllers\Modules\Konten\GaleriController;
use App\Http\Controllers\Modules\Konten\KegiatanController;

Route::get('dashboard',[HomeController::class,'dashboard'])->name('dashboard');
Route::post('session', [HomeController::class, 'session'])->name('dashboard.session');
Route::get('dashboard/gridUsulan',[HomeController::class,'gridUsulan'])->name('gridUsulan');
Route::get('dashboard/gridAdministrasi',[HomeController::class,'gridAdministrasi'])->name('gridAdministrasi');
Route::get('profile/{id?}',[ProfileController::class,'profile'])->name('profile');
Route::post('profile-store',[ProfileController::class,'profileStore'])->name('profileStore');
Route::get('profile-sekolah',[ProfileController::class,'index'])->name('profile.index');
Route::get('profile-sekolah/grid',[ProfileController::class,'grid'])->name('profile.grid');
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('konten.')->prefix('konten')->group(function () {

    Route::name('kegiatan.')->prefix('kegiatan')->group(function () {
        Route::resource('/',KegiatanController::class);
        Route::get('/update/{id?}',[KegiatanController::class,'update'])->name('update');
        Route::get('/grid',[KegiatanController::class,'grid'])->name('grid');
        Route::get('delete/{id?}',[KegiatanController::class,'delete'])->name('delete');
        Route::post('image/delete/{id?}',[KegiatanController::class,'imageDelete'])->name('image.delete');
    });

    Route::name('galeri.')->prefix('galeri')->group(function () {
        Route::resource('/',GaleriController::class);
        Route::get('/grid',[GaleriController::class,'grid'])->name('grid');
        Route::get('/update/{id?}',[GaleriController::class,'update'])->name('update');
        Route::get('delete/{id?}',[GaleriController::class,'delete'])->name('delete');
    });

});
Route::name('master.')->prefix('master')->group(function () {
    Route::resource('indikator',IndikatorController::class);
    Route::resource('komponen',KomponenController::class);

    Route::name('form-kriteria.')->prefix('form-kriteria')->group(function () {
        Route::get('/',[FormKriteriaController::class,'index'])->name('index');
        Route::get('/update/{id?}',[FormKriteriaController::class,'update'])->name('update');
        Route::post('/store',[FormKriteriaController::class,'store'])->name('store');
        Route::get('/grid',[FormKriteriaController::class,'grid'])->name('grid');
        Route::get('delete/{id?}',[FormKriteriaController::class,'delete'])->name('delete');
    });
});

Route::name('kuesioner.')->prefix('kuesioner')->group(function () {
    Route::get('/',[KuesionerController::class,'index'])->name('index');
    Route::get('/grid',[KuesionerController::class,'grid'])->name('grid');
    Route::get('/update/{id?}',[KuesionerController::class,'update'])->name('update');
    Route::post('/store',[KuesionerController::class,'store'])->name('store');
    Route::get('/verifikasi/{id?}',[KuesionerController::class,'verifikasi'])->name('verifikasi');
    Route::get('/tolak/{id?}',[KuesionerController::class,'tolak'])->name('tolak');
});

Route::name('sampah.')->prefix('sampah')->group(function () {
        Route::resource('/',SampahController::class);
        Route::get('/update/{id}',[SampahController::class,'update'])->name('update');
        Route::get('/grid',[SampahController::class,'grid'])->name('grid');
    });

Route::name('usulan.')->prefix('usulan')->group(function () {

    Route::name('csak.')->prefix('csak')->group(function () {
        Route::resource('/',CSAKController::class);
        Route::get('/update/{id}',[CSAKController::class,'update'])->name('update');
        Route::get('/resume/{sekolah_id}',[CSAKController::class,'resume'])->name('resume');
        Route::get('/grid',[CSAKController::class,'grid'])->name('grid');
    });

    Route::name('csap.')->prefix('csap')->group(function () {
        Route::resource('/',CSAPController::class);
        Route::get('update/{id}',[CSAPController::class,'update'])->name('update');
        Route::get('/resume/{sekolah_id}',[CSAPController::class,'resume'])->name('resume');
        Route::get('/grid',[CSAPController::class,'grid'])->name('grid');
    });

    Route::name('csam.')->prefix('csam')->group(function () {
        Route::resource('/',CSAMController::class);
        Route::get('update/{id}',[CSAMController::class,'update'])->name('update');
        Route::get('/resume/{sekolah_id}',[CSAMController::class,'resume'])->name('resume');
        Route::get('/grid',[CSAMController::class,'grid'])->name('grid');
    });

    Route::name('csan.')->prefix('csan')->group(function () {
        Route::resource('/',CSANController::class);
        Route::get('update/{id}',[CSANController::class,'update'])->name('update');
        Route::get('/resume/{sekolah_id}',[CSANController::class,'resume'])->name('resume');
        Route::get('/grid',[CSANController::class,'grid'])->name('grid');
    });

    Route::name('surat.')->prefix('surat')->group(function () {
        Route::resource('/',SuratController::class);
        Route::get('/grid',[SuratController::class,'grid'])->name('grid');
    });

    

    // Route::name('progress.')->prefix('progress')->group(function () {
    //     Route::get('/',[ProgressController::class,'index'])->name('index');
    // });


    
});

Route::name('usulan_adiwiyata.')->prefix('usulan/adiwiyata')->group(function () {

     Route::name('kriteria.')->prefix('kriteria')->group(function () {
        Route::get('/',[KriteriaController::class,'index'])->name('index');
        Route::get('/resume/{sekolah_id}',[KriteriaController::class,'resume'])->name('resume');
        Route::get('/progress/{sekolah_id}',[KriteriaController::class,'progress'])->name('progress');
        Route::post('/kirimData/{sekolah_id}/{kuesioner_id}',[KriteriaController::class,'kirimData'])->name('kirimData');
        Route::get('/deleteFile/{id}/{pagenumber}',[KriteriaController::class,'deletFile'])->name('deletFile');
        Route::post('/store',[KriteriaController::class,'store2026'])->name('store');
    });

    Route::name('binaan.')->prefix('binaan')->group(function () {
        Route::get('/',[SekolahBinaanController::class,'index'])->name('index');
    });

    Route::name('administrasi.')->prefix('administrasi')->group(function () {
        Route::get('/',[AdministrasiController::class,'index'])->name('index');
        Route::get('/grid',[AdministrasiController::class,'grid'])->name('grid');
        Route::post('/store',[AdministrasiController::class,'store'])->name('store');
        Route::get('/verifikasi/{id?}',[AdministrasiController::class,'verifikasi'])->name('verifikasi');
        Route::get('/tolak/{id?}',[AdministrasiController::class,'tolak'])->name('tolak');
        Route::get('/tolak_kosong/{id?}',[AdministrasiController::class,'tolak_kosong'])->name('tolak_kosong');
        Route::post('/update',[AdministrasiController::class,'update'])->name('update');
    });
    Route::name('sk.')->prefix('sk')->group(function () {
        Route::resource('/',SKController::class);
        Route::get('/update/{id?}',[SKController::class,'update'])->name('update');
        Route::get('/grid',[SKController::class,'grid'])->name('grid');
    });
});

Route::name('management.')->prefix('management')->group(function () {
    Route::name('user.')->prefix('user')->group(function () {
        Route::resource('/',UserController::class);
        Route::get('grid',[UserController::class,'grid'])->name('grid');
        Route::get('update/{id?}',[UserController::class,'update'])->name('update');
        Route::get('delete/{id?}',[UserController::class,'delete'])->name('delete');
        Route::get('forcelogin/{id?}',[UserController::class,'forcelogin'])->name('forcelogin');
    });

    Route::name('user_sekolah.')->prefix('user_sekolah')->group(function () {
        Route::resource('/',UserSekolahController::class);
        Route::get('grid',[UserSekolahController::class,'grid'])->name('grid');
        Route::get('update/{id?}',[UserSekolahController::class,'update'])->name('update');
        Route::get('delete/{id?}',[UserSekolahController::class,'delete'])->name('delete');
    });

    Route::name('role.')->prefix('role')->group(function () {
        Route::resource('/',RoleController::class);
        Route::get('grid',[RoleController::class,'grid'])->name('grid');

        Route::name('akses.')->prefix('akses')->group(function () {
            Route::resource('/',AksesController::class);
            Route::get('{id}/edit',[AksesController::class,'edit'])->name('edit');
        });
    });

    
});