<?php

use App\Http\Controllers\IndexController;
use App\Http\Controllers\InsertNotesController;
use App\Http\Controllers\ModificationController;
use App\Http\Controllers\StatistiqueController;
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('/', [IndexController::class, 'connexion']);

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


Route::group(['middleware' => ['load_tenant']], function () {

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

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

    //session normale
    Route::get('/insersion-normale', [InsertNotesController::class, 'sessionNormale'])->name('session_normale');
    Route::post('/ec-and-ue', [InsertNotesController::class, 'ajaxUEANDEC'])->name('ec.ue');
    Route::post('/ue', [InsertNotesController::class, 'ajaxUE'])->name('ue');
    Route::post('/session-normale/liste', [InsertNotesController::class, 'sessionNormaleList'])->name('insertion.normale.list');
    Route::post('/session-normale/insertion', [InsertNotesController::class, 'sessionNormaleInsertion'])->name('insertion.normale.note1');
   
    //session rattrapage
    Route::get('/insersion-rattrapage', [InsertNotesController::class, 'sessionRattrapage'])->name('session_rattrapage');
    Route::post('/session-rattrapage/liste', [InsertNotesController::class, 'sessionRattrapageList'])->name('insertion.rattrapage.list');
    Route::post('/session-rattrapage/insertion', [InsertNotesController::class, 'sessionRattrapageInsertion'])->name('insertion.rattrapage.note1');

    //session rattrapage
    Route::get('/insersion-reprise', [InsertNotesController::class, 'sessionReprise'])->name('session_reprise');
    Route::post('/session-reprise/liste', [InsertNotesController::class, 'sessionRepriseList'])->name('insertion.reprise.list');
    Route::post('/session-reprise/insertion', [InsertNotesController::class, 'sessionRepriseInsertion'])->name('insertion.reprise.note1');


    //modification des notes
    Route::get('/modification', [ModificationController::class, 'modification'])->name('modif');
    Route::post('/modiflist', [ModificationController::class, 'listmodif'])->name('listModifPost');
    Route::post('/modiflistajax', [ModificationController::class, 'updateNote'])->name('operation.update');

    Route::get('/statistiques', [StatistiqueController::class, 'statistiques'])->name('statistique');
    
    Route::post('/generationExcel', [StatistiqueController::class, 'excelEffectifValidation'])->name('statistique.excelEffectifValidation');
   
});
Route::get('/logout', [IndexController::class, 'logout'])->name('logout');

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