You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
12 KiB
207 lines
12 KiB
@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
|