aemo_fr/templates/aemo/famille_edit.html

166 lines
7.7 KiB
HTML
Raw Normal View History

2024-06-03 16:49:01 +02:00
{% extends "base.html" %}
{% block boutons_droite %}
{% if form.instance.pk %}
{% include 'aemo/famille_boutons.html' with active='coordonnees' %}
{% endif %}
{% endblock %}
{% block content %}
<div class="row border-bottom mt-3 mb-5 lead">
{% if form.instance.pk %}
<div class="col">Famille {{ famille.nom }} - {{ famille.adresse }}</div>
<div class="col text-end">
Informations générales
<a href="{{ famille.print_coords_url }}"><img class="icon" src="{% static 'img/printer.png' %}"></a>
</div>
{% else %}
<div class="col">Nouvelle famille</div>
{% endif %}
</div>
<form name="FamilleForm" method="post">{% csrf_token %}
<div class="row mb-3 justify-content-center">
<div class="col-6">
{% for hidden in subform.hidden_fields %}{{ hidden }}{% endfor %}
<table class="table table-sm table-borderless">
{% for field in form.visible_fields %}
<tr>
<td>{{ field.label_tag }}</td>
<td>{{ field.errors }}{{ field }}</td>
</tr>
{% if form.instance.pk and not form.readonly and field.name == "localite" %}
<tr>
<td colspan="2" class="text-end">
<a class="btn btn-sm btn-outline-primary"
href="{% url 'famille-adresse-change' famille.pk %}">
Changer ladresse
</a>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
</div>
{% if form.instance.pk %}
<div class="col-6">
<p class="h5 border-bottom pt-2">Parents et personnes significatives
{% if famille|can_edit:user and form.instance.pk %}
<a class="btn btn-outline-primary btn-sm ms-3" role="button"
href="{{ famille.add_person_url }}?role=ps">Ajouter pers. sign.
</a>
{% endif %}
</p>
{% with parents=famille.parents %}
<table class="table table-sm table-borderless">
{% for parent in parents %}
<tr><td width="100px">{{ parent.role }}:</td>
<td><a href="{{ parent.edit_url }}">{{ parent.nom_prenom }}</a> - {{ parent.adresse }} {% if parent.telephone %}/ {{ parent.telephone}}{% endif %}</td>
</tr>
{% endfor %}
{% if parents|length < 2 %}
<tr>
<td colspan="2">
<a class="btn btn-outline-primary btn-sm ml-3" role="button"
href="{% url 'personne-add' famille.pk %}?role=parent">Ajouter parent</a>
</td>
</tr>
{% endif %}
</table>
{% endwith %}
<table class="table table-sm table-borderless">
{% for person in famille.autres_parents %}
<tr {% if membre.decedee %}class="decedee"{% endif %}>
<td width="100px">{{ person.role }}:</td>
<td><a href="{{ person.edit_url }}">{{ person.nom_prenom }}</a>
{% if person.adresse %}- {{ person.adresse }}{% endif %}
{% if person.telephone %} / {{ person.telephone }}{% endif %}
</td>
</tr>
{% endfor %}
</table>
<!-- Enfants non suivis -->
<p class="h5 border-bottom pt-2">Enfants non-suivis
{% if famille|can_edit:user %}
{% if form.instance.pk %}
<a class="btn btn-outline-primary btn-sm ms-3" role="button"
href="{{ famille.add_person_url }}?role={{ enfant_non_suivi.pk }}">Ajouter
</a>
{% endif %}
{% endif %}
</p>
<table class="table table-sm table-borderless">
{% for membre in famille.enfants_non_suivis %}
<tr {% if membre.decedee %}class="decedee"{% endif %}>
<td><a href="{{ membre.edit_url }}">{{ membre.nom_prenom }}</a><br>
{{ membre.age_str }}</td>
<td>{{ membre.adresse }}</td>
<td>{{ membre.formation.get_statut_display }}</td>
</tr>
{% endfor %}
</table>
<!-- Enfants suivis -->
<p class="h5 border-bottom pt-2">Enfants suivis
{% if famille|can_edit:user %}
{% if form.instance.pk %}
<a class="btn btn-outline-primary btn-sm ms-3" role="button"
href="{{ famille.add_person_url }}?role={{ enfant_suivi.pk }}">Ajouter</a>
{% endif %}
{% endif %}
</p>
<div class="row no-gutters">
<table class="table table-sm table-borderless">
{% for membre in famille.membres_suivis %}
<tr>
<td width="40%">
<div class="ms-1">
<a href="{{ membre.edit_url }}"
title="{{ membre.formation.info_scol }}">{{ membre.nom_prenom }}</a>
{% if membre.formation %}
<a href="{% url 'formation' membre.pk %}" title="Formation">
<img src="{% static 'img/formation.png' %}" class="icon">
</a>
<a href="{% url 'personne-reseau-list' membre.pk %}" title="Réseau">
<img src="{% static 'img/reseau.png' %}" class="icon">
</a>
{% endif %}
<br>
{{ membre.age_str }}
</div>
</td>
<td width="40%">{{ membre.adresse }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endif %}
</div>
<div class="row mb-3 justify-content-center">
{% if view.archive_url %}
<div class="col mt-3">
<button class="btn btn-sm btn-danger" type="button"
data-confirm="Voulez-vous vraiment archiver cette famille ?"
formaction="{{ view.archive_url }}"
>Archiver</button>
</div>
{% elif view.unarchive_url %}
<div class="col-1 mt-4">
<button class="btn btn-sm btn-warning confirm" type="button"
data-confirm="Voulez-vous vraiment désarchiver cette famille ?"
formaction="{{ view.unarchive_url }}"
>Désarchiver</button>
</div>
{% endif %}
<div class="col">
{% if not form.instance.pk or not form.readonly %}
{% include "actions.html" %}
{% endif %}
</div>
</div>
</form>
{% endblock %}