<?php

use CodeIgniter\Router\RouteCollection;

/** @var RouteCollection $routes */

/* Rutas para configuraciones */
$routes->group('configuracion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {

    /* Paises */
    $routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'Paises::index', ['as' => 'paisList']);
        $routes->get('add', 'Paises::add', ['as' => 'newPais']);
        $routes->post('add', 'Paises::add', ['as' => 'createPais']);
        $routes->get('delete/(:num)', 'Paises::delete/$1');
        $routes->post('create', 'Paises::create', ['as' => 'ajaxCreatePais']);
        $routes->put('update/(:num)', 'Paises::update/$1', ['as' => 'ajaxUpdatePais']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'Paises::edit/$1', ['as' => 'updatePais']);
        $routes->get('datatable', 'Paises::datatable', ['as' => 'dataTableOfPaises']);
        $routes->post('allmenuitems', 'Paises::allItemsSelect', ['as' => 'select2ItemsOfPaises']);
        $routes->post('menuitems', 'Paises::menuItems', ['as' => 'menuItemsOfPaises']);
        $routes->get('menuitems2', 'Paises::menuItems2', ['as' => 'menuItemsOfPaises2']);
    });


    /* Papeles genericos */
    $routes->group('papelesgenericos', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'Papelesgenericos::index', ['as' => 'papelGenericoList']);
        $routes->delete('', 'Papelesgenericos::index', ['as' => 'papelGenericoList2']);
        $routes->get('add', 'Papelesgenericos::add', ['as' => 'newPapelGenerico']);
        $routes->post('add', 'Papelesgenericos::add', ['as' => 'createPapelGenerico']);
        $routes->post('create', 'Papelesgenericos::create', ['as' => 'ajaxCreatePapelGenerico']);
        $routes->put('(:num)/update', 'Papelesgenericos::update/$1', ['as' => 'ajaxUpdatePapelGenerico']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'Papelesgenericos::edit/$1', ['as' => 'updatePapelGenerico']);
        $routes->post('datatable', 'Papelesgenericos::datatable', ['as' => 'dataTableOfPapelesGenericos']);
        $routes->post('allmenuitems', 'Papelesgenericos::allItemsSelect', ['as' => 'select2ItemsOfPapelesGenericos']);
        $routes->post('menuitems', 'Papelesgenericos::menuItems', ['as' => 'menuItemsOfPapelesGenericos']);
        $routes->get('getpapelcliente', 'Papelesgenericos::getPapelCliente', ['as' => 'getPapelCliente']);
        $routes->get('selectpapelespecial', 'Papelesgenericos::selectPapelEspecial', ['as' => 'selectPapelEspecial']);
    });

    /* Papeles impresion */
    $routes->group('papelesimpresion', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'Papelesimpresion::index', ['as' => 'papelImpresionList']);
        $routes->get('add', 'Papelesimpresion::add', ['as' => 'newPapelImpresion']);
        $routes->post('add', 'Papelesimpresion::add', ['as' => 'createPapelImpresion']);
        $routes->post('create', 'Papelesimpresion::create', ['as' => 'ajaxCreatePapelImpresion']);
        $routes->put('(:num)/update', 'Papelesimpresion::update/$1', ['as' => 'ajaxUpdatePapelImpresion']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'Papelesimpresion::edit/$1', ['as' => 'updatePapelImpresion']);
        $routes->post('datatable', 'Papelesimpresion::datatable', ['as' => 'dataTableOfPapelesImpresion']);
        $routes->post('allmenuitems', 'Papelesimpresion::allItemsSelect', ['as' => 'select2ItemsOfPapelesImpresion']);
        $routes->post('menuitems', 'Papelesimpresion::menuItems', ['as' => 'menuItemsOfPapelesImpresion']);
        $routes->post('duplicate/(:num)', 'Papelesimpresion::duplicate/$1', ['as' => 'duplicatePapelImpresion']);
        $routes->get('select', 'Papelesimpresion::papel_impresion_select', ['as' => 'papelImpresionSelect']);
        $routes->get('show/(:num)', 'Papelesimpresion::papel_impresion_find/$1', ['as' => 'showPapelImpresion']);

    });

    /* Maquinas */
    $routes->group('maquinas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'Maquinas::index', ['as' => 'maquinaList']);
        $routes->get('add', 'Maquinas::add', ['as' => 'newMaquina']);
        $routes->get('edit/(:num)', 'Maquinas::edit/$1');
        $routes->get('delete/(:num)', 'Maquinas::delete/$1');
        $routes->post('add', 'Maquinas::add', ['as' => 'createMaquina']);
        $routes->post('create', 'Maquinas::create', ['as' => 'ajaxCreateMaquina']);
        $routes->put('update/(:num)', 'Maquinas::update/$1', ['as' => 'ajaxUpdateMaquina']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'Maquinas::edit/$1', ['as' => 'updateMaquina']);
        $routes->post('datatable', 'Maquinas::datatable', ['as' => 'dataTableOfMaquinas']);
        $routes->post('allmenuitems', 'Maquinas::allItemsSelect', ['as' => 'select2ItemsOfMaquinas']);
        $routes->post('menuitems', 'Maquinas::menuItems', ['as' => 'menuItemsOfMaquinas']);
        $routes->post('duplicate/(:num)', 'Maquinas::duplicate/$1', ['as' => 'duplicateMaquina']);
        $routes->get('(:num)', 'Maquinas::find_maquina/$1', ['as' => 'findMaquina']);
        $routes->get('select', 'Maquinas::select', ['as' => 'selectMaquinas']);
    });

    /* Maquinas por defecto */
    $routes->group('maquinasdefecto', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'Maquinasdefecto::index', ['as' => 'maquinaPorDefectoList']);
        $routes->get('add', 'Maquinasdefecto::add', ['as' => 'newMaquinaPorDefecto']);
        $routes->post('add', 'Maquinasdefecto::add', ['as' => 'createMaquinaPorDefecto']);
        $routes->post('create', 'Maquinasdefecto::create', ['as' => 'ajaxCreateMaquinaPorDefecto']);
        $routes->put('(:num)/update', 'Maquinasdefecto::update/$1', ['as' => 'ajaxUpdateMaquinaPorDefecto']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'Maquinasdefecto::edit/$1', ['as' => 'updateMaquinaPorDefecto']);
        $routes->post('datatable', 'Maquinasdefecto::datatable', ['as' => 'dataTableOfMaquinasPorDefecto']);
        $routes->post('allmenuitems', 'Maquinasdefecto::allItemsSelect', ['as' => 'select2ItemsOfMaquinasPorDefecto']);
        $routes->post('menuitems', 'Maquinasdefecto::menuItems', ['as' => 'menuItemsOfMaquinasPorDefecto']);
    });


    /* Ubicaciones */
    $routes->group('ubicaciones', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {

        $routes->get('', 'Ubicaciones::index', ['as' => 'ubicacionesList']);
        $routes->match(['get', 'post'], 'add', 'Ubicaciones::add', ['as' => 'ubicacionesAdd']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'Ubicaciones::edit/$1', ['as' => 'ubicacionesEdit']);
        $routes->get('delete/(:num)', 'Ubicaciones::delete/$1', ['as' => 'ubicacionesDelete']);
        $routes->post('datatable', 'Ubicaciones::datatable', ['as' => 'ubicacionesDT']);
    });

    /* Permisos y roles */
    $routes->group('group', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'Group::index', ['as' => 'userGroupList']);
        $routes->get('index', 'Group::index', ['as' => 'groupIndex']);
        $routes->post('edit/(:num)', 'Group::edit/$1', ['as' => 'updateGroup']);
        $routes->get('edit/(:num)', 'Group::edit/$1', ['as' => 'editGroup']);
        $routes->get('delete/(:num)', 'Group::delete/$1', ['as' => 'deleteGroup']);
        $routes->get('add', 'Group::add', ['as' => 'newGroup']);
        $routes->post('add', 'Group::add', ['as' => 'createGroup']);
    });

    /* Series Factura */
    $routes->group('series-facturas', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'SeriesFacturas::index', ['as' => 'seriesFacturasList']);
        $routes->match(['get', 'post'], 'add', 'SeriesFacturas::add', ['as' => 'seriesFacturasAdd']);
        $routes->match(['get', 'post'], 'edit/(:num)', 'SeriesFacturas::edit/$1', ['as' => 'seriesFacturasEdit']);
        $routes->get('delete/(:num)', 'SeriesFacturas::delete/$1', ['as' => 'seriesFacturasDelete']);
        $routes->post('datatable', 'SeriesFacturas::datatable', ['as' => 'seriesFacturasDT']);
        $routes->post('menuitemsFacturas', 'SeriesFacturas::menuItemsFacturas', ['as' => 'menuItemsOfSeriesFacturas']);
    });

    /* Variables del sistema */
    $routes->group("variables", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'ConfigVariables::index', ['as' => 'variablesIndex']);
        $routes->get('find/(:num)', 'ConfigVariables::get/$1', ['as' => 'variablesFind']);
        $routes->post('edit/(:num)', 'ConfigVariables::updateVariable/$1', ['as' => 'updateVariable']);
        $routes->delete('delete/(:num)', 'ConfigVariables::delete/$1', ['as' => 'deleteVariable']);
        $routes->get('datatable', 'ConfigVariables::datatable', ['as' => 'datatableVariables']);
    });

    /* Errores en presupuestos */
    $routes->group("errores-presupuesto", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'ConfigErrores::index', ['as' => 'erroresPresupuestoIndex']);
        $routes->get('edit/(:num)', 'ConfigErrores::viewForm/$1', ['as' => 'erroresPresupuestoViewForm']);
        $routes->get('get/(:num)', 'ConfigErrores::get_error_presupuesto/$1', ['as' => 'erroresPresupuestoGetErrorPresupuesto']);
        $routes->get('datatable', 'ConfigErrores::datatable', ['as' => 'erroresPresupuestoDatatable']);
        $routes->post('edit/(:num)', 'ConfigErrores::update_error_presupuesto/$1', ['as' => 'erroresPresupuestoUpdate']);
    });

    $routes->group("maquina-tareas", ["namespace" => 'App\Controllers\Configuracion'], function ($routes) {
        $routes->get('', 'MaquinaTarea::index', ['as' => 'maquinaTareaList']);
        $routes->get('(:num)', 'MaquinaTarea::show/$1', ['as' => 'maquinaTareaShow']);
        $routes->delete('(:num)', 'MaquinaTarea::delete/$1', ['as' => 'maquinaTareaDelete']);
        $routes->post('', 'MaquinaTarea::store/$1', ['as' => 'maquinaTareaStore']);
        $routes->post('update/(:num)', 'MaquinaTarea::update_servicio_cliente/$1', ['as' => 'maquinaTareaUpdate']);
        $routes->get('edit/(:num)', 'MaquinaTarea::viewForm/$1', ['as' => 'maquinaTareaViewForm']);
        $routes->get('datatable', 'MaquinaTarea::datatable', ['as' => 'maquinaTareaDatatable']);
    });
    $routes->group("messages", ["namespace" => 'App\Controllers\Chat'], function ($routes) {
        $routes->get('', 'ChatController::config_view', ['as' => 'configMessagesIndex']);
    });
});

