{% extends "base.html" %}

{% block title %}{{ title }} - GMAO{% endblock %}

{% block content %}
<div class="container-fluid py-4">
  <div class="row justify-content-center">
    <div class="col-lg-6">
      <div class="card shadow-sm">
        <div class="card-header bg-primary text-white">
          <i class="bi bi-person-plus me-2"></i>{{ title }}
        </div>
        <div class="card-body">
          <form method="POST">
            {{ form.hidden_tag() }}

            <div class="row mb-3">
              <div class="col-md-6">
                {{ form.first_name.label(class="form-label") }}
                {{ form.first_name(class="form-control") }}
              </div>
              <div class="col-md-6">
                {{ form.last_name.label(class="form-label") }}
                {{ form.last_name(class="form-control") }}
              </div>
            </div>

            <div class="row mb-3">
              <div class="col-md-6">
                {{ form.function.label(class="form-label") }}
                {{ form.function(class="form-control", placeholder="Ex: Professeur, CPE, AED…") }}
              </div>
              <div class="col-md-6">
                {{ form.department.label(class="form-label") }}
                {{ form.department(class="form-control", placeholder="Ex: Mathématiques, Vie scolaire…") }}
              </div>
            </div>

            <div class="row mb-3">
              <div class="col-md-6">
                {{ form.email.label(class="form-label") }}
                {{ form.email(class="form-control", placeholder="prenom.nom@ac-creteil.fr") }}
              </div>
              <div class="col-md-6">
                {{ form.phone.label(class="form-label") }}
                {{ form.phone(class="form-control", placeholder="01 60 xx xx xx") }}
              </div>
            </div>

            <div class="mb-3">
              <div class="form-check form-switch">
                {{ form.is_active(class="form-check-input") }}
                {{ form.is_active.label(class="form-check-label") }}
              </div>
            </div>

            <div class="d-flex gap-2">
              <button type="submit" class="btn btn-primary">
                <i class="bi bi-check-lg me-1"></i>Enregistrer
              </button>
              <a href="{{ url_for('ent.staff') }}" class="btn btn-outline-secondary">Annuler</a>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}
