<?php

use Illuminate\Support\Facades\Route;

use App\Http\Controllers\Authentication\LoginController;

use App\Http\Controllers\DashboardController;
use App\Http\Controllers\JenisController;
use App\Http\Controllers\ReviewerController;
use App\Http\Controllers\DaftarProposalController;
use App\Http\Controllers\JadwalKegiatanController;
use App\Http\Controllers\JenisPenilaianMonevController;
use App\Http\Controllers\SelectController;

use App\Http\Controllers\Mahasiswa\KelompokController as MahasiswaKelompok;
use App\Http\Controllers\Mahasiswa\AnggotaController;
use App\Http\Controllers\Mahasiswa\ProposalController as MahasiswaProposal;
use App\Http\Controllers\Mahasiswa\BiodataController as BiodataMahasiswa;
use App\Http\Controllers\Mahasiswa\SeleksiController as SeleksiMahasiswa;
use App\Http\Controllers\Mahasiswa\MonevController as MonevMahasiswa;

use App\Http\Controllers\Dosen\KelompokController as DosenKelompok;
use App\Http\Controllers\Dosen\BiodataController as DosenBiodata;
use App\Http\Controllers\Dosen\ProposalController as DosenProposal;
use App\Http\Controllers\Dosen\SeleksiController as DosenSeleksi;
use App\Http\Controllers\Dosen\MonevController as DosenMonev;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Route::get('/', function () {
//     return view('mahasiswa.index');
// });

Route::get('/', function () {
    return view('auth.login');
});

Route::group(['namespace' => 'Authentication'], function () {
    Route::get('sso/{email}/{sessionid}', [LoginController::class, 'sso']);
});

Route::get('login', [App\Http\Controllers\Auth\LoginController::class, 'showLoginForm'])->name('login');
Route::post('login', [Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::class, 'store']);

Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {

    Route::resource('dashboard', DashboardController::class);

    Route::post('selectmahasiswa', [SelectController::class, 'mahasiswa'])->name('mahasiswa-select');

    Route::name('mahasiswa.')->prefix('mahasiswa')->middleware(['role:admin|mahasiswa|tendik'])->group(function () {

        //biodata
        Route::resource('biodata', BiodataMahasiswa::class);

        //kelompok
        Route::resource('kelompok', MahasiswaKelompok::class);
        Route::get('/kelompok-new/{id}', [MahasiswaKelompok::class, 'newkelompok'])->name('kelompok.createnew');
        Route::post('/kelompok-kirim', [MahasiswaKelompok::class, 'kirim'])->name('kelompok.kirim');
        Route::post('/kelompok-hapus', [MahasiswaKelompok::class, 'hapus'])->name('kelompok.hapus');

        Route::resource('anggota', AnggotaController::class);

        //proposal
        Route::resource('proposal', MahasiswaProposal::class);
        Route::post('/proposal-hapus', [MahasiswaProposal::class, 'hapus'])->name('proposal.hapus');

        //seleksi
        Route::resource('seleksi', SeleksiMahasiswa::class);
        Route::get('/seleksi-internal', [SeleksiMahasiswa::class, 'seleksiInternal'])->name('seleksi-internal');
        Route::get('/seleksi-belmawa', [SeleksiMahasiswa::class, 'seleksiBelmawa'])->name('seleksi-belmawa');
        Route::get('/seleksi-internal-revisi', [SeleksiMahasiswa::class, 'internalRevisi'])->name('seleksi-internal-revisi');

        Route::get('/seleksi-belmawa/revisi/{id}', [SeleksiMahasiswa::class, 'editBelmawa'])->name('seleksi-belmawa-revisi');
        Route::post('/seleksi-belmawa/upload', [SeleksiMahasiswa::class, 'uploadBelmawa'])->name('seleksi-belmawa-upload');

        //seleksi
        Route::get('/monev-satu', [MonevMahasiswa::class, 'monevsatu'])->name('monev-satu');
        Route::get('/monev-dua', [MonevMahasiswa::class, 'monevdua'])->name('monev-dua');
        Route::get('/monev-tiga', [MonevMahasiswa::class, 'monevtiga'])->name('monev-tiga');

        Route::get('/monev-revisi/{id}', [MonevMahasiswa::class, 'revisiMonev'])->name('monev-revisi');
        Route::post('/monev-revisi/upload', [MonevMahasiswa::class, 'uploadMonev'])->name('monev-revisi-upload');

    });

    Route::name('dosen.')->prefix('dosen')->middleware(['role:admin|dosen|tendik'])->group(function () {

        //biodata
        Route::resource('biodata', DosenBiodata::class);

        //kelompok
        Route::resource('kelompok', DosenKelompok::class);
        Route::get('/kelompok-new/{id}', [DosenKelompok::class, 'newkelompok'])->name('kelompok.createnew');
        Route::post('/kelompok-tolak', [DosenKelompok::class, 'tolak'])->name('kelompok.tolak');
        Route::post('/kelompok-terima', [DosenKelompok::class, 'terima'])->name('kelompok.terima');

        //proposal
        Route::resource('proposal', DosenProposal::class);
        Route::post('/proposal-setuju', [DosenProposal::class, 'setuju'])->name('proposal.setuju');

        //seleksi
        Route::resource('seleksi', DosenSeleksi::class);
        Route::get('/seleksi-internal', [DosenSeleksi::class, 'seleksiInternal'])->name('seleksi-internal');
        Route::get('/seleksi-belmawa', [DosenSeleksi::class, 'seleksiBelmawa'])->name('seleksi-belmawa');
        Route::get('/seleksi-internal-revisi', [DosenSeleksi::class, 'internalRevisi'])->name('seleksi-internal-revisi');

         //seleksi
         Route::get('/monev-satu', [DosenMonev::class, 'monevsatu'])->name('monev-satu');
         Route::get('/monev-dua', [DosenMonev::class, 'monevdua'])->name('monev-duaa');
         Route::get('/monev-tiga', [DosenMonev::class, 'monevtiga'])->name('monev-tiga');
    });
});

Route::resource('jenis', JenisController::class);
Route::get('getJenis', [JenisController::class, 'getData'])->name('getJenis');
Route::resource('jenis_penilaian_monev', JenisPenilaianMonevController::class);
Route::get('getJenisPenilaianMonev', [JenisPenilaianMonevController::class, 'getData'])->name('getJenisPenilaianMonev');

Route::get('rowJenisPenilaianMonev', function () {
    return view('backend/jenis_penilaian_monev/row');
});

Route::resource('jadwal_kegiatan', JadwalKegiatanController::class);
Route::resource('seleksi_internal_reviewer', ReviewerController::class);
Route::get('getReviewer', [ReviewerController::class, 'getData'])->name('getReviewer');
Route::get('getDosen', [ReviewerController::class, 'getDosen'])->name('getDosen');

Route::resource('seleksi_internal_proposal', DaftarProposalController::class);
Route::get('getDaftarProposal', [DaftarProposalController::class, 'getData'])->name('getDaftarProposal');

//Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');




