|
|
@ -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 |
|
|
|