Skip to content

Commit

Permalink
www.approvals_views: add new detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Sep 12, 2024
1 parent d25c029 commit 9186d2a
Show file tree
Hide file tree
Showing 4 changed files with 397 additions and 3 deletions.
4 changes: 4 additions & 0 deletions itou/templates/approvals/includes/box.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@
{% endif %}
{% endwith %}
{% endif %}
<a href="{% url 'approvals:details' pk=approval.pk %}" class="btn btn-outline-primary btn-block btn-ico bg-white mt-3">
<i class="ri-eye-line font-weight-medium" aria-hidden="true"></i>
<span>Afficher le PASS IAE</span>
</a>
</div>
283 changes: 283 additions & 0 deletions itou/templates/approvals/new_details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
{% extends "layout/base.html" %}
{% load matomo %}
{% load static %}
{% load str_filters %}
{% load format_filters %}

{% block title %}
PASS IAE de {{ approval.user.get_full_name|mask_unless:can_view_personal_information }} {{ block.super }}
{% endblock %}

{% block title_content %}
<div class="d-flex flex-column flex-md-row gap-3 justify-content-md-between">
<h1 class="m-0">PASS IAE de {{ approval.user.get_full_name|mask_unless:can_view_personal_information }}</h1>
<div class="d-flex flex-column flex-md-row gap-3" role="group" aria-label="Actions sur le PASS IAE">
{% if approval_deletion_form_url %}
<a href="{{ approval_deletion_form_url }}"
class="btn btn-lg btn-outline-warning btn-ico"
target="_blank"
rel="noopener"
aria-label="Mettre fin au PASS IAE de {{ approval.user.get_full_name|mask_unless:can_view_personal_information }}">
<i class="ri-pass-expired-line font-weight-medium" aria-hidden="true"></i>
<span>Clôturer ce PASS IAE</span>
</a>
{% endif %}
{% if request.user.is_employer %}
<a href="{% url 'approvals:display_printable_approval' approval_id=approval.pk %}" class="btn btn-lg btn-primary btn-ico">
<i class="ri-eye-line font-weight-medium" aria-hidden="true"></i>
<span>Afficher l’attestation</span>
</a>
{% endif %}
</div>
</div>
{% endblock %}

{% block title_prevstep %}
{% include "layout/previous_step.html" with back_url=back_url only %}
{% endblock %}

{% block content %}
<section class="s-section">
<div class="s-section__container container">
<div class="row">
<div class="col-12">
{# Should we try to reuse "approvals/includes/box.html" ? #}
<div class="c-box c-box--pass {% if approval.state == 'EXPIRED' %}bg-danger-lightest border-danger{% elif approval.state == 'SUSPENDED' %}bg-info-lightest border-info{% else %}bg-success-lightest border-success{% endif %} mb-3 mb-md-4">
<div class="mb-3 mb-md-4">
<span class="badge badge-base rounded-pill {% if approval.state == 'EXPIRED' %}bg-danger{% elif approval.state == 'SUSPENDED' %}bg-info{% else %}bg-success{% endif %} text-white">
<i class="{% if approval.state == 'EXPIRED' %}ri-pass-expired-line{% elif approval.state == 'SUSPENDED' %}ri-pass-pending-line{% else %}ri-pass-valid-line{% endif %}" aria-hidden="true"></i>
PASS IAE {{ approval.get_state_display.lower }}
</span>
</div>
<ul class="list-data list-data__two-column-md">
<li>
<small>Numéro de PASS IAE</small>
<strong>{{ approval.number|format_approval_number }}</strong>
</li>
{% if approval.state == "EXPIRED" %}
<li>
<small>A expiré le</small>
<strong class="text-danger">{{ approval.end_at|date:"d/m/Y" }}</strong>
</li>
{% else %}
<li>
<small>Date de début</small>
<strong>{{ approval.start_at|date:"d/m/Y" }}</strong>
</li>
<li>
<small>Durée de validité <i class="ri-information-line ri-xl text-info"
data-bs-toggle="tooltip"
data-bs-title="Le reliquat est calculé sur la base d’un nombre de jours calendaires. Si le PASS IAE n’est pas suspendu, il décroît donc tous les jours (samedi, dimanche et jours fériés compris)."></i></small>
<strong {% if approval.state == "VALID" or approval.state == "FUTURE" %}class="text-success"{% endif %}>{{ approval.get_remainder_display }}</strong>
</li>
<li>
<small>Date de fin prévisionnelle <i class="ri-information-line ri-xl text-info" data-bs-toggle="tooltip" data-bs-title="Cette date de fin est susceptible d’évoluer avec les éventuelles suspensions et prolongations du PASS IAE."></i></small>
<strong>{{ approval.remainder_as_date|date:"d/m/Y" }}</strong>
</li>
{% endif %}
</ul>
{% if approval.origin == ApprovalOrigin.PE_APPROVAL %}
<p class="fs-sm fst-italic mt-3">Ce PASS IAE a été importé depuis un agrément Pôle emploi.</p>
{% endif %}
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="c-box mb-3 mb-lg-5">
<div class="d-flex flex-column flex-md-row gap-3 justify-content-md-between">
<h2>Suspensions</h2>
<div class="d-flex flex-column flex-md-row gap-3" role="group" aria-label="Actions sur le PASS IAE">
{% if can_be_suspended_by_current_user %}
<a href="{% url 'approvals:suspend' approval_id=approval.id %}?back_url={{ request.get_full_path|urlencode }}"
class="btn btn-block btn-outline-primary btn-ico mt-3"
aria-label="Suspendre le PASS IAE de {{ approval.user.get_full_name|mask_unless:can_view_personal_information }}">
<i class="ri-pause-circle-line font-weight-medium" aria-hidden="true"></i>
<span>Suspendre</span>
</a>
{% elif request.user.is_employer %}
<button type="button"
class="btn btn-block btn-outline-primary btn-ico disabled"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="La suspension n’est pas possible car un autre employeur a embauché le candidat.">
<i class="ri-pause-circle-line font-weight-medium" aria-hidden="true"></i>
<span>Suspendre</span>
</button>
{% endif %}
</div>
</div>
{% if suspensions %}
<div class="mt-3 mt-md-4">
<table class="table">
<caption class="visually-hidden">Liste des suspensions</caption>
<thead>
<tr>
<th scope="col">Statut</th>
<th scope="col">Émetteur</th>
<th scope="col">Du</th>
<th scope="col">Jusqu’au</th>
<th scope="col">Motif</th>
<th scope="col" />
</tr>
</thead>
<tbody>
{% for suspension in suspensions %}
<tr>
<td>
{% if suspension.is_in_progress %}
<span class="badge badge-base rounded-pill bg-info">En cours</span>
{% else %}
<span class="badge badge-base rounded-pill bg-light text-primary">Passée</span>
{% endif %}
</td>
<td>
{% if suspension.siae %}
{{ suspension.siae.display_name }}
{% else %}
-
{% endif %}
</td>
<td>{{ suspension.start_at|date:"d/m/Y" }}</td>
<td>{{ suspension.end_at|date:"d/m/Y" }}</td>
<td>{{ suspension.get_reason_display }}</td>
<td>
{% if suspension.can_be_handled_by_current_user %}

<a href="{% url 'approvals:suspension_update' suspension_id=suspension.pk %}?back_url={{ request.get_full_path|urlencode }}" class="btn btn-ico-only">
<i class="ri-pencil-line font-weight-medium" aria-hidden="true" data-bs-toggle="tooltip" data-bs-title="Modifier la suspension"></i>
<span class="visually-hidden">Modifier la suspension</span>
</a>

<button id="dropdown_{{ forloop.counter }}_action_menu" class="btn btn-link btn-ico-only btn-sm" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="Plus d'actions">
<i class="ri-more-2-fill" aria-hidden="true"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdown_{{ forloop.counter }}_action_menu">
<a class="dropdown-item" href="{% url 'approvals:suspension_action_choice' suspension_id=suspension.pk %}?back_url={{ request.get_full_path|urlencode }}">Supprimer la suspension</a>
</div>

{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="fs-sm fst-italic">Aucune suspension enregistrée pour l’instant.</p>
{% endif %}
<div class="c-info">
<button class="c-info__summary collapsed" data-bs-toggle="collapse" data-bs-target="#collapseSuspensionInfo" aria-expanded="false" aria-controls="collapseSuspensionInfo">
<span>Comment gérer mes suspensions ?</span>
</button>
<div class="c-info__detail collapse" id="collapseSuspensionInfo">
<p>
Retrouvez toutes les informations sur le fonctionnement des suspensions sur notre
<a href="https://aide.emplois.inclusion.beta.gouv.fr/hc/fr/articles/14739233143953--Suspendre-un-PASS-IAE"
aria-label="Documentation sur le fonctionnement des suspensions (nouvel onglet)"
rel="noopener"
target="_blank">
<span>documentation</span>
<i class="ri-external-link-line ri-lg"></i>
</a>.
</p>
</div>
</div>
</div>

</div>
</div>
<div class="row">
<div class="col-12">
<div class="c-box mb-3 mb-lg-5">
<div class="d-flex flex-column flex-md-row gap-3 justify-content-md-between">
<h2>Prolongations</h2>
<div class="d-flex flex-column flex-md-row gap-3" role="group" aria-label="Actions sur le PASS IAE">
{% if can_be_prolonged_by_current_user %}
<a href="{% url 'approvals:declare_prolongation' approval_id=approval.id %}?back_url={{ request.get_full_path|urlencode }}"
class="btn btn-block btn-outline-primary btn-ico mt-3"
aria-label="Prolonger le PASS IAE de {{ approval.user.get_full_name|mask_unless:can_view_personal_information }}">
<i class="ri-refresh-line font-weight-medium" aria-hidden="true"></i>
<span>Prolonger</span>
</a>
{% elif request.user.is_employer %}
<button type="button"
class="btn btn-block btn-outline-primary btn-ico disabled"
data-bs-toggle="tooltip"
data-bs-placement="top"
{% if approval.is_valid %} title="Les prolongations ne sont possibles qu’entre le {{ approval.IS_OPEN_TO_PROLONGATION_BOUNDARIES_MONTHS_BEFORE_END }}ème mois avant la fin d’un PASS IAE et jusqu’à son dernier jour de validité." {% else %} title = "Il est impossible de faire une prolongation de PASS IAE expiré." {% endif %}>
<i class="ri-refresh-line font-weight-medium" aria-hidden="true"></i>
<span>Prolonger</span>
</button>
{% endif %}
</div>
</div>
{% if prolongations %}
<div class="mt-3 mt-md-4">
<table class="table">
<caption class="visually-hidden">Liste des prolongations</caption>
<thead>
<tr>
<th scope="col">Statut</th>
<th scope="col">Du</th>
<th scope="col">Jusqu’au</th>
<th scope="col">Motif</th>
<th scope="col">Validée par</th>
</tr>
</thead>
<tbody>
{% for prolongation in prolongations %}
<tr>
<td>
{% if prolongation.status %}
{# Prolongation request #}
{% if prolongation.status == "DENIED" %}
<span class="badge badge-base rounded-pill bg-danger-lighter text-danger">Refusée</span>
{% elif prolongation.status == "PENDING" %}
<span class="badge badge-base rounded-pill bg-accent-03-lighter text-primary">En attente</span>
{% endif %}
{% else %}
<span class="badge badge-base rounded-pill bg-success-lighter text-success">Acceptée</span>
{% endif %}
</td>
<td>{{ prolongation.start_at|date:"d/m/Y" }}</td>
<td>{{ prolongation.end_at|date:"d/m/Y" }}</td>
<td>{{ prolongation.get_reason_display }}</td>
<td>
{% if prolongation.validated_by %}
{{ prolongation.validated_by }}
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="fs-sm fst-italic">Aucune prolongation enregistrée pour l’instant.</p>
{% endif %}
<div class="c-info">
<button class="c-info__summary collapsed" data-bs-toggle="collapse" data-bs-target="#collapseProlongationInfo" aria-expanded="false" aria-controls="collapseProlongationInfo">
<span>Comment gérer mes prolongations ?</span>
</button>
<div class="c-info__detail collapse" id="collapseProlongationInfo">
<p>
Retrouvez toutes les informations sur le fonctionnement des prolongations sur notre
<a href="https://aide.emplois.inclusion.beta.gouv.fr/hc/fr/articles/14738994643217--Prolonger-un-PASS-IAE"
aria-label="Documentation sur le fonctionnement des prolongations (nouvel onglet)"
rel="noopener"
target="_blank">
<span>documentation</span>
<i class="ri-external-link-line ri-lg"></i>
</a>.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
Loading

0 comments on commit 9186d2a

Please sign in to comment.