<?php

use App\Http\Controllers\DashboardController;
use App\Http\Controllers\LelangPersonilController;
use App\Http\Controllers\PaketLelangController;
use App\Http\Controllers\PersonilController;
use Illuminate\Support\Facades\Auth;
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 and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Auth::routes(['verify' => false]);

Route::middleware('auth')->group(function () {
    Route::get('/', function () {
        return redirect()->route('dashboard');
    });
    Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
    
    Route::resource('personils', PersonilController::class);
    Route::put('/personils/{personil}/checklist', [PersonilController::class, 'updateChecklist'])->name('personils.update-checklist');
    
    Route::resource('paket-lelangs', PaketLelangController::class);
    
    Route::get('/paket-lelangs/{paketLelang}/personils/create', [LelangPersonilController::class, 'create'])->name('paket-lelangs.personils.create');
    Route::post('/paket-lelangs/{paketLelang}/personils', [LelangPersonilController::class, 'store'])->name('paket-lelangs.personils.store');
    Route::get('/paket-lelangs/{paketLelang}/personils/{lelangPersonil}/edit', [LelangPersonilController::class, 'edit'])->name('paket-lelangs.personils.edit');
    Route::put('/paket-lelangs/{paketLelang}/personils/{lelangPersonil}', [LelangPersonilController::class, 'update'])->name('paket-lelangs.personils.update');
    Route::delete('/paket-lelangs/{paketLelang}/personils/{lelangPersonil}', [LelangPersonilController::class, 'destroy'])->name('paket-lelangs.personils.destroy');
    
    Route::get('/panduan-gdrive', function () {
        return view('panduan-gdrive');
    })->name('panduan-gdrive');
});
