{% extends 'dossiers/patientrecord_tab.html' %}

{% block content %}
<br class="clear" />
<div id="tabs-7">
  <div class="frame">
    <h3>Périodes de socialisation</h3>
    <p><button id="new-socialisation-duration-btn">Nouvelle période de socialisation</button></p>
    {% for duration in object.socialisation_durations.all %}
    <div class="subframe">
      Arrivée le <strong>{{ duration.start_date }}</strong> dans {% if duration.school %}l'établissement <strong>{{ duration.school }}</strong>{% else %}un établissement non renseigné{% endif %}{% if duration.level %} (en {{ duration.level }}){% endif %}
      <ul>
        {% if duration.school.address %}
        <li><label>Adresse établissement : </label>{{ duration.school.address }}, {{ duration.school.zip_code }} {{ duration.school.city }}</span></li>
        {% endif %}
        {% if duration.school.phone %}
        <li><span class="icon-phone">{{ duration.school.phone }}</span></li>
        {% endif %}
      </ul>
      <div class="buttons">
        <button type="button" data-id="{{ duration.id }}" class="del-duration icon-minus" title="Supprimer"></button>
        <button type="button" data-id="{{ duration.id }}" class="update-duration-btn icon-edit" title="Modifier"></button>
      </div>
      <div>
        <ul>
          {% if duration.end_date %}<li><label>Date de départ</label> : {{ duration.end_date }}</li>{% endif %}
          {% if duration.comment %}<li><label>Commentaire</label> : {{ duration.comment }}</li>{% endif %}
        </ul>
      </div>
    </div>
    {% endfor %}
  </div>

  <div class="frame">
    <h3>Demandes MDPH</h3>
    <p><button id="new-mdph-request-btn">Nouvelle demande MDPH</button></p>
    {% for request in object.mdph_requests.all %}
    <div class="subframe">
      Demande le <strong>{{ request.start_date }}</strong> à la MDPH <strong>{{ request.mdph }}</strong>
      <div class="buttons">
        <button type="button" data-id="{{ request.id }}" class="del-mdph-request icon-minus" title="Supprimer"></button>
        <button type="button" data-id="{{ request.id }}" class="update-mdph-request-btn icon-edit" title="Modifier"></button>
      </div>
      <div>
        <ul>
          {% if request.comment %}<li><label>Commentaire</label> : {{ request.comment }}</li>{% endif %}
        </ul>
      </div>
    </div>
    {% endfor %}
  </div>

  <div class="frame">
    <h3>Réponses MDPH</h3>
    <p><button id="new-mdph-response-btn">Nouvelle réponse MDPH</button></p>
    {% for response in object.mdph_responses.all %}
    <div class="subframe">
      Du <strong>{{ response.start_date }}</strong> au <strong>{{ response.end_date }}</strong> à la MDPH <strong>{{ response.mdph }}</strong>
      <div class="buttons">
        <button type="button" data-id="{{ response.id }}" class="del-mdph-response icon-minus" title="Supprimer"></button>
        <button type="button" data-id="{{ response.id }}" class="update-mdph-response-btn icon-edit" title="Modifier"></button>
      </div>
      <div>
        <ul>
          {% if response.comment %}<li><label>Commentaire</label> : {{ response.comment }}</li>{% endif %}
          {% if response.type_aide %}<li><label>Type d'aide</label> : {{ response.type_aide }}</li>{% endif %}
          {% if response.name %}<li><label>Nom</label> : {{ response.name }}</li>{% endif %}
          {% if response.rate %}<li><label>Taux</label> : {{ response.rate }}</li>{% endif %}
        </ul>
      </div>
    </div>
    {% endfor %}
  </div>
</div>
{% endblock %}
