Merge pull request #9930 from demarches-simplifiees/add-external-link-to-procedure

ETQ admin lorsque je clos une démarche je peux alerter les usagers et je crée une page de fermeture si la démarche n'est pas redirigée dans DS
This commit is contained in:
Colin Darie 2024-03-12 15:03:30 +00:00 committed by GitHub
commit ee92668611
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 721 additions and 47 deletions

View file

@ -8,15 +8,21 @@
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
%h1= t('administrateurs.procedures.close.page_title')
%p= t('administrateurs.procedures.close.replacement_procedure_title')
= render Dsfr::CalloutComponent.new(title: t("administrateurs.procedures.close.replacement_procedure_callout_title"), icon: "fr-fi-information-line") do |c|
- c.with_body do
= t('administrateurs.procedures.close.replacement_procedure_callout_content')
= form_tag admin_procedure_archive_path(@procedure), method: :put do
= form_for @procedure, url: admin_procedure_archive_path(@procedure), method: :put, html: { "data-controller" => "closing-reason" } do |f|
.fr-select-group
= f.label :closing_reason, class: 'fr-label'
= f.select :closing_reason, options_for_select(@closing_reason_options), {}, { class: 'fr-select', "data-closing-reason-target" => "closingReason" }
- if @published_procedures.present?
.fr-select-group
= label_tag :new_procedure, class: 'fr-label' do
= t('activerecord.attributes.procedure.new_procedure')
= t('utils.no_mandatory')
= select_tag :new_procedure, options_for_select(@published_procedures), include_blank: true, class: 'fr-select'
.fr-select-group#js_replaced_by_procedure_id{ "data-closing-reason-target" => "replacedByProcedureId" }
= f.label :replaced_by_procedure_id, class: 'fr-label'
= f.select :replaced_by_procedure_id, options_for_select(@published_procedures), { include_blank: "Sélectionnez la nouvelle démarche" }, { class: 'fr-select' }
.fr-input-group#js_closing_details{ "data-closing-reason-target" => "closingDetails" }
= render Dsfr::InputComponent.new(form: f, attribute: :closing_details, input_type: :text_area, opts: { rows: '10', placeholder: t('activerecord.attributes.procedure.hints.closing_details_placeholder')}, required: false)
= submit_tag t('administrateurs.procedures.close.actions.close_procedure'), { class: "fr-btn", id: 'publish', data: { confirm: "Voulez-vous vraiment clore la démarche ? \nLes dossiers en cours pourront être instruits, mais aucun nouveau dossier ne pourra plus être déposé.", disable_with: "Archivage..."} }

View file

@ -0,0 +1,52 @@
= render partial: 'administrateurs/breadcrumbs',
locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)],
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],[t('administrateurs.procedures.close.page_title')]],
metadatas: true }
.fr-container
.fr-grid-row
.fr-col-12.fr-col-offset-md-2.fr-col-md-8
%h1= t('administrateurs.procedures.closing_notification.page_title')
- if @procedure.closing_reason == Procedure.closing_reasons.fetch(:other)
%h2.fr-h5= I18n.t('administrateurs.procedures.closing_notification.page_subtitle', closing_path: closing_details_path(@procedure.path)).html_safe
- else
%h2.fr-h5= I18n.t('administrateurs.procedures.closing_notification.page_subtitle_with_redirection', redirection_path: commencer_path(@procedure.replaced_by_procedure.path)).html_safe
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: 'fr-mb-2w') do |c|
- c.with_body do
%p
= t('administrateurs.procedures.closing_notification.callout_content')
= form_for @procedure,
url: admin_procedure_notify_after_closing_path(@procedure),
method: :post,
html: { "data-controller" => "closing-notification" } do |f|
%div{ data: { 'action': "click->closing-notification#enableSubmitOnClick" } }
- if @users_brouillon_count != 0
= render Dsfr::ToggleComponent.new(form: f,
target: :closing_notification_brouillon,
title: t("administrateurs.procedures.closing_notification.email_toggle_brouillon", count: @users_brouillon_count),
toggle_labels: {checked: 'Oui', unchecked: 'Non'},
opt: {"closing-notification-target" => "brouillonToggle"})
.fr-input-group{ "data-closing-notification-target" => "emailContentBrouillon" }
= label_tag :email_content_brouillon, t("administrateurs.procedures.closing_notification.email_content_brouillon"), class: "fr-label"
= text_area_tag :email_content_brouillon, '', class: "fr-input"
- if @users_en_cours_count != 0
= render Dsfr::ToggleComponent.new(form: f,
target: :closing_notification_en_cours,
title: t("administrateurs.procedures.closing_notification.email_toggle_en_cours", count: @users_en_cours_count),
toggle_labels: {checked: 'Oui', unchecked: 'Non'},
opt: {"closing-notification-target" => "enCoursToggle"})
.fr-input-group{ "data-closing-notification-target" => "emailContentEnCours" }
= label_tag :email_content_en_cours, t("administrateurs.procedures.closing_notification.email_content_en_cours"), class: "fr-label"
= text_area_tag :email_content_en_cours, '', class: "fr-input"
%ul.fr-btns-group.fr-btns-group--inline-md
%li
= submit_tag t('administrateurs.procedures.close.actions.notify_after_closing'), { class: "fr-btn", id: 'publish', disabled: true, data: { confirm: "Vous allez informer les usagers de la clôture de la démarche. Souhaitez-vous continuer ?", disable_with: "Envoi des notifications…", 'closing-notification-target': 'submit'} }
%li
= link_to t('administrateurs.procedures.close.actions.cancel'), admin_procedures_path, class: 'fr-btn fr-btn--secondary fr-ml-2w'

