Damian 5 days ago
parent
commit
5b034688a7
  1. 12
      app/Exports/MarcasExport.php
  2. 33
      app/Exports/PrestamosExport.php
  3. 16
      app/Exports/UsuariosExport.php
  4. 35
      app/Exports/tiposLicenciasExport.php
  5. 116
      app/Http/Controllers/PrestamoController.php
  6. 19
      app/Http/Controllers/TiposLicenciasController.php
  7. 56
      app/Http/Controllers/TiposVeiculosController.php
  8. 23
      app/Http/Controllers/usuariosController.php
  9. 8
      app/Models/User.php
  10. 13
      app/Models/prestamo.php
  11. 11
      app/Models/puesto.php
  12. 2
      composer.json
  13. 295
      composer.lock
  14. 3
      config/app.php
  15. 301
      config/dompdf.php
  16. 32
      database/migrations/2013_03_27_235747_create_puestos_table.php
  17. 4
      database/migrations/2014_10_12_000000_create_users_table.php
  18. 8
      database/migrations/2025_03_27_174121_create_prestamos_table.php
  19. 28
      database/migrations/2025_03_27_183714_add_columneliminado_toprestamos.php
  20. 42
      resources/views/exports/marcas-pdf.blade.php
  21. 76
      resources/views/exports/prestamos-pdf.blade.php
  22. 44
      resources/views/exports/tiposLicencias-pdf.blade.php
  23. 75
      resources/views/exports/tipos_vehiculos_pdf.blade.php
  24. 2
      resources/views/layouts/dashboard.blade.php
  25. 35
      resources/views/marcas.blade.php
  26. 206
      resources/views/prestamos.blade.php
  27. 207
      resources/views/prestamosCrearEditar.blade.php
  28. 146
      resources/views/tiposLicencia.blade.php
  29. 52
      resources/views/usuarios.blade.php
  30. 95
      resources/views/usuariosCrearEditar.blade.php
  31. 16
      resources/views/vehiculos.blade.php
  32. 36
      routes/web.php

12
app/Exports/MarcasExport.php

@ -7,7 +7,6 @@ use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class MarcasExport implements FromCollection, WithHeadings
{
/**
* Método que devuelve la colección de datos a exportar.
@ -16,9 +15,7 @@ class MarcasExport implements FromCollection, WithHeadings
*/
public function collection()
{
return Marca::where('eliminado', 0) // Solo marcas activas
->select('id', 'marca') // Selecciona los campos que deseas exportar
->get();
return Marca::where('eliminado', 0)->get();
}
/**
@ -29,8 +26,11 @@ class MarcasExport implements FromCollection, WithHeadings
public function headings(): array
{
return [
'ID', // Encabezado para la columna ID
'Marca', // Encabezado para la columna Marca
'ID',
'Marca',
'Estado',
'Fecha de Creación',
'Última Actualización'
];
}
}

33
app/Exports/PrestamosExport.php

@ -0,0 +1,33 @@
<?php
namespace App\Exports;
use App\Models\Prestamo;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class PrestamosExport implements FromCollection, WithHeadings
{
public function collection()
{
return Prestamo::where('eliminado', 0)->get();
}
public function headings(): array
{
return [
'ID',
'Nombre Solicitante',
'Destino',
'Fecha y Hora Salida',
'Fecha y Hora Llegada',
'Motivo',
'Domicilio',
'Número de Personas',
'Chofer',
'Estado',
'Fecha de Creación',
'Última Actualización'
];
}
}

16
app/Exports/UsuariosExport.php

@ -10,15 +10,23 @@ class UsuariosExport implements FromCollection, WithHeadings
{
public function collection()
{
return User::select('id', 'name', 'email')->get();
return User::select( 'name', 'email','apellido',
'puesto',
'carrera',
'telefono',)->get();
}
public function headings(): array
{
return [
'ID',
'Nombre',
'Email'
'nombre',
'correo',
'apellido',
'puesto',
'carrera',
'telefono',
'Fecha de Creación',
'Última Actualización'
];
}
}

35
app/Exports/tiposLicenciasExport.php

@ -0,0 +1,35 @@
<?php
namespace App\Exports;
use App\Models\tiposLicencias;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class TiposLicenciasExport implements FromCollection, WithHeadings
{
/**
* Método que devuelve la colección de datos a exportar.
*
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return tiposLicencias::where('eliminado', 0) // Solo marcas activas
->select('id', 'tipoLicencia') // Selecciona los campos que deseas exportar
->get();
}
/**
* Método que define los encabezados de las columnas en el archivo Excel.
*
* @return array
*/
public function headings(): array
{
return [
'ID', // Encabezado para la columna ID
'Tipo de licencia', // Encabezado para la columna Tipo de licencia
];
}
}

116
app/Http/Controllers/PrestamoController.php

@ -2,17 +2,37 @@
namespace App\Http\Controllers;
use App\Models\prestamo;
use App\Models\Prestamo; // Asegúrate de que el modelo esté correctamente nombrado
use Illuminate\Http\Request;
use App\Exports\PrestamosExport; // Asegúrate de tener esta clase de exportación
use Maatwebsite\Excel\Facades\Excel;
use PDF;
class PrestamoController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
public function index(Request $request)
{
//
$busqueda = $request->busqueda;
if ($busqueda) {
// Busca en la columna 'nombre_solicitante' de la tabla 'prestamos'
$prestamos = Prestamo::where('nombre_solicitante', 'LIKE', "%{$busqueda}%")
->where('eliminado', 0)
->get();
if ($prestamos->isEmpty()) {
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
$prestamos = Prestamo::where('eliminado', 0)->get();
}
return view('prestamos', ['prestamos' => $prestamos]);
}
/**
@ -20,7 +40,7 @@ class PrestamoController extends Controller
*/
public function create()
{
//
return view('prestamosCrearEditar', ['prestamo' => null]); // No se necesita pasar préstamos
}
/**
@ -28,38 +48,98 @@ class PrestamoController extends Controller
*/
public function store(Request $request)
{
//
}
// 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',
]);
// Crea un nuevo préstamo
$prestamo = new Prestamo();
$prestamo->nombre_solicitante = $request->nombre_solicitante;
$prestamo->destino = $request->destino;
$prestamo->fecha_hora_salida = $request->fecha_hora_salida;
$prestamo->fecha_hora_llegada = $request->fecha_hora_llegada;
$prestamo->motivo = $request->motivo;
$prestamo->domicilio = $request->domicilio;
$prestamo->numero_personas = $request->numero_personas;
$prestamo->chofer = $request->has('chofer') ? 1 : 0; // Manejo del checkbox
$prestamo->eliminado = 0; // Marca como activo por defecto
$prestamo->save();
return redirect()->route('prestamos.index')->with('success', 'Préstamo creado exitosamente.');
}
/**
* Display the specified resource.
* Show the form for editing the specified resource.
*/
public function show(prestamo $prestamo)
public function edit($id)
{
//
$prestamo = Prestamo::findOrFail($id); // Busca el préstamo por ID
return view('prestamosCrearEditar', ['prestamo' => $prestamo]); // Pasa el préstamo a la vista
}
/**
* Show the form for editing the specified resource.
* Update the specified resource in storage.
*/
public function edit(prestamo $prestamo)
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.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
$prestamo = Prestamo::findOrFail($id); // Encuentra el préstamo por ID
$prestamo->eliminado = 1; // Cambia el estado a inactivo
$prestamo->save(); // Guarda los cambios
return redirect()->route('prestamos.index')->with('success', 'Préstamo inactivado correctamente.');
}
/**
* Update the specified resource in storage.
* Export to Excel.
*/
public function update(Request $request, prestamo $prestamo)
public function exportExcel()
{
//
return Excel::download(new PrestamosExport, 'prestamos.xlsx');
}
/**
* Remove the specified resource from storage.
* Export to PDF.
*/
public function destroy(prestamo $prestamo)
public function exportPDF()
{
//
$prestamos = Prestamo::where('eliminado', 0)->get();
$pdf = PDF::loadView('exports.prestamos-pdf', ['prestamos' => $prestamos]);
return $pdf->download('prestamos.pdf');
}
}

