sergiomarquez778 5 days ago
parent
commit
93d20a608b
  1. 30
      app/Exports/CapacidadesExport.php
  2. 22
      app/Exports/tiposLicenciasExport.php
  3. 20
      app/Http/Controllers/CapacidadController.php
  4. 52
      app/Http/Controllers/PrestamoController.php
  5. 17
      app/Http/Controllers/TiposLicenciasController.php
  6. 3
      composer.json
  7. 442
      composer.lock
  8. 333
      config/excel.php
  9. 28
      database/migrations/2025_03_28_175646_add_estado_to_prestamos_table.php
  10. 28
      database/migrations/2025_03_28_182126_add_estado_to_prestamos_table.php
  11. 28
      database/migrations/2025_03_28_183038_add_estado_to_prestamos_table.php
  12. 17
      resources/views/capacidades.blade.php
  13. 41
      resources/views/exports/capacidades-pdf.blade.php
  14. 41
      resources/views/exports/tiposLicencias-pdf.blade.php
  15. 6
      resources/views/layouts/navigation.blade.php
  16. 79
      resources/views/prestamos.blade.php
  17. 163
      resources/views/prestamos/aceptados.blade.php
  18. 2
      resources/views/tiposLicencia.blade.php
  19. 17
      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');
}
}

52
app/Http/Controllers/PrestamoController.php

@ -21,15 +21,18 @@ 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('prestamo.index')
return redirect()->route('prestamos.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
$prestamos = Prestamo::where('eliminado', 0)->get();
// Si no hay búsqueda, mostrar todos los préstamos pendientes
$prestamos = Prestamo::where('eliminado', 0)
->where('estado', 'pendiente')
->get();
}
return view('prestamos', ['prestamos' => $prestamos]);
@ -144,4 +147,47 @@ 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.');
}
}

17
app/Http/Controllers/TiposLicenciasController.php

@ -6,7 +6,8 @@ use App\Models\tiposLicencias;
use App\Exports\TiposLicenciasExport;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use PDF;
use Barryvdh\DomPDF\Facade\Pdf;
class TiposLicenciasController extends Controller
{
/**
@ -36,6 +37,14 @@ class TiposLicenciasController extends Controller
return view('tiposLicencia', ["tiposLicencias" => $tiposLicencias]);
}
/**
* Display the specified resource.
*/
public function show(tiposLicencias $tiposLicencias)
{
return view('tiposLicencia', ['tiposLicencias' => [$tiposLicencias]]);
}
/**
* Show the form for creating a new resource.
*/
@ -110,8 +119,8 @@ class TiposLicenciasController extends Controller
public function exportPDF()
{
$tiposLicencias = TiposLicencias::where('eliminado', 0)->get();
$tiposLicencias = TiposLicencias::where('eliminado', 1)->get();
$pdf = PDF::loadView('exports.tiposlicencias-pdf', ['tiposLicencias' => $tiposLicencias]);
return $pdf->download('tiposLicencias.pdf');
return $pdf->download('tipos_licencias.pdf');
}
}
}

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,
],
];

28
database/migrations/2025_03_28_175646_add_estado_to_prestamos_table.php

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('prestamos', function (Blueprint $table) {
//
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('prestamos', function (Blueprint $table) {
//
});
}
};

28
database/migrations/2025_03_28_182126_add_estado_to_prestamos_table.php

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('prestamos', function (Blueprint $table) {
//
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('prestamos', function (Blueprint $table) {
//
});
}
};

28
database/migrations/2025_03_28_183038_add_estado_to_prestamos_table.php

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('prestamos', function (Blueprint $table) {
$table->string('estado')->default('pendiente'); // pendiente, aceptado, rechazado
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('prestamos', function (Blueprint $table) {
$table->dropColumn('estado');
});
}
};

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>

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

