<?php

use App\Http\Controllers\DossierController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\IndexController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Session;

/*
|--------------------------------------------------------------------------
| 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('/', [IndexController::class, 'connexion']);

Route::match(['get', 'post'], '/login', [IndexController::class, 'login'])->name('login');
Route::get('/logout', [IndexController::class, 'logout'])->name('logout');

Route::group(
    ['middleware' => ['load_tenant']],
    function () {
        Route::get('/home', [HomeController::class, 'home'])->name('home');

        //Route du profil
        Route::get('/profil/{num}', [IndexController::class, 'profil'])->name('profile');

        Route::post('/profile_update', [IndexController::class, 'updateProfile'])->name('update_prof');

        Route::post('/password_update', [IndexController::class, 'updatePassword'])->name('update_passwd');

        Route::get('/guide', [IndexController::class, 'guide'])->name('guide');

        Route::get('/f_dossier', [DossierController::class, 'formDossier'])->name('f_dossier');

        Route::get('/pageDossier/{matricule}/{idFiliere}/{annee}/{fil}/{niv}/{name}', [DossierController::class, 'pageDossier'])->name('page_dossier');

        Route::post('/student', [DossierController::class, 'checkStudent'])->name('student.name');

        Route::post('/dossier', [DossierController::class, 'dossier'])->name('dossier');

        Route::post('/set_dossier', [DossierController::class, 'set_dossier'])->name('set_dossier');

        Route::get('/qrnew', [HomeController::class, 'qrnew'])->name('qrnew');

        Route::get('/qrnew/traite_verification/{code}', [HomeController::class, 'taiteVerification'])->name('traiteVerification');

        Route::get('/qrnew/numerisation_auto/{matricule}/{niveau}/{annee}/{filiere}/{acad}/{idEtab}', [HomeController::class, 'numerisationAuto'])->name('numerisationAuto');

        Route::get('/qrnew/scanner_auto/{niveau}/{annee}/{filiere}/{acad}/{idEtab}', [HomeController::class, 'scannerAuto'])->name('scannerAuto');

        Route::get('/semi', [HomeController::class, 'semi'])->name('semi');
    }
);
