{% extends "base.html" %}

{% block boutons_droite %}
    {% include 'aemo/famille_boutons.html' with active='agenda' %}
{% endblock %}

{% block content %}
    <div class="row border-bottom lead mt-3 mb-3">
        <div class="col">Famille {{ famille.nom }} - {{ famille.adresse }}</div>
        <div class="col text-end">
            Bilan du {{ bilan.date }}{% if bilan.phase %} - Phase {{ bilan.phase }}{% endif %}
        </div>
    </div>

    <div class="row justify-content-center">
        <div class="col-10">
            {% for label, value in data %}
            <h3>{{ label }}</h3>
            {{ value|default:'-'|raw_or_html }}
            {% endfor %}
            {% if bilan.fichier and bilan.famille|can_edit:user %}
               <h3>Document annexé</h3>
                  <a href="{{ bilan.fichier.url }}">{{ bilan.fichier }}</a>
            {% endif %}
         </div>
   </div>

    <div class="row mt-5">
        <div class="col mt-3 text-end">
            <a class="btn btn-sm btn-secondary" href="javascript: history.go(-1)">Retour</a>
            {% if bilan|can_edit:user %}
                <a class="btn btn-sm btn-success" href="{{ bilan.edit_url }}">Modifier</a>
                <form class="inline ms-5" method="post">{% csrf_token %}
                    <button class="btn btn-sm btn-danger" name="delete" type="submit"
                        data-confirm="Voulez-vous vraiment supprimer ce bilan ?"
                        formaction="{% url bilan.delete_urlname famille.pk bilan.pk %}"
                        >Supprimer</button>
                </form>
            {% endif %}
        </div>
    </div>
{% endblock %}
