{{-- resources/views/cepros/edit.blade.php --}}
@extends('layouts.app')

@section('title', 'Editar Centro Educativo')

@section('content')
    <div class="container">
        <h1 class="mb-4 text-white"><i class="bi bi-building-gear me-2"></i> Editar Centro Educativo</h1>

        <div class="row justify-content-center">
            <div class="col-md-8 col-lg-6">
                <div class="card bg-dark shadow-sm text-white">
                    <div class="card-body">
                        <form action="{{ route('cepros.update', $cepro) }}" method="POST">
                            @csrf
                            @method('PUT')

                            <div class="mb-3">
                                <label for="nom_cepro" class="form-label"><i class="bi bi-building-fill me-2"></i> Nombre del Centro Educativo</label>
                                <input type="text" class="form-control form-control-sm bg-secondary border-secondary text-white @error('nom_cepro') is-invalid @enderror" id="nom_cepro" name="nom_cepro" value="{{ old('nom_cepro', $cepro->nom_cepro) }}" required>
                                @error('nom_cepro')
                                    <div class="invalid-feedback">{{ $message }}</div>
                                @enderror
                            </div>

                            <div class="mb-3">
                                <label for="prov_cepro" class="form-label"><i class="bi bi-map-fill me-2"></i> Provincia</label>
                                <input type="text" class="form-control form-control-sm bg-secondary border-secondary text-white @error('prov_cepro') is-invalid @enderror" id="prov_cepro" name="prov_cepro" value="{{ old('prov_cepro', $cepro->prov_cepro) }}">
                                @error('prov_cepro')
                                    <div class="invalid-feedback">{{ $message }}</div>
                                @enderror
                            </div>

                            <div class="mb-3">
                                <label for="nivel" class="form-label"><i class="bi bi-layer-group-fill me-2"></i> Nivel</label>
                                <select class="form-select form-select-sm bg-secondary border-secondary text-white @error('nivel') is-invalid @enderror" id="nivel" name="nivel">
                                    <option value="">Seleccionar Nivel</option>
                                    <option value="1" {{ old('nivel', $cepro->nivel) == '1' ? 'selected' : '' }}>Técnico Productivo</option>
                                    <option value="2" {{ old('nivel', $cepro->nivel) == '2' ? 'selected' : '' }}>Auxiliar Técnico</option>
                                </select>
                                @error('nivel')
                                    <div class="invalid-feedback">{{ $message }}</div>
                                @enderror
                            </div>

                            <div class="d-flex justify-content-end">
                                <button type="submit" class="btn btn-primary btn-sm shadow-sm"><i class="bi bi-arrow-repeat me-2"></i> Actualizar Centro</button>
                                <a href="{{ route('cepros.index') }}" class="btn btn-secondary btn-sm ms-2 shadow-sm"><i class="bi bi-x-circle me-2"></i> Cancelar</a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection