<?php

use CodeIgniter\Router\RouteCollection;

/** @var RouteCollection $routes */


/* Compras */
$routes->group('compras', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
    $routes->group('proveedores', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
        $routes->get('', 'Proveedores::index', ['as' => 'proveedorList']);
        $routes->get('add', 'Proveedores::add', ['as' => 'newProveedor']);
        $routes->post('add', 'Proveedores::add', ['as' => 'createProveedor']);
        $routes->post('create', 'Proveedores::create', ['as' => 'ajaxCreateProveedor']);
        $routes->put('(:num)/update', 'Proveedores::update/$1', ['as' => 'ajaxUpdateProveedor']);
        $routes->get('edit/(:num)', 'Proveedores::edit/$1', ['as' => 'editProveedor']);
        $routes->post('edit/(:num)', 'Proveedores::edit/$1', ['as' => 'updateProveedor']);
        $routes->post('datatable', 'Proveedores::datatable', ['as' => 'dataTableOfProveedores']);
        $routes->get('delete/(:num)', 'Proveedores::delete/$1', ['as' => 'deleteProveedores']);
        $routes->post('allmenuitems', 'Proveedores::allItemsSelect', ['as' => 'select2ItemsOfProveedores']);
        $routes->post('menuitems', 'Proveedores::menuItems', ['as' => 'menuItemsOfProveedores']);
        $routes->get('getProveedores', 'Proveedores::getForSelect');
    });
});

$routes->group('proveedorestipos', ['namespace' => 'App\Controllers\Compras'], function ($routes) {
    $routes->post('menuitems', 'ProveedoresTipos::menuItems', ['as' => 'menuItemsOfProveedoresTipos']);
});