From 5b4c3df54cf48464e6965a77b0720fa3631dc6d0 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 9 Oct 2023 22:53:35 +0200 Subject: [PATCH] feat: when previous dossiers exist, show a preview --- app/views/commencer/show.html.haml | 9 +++++++++ config/locales/en.yml | 5 +++++ config/locales/fr.yml | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/app/views/commencer/show.html.haml b/app/views/commencer/show.html.haml index 98e292f7d..f308ab076 100644 --- a/app/views/commencer/show.html.haml +++ b/app/views/commencer/show.html.haml @@ -54,6 +54,15 @@ %ul.fr-btns-group.fr-btns-group--inline %li= link_to t('views.commencer.show.show_dossiers'), dossiers_path(procedure_id: @procedure.id), class: "fr-btn" %li= link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: "fr-btn fr-btn--secondary" + - preview_dossiers = dossiers.order(created_at: :desc).limit(3) + %p= t('views.commencer.show.already_created', count: preview_dossiers.size) + %ul + - preview_dossiers.each do |dossier| + %li= link_to t('views.commencer.show.already_created_details_html', + id: number_with_html_delimiter(dossier.id), + created_at: time_ago_in_words(dossier.created_at), + state: dossier_display_state(dossier.state, lower: true)), + dossier_path(dossier) - if @procedure.feature_enabled?(:dossier_pdf_vide) diff --git a/config/locales/en.yml b/config/locales/en.yml index 12bd19c24..ebfb60103 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -225,6 +225,11 @@ en: show_my_submitted_file: 'Show my submitted file' want_empty_pdf: "You prefer to submit a paper form? You can download an empty PDF file, and send it to the right administration : %{service} - %{adresse}" download_empty_pdf: 'Download an empty PDF file' + already_created: + one: "Your previous file :" + other: "Your last %{count} created files :" + already_created_details_html: + "N° %{id}, created %{created_at} ago and %{state}" prefill_descriptions: edit: intro_html: "You'd like to allow your users to create a prefilled file, with data you already have, for the procedure « %{libelle} »." diff --git a/config/locales/fr.yml b/config/locales/fr.yml index aa32f67ba..b10404fb0 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -221,6 +221,11 @@ fr: show_my_submitted_file: 'Voir mon dossier déposé' want_empty_pdf: "Vous souhaitez effectuer une demande par papier ? Vous pouvez télécharger un dossier vide au format PDF, et l’envoyer à l’administration concernée : %{service} - %{adresse}" download_empty_pdf: 'Télécharger un dossier vide au format PDF' + already_created: + one: "Votre dernier dossier :" + other: "Vos %{count} derniers dossiers créés :" + already_created_details_html: + "N° %{id}, créé il y a %{created_at} et %{state}" prefill_descriptions: edit: intro_html: "Vous souhaitez permettre à vos usager·ères la création d'un dossier prérempli, à partir de données dont vous disposez déjà, pour la démarche « %{libelle} »."