create component to display deleted dossiers

This commit is contained in:
Lisa Durand 2024-07-24 16:36:47 +02:00
parent 5281ab966a
commit 286758e933
No known key found for this signature in database
GPG key ID: 0DF91F2CA1E8B816
6 changed files with 74 additions and 63 deletions

View file

@ -0,0 +1,11 @@
class Dossiers::DeletedDossiersComponent < ApplicationComponent
include DossierHelper
def initialize(deleted_dossiers:)
@deleted_dossiers = deleted_dossiers
end
def role
controller.try(:nav_bar_profile)
end
end

View file

@ -0,0 +1,7 @@
en:
deleted_explanation: "The folders have been deleted. You can no longer recover them for the following reasons:"
deleted_explanation_first_instructor: The user intentionally deleted their folder.
deleted_explanation_second_instructor: The maximum retention period has expired. In accordance with GDPR regulations, the application cannot continue to host them.
deleted_explanation_first_user: You have deleted your folder.
deleted_explanation_second_user: The maximum retention period has expired. In accordance with GDPR regulations, the application cannot continue to host them.
no_deleted_folders: You have no permanently deleted folders.

View file

@ -0,0 +1,7 @@
fr:
deleted_explanation: "Les dossiers ont été supprimés. Vous ne pouvez plus les récupérer pour les raisons suivantes :"
deleted_explanation_first_instructeur: Lutilisateur a intentionnellement supprimé son dossier.
deleted_explanation_second_instructeur: Le délai de conservation maximal a expiré. Conformément au règlement RGPD, l'application ne peut continuer à les héberger.
deleted_explanation_first_user: Vous avez supprimé votre dossier.
deleted_explanation_second_user: Le délai de conservation maximal a expiré. Conformément au règlement RGPD, l'application ne peut continuer à les héberger.
no_deleted_dossiers: Vous n'avez pas de dossiers supprimés définitivement.

View file

@ -0,0 +1,47 @@
.fr-container
%h1.fr-h2
Historique des dossiers supprimés
.fr-container
- if @deleted_dossiers.present?
= render Dsfr::CalloutComponent.new(title: nil) do |c|
- c.with_body do
%p
= t('.deleted_explanation')
%ul
%li
= t(".deleted_explanation_first_#{role}")
%li
= t(".deleted_explanation_second_#{role}")
.fr-table.fr-table--layout-fixed.fr-mt-3w
%table
%thead
%tr
%th.number-col N° dossier
%th Libellé de la démarche
%th Raison de suppression
%th Date de suppression
%tbody
- @deleted_dossiers.each do |deleted_dossier|
%tr
%td.number-col
= deleted_dossier.dossier_id
%td.number-col
= deleted_dossier.procedure.libelle.truncate_words(10)
%td
= deletion_reason_badge(deleted_dossier.reason)
-# .fr-badge
-# = t("activerecord.attributes.deleted_dossier.reason.#{deleted_dossier.reason}")
%td.deleted-cell
= l(deleted_dossier.deleted_at, format: '%d/%m/%y')
= paginate @deleted_dossiers, views_prefix: 'shared'
- else
%p
= t('.no_deleted_dossiers')

View file

@ -7,33 +7,5 @@
.fr-container
.fr-mb-3w
= link_to "Retour à la démarche", instructeur_procedure_path(@procedure), class: "fr-link fr-icon-arrow-left-line fr-link--icon-left"
%h1.titre-dossiers Historique des dossiers supprimés
- if @deleted_dossiers.any?
= render Dsfr::CalloutComponent.new(title: nil) do |c|
- c.with_body do
%p Les dossiers ont été supprimés. Vous ne pouvez plus les récupérer depuis Démarches Simplifiées.
Ceci s'explique pour les raisons suivantes :
%ul
%li Lutilisateur a intentionnellement supprimé son dossier.
%li Le délai de conservation maximal de #{@procedure.duree_conservation_dossiers_dans_ds} mois a expiré. Conformément au règlement RGPD, DS ne peut continuer à les héberger.
= paginate @deleted_dossiers, views_prefix: 'shared'
.fr-table.fr-table--layout-fixed.fr-mt-3w
%table
%thead
%tr
%th.number-col N° dossier
%th Raison de suppression
%th Date de suppression
%tbody
- @deleted_dossiers.each do |deleted_dossier|
%tr
%td.number-col
= deleted_dossier.dossier_id
%td
= deletion_reason_badge(deleted_dossier.reason)
%td.deleted-cell
= l(deleted_dossier.deleted_at, format: '%d/%m/%y')
= paginate @deleted_dossiers, views_prefix: 'shared'
- else
Aucun dossier supprimé
= render Dossiers::DeletedDossiersComponent.new(deleted_dossiers: @deleted_dossiers)

View file

@ -3,37 +3,4 @@
= render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Historique des dossiers supprimés']] }
.fr-container
%h1.fr-h2
Historique des dossiers supprimés
.fr-container
- if @deleted_dossiers.present?
%h2.fr-h6.fr-mb-2w
= page_entries_info @deleted_dossiers
- @deleted_dossiers.each do |dossier|
.card
.flex.justify-between
%div
%h3.card-title
= dossier.procedure.libelle
%p.fr-icon--sm.fr-icon-delete-line.fr-mb-0
= t('views.users.dossiers.dossiers_list.deleted', date: l(dossier.updated_at.to_date))
= "-"
= t("activerecord.attributes.deleted_dossier.reason.#{dossier.reason}")
.text-right
%p.fr-mb-0
= t('views.users.dossiers.dossiers_list.n_dossier')
= dossier.dossier_id
= paginate @deleted_dossiers, views_prefix: 'shared'
- else
.blank-tab
%h2.empty-text= t('views.users.dossiers.dossiers_list.no_result_title')
%p.empty-text-details
= t('views.users.dossiers.dossiers_list.no_result_text_html', app_base: Current.application_base_url)
= render Dossiers::DeletedDossiersComponent.new(deleted_dossiers: @deleted_dossiers)