Skip to content

Commit

Permalink
Filter GPS results by beneficiary name
Browse files Browse the repository at this point in the history
  • Loading branch information
celine-m-s committed Jul 8, 2024
1 parent 244c0d6 commit ee67206
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 245 deletions.
134 changes: 134 additions & 0 deletions itou/templates/gps/includes/memberships_results.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{% load str_filters %}

<section aria-labelledby="results" id="follow-up-groups-section">
{% if not memberships_page %}
<div class="my-3 my-md-4 s-box__row row membership-card">Aucun résultat.</div>
{% else %}
{% for membership in memberships_page %}
<div class="my-3 my-md-4 s-box__row row membership-card">
<div class="c-box--results__header">

<div class="c-box--results__summary">
<i class="ri-user-line" aria-hidden="true"></i>
<div>
<h3>{{ membership.follow_up_group.beneficiary.get_full_name }}</h3>
<span>{{ membership.follow_up_group.beneficiary.email }}</span>
</div>
</div>
</div>

<hr class="m-0 pb-4" />

<div class="d-flex justify-content-between mb-4">
<div>
{% with membership.nb_members|add:"-1" as counter %}
<div>
{% if not membership.created_in_bulk %}
<div>
{# djlint:off #}
{# Don't let djlint add a newline before the . or it will add a space after référent and . #}
Vous avez ajouté ce bénéficiaire le <strong>{{ membership.created_at|date:"d/m/Y" }}</strong>{% if membership.is_referent %} et êtes <strong>référent</strong>{% endif %}.{# djlint:on #}
</div>
{% elif membership.is_referent %}
<div>
Vous êtes <strong>référent</strong>.
</div>
{% endif %}
{% if counter < 1 %}
Aucun autre professionnel que vous n'est intervenu auprès de ce bénéficiaire.
{% else %}
{{ counter }} autre{{ counter|pluralizefr }} professionnel{{ counter|pluralizefr }}
{{ counter|pluralize:"est,sont" }}
intervenu{{ counter|pluralizefr }} auprès de ce bénéficiaire.
{% endif %}
</div>
{% endwith %}
</div>


</div>
<div class="d-flex justify-content-between">

{% with membership.follow_up_group.beneficiary.public_id as public_id %}
<div>

{% url 'gps:leave_group' group_id=membership.follow_up_group.id as leave_group_url %}
<a href="{% url 'users:details' public_id=public_id %}"
class="btn btn-warning btn-block w-100 w-md-auto btn-ico"
aria-label="Ne plus suivre {{ membership.follow_up_group.beneficiary.get_full_name }}"
data-bs-toggle="modal"
data-bs-target="#confirm_modal"
data-bs-title="Êtes-vous sûr de ne plus vouloir suivre {{ membership.follow_up_group.beneficiary.get_full_name }} ?"
data-bs-body="Vous pourrez toujours suivre ce bénéficiaire de nouveau plus tard."
data-bs-confirm-text="Ne plus suivre"
data-bs-confirm-url="{{ leave_group_url }}"
data-bs-confirm-class="btn-danger">
<i class="ri-user-unfollow-line" aria-hidden="true"></i>
<span>Ne plus suivre</span>

</a>


{% if membership.is_referent %}

{% url 'gps:toggle_referent' group_id=membership.follow_up_group.id as remove_referent_url %}
<a href="{% url 'users:details' public_id=membership.follow_up_group.beneficiary.public_id %}"
class="btn btn-warning btn-block w-100 w-md-auto btn-ico"
aria-label="Ne plus être référent de {{ membership.follow_up_group.beneficiary.get_full_name }}"
data-bs-toggle="modal"
data-bs-target="#confirm_modal"
data-bs-title="Êtes-vous sûr de ne plus vouloir être référent de {{ membership.follow_up_group.beneficiary.get_full_name }} ?"
data-bs-body="Vous pourrez toujours devenir référent de ce bénéficiaire plus tard."
data-bs-confirm-text="Ne plus être référent"
data-bs-confirm-url="{{ remove_referent_url }}"
data-bs-confirm-class="btn-danger">

<i class="ri-map-pin-user-line font-weight-normal me-1" aria-hidden="true"></i>
<span>Ne plus être référent</span>

</a>

{% endif %}
</div>


<div>
{% if not membership.is_referent %}
{% url 'gps:toggle_referent' group_id=membership.follow_up_group.id as add_referent_url %}

<a href="{% url 'users:details' public_id=membership.follow_up_group.beneficiary.public_id %}"
class="btn btn-outline-success btn-block w-100 w-md-auto btn-ico"
aria-label="Devenir référent de {{ membership.follow_up_group.beneficiary.get_full_name }}"
data-bs-toggle="modal"
data-bs-target="#confirm_modal"
data-bs-title="Êtes-vous sûr de vouloir devenir référent de {{ membership.follow_up_group.beneficiary.get_full_name }} ?"
data-bs-body="Vous pourrez toujours ne plus être référent de ce bénéficiaire plus tard."
data-bs-confirm-text="Devenir référent"
data-bs-confirm-url="{{ add_referent_url }}"
data-bs-confirm-class="btn-success">

<i class="ri-map-pin-user-line font-weight-normal me-1" aria-hidden="true"></i>
<span>Devenir référent</span>

</a>

{% endif %}
<a href="{% url 'users:details' public_id=membership.follow_up_group.beneficiary.public_id %}"
class="btn btn-outline-primary btn-block btn-ico w-100 w-md-auto"
aria-label="Consulter la fiche de {{ membership.follow_up_group.beneficiary.get_full_name }}">
<i class="ri-eye-line ri-xl font-weight-medium" aria-hidden="true"></i>
<span>Consulter la fiche</span>
</a>
</div>
{% endwith %}

</div>
</div>
{% endfor %}

<div class="mt-5">
{% include "includes/pagination.html" with page=memberships_page boost=True boost_target="#follow-up-groups-section" boost_indicator="#follow-up-groups-section" %}
</div>

{% endif %}
</section>
Loading

0 comments on commit ee67206

Please sign in to comment.