<?php

use App\Http\Controllers\Authentication\LoginController;
use App\Http\Controllers\GetDataController;
use App\Http\Controllers\User\BukuAjarController;
use App\Http\Controllers\User\FasilitasController;
use App\Http\Controllers\User\KekayaanIntelController;
use App\Http\Controllers\User\KontrakKerjaController;
use App\Http\Controllers\User\PenelitianSumberDanaController;
use App\Http\Controllers\User\PenelitiAsingController;
use App\Http\Controllers\User\PenyelenggaraanSeminarController;
use App\Http\Controllers\User\PublikasiArtikelController;
use App\Http\Controllers\User\PublikasiJurnalController;
use App\Http\Controllers\User\StafPendukungController;
use App\Http\Controllers\User\UnitBisnisController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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('dashboard');
});

Route::get('login', [LoginController::class, 'index'])->name('login');
Route::get('sso/{email}/{sessionid}', [LoginController::class, 'sso']);

Route::middleware(['auth:sanctum', 'verified'])->group(function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');

    Route::get('/get-biodata', [GetDataController::class, 'getBiodata'])->name('get-biodata');
    // Route::get('/get-row-anggota', [PenelitianSumberDanaController::class, 'getRowAnggota'])->name('get-row-anggota');
    Route::get('/get-children', [GetDataController::class, 'getChildren'])->name('get-children');

    Route::resource('/bukuajar', BukuAjarController::class);
    Route::resource('/fasilitas', FasilitasController::class);
    Route::resource('/kekayaanintelek', KekayaanIntelController::class);
    Route::resource('/kontrakkerja', KontrakKerjaController::class);
    Route::resource('/penelitiansumber', PenelitianSumberDanaController::class);
    Route::get('/penelitiansumber/next-form/{id}', [PenelitianSumberDanaController::class, 'nextForm'])->name('penelitiansumber.next-form');
    Route::get('/penelitiansumber/edit-anggota/{id}', [PenelitianSumberDanaController::class, 'editAnggota'])->name('penelitiansumber.edit-anggota');
    Route::post('/penelitiansumber/simpan-anggota/{id}', [PenelitianSumberDanaController::class, 'simpanAnggota'])->name('penelitiansumber.simpan-anggota');
    Route::post('/penelitiansumber/delete-anggota', [PenelitianSumberDanaController::class, 'deleteAnggota'])->name('penelitiansumber.delete-anggota');
    Route::post('/penelitiansumber/cek-simpan-anggota', [PenelitianSumberDanaController::class, 'cekSimpanAnggota'])->name('penelitiansumber.cek-simpan-anggota');
    Route::resource('/penelitiasing', PenelitiAsingController::class);
    Route::resource('/publikasiartikel', PublikasiArtikelController::class);
    Route::resource('/publikasijurnal', PublikasiJurnalController::class);
    Route::resource('/penyelenggaraseminar', PenyelenggaraanSeminarController::class);
    Route::resource('/stafpendukung', StafPendukungController::class);
    Route::resource('/unitbisnis', UnitBisnisController::class);
});
