diff --git a/.gitignore b/.gitignore index 7c37daf..68da81a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ yarn-error.log .idea /resources/csv/exports/*.csv /resources/csv/canastas/*.csv +/storage/csv/exports/*.csv +/storage/csv/canastas/*.csv /public/css/ /public/js/ /public/mix-manifest.json diff --git a/app/GrupoDeCompra.php b/app/GrupoDeCompra.php index 3a0fe18..782d16c 100644 --- a/app/GrupoDeCompra.php +++ b/app/GrupoDeCompra.php @@ -11,13 +11,12 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use League\Csv\Exception; class GrupoDeCompra extends Model { - public $timestamps = false; - protected $fillable = ["nombre", "region", "telefono", "correo", "referente_finanzas", "cantidad_de_nucleos", "fila", "devoluciones_habilitadas"]; + protected $fillable = ["nombre", "region", "devoluciones_habilitadas", "saldo"]; protected $table = 'grupos_de_compra'; - protected $hidden = ['password']; public function subpedidos(): HasMany { @@ -45,6 +44,14 @@ class GrupoDeCompra extends Model return $total; } + public function totalSinDevoluciones() { + $total = 0; + foreach ($this->pedidosAprobados() as $subpedido) { + $total = $total + $subpedido->totalSinDevoluciones(); + } + return $total; + } + public function totalBarrial() { $total = 0; @@ -63,11 +70,17 @@ class GrupoDeCompra extends Model return $total; } - public function totalATransferir() + public function totalDePedido() { return $this->totalCentralesQueNoPaganTransporte() + $this->totalCentralesQuePaganTransporte() - + $this->totalTransporte(); + + $this->totalTransporte() + ; + } + + public function totalATransferir() + { + return $this->totalDePedido() - $this->saldo; } public function totalCentralesQueNoPaganTransporte() @@ -105,12 +118,13 @@ class GrupoDeCompra extends Model public function exportarPedidosAPdf() { $subpedidos = $this->pedidosAprobados(); - PdfHelper::exportarPedidos($this->nombre . '.pdf', $subpedidos); + $fecha = now()->format('Y-m-d'); + PdfHelper::exportarPedidos($this->nombre . '-' . $fecha . '.pdf', $subpedidos); } function pedidoParaPdf(): array { - $productos = $this->productosPedidos(true, true, 'producto_id'); + $productos = $this->productosPedidos(true, 'producto_id'); $pedido = []; $pedido['productos'] = []; @@ -138,7 +152,8 @@ class GrupoDeCompra extends Model public static function exportarPedidosBarrialesAPdf() { $barrios = GrupoDeCompra::barriosMenosPrueba()->get(); - PdfHelper::exportarPedidos('pedidos_por_barrio.pdf', $barrios); + $fecha = now()->format('Y-m-d'); + PdfHelper::exportarPedidos('pedidos_por_barrio-' . $fecha . '.pdf', $barrios); } static function filaVacia(string $product, int $columns): array @@ -151,6 +166,10 @@ class GrupoDeCompra extends Model } //Asume que los productos están gruadados en orden de fila + + /** + * @throws Exception + */ public static function obtenerTemplateDeFilasVacias(int $columns): array { $productosFilaID = Producto::productosFilaID(); @@ -168,13 +187,20 @@ class GrupoDeCompra extends Model return $template; } + /** + * @throws Exception + */ public function exportarPedidoEnCSV() { $records = $this->generarColumnaCantidades(); - CsvHelper::generarCsv('csv/exports/' . $this->nombre . '.csv', $records); + $fecha = now()->format('Y-m-d'); + CsvHelper::generarCsv('csv/exports/' . $this->nombre . '-' . $fecha . '.csv', $records); } + /** + * @throws Exception + */ public function generarColumnaCantidades(): array { $productos_en_pedido = $this->productosPedidos(); @@ -197,6 +223,9 @@ class GrupoDeCompra extends Model return $records; } + /** + * @throws Exception + */ public function exportarPedidoConNucleosEnCSV() { $productos_en_pedido = $this->productosPedidos(); @@ -229,7 +258,8 @@ class GrupoDeCompra extends Model } array_splice($records, 0, 0, array($nucleos)); - CsvHelper::generarCsv('csv/exports/' . $this->nombre . '-completo.csv', $records); + $fecha = now()->format('Y-m-d'); + CsvHelper::generarCsv('csv/exports/' . $this->nombre . '-completo-' . $fecha . '.csv', $records); } public function agregarCantidad($pedido, $id, array $records, $fila, int $i): array @@ -260,13 +290,12 @@ class GrupoDeCompra extends Model return $result; } - public function productosPedidos($excluirBarriales = false, $excluirBonos = false, $orderBy = 'producto_nombre'): Collection + public function productosPedidos($excluirBonos = false, $orderBy = 'producto_nombre'): Collection { $query = DB::table('pedidos_aprobados') - ->where('grupo_de_compra_id', $this->id); + ->where('grupo_de_compra_id', $this->id) + ->where('producto_nombre','NOT LIKE','%barrial%'); - if ($excluirBarriales) - $query = $query->where('producto_nombre','NOT LIKE','%barrial%'); if ($excluirBonos) $query = $query->where('producto_es_bono',false); @@ -275,4 +304,9 @@ class GrupoDeCompra extends Model ->get() ->keyBy('producto_id'); } + + public function setSaldo(float $saldo) { + $this->saldo = $saldo; + $this->save(); + } } diff --git a/app/Helpers/CanastaHelper.php b/app/Helpers/CanastaHelper.php index 7a80fee..d8884b1 100644 --- a/app/Helpers/CanastaHelper.php +++ b/app/Helpers/CanastaHelper.php @@ -3,13 +3,13 @@ namespace App\Helpers; use App\Producto; -use App\Proveedor; use App\CanastaLog; use DatabaseSeeder; use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\File; use Illuminate\Support\Str; - +use League\Csv\Exception; class CanastaHelper { @@ -21,76 +21,77 @@ class CanastaHelper const CANASTA_CARGADA = 'Canasta cargada'; const PRODUCTO_TALLE_COLOR = "PTC"; + public static function canastaActual() { + $result = []; + $log = CanastaLog::where('descripcion', self::CANASTA_CARGADA) + ->orderBy('created_at', 'desc') + ->first(); + $nombre = str_replace(storage_path(), "", $log->path); + $nombre = str_replace("/csv/canastas/", "", $nombre); + $result["nombre"] = str_replace(".csv", "", $nombre); + $result["fecha"] = $log->created_at; + return $result; + } + public static function guardarCanasta($data, $path): string { + if (!File::exists(storage_path('csv/canastas'))) { + File::makeDirectory(storage_path('csv/canastas'), 0755, true); + } + $nombre = $data->getClientOriginalName(); - $data->move(resource_path($path), $nombre); + $storage_path = storage_path($path); + $data->move($storage_path, $nombre); - self::log($path . $nombre, self::ARCHIVO_SUBIDO); + self::log($storage_path . $nombre, self::ARCHIVO_SUBIDO); return $nombre; } + /** + * @throws Exception + */ public static function cargarCanasta($archivo) { self::limpiarTablas(); - $registros = CsvHelper::getRecords($archivo); + $registros = CsvHelper::getRecords($archivo, "No se pudo leer el archivo."); + $toInsert = []; $categoria = ''; foreach($registros as $i => $registro) { - // saltear filas que no tienen tipo - if (self::noTieneTipo($registro)) { - var_dump("no hay tipo en la fila " . $i); + // saltear bono de transporte y filas que no tienen tipo + if (self::noTieneTipo($registro) || $registro[self::TIPO] == "T") continue; - } - - // saltear bono de transporte - if ($registro[self::TIPO] == "T"){ - continue; - } // obtener categoria si no hay producto if ($registro[self::PRODUCTO] == '') { // no es la pregunta de la copa? if (!Str::contains($registro[self::TIPO],"¿")) $categoria = $registro[self::TIPO]; - continue; + continue; // saltear si es la pregunta de la copa } // completar producto - $toInsert[] = [ + $toInsert[] = DatabaseSeeder::addTimestamps([ 'fila' => $i, 'categoria' => $categoria, 'nombre' => trim(str_replace('*', '',$registro[self::PRODUCTO])), 'precio' => $registro[self::PRECIO], - 'proveedor_id' => self::obtenerProveedor($registro[self::PRODUCTO]), + 'es_solidario' => Str::contains($registro[self::PRODUCTO],"*"), 'bono' => preg_match(self::REGEX_BONO, $registro[self::TIPO]), 'requiere_notas'=> $registro[self::TIPO] == self::PRODUCTO_TALLE_COLOR, - ]; + ]); } - foreach (array_chunk($toInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) { - DB::table('productos')->insert($chunk); - } + foreach (array_chunk($toInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) + Producto::insert($chunk); self::agregarBonoBarrial(); self::log($archivo, self::CANASTA_CARGADA); } - private static function obtenerProveedor($nombre) { - $result = null; - if (Str::contains($nombre,"*")){ - $result = Proveedor::firstOrCreate([ - 'nombre' => 'Proveedor de economía solidaria', - 'economia_solidaria' => 1, - 'nacional' => 1 - ])->id; - } - return $result; - } - /** * @param $path * @param $descripcion @@ -122,13 +123,12 @@ class CanastaHelper return Str::contains($c, 'BONO'); }); - DB::table('productos')->insert([ - 'fila' => 420, + Producto::create([ 'nombre' => "Bono barrial", 'precio' => 20, 'categoria' => $categoria, 'bono' => 1, - 'proveedor_id' => null, + 'es_solidario' => 0, 'requiere_notas'=> false, ]); } diff --git a/app/Helpers/CsvHelper.php b/app/Helpers/CsvHelper.php index 95f2cfd..c27ff6d 100644 --- a/app/Helpers/CsvHelper.php +++ b/app/Helpers/CsvHelper.php @@ -2,6 +2,7 @@ namespace App\Helpers; +use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Log; use Iterator; use League\Csv\CannotInsertRecord; @@ -12,8 +13,11 @@ use League\Csv\Writer; class CsvHelper { - public static function getRecords($filePath): Iterator { - $csv = Reader::createFromPath(resource_path($filePath)); + /** + * @throws Exception + */ + public static function getRecords($filePath, $message): Iterator { + $csv = Reader::createFromPath($filePath); try { $csv->setDelimiter("|"); $csv->setEnclosure("'"); @@ -21,14 +25,18 @@ class CsvHelper return $csv->getRecords(); } catch (InvalidArgument|Exception $e) { Log::error($e->getMessage()); - return null; + throw new Exception($message, $e); } } public static function generarCsv($filePath, $contenido, $headers = null): void { + if (!File::exists(storage_path('csv/exports'))) { + File::makeDirectory(storage_path('csv/exports'), 0755, true); + } + try { - $writer = Writer::createFromPath(resource_path($filePath), 'w'); + $writer = Writer::createFromPath(storage_path($filePath), 'w'); if ($headers) { $writer->insertOne($headers); } diff --git a/app/Helpers/TransporteHelper.php b/app/Helpers/TransporteHelper.php index 49ec37f..046b4b8 100644 --- a/app/Helpers/TransporteHelper.php +++ b/app/Helpers/TransporteHelper.php @@ -4,6 +4,7 @@ namespace App\Helpers; use App\CanastaLog; use Illuminate\Support\Facades\Log; +use League\Csv\Exception; class TransporteHelper { @@ -20,6 +21,9 @@ class TransporteHelper return self::cantidadTransporte($monto) * self::COSTO_TRANSPORTE; } + /** + * @throws Exception + */ public static function filaTransporte() { $ultimaCanasta = CanastaLog::where('descripcion', CanastaHelper::CANASTA_CARGADA) @@ -27,12 +31,14 @@ class TransporteHelper ->pluck('path') ->first(); - $registros = CsvHelper::getRecords($ultimaCanasta); + $registros = CsvHelper::getRecords($ultimaCanasta, "No se encontró la ultima canasta."); + $error = 'No hay fila de tipo T en la planilla: ' . $ultimaCanasta; foreach ($registros as $key => $registro) - if ($registro[CanastaHelper::TIPO] == 'T') return $key; + if ($registro[CanastaHelper::TIPO] == 'T') + return $key; - Log::error('No hay fila de tipo T en la planilla: ' . $ultimaCanasta); - return null; + Log::error($error); + throw new Exception($error); } } diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 44165ac..a280c84 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -3,13 +3,13 @@ namespace App\Http\Controllers; use App\GrupoDeCompra; -use Symfony\Component\HttpFoundation\BinaryFileResponse; +use League\Csv\Exception; class AdminController extends Controller { public function show() { - return view('auth/admin_login'); + return view('auth/login'); } public function index() { @@ -20,17 +20,37 @@ class AdminController extends Controller $gdc->exportarPedidosAPdf(); } - public function exportarPedidoACSV(GrupoDeCompra $gdc): BinaryFileResponse + public function exportarPedidoACSV(GrupoDeCompra $gdc) { - $gdc->exportarPedidoEnCSV(); - $file = resource_path('csv/exports/'.$gdc->nombre.'.csv'); - return response()->download($file); + try { + $gdc->exportarPedidoEnCSV(); + } catch (Exception $e) { + return response()->json(['message' => $e->getMessage()]); + } + $pattern = storage_path('csv/exports/'. $gdc->nombre . '-*.csv'); + $files = glob($pattern); + + usort($files, function ($a, $b) { + return filemtime($b) <=> filemtime($a); + }); + + return response()->download($files[0]); } - public function exportarPedidoConNucleosACSV(GrupoDeCompra $gdc): BinaryFileResponse + public function exportarPedidoConNucleosACSV(GrupoDeCompra $gdc) { - $gdc->exportarPedidoConNucleosEnCSV(); - $file = resource_path('csv/exports/'.$gdc->nombre.'-completo.csv'); - return response()->download($file); + try { + $gdc->exportarPedidoConNucleosEnCSV(); + } catch (Exception $e) { + return response()->json(['message' => $e->getMessage()]); + } + $pattern = storage_path('csv/exports/'.$gdc->nombre.'-completo-*.csv'); + $files = glob($pattern); + + usort($files, function ($a, $b) { + return filemtime($b) <=> filemtime($a); + }); + + return response()->download($files[0]); } } diff --git a/app/Http/Controllers/Api/CanastaController.php b/app/Http/Controllers/Api/CanastaController.php new file mode 100644 index 0000000..510a364 --- /dev/null +++ b/app/Http/Controllers/Api/CanastaController.php @@ -0,0 +1,13 @@ +json(CanastaHelper::canastaActual()); + } +} diff --git a/app/Http/Controllers/Api/GrupoDeCompraController.php b/app/Http/Controllers/Api/GrupoDeCompraController.php index 58f88d5..8ede935 100644 --- a/app/Http/Controllers/Api/GrupoDeCompraController.php +++ b/app/Http/Controllers/Api/GrupoDeCompraController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api; use App\GrupoDeCompra; use App\Http\Controllers\Controller; +use App\Http\Resources\GrupoDeCompraComisionesResource; use App\Http\Resources\GrupoDeCompraResource; class GrupoDeCompraController extends Controller @@ -16,4 +17,32 @@ class GrupoDeCompraController extends Controller { return new GrupoDeCompraResource($grupoDeCompra); } + public function regiones() + { + return GrupoDeCompra::all()->pluck('region')->unique()->flatten(); + } + + public function region(string $region) + { + return GrupoDeCompra::where('region', $region)->get(); + } + + public function toggleDevoluciones(int $gdc) { + GrupoDeCompra::find($gdc)->toggleDevoluciones(); + return response()->noContent(); + } + + public function setSaldo(int $gdc) { + $valid = request()->validate([ + 'saldo' => ['required', 'min:0'], + ]); + $grupoDeCompra = GrupoDeCompra::find($gdc); + $grupoDeCompra->setSaldo($valid['saldo']); + return response()->noContent(); + } + + public function saldos() + { + return GrupoDeCompraComisionesResource::collection(GrupoDeCompra::all()); + } } diff --git a/app/Http/Controllers/Api/ProductoController.php b/app/Http/Controllers/Api/ProductoController.php index ed66c1f..555e3af 100644 --- a/app/Http/Controllers/Api/ProductoController.php +++ b/app/Http/Controllers/Api/ProductoController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers\Api; -use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use App\Http\Controllers\Controller; use App\Filtros\FiltroDeProducto; use App\Http\Resources\ProductoResource; use App\Producto; @@ -15,9 +15,8 @@ class ProductoController extends Controller return ProductoResource::collection(Producto::filtrar($filtros)->paginate(Producto::getPaginar($request))); } - public function show(Producto $producto) + public function categorias() { - return new ProductoResource($producto); + return Producto::all()->pluck('categoria')->unique()->flatten(); } - } diff --git a/app/Http/Controllers/Api/SubpedidoController.php b/app/Http/Controllers/Api/SubpedidoController.php index d17d571..7e6b266 100644 --- a/app/Http/Controllers/Api/SubpedidoController.php +++ b/app/Http/Controllers/Api/SubpedidoController.php @@ -17,7 +17,7 @@ class SubpedidoController extends Controller { public function index(FiltroDeSubpedido $filtros, Request $request) { - return Subpedido::filtrar($filtros)->get(); + return Subpedido::filtrar($filtros)->select('id','nombre')->get(); } public function indexResources(FiltroDeSubpedido $filtros, Request $request) @@ -35,7 +35,7 @@ class SubpedidoController extends Controller $s->nombre = $validado["nombre"]; $s->grupo_de_compra_id = $validado["grupo_de_compra_id"]; $s->save(); - return $s; + return $this->show($s); } protected function validateSubpedido(): array @@ -57,7 +57,7 @@ class SubpedidoController extends Controller // recibe request, saca producto y cantidad, valida, y pasa a syncProducto en Subpedido public function syncProductos(Subpedido $subpedido) { if ($subpedido->aprobado) - return new SubpedidoResource($subpedido); + abort(400, "No se puede modificar un pedido aprobado."); $valid = request()->validate([ 'cantidad' => ['integer','required','min:0'], @@ -80,11 +80,12 @@ class SubpedidoController extends Controller 'aprobacion' => 'required | boolean' ]); $subpedido->toggleAprobacion($valid['aprobacion']); - return new SubpedidoResource($subpedido); + return response()->noContent(); } public function syncDevoluciones(Subpedido $subpedido) { - if ($subpedido->aprobado) return new SubpedidoResource($subpedido); + if ($subpedido->aprobado) + abort(400, "No se puede modificar un pedido aprobado."); $valid = request()->validate([ 'total' => 'required|min:0', diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index c4092fa..6d96912 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -6,7 +6,6 @@ use App\Http\Controllers\Controller; use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; class LoginController extends Controller { @@ -31,14 +30,7 @@ class LoginController extends Controller protected function authenticated(Request $request, $user) { - if ($user->is_compras) { - return redirect('compras/pedidos'); - } else if ($user->is_admin) { - session(['admin_gdc' => $user->grupo_de_compra_id]); - return redirect('admin/pedidos'); - } else { - return redirect('/'); - } + return redirect('/'); } /** diff --git a/app/Http/Controllers/ComisionesController.php b/app/Http/Controllers/ComisionesController.php new file mode 100644 index 0000000..6c5d555 --- /dev/null +++ b/app/Http/Controllers/ComisionesController.php @@ -0,0 +1,107 @@ +json(['message' => $e->getMessage()], 500); + } + $pattern = storage_path('csv/exports/pedidos-por-barrio-*.csv'); + $files = glob($pattern); + + usort($files, function ($a, $b) { + return filemtime($b) <=> filemtime($a); + }); + + return response()->download($files[0]); + } + + public function descargarNotas(): BinaryFileResponse + { + Producto::planillaNotas(); + $pattern = storage_path('csv/exports/notas-por-barrio-*.csv'); + $files = glob($pattern); + + usort($files, function ($a, $b) { + return filemtime($b) <=> filemtime($a); + }); + + return response()->download($files[0]); + } + + public function pdf() { + GrupoDeCompra::exportarPedidosBarrialesAPdf(); + } + + public function cargarCanasta(Request $request): JsonResponse + { + $request->validate([ + 'data' => 'required|file|mimes:csv,txt|max:2048', + ]); + + $nombre = CanastaHelper::guardarCanasta($request->file('data'), self::CANASTAS_PATH); + try { + CanastaHelper::cargarCanasta(storage_path(self::CANASTAS_PATH . $nombre)); + } catch (Exception $e) { + return response()->json(['message' => $e->getMessage()], 500); + } + + return response()->json([ + 'message' => 'Canasta cargada exitosamente', + ]); + } + + public function descargarCanastaEjemplo(): BinaryFileResponse + { + $file = resource_path('csv/productos.csv'); + return response()->download($file); + } + + public function cargarSaldos(Request $request): JsonResponse + { + $request->validate([ + 'data' => 'required|file|mimes:csv,txt|max:2048', + ]); + + $file = $request->file('data')->getPathname(); + + try { + $records = CsvHelper::getRecords($file, "No se pudo leer el archivo."); + } catch (Exception $e) { + return response()->json(['message' => $e->getMessage()], 500); + } + + foreach ($records as $record) { + $barrio = $record[self::BARRIO]; + $saldo = $record[self::SALDO]; + GrupoDeCompra::where('nombre', $barrio) + ->update(['saldo' => $saldo]); + } + + return response()->json(GrupoDeCompraResource::collection(GrupoDeCompra::all())); + } +} diff --git a/app/Http/Controllers/ComprasController.php b/app/Http/Controllers/ComprasController.php deleted file mode 100644 index 2aef574..0000000 --- a/app/Http/Controllers/ComprasController.php +++ /dev/null @@ -1,62 +0,0 @@ -download($file); - } - - public function descargarNotas(): BinaryFileResponse - { - Producto::planillaNotas(); - $file = resource_path('csv/exports/notas-por-barrio.csv'); - return response()->download($file); - } - - public function pdf() { - GrupoDeCompra::exportarPedidosBarrialesAPdf(); - } - - public function show() - { - return view('auth/compras_login'); - } - - public function cargarCanasta(Request $request): JsonResponse - { - $request->validate([ - 'data' => 'required|file|mimes:csv,txt|max:2048', - ]); - - $nombre = CanastaHelper::guardarCanasta($request->file('data'), self::CANASTAS_PATH); - CanastaHelper::cargarCanasta(self::CANASTAS_PATH . $nombre); - - return response()->json([ - 'message' => 'Canasta cargada exitosamente', - ]); - } - - public function descargarCanastaEjemplo(): BinaryFileResponse - { - $file = resource_path('csv/productos.csv'); - return response()->download($file); - } -} diff --git a/app/Http/Controllers/RouteController.php b/app/Http/Controllers/RouteController.php new file mode 100644 index 0000000..e5b4a57 --- /dev/null +++ b/app/Http/Controllers/RouteController.php @@ -0,0 +1,34 @@ +first(); + $admin = UserRole::where('nombre', 'admin_barrio')->first(); + $comision = UserRole::where('nombre', 'comision')->first(); + + switch ($request->user()->role_id) { + case $barrio->id: + return redirect('/pedido'); + case $admin->id: + return redirect('/admin'); + case $comision->id: + return redirect('/comisiones'); + default: + abort(400, 'Rol de usuario invalido'); + } + } + + function main(Request $request) { + return view('main'); + } +} diff --git a/app/Http/Controllers/SessionController.php b/app/Http/Controllers/SessionController.php new file mode 100644 index 0000000..a766524 --- /dev/null +++ b/app/Http/Controllers/SessionController.php @@ -0,0 +1,35 @@ +grupo_de_compra_id; + $validated = $request->validate([ + 'id' => 'required', + Rule::in(Subpedido::where('grupo_de_compra_id', $grupo_de_compra_id)->pluck('id')), + ]); + session()->put('pedido_id', $validated["id"]); + return response()->noContent(); + } + + public function fetch(): JsonResponse + { + return response()->json(['id' => session('pedido_id')]); + } + + public function destroy(): Response + { + session()->forget('pedido_id'); + return response()->noContent(); + } +} diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..62243c5 --- /dev/null +++ b/app/Http/Controllers/UserController.php @@ -0,0 +1,37 @@ + UserRole::find($request->user()->role_id)->nombre]; + } + + public function grupoDeCompra(Request $request) + { + $user = Auth::user(); + $result = [ 'grupo_de_compra' => null, ]; + $grupo_de_compra = GrupoDeCompra::find($user->grupo_de_compra_id); + switch (UserRole::findOrFail($user->role_id)->nombre) { + case 'barrio': + $result['grupo_de_compra'] = new GrupoDeCompraPedidoResource($grupo_de_compra); + break; + case 'admin_barrio': + $result['grupo_de_compra'] = new GrupoDeCompraResource($grupo_de_compra); + break; + case 'comision': + break; + default: + abort(400, 'Rol invalido.'); + } + return $result; + } +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 243f1f2..cbf821d 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -2,6 +2,7 @@ namespace App\Http; +use App\Http\Middleware\CheckRole; use Illuminate\Foundation\Http\Kernel as HttpKernel; use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful; @@ -56,8 +57,7 @@ class Kernel extends HttpKernel */ protected $routeMiddleware = [ 'auth' => \App\Http\Middleware\Authenticate::class, - 'admin' => \App\Http\Middleware\Admin::class, - 'compras' => \App\Http\Middleware\Compras::class, + 'role' => \App\Http\Middleware\CheckRole::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, diff --git a/app/Http/Middleware/Admin.php b/app/Http/Middleware/Admin.php deleted file mode 100644 index df3fdb1..0000000 --- a/app/Http/Middleware/Admin.php +++ /dev/null @@ -1,20 +0,0 @@ -is_admin) { - return $next($request); - } else { - return response('Necesitás ser admin para hacer esto', 403); - } - } -} diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 704089a..7eabcdf 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -14,7 +14,12 @@ class Authenticate extends Middleware */ protected function redirectTo($request) { - if (! $request->expectsJson()) { + if (!$request->expectsJson()) { + $path = $request->path(); + if (preg_match('~^admin.*~i', $path)) + return route('admin.login'); + if (preg_match('~^comisiones.*~i', $path)) + return route('comisiones.login'); return route('login'); } } diff --git a/app/Http/Middleware/CheckRole.php b/app/Http/Middleware/CheckRole.php new file mode 100644 index 0000000..daaf84c --- /dev/null +++ b/app/Http/Middleware/CheckRole.php @@ -0,0 +1,25 @@ +first()->id; + return $request->user()->role_id == $role_id ? $next($request) + : response('No tenés permiso para esto.', 403); + } +} diff --git a/app/Http/Middleware/Compras.php b/app/Http/Middleware/Compras.php deleted file mode 100644 index a9d9f6b..0000000 --- a/app/Http/Middleware/Compras.php +++ /dev/null @@ -1,29 +0,0 @@ -route('compras_login.show'); - - if (Auth::user()->is_compras) { - return $next($request); - } else { - return response('Necesitás ser de comisión compras para hacer esto', 403); - } - } -} diff --git a/app/Http/Resources/GrupoDeCompraComisionesResource.php b/app/Http/Resources/GrupoDeCompraComisionesResource.php new file mode 100644 index 0000000..537971e --- /dev/null +++ b/app/Http/Resources/GrupoDeCompraComisionesResource.php @@ -0,0 +1,22 @@ + $this->id, + 'nombre' => $this->nombre, + 'saldo' => $this->saldo, + ]; + } +} diff --git a/app/Http/Resources/GrupoDeCompraPedidoResource.php b/app/Http/Resources/GrupoDeCompraPedidoResource.php new file mode 100644 index 0000000..ea725f7 --- /dev/null +++ b/app/Http/Resources/GrupoDeCompraPedidoResource.php @@ -0,0 +1,22 @@ + $this->id, + 'nombre' => $this->nombre, + 'devoluciones_habilitadas' => $this->devoluciones_habilitadas, + ]; + } +} diff --git a/app/Http/Resources/GrupoDeCompraResource.php b/app/Http/Resources/GrupoDeCompraResource.php index 58a025b..b67e14b 100644 --- a/app/Http/Resources/GrupoDeCompraResource.php +++ b/app/Http/Resources/GrupoDeCompraResource.php @@ -21,8 +21,11 @@ class GrupoDeCompraResource extends JsonResource 'devoluciones_habilitadas' => $this->devoluciones_habilitadas, 'pedidos' => SubpedidoResource::collection($this->subpedidos), 'total_a_recaudar' => number_format($this->totalARecaudar(),2), + 'saldo' => number_format($this->saldo, 2, ".", ""), + 'total_sin_devoluciones' => number_format($this->totalSinDevoluciones(),2), 'total_barrial' => number_format($this->totalBarrial(),2), 'total_devoluciones' => number_format($this->totalDevoluciones(),2), + 'total_de_pedido' => number_format($this->totalDePedido(),2), 'total_a_transferir' => number_format($this->totalATransferir(),2), 'total_transporte' => number_format($this->totalTransporte()), 'cantidad_transporte' => number_format($this->cantidadTransporte()), diff --git a/app/Http/Resources/ProductoResource.php b/app/Http/Resources/ProductoResource.php index 677af54..bf6eb8f 100644 --- a/app/Http/Resources/ProductoResource.php +++ b/app/Http/Resources/ProductoResource.php @@ -20,13 +20,8 @@ class ProductoResource extends JsonResource 'nombre' => $this->nombre, 'precio' => $this->precio, 'categoria' => $this->categoria, - 'proveedor' => optional($this->proveedor)->nombre, - 'economia_solidaria' => optional($this->proveedor)->economia_solidaria, - 'nacional' => optional($this->proveedor)->nacional, - 'imagen' => optional($this->poster)->url(), - 'descripcion' => $this->descripcion, - 'apto_veganxs' => $this->apto_veganxs, - 'apto_celiacxs' => $this->apto_celiacxs, + 'economia_solidaria' => $this->es_solidario, + 'nacional' => $this->es_solidario, 'requiere_notas' => $this->requiere_notas, ]; } diff --git a/app/Http/Resources/SubpedidoResource.php b/app/Http/Resources/SubpedidoResource.php index 98fd733..89b911e 100644 --- a/app/Http/Resources/SubpedidoResource.php +++ b/app/Http/Resources/SubpedidoResource.php @@ -15,11 +15,14 @@ class SubpedidoResource extends JsonResource */ public function toArray($request): array { + $productos = $this->productos; + foreach ($productos as $producto) { + $producto['pivot']['total'] = number_format($producto->pivot->cantidad * $producto->precio, 2); + } return [ 'id' => $this->id, 'nombre' => $this->nombre, - 'grupo_de_compra' => $this->grupoDeCompra, - 'productos' => $this->productos, + 'productos' => $productos, 'aprobado' => (bool) $this->aprobado, 'total' => number_format($this->total(),2), 'total_transporte' => number_format($this->totalTransporte()), diff --git a/app/Producto.php b/app/Producto.php index 9b412c3..5617617 100644 --- a/app/Producto.php +++ b/app/Producto.php @@ -7,29 +7,27 @@ use App\Helpers\CsvHelper; use App\Helpers\TransporteHelper; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use League\Csv\Exception; class Producto extends Model { - public $timestamps = false; - protected $fillable = ["nombre", "precio", "presentacion", "stock", "categoria"]; - static int $paginarPorDefecto = 10; + protected $fillable = ["nombre", "precio", "categoria", "bono", "es_solidario", "requiere_notas"]; public function subpedidos(): BelongsToMany { - return $this->belongsToMany('App\Subpedido', 'productos_subpedidos')->withPivot(["cantidad", "notas"]); + return $this->belongsToMany(Subpedido::class, 'productos_subpedidos')->withPivot(["cantidad", "notas"]); } - public function proveedor(): BelongsTo + public static function noBarriales() { - return $this->belongsTo('App\Proveedor'); + return self::where('nombre', 'not like', '%barrial%'); } - //Este método permite que se apliquen los filtros al hacer una request (por ejemplo, de búsqueda) + // Este método permite que se apliquen los filtros al hacer una request (por ejemplo, de búsqueda) public function scopeFiltrar($query, FiltroDeProducto $filtros): Builder { return $filtros->aplicar($query); @@ -37,22 +35,22 @@ class Producto extends Model public static function getPaginar(Request $request): int { - return $request->has('paginar') && intval($request->input('paginar')) ? intval($request->input('paginar')) : self::$paginarPorDefecto; + return $request->has('paginar') && intval($request->input('paginar')) ? intval($request->input('paginar')) : self::all()->count(); } public static function productosFilaID() { - return Producto::pluck('id', 'fila')->all(); + return self::noBarriales()->pluck('id', 'fila')->all(); } public static function productosIDFila() { - return Producto::pluck('fila', 'id')->all(); + return self::noBarriales()->pluck('fila', 'id')->all(); } public static function productosIDNombre() { - return Producto::pluck('nombre', 'id')->all(); + return self::noBarriales()->pluck('nombre', 'id')->all(); } static public function cantidadesPorBarrio(): Collection @@ -78,6 +76,9 @@ class Producto extends Model ->get(); } + /** + * @throws Exception + */ static public function planillaTotales() { $headers = ['Producto']; @@ -112,7 +113,8 @@ class Producto extends Model $planilla[$filaTransporte][] = $cantidad; } - CsvHelper::generarCsv('csv/exports/pedidos-por-barrio.csv', $planilla, $headers); + $fecha = now()->format('Y-m-d'); + CsvHelper::generarCsv('csv/exports/pedidos-por-barrio- ' . $fecha . '.csv', $planilla, $headers); } public static function notasPorBarrio(): Collection @@ -149,6 +151,7 @@ class Producto extends Model $planilla[] = $fila; } - CsvHelper::generarCsv('csv/exports/notas-por-barrio.csv', $planilla, $headers); + $fecha = now()->format('Y-m-d'); + CsvHelper::generarCsv('csv/exports/notas-por-barrio-' . $fecha . '.csv', $planilla, $headers); } } diff --git a/app/Proveedor.php b/app/Proveedor.php deleted file mode 100644 index 07dbc40..0000000 --- a/app/Proveedor.php +++ /dev/null @@ -1,18 +0,0 @@ -hasMany('App\Producto'); - } -} diff --git a/app/Subpedido.php b/app/Subpedido.php index 0370020..26e38e4 100644 --- a/app/Subpedido.php +++ b/app/Subpedido.php @@ -12,17 +12,16 @@ use App\Filtros\FiltroDeSubpedido; class Subpedido extends Model { - public $timestamps = false; protected $fillable = ['grupo_de_compra_id', 'aprobado', 'nombre', 'devoluciones_total', 'devoluciones_notas']; public function productos(): BelongsToMany { - return $this->belongsToMany('App\Producto')->withPivot(["cantidad", "total", "notas"]); + return $this->belongsToMany(Producto::class)->withPivot(["cantidad", "notas"]); } public function grupoDeCompra(): BelongsTo { - return $this->belongsTo('App\GrupoDeCompra'); + return $this->belongsTo(GrupoDeCompra::class); } // Permite que se apliquen los filtros al hacer una request (por ejemplo, de búsqueda) @@ -92,7 +91,7 @@ class Subpedido extends Model return TransporteHelper::cantidadTransporte($this->totalCentralesQuePaganTransporte()); } - //Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto. + // Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto. public function syncProducto(Producto $producto, int $cantidad, string $notas) { if ($cantidad) { @@ -100,7 +99,6 @@ class Subpedido extends Model $this->productos()->syncWithoutDetaching([ $producto->id => [ 'cantidad' => $cantidad, - 'total' => $cantidad * $producto->precio, 'notas' => $notas, ] ]); @@ -108,11 +106,15 @@ class Subpedido extends Model //si la cantidad es 0, se elimina el producto del subpedido $this->productos()->detach($producto->id); } + + $this->updated_at = now(); + $this->save(); } public function toggleAprobacion(bool $aprobacion) { $this->aprobado = $aprobacion; + $this->update(['aprobado' => $aprobacion]); $this->save(); } diff --git a/app/User.php b/app/User.php index 5f45a74..1dac38b 100644 --- a/app/User.php +++ b/app/User.php @@ -16,7 +16,7 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'email', 'password', + 'name', 'email', 'password', 'role_id', ]; /** @@ -40,6 +40,6 @@ class User extends Authenticatable public function grupoDeCompra(): BelongsTo { - return $this->belongsTo('App\GrupoDeCompra'); + return $this->belongsTo(GrupoDeCompra::class); } } diff --git a/app/Admin.php b/app/UserRole.php similarity index 50% rename from app/Admin.php rename to app/UserRole.php index 9745b32..67f69f6 100644 --- a/app/Admin.php +++ b/app/UserRole.php @@ -4,7 +4,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; -class Admin extends Model +class UserRole extends Model { - // + protected $fillable = ["nombre"]; } diff --git a/composer.json b/composer.json index adf9112..598e56a 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "license": "MIT", "require": { "php": "^7.4", + "doctrine/dbal": "^2.2.0", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.3.1|^7.0.1", diff --git a/composer.lock b/composer.lock index 972a0bd..32fc553 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4767b996aacf58bf7260964e8930a81d", + "content-hash": "ee189c9cfbbc9d8b733193f93d042fd9", "packages": [ { "name": "asm89/stack-cors", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/asm89/stack-cors.git", - "reference": "50f57105bad3d97a43ec4a485eb57daf347eafea" + "reference": "acf3142e6c5eafa378dc8ef3c069ab4558993f70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/asm89/stack-cors/zipball/50f57105bad3d97a43ec4a485eb57daf347eafea", - "reference": "50f57105bad3d97a43ec4a485eb57daf347eafea", + "url": "https://api.github.com/repos/asm89/stack-cors/zipball/acf3142e6c5eafa378dc8ef3c069ab4558993f70", + "reference": "acf3142e6c5eafa378dc8ef3c069ab4558993f70", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/asm89/stack-cors/issues", - "source": "https://github.com/asm89/stack-cors/tree/v2.2.0" + "source": "https://github.com/asm89/stack-cors/tree/v2.3.0" }, - "time": "2023-11-14T13:51:46+00:00" + "time": "2025-03-13T08:50:04+00:00" }, { "name": "brick/math", @@ -124,26 +124,26 @@ }, { "name": "carbonphp/carbon-doctrine-types", - "version": "2.1.0", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", - "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb" + "reference": "3c430083d0b41ceed84ecccf9dac613241d7305d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", - "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/3c430083d0b41ceed84ecccf9dac613241d7305d", + "reference": "3c430083d0b41ceed84ecccf9dac613241d7305d", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0" + "php": "^7.1.8 || ^8.0" }, "conflict": { - "doctrine/dbal": "<3.7.0 || >=4.0.0" + "doctrine/dbal": ">=3.7.0" }, "require-dev": { - "doctrine/dbal": "^3.7.0", + "doctrine/dbal": ">=2.0.0", "nesbot/carbon": "^2.71.0 || ^3.0.0", "phpunit/phpunit": "^10.3" }, @@ -173,7 +173,7 @@ ], "support": { "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", - "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/2.1.0" + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/1.0.0" }, "funding": [ { @@ -189,7 +189,349 @@ "type": "tidelift" } ], - "time": "2023-12-11T17:09:12+00:00" + "time": "2023-10-01T12:35:29+00:00" + }, + { + "name": "doctrine/cache", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/2.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2022-05-20T20:07:39+00:00" + }, + { + "name": "doctrine/dbal", + "version": "2.13.9", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/c480849ca3ad6706a39c970cdfe6888fa8a058b8", + "reference": "c480849ca3ad6706a39c970cdfe6888fa8a058b8", + "shasum": "" + }, + "require": { + "doctrine/cache": "^1.0|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1.0", + "ext-pdo": "*", + "php": "^7.1 || ^8" + }, + "require-dev": { + "doctrine/coding-standard": "9.0.0", + "jetbrains/phpstorm-stubs": "2021.1", + "phpstan/phpstan": "1.4.6", + "phpunit/phpunit": "^7.5.20|^8.5|9.5.16", + "psalm/plugin-phpunit": "0.16.1", + "squizlabs/php_codesniffer": "3.6.2", + "symfony/cache": "^4.4", + "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", + "vimeo/psalm": "4.22.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlanywhere", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/2.13.9" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2022-05-02T20:28:55+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=13" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12 || ^13", + "phpstan/phpstan": "1.4.10 || 2.1.11", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.5" + }, + "time": "2025-04-07T20:06:18+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^0.5.3 || ^1", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.8", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.24" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/1.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2022-10-12T20:51:15+00:00" }, { "name": "doctrine/inflector", @@ -630,16 +972,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.2", + "version": "7.9.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", - "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", "shasum": "" }, "require": { @@ -736,7 +1078,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" }, "funding": [ { @@ -752,20 +1094,20 @@ "type": "tidelift" } ], - "time": "2024-07-24T11:22:20+00:00" + "time": "2025-03-27T13:37:11+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.4", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", - "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", "shasum": "" }, "require": { @@ -819,7 +1161,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.4" + "source": "https://github.com/guzzle/promises/tree/2.2.0" }, "funding": [ { @@ -835,20 +1177,20 @@ "type": "tidelift" } ], - "time": "2024-10-17T10:06:22+00:00" + "time": "2025-03-27T13:27:01+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.7.0", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", - "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", "shasum": "" }, "require": { @@ -935,7 +1277,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.7.0" + "source": "https://github.com/guzzle/psr7/tree/2.7.1" }, "funding": [ { @@ -951,7 +1293,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T11:15:46+00:00" + "time": "2025-03-27T12:30:47+00:00" }, { "name": "laravel/framework", @@ -1144,13 +1486,13 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "laravel": { "providers": [ "Laravel\\Sanctum\\SanctumServiceProvider" ] + }, + "branch-alias": { + "dev-master": "2.x-dev" } }, "autoload": { @@ -1182,22 +1524,22 @@ }, { "name": "laravel/tinker", - "version": "v2.10.0", + "version": "v2.10.1", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "ba4d51eb56de7711b3a37d63aa0643e99a339ae5" + "reference": "22177cc71807d38f2810c6204d8f7183d88a57d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/ba4d51eb56de7711b3a37d63aa0643e99a339ae5", - "reference": "ba4d51eb56de7711b3a37d63aa0643e99a339ae5", + "url": "https://api.github.com/repos/laravel/tinker/zipball/22177cc71807d38f2810c6204d8f7183d88a57d3", + "reference": "22177cc71807d38f2810c6204d8f7183d88a57d3", "shasum": "" }, "require": { - "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", "php": "^7.2.5|^8.0", "psy/psysh": "^0.11.1|^0.12.0", "symfony/var-dumper": "^4.3.4|^5.0|^6.0|^7.0" @@ -1205,10 +1547,10 @@ "require-dev": { "mockery/mockery": "~1.3.3|^1.4.2", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^8.5.8|^9.3.3" + "phpunit/phpunit": "^8.5.8|^9.3.3|^10.0" }, "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0)." + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0)." }, "type": "library", "extra": { @@ -1242,9 +1584,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.10.0" + "source": "https://github.com/laravel/tinker/tree/v2.10.1" }, - "time": "2024-09-23T13:32:56+00:00" + "time": "2025-01-27T14:24:01+00:00" }, { "name": "laravel/ui", @@ -1905,16 +2247,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.1", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -1953,7 +2295,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -1961,20 +2303,20 @@ "type": "tidelift" } ], - "time": "2024-11-08T17:47:46+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "nesbot/carbon", - "version": "2.72.5", + "version": "2.73.0", "source": { "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed" + "url": "https://github.com/CarbonPHP/carbon.git", + "reference": "9228ce90e1035ff2f0db84b40ec2e023ed802075" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/afd46589c216118ecd48ff2b95d77596af1e57ed", - "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/9228ce90e1035ff2f0db84b40ec2e023ed802075", + "reference": "9228ce90e1035ff2f0db84b40ec2e023ed802075", "shasum": "" }, "require": { @@ -1994,7 +2336,7 @@ "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", - "ondrejmirtes/better-reflection": "*", + "ondrejmirtes/better-reflection": "<6", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12.99 || ^1.7.14", @@ -2007,10 +2349,6 @@ ], "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.x-dev", - "dev-2.x": "2.x-dev" - }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" @@ -2020,6 +2358,10 @@ "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-2.x": "2.x-dev", + "dev-master": "3.x-dev" } }, "autoload": { @@ -2068,20 +2410,20 @@ "type": "tidelift" } ], - "time": "2024-06-03T19:18:41+00:00" + "time": "2025-01-08T20:10:23+00:00" }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -2124,9 +2466,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "opis/closure", @@ -2761,16 +3103,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.4", + "version": "v0.12.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "2fd717afa05341b4f8152547f142cd2f130f6818" + "reference": "85057ceedee50c49d4f6ecaff73ee96adb3b3625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818", - "reference": "2fd717afa05341b4f8152547f142cd2f130f6818", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/85057ceedee50c49d4f6ecaff73ee96adb3b3625", + "reference": "85057ceedee50c49d4f6ecaff73ee96adb3b3625", "shasum": "" }, "require": { @@ -2797,12 +3139,12 @@ ], "type": "library", "extra": { - "branch-alias": { - "dev-main": "0.12.x-dev" - }, "bamarni-bin": { "bin-links": false, "forward-command": false + }, + "branch-alias": { + "dev-main": "0.12.x-dev" } }, "autoload": { @@ -2834,9 +3176,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.4" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.8" }, - "time": "2024-06-10T01:18:23+00:00" + "time": "2025-03-16T03:05:19+00:00" }, { "name": "ralouphie/getallheaders", @@ -3029,11 +3371,11 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "4.x-dev" - }, "captainhook": { "force-install": true + }, + "branch-alias": { + "dev-main": "4.x-dev" } }, "autoload": { @@ -3132,31 +3474,31 @@ }, { "name": "setasign/fpdi", - "version": "v2.6.1", + "version": "v2.6.3", "source": { "type": "git", "url": "https://github.com/Setasign/FPDI.git", - "reference": "09a816004fcee9ed3405bd164147e3fdbb79a56f" + "reference": "67c31f5e50c93c20579ca9e23035d8c540b51941" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/09a816004fcee9ed3405bd164147e3fdbb79a56f", - "reference": "09a816004fcee9ed3405bd164147e3fdbb79a56f", + "url": "https://api.github.com/repos/Setasign/FPDI/zipball/67c31f5e50c93c20579ca9e23035d8c540b51941", + "reference": "67c31f5e50c93c20579ca9e23035d8c540b51941", "shasum": "" }, "require": { "ext-zlib": "*", - "php": "^5.6 || ^7.0 || ^8.0" + "php": "^7.1 || ^8.0" }, "conflict": { "setasign/tfpdf": "<1.31" }, "require-dev": { - "phpunit/phpunit": "~5.7", + "phpunit/phpunit": "^7", "setasign/fpdf": "~1.8.6", "setasign/tfpdf": "~1.33", "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "~6.2" + "tecnickcom/tcpdf": "^6.2" }, "suggest": { "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured." @@ -3192,7 +3534,7 @@ ], "support": { "issues": "https://github.com/Setasign/FPDI/issues", - "source": "https://github.com/Setasign/FPDI/tree/v2.6.1" + "source": "https://github.com/Setasign/FPDI/tree/v2.6.3" }, "funding": [ { @@ -3200,7 +3542,7 @@ "type": "tidelift" } ], - "time": "2024-09-02T10:17:15+00:00" + "time": "2025-02-05T13:22:35+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -3445,16 +3787,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", - "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { @@ -3462,12 +3804,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3492,7 +3834,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4" }, "funding": [ { @@ -3508,7 +3850,7 @@ "type": "tidelift" } ], - "time": "2023-01-24T14:02:46+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/error-handler", @@ -3668,16 +4010,16 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73" + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/540f4c73e87fd0c71ca44a6aa305d024ac68cb73", - "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", + "reference": "e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f", "shasum": "" }, "require": { @@ -3689,12 +4031,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3727,7 +4069,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.4" }, "funding": [ { @@ -3743,7 +4085,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/finder", @@ -3810,16 +4152,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.4.46", + "version": "v5.4.48", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "168b77c71e6f02d8fc479db78beaf742a37d3cab" + "reference": "3f38b8af283b830e1363acd79e5bc3412d055341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/168b77c71e6f02d8fc479db78beaf742a37d3cab", - "reference": "168b77c71e6f02d8fc479db78beaf742a37d3cab", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3f38b8af283b830e1363acd79e5bc3412d055341", + "reference": "3f38b8af283b830e1363acd79e5bc3412d055341", "shasum": "" }, "require": { @@ -3866,7 +4208,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.46" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.48" }, "funding": [ { @@ -3882,20 +4224,20 @@ "type": "tidelift" } ], - "time": "2024-11-05T15:52:21+00:00" + "time": "2024-11-13T18:58:02+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.47", + "version": "v5.4.48", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "0ac42d5e16317f15dc5f8ea83742c51d2ed2350f" + "reference": "c2dbfc92b851404567160d1ecf3fb7d9b7bde9b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/0ac42d5e16317f15dc5f8ea83742c51d2ed2350f", - "reference": "0ac42d5e16317f15dc5f8ea83742c51d2ed2350f", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c2dbfc92b851404567160d1ecf3fb7d9b7bde9b0", + "reference": "c2dbfc92b851404567160d1ecf3fb7d9b7bde9b0", "shasum": "" }, "require": { @@ -3979,7 +4321,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.47" + "source": "https://github.com/symfony/http-kernel/tree/v5.4.48" }, "funding": [ { @@ -3995,7 +4337,7 @@ "type": "tidelift" } ], - "time": "2024-11-13T13:47:53+00:00" + "time": "2024-11-27T12:43:17+00:00" }, { "name": "symfony/mime", @@ -4084,7 +4426,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -4108,8 +4450,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4143,7 +4485,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" }, "funding": [ { @@ -4163,16 +4505,16 @@ }, { "name": "symfony/polyfill-iconv", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "48becf00c920479ca2e910c22a5a39e5d47ca956" + "reference": "5f3b930437ae03ae5dff61269024d8ea1b3774aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/48becf00c920479ca2e910c22a5a39e5d47ca956", - "reference": "48becf00c920479ca2e910c22a5a39e5d47ca956", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/5f3b930437ae03ae5dff61269024d8ea1b3774aa", + "reference": "5f3b930437ae03ae5dff61269024d8ea1b3774aa", "shasum": "" }, "require": { @@ -4187,8 +4529,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4223,7 +4565,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.32.0" }, "funding": [ { @@ -4239,11 +4581,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-09-17T14:58:18+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -4264,8 +4606,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4301,7 +4643,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.32.0" }, "funding": [ { @@ -4321,16 +4663,16 @@ }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773" + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773", - "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3", "shasum": "" }, "require": { @@ -4343,8 +4685,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4384,7 +4726,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.32.0" }, "funding": [ { @@ -4400,11 +4742,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-09-10T14:38:51+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -4425,8 +4767,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4465,7 +4807,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, "funding": [ { @@ -4485,19 +4827,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -4509,8 +4852,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4545,7 +4888,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -4561,11 +4904,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -4583,8 +4926,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4621,7 +4964,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.32.0" }, "funding": [ { @@ -4641,16 +4984,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "shasum": "" }, "require": { @@ -4659,8 +5002,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4701,7 +5044,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" }, "funding": [ { @@ -4717,11 +5060,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2025-01-02T08:10:11+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", @@ -4739,8 +5082,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4777,7 +5120,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0" }, "funding": [ { @@ -4859,16 +5202,16 @@ }, { "name": "symfony/routing", - "version": "v5.4.45", + "version": "v5.4.48", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "986597b3d1c86ecefe094c0c236a9e9ad22756f2" + "reference": "dd08c19879a9b37ff14fd30dcbdf99a4cf045db1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/986597b3d1c86ecefe094c0c236a9e9ad22756f2", - "reference": "986597b3d1c86ecefe094c0c236a9e9ad22756f2", + "url": "https://api.github.com/repos/symfony/routing/zipball/dd08c19879a9b37ff14fd30dcbdf99a4cf045db1", + "reference": "dd08c19879a9b37ff14fd30dcbdf99a4cf045db1", "shasum": "" }, "require": { @@ -4929,7 +5272,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.4.45" + "source": "https://github.com/symfony/routing/tree/v5.4.48" }, "funding": [ { @@ -4945,20 +5288,20 @@ "type": "tidelift" } ], - "time": "2024-09-30T08:44:06+00:00" + "time": "2024-11-12T18:20:21+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", - "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", "shasum": "" }, "require": { @@ -4974,12 +5317,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -5012,7 +5355,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.4" }, "funding": [ { @@ -5028,7 +5371,7 @@ "type": "tidelift" } ], - "time": "2023-04-21T15:04:16+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/string", @@ -5215,16 +5558,16 @@ }, { "name": "symfony/translation-contracts", - "version": "v2.5.3", + "version": "v2.5.4", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "b0073a77ac0b7ea55131020e87b1e3af540f4664" + "reference": "450d4172653f38818657022252f9d81be89ee9a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b0073a77ac0b7ea55131020e87b1e3af540f4664", - "reference": "b0073a77ac0b7ea55131020e87b1e3af540f4664", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/450d4172653f38818657022252f9d81be89ee9a8", + "reference": "450d4172653f38818657022252f9d81be89ee9a8", "shasum": "" }, "require": { @@ -5235,12 +5578,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -5273,7 +5616,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.3" + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.4" }, "funding": [ { @@ -5289,20 +5632,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.4.47", + "version": "v5.4.48", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "e13e8dfa8eaab2b0536ef365beddc2af723a9ac0" + "reference": "42f18f170aa86d612c3559cfb3bd11a375df32c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e13e8dfa8eaab2b0536ef365beddc2af723a9ac0", - "reference": "e13e8dfa8eaab2b0536ef365beddc2af723a9ac0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/42f18f170aa86d612c3559cfb3bd11a375df32c8", + "reference": "42f18f170aa86d612c3559cfb3bd11a375df32c8", "shasum": "" }, "require": { @@ -5362,7 +5705,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.47" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.48" }, "funding": [ { @@ -5382,31 +5725,33 @@ }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "v2.2.7", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb" + "reference": "0d72ac1c00084279c1816675284073c5a337c20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/83ee6f38df0a63106a9e4536e3060458b74ccedb", - "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0d72ac1c00084279c1816675284073c5a337c20d", + "reference": "0d72ac1c00084279c1816675284073c5a337c20d", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" + "php": "^7.4 || ^8.0", + "symfony/css-selector": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^8.5.21 || ^9.5.10" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -5429,9 +5774,9 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.2.7" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.3.0" }, - "time": "2023-12-08T13:03:43+00:00" + "time": "2024-12-21T16:25:41+00:00" }, { "name": "vlucas/phpdotenv", @@ -5694,16 +6039,16 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "laravel": { - "providers": [ - "Facade\\Ignition\\IgnitionServiceProvider" - ], "aliases": { "Flare": "Facade\\Ignition\\Facades\\Flare" - } + }, + "providers": [ + "Facade\\Ignition\\IgnitionServiceProvider" + ] + }, + "branch-alias": { + "dev-master": "2.x-dev" } }, "autoload": { @@ -5852,16 +6197,16 @@ }, { "name": "filp/whoops", - "version": "2.16.0", + "version": "2.18.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "befcdc0e5dce67252aa6322d82424be928214fa2" + "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/befcdc0e5dce67252aa6322d82424be928214fa2", - "reference": "befcdc0e5dce67252aa6322d82424be928214fa2", + "url": "https://api.github.com/repos/filp/whoops/zipball/a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", + "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", "shasum": "" }, "require": { @@ -5911,7 +6256,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.16.0" + "source": "https://github.com/filp/whoops/tree/2.18.0" }, "funding": [ { @@ -5919,7 +6264,7 @@ "type": "github" } ], - "time": "2024-09-25T12:00:00+00:00" + "time": "2025-03-15T12:00:00+00:00" }, { "name": "nunomaduro/collision", @@ -6012,12 +6357,12 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^7.4" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/database/migrations/2025_05_15_021941_create_user_roles_table.php b/database/migrations/2025_05_15_021941_create_user_roles_table.php new file mode 100644 index 0000000..e4de28c --- /dev/null +++ b/database/migrations/2025_05_15_021941_create_user_roles_table.php @@ -0,0 +1,41 @@ +id(); + $table->string('nombre'); + $table->timestamps(); + }); + + $tipos = ["barrio", "admin_barrio", "comision"]; + foreach ($tipos as $tipo) { + UserRole::create([ + "nombre" => $tipo, + ]); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('user_roles'); + } +} diff --git a/database/migrations/2025_05_15_023829_agregar_rol_a_user.php b/database/migrations/2025_05_15_023829_agregar_rol_a_user.php new file mode 100644 index 0000000..d6e0673 --- /dev/null +++ b/database/migrations/2025_05_15_023829_agregar_rol_a_user.php @@ -0,0 +1,43 @@ +foreignId('role_id'); + }); + + $barrio = UserRole::where('nombre', 'barrio')->first(); + $admin_barrio = UserRole::where('nombre', 'admin_barrio')->first(); + $comision = UserRole::where('nombre', 'comision')->first(); + User::all()->each(function($user) use ($barrio, $comision, $admin_barrio) { + $user->role_id = $user->is_admin ? $admin_barrio->id : + ($user->is_compras ? $comision->id : $barrio->id); + $user->save(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('user', function (Blueprint $table) { + $table->dropForeign('role_id'); + }); + } +} diff --git a/database/migrations/2025_05_15_033316_simplificar_users.php b/database/migrations/2025_05_15_033316_simplificar_users.php new file mode 100644 index 0000000..649a912 --- /dev/null +++ b/database/migrations/2025_05_15_033316_simplificar_users.php @@ -0,0 +1,43 @@ +dropColumn(['is_admin', 'is_compras']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->boolean('is_admin')->default(false); + $table->boolean('is_compras')->default(false); + }); + + $admin_barrio = UserRole::where('nombre', 'admin_barrio')->first(); + $comision = UserRole::where('nombre', 'comision')->first(); + foreach (User::all() as $user) { + $user->is_admin = $user->role_id == $admin_barrio->id; + $user->is_compras = $user->role_id == $comision->id; + $user->save(); + } + } +} diff --git a/database/migrations/2025_05_15_033711_simplificar_barrios.php b/database/migrations/2025_05_15_033711_simplificar_barrios.php new file mode 100644 index 0000000..f7d4e6e --- /dev/null +++ b/database/migrations/2025_05_15_033711_simplificar_barrios.php @@ -0,0 +1,40 @@ +dropColumn([ + 'cantidad_de_nucleos', + 'telefono', + 'correo', + 'referente_finanzas', + ]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('grupos_de_compra', function (Blueprint $table) { + $table->double('cantidad_de_nucleos'); + $table->string('telefono'); + $table->string('correo'); + $table->string('referente_finanzas'); + }); + } +} diff --git a/database/migrations/2025_05_15_034325_simplificar_productos.php b/database/migrations/2025_05_15_034325_simplificar_productos.php new file mode 100644 index 0000000..079b389 --- /dev/null +++ b/database/migrations/2025_05_15_034325_simplificar_productos.php @@ -0,0 +1,44 @@ +dropColumn([ + 'presentacion', + 'stock', + 'imagen_id', + 'descripcion', + 'apto_veganxs', + 'apto_celiacxs', + ]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('productos', function (Blueprint $table) { + $table->integer('presentacion')->nullable(); + $table->integer('stock')->nullable(); + $table->foreignId('imagen_id')->nullable(); + $table->string('descripcion')->nullable(); + $table->boolean('apto_veganxs')->nullable(); + $table->boolean('apto_celiacxs')->nullable(); + }); + } +} diff --git a/database/migrations/2025_05_15_034910_simplificar_producto_subpedido.php b/database/migrations/2025_05_15_034910_simplificar_producto_subpedido.php new file mode 100644 index 0000000..ce6245f --- /dev/null +++ b/database/migrations/2025_05_15_034910_simplificar_producto_subpedido.php @@ -0,0 +1,32 @@ +dropColumn('total'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('producto_subpedido', function (Blueprint $table) { + $table->double('total'); + }); + } +} diff --git a/database/migrations/2025_05_15_035305_agregar_es_solidario.php b/database/migrations/2025_05_15_035305_agregar_es_solidario.php new file mode 100644 index 0000000..e4797c4 --- /dev/null +++ b/database/migrations/2025_05_15_035305_agregar_es_solidario.php @@ -0,0 +1,38 @@ +boolean('es_solidario')->default(false); + }); + + foreach (Producto::all() as $producto) { + $producto->es_solidario = $producto->proveedor_id != null; + $producto->save(); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('productos', function (Blueprint $table) { + $table->dropColumn('es_solidario'); + }); + } +} diff --git a/database/migrations/2025_05_15_035807_eliminar_proveedor.php b/database/migrations/2025_05_15_035807_eliminar_proveedor.php new file mode 100644 index 0000000..52c4210 --- /dev/null +++ b/database/migrations/2025_05_15_035807_eliminar_proveedor.php @@ -0,0 +1,59 @@ +dropColumn('proveedor_id'); + }); + Schema::dropIfExists('proveedores'); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::create('proveedores', function (Blueprint $table) { + $table->id(); + $table->string('nombre'); + $table->string('direccion')->nullable(); + $table->string('telefono')->nullable(); + $table->string('correo')->nullable(); + $table->boolean('economia_solidaria')->nullable(); + $table->boolean('nacional')->nullable(); + $table->text('detalles_de_pago')->nullable(); + $table->text('comentario')->nullable(); + $table->timestamps(); + }); + + Schema::table('productos', function (Blueprint $table) { + $table->foreignId('proveedor_id')->nullable(); + }); + + $proveedor_id = DB::table('proveedores')->insertGetId([ + ['nombre' => 'Proveedor de economía solidaria', + 'economia_solidaria' => 1, + 'nacional' => 1] + ]); + + foreach (Producto::all() as $producto) { + $producto->proveedor_id = $producto->es_solidario ? $proveedor_id : null; + $producto->save(); + } + } +} diff --git a/database/migrations/2025_05_15_041404_eliminar_admin.php b/database/migrations/2025_05_15_041404_eliminar_admin.php new file mode 100644 index 0000000..cee52ed --- /dev/null +++ b/database/migrations/2025_05_15_041404_eliminar_admin.php @@ -0,0 +1,35 @@ +id(); + $table->string('nombre'); + $table->foreignId('grupo_de_compra_id'); + $table->string('email'); + $table->string('contrasena'); + $table->timestamps(); + }); + } +} diff --git a/database/migrations/2025_05_23_193246_hacer_fila_nullable.php b/database/migrations/2025_05_23_193246_hacer_fila_nullable.php new file mode 100644 index 0000000..5a80764 --- /dev/null +++ b/database/migrations/2025_05_23_193246_hacer_fila_nullable.php @@ -0,0 +1,32 @@ +integer('fila')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('productos', function (Blueprint $table) { + $table->integer('fila')->nullable(false)->change(); + }); + } +} diff --git a/database/migrations/2025_05_23_212603_quitar_password_de_grupo_de_compra.php b/database/migrations/2025_05_23_212603_quitar_password_de_grupo_de_compra.php new file mode 100644 index 0000000..a6820c5 --- /dev/null +++ b/database/migrations/2025_05_23_212603_quitar_password_de_grupo_de_compra.php @@ -0,0 +1,32 @@ +dropColumn('password'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('grupos_de_compra', function (Blueprint $table) { + $table->string('password')->nullable(); + }); + } +} diff --git a/database/migrations/2025_06_14_172643_agregar_saldos_a_barrios.php b/database/migrations/2025_06_14_172643_agregar_saldos_a_barrios.php new file mode 100644 index 0000000..bffe955 --- /dev/null +++ b/database/migrations/2025_06_14_172643_agregar_saldos_a_barrios.php @@ -0,0 +1,34 @@ +double('saldo', 10, 2)->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // Remover columna 'saldo' de la tabla 'grupos_de_compra' + Schema::table('grupos_de_compra', function (Blueprint $table) { + $table->dropColumn('saldo'); + }); + } +} diff --git a/database/seeds/CanastaSeeder.php b/database/seeds/CanastaSeeder.php index 167fa8f..19ed268 100644 --- a/database/seeds/CanastaSeeder.php +++ b/database/seeds/CanastaSeeder.php @@ -11,9 +11,10 @@ class CanastaSeeder extends Seeder * Run the database seeds. * * @return void + * @throws \League\Csv\Exception */ public function run() { - CanastaHelper::cargarCanasta(self::ARCHIVO_DEFAULT); + CanastaHelper::cargarCanasta(resource_path(self::ARCHIVO_DEFAULT)); } } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 845fa72..57f6ac4 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -1,10 +1,19 @@ orWhere('nombre', 'admin_barrio')->get(); foreach($registros as $key => $registro){ - $gdcToInsert[] = [ + $gdcToInsert[] = DatabaseSeeder::addTimestamps([ 'nombre' => $registro['barrio'], 'region' => $registro['region'], - 'telefono' => $registro['telefono'], - 'correo' => $registro['correo'], - 'referente_finanzas' => $registro['referente'] - ]; + ]); - $usersToInsert[] = [ - 'name' => $registro['barrio'], - 'password' => Hash::make("123"), - "is_admin" => 0, - 'grupo_de_compra_id' => $key - ]; - - $usersToInsert[] = [ - 'name' => $registro['barrio'] . "_admin", - 'password' => Hash::make("123"), - "is_admin" => 1, - 'grupo_de_compra_id' => $key - ]; + foreach($roles as $role) { + $nombre = $registro['barrio'] . ($role->nombre == 'barrio' ? '' : '_admin'); + $usersToInsert[] = DatabaseSeeder::addTimestamps([ + 'name' => $nombre, + 'password' => Hash::make("123"), + 'role_id' => $role->id, + 'grupo_de_compra_id' => $key, + ]); + } } foreach (array_chunk($gdcToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) - { - DB::table('grupos_de_compra')->insert($chunk); - } + GrupoDeCompra::insert($chunk); foreach (array_chunk($usersToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) - { - DB::table('users')->insert($chunk); - } + User::insert($chunk); } } diff --git a/database/seeds/UserSeeder.php b/database/seeds/UserSeeder.php index f2164c1..35bc3b9 100644 --- a/database/seeds/UserSeeder.php +++ b/database/seeds/UserSeeder.php @@ -1,7 +1,8 @@ 'compras', + $usersToInsert[] = DatabaseSeeder::addTimestamps([ + 'name' => 'comi', 'password' => Hash::make("123"), - 'is_admin' => 0, - 'is_compras' => 1 - ]; + 'role_id' => UserRole::where('nombre', 'comision')->first()->id, + ]); foreach (array_chunk($usersToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) - { - DB::table('users')->insert($chunk); - } + User::insert($chunk); } } diff --git a/package-lock.json b/package-lock.json index c28b5a6..6badddb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,16 +8,13 @@ "animate.css": "^4.1.1", "bulma": "^0.9.4", "bulma-switch": "^2.0.4", - "bulma-toast": "^2.4.1" + "bulma-toast": "^2.4.1", + "vuex": "^3.6.2" }, "devDependencies": { "axios": "^0.19.2", - "bootstrap": "^4.0.0", "cross-env": "^7.0.3", - "jquery": "^3.2", "laravel-mix": "^5.0.1", - "lodash": "^4.17.19", - "popper.js": "^1.12", "resolve-url-loader": "^2.3.1", "sass": "^1.20.1", "sass-loader": "^8.0.0", @@ -350,7 +347,6 @@ "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -359,7 +355,6 @@ "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -404,7 +399,6 @@ "version": "7.27.2", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.2.tgz", "integrity": "sha512-QYLs8299NA7WM/bZAdp+CviYYkVoYXlDW2rzliy3chxd1PQjej7JORuMJDJXJUb9g0TT+B99EwaVLKmX+sPXWw==", - "dev": true, "dependencies": { "@babel/types": "^7.27.1" }, @@ -1568,7 +1562,6 @@ "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.1.tgz", "integrity": "sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==", - "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" @@ -2060,7 +2053,6 @@ "version": "2.7.16", "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz", "integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==", - "dev": true, "dependencies": { "@babel/parser": "^7.23.5", "postcss": "^8.4.14", @@ -2075,7 +2067,6 @@ "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", - "dev": true, "funding": [ { "type": "opencollective", @@ -3095,26 +3086,6 @@ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true }, - "node_modules/bootstrap": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz", - "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/twbs" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/bootstrap" - } - ], - "peerDependencies": { - "jquery": "1.9.1 - 3", - "popper.js": "^1.16.1" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4609,8 +4580,7 @@ "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/cyclist": { "version": "1.0.2", @@ -7945,12 +7915,6 @@ "node": ">=8" } }, - "node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", - "dev": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8717,7 +8681,6 @@ "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, "funding": [ { "type": "github", @@ -9555,8 +9518,7 @@ "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -9613,17 +9575,6 @@ "node": ">=8" } }, - "node_modules/popper.js": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", - "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==", - "deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, "node_modules/portfinder": { "version": "1.0.37", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.37.tgz", @@ -10557,7 +10508,6 @@ "version": "2.8.8", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, "optional": true, "bin": { "prettier": "bin-prettier.js" @@ -12085,7 +12035,6 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -12094,7 +12043,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -13345,7 +13293,6 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.16.tgz", "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", - "dev": true, "dependencies": { "@vue/compiler-sfc": "2.7.16", "csstype": "^3.1.0" @@ -13463,6 +13410,14 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, + "node_modules/vuex": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", + "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", + "peerDependencies": { + "vue": "^2.0.0" + } + }, "node_modules/watchpack": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", @@ -15238,14 +15193,12 @@ "@babel/helper-string-parser": { "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==" }, "@babel/helper-validator-identifier": { "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", - "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", - "dev": true + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==" }, "@babel/helper-validator-option": { "version": "7.27.1", @@ -15278,7 +15231,6 @@ "version": "7.27.2", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.2.tgz", "integrity": "sha512-QYLs8299NA7WM/bZAdp+CviYYkVoYXlDW2rzliy3chxd1PQjej7JORuMJDJXJUb9g0TT+B99EwaVLKmX+sPXWw==", - "dev": true, "requires": { "@babel/types": "^7.27.1" } @@ -16040,7 +15992,6 @@ "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.1.tgz", "integrity": "sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==", - "dev": true, "requires": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" @@ -16309,7 +16260,6 @@ "version": "2.7.16", "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz", "integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==", - "dev": true, "requires": { "@babel/parser": "^7.23.5", "postcss": "^8.4.14", @@ -16321,7 +16271,6 @@ "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", - "dev": true, "requires": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", @@ -17166,13 +17115,6 @@ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true }, - "bootstrap": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz", - "integrity": "sha512-51Bbp/Uxr9aTuy6ca/8FbFloBUJZLHwnhTcnjIeRn2suQWsWzcuJhGjKDB5eppVte/8oCdOL3VuwxvZDUggwGQ==", - "dev": true, - "requires": {} - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -18344,8 +18286,7 @@ "csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "cyclist": { "version": "1.0.2", @@ -20905,12 +20846,6 @@ } } }, - "jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -21555,8 +21490,7 @@ "nanoid": { "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==" }, "nanomatch": { "version": "1.2.13", @@ -22207,8 +22141,7 @@ "picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "picomatch": { "version": "2.3.1", @@ -22247,12 +22180,6 @@ "find-up": "^4.0.0" } }, - "popper.js": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", - "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==", - "dev": true - }, "portfinder": { "version": "1.0.37", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.37.tgz", @@ -23060,7 +22987,6 @@ "version": "2.8.8", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, "optional": true }, "private": { @@ -24290,14 +24216,12 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==" }, "source-map-resolve": { "version": "0.5.3", @@ -25287,7 +25211,6 @@ "version": "2.7.16", "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.16.tgz", "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", - "dev": true, "requires": { "@vue/compiler-sfc": "2.7.16", "csstype": "^3.1.0" @@ -25382,6 +25305,12 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, + "vuex": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz", + "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==", + "requires": {} + }, "watchpack": { "version": "1.7.5", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz", diff --git a/package.json b/package.json index cc4c17c..23c0c28 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,8 @@ }, "devDependencies": { "axios": "^0.19.2", - "bootstrap": "^4.0.0", "cross-env": "^7.0.3", - "jquery": "^3.2", "laravel-mix": "^5.0.1", - "lodash": "^4.17.19", - "popper.js": "^1.12", "resolve-url-loader": "^2.3.1", "sass": "^1.20.1", "sass-loader": "^8.0.0", @@ -27,6 +23,7 @@ "animate.css": "^4.1.1", "bulma": "^0.9.4", "bulma-switch": "^2.0.4", - "bulma-toast": "^2.4.1" + "bulma-toast": "^2.4.1", + "vuex": "^3.6.2" } } diff --git a/resources/js/app.js b/resources/js/app.js index c2bf1a6..40a3961 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -5,6 +5,7 @@ */ import axios from 'axios'; import Vue from 'vue'; + window.Vue = require('vue'); window.Event = new Vue(); window.axios = axios; @@ -18,33 +19,18 @@ window.bulmaToast = require('bulma-toast'); * Eg. ./components/ExampleComponent.vue -> */ import './components'; +import store from "./store"; -/** - * Constants - */ -Vue.prototype.$rootMiga = { - nombre: "Categorías", - href: "/productos" -} /** * Global methods */ -Vue.prototype.$settearProducto = function(cantidad, id) { - Event.$emit("sync-subpedido", this.cant, this.producto.id) -} -Vue.prototype.$toast = function(mensaje, duration = 2000) { - return window.bulmaToast.toast({ - message: mensaje, - duration: duration, - type: 'is-danger', - position: 'bottom-center', - }); -} -Vue.prototype.$limpiarFloat = function(unFloat) { - return parseFloat(unFloat.replace(/,/g, '')) -} -Vue.prototype.$limpiarInt = function(unInt) { - return parseInt(unInt.replace(/,/g, '')) +Vue.prototype.$toast = function (mensaje, duration = 2000) { + return window.bulmaToast.toast({ + message: mensaje, + duration: duration, + type: 'is-danger', + position: 'bottom-center', + }); } /** @@ -52,98 +38,8 @@ Vue.prototype.$limpiarInt = function(unInt) { * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */ -const app = new Vue({ +new Vue({ el: '#root', - data() { - return { - gdc: null, - pedido: null, - devoluciones: null, - } - }, - computed: { - productos: function() { - return this.pedido.productos - } - }, - methods: { - cantidad(producto) { - let pedido = this.productos.some(p => p.id == producto.id) - return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0 - }, - notas(producto) { - let pedido = this.productos.some(p => p.id == producto.id); - return pedido ? this.productos.find(p => p.id == producto.id).pivot.notas : ""; - }, - settearDevoluciones() { - axios.get(`/api/grupos-de-compra/${this.gdc}/devoluciones`) - .then(response => { - this.devoluciones = response.data.devoluciones; - }); - } - }, - mounted() { - Event.$on('obtener-sesion', () => { - axios.get('/subpedidos/obtener_sesion') - .then(response => { - if (response.data.subpedido.id) { - this.gdc = response.data.gdc; - this.settearDevoluciones(); - this.pedido = response.data.subpedido.id; - axios.get('/api/subpedidos/' + this.pedido) - .then(response => { - this.pedido = response.data.data; - Event.$emit("pedido-actualizado"); - }); - } else { - axios.get('/admin/obtener_sesion') - .then(response => { - this.gdc = response.data.gdc - }); - } - }) - }) - Event.$on('sync-subpedido', (cantidad, id, notas) => { - if (this.pedido.aprobado) { - this.$toast('No se puede modificar un pedido ya aprobado', 2000); - return; - } - axios.post("/api/subpedidos/" + this.pedido.id + "/sync", { - cantidad: cantidad, - producto_id: id, - notas: notas, - }).then((response) => { - this.pedido = response.data.data - this.$toast('Pedido actualizado exitosamente') - Event.$emit("pedido-actualizado"); - }); - }); - // Actualizar monto y notas de devoluciones - Event.$on('sync-devoluciones', (total, notas) => { - if (this.pedido.aprobado) { - this.$toast('No se puede modificar un pedido ya aprobado', 2000); - return; - } - - axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", { - total: total, - notas: notas, - }).then((response) => { - this.pedido = response.data.data; - this.$toast('Pedido actualizado'); - Event.$emit("pedido-actualizado"); - }); - }); - - Event.$on('aprobacion-subpedido', (subpedidoId, aprobado) => { - axios.post("/api/admin/subpedidos/" + subpedidoId + "/aprobacion", { - aprobacion: aprobado - }).then((response) => { - Event.$emit('sync-aprobacion', response.data.data); - this.$toast('Pedido ' + (aprobado ? 'aprobado' : 'desaprobado') + ' exitosamente') - }) - }) - Event.$emit('obtener-sesion') - }, + store, }); diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js deleted file mode 100644 index 63605fa..0000000 --- a/resources/js/bootstrap.js +++ /dev/null @@ -1,41 +0,0 @@ -window._ = require('lodash'); - -/** - * We'll load jQuery and the Bootstrap jQuery plugin which provides support - * for JavaScript based Bootstrap features such as modals and tabs. This - * code may be modified to fit the specific needs of your application. - */ - -try { - window.Popper = require('popper.js').default; - window.$ = window.jQuery = require('jquery'); - - require('bootstrap'); -} catch (e) {} - -/** - * We'll load the axios HTTP library which allows us to easily issue requests - * to our Laravel back-end. This library automatically handles sending the - * CSRF token as a header based on the value of the "XSRF" token cookie. - */ - -window.axios = require('axios'); - -window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; - -/** - * Echo exposes an expressive API for subscribing to channels and listening - * for events that are broadcast by Laravel. Echo and event broadcasting - * allows your team to easily build robust real-time web applications. - */ - -// import Echo from 'laravel-echo'; - -// window.Pusher = require('pusher-js'); - -// window.Echo = new Echo({ -// broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, -// forceTLS: true -// }); diff --git a/resources/js/components/AppLogin.vue b/resources/js/components/AppLogin.vue new file mode 100644 index 0000000..ecedec1 --- /dev/null +++ b/resources/js/components/AppLogin.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/resources/js/components/AppMain.vue b/resources/js/components/AppMain.vue new file mode 100644 index 0000000..09780fc --- /dev/null +++ b/resources/js/components/AppMain.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/resources/js/components/admin/Body.vue b/resources/js/components/admin/Body.vue index 2083305..1f41a28 100644 --- a/resources/js/components/admin/Body.vue +++ b/resources/js/components/admin/Body.vue @@ -1,15 +1,11 @@ @@ -28,19 +23,17 @@ import CaracteristicasOpcionales from "./CaracteristicasOpcionales.vue"; import TabsSecciones from "../comunes/TabsSecciones.vue"; import DropdownDescargar from "./DropdownDescargar.vue"; import TablaPedidos from "./TablaPedidos.vue"; -import TablaBonos from "./TablaBonos.vue"; -import axios from "axios"; +import { mapActions, mapGetters } from "vuex"; export default { + name: "AdminBody", components: { CaracteristicasOpcionales, TabsSecciones, DropdownDescargar, TablaPedidos, - TablaBonos, }, data() { return { - gdc: undefined, tabs: [{ id: "pedidos", nombre: "Pedidos" }, { id: "caracteristicas", nombre: "Caracteristicas opcionales" }], tabActiva: "pedidos", @@ -48,32 +41,17 @@ export default { } }, computed: { - hayPedidos: function() { - return this.gdc && this.gdc.pedidos.length !== 0 - }, - hayAprobados: function() { - return this.gdc && this.gdc.pedidos.filter(p => p.aprobado).length > 0 - } + ...mapGetters('admin', ['hayPedidos']), }, methods: { + ...mapActions('admin', ['getGrupoDeCompra']), setSeccionActiva(tabId) { this.tabActiva = tabId; this.seccionActiva = tabId + "-seccion"; }, - actualizar() { - axios.get('/api/grupos-de-compra/' + this.$root.gdc) - .then(response => { - this.gdc = response.data.data; - console.log(this.gdc); - }) - } }, async mounted() { - Event.$on('sync-aprobacion', (_) => { - this.actualizar(); - }); - await new Promise(r => setTimeout(r, 1000)); - this.actualizar(); + await this.getGrupoDeCompra(); }, } diff --git a/resources/js/components/admin/BotonLogin.vue b/resources/js/components/admin/BotonLogin.vue deleted file mode 100644 index 0ce0e17..0000000 --- a/resources/js/components/admin/BotonLogin.vue +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/resources/js/components/admin/CaracteristicasOpcionales.vue b/resources/js/components/admin/CaracteristicasOpcionales.vue index 242dfb2..9339a20 100644 --- a/resources/js/components/admin/CaracteristicasOpcionales.vue +++ b/resources/js/components/admin/CaracteristicasOpcionales.vue @@ -8,8 +8,7 @@ export default { caracteristicas: [ { id: "devoluciones", - nombre: "Devoluciones", - habilitada: false + nombre: "Devoluciones" }, ] } @@ -27,16 +26,15 @@ export default { - - + :caracteristica="c" + /> diff --git a/resources/js/components/admin/DropdownDescargar.vue b/resources/js/components/admin/DropdownDescargar.vue index 0b95488..55f91ae 100644 --- a/resources/js/components/admin/DropdownDescargar.vue +++ b/resources/js/components/admin/DropdownDescargar.vue @@ -14,13 +14,13 @@ @@ -51,19 +60,28 @@ - + diff --git a/resources/js/components/comisiones/Body.vue b/resources/js/components/comisiones/Body.vue new file mode 100644 index 0000000..56287e4 --- /dev/null +++ b/resources/js/components/comisiones/Body.vue @@ -0,0 +1,59 @@ + + + diff --git a/resources/js/components/compras/DropdownDescargar.vue b/resources/js/components/comisiones/DropdownDescargar.vue similarity index 84% rename from resources/js/components/compras/DropdownDescargar.vue rename to resources/js/components/comisiones/DropdownDescargar.vue index 92f91f8..dc119a8 100644 --- a/resources/js/components/compras/DropdownDescargar.vue +++ b/resources/js/components/comisiones/DropdownDescargar.vue @@ -14,13 +14,13 @@