{% extends "base.html" %}

{% block boutons_droite %}
    {% if form.instance.pk %}
        {% include 'aemo/famille_boutons.html' with active='demande' %}
    {% endif %}
{% endblock %}

{% block content %}
    <div class="row border-bottom lead mt-3 mb-5">
        <div class="col">Famille {{ famille.nom }} - {{ famille.adresse }}</div>
        <div class="col text-end">Analyse de la demande</div>
    </div>
    <div class="row justify-content-center mb-3">
        <div class="col-10">
            <form action= "." name="DemandeForm" method="post">{% csrf_token %}
                <input type="hidden" name="famille" value="{{ famille.pk }}">
                <table class="table table-sm table-borderless">
                    {{ form.as_table }}
                    <tr>
                        <th>Réseau prof.</th>
                        <td>
                            <table>
                                <tr>
                                    <td>OPE:</td>
                                    <td>{{ famille.suivi|noms_referents_ope }} {{ famille.suivi.mandat_ope|join:', '|in_parens }}</td>
                                </tr>
                                {% for enfant in famille.membres_suivis %}
                                    {% for ct in enfant.reseaux.all %}
                                        <tr>
                                            <td>{{ enfant.prenom }}:</td>
                                            <td>{{ ct }} {{ ct.contact }}</td>
                                        </tr>
                                    {% endfor %}
                                {% endfor %}
                            </table>
                        </td>
                    </tr>
                </table>
                {% if famille|can_edit:user %}
                    {% include "actions.html" %}
                {% endif %}
            </form>
        </div>
    </div>

{% endblock %}