19
app/Http/Controllers/TiposLicenciasController.php

@ -3,9 +3,10 @@
namespace App\Http\Controllers;
use App\Models\tiposLicencias;
use App\Exports\TiposLicenciasExport;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use PDF;
class TiposLicenciasController extends Controller
{
/**
@ -101,4 +102,16 @@ class TiposLicenciasController extends Controller
$tipoLicencia->save();
return redirect()->route('tiposLicencias.index')->with('success', 'Tipo de licencia eliminado exitosamente.');
}
}
public function exportExcel()
{
return Excel::download(new TiposLicenciasExport(), 'tiposLicencias.xlsx');
}
public function exportPDF()
{
$tiposLicencias = TiposLicencias::where('eliminado', 0)->get();
$pdf = PDF::loadView('exports.tiposlicencias-pdf', ['tiposLicencias' => $tiposLicencias]);
return $pdf->download('tiposLicencias.pdf');
}
}

56
app/Http/Controllers/TiposVeiculosController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\tiposVeiculos;
use Illuminate\Http\Request;
use Barryvdh\DomPDF\Facade\Pdf;
class TiposVeiculosController extends Controller
{
@ -108,4 +109,59 @@ class TiposVeiculosController extends Controller
$tiposVeiculos->save();
return redirect()->route('vehiculos.index')->with('success', 'Vehiculo eliminado exitosamente.');
}
public function exportExcel()
{
$tiposVeiculos = tiposVeiculos::all();
$headers = [
'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment; filename="tipos_vehiculos.csv"',
];
$callback = function() use ($tiposVeiculos) {
$file = fopen('php://output', 'w');
// Encabezados
fputcsv($file, ['ID', 'Nombre', 'Tipo de Combustible', 'Estado', 'Fecha de Creación']);
// Datos
foreach ($tiposVeiculos as $vehiculo) {
$estado = $vehiculo->status ? 'Activo' : 'Inactivo';
$tipoCombustible = '';
switch($vehiculo->tipo_combustible) {
case 'gasolina_verde':
$tipoCombustible = 'Gasolina Verde';
break;
case 'gasolina_roja':
$tipoCombustible = 'Gasolina Roja';
break;
case 'diesel':
$tipoCombustible = 'Diesel';
break;
default:
$tipoCombustible = 'No especificado';
}
fputcsv($file, [
$vehiculo->id,
$vehiculo->nombre,
$tipoCombustible,
$estado,
$vehiculo->created_at->format('d/m/Y')
]);
}
fclose($file);
};
return response()->stream($callback, 200, $headers);
}
public function exportPDF()
{
$tiposVeiculos = tiposVeiculos::all();
$pdf = PDF::loadView('exports.tipos_vehiculos_pdf', ['tiposVeiculos' => $tiposVeiculos]);
return $pdf->download('tipos_vehiculos.pdf');
}
}

23
app/Http/Controllers/usuariosController.php

@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use App\Exports\UsuariosExport;
use Maatwebsite\Excel\Facades\Excel;
use PDF; // Asegúrate de incluir la clase PDF
use App\Models\Puesto;
class usuariosController extends Controller
{
@ -38,7 +39,8 @@ class usuariosController extends Controller
*/
public function create()
{
return view('usuariosCrearEditar'); // Vista para crear usuario
$puestos = Puesto::all();
return view('usuariosCrearEditar', ['usuario' => null, 'puestos' => $puestos]);
}
@ -52,18 +54,18 @@ class usuariosController extends Controller
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'apellido' => 'required|string|max:255',
'puesto' => 'required|string|max:255',
'puesto_id' => 'required|exists:puestos,id',
'carrera' => 'required|string|max:255',
'telefono' => 'required|string|max:255',
'password' => 'required|string|min:8|confirmed',
]);
// Crear nuevo usuario
// Si la validación pasa, crea el usuario
$usuario = new User();
$usuario->name = $request->name;
$usuario->email = $request->email;
$usuario->apellido = $request->apellido;
$usuario->puesto = $request->puesto;
$usuario->puesto_id = $request->puesto_id;
$usuario->carrera = $request->carrera;
$usuario->telefono = $request->telefono;
$usuario->password = bcrypt($request->password);
@ -83,11 +85,14 @@ class usuariosController extends Controller
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
// ... existing code ...
public function edit($id)
{
$usuario = User::findOrFail($id);
return view('usuariosCrearEditar', compact('usuario')); // Vista para editar usuario
$user = User::findOrFail($id);
$puestos = Puesto::all();
return view('usuariosCrearEditar',['usuario' => $user, 'puestos' => $puestos]); // Asegúrate de que la clave sea 'usuario'
}
// ... existing code ...
/**
@ -100,7 +105,7 @@ class usuariosController extends Controller
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255',
'apellido' => 'required|string|max:255',
'puesto' => 'required|string|max:255',
//'puesto_id' => 'required|exists:puesto_id',
'carrera' => 'required|string|max:255',
'telefono' => 'required|string|max:255',
'password' => 'nullable|string|min:8|confirmed',
@ -111,7 +116,7 @@ class usuariosController extends Controller
$usuario->name = $request->name;
$usuario->email = $request->email;
$usuario->apellido = $request->apellido;
$usuario->puesto = $request->puesto;
$usuario->puesto_id = $request->puesto_id;
$usuario->carrera = $request->carrera;
$usuario->telefono = $request->telefono;

8
app/Models/User.php

@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Illuminate\Database\Eloquent\Relations\HasOne;
class User extends Authenticatable
{
@ -21,12 +22,13 @@ class User extends Authenticatable
'name',
'email',
'apellido',
'puesto',
'puesto_id',
'carrera',
'telefono',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
@ -45,4 +47,8 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
];
public function puesto():HasOne{
return $this->hasOne(Puesto::class, 'id','puesto_id');
}
}

13
app/Models/prestamo.php

@ -8,4 +8,17 @@ use Illuminate\Database\Eloquent\Model;
class prestamo extends Model
{
use HasFactory;
protected $table = 'prestamos';
protected $fillable = [
'nombre_solicitante',
'destino',
'fecha_hora_salida',
'fecha_hora_llegada',
'motivo',
'domicilio',
'numero_personas',
'chofer',
];
}

11
app/Models/puesto.php

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class puesto extends Model
{
use HasFactory;
}

2
composer.json

@ -12,7 +12,7 @@
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.6",
"maatwebsite/excel": "^1.1"
"maatwebsite/excel": "^3.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",

295
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": "c0f0a026d64d98ad86849a80b4a5135b",
"content-hash": "fe2612b7b0bc8d9bd48499fcb0b1cc71",
"packages": [
{
"name": "barryvdh/laravel-dompdf",
@ -291,6 +291,87 @@
],
"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",
@ -821,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",
@ -2265,48 +2407,58 @@
},
{
"name": "maatwebsite/excel",
"version": "v1.1.5",
"version": "3.1.64",
"source": {
"type": "git",
"url": "https://github.com/Maatwebsite/Laravel-Excel.git",
"reference": "0c67aba8387726458d42461eae91a3415593bbc4"
"url": "https://github.com/SpartnerNL/Laravel-Excel.git",
"reference": "e25d44a2d91da9179cd2d7fec952313548597a79"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/0c67aba8387726458d42461eae91a3415593bbc4",
"reference": "0c67aba8387726458d42461eae91a3415593bbc4",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/e25d44a2d91da9179cd2d7fec952313548597a79",
"reference": "e25d44a2d91da9179cd2d7fec952313548597a79",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"phpoffice/phpexcel": "~1.8.0"
"composer/semver": "^3.3",
"ext-json": "*",
"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": {
"mockery/mockery": "~0.9",
"orchestra/testbench": "~2.2.0@dev",
"phpunit/phpunit": "~4.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",
@ -2314,13 +2466,25 @@
"excel",
"export",
"import",
"laravel"
"laravel",
"php",
"phpspreadsheet"
],
"support": {
"issues": "https://github.com/Maatwebsite/Laravel-Excel/issues",
"source": "https://github.com/Maatwebsite/Laravel-Excel/tree/master"
"issues": "https://github.com/SpartnerNL/Laravel-Excel/issues",
"source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.64"
},
"time": "2014-07-10T09:06:07+00:00"
"funding": [
{
"url": "https://laravel-excel.com/commercial-support",
"type": "custom"
},
{
"url": "https://github.com/patrickbrouwers",
"type": "github"
}
],
"time": "2025-02-24T11:12:50+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -3075,80 +3239,18 @@
],
"time": "2024-11-21T10:36:35+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"shasum": ""
},
"require": {
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": ">=5.2.0"
},
"type": "library",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Mark Baker"
},
{
"name": "Franck Lefevre",
"homepage": "http://blog.rootslabs.net"
},
{
"name": "Erik Tilt"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "http://phpexcel.codeplex.com",
"keywords": [
"OpenXML",
"excel",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PHPExcel/issues",
"source": "https://github.com/PHPOffice/PHPExcel/tree/master"
},
"abandoned": "phpoffice/phpspreadsheet",
"time": "2015-05-01T07:00:55+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "4.1.0",
"version": "1.29.10",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "6ff18c3a8df3a945492f75ce455d77f7ad55dd5c"
"reference": "c80041b1628c4f18030407134fe88303661d4e4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/6ff18c3a8df3a945492f75ce455d77f7ad55dd5c",
"reference": "6ff18c3a8df3a945492f75ce455d77f7ad55dd5c",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c80041b1628c4f18030407134fe88303661d4e4e",
"reference": "c80041b1628c4f18030407134fe88303661d4e4e",
"shasum": ""
},
"require": {
@ -3166,24 +3268,25 @@
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^8.1",
"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": "^2.0 || ^3.0",
"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": "^10.5",
"phpunit/phpunit": "^8.5 || ^9.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
@ -3238,9 +3341,9 @@
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/4.1.0"
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.10"
},
"time": "2025-03-02T06:52:24+00:00"
"time": "2025-02-08T02:56:14+00:00"
},
{
"name": "phpoption/phpoption",

3
config/app.php

@ -195,7 +195,7 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
],
@ -212,6 +212,7 @@ return [
'aliases' => Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
'PDF' => Barryvdh\DomPDF\Facade\Pdf::class,
])->toArray(),
];

301
config/dompdf.php

@ -0,0 +1,301 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'public_path' => null, // Override the public path if needed
/*
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show € and £.
*/
'convert_entities' => true,
'options' => [
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the webserver process.
* *Please note the trailing slash.*
*
* Notes regarding fonts:
* Additional .afm font metrics can be added by executing load_font.php from command line.
*
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
* increase file size unless font subsetting is enabled. Before embedding a font please
* review your rights under the font license.
*
* Any font specification in the source HTML is translated to the closest font available
* in the font directory.
*
* The pdf standard "Base 14 fonts" are:
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
'font_dir' => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as DOMPDF_FONT_DIR
*
* Note: This directory must exist and be writable by the webserver process.
*/
'font_cache' => storage_path('fonts'),
/**
* The location of a temporary directory.
*
* The directory specified must be writeable by the webserver process.
* The temporary directory is required to download remote images and when
* using the PDFLib back end.
*/
'temp_dir' => sys_get_temp_dir(),
/**
* ==== IMPORTANT ====
*
* dompdf's "chroot": Prevents dompdf from accessing system files or other
* files on the webserver. All local files opened by dompdf must be in a
* subdirectory of this directory. DO NOT set it to '/' since this could
* allow an attacker to use dompdf to read any files on the server. This
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
'chroot' => realpath(base_path()),
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URIs, and the validation rules
* that determine if a resouce may be loaded. Full support is not guaranteed
* for the protocols/wrappers specified
* by this array.
*
* @var array
*/
'allowed_protocols' => [
'data://' => ['rules' => []],
'file://' => ['rules' => []],
'http://' => ['rules' => []],
'https://' => ['rules' => []],
],
/**
* Operational artifact (log files, temporary files) path validation
*/
'artifactPathValidation' => null,
/**
* @var string
*/
'log_output_file' => null,
/**
* Whether to enable font subsetting or not.
*/
'enable_font_subsetting' => false,
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
* fall back on CPDF. 'GD' renders PDFs to graphic files.
* {@link * Canvas_Factory} ultimately determines which rendering class to
* instantiate based on this setting.
*
* Both PDFLib & CPDF rendering backends provide sufficient rendering
* capabilities for dompdf, however additional features (e.g. object,
* image and font support, etc.) differ between backends. Please see
* {@link PDFLib_Adapter} for more information on the PDFLib backend
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
* on CPDF. Also see the documentation for each backend at the links
* below.
*
* The GD rendering backend is a little different than PDFLib and
* CPDF. Several features of CPDF and PDFLib are not supported or do
* not make any sense when creating image files. For example,
* multiple pages are not supported, nor are PDF 'objects'. Have a
* look at {@link GD_Adapter} for more information. GD support is
* experimental, so use it at your own risk.
*
* @link http://www.pdflib.com
* @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image
*/
'pdf_backend' => 'CPDF',
/**
* html target media view which should be rendered into pdf.
* List of types and parsing rules for future extensions:
* http://www.w3.org/TR/REC-html40/types.html
* screen, tty, tv, projection, handheld, print, braille, aural, all
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
* Note, even though the generated pdf file is intended for print output,
* the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here.
*/
'default_media_type' => 'screen',
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
*
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/
'default_paper_size' => 'a4',
/**
* The default paper orientation.
*
* The orientation of the page (portrait or landscape).
*
* @var string
*/
'default_paper_orientation' => 'portrait',
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
*
* @var string
*/
'default_font' => 'serif',
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explictly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* Rendering resolution of various browsers in px per inch:
* Windows Firefox and Internet Explorer:
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
* Linux Firefox:
* about:config *resolution: Default:96
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
*
* Take care about extra font/image zoom factor of browser.
*
* In images, <img> size in pixel attribute, img css style, are overriding
* the real image dimension in px for rendering.
*
* @var int
*/
'dpi' => 96,
/**
* Enable embedded PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate embedded PHP contained
* within <script type="text/php"> ... </script> tags.
*
* ==== IMPORTANT ==== Enabling this for documents you do not trust (e.g. arbitrary remote html pages)
* is a security risk.
* Embedded scripts are run with the same level of system access available to dompdf.
* Set this option to false (recommended) if you wish to process untrusted documents.
* This setting may increase the risk of system exploit.
* Do not change this settings without understanding the consequences.
* Additional documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var bool
*/
'enable_php' => false,
/**
* Rnable inline JavaScript
*
* If this setting is set to true then DOMPDF will automatically insert JavaScript code contained
* within <script type="text/javascript"> ... </script> tags as written into the PDF.
* NOTE: This is PDF-based JavaScript to be executed by the PDF viewer,
* not browser-based JavaScript executed by Dompdf.
*
* @var bool
*/
'enable_javascript' => true,
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
*
* ==== IMPORTANT ====
* This can be a security risk, in particular in combination with isPhpEnabled and
* allowing remote html code to be passed to $dompdf = new DOMPDF(); $dompdf->load_html(...);
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* This setting may increase the risk of system exploit. Do not change
* this settings without understanding the consequences. Additional
* documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var bool
*/
'enable_remote' => false,
/**
* List of allowed remote hosts
*
* Each value of the array must be a valid hostname.
*
* This will be used to filter which resources can be loaded in combination with
* isRemoteEnabled. If enable_remote is FALSE, then this will have no effect.
*
* Leave to NULL to allow any remote host.
*
* @var array|null
*/
'allowed_remote_hosts' => null,
/**
* A ratio applied to the fonts height to be more like browsers' line height
*/
'font_height_ratio' => 1.1,
/**
* Use the HTML5 Lib parser
*
* @deprecated This feature is now always on in dompdf 2.x
*
* @var bool
*/
'enable_html5_parser' => true,
],
];

