32 changed files with 1778 additions and 269 deletions
@ -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' |
|||
]; |
|||
} |
|||
} |
@ -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 |
|||
]; |
|||
} |
|||
} |
@ -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; |
|||
} |
@ -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, |
|||
], |
|||
|
|||
]; |
@ -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'); |
|||
} |
|||
}; |
@ -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'); |
|||
}); |
|||
} |
|||
}; |
@ -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> |
@ -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> |
@ -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> |
@ -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 |
@ -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 |
Loading…
Reference in new issue