<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\InscripcionController;
use App\Http\Controllers\ReciboController;
use App\Http\Controllers\FormularioController;
use App\Http\Controllers\AjaxController;


/*
|--------------------------------------------------------------------------
| 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('welcome');
    return redirect()->route('vistaFormulario');
});

Route::get('/inscripcion', [FormularioController::class, 'llenarFormlr'])->name('vistaFormulario');

Route::post('/inscripcion/enviar', [InscripcionController::class, 'enviar'])->name('guardarInscripcion');

Route::post('/recibo/guardar', [ReciboController::class, 'enviar'])->name('guardarRecibo');

Route::get('/recibo/{dataRecibo}', function (){
    return view('recibo')->compact($dataRecibo);
})->name('verRecibo');

Route::get('/recibo/cargarImagen/{codigoBarrs}', [ReciboController::class, 'mostrarCodigo'])->name('setImg');

Route::get('/prueba', function () {
    return view('despedida');
});

Route::post('/inscripcion/ajax', [InscripcionController::class, 'buscarValdrAjax'])->name('ajaxForm');

// Route::get('/inscripcion/ajaxProgm/{nvlProg}', [AjaxController::class, 'llenarProgramas'])->name('prb1');
// Route::get('/inscripcion/ajaxAsesr', [AjaxController::class, 'llenarAsesores'])->name('prb2');

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

require __DIR__.'/auth.php';