32
database/migrations/2013_03_27_235747_create_puestos_table.php

@ -0,0 +1,32 @@
<?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::create('puestos', function (Blueprint $table) {
$table->id();
$table->string('nombre');
$table->timestamps();
});
DB::table('puestos')->insert(['nombre'=> 'Administrativo']);
DB::table('puestos')->insert(['nombre'=> 'docente']);
DB::table('puestos')->insert(['nombre'=> 'coordinador']);
DB::table('puestos')->insert(['nombre'=> 'personal general']);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('puestos');
}
};

4
database/migrations/2014_10_12_000000_create_users_table.php

@ -17,12 +17,14 @@ return new class extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('apellido')->nullable();
$table->string('puesto')->nullable();
$table->unsignedBigInteger('puesto_id')->nullable();
$table->string('carrera')->nullable();
$table->string('telefono')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->foreign('puesto_id')->references('id')->on('puestos');
});
DB::table('users')->insert([
'name'=> 'Administrador',

8
database/migrations/2025_03_27_174121_create_prestamos_table.php

@ -13,6 +13,14 @@ return new class extends Migration
{
Schema::create('prestamos', function (Blueprint $table) {
$table->id();
$table->string('nombre_solicitante');
$table->string('destino');
$table->dateTime('fecha_hora_salida');
$table->dateTime('fecha_hora_llegada');
$table->text('motivo');
$table->string('domicilio');
$table->integer('numero_personas');
$table->boolean('chofer')->default(false); // Opción de sí (true) o no (false)
$table->timestamps();
});
}

28
database/migrations/2025_03_27_183714_add_columneliminado_toprestamos.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->boolean('eliminado')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('prestamos', function (Blueprint $table) {
$table->dropColumn('eliminado');
});
}
};

