[Fix #2145] When procedure is archived, usager should see a message explaining dossier submission is closed
This commit is contained in:
parent
9afbd16bbf
commit
e694e7f9b9
7 changed files with 123 additions and 33 deletions
|
@ -5,6 +5,7 @@
|
||||||
padding: ($default-spacer * 3) ($default-spacer * 2);
|
padding: ($default-spacer * 3) ($default-spacer * 2);
|
||||||
border: 1px solid $border-grey;
|
border: 1px solid $border-grey;
|
||||||
margin-bottom: $default-spacer * 2;
|
margin-bottom: $default-spacer * 2;
|
||||||
|
background: #FFFFFF;
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -14,4 +14,8 @@ module DossierHelper
|
||||||
"highlighted"
|
"highlighted"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dossier_submission_is_closed?(dossier)
|
||||||
|
dossier.brouillon? && dossier.procedure.archivee?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,35 +15,38 @@
|
||||||
= h string_to_html(@dossier.procedure.description)
|
= h string_to_html(@dossier.procedure.description)
|
||||||
|
|
||||||
.column.identity-form
|
.column.identity-form
|
||||||
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
|
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
|
||||||
%h1 Données d'identité
|
|
||||||
|
|
||||||
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
|
- if !dossier_submission_is_closed?(@dossier)
|
||||||
|
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
|
||||||
|
%h1 Données d'identité
|
||||||
|
|
||||||
%label
|
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
|
||||||
%span.mandatory *
|
|
||||||
champs requis
|
|
||||||
|
|
||||||
= f.label :gender, class: "required"
|
%label
|
||||||
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
|
|
||||||
|
|
||||||
.flex
|
|
||||||
.inline-champ
|
|
||||||
= f.label :prenom, class: "required"
|
|
||||||
= f.text_field :prenom, class: "small", required: true
|
|
||||||
.inline-champ
|
|
||||||
= f.label :nom, class: "required"
|
|
||||||
= f.text_field :nom, class: "small", required: true
|
|
||||||
|
|
||||||
- if @dossier.procedure.ask_birthday?
|
|
||||||
= f.label :birthdate, class: "required"
|
|
||||||
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
|
|
||||||
|
|
||||||
= fields_for :dossier, @dossier do |df|
|
|
||||||
= label_tag do
|
|
||||||
= df.check_box :autorisation_donnees, required: true
|
|
||||||
J'accepte
|
|
||||||
= link_to "les CGU", CGU_URL, target: :blank
|
|
||||||
%span.mandatory *
|
%span.mandatory *
|
||||||
|
champs requis
|
||||||
|
|
||||||
= f.submit "Continuer", class: "button large primary expand"
|
= f.label :gender, class: "required"
|
||||||
|
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
|
||||||
|
|
||||||
|
.flex
|
||||||
|
.inline-champ
|
||||||
|
= f.label :prenom, class: "required"
|
||||||
|
= f.text_field :prenom, class: "small", required: true
|
||||||
|
.inline-champ
|
||||||
|
= f.label :nom, class: "required"
|
||||||
|
= f.text_field :nom, class: "small", required: true
|
||||||
|
|
||||||
|
- if @dossier.procedure.ask_birthday?
|
||||||
|
= f.label :birthdate, class: "required"
|
||||||
|
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
|
||||||
|
|
||||||
|
= fields_for :dossier, @dossier do |df|
|
||||||
|
= label_tag do
|
||||||
|
= df.check_box :autorisation_donnees, required: true
|
||||||
|
J'accepte
|
||||||
|
= link_to "les CGU", CGU_URL, target: :blank
|
||||||
|
%span.mandatory *
|
||||||
|
|
||||||
|
= f.submit "Continuer", class: "button large primary expand"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
.container
|
.container
|
||||||
|
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
|
||||||
|
|
||||||
- if notice_url(dossier.procedure).present?
|
- if notice_url(dossier.procedure).present?
|
||||||
%p
|
%p
|
||||||
Pour vous aider à remplir votre dossier, vous pouvez consulter
|
Pour vous aider à remplir votre dossier, vous pouvez consulter
|
||||||
|
@ -58,7 +60,7 @@
|
||||||
class: 'button send',
|
class: 'button send',
|
||||||
data: { action: 'draft', disable_with: 'Envoi...' }
|
data: { action: 'draft', disable_with: 'Envoi...' }
|
||||||
|
|
||||||
- if current_user.owns?(dossier)
|
- if current_user.owns?(dossier) && dossier.can_transition_to_en_construction?
|
||||||
= f.button 'Soumettre le dossier',
|
= f.button 'Soumettre le dossier',
|
||||||
class: 'button send primary',
|
class: 'button send primary',
|
||||||
data: { action: 'submit', disable_with: 'Envoi...' }
|
data: { action: 'submit', disable_with: 'Envoi...' }
|
||||||
|
@ -67,3 +69,5 @@
|
||||||
= f.button 'Enregistrer les modifications du dossier',
|
= f.button 'Enregistrer les modifications du dossier',
|
||||||
class: 'button send primary',
|
class: 'button send primary',
|
||||||
data: { action: 'submit', disable_with: 'Envoi...' }
|
data: { action: 'submit', disable_with: 'Envoi...' }
|
||||||
|
|
||||||
|
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
|
||||||
|
|
8
app/views/shared/dossiers/_submit_is_over.html.haml
Normal file
8
app/views/shared/dossiers/_submit_is_over.html.haml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
- if dossier_submission_is_closed?(dossier)
|
||||||
|
.card.featured
|
||||||
|
.card-title
|
||||||
|
Le dépôt de dossier est fermé
|
||||||
|
- if dossier.procedure.archived_at.present?
|
||||||
|
Il n'est plus possible de déposer de dossier pour cette démarche en ligne depuis le #{dossier.procedure.archived_at.strftime("%d/%m/%Y")}.
|
||||||
|
- else
|
||||||
|
Il n'est plus possible de déposer de dossier pour cette démarche en ligne.
|
|
@ -233,12 +233,25 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates the champs' do
|
context 'when dossier can be updated by the owner' do
|
||||||
subject
|
it 'updates the champs' do
|
||||||
|
subject
|
||||||
|
|
||||||
expect(response).to redirect_to(merci_dossier_path(dossier))
|
expect(response).to redirect_to(merci_dossier_path(dossier))
|
||||||
expect(first_champ.reload.value).to eq('beautiful value')
|
expect(first_champ.reload.value).to eq('beautiful value')
|
||||||
expect(dossier.reload.state).to eq('en_construction')
|
expect(dossier.reload.state).to eq('en_construction')
|
||||||
|
end
|
||||||
|
|
||||||
|
context "on an archived procedure" do
|
||||||
|
before { dossier.procedure.archive }
|
||||||
|
|
||||||
|
it "it does not change state" do
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect(response).not_to redirect_to(merci_dossier_path(dossier))
|
||||||
|
expect(dossier.reload.state).to eq('brouillon')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sends an email only on the first #update' do
|
it 'sends an email only on the first #update' do
|
||||||
|
|
|
@ -25,4 +25,61 @@ RSpec.describe DossierHelper, type: :helper do
|
||||||
it { is_expected.to eq nil }
|
it { is_expected.to eq nil }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe ".dossier_submission_is_closed?" do
|
||||||
|
let(:dossier) { create(:dossier, state: state) }
|
||||||
|
let(:state) { "brouillon" }
|
||||||
|
|
||||||
|
subject { dossier_submission_is_closed?(dossier) }
|
||||||
|
|
||||||
|
context "when dossier state is brouillon" do
|
||||||
|
it { is_expected.to be false }
|
||||||
|
|
||||||
|
context "when dossier state is brouillon and procedure is archivee" do
|
||||||
|
before { dossier.procedure.archive }
|
||||||
|
|
||||||
|
it { is_expected.to be true }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for "returns false" do
|
||||||
|
it { is_expected.to be false }
|
||||||
|
|
||||||
|
context "and procedure is archivee" do
|
||||||
|
before { dossier.procedure.archive }
|
||||||
|
|
||||||
|
it { is_expected.to be false }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when dossier state is en_construction" do
|
||||||
|
let(:state) { "en_construction" }
|
||||||
|
|
||||||
|
it_behaves_like "returns false"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when dossier state is en_construction" do
|
||||||
|
let(:state) { "en_instruction" }
|
||||||
|
|
||||||
|
it_behaves_like "returns false"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when dossier state is en_construction" do
|
||||||
|
let(:state) { "accepte" }
|
||||||
|
|
||||||
|
it_behaves_like "returns false"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when dossier state is en_construction" do
|
||||||
|
let(:state) { "refuse" }
|
||||||
|
|
||||||
|
it_behaves_like "returns false"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when dossier state is en_construction" do
|
||||||
|
let(:state) { "sans_suite" }
|
||||||
|
|
||||||
|
it_behaves_like "returns false"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue