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.
158 lines
9.3 KiB
158 lines
9.3 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">
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h2 class="text-2xl font-bold text-gray-800">
|
|
{{ isset($usuario) ? 'Editar Usuario' : 'Nuevo Usuario' }}
|
|
</h2>
|
|
</div>
|
|
|
|
@if($errors->any())
|
|
<div class="mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded-r-lg">
|
|
<div class="flex items-center">
|
|
<div class="text-red-700">
|
|
<ul>
|
|
@foreach($errors->all() as $error)
|
|
<li>{{ $error }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<form action="{{ isset($usuario) ? route('usuarios.update', $usuario->id) : route('usuarios.store') }}" method="POST">
|
|
@csrf
|
|
@if(isset($usuario))
|
|
@method('PUT')
|
|
@endif
|
|
|
|
<div class="space-y-6">
|
|
<div>
|
|
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">Nombre</label>
|
|
<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>
|
|
<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>
|
|
<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="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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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">
|
|
<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">
|
|
<i class="fas fa-save mr-2"></i>{{ isset($usuario) ? 'Actualizar' : 'Guardar' }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|