42
resources/views/exports/marcas-pdf.blade.php

@ -3,10 +3,14 @@
<head>
<title>Lista de Marcas</title>
<style>
body {
font-family: Arial, sans-serif;
font-size: 12px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
@ -16,29 +20,51 @@
th {
background-color: #f2f2f2;
}
h2 {
color: #333;
h1 {
text-align: center;
margin-bottom: 20px;
}
.header {
margin-bottom: 20px;
}
.footer {
margin-top: 20px;
text-align: right;
font-size: 10px;
}
</style>
</head>
<body>
<h2>Lista de Marcas</h2>
<div class="header">
<h1>Lista de Marcas</h1>
<p>Fecha de generación: {{ date('d/m/Y H:i:s') }}</p>
</div>
<table>
<thead>
<tr>
<th>ID</th>
<th>Marca</th>
<th>Estado</th>
<th>Fecha de Creación</th>
<th>Última Actualización</th>
</tr>
</thead>
<tbody>
@foreach($marcas as $marca)
<tr>
<td>{{ $marca->id }}</td>
<td>{{ $marca->marca }}</td>
</tr>
<tr>
<td>{{ $marca->id }}</td>
<td>{{ $marca->marca }}</td>
<td>{{ $marca->eliminado == 0 ? 'Activo' : 'Inactivo' }}</td>
<td>{{ $marca->created_at->format('d/m/Y H:i:s') }}</td>
<td>{{ $marca->updated_at->format('d/m/Y H:i:s') }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="footer">
<p>Página {{ $loop->iteration }} de {{ $loop->count }}</p>
</div>
</body>
</html>

76
resources/views/exports/prestamos-pdf.blade.php

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<title>Lista de Préstamos</title>
<style>
body {
font-family: Arial, sans-serif;
font-size: 12px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
h1 {
text-align: center;
margin-bottom: 20px;
}
.header {
margin-bottom: 20px;
}
.footer {
margin-top: 20px;
text-align: right;
font-size: 10px;
}
</style>
</head>
<body>
<div class="header">
<h1>Lista de Préstamos</h1>
<p>Fecha de generación: {{ date('d/m/Y H:i:s') }}</p>
</div>
<table>
<thead>
<tr>
<th>ID</th>
<th>Solicitante</th>
<th>Destino</th>
<th>Salida</th>
<th>Llegada</th>
<th>Motivo</th>
<th>Domicilio</th>
<th>Personas</th>
<th>Chofer</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
@foreach($prestamos as $prestamo)
<tr>
<td>{{ $prestamo->id }}</td>
<td>{{ $prestamo->nombre_solicitante }}</td>
<td>{{ $prestamo->destino }}</td>
<td>{{ $prestamo->fecha_hora_salida }}</td>
<td>{{ $prestamo->fecha_hora_llegada }}</td>
<td>{{ $prestamo->motivo }}</td>
<td>{{ $prestamo->domicilio }}</td>
<td>{{ $prestamo->numero_personas }}</td>
<td>{{ $prestamo->chofer ? 'Sí' : 'No' }}</td>
<td>{{ $prestamo->eliminado == 0 ? 'Activo' : 'Inactivo' }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

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

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>Lista de tiposLicencias</title>
<style>
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
h2 {
color: #333;
margin-bottom: 20px;
}
</style>
</head>
<body>
<h2>Lista de tiposLicencias</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>tipoLicencias</th>
</tr>
</thead>
<tbody>
@foreach($tiposlicencias as $tiposlicencias)
<tr>
<td>{{ $tiposlicencias->id }}</td>
<td>{{ $tiposlicencias->tiposlicencias }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

75
resources/views/exports/tipos_vehiculos_pdf.blade.php

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<title>Tipos de Vehículos</title>
<style>
body {
font-family: Arial, sans-serif;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.status-active {
color: green;
}
.status-inactive {
color: red;
}
</style>
</head>
<body>
<div class="header">
<h1>Reporte de Tipos de Vehículos</h1>
<p>Fecha de generación: {{ date('d/m/Y H:i:s') }}</p>
</div>
<table>
<thead>
<tr>
<th>ID</th>
<th>Nombre</th>
<th>Tipo de Combustible</th>
<th>Estado</th>
<th>Fecha de Creación</th>
</tr>
</thead>
<tbody>
@foreach($tiposVeiculos as $vehiculo)
<tr>
<td>{{ $vehiculo->id }}</td>
<td>{{ $vehiculo->nombre }}</td>
<td>
@if($vehiculo->tipo_combustible == 'gasolina_verde')
Gasolina Verde
@elseif($vehiculo->tipo_combustible == 'gasolina_roja')
Gasolina Roja
@elseif($vehiculo->tipo_combustible == 'diesel')
Diesel
@else
No especificado
@endif
</td>
<td class="{{ $vehiculo->status ? 'status-active' : 'status-inactive' }}">
{{ $vehiculo->status ? 'Activo' : 'Inactivo' }}
</td>
<td>{{ $vehiculo->created_at->format('d/m/Y') }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

2
resources/views/layouts/dashboard.blade.php

@ -73,7 +73,7 @@
class="pl-4 mt-2 space-y-1 text-sm">
<li>
<a href="/prestamos/nuevo" class="nav-item-hover flex items-center space-x-3 px-4 py-3 rounded-lg hover:bg-white/10 backdrop-blur-sm {{ request()->is('prestamos/nuevo') ? 'bg-white/20' : '' }}">
<a href="{{ route('prestamos.index') }}" class="nav-item-hover flex items-center space-x-3 px-4 py-3 rounded-lg hover:bg-white/10 backdrop-blur-sm {{ request()->is('tiposLicencias*') ? 'bg-white/20' : '' }}">
<i class="fas fa-plus text-white/80"></i>
<span class="font-light">Nuevo Préstamo</span>
</a>

35
resources/views/marcas.blade.php

@ -75,28 +75,28 @@
<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">ID</th>
<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">Marca</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Estado</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($marcas as $marca)
@foreach($marcas as $index => $marca)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $marca->id }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $index + 1 }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-car text-blue-500 mr-2"></i>
{{ $marca->marca }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
@if($marca->eliminado == 0)
<span class="flex items-center">
<span class="h-2 w-2 bg-green-500 rounded-full mr-2"></span> Activo
</span>
<span class="inline-flex items-center px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded-full">
<span class="fas fa-check-circle mr-1"></span> Activo
</span>
@else
<span class="flex items-center">
<span class="h-2 w-2 bg-red-500 rounded-full mr-2"></span> Inactivo
<span class="fas fa-check-circle mr-1"></span> Inactivo
</span>
@endif
</td>
@ -121,7 +121,7 @@
<form action="{{ route('marca.destroy', $marca->id) }}" method="POST" class="d-inline">
@csrf
@method('DELETE')
<a href="#" onclick="event.preventDefault(); this.closest('form').submit();"
<a href="#" onclick="event.preventDefault(); confirmarEliminacion(this);"
class="text-red-600 hover:text-red-700 transition-colors duration-200"
title="Eliminar marca">
<i class="fas fa-trash"></i>
@ -149,5 +149,22 @@
}, 500);
}
}, 3000);
function confirmarEliminacion(button) {
Swal.fire({
title: '¿Estás seguro?',
text: "Esta acción no se puede deshacer",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, eliminar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
button.closest('form').submit();
}
});
}
</script>
@endsection
@endsection

206
resources/views/prestamos.blade.php

@ -0,0 +1,206 @@
@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">Gestión de Préstamos</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') }}"
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>
<!-- Barra de búsqueda -->
<div class="p-4 border-b border-gray-200 bg-gray-50">
<form action="{{ route('prestamos.index') }}" 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.index') }}" 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">Estado</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-truck text-green-500 mr-2"></i>
{{ $prestamo->fecha_hora_salida }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-truck text-yellow-500 mr-2"></i>
{{ $prestamo->fecha_hora_llegada }}
</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-purple-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-indigo-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-blue-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>
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {{ $prestamo->chofer ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' }}">
{{ $prestamo->chofer ? 'Sí' : 'No' }}
</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<span class="inline-flex items-center px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded-full">
<i class="fas fa-check-circle mr-1"></i> Activo
</span>
</td>
<td class="flex space-x-2 px-6 py-4 whitespace-nowrap text-sm">
<a href="{{ route('prestamos.edit', $prestamo->id) }}"
class="text-yellow-600 hover:text-yellow-700 transition-colors duration-200"
title="Editar préstamo">
<i class="fas fa-pencil-alt"></i>
</a>
<form action="{{ route('prestamos.destroy', $prestamo->id) }}" method="POST" class="d-inline">
@csrf
@method('DELETE')
<a href="#" onclick="event.preventDefault(); confirmarEliminacion(this);"
class="text-red-600 hover:text-red-700 transition-colors duration-200"
title="Eliminar préstamo">
<i class="fas fa-trash-alt"></i>
</a>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<script>
// Desaparecer el mensaje después de 3 segundos
setTimeout(function() {
var message = document.getElementById('success-message');
if (message) {
message.style.transition = 'opacity 0.5s ease';
message.style.opacity = '0';
setTimeout(function() {
message.remove();
}, 500);
}
}, 3000);
function confirmarEliminacion(button) {
Swal.fire({
title: '¿Estás seguro?',
text: "Esta acción no se puede deshacer",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, eliminar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
button.closest('form').submit();
}
});
}
</script>
@endsection

207
resources/views/prestamosCrearEditar.blade.php

@ -0,0 +1,207 @@
@extends('layouts.dashboard')
@section('content')
<div class="container mx-auto px-4 py-6">
<div class="max-w-lg mx-auto">
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
<div class="p-6">
<!-- Encabezado del formulario -->
<div class="flex items-center justify-between mb-6">
<h2 class="text-2xl font-bold text-gray-800">
{{ isset($prestamo) ? 'Editar Préstamo' : 'Nuevo Préstamo' }}
</h2>
<div class="h-10 w-10 bg-blue-100 rounded-full flex items-center justify-center">
<i class="fas fa-car text-blue-600"></i>
</div>
</div>
<!-- Mensajes de error -->
@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">
<i class="fas fa-exclamation-circle text-red-500 mr-3"></i>
<div class="text-red-700">
<ul>
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<!-- Formulario -->
<form id="prestamoForm"
action="{{ isset($prestamo) ? route('prestamos.update', $prestamo->id) : route('prestamos.store') }}"
method="POST">
@csrf
@if(isset($prestamo))
@method('PUT')
@endif
<div class="space-y-6">
<!-- Campo Nombre Solicitante -->
<div>
<label for="nombre_solicitante" class="block text-sm font-medium text-gray-700 mb-2">
Nombre del Solicitante
</label>
<div class="relative">
<i class="fas fa-user absolute left-3 top-2.5 text-gray-400"></i>
<input type="text"
name="nombre_solicitante"
id="nombre_solicitante"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
placeholder="Ingresa el nombre del solicitante"
value="{{ isset($prestamo) ? $prestamo->nombre_solicitante : old('nombre_solicitante') }}">
</div>
@error('nombre_solicitante')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Destino -->
<div>
<label for="destino" class="block text-sm font-medium text-gray-700 mb-2">
Destino
</label>
<div class="relative">
<i class="fas fa-map-marker-alt absolute left-3 top-2.5 text-gray-400"></i>
<input type="text"
name="destino"
id="destino"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
placeholder="Ingresa el destino"
value="{{ isset($prestamo) ? $prestamo->destino : old('destino') }}">
</div>
@error('destino')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Fecha y Hora de Salida -->
<div>
<label for="fecha_hora_salida" class="block text-sm font-medium text-gray-700 mb-2">
Fecha y Hora de Salida
</label>
<div class="relative">
<i class="fas fa-clock absolute left-3 top-2.5 text-gray-400"></i>
<input type="datetime-local"
name="fecha_hora_salida"
id="fecha_hora_salida"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
value="{{ isset($prestamo) ? $prestamo->fecha_hora_salida : old('fecha_hora_salida') }}">
</div>
@error('fecha_hora_salida')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Fecha y Hora de Llegada -->
<div>
<label for="fecha_hora_llegada" class="block text-sm font-medium text-gray-700 mb-2">
Fecha y Hora de Llegada
</label>
<div class="relative">
<i class="fas fa-clock absolute left-3 top-2.5 text-gray-400"></i>
<input type="datetime-local"
name="fecha_hora_llegada"
id="fecha_hora_llegada"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
value="{{ isset($prestamo) ? $prestamo->fecha_hora_llegada : old('fecha_hora_llegada') }}">
</div>
@error('fecha_hora_llegada')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Motivo -->
<div>
<label for="motivo" class="block text-sm font-medium text-gray-700 mb-2">
Motivo
</label>
<div class="relative">
<i class="fas fa-info-circle absolute left-3 top-2.5 text-gray-400"></i>
<textarea name="motivo"
id="motivo"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
placeholder="Ingresa el motivo">{{ isset($prestamo) ? $prestamo->motivo : old('motivo') }}</textarea>
</div>
@error('motivo')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Domicilio -->
<div>
<label for="domicilio" class="block text-sm font-medium text-gray-700 mb-2">
Domicilio
</label>
<div class="relative">
<i class="fas fa-home absolute left-3 top-2.5 text-gray-400"></i>
<input type="text"
name="domicilio"
id="domicilio"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
placeholder="Ingresa el domicilio"
value="{{ isset($prestamo) ? $prestamo->domicilio : old('domicilio') }}">
</div>
@error('domicilio')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Número de Personas -->
<div>
<label for="numero_personas" class="block text-sm font-medium text-gray-700 mb-2">
Número de Personas
</label>
<div class="relative">
<i class="fas fa-users absolute left-3 top-2.5 text-gray-400"></i>
<input type="number"
name="numero_personas"
id="numero_personas"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
required
placeholder="Ingresa el número de personas"
value="{{ isset($prestamo) ? $prestamo->numero_personas : old('numero_personas') }}">
</div>
@error('numero_personas')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Campo Chofer -->
<div class="flex items-center">
<input type="checkbox"
name="chofer"
id="chofer"
class="rounded border-gray-300 text-blue-600 shadow-sm focus:ring-blue-500"
{{ isset($prestamo) && $prestamo->chofer ? 'checked' : '' }}>
<label for="chofer" class="ml-2 text-sm text-gray-700">¿Requiere chofer?</label>
</div>
<!-- Botones de acción -->
<div class="flex justify-end space-x-2 pt-4 border-t border-gray-200">
<a href="{{ route('prestamos.index') }}"
class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Cancelar
</a>
<button type="submit"
class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
{{ isset($prestamo) ? 'Actualizar' : 'Guardar' }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection

146
resources/views/tiposLicencia.blade.php

@ -2,7 +2,7 @@
@section('content')
<div class="container mx-auto px-4 py-6">
<!-- Encabezado -->
<!-- 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>
@ -16,13 +16,34 @@
@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 Tipos de Licencias</h2>
<a href="{{ route('tiposLicencias.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>
Agregar
</a>
<div class="flex items-center space-x-6">
<!-- Íconos de exportación y agregar -->
<div class="flex space-x-4">
<!-- Exportar a Excel -->
<a href="{{ route('tiposLicencias.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('tiposLicencias.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 tipo de licencia -->
<a href="{{ route('tiposLicencias.create') }}"
class="text-blue-500 hover:text-blue-600 transition-colors duration-200"
title="Agregar nuevo tipo de licencia">
<i class="fas fa-plus text-xl"></i>
</a>
</div>
</div>
</div>
<!-- Barra de búsqueda -->
@ -49,12 +70,14 @@
</form>
</div>
<!-- Tabla de tipos de licencias -->
<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">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tipo de Licencia</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Estado</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acciones</th>
</tr>
</thead>
@ -63,31 +86,46 @@
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $tipoLicencia->id }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-car text-blue-500 mr-2"></i>
<i class="fas fa-id-card text-blue-500 mr-2"></i>
{{ $tipoLicencia->tipoLicencia }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
@if($tipoLicencia->eliminado == 1)
<span class="flex items-center">
<span class="h-2 w-2 bg-green-500 rounded-full mr-2"></span> Activo
</span>
@else
<span class="flex items-center">
<span class="h-2 w-2 bg-red-500 rounded-full mr-2"></span> Inactivo
</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
<div class="flex gap-2">
<a href="{{ route('tiposLicencias.edit', $tipoLicencia->id) }}"
class="text-blue-600 hover:text-blue-900">
<i class="fas fa-edit"></i>
</a>
<a href="{{ route('tiposLicencias.toggle-status', $tipoLicencia->id) }}"
class="{{ $tipoLicencia->eliminado ? 'text-green-600 hover:text-green-900' : 'text-yellow-600 hover:text-yellow-900' }}">
<i class="fas {{ $tipoLicencia->eliminado ? 'fa-check-circle' : 'fa-times-circle' }}"></i>
</a>
<form action="{{ route('tiposLicencias.destroy', $tipoLicencia->id) }}"
method="POST"
class="inline"
onsubmit="return false;">
@csrf
@method('DELETE')
<button type="button"
onclick="confirmarEliminacion(this)"
class="text-red-600 hover:text-red-900">
<i class="fas fa-trash"></i>
</button>
</form>
@if($tipoLicencia->eliminado == 0)
<a href="{{ route('tiposLicencias.toggle-status', $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>
</a>
@else
<a href="{{ route('tiposLicencias.edit', $tipoLicencia->id) }}"
class="text-yellow-600 hover:text-yellow-700 transition-colors duration-200"
title="Editar tipo de licencia">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('tiposLicencias.destroy', $tipoLicencia->id) }}"
method="POST"
class="inline">
@csrf
@method('DELETE')
<button type="submit"
class="text-red-600 hover:text-red-700 transition-colors duration-200"
title="Eliminar tipo de licencia">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</div>
</td>
</tr>
@ -99,50 +137,16 @@
</div>
<script>
function confirmarEdicion(url) {
Swal.fire({
title: '¿Editar tipo de licencia?',
text: "¿Estás seguro de que deseas editar este tipo de licencia?",
icon: 'question',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, editar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = url;
// Desaparecer el mensaje después de 3 segundos
setTimeout(function() {
var message = document.getElementById('success-message');
if (message) {
message.style.transition = 'opacity 0.5s ease';
message.style.opacity = '0';
setTimeout(function() {
message.remove();
}, 500);
}
});
}
function confirmarEliminacion(button) {
Swal.fire({
title: '¿Estás seguro?',
text: "Esta acción no se puede deshacer",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí, eliminar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
button.closest('form').onsubmit = null;
button.closest('form').submit();
}
});
}
// Desaparecer el mensaje después de 3 segundos
setTimeout(function() {
var message = document.getElementById('success-message');
if (message) {
message.style.transition = 'opacity 0.5s ease';
message.style.opacity = '0';
setTimeout(function() {
message.remove();
}, 500); // Tiempo para remover el elemento después de la transición
}
}, 3000); // Tiempo en milisegundos antes de comenzar a desaparecer
}, 3000);
</script>
@endsection

52
resources/views/usuarios.blade.php

@ -36,6 +36,8 @@
<i class="fas fa-file-pdf text-xl"></i>
</a>
<!-- Agregar nuevo usuario -->
<a href="{{ route('usuarios.create') }}"
class="text-blue-500 hover:text-blue-600 transition-colors duration-200"
@ -43,6 +45,7 @@
<i class="fas fa-plus text-xl"></i>
</a>
</div>
</div>
</div>
@ -76,15 +79,15 @@
<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">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nombre</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Apellido</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Puesto</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Carrera</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Teléfono</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Estado</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acciones</th>
<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 </th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email </th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Apellido </th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Puesto </th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Carrera </th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Teléfono </th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Estado </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">
@ -93,22 +96,35 @@
<td colspan="9" class="px-6 py-4 text-center text-gray-500">No hay usuarios registrados.</td>
</tr>
@else
@foreach($usuarios as $usuario)
@foreach($usuarios as $index => $usuario)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $usuario->id }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $index + 1 }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-user text-blue-500 mr-2"></i>
{{ $usuario->name }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $usuario->email }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $usuario->apellido }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $usuario->puesto }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $usuario->carrera }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ $usuario->telefono }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-envelope text-blue-500"></i> {{ $usuario->email }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-user-tag text-green-500"></i> {{ $usuario->apellido }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<div class="flex items-center">
<i class="fas fa-briefcase text-gray-400 mr-2"></i>
{{ $usuario->puesto->nombre ?? 'Sin puesto asignado' }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-graduation-cap text-purple-500"></i> {{ $usuario->carrera }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
<i class="fas fa-phone text-red-500"></i> {{ $usuario->telefono }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
@if($usuario->eliminado == 0)
<span class="flex items-center">
<span class="h-2 w-2 bg-green-500 rounded-full mr-2"></span> Activo
<span class="inline-flex items-center px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded-full">
<span class="h-2 w-2 bg-green-500 rounded-full mr-2"></span> Activo
</span>
@else
<span class="flex items-center">

95
resources/views/usuariosCrearEditar.blade.php

@ -34,48 +34,119 @@
<div class="space-y-6">
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">Nombre</label>
<input type="text" name="name" id="name" class="block w-full px-3 py-2 border border-gray-300 rounded-md" required value="{{ isset($usuario) ? $usuario->name : old('name') }}">
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-user text-gray-400"></i>
</div>
<input type="text" name="name" id="name"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Ingresa el nombre"
required value="{{ isset($usuario) ? $usuario->name : old('name') }}">
</div>
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">Correo Electrónico</label>
<input type="email" name="email" id="email" class="block w-full px-3 py-2 border border-gray-300 rounded-md" required value="{{ isset($usuario) ? $usuario->email : old('email') }}">
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-envelope text-gray-400"></i>
</div>
<input type="email" name="email" id="email"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Ingresa el correo electrónico"
required value="{{ isset($usuario) ? $usuario->email : old('email') }}">
</div>
</div>
<div>
<label for="apellido" class="block text-sm font-medium text-gray-700 mb-2">Apellido</label>
<input type="text" name="apellido" id="apellido" class="block w-full px-3 py-2 border border-gray-300 rounded-md" required value="{{ isset($usuario) ? $usuario->apellido : old('apellido') }}">
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-user-tag text-gray-400"></i>
</div>
<input type="text" name="apellido" id="apellido"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Ingresa el apellido"
required value="{{ isset($usuario) ? $usuario->apellido : old('apellido') }}">
</div>
</div>
<div>
<label for="puesto" class="block text-sm font-medium text-gray-700 mb-2">Puesto</label>
<input type="text" name="puesto" id="puesto" class="block w-full px-3 py-2 border border-gray-300 rounded-md" required value="{{ isset($usuario) ? $usuario->puesto : old('puesto') }}">
<label for="puestos_id" class="block text-sm font-medium text-gray-700 mb-2">Puesto</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-briefcase text-gray-400"></i>
</div>
<select name="puesto_id" id="puesto_id" class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md" required>
<option value="">Selecciona un puesto</option>
@foreach($puestos as $puesto)
<option value="{{ $puesto->id }}"
{{ (isset($usuario) && $usuario->puesto_id == $puesto->id) ? 'selected' : '' }}>
{{ $puesto->nombre }}
</option>
@endforeach
</select>
</div>
</div>
<div>
<label for="carrera" class="block text-sm font-medium text-gray-700 mb-2">Carrera</label>
<input type="text" name="carrera" id="carrera" class="block w-full px-3 py-2 border border-gray-300 rounded-md" required value="{{ isset($usuario) ? $usuario->carrera : old('carrera') }}">
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-graduation-cap text-gray-400"></i>
</div>
<input type="text" name="carrera" id="carrera"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Ingresa la carrera"
required value="{{ isset($usuario) ? $usuario->carrera : old('carrera') }}">
</div>
</div>
<div>
<label for="telefono" class="block text-sm font-medium text-gray-700 mb-2">Teléfono</label>
<input type="text" name="telefono" id="telefono" class="block w-full px-3 py-2 border border-gray-300 rounded-md" required value="{{ isset($usuario) ? $usuario->telefono : old('telefono') }}">
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-phone text-gray-400"></i>
</div>
<input type="text" name="telefono" id="telefono"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Ingresa el número telefónico"
required value="{{ isset($usuario) ? $usuario->telefono : old('telefono') }}">
</div>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700 mb-2">Contraseña</label>
<input type="password" name="password" id="password" class="block w-full px-3 py-2 border border-gray-300 rounded-md" {{ isset($usuario) ? '' : 'required' }}>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-gray-400"></i>
</div>
<input type="password" name="password" id="password"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Ingresa la contraseña"
{{ isset($usuario) ? '' : 'required' }}>
</div>
</div>
<div>
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 mb-2">Confirmar Contraseña</label>
<input type="password" name="password_confirmation" id="password_confirmation" class="block w-full px-3 py-2 border border-gray-300 rounded-md" {{ isset($usuario) ? '' : 'required' }}>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-gray-400"></i>
</div>
<input type="password" name="password_confirmation" id="password_confirmation"
class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md"
placeholder="Confirma la contraseña"
{{ isset($usuario) ? '' : 'required' }}>
</div>
</div>
<div class="flex justify-end space-x-2 pt-4 border-t border-gray-200">
<a href="{{ route('usuarios') }}" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">Cancelar</a>
<a href="{{ route('usuarios') }}" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">
<i class="fas fa-times mr-2"></i>Cancelar
</a>
<button type="submit" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700">
{{ isset($usuario) ? 'Actualizar' : 'Guardar' }}
<i class="fas fa-save mr-2"></i>{{ isset($usuario) ? 'Actualizar' : 'Guardar' }}
</button>
</div>
</div>
@ -84,4 +155,4 @@
</div>
</div>
</div>
@endsection
@endsection

16
resources/views/vehiculos.blade.php

@ -18,11 +18,17 @@
<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 Vehículos</h2>
<a href="{{ route('vehiculos.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>
Agregar
</a>
<div class="flex items-center gap-4">
<a href="{{ route('vehiculos.excel') }}" class="text-green-600 hover:text-green-800 text-2xl">
<i class="fas fa-file-excel"></i>
</a>
<a href="{{ route('vehiculos.pdf') }}" class="text-red-600 hover:text-red-800 text-2xl">
<i class="fas fa-file-pdf"></i>
</a>
<a href="{{ route('vehiculos.create') }}" class="text-blue-600 hover:text-blue-800 text-2xl">
<i class="fas fa-plus"></i>
</a>
</div>
</div>
<!-- Barra de búsqueda -->

36
routes/web.php

@ -29,35 +29,61 @@ use App\Http\Controllers\PrestamoController;
Route::resource('marca', MarcaController::class);
Route::resource('docentes', DocentesController::class);
// Rutas específicas de vehículos
Route::get('vehiculos/excel', [TiposVeiculosController::class, 'exportExcel'])->name('vehiculos.excel');
Route::get('vehiculos/pdf', [TiposVeiculosController::class, 'exportPDF'])->name('vehiculos.pdf');
Route::get('/vehiculos/{id}/toggle-status', [TiposVeiculosController::class, 'toggleStatus'])->name('vehiculos.toggle-status');
Route::resource('vehiculos', TiposVeiculosController::class);
Route::resource('tiposLicencias', TiposLicenciasController::class);
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::resource('tiposLicencias', TiposLicenciasController::class);
Route::get('/tiposLicencias/{id}/toggle-status', [TiposLicenciasController::class, 'toggleStatus'])->name('tiposLicencias.toggle-status');
Route::resource('capacidades', CapacidadController::class);
Route::resource('prestamos',PrestamoController::class);
Route::get('marcas/excel', [MarcaController::class, 'exportExcel'])->name('marcas.excel');
Route::get('marcas/pdf', [MarcaController::class, 'exportPDF'])->name('marcas.pdf');
Route::get('/marcas/excel', [MarcaController::class, 'exportExcel'])->name('marcas.excel');
Route::get('/marcas/pdf', [MarcaController::class, 'exportPDF'])->name('marcas.pdf');
// 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');
// Después la ruta de recurso (más general)
Route::resource('prestamos', PrestamoController::class);
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
// Rutas protegidas que requieren autenticación
Route::middleware(['auth'])->group(function () {
Route::get('/dashboard', [HomeController::class, 'index'])->name('dashboard');
Route::get('/usuarios', [usuariosController::class,'index'])->name('usuarios');
Route::get('/usuarios/nuevo', [usuariosController::class, 'create'])->name('usuarios.create');
Route::post('/usuarios/store', [usuariosController::class,'store'])->name('usuarios.store');
Route::get('/usuarios/edit/{id}', [usuariosController::class, 'edit'])->name('usuarios.edit');
Route::put('/usuarios/update', [usuariosController::class,'update'])->name('usuarios.update');
Route::put('/usuarios/{id}', [usuariosController::class, 'update'])->name('usuarios.update');
Route::delete('/usuarios/destroy/{id}', [usuariosController::class, 'destroy'])->name('usuarios.destroy');
Route::get('usuarios/excel', [usuariosController::class, 'exportExcel'])->name('usuarios.excel');
Route::get('usuarios/pdf', [usuariosController::class, 'exportPDF'])->name('usuarios.pdf');
Route::get('/home', [HomeController::class, 'index'])->name('home');
////corerecion rubi
});

Loading…
Cancel
Save