<form method="post" id="id-form">
  {% csrf_token %}
  <div class="frame inline">
    <h3>État civil</h3>
    <button class="save enable-on-change">✔</button>
    <p>
    {% for field in forms.id %}
    {{ field.errors }}
    {% endfor %}
    </p>
    <p>
    {{ forms.id.last_name.label_tag }} : <span class="lastname">{{ forms.id.last_name }}</span>
    {{ forms.id.first_name.label_tag }} : {{ forms.id.first_name }}
    {{ forms.id.birthplace.label_tag }} : {{ forms.id.birthplace }}
    </p>
    <p>
    {{ forms.id.birthdate.label_tag }} : {{ forms.id.birthdate }}
    {{ forms.id.gender.label_tag }} : {{ forms.id.gender }}
    {{ forms.id.nationality.label_tag }} : {{ forms.id.nationality }}
    </p>
    <input type="hidden"  name="tab"  value="1">
  </div>
</form>

<form method="post" id="inscription-form" class="patientrecordform">
  {% csrf_token %}
  <div class="frame inline">
    <h3>Inscription</h3>
    <button class="save enable-on-change">✔</button>
    <p>
    {% for field in forms.inscription %}
    {{ field.label_tag  }} : {{ field }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/{{ field.name }}/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_inscription-{{ field.name }}"
      title="Ajouter un {{ field.label.lower }}"
      type="button">+</button>
    {% endfor %}
    </p>
    <input type="hidden"  name="tab"  value="1">
  </div>
</form>

<form method="post" id="out-form" class="patientrecordform">
  {% csrf_token %}
  <div class="frame inline">
    <h3>Sortie</h3>
    <button class="save enable-on-change">✔</button>
    <p>
    {% for field in forms.out %}
    {{ field.label_tag  }} : {{ field }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/{{ field.name }}/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_out-{{ field.name }}"
      title="Ajouter un {{ field.label.lower }}"
      type="button">+</button>
    {% endfor %}
    </p>
    <input type="hidden"  name="tab"  value="1">
  </div>
</form>

<form method="post" id="family-form" class="patientrecordform">
  {% csrf_token %}
  <div class="frame inline">
    <h3>Famille</h3>
    <button class="save enable-on-change">✔</button>
    <p>
    {% for field in forms.family %}
    {{ field.errors }}
    {% endfor %}
    </p>
    <p>
    {{ forms.family.sibship_place.label_tag  }} : {{ forms.family.sibship_place }}
    {{ forms.family.nb_children_family.label_tag  }} : {{ forms.family.nb_children_family }}
    <label>Rang (gémellité) :  </label> {{ object.twinning_rank|default_if_none:"Aucun" }}
    </p>
    <p>
    {{ forms.family.parental_authority.label_tag  }} : {{ forms.family.parental_authority }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/parentalauthoritytype/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-parental_authority"
      title="Ajouter un type d'autorité parentale">+</button>
    {{ forms.family.family_situation.label_tag  }} : {{ forms.family.family_situation }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/familysituationtype/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-family_situation"
      title="Ajouter un type de situation familiale">+</button>
    {{ forms.family.child_custody.label_tag  }} : {{ forms.family.child_custody }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/parentalcustodytype/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-child_custody"
      title="Ajouter un type de garde parentale">+</button>
    {{ forms.family.job_mother.label_tag  }} : {{ forms.family.job_mother }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/job/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-job_mother"
      title="Ajouter un type de profession">+</button>
    {{ forms.family.job_father.label_tag  }} : {{ forms.family.job_father }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/job/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-job_father"
      title="Ajouter un type de profession">+</button>
    {{ forms.family.rm_mother.label_tag  }} : {{ forms.family.rm_mother }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/maritalstatustype/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-rm_mother"
      title="Ajouter un type de régime">+</button>
    {{ forms.family.rm_father.label_tag  }} : {{ forms.family.rm_father }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/maritalstatustype/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_family-rm_father"
      title="Ajouter un type de régime">+</button>
    </p>
    <p>
    {{ forms.family.family_comment.label_tag  }} : {{ forms.family.family_comment }}
    </p>
    <input type="hidden"  name="tab"  value="1">
  </div>
</form>

<form method="post" id="transport-form" class="patientrecordform">
  {% csrf_token %}
  <div class="frame inline">
    <h3>Transport</h3>
    <button class="save enable-on-change">✔</button>
    <p>
    {% for field in forms.transport %}
    {{ field.label_tag  }} : {{ field }}
    <button type="button"
      class="dialog-button"
      data-url="../../ressources/{{ field.name }}/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_transport-{{ field.name }}"
      title="Ajouter {% if field.label.lower == "type de transport" %}un{% else %}une{% endif %} {{ field.label.lower }}">+</button>
    {% endfor %}
    </p>
<!--    <table>-->
<!--      <tr><td><button type="button">Attestation</button></td> <td><button type="button">Prescription</td></tr>-->
<!--        <tr><td>Dernière attestation le 25/07/2012 <button>Historique</button></td>-->
<!--          <td>Dernière prescription le 25/07/2012 <button>Historique</button></td></tr>-->
<!--      </table>-->
<!--      <input type="hidden"  name="tab"  value="1">-->
    </div>
  </form>

  <form method="post" id="followup-form" class="patientrecordform">{% csrf_token %}
    <div class="frame inline">
      <h3>Suivi du patient</h3>
      <button class="save enable-on-change">✔</button>
      <p>
      {{ forms.followup.coordinators.label_tag  }} : {{ forms.followup.coordinators }}
      </p>
      <p>
      {{ forms.followup.externaldoctor.label_tag  }} : {{ forms.followup.externaldoctor }}
    <button type="button"
      class="dialog-button"
      data-url="../../personnes/externaltherapist/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_followup-externaldoctor"
      title="Ajouter un médecin extérieur">+</button>
      {{ forms.followup.externalintervener.label_tag  }} : {{ forms.followup.externalintervener }}
    <button type="button"
      class="dialog-button"
      data-url="../../personnes/externalworker/new/ #form-content"
      data-default-button="Ajouter"
      data-next-url="{{ request.get_full_path }}#tab=1"
      data-add-select="#id_followup-externalintervener"
      title="Ajouter un intervenant extérieur">+</button>
    </div>
      </p>
      <input type="hidden"  name="tab"  value="1">
  </form>
