{% extends 'admin/base.twig' %}
{% block title %}AG (Assemblée Générale){% endblock %}
{% block page_title %}AG (Assemblée Générale){% endblock %}

{% block body %}
    <div class="p-4 sm:p-6 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 min-h-screen">

        <h1 class="text-2xl font-bold mb-6 border-b pb-2 border-gray-200 dark:border-gray-700">
            {% if ag.vars.value.id is defined and ag.vars.value.id is not null %}
                Modifier l'Assemblée Générale
            {% else %}
                Créer une nouvelle Assemblée Générale
            {% endif %}
        </h1>

        {# Le formulaire doit utiliser le thème 'form_admin.twig' pour le style #}
        {% form_theme ag 'form_admin.twig' %}

        {{ form_start(ag, {'attr': {'class': 'space-y-6'}}) }}

        {# Section 1: Informations principales et dates (Grid Layout) #}
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 p-4 border rounded-lg bg-gray-50 dark:bg-gray-700">

            <h2 class="col-span-full text-lg font-semibold text-gray-700 dark:text-gray-200 mb-2">Détails de l'AG</h2>

            {{ form_row(ag.agDateAt) }}
            {{ form_row(ag.type) }}
            {# Ce champ est seul sur la deuxième colonne pour l'exemple #}
            <div class="md:col-span-1"></div>
        </div>

        {# Section 2: Localisation (Grid Layout) #}
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 p-4 border rounded-lg bg-gray-50 dark:bg-gray-700">

            <h2 class="col-span-full text-lg font-semibold text-gray-700 dark:text-gray-200 mb-2">Lieu</h2>

            {{ form_row(ag.locate) }}
            {{ form_row(ag.locateZipcode) }}
            {{ form_row(ag.locateCity) }}
        </div>

        {# Section 3: Rôles (Simple Layout) #}
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 p-4 border rounded-lg bg-gray-50 dark:bg-gray-700">

            <h2 class="col-span-full text-lg font-semibold text-gray-700 dark:text-gray-200 mb-2">Rôles</h2>

            {{ form_row(ag.president) }}
            {{ form_row(ag.secretaire) }}
        </div>

        {# Boutons d'action #}
        <div class="flex justify-end space-x-4 pt-6 border-t border-gray-200 dark:border-gray-700">

            {# Bouton Annuler/Retour #}
            <a href="{{ path('admin_ag') }}"
               class="inline-flex items-center px-4 py-2 border border-gray-300 dark:border-gray-600 text-sm font-medium rounded-md shadow-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                Annuler
            </a>

            {# Bouton Soumettre/Enregistrer #}
            <button type="submit"
                    class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 dark:bg-indigo-500 dark:hover:bg-indigo-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
                Enregistrer l'AG
            </button>
        </div>

        {{ form_end(ag) }}
    </div>
{% endblock %}
