<?php
use App\Http\Controllers\CaptchaServiceController;

/*
|--------------------------------------------------------------------------
| 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::match(['get', 'post'],'/', 'indexController@index')->name('index');
Route::match(['get', 'post'],'/iniciar', 'usuarioController@iniciar')->name('iniciar');

Route::match(['get', 'post'],'/registro', 'indexController@registro')->name('registro2');
Route::match(['get', 'post'],'/usuario/registro', 'usuarioController@registro')->name('registro');
Route::match(['get', 'post'],'/buscarcedula/{id}', 'usuarioController@buscarcedula')->name('buscarcedula');

Route::match(['get', 'post'],'/recuperar', 'usuarioController@recuperar')->name('recuperar');
Route::match(['get', 'post'],'/recuperar1/{id}', 'usuarioController@recuperar1')->name('recuperar1');
Route::match(['get', 'post'],'/recuperar2', 'usuarioController@recuperar2')->name('recuperar2');



Route::group(['middleware' => 'usuarios_duales'], function(){
//LENTES//
Route::match(['get', 'post'],'/reapp', 'lentes_soliController@registro_venapp')->name('reapp');

Route::match(['get', 'post'],'/principal', 'indexController@bienvenido')->name('principal');
Route::match(['get', 'post'],'/lentes/lista', 'lentes_soliController@lista')->name('l_lentes_lista');
Route::match(['get', 'post'],'/lentes/registro', 'lentes_soliController@index')->name('l_lentes');

Route::match(['get', 'post'],'/menor', 'lentes_soliController@buscar_datos')->name('buscar_datos');

Route::match(['get', 'post'],'/consultar', 'personaController@consultar')->name('consultar_cedula');
Route::match(['get', 'post'],'/aseo', 'personaController@siremi_aseo_consulta')->name('siremi_aseo_consulta');


//PERFIL
Route::match(['get', 'post'],'/perfil/configuracion', 'perfilController@perfilUsuario')->name('perfilUsuario');
Route::match(['get', 'post'],'/perfil2', 'perfilController@actualizar_usuario')->name('actualizar_usuario');

Route::match(['get', 'post'],'/perfil/personal', 'perfilController@perfilPersonal')->name('perfilPersonal');

Route::match(['get', 'post'],'/perfil/datos_personales', 'perfilController@datos_personales')->name('datos_personales');

Route::match(['get', 'post'],'/perfil/familia', 'perfilController@grupo_familiar')->name('grupo_familiar');

Route::match(['get', 'post'],'/perfil/familia/add/cedulado', 'perfilController@grupo_familiar_cedulado')->name('grupo_familiar_cedulado');
Route::match(['get', 'post'],'/perfil/familia/add/nocedulado', 'perfilController@grupo_familiar_nocedulado')->name('grupo_familiar_nocedulado');

Route::match(['get', 'post'],'/perfil/familia/guardar_cedulado_familia', 'perfilController@guardar_cedulado_familia')->name('guardar_cedulado_familia');

Route::match(['get', 'post'],'/perfil/familia/eliminar_familia', 'perfilController@Eliminar_familia')->name('Eliminar_familia');

Route::match(['get', 'post'],'/perfil/familia/guardar_nocedulado_familia', 'perfilController@guardar_nocedulado_familia')->name('guardar_nocedulado_familia');

});


Route::match(['get', 'post'],'/admincp', 'indexController@login_admin')->name('admincp');



// INICIO VALIDADOR ADMINISTRACION //
Route::group(['middleware' => 'administrador'], function(){
//LENTES
Route::match(['get', 'post'],'/key', 'lentes_reportesController@key')->name('key');


Route::match(['get', 'post'],'/admincp/lentes', 'lentes_soliController@admin_lentes')->name('admin_lentes');
Route::match(['get', 'post'],'/admincp/report', 'lentes_reportesController@index_report')->name('index_report');
Route::match(['get', 'post'],'/admincp/report/r1', 'lentes_reportesController@r1')->name('index_reportr1');

Route::match(['get', 'post'],'/admincp/analisis', 'lentes_soliController@analisis')->name('admin_lentes_analisis');
Route::match(['get', 'post'],'/admincp/aprobacion', 'lentes_soliController@aprobacion')->name('aprobacion');

//
Route::match(['get', 'post'],'/persona', 'personaController@index')->name('indexp');
Route::match(['get', 'post'],'/persona/aseo', 'personaController@index2')->name('indexp2');
Route::match(['get', 'post'],'/persona/{id}/aseo', 'personaController@index3')->name('indexp3');
Route::match(['get', 'post'],'/persona/{id}/comunidad', 'personaController@buscar')->name('bpersona');

//
Route::match(['get', 'post'],'/bzona/{id}', 'funcionesController@zona')->name('bzona');
Route::match(['get', 'post'],'/jcom/{id}', 'funcionesController@j_comunidad')->name('jcom');
Route::match(['get', 'post'],'/confcom/{id}', 'funcionesController@configcomunidad')->name('confcom');
Route::match(['get', 'post'],'/buscarjf/{id}', 'funcionesController@buscar__')->name('buscar__');
//

///////////
Route::match(['get', 'post'],'/registro2', 'personaController@registrar2')->name('registrar2');
Route::match(['get', 'post'],'/registro3', 'personaController@registrar3')->name('registrar3');
Route::match(['get', 'post'],'/registro4', 'personaController@registrar4')->name('registrar4');
Route::match(['get', 'post'],'/cambio_fecha/{id}', 'personaController@cambio_fecha')->name('cambio_fecha');
Route::match(['get', 'post'],'/cambio_propietario', 'personaController@cambio_propietario')->name('cambio_propietario');
Route::match(['get', 'post'],'/bpagos/{id}', 'personaController@consultar_pagos')->name('consultar_pagos');
///////////


Route::match(['get', 'post'],'/reg__persona', 'personaController@registrar')->name('reg__persona');

//REPORTES ADMIN
Route::match(['get', 'post'],'/reporte/pagos', 'reportesController@pagos')->name('reportepagos');

Route::group(['middleware' => 'root'], function(){
    Route::match(['get', 'post'],'/reporte/participantes', 'reportesController@participantes')->name('participantes');
    Route::match(['get', 'post'],'/reporte/participantes1', 'reportesController@participantes1')->name('participantes1');

    Route::match(['get', 'post'],'/config/update', 'configuracionController@update')->name('update');

    //REPORTES MINI
    Route::match(['get', 'post'],'/reporte/{id}/mini_comprobante', 'reportesController@mini_comprobante')->name('mini_comprobante');
});

//CONFIGURACIONES
Route::match(['get', 'post'],'/config/comunidad', 'configuracionController@comunidad')->name('configc');
Route::match(['get', 'post'],'/config/cambiar', 'configuracionController@rep')->name('rep');

Route::match(['get', 'post'],'/config/cambiar/m', 'configuracionController@cambio')->name('cambiop');

});
// FIN VALIDADOR ADMINISTRACION //
//REPORTES
Route::match(['get', 'post'],'/reporte/{id}/comprobante', 'reportesController@comprobante')->name('comprobante');

//
Route::match(['get', 'post'],'/cne', 'funcionesController@cne')->name('cne');
Route::match(['get', 'post'],'/info', 'configController@info')->name('info');

//

Route::get('/reload-captcha', [CaptchaServiceController::class, 'reloadCaptcha'])->name('reloadCaptcha');

Route::match(['get', 'post'],'/cerrar', 'usuarioController@cerrar_sesion')->name('cerrar');

Route::get('/mantenimiento', function () {
    $exitCode['cache:clear'] = Artisan::call('cache:clear');
    $exitCode['config:cache'] = Artisan::call('config:cache');
    $exitCode['view:clear'] = Artisan::call('view:clear');
    $exitCode['route:clear'] = Artisan::call('route:clear');
    //$exitCode['optimize'] = Artisan::call('optimize');

    dd($exitCode);
});