@ -1,12 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Lista de tiposLicencias</title>
<title>Tipos de Licencias</title>
<style>
body {
font-family: Arial, sans-serif;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
@ -16,29 +19,45 @@
th {
background-color: #f2f2f2;
}
h2 {
color: #333;
margin-bottom: 20px;
.header {
text-align: center;
margin-bottom: 30px;
}
.status-active {
color: green;
}
.status-inactive {
color: red;
}
</style>
</head>
<body>
<h2>Lista de tiposLicencias</h2>
<div class="header">
<h1>Reporte de Tipos de Licencias</h1>
<p>Fecha de generación: {{ date('d/m/Y H:i:s') }}</p>
</div>
<table>
<thead>
<tr>
<th>ID</th>
<th>tipoLicencias</th>
<th>Tipo de Licencia</th>
<th>Estado</th>
<th>Fecha de Creación</th>
</tr>
</thead>
<tbody>
@foreach($tiposlicencias as $tiposlicencias)
@foreach($tiposLicencias as $licencia)
<tr>
<td>{{ $tiposlicencias->id }}</td>
<td>{{ $tiposlicencias->tiposlicencias }}</td>
<td>{{ $licencia->id }}</td>
<td>{{ $licencia->tipoLicencia }}</td>
<td class="{{ $licencia->eliminado == 1 ? 'status-active' : 'status-inactive' }}">
{{ $licencia->eliminado == 1 ? 'Activo' : 'Inactivo' }}
</td>
<td>{{ $licencia->created_at->format('d/m/Y') }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>
</html>

6
resources/views/layouts/navigation.blade.php

@ -0,0 +1,6 @@
<x-nav-link :href="route('prestamos.index')" :active="request()->routeIs('prestamos.index')">
{{ __('Préstamos') }}
</x-nav-link>
<x-nav-link :href="route('prestamos.aceptados')" :active="request()->routeIs('prestamos.aceptados')">
{{ __('Préstamos Aceptados') }}
</x-nav-link>

79
resources/views/prestamos.blade.php

@ -15,44 +15,34 @@
</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>
<!-- 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>
<!-- Í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>
</div>
</div>
@ -161,16 +151,28 @@
</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-yellow-600 hover:text-blue-900">
<a href="{{ route('prestamos.edit', $prestamo->id) }}" class="text-blue-600 hover:text-blue-900">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('prestamos.destroy', $prestamo->id) }}" method="POST" class="inline" onsubmit="return confirmarEliminacion(this);">
<form action="{{ route('prestamos.destroy', $prestamo->id) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-900">
<button type="submit" class="text-red-600 hover:text-red-900" onclick="return confirm('¿Estás seguro de que deseas eliminar este préstamo?')">
<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>
@ -194,8 +196,8 @@
}
}, 3000);
function confirmarEliminacion(form) {
return Swal.fire({
function confirmarEliminacion(button) {
Swal.fire({
title: '¿Estás seguro?',
text: "Esta acción no se puede deshacer",
icon: 'warning',
@ -206,9 +208,8 @@
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
form.submit();
button.closest('form').submit();
}
return false; // Evitar el envío del formulario por defecto
});
}
</script>

163
resources/views/prestamos/aceptados.blade.php

@ -0,0 +1,163 @@
@extends('layouts.dashboard')
@section('content')
<div class="container mx-auto px-4 py-6">
<!-- Mensajes de éxito y error -->
@if(session('success'))
<div id="success-message" class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline">{{ session('success') }}</span>
</div>
@endif
@if(session('error'))
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline">{{ session('error') }}</span>
</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">Préstamos Aceptados</h2>
<div class="flex items-center space-x-6">
<!-- Íconos de exportación -->
<div class="flex space-x-4">
<!-- Exportar a Excel -->
<a href="{{ route('prestamos.excel') }}?estado=aceptado" class="text-green-600 hover:text-green-800 text-2xl">
<i class="fas fa-file-excel"></i>
</a>
<!-- Exportar a PDF -->
<a href="{{ route('prestamos.pdf') }}?estado=aceptado" class="text-red-600 hover:text-red-800 text-2xl">
<i class="fas fa-file-pdf"></i>
</a>
</div>
</div>
</div>
<!-- Barra de búsqueda -->
<div class="p-4 border-b border-gray-200 bg-gray-50">
<form action="{{ route('prestamos.aceptados') }}" method="GET" class="flex gap-2">
<div class="relative w-full sm:w-64">
<input type="text"
name="busqueda"
placeholder="Buscar préstamo..."
value="{{ request('busqueda') }}"
class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<div class="absolute left-3 top-2.5 text-gray-400">
<i class="fas fa-search"></i>
</div>
</div>
<button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
Buscar
</button>
@if(request('busqueda'))
<a href="{{ route('prestamos.aceptados') }}" class="px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-gray-600">
Limpiar
</a>
@endif
</form>
</div>
<!-- Tabla de préstamos -->
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Número</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nombre Solicitante</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Destino</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Fecha y Hora Salida</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Fecha y Hora Llegada</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Motivo</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Domicilio</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Número de Personas</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Chofer</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acciones</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($prestamos as $index => $prestamo)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="font-medium">{{ $index + 1 }}</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-user text-blue-500 mr-2"></i>
{{ $prestamo->nombre_solicitante }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-map-marker-alt text-red-500 mr-2"></i>
{{ $prestamo->destino }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-clock text-green-500 mr-2"></i>
{{ \Carbon\Carbon::parse($prestamo->fecha_hora_salida)->format('d/m/Y H:i') }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-clock text-red-500 mr-2"></i>
{{ \Carbon\Carbon::parse($prestamo->fecha_hora_llegada)->format('d/m/Y H:i') }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-info-circle text-blue-500 mr-2"></i>
{{ $prestamo->motivo }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-home text-purple-500 mr-2"></i>
{{ $prestamo->domicilio }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-users text-yellow-500 mr-2"></i>
{{ $prestamo->numero_personas }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-id-card text-gray-500 mr-2"></i>
{{ $prestamo->chofer ? 'Sí' : 'No' }}
</div>
</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">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('prestamos.destroy', $prestamo->id) }}" method="POST" class="inline">
@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?')">
<i class="fas fa-trash"></i>
</button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
// Ocultar el mensaje de éxito después de 3 segundos
setTimeout(function() {
const successMessage = document.getElementById('success-message');
if (successMessage) {
successMessage.style.display = 'none';
}
}, 3000);
</script>
@endsection

2
resources/views/tiposLicencia.blade.php

@ -103,7 +103,7 @@
<td class="px-6 py-4 whitespace-nowrap text-sm">
<div class="flex gap-2">
@if($tipoLicencia->eliminado == 0)
<a href="{{ route('tiposLicencias.toggle-status', $tipoLicencia->id) }}"
<a href="{{ route('tiposLicencias.toggle-status', ['id' => $tipoLicencia->id]) }}"
class="text-green-600 hover:text-green-700 transition-colors duration-200"
title="Recuperar tipo de licencia">
<i class="fas fa-undo"></i>

17
routes/web.php

@ -36,19 +36,13 @@ use App\Http\Controllers\PrestamoController;
Route::get('/vehiculos/{id}/toggle-status', [TiposVeiculosController::class, 'toggleStatus'])->name('vehiculos.toggle-status');
Route::resource('vehiculos', TiposVeiculosController::class);
Route::resource('tiposLicencias', TiposLicenciasController::class);
// Rutas específicas de tipos de licencias
Route::get('tiposLicencias/excel', [TiposLicenciasController::class, 'exportExcel'])->name('tiposLicencias.excel');
Route::get('tiposLicencias/pdf', [TiposLicenciasController::class, 'exportPDF'])->name('tiposLicencias.pdf');
Route::get('/tiposLicencias/{id}/toggle-status', [TiposLicenciasController::class, 'toggleStatus'])->name('tiposLicencias.toggle-status');
Route::get('tiposLicencias/{id}/toggle-status', [TiposLicenciasController::class, 'toggleStatus'])->name('tiposLicencias.toggle-status');
Route::resource('tiposLicencias', TiposLicenciasController::class);
Route::get('/tiposLicencias/{id}/toggle-status', [TiposLicenciasController::class, 'toggleStatus'])->name('tiposLicencias.toggle-status');
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');
@ -57,6 +51,9 @@ use App\Http\Controllers\PrestamoController;
// Primero las rutas de exportación (más específicas)
Route::get('/prestamos/excel', [PrestamoController::class, 'exportExcel'])->name('prestamos.excel');
Route::get('/prestamos/pdf', [PrestamoController::class, 'exportPDF'])->name('prestamos.pdf');
Route::get('/prestamos/aceptados', [PrestamoController::class, 'aceptados'])->name('prestamos.aceptados');
Route::post('/prestamos/{id}/aceptar', [PrestamoController::class, 'aceptar'])->name('prestamos.aceptar');
Route::post('/prestamos/{id}/rechazar', [PrestamoController::class, 'rechazar'])->name('prestamos.rechazar');
// Después la ruta de recurso (más general)
Route::resource('prestamos', PrestamoController::class);
@ -64,10 +61,6 @@ use App\Http\Controllers\PrestamoController;
Route::get('/docentes/export/{format}', [DocentesController::class, 'export'])->name('docentes.export');
Route::get('/docentes/{id}/toggle-status', [DocentesController::class, 'toggleStatus'])->name('docentes.toggle-status');
Route::get('tiposLicencias/excel', [TiposLicenciasController::class, 'exportExcel'])->name('tiposLicencias.excel');
Route::get('tiposLicencias/pdf', [TiposLicenciasController::class, 'exportPDF'])->name('tiposLicencias.pdf');
// Rutas protegidas que requieren autenticación

Loading…
Cancel
Save