Skip to content

Commit

Permalink
create component to display deleted dossiers
Browse files Browse the repository at this point in the history
  • Loading branch information
lisa-durand authored and tchak committed Jul 30, 2024
1 parent dcb5d0f commit 2902a2f
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 63 deletions.
11 changes: 11 additions & 0 deletions app/components/dossiers/deleted_dossiers_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Dossiers::DeletedDossiersComponent < ApplicationComponent
include DossierHelper

Check warning on line 2 in app/components/dossiers/deleted_dossiers_component.rb

View check run for this annotation

Codecov / codecov/patch

app/components/dossiers/deleted_dossiers_component.rb#L1-L2

Added lines #L1 - L2 were not covered by tests

def initialize(deleted_dossiers:)
@deleted_dossiers = deleted_dossiers
end

Check warning on line 6 in app/components/dossiers/deleted_dossiers_component.rb

View check run for this annotation

Codecov / codecov/patch

app/components/dossiers/deleted_dossiers_component.rb#L4-L6

Added lines #L4 - L6 were not covered by tests

def role
controller.try(:nav_bar_profile)
end
end

Check warning on line 11 in app/components/dossiers/deleted_dossiers_component.rb

View check run for this annotation

Codecov / codecov/patch

app/components/dossiers/deleted_dossiers_component.rb#L8-L11

Added lines #L8 - L11 were not covered by tests
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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: L’utilisateur 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.
Original file line number Diff line number Diff line change
@@ -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')
30 changes: 1 addition & 29 deletions app/views/instructeurs/procedures/deleted_dossiers.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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 L’utilisateur 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)
35 changes: 1 addition & 34 deletions app/views/users/dossiers/deleted_dossiers.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 2902a2f

Please sign in to comment.