feat(procedure): add closing details page
This commit is contained in:
parent
facb38b539
commit
d800213920
7 changed files with 38 additions and 5 deletions
|
@ -78,6 +78,11 @@ module Users
|
||||||
current_user ? :user : :guest
|
current_user ? :user : :guest
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def closing_details
|
||||||
|
@procedure = Procedure.find_by(path: params[:path])
|
||||||
|
render 'closing_details', layout: 'closing_details'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def extra_query_params
|
def extra_query_params
|
||||||
|
@ -136,9 +141,8 @@ module Users
|
||||||
redirect_to commencer_path(procedure.replaced_by_procedure.path, **extra_query_params)
|
redirect_to commencer_path(procedure.replaced_by_procedure.path, **extra_query_params)
|
||||||
return
|
return
|
||||||
elsif procedure&.close?
|
elsif procedure&.close?
|
||||||
flash.alert = procedure.service.presence ?
|
redirect_to closing_details_path(procedure.path)
|
||||||
t('errors.messages.procedure_archived.with_service_and_phone_email', service_name: procedure.service.nom, service_phone_number: procedure.service.telephone, service_email: procedure.service.email) :
|
return
|
||||||
t('errors.messages.procedure_archived.with_organisation_only', organisation_name: procedure.organisation)
|
|
||||||
else
|
else
|
||||||
flash.alert = t('errors.messages.procedure_not_found')
|
flash.alert = t('errors.messages.procedure_not_found')
|
||||||
end
|
end
|
||||||
|
|
16
app/views/layouts/closing_details.html.haml
Normal file
16
app/views/layouts/closing_details.html.haml
Normal 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'
|
8
app/views/users/commencer/closing_details.html.haml
Normal file
8
app/views/users/commencer/closing_details.html.haml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
- 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)
|
|
@ -21,3 +21,5 @@ en:
|
||||||
other: "Your last %{count} created files :"
|
other: "Your last %{count} created files :"
|
||||||
already_created_details_html:
|
already_created_details_html:
|
||||||
"N° %{id}, created %{created_at} ago and %{state}"
|
"N° %{id}, created %{created_at} ago and %{state}"
|
||||||
|
closing_details:
|
||||||
|
page_title: "Procedure %{libelle} is closed since %{closed_at}"
|
||||||
|
|
|
@ -21,3 +21,5 @@ fr:
|
||||||
other: "Vos %{count} derniers dossiers créés :"
|
other: "Vos %{count} derniers dossiers créés :"
|
||||||
already_created_details_html:
|
already_created_details_html:
|
||||||
"N° %{id}, créé il y a %{created_at} et %{state}"
|
"N° %{id}, créé il y a %{created_at} et %{state}"
|
||||||
|
closing_details:
|
||||||
|
page_title: "La démarche %{libelle} est close depuis le %{closed_at}"
|
||||||
|
|
|
@ -382,6 +382,7 @@ Rails.application.routes.draw do
|
||||||
post 'accept_merge' => 'profil#accept_merge'
|
post 'accept_merge' => 'profil#accept_merge'
|
||||||
post 'refuse_merge' => 'profil#refuse_merge'
|
post 'refuse_merge' => 'profil#refuse_merge'
|
||||||
delete 'france_connect_information' => 'profil#destroy_fci'
|
delete 'france_connect_information' => 'profil#destroy_fci'
|
||||||
|
get 'fermeture/:path', to: 'commencer#closing_details', as: :closing_details
|
||||||
end
|
end
|
||||||
|
|
||||||
get 'procedures/:id/logo', to: 'procedures#logo', as: :procedure_logo
|
get 'procedures/:id/logo', to: 'procedures#logo', as: :procedure_logo
|
||||||
|
|
|
@ -42,7 +42,7 @@ describe Users::CommencerController, type: :controller do
|
||||||
published_procedure.organisation = "hello"
|
published_procedure.organisation = "hello"
|
||||||
published_procedure.close!
|
published_procedure.close!
|
||||||
get :commencer, params: { path: published_procedure.path }
|
get :commencer, params: { path: published_procedure.path }
|
||||||
expect(response).to redirect_to(root_path)
|
expect(response).to redirect_to(closing_details_path(published_procedure.path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ describe Users::CommencerController, type: :controller do
|
||||||
published_procedure.service = create(:service)
|
published_procedure.service = create(:service)
|
||||||
published_procedure.close!
|
published_procedure.close!
|
||||||
get :commencer, params: { path: published_procedure.path }
|
get :commencer, params: { path: published_procedure.path }
|
||||||
expect(response).to redirect_to(root_path)
|
expect(response).to redirect_to(closing_details_path(published_procedure.path))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue