@extends('layouts.dashboard')

@section('content')
<div class="container mx-auto px-4 py-6">
    <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">{{ isset($docente) ? 'Editar Docente' : 'Crear Docente' }}</h2>
        </div>
        <div class="p-4">
            <form action="{{ isset($docente) ? route('docentes.update', $docente->id) : route('docentes.store') }}" method="POST">
                @csrf
                @if(isset($docente))
                    @method('PUT')
                @endif
                <div class="grid grid-cols-1 gap-6">
                    <div>
                        <label for="nombre" class="block text-sm font-medium text-gray-700">Nombre</label>
                        <input type="text" name="nombre" id="nombre" value="{{ old('nombre', $docente->nombre ?? '') }}" class="mt-1 block w-full border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    </div>
                    <div>
                        <label for="telefono" class="block text-sm font-medium text-gray-700">Teléfono</label>
                        <input type="text" name="telefono" id="telefono" value="{{ old('telefono', $docente->telefono ?? '') }}" class="mt-1 block w-full border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    </div>
                    <div>
                        <label for="correo" class="block text-sm font-medium text-gray-700">Correo</label>
                        <input type="email" name="correo" id="correo" value="{{ old('correo', $docente->correo ?? '') }}" class="mt-1 block w-full border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    </div>
                    <div>
                        <label for="tipo_licencia" class="block text-sm font-medium text-gray-700">Tipo de Licencia</label>
                        <input type="text" name="tipo_licencia" id="tipo_licencia" value="{{ old('tipo_licencia', $docente->tipo_licencia ?? '') }}" class="mt-1 block w-full border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                    </div>
                    <div>
                        <label for="materia" class="block text-sm font-medium text-gray-700">Materia</label>
                        <select name="materia" id="materia" class="mt-1 block w-full border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
                            <option value="">Seleccione una materia</option>
                            <option value="Matemáticas" {{ old('materia', $docente->materia ?? '') == 'Matemáticas' ? 'selected' : '' }}>Matemáticas</option>
                            <option value="Programación" {{ old('materia', $docente->materia ?? '') == 'Programación' ? 'selected' : '' }}>Programación</option>
                            <option value="Base de datos" {{ old('materia', $docente->materia ?? '') == 'Base de datos' ? 'selected' : '' }}>Base de datos</option>
                            <option value="Sistemas Operativos" {{ old('materia', $docente->materia ?? '') == 'Sistemas Operativos' ? 'selected' : '' }}>Sistemas Operativos</option>
                            <option value="Redes" {{ old('materia', $docente->materia ?? '') == 'Redes' ? 'selected' : '' }}>Redes</option>
                        </select>
                    </div>
                </div>
                <div class="mt-6 flex justify-end">
                    <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
                        {{ isset($docente) ? 'Actualizar' : 'Crear' }}
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection