90 lines
		
	
	
	
		
			3.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
	
		
			3.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Illuminate\Support\Facades\App;
 | |
| use Illuminate\Support\Facades\Auth;
 | |
| use Illuminate\Support\Facades\Route;
 | |
| use Illuminate\Support\Facades\URL;
 | |
| use Symfony\Component\HttpKernel\Exception\HttpException;
 | |
| /*
 | |
| |--------------------------------------------------------------------------
 | |
| | 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!
 | |
| |
 | |
| */
 | |
| 
 | |
| if (App::environment('production')) {
 | |
|     URL::forceScheme('https');
 | |
| }
 | |
| 
 | |
| Auth::routes(['register' => false]);
 | |
| 
 | |
| Route::get('/', 'RouteController@home')->name('home');
 | |
| 
 | |
| Route::middleware(['auth'])->group(function () {
 | |
|     Route::get('/user/grupo_de_compra', 'UserController@grupoDeCompra');
 | |
| });
 | |
| 
 | |
| Route::middleware(['auth', 'role:barrio'])->group( function() {
 | |
|     Route::get('/productos', 'ProductoController@index')->name('productos.index');
 | |
| 
 | |
|     Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
 | |
|         Route::get('/', function() {
 | |
|             return view('subpedidos_create');
 | |
|         })->name('create');
 | |
| 
 | |
|         Route::post('guardar_sesion', function() {
 | |
|             $r = request();
 | |
|             if (!isset($r["subpedido"])) {
 | |
|                 throw new HttpException(400, "La request necesita un subpedido para guardar en sesión");
 | |
|             }
 | |
|             if (!isset($r["grupo_de_compra_id"])) {
 | |
|                 throw new HttpException(400, "La request necesita un grupo de compra para guardar en sesión");
 | |
|             }
 | |
|             session(["subpedido_nombre" => $r["subpedido"]["nombre"]]);
 | |
|             session(["subpedido_id" => $r["subpedido"]["id"]]);
 | |
|             session(["gdc" => $r["grupo_de_compra_id"]]);
 | |
|             return "Subpedido guardado en sesión";
 | |
|         })->name('guardarSesion');
 | |
| 
 | |
|         Route::get('obtener_sesion', function() {
 | |
|             return [
 | |
|                 'subpedido' => [
 | |
|                     'nombre' => session("subpedido_nombre"),
 | |
|                     'id' => session("subpedido_id")
 | |
|                 ],
 | |
|                 'gdc' => session("gdc")
 | |
|             ];
 | |
|         })->name('obtenerSesion');
 | |
| 
 | |
|         Route::post('sesion', 'SessionController@store');
 | |
| 
 | |
|         Route::get('sesion', 'SessionController@fetch');
 | |
|     });
 | |
| });
 | |
| 
 | |
| Route::get('/admin/login', 'AdminController@show')->name('admin.login');
 | |
| 
 | |
| Route::middleware(['auth', 'role:admin_barrio'])->group( function () {
 | |
| 	Route::get('/admin', 'AdminController@index')->name('admin.pedidos');
 | |
| 
 | |
| 	Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPedidosAPdf');
 | |
| 
 | |
| 	Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
 | |
| 
 | |
| 	Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
 | |
| });
 | |
| 
 | |
| Route::get('/compras/login', 'ComprasController@show')->name('compras.login');
 | |
| 
 | |
| Route::middleware(['auth', 'role:comision'])->group( function() {
 | |
|     Route::get('/compras', 'ComprasController@indexPedidos')->name('compras.pedidos');
 | |
|     Route::get('/compras/pedidos/descargar', 'ComprasController@descargarPedidos')->name('compras.pedidos.descargar');
 | |
|     Route::get('/compras/pedidos/notas', 'ComprasController@descargarNotas')->name('compras.pedidos.descargar');
 | |
|     Route::get('/compras/pedidos/pdf', 'ComprasController@pdf')->name('compras.pedidos.pdf');
 | |
|     Route::post('/compras/canasta', 'ComprasController@cargarCanasta')->name('compras.canasta');
 | |
|     Route::get('/compras/canasta/ejemplo', 'ComprasController@descargarCanastaEjemplo')->name('compras.canasta.ejemplo');
 | |
| });
 |