Rubi 4 days ago
parent
commit
de9b68a163
  1. 30
      app/Exports/CapacidadesExport.php
  2. 22
      app/Exports/tiposLicenciasExport.php
  3. 20
      app/Http/Controllers/CapacidadController.php
  4. 10
      app/Http/Controllers/MarcaController.php
  5. 106
      app/Http/Controllers/PrestamoController.php
  6. 3
      composer.json
  7. 442
      composer.lock
  8. 333
      config/excel.php
  9. 17
      resources/views/capacidades.blade.php
  10. 41
      resources/views/exports/capacidades-pdf.blade.php
  11. 79
      resources/views/prestamos.blade.php
  12. 2
      routes/web.php

30
app/Exports/CapacidadesExport.php

@ -1,30 +0,0 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class CapacidadesExport implements FromCollection, WithHeadings
{
protected $capacidades;
public function __construct($capacidades)
{
$this->capacidades = $capacidades;
}
public function collection()
{
return $this->capacidades;
}
public function headings(): array
{
return [
'ID',
'Cantidad',
'Fecha de Creación'
];
}
}

22
app/Exports/tiposLicenciasExport.php

@ -3,7 +3,6 @@
namespace App\Exports;
use App\Models\tiposLicencias;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
@ -12,20 +11,13 @@ class TiposLicenciasExport implements FromCollection, WithHeadings
/**
* Método que devuelve la colección de datos a exportar.
*
* @return Collection
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return tiposLicencias::where('eliminado', 1)
->get()
->map(function($licencia) {
return [
$licencia->id,
$licencia->tipoLicencia,
$licencia->eliminado ? 'Activo' : 'Inactivo',
$licencia->created_at ? $licencia->created_at->format('d/m/Y') : ''
];
});
return tiposLicencias::where('eliminado', 0) // Solo marcas activas
->select('id', 'tipoLicencia') // Selecciona los campos que deseas exportar
->get();
}
/**
@ -36,10 +28,8 @@ class TiposLicenciasExport implements FromCollection, WithHeadings
public function headings(): array
{
return [
'ID',
'Tipo de Licencia',
'Estado',
'Fecha de Creación'
'ID', // Encabezado para la columna ID
'Tipo de licencia', // Encabezado para la columna Tipo de licencia
];
}
}

20
app/Http/Controllers/CapacidadController.php

@ -4,11 +4,6 @@ namespace App\Http\Controllers;
use App\Models\Capacidad;
use Illuminate\Http\Request;
use PDF;
use App\Exports\CapacidadesExport;
use Maatwebsite\Excel\Facades\Excel as ExcelFacade;
class CapacidadController extends Controller
{
@ -101,19 +96,4 @@ class CapacidadController extends Controller
return redirect()->route('capacidades.index')->with('error', 'No se pudo eliminar la capacidad.');
}
public function exportExcel()
{
$capacidades = Capacidad::where('eliminado', 1)->get();
return ExcelFacade::download(new CapacidadesExport($capacidades), 'capacidades.xlsx');
}
public function exportPDF()
{
$capacidades = Capacidad::where('eliminado', 1)->get();
$pdf = PDF::loadView('exports.capacidades-pdf', ['capacidades' => $capacidades]);
return $pdf->download('capacidades.pdf');
}
}

10
app/Http/Controllers/MarcaController.php

@ -46,6 +46,11 @@ class MarcaController extends Controller
*/
public function store(Request $request)
{
// Validación de datos
$request->validate([
'marca' => 'required|string|max:255|unique:marcas,marca', // Asegúrate de que 'marca' sea único
]);
// Crea una nueva marca
$marca = new Marca();
$marca->marca = $request->marca; // Asigna el nombre ingresado por el usuario
@ -59,7 +64,9 @@ class MarcaController extends Controller
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$marca = Marca::findOrFail($id); // Busca la marca por ID
return view('marcasCrearEditar', ['marca' => $marca]); // Pasa la marca a la vista
}
@ -69,6 +76,9 @@ class MarcaController extends Controller
*/
public function update(Request $request, $id)
{
$request->validate([
'marca' => 'required|string|max:255|unique:marcas,marca', // Asegúrate de que 'marca' sea único
]);
$marca = Marca::findOrFail($id); // Encuentra la marca por ID
$marca->marca = $request->marca; // Actualiza el nombre de la marca
$marca->eliminado = 0; // Cambia el estado a activo si se está editando

106
app/Http/Controllers/PrestamoController.php

@ -21,18 +21,15 @@ class PrestamoController extends Controller
// Busca en la columna 'nombre_solicitante' de la tabla 'prestamos'
$prestamos = Prestamo::where('nombre_solicitante', 'LIKE', "%{$busqueda}%")
->where('eliminado', 0)
->where('estado', 'pendiente')
->get();
if ($prestamos->isEmpty()) {
return redirect()->route('prestamos.index')
return redirect()->route('prestamo.index')
->with('error', 'No existe ningún préstamo con el solicitante "' . $busqueda . '". Por favor, inténtalo de nuevo.');
}
} else {
// Si no hay búsqueda, mostrar todos los préstamos pendientes
$prestamos = Prestamo::where('eliminado', 0)
->where('estado', 'pendiente')
->get();
// Si no hay búsqueda, mostrar todos los préstamos
$prestamos = Prestamo::where('eliminado', 0)->get();
}
return view('prestamos', ['prestamos' => $prestamos]);
@ -61,6 +58,7 @@ class PrestamoController extends Controller
'domicilio' => 'required|string|max:255',
'numero_personas' => 'required|integer',
]);
// Crea un nuevo préstamo
$prestamo = new Prestamo();
$prestamo->nombre_solicitante = $request->nombre_solicitante;
@ -76,6 +74,7 @@ class PrestamoController extends Controller
return redirect()->route('prestamos.index')->with('success', 'Préstamo creado exitosamente.');
}
/**
* Show the form for editing the specified resource.
*/
@ -89,32 +88,32 @@ class PrestamoController extends Controller
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
// Validación de datos
$request->validate([
'nombre_solicitante' => 'required|string|max:255',
'destino' => 'required|string|max:255',
'fecha_hora_salida' => 'required|date',
'fecha_hora_llegada' => 'required|date',
'motivo' => 'required|string|max:255',
'domicilio' => 'required|string|max:255',
'numero_personas' => 'required|integer',
]);
$prestamo = Prestamo::findOrFail($id); // Encuentra el préstamo por ID
$prestamo->nombre_solicitante = $request->nombre_solicitante; // Actualiza el nombre del solicitante
$prestamo->destino = $request->destino; // Actualiza el destino
$prestamo->fecha_hora_salida = $request->fecha_hora_salida; // Actualiza la fecha y hora de salida
$prestamo->fecha_hora_llegada = $request->fecha_hora_llegada; // Actualiza la fecha y hora de llegada
$prestamo->motivo = $request->motivo; // Actualiza el motivo
$prestamo->domicilio = $request->domicilio; // Actualiza el domicilio
$prestamo->numero_personas = $request->numero_personas; // Actualiza el número de personas
$prestamo->chofer = $request->has('chofer') ? 1 : 0; // Manejo del checkbox
$prestamo->eliminado = 0; // Cambia el estado a activo si se está editando
$prestamo->save(); // Guarda los cambios
return redirect()->route('prestamos.index')->with('success', 'Préstamo actualizado correctamente.');
}
{
// Validación de datos
$request->validate([
'nombre_solicitante' => 'required|string|max:255',
'destino' => 'required|string|max:255',
'fecha_hora_salida' => 'required|date',
'fecha_hora_llegada' => 'required|date',
'motivo' => 'required|string|max:255',
'domicilio' => 'required|string|max:255',
'numero_personas' => 'required|integer',
]);
$prestamo = Prestamo::findOrFail($id); // Encuentra el préstamo por ID
$prestamo->nombre_solicitante = $request->nombre_solicitante; // Actualiza el nombre del solicitante
$prestamo->destino = $request->destino; // Actualiza el destino
$prestamo->fecha_hora_salida = $request->fecha_hora_salida; // Actualiza la fecha y hora de salida
$prestamo->fecha_hora_llegada = $request->fecha_hora_llegada; // Actualiza la fecha y hora de llegada
$prestamo->motivo = $request->motivo; // Actualiza el motivo
$prestamo->domicilio = $request->domicilio; // Actualiza el domicilio
$prestamo->numero_personas = $request->numero_personas; // Actualiza el número de personas
$prestamo->chofer = $request->has('chofer') ? 1 : 0; // Manejo del checkbox
$prestamo->eliminado = 0; // Cambia el estado a activo si se está editando
$prestamo->save(); // Guarda los cambios
return redirect()->route('prestamos.index')->with('success', 'Préstamo actualizado correctamente.');
}
/**
* Remove the specified resource from storage.
@ -145,47 +144,4 @@ class PrestamoController extends Controller
$pdf = PDF::loadView('exports.prestamos-pdf', ['prestamos' => $prestamos]);
return $pdf->download('prestamos.pdf');
}
public function aceptados(Request $request)
{
$busqueda = $request->busqueda;
if ($busqueda) {
$prestamos = Prestamo::where('nombre_solicitante', 'LIKE', "%{$busqueda}%")
->where('eliminado', 0)
->where('estado', 'aceptado')
->get();
if ($prestamos->isEmpty()) {
return redirect()->route('prestamos.aceptados')
->with('error', 'No existe ningún préstamo aceptado con el solicitante "' . $busqueda . '". Por favor, inténtalo de nuevo.');
}
} else {
$prestamos = Prestamo::where('eliminado', 0)
->where('estado', 'aceptado')
->get();
}
return view('prestamos.aceptados', ['prestamos' => $prestamos]);
}
public function aceptar($id)
{
$prestamo = Prestamo::findOrFail($id);
$prestamo->estado = 'aceptado';
$prestamo->save();
return redirect()->route('prestamos.index')
->with('success', 'Préstamo aceptado exitosamente.');
}
public function rechazar($id)
{
$prestamo = Prestamo::findOrFail($id);
$prestamo->estado = 'rechazado';
$prestamo->save();
return redirect()->route('prestamos.index')
->with('success', 'Préstamo rechazado exitosamente.');
}
}

3
composer.json

@ -12,8 +12,7 @@
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.6",
"maatwebsite/excel": "3.1.48",
"psr/simple-cache": "2.0"
"maatwebsite/excel": "^3.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",

442
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6b2a345146d28f6cd5eacc49b8104410",
"content-hash": "fe2612b7b0bc8d9bd48499fcb0b1cc71",
"packages": [
{
"name": "barryvdh/laravel-dompdf",
@ -212,6 +212,166 @@
],
"time": "2023-12-11T17:09:12+00:00"
},
{
"name": "composer/pcre",
"version": "3.3.2",
"source": {
"type": "git",
"url": "https://github.com/composer/pcre.git",
"reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e",
"reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<1.11.10"
},
"require-dev": {
"phpstan/phpstan": "^1.12 || ^2",
"phpstan/phpstan-strict-rules": "^1 || ^2",
"phpunit/phpunit": "^8 || ^9"
},
"type": "library",
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
},
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Pcre\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "PCRE wrapping library that offers type-safe preg_* replacements.",
"keywords": [
"PCRE",
"preg",
"regex",
"regular expression"
],
"support": {
"issues": "https://github.com/composer/pcre/issues",
"source": "https://github.com/composer/pcre/tree/3.3.2"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2024-11-12T16:29:46+00:00"
},
{
"name": "composer/semver",
"version": "3.4.3",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12",
"reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.11",
"symfony/phpunit-bridge": "^3 || ^7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Semver\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nils Adermann",
"email": "naderman@naderman.de",
"homepage": "http://www.naderman.de"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
},
{
"name": "Rob Bast",
"email": "rob.bast@gmail.com",
"homepage": "http://robbast.nl"
}
],
"description": "Semver library that offers utilities, version constraint parsing and validation.",
"keywords": [
"semantic",
"semver",
"validation",
"versioning"
],
"support": {
"irc": "ircs://irc.libera.chat:6697/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.4.3"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2024-09-19T14:15:21+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.3",
@ -742,6 +902,67 @@
],
"time": "2025-03-06T22:45:56+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.18.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "cb56001e54359df7ae76dc522d08845dc741621b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/cb56001e54359df7ae76dc522d08845dc741621b",
"reference": "cb56001e54359df7ae76dc522d08845dc741621b",
"shasum": ""
},
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-tidy": "Used for pretty-printing HTML"
},
"type": "library",
"autoload": {
"files": [
"library/HTMLPurifier.composer.php"
],
"psr-0": {
"HTMLPurifier": "library/"
},
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.18.0"
},
"time": "2024-11-01T03:51:45+00:00"
},
{
"name": "fruitcake/php-cors",
"version": "v1.3.0",
@ -877,16 +1098,16 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "7.9.3",
"version": "7.9.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
"reference": "d281ed313b989f213357e3be1a179f02196ac99b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
"reference": "d281ed313b989f213357e3be1a179f02196ac99b",
"shasum": ""
},
"require": {
@ -983,7 +1204,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.9.3"
"source": "https://github.com/guzzle/guzzle/tree/7.9.2"
},
"funding": [
{
@ -999,20 +1220,20 @@
"type": "tidelift"
}
],
"time": "2025-03-27T13:37:11+00:00"
"time": "2024-07-24T11:22:20+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "2.2.0",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c"
"reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
"url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"shasum": ""
},
"require": {
@ -1066,7 +1287,7 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.2.0"
"source": "https://github.com/guzzle/promises/tree/2.0.4"
},
"funding": [
{
@ -1082,20 +1303,20 @@
"type": "tidelift"
}
],
"time": "2025-03-27T13:27:01+00:00"
"time": "2024-10-17T10:06:22+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "2.7.1",
"version": "2.7.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16"
"reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"shasum": ""
},
"require": {
@ -1182,7 +1403,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.7.1"
"source": "https://github.com/guzzle/psr7/tree/2.7.0"
},
"funding": [
{
@ -1198,7 +1419,7 @@
"type": "tidelift"
}
],
"time": "2025-03-27T12:30:47+00:00"
"time": "2024-07-18T11:15:46+00:00"
},
{
"name": "guzzlehttp/uri-template",
@ -2186,51 +2407,58 @@
},
{
"name": "maatwebsite/excel",
"version": "3.1.48",
"version": "3.1.64",
"source": {
"type": "git",
"url": "https://github.com/SpartnerNL/Laravel-Excel.git",
"reference": "6d0fe2a1d195960c7af7bf0de760582da02a34b9"
"reference": "e25d44a2d91da9179cd2d7fec952313548597a79"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/6d0fe2a1d195960c7af7bf0de760582da02a34b9",
"reference": "6d0fe2a1d195960c7af7bf0de760582da02a34b9",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/e25d44a2d91da9179cd2d7fec952313548597a79",
"reference": "e25d44a2d91da9179cd2d7fec952313548597a79",
"shasum": ""
},
"require": {
"composer/semver": "^3.3",
"ext-json": "*",
"illuminate/support": "5.8.*|^6.0|^7.0|^8.0|^9.0|^10.0",
"php": "^7.0|^8.0",
"phpoffice/phpspreadsheet": "^1.18",
"psr/simple-cache": "^1.0|^2.0|^3.0"
"illuminate/support": "5.8.*||^6.0||^7.0||^8.0||^9.0||^10.0||^11.0||^12.0",
"php": "^7.0||^8.0",
"phpoffice/phpspreadsheet": "^1.29.9",
"psr/simple-cache": "^1.0||^2.0||^3.0"
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0|^8.0",
"laravel/scout": "^7.0||^8.0||^9.0||^10.0",
"orchestra/testbench": "^6.0||^7.0||^8.0||^9.0||^10.0",
"predis/predis": "^1.1"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Excel": "Maatwebsite\\Excel\\Facades\\Excel"
},
"providers": [
"Maatwebsite\\Excel\\ExcelServiceProvider"
]
}
},
"autoload": {
"psr-0": {
"psr-4": {
"Maatwebsite\\Excel\\": "src/"
},
"classmap": [
"src/Maatwebsite/Excel",
"tests/TestCase.php"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
"MIT"
],
"authors": [
{
"name": "Maatwebsite.nl",
"email": "patrick@maatwebsite.nl"
"name": "Patrick Brouwers",
"email": "patrick@spartner.nl"
}
],
"description": "An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel",
"description": "Supercharged Excel exports and imports in Laravel",
"keywords": [
"PHPExcel",
"batch",
@ -2238,11 +2466,13 @@
"excel",
"export",
"import",
"laravel"
"laravel",
"php",
"phpspreadsheet"
],
"support": {
"issues": "https://github.com/SpartnerNL/Laravel-Excel/issues",
"source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.48"
"source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.64"
},
"funding": [
{
@ -2254,7 +2484,7 @@
"type": "github"
}
],
"time": "2023-02-22T21:01:38+00:00"
"time": "2025-02-24T11:12:50+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -3010,66 +3240,110 @@
"time": "2024-11-21T10:36:35+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.1",
"name": "phpoffice/phpspreadsheet",
"version": "1.29.10",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32"
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "c80041b1628c4f18030407134fe88303661d4e4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c80041b1628c4f18030407134fe88303661d4e4e",
"reference": "c80041b1628c4f18030407134fe88303661d4e4e",
"shasum": ""
},
"require": {
"composer/pcre": "^1||^2||^3",
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"php": ">=5.2.0"
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker"
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "http://blog.rootslabs.net"
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "http://phpexcel.codeplex.com",
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PHPExcel/issues",
"source": "https://github.com/PHPOffice/PHPExcel/tree/master"
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.10"
},
"abandoned": "phpoffice/phpspreadsheet",
"time": "2015-05-01T07:00:55+00:00"
"time": "2025-02-08T02:56:14+00:00"
},
{
"name": "phpoption/phpoption",
@ -3916,16 +4190,16 @@
},
{
"name": "symfony/console",
"version": "v6.4.20",
"version": "v6.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "2e4af9c952617cc3f9559ff706aee420a8464c36"
"reference": "799445db3f15768ecc382ac5699e6da0520a0a04"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/2e4af9c952617cc3f9559ff706aee420a8464c36",
"reference": "2e4af9c952617cc3f9559ff706aee420a8464c36",
"url": "https://api.github.com/repos/symfony/console/zipball/799445db3f15768ecc382ac5699e6da0520a0a04",
"reference": "799445db3f15768ecc382ac5699e6da0520a0a04",
"shasum": ""
},
"require": {
@ -3990,7 +4264,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v6.4.20"
"source": "https://github.com/symfony/console/tree/v6.4.17"
},
"funding": [
{
@ -4006,7 +4280,7 @@
"type": "tidelift"
}
],
"time": "2025-03-03T17:16:38+00:00"
"time": "2024-12-07T12:07:30+00:00"
},
{
"name": "symfony/css-selector",
@ -4142,16 +4416,16 @@
},
{
"name": "symfony/error-handler",
"version": "v6.4.20",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
"reference": "aa3bcf4f7674719df078e61cc8062e5b7f752031"
"reference": "3d4e55cd2b8f1979a65eba9ab749d6466c316f71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/aa3bcf4f7674719df078e61cc8062e5b7f752031",
"reference": "aa3bcf4f7674719df078e61cc8062e5b7f752031",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/3d4e55cd2b8f1979a65eba9ab749d6466c316f71",
"reference": "3d4e55cd2b8f1979a65eba9ab749d6466c316f71",
"shasum": ""
},
"require": {
@ -4197,7 +4471,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/error-handler/tree/v6.4.20"
"source": "https://github.com/symfony/error-handler/tree/v6.4.19"
},
"funding": [
{
@ -4213,7 +4487,7 @@
"type": "tidelift"
}
],
"time": "2025-03-01T13:00:38+00:00"
"time": "2025-02-02T20:16:33+00:00"
},
{
"name": "symfony/event-dispatcher",
@ -4514,16 +4788,16 @@
},
{
"name": "symfony/http-kernel",
"version": "v6.4.20",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "6be6db31bc74693ce5516e1fd5e5ff1171005e37"
"reference": "88f2c9f7feff86bb7b9105c5151bc2c1404cd64c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/6be6db31bc74693ce5516e1fd5e5ff1171005e37",
"reference": "6be6db31bc74693ce5516e1fd5e5ff1171005e37",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/88f2c9f7feff86bb7b9105c5151bc2c1404cd64c",
"reference": "88f2c9f7feff86bb7b9105c5151bc2c1404cd64c",
"shasum": ""
},
"require": {
@ -4608,7 +4882,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/v6.4.20"
"source": "https://github.com/symfony/http-kernel/tree/v6.4.19"
},
"funding": [
{
@ -4624,7 +4898,7 @@
"type": "tidelift"
}
],
"time": "2025-03-28T13:27:10+00:00"
"time": "2025-02-26T10:51:37+00:00"
},
{
"name": "symfony/mailer",
@ -5429,16 +5703,16 @@
},
{
"name": "symfony/process",
"version": "v6.4.20",
"version": "v6.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "e2a61c16af36c9a07e5c9906498b73e091949a20"
"reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/e2a61c16af36c9a07e5c9906498b73e091949a20",
"reference": "e2a61c16af36c9a07e5c9906498b73e091949a20",
"url": "https://api.github.com/repos/symfony/process/zipball/7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3",
"reference": "7a1c12e87b08ec9c97abdd188c9b3f5a40e37fc3",
"shasum": ""
},
"require": {
@ -5470,7 +5744,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.4.20"
"source": "https://github.com/symfony/process/tree/v6.4.19"
},
"funding": [
{
@ -5486,7 +5760,7 @@
"type": "tidelift"
}
],
"time": "2025-03-10T17:11:00+00:00"
"time": "2025-02-04T13:35:48+00:00"
},
{
"name": "symfony/routing",

333
config/excel.php

@ -1,333 +0,0 @@
<?php
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

17
resources/views/capacidades.blade.php

@ -17,17 +17,10 @@
<div class="bg-white rounded-lg shadow-lg">
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
<h2 class="text-2xl font-bold">Gestión de Capacidades</h2>
<div class="flex items-center gap-4">
<a href="{{ route('capacidades.excel') }}" class="text-green-600 hover:text-green-800 text-2xl">
<i class="fas fa-file-excel"></i>
</a>
<a href="{{ route('capacidades.pdf') }}" class="text-red-600 hover:text-red-800 text-2xl">
<i class="fas fa-file-pdf"></i>
</a>
<a href="{{ route('capacidades.create') }}" class="text-blue-600 hover:text-blue-800 text-2xl">
<i class="fas fa-plus"></i>
</a>
</div>
<a href="{{ route('capacidades.create') }}"
class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 flex items-center gap-2">
<i class="fas fa-plus"></i>
</a>
</div>
<div class="overflow-x-auto">
@ -56,7 +49,7 @@
onsubmit="return false;">
@csrf
@method('DELETE')
<button type="button"
onclick="confirmarEliminacion(this)"
class="text-red-600 hover:text-red-900">

41
resources/views/exports/capacidades-pdf.blade.php

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Capacidades</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>Lista de Capacidades</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Cantidad</th>
<th>Fecha de Creación</th>
</tr>
</thead>
<tbody>
@foreach($capacidades as $capacidad)
<tr>
<td>{{ $capacidad->id }}</td>
<td>{{ $capacidad->cantidad }}</td>
<td>{{ $capacidad->created_at->format('d/m/Y') }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

79
resources/views/prestamos.blade.php

@ -15,34 +15,44 @@
</div>
@endif
@if($errors->any())
<div class="mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded-r-lg">
<div class="flex items-center">
<div class="text-red-700">
<ul>
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<div class="bg-white rounded-lg shadow-lg">
<!-- Encabezado con título y botones de acción -->
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
<h2 class="text-2xl font-bold">Gestión de Préstamos</h2>
<div class="flex items-center space-x-6">
<!-- Exportar a Excel -->
<a href="{{ route('prestamos.excel') }}"
class="text-green-600 hover:text-green-700 transition-colors duration-200"
title="Exportar a Excel">
<i class="fas fa-file-excel text-xl"></i>
</a>
<!-- Íconos de exportación -->
<div class="flex space-x-4">
<!-- Exportar a Excel -->
<a href="{{ route('prestamos.excel') }}"
class="text-green-600 hover:text-green-700 transition-colors duration-200"
title="Exportar a Excel">
<i class="fas fa-file-excel text-xl"></i>
</a>
<!-- Exportar a PDF -->
<a href="{{ route('prestamos.pdf') }}"
class="text-red-600 hover:text-red-700 transition-colors duration-200"
title="Exportar a PDF">
<i class="fas fa-file-pdf text-xl"></i>
</a>
<!-- Agregar nuevo préstamo -->
<a href="{{ route('prestamos.create') }}"
class="text-blue-500 hover:text-blue-600 transition-colors duration-200"
title="Agregar nuevo préstamo">
<i class="fas fa-plus text-xl"></i>
</a>
</div>
<!-- Exportar a PDF -->
<a href="{{ route('prestamos.pdf') }}"
class="text-red-600 hover:text-red-700 transition-colors duration-200"
title="Exportar a PDF">
<i class="fas fa-file-pdf text-xl"></i>
</a>
<!-- Agregar nuevo préstamo -->
<a href="{{ route('prestamos.create') }}"
class="text-blue-500 hover:text-blue-600 transition-colors duration-200"
title="Agregar nuevo préstamo">
<i class="fas fa-plus text-xl"></i>
</a>
</div>
</div>
@ -151,28 +161,16 @@
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<div class="flex space-x-2">
<a href="{{ route('prestamos.edit', $prestamo->id) }}" class="text-blue-600 hover:text-blue-900">
<a href="{{ route('prestamos.edit', $prestamo->id) }}" class="text-yellow-600 hover:text-blue-900">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('prestamos.destroy', $prestamo->id) }}" method="POST" class="inline">
<form action="{{ route('prestamos.destroy', $prestamo->id) }}" method="POST" class="inline" onsubmit="return confirmarEliminacion(this);">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900" onclick="return confirm('¿Estás seguro de que deseas eliminar este préstamo?')">
<button type="submit" class="text-red-600 hover:text-red-900">
<i class="fas fa-trash"></i>
</button>
</form>
<form action="{{ route('prestamos.aceptar', $prestamo->id) }}" method="POST" class="inline">
@csrf
<button type="submit" class="text-green-600 hover:text-green-900" onclick="return confirm('¿Estás seguro de que deseas aceptar este préstamo?')">
<i class="fas fa-check"></i>
</button>
</form>
<form action="{{ route('prestamos.rechazar', $prestamo->id) }}" method="POST" class="inline">
@csrf
<button type="submit" class="text-yellow-600 hover:text-yellow-900" onclick="return confirm('¿Estás seguro de que deseas rechazar este préstamo?')">
<i class="fas fa-times"></i>
</button>
</form>
</div>
</td>
</tr>
@ -196,8 +194,8 @@
}
}, 3000);
function confirmarEliminacion(button) {
Swal.fire({
function confirmarEliminacion(form) {
return Swal.fire({
title: '¿Estás seguro?',
text: "Esta acción no se puede deshacer",
icon: 'warning',
@ -208,8 +206,9 @@
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
button.closest('form').submit();
form.submit();
}
return false; // Evitar el envío del formulario por defecto
});
}
</script>

2
routes/web.php

@ -43,8 +43,6 @@ use App\Http\Controllers\PrestamoController;
Route::resource('tiposLicencias', TiposLicenciasController::class);
Route::resource('capacidades', CapacidadController::class);
Route::get('capacidades/excel', [CapacidadController::class, 'exportExcel'])->name('capacidades.excel');
Route::get('capacidades/pdf', [CapacidadController::class, 'exportPDF'])->name('capacidades.pdf');
Route::get('/marcas/excel', [MarcaController::class, 'exportExcel'])->name('marcas.excel');

Loading…
Cancel
Save