2021-12-30 11:49:40 -03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Route;
|
2022-01-11 17:24:46 -03:00
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
2021-12-30 11:49:40 -03:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| 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!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-05-19 15:30:11 -03:00
|
|
|
if (App::environment('production')) {
|
|
|
|
URL::forceScheme('https');
|
|
|
|
}
|
|
|
|
|
2022-01-08 02:53:00 -03:00
|
|
|
Route::get('/', 'ProductoController@index')->name('productos');
|
|
|
|
|
2022-01-08 23:56:37 -03:00
|
|
|
Auth::routes(['register' => false]);
|
|
|
|
|
|
|
|
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
|
|
|
|
2022-06-08 15:18:14 -03:00
|
|
|
Route::get('/admin', 'AdminController@show')->name('admin_login.show');
|
2022-03-31 17:48:08 -03:00
|
|
|
|
2022-06-08 20:32:50 -03:00
|
|
|
Route::get('/admin/obtener_sesion', function() {
|
|
|
|
$sesion = [
|
|
|
|
'gdc' => session("admin_gdc")
|
|
|
|
];
|
|
|
|
return $sesion;
|
|
|
|
})->name('admin_obtener_sesion');
|
|
|
|
|
2022-09-06 21:43:56 -03:00
|
|
|
Route::middleware(['auth', 'admin'])->group( function () {
|
2022-10-14 17:36:49 -03:00
|
|
|
Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
|
2024-08-27 19:53:57 -03:00
|
|
|
|
2022-10-14 17:36:49 -03:00
|
|
|
Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
|
2024-08-27 19:53:57 -03:00
|
|
|
|
2022-10-14 17:36:49 -03:00
|
|
|
Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
|
2024-08-27 19:53:57 -03:00
|
|
|
|
2023-07-06 00:18:52 -03:00
|
|
|
Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
|
2022-06-08 20:32:50 -03:00
|
|
|
});
|
|
|
|
|
2022-01-11 17:24:46 -03:00
|
|
|
Route::middleware('auth')->group( function() {
|
|
|
|
|
|
|
|
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
|
|
|
Route::get('/', function() {
|
|
|
|
return view('subpedidos_create');
|
|
|
|
})->name('create');
|
2022-03-31 17:48:08 -03:00
|
|
|
|
2022-01-11 17:24:46 -03:00
|
|
|
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");
|
|
|
|
}
|
2024-07-11 19:00:31 -03:00
|
|
|
if (!isset($r["grupo_de_compra_id"])) {
|
|
|
|
throw new HttpException(400, "La request necesita un grupo de compra para guardar en sesión");
|
|
|
|
}
|
2022-01-11 17:24:46 -03:00
|
|
|
session(["subpedido_nombre" => $r["subpedido"]["nombre"]]);
|
|
|
|
session(["subpedido_id" => $r["subpedido"]["id"]]);
|
2024-07-11 19:00:31 -03:00
|
|
|
session(["gdc" => $r["grupo_de_compra_id"]]);
|
2022-01-11 17:24:46 -03:00
|
|
|
return "Subpedido guardado en sesión";
|
|
|
|
})->name('guardarSesion');
|
2022-02-24 19:07:58 -03:00
|
|
|
|
|
|
|
Route::get('obtener_sesion', function() {
|
|
|
|
$sesion = [
|
|
|
|
'subpedido' => [
|
|
|
|
'nombre' => session("subpedido_nombre"),
|
|
|
|
'id' => session("subpedido_id")
|
2024-07-11 19:00:31 -03:00
|
|
|
],
|
|
|
|
'gdc' => session("gdc")
|
2022-02-24 19:07:58 -03:00
|
|
|
];
|
|
|
|
return $sesion;
|
|
|
|
})->name('obtenerSesion');
|
2022-01-11 17:24:46 -03:00
|
|
|
});
|
|
|
|
});
|
2024-08-27 19:53:57 -03:00
|
|
|
|
2024-09-14 13:37:06 -03:00
|
|
|
Route::get('/compras', 'ComprasController@show')->name('compras_login.show');
|
2024-09-10 21:11:22 -03:00
|
|
|
|
|
|
|
Route::middleware(['compras'])->group( function() {
|
2024-09-17 20:41:50 -03:00
|
|
|
Route::get('/compras/pedidos', 'ComprasController@indexPedidos')->name('compras.pedidos');
|
|
|
|
Route::get('/compras/pedidos/descargar', 'ComprasController@descargarPedidos')->name('compras.pedidos.descargar');
|
2024-10-15 20:44:28 -03:00
|
|
|
Route::get('/compras/pedidos/notas', 'ComprasController@descargarNotas')->name('compras.pedidos.descargar');
|
2024-12-09 12:59:59 -03:00
|
|
|
Route::get('/compras/pedidos/transporte', 'ComprasController@descargarTransporte')->name('compras.pedidos.descargar');
|
2024-12-21 14:29:48 -03:00
|
|
|
Route::post('/compras/canasta', 'ComprasController@cargarCanasta')->name('compras.canasta');
|
2024-12-22 01:51:53 -03:00
|
|
|
Route::get('/compras/canasta/ejemplo', 'ComprasController@descargarCanastaEjemplo')->name('compras.canasta.ejemplo');
|
2024-08-27 19:53:57 -03:00
|
|
|
});
|