View file

@ -47,6 +47,24 @@
- if !@procedure.procedure_expires_when_termine_enabled?
= render partial: 'administrateurs/procedures/suggest_expires_when_termine', locals: { procedure: @procedure }
- if @procedure.close?
.fr-container
= render Dsfr::AlertComponent.new(title: 'cette démarche est close', state: (:warning), heading_level: 'h2', extra_class_names: 'fr-my-2w') do |c|
- c.with_body do
%p
Les dossiers en cours peuvent être instruits, mais aucun nouveau dossier ne peut plus être déposé.
- if @procedure.closing_reason == 'internal_procedure'
- new_procedure = Procedure.find_by(id: @procedure.replaced_by_procedure_id)
%p
= "Cette démarche est remplacée par une autre démarche dans Démarches simplifiées :"
= link_to(new_procedure&.libelle, admin_procedure_path(new_procedure))
- if @procedure.closing_reason == 'other'
%p
= "Plus d'informations dans la #{link_to('page de fermeture', closing_details_path(@procedure.path))}, visible par les usagers."
- if @procedure.closing_notification_brouillon? || @procedure.closing_notification_en_cours?
= "Un email a été envoyé pour informer les usagers le #{ l(@procedure.closed_at.to_date) }"
.fr-container
%h2= "Gestion de la démarche № #{@procedure.id}"
%h3.fr-h6 Indispensable avant publication

View file

@ -0,0 +1,16 @@
- procedure = @procedure || @dossier&.procedure || nil
- content_for :content do
.fr-container.fr-mt-5w
.fr-grid-row
.fr-col-12.fr-col-md-8.fr-col-offset-md-2
.procedure-preview.fr-mb-5w
= yield
- content_for :footer do
- if procedure
= render partial: 'users/procedure_footer', locals: { procedure: procedure, dossier: @dossier }
- else
= render partial: 'application/footer'
= render template: 'layouts/application'

View file

@ -0,0 +1,4 @@
- content_for(:title, @subject)
%p
= simple_format(@content)

View file

@ -0,0 +1,11 @@
- content_for(:title, @procedure.libelle)
.fr-container
.fr-grid-row
.fr-col-12
%h1= t('commencer.closing_details.page_title', libelle: @procedure.libelle, closed_at: @procedure.closed_at.strftime('%d/%m/%Y'))
%p
= format_text_value(@procedure.closing_details)
.text-center
= image_tag('landing/hero/dematerialiser.svg', "aria-hidden": true)

View file

@ -54,7 +54,14 @@
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: "fr-mb-2w") do |c|
- c.with_body do
%p
= t('views.users.dossiers.dossiers_list.procedure_closed')
- if dossier.brouillon? && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:internal_procedure)
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.brouillon.internal_procedure', link: commencer_path(dossier.procedure.replaced_by_procedure.path)).html_safe
- elsif dossier.brouillon? && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:other)
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.brouillon.other', link: closing_details_path(dossier.procedure.path)).html_safe
- elsif (dossier.en_construction? || dossier.en_instruction?) && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:internal_procedure)
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.en_cours.internal_procedure')
- elsif (dossier.en_construction? || dossier.en_instruction?) && dossier.procedure.closing_reason == Procedure.closing_reasons.fetch(:other)
= I18n.t('views.users.dossiers.dossiers_list.procedure_closed.en_cours.other', link: closing_details_path(dossier.procedure.path)).html_safe
- if dossier.pending_correction?
= render Dsfr::AlertComponent.new(state: :warning, size: :sm, extra_class_names: "fr-mb-2w") do |c|

View file

@ -14,7 +14,7 @@
= render partial: "users/dossiers/replacement_procedure", locals: { replacement_procedure: dossier.procedure.replaced_by_procedure }
%p
= t('users.dossiers.header.banner.contact_service', service_name: dossier.procedure.service.nom, service_phone_number: dossier.procedure.service.telephone, service_email: dossier.procedure.service.email)
= t('users.dossiers.header.banner.contact_service_html', service_name: dossier.procedure.service.nom, service_phone_number: Phonelib.parse(dossier.procedure.service.telephone_url).full_national, service_email: dossier.procedure.service.email)
- if !dossier.brouillon?
= render(partial: 'users/dossiers/show/print_dossier', locals: { dossier: dossier })