{% 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-building-exclamation"></i> {{ title }}</h2>
    <a href="{{ url_for('planning.availability') }}" 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: Vacances de Noël") }}
        </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>
        {% if form.zone %}
        <div class="mt-2">
          {{ form.zone.label(class="form-label small") }}
          {{ form.zone(class="form-select form-select-sm") }}
        </div>
        {% endif %}
        {% if form.is_exception %}
        <div class="form-check form-switch mt-2">
          {{ form.is_exception(class="form-check-input") }}
          {{ form.is_exception.label(class="form-check-label small", text="Exception (collège ouvert)") }}
        </div>
        {% endif %}
        <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 %}