{% extends "base.html" %}
{% block title %}{{ title }} — GMAO Collège{% endblock %}

{% block content %}
<div class="py-2 py-md-3" style="max-width:500px;">
  <div class="d-flex justify-content-between align-items-center mb-3">
    <h2 class="mb-0 h5"><i class="bi bi-person-dash"></i> {{ title }}</h2>
    <a href="{{ url_for('planning.leaves') }}" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left"></i></a>
  </div>

  <form method="POST">
    {{ form.hidden_tag() }}

    <div class="card border-0 shadow-sm mb-3">
      <div class="card-body py-2 px-3">
        <div class="mb-2">
          {{ form.type.label(class="form-label small") }}
          {{ form.type(class="form-select form-select-sm") }}
        </div>
        <div class="mb-2">
          {{ form.label.label(class="form-label small") }}
          {{ form.label(class="form-control form-control-sm", placeholder="Ex: RTT, Arrêt maladie…") }}
        </div>
        <div class="row g-2">
          <div class="col-6">
            {{ form.start_date.label(class="form-label small") }}
            {{ form.start_date(class="form-control form-control-sm", type="date") }}
          </div>
          <div class="col-6">
            {{ form.end_date.label(class="form-label small") }}
            {{ form.end_date(class="form-control form-control-sm", type="date") }}
          </div>
        </div>
        <div class="row g-2 mt-2">
          <div class="col-6">
            <div class="form-check form-switch">
              {{ form.am_only(class="form-check-input") }}
              {{ form.am_only.label(class="form-check-label small", text="Matin seul") }}
            </div>
          </div>
          <div class="col-6">
            <div class="form-check form-switch">
              {{ form.pm_only(class="form-check-input") }}
              {{ form.pm_only.label(class="form-check-label small", text="Après-midi seul") }}
            </div>
          </div>
        </div>
        <div class="mt-2">
          {{ form.notes.label(class="form-label small") }}
          {{ form.notes(class="form-control form-control-sm", rows=2, placeholder="Notes…") }}
        </div>
      </div>
    </div>

    <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Enregistrer</button>
  </form>
</div>
{% endblock %}