feat(correction): user can mark dossier en_construction as resolved

This commit is contained in:
Colin Darie 2023-04-11 18:31:16 +02:00
parent 8839ac7f76
commit a32014d4fd
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
7 changed files with 28 additions and 3 deletions

View file

@ -30,7 +30,7 @@
color: $dark-red; color: $dark-red;
} }
label, label:not(.fr-label),
legend.form-label { legend.form-label {
font-size: 18px; font-size: 18px;
margin-bottom: $default-padding; margin-bottom: $default-padding;

View file

@ -27,7 +27,8 @@ class Dossiers::EditFooterComponent < ApplicationComponent
{ {
class: 'fr-btn fr-btn--sm', class: 'fr-btn fr-btn--sm',
method: :post, method: :post,
data: { 'disable-with': t('.submitting'), controller: 'autosave-submit' } data: { 'disable-with': t('.submitting'), controller: 'autosave-submit' },
form: { id: "form-submit-en-construction" }
} }
end end

View file

@ -227,6 +227,10 @@ module Users
editing_fork_origin.merge_fork(@dossier) editing_fork_origin.merge_fork(@dossier)
RoutingEngine.compute(editing_fork_origin) RoutingEngine.compute(editing_fork_origin)
if cast_bool(params.dig(:dossier, :pending_correction_confirm))
editing_fork_origin.resolve_pending_correction!
end
redirect_to dossier_path(editing_fork_origin) redirect_to dossier_path(editing_fork_origin)
else else
flash.now.alert = errors flash.now.alert = errors

View file

@ -39,6 +39,12 @@
dossier.procedure.groupe_instructeurs.active.map { |gi| [gi.label, gi.id] }, dossier.procedure.groupe_instructeurs.active.map { |gi| [gi.label, gi.id] },
{ include_blank: dossier.brouillon? } { include_blank: dossier.brouillon? }
= render EditableChamp::SectionComponent.new(champs: dossier_for_editing.champs_public) = render EditableChamp::SectionComponent.new(champs: dossier_for_editing.champs_public)
- if dossier.pending_correction?
.fr-checkbox-group.fr-my-3w
= check_box_tag field_name(:dossier, :pending_correction_confirm), "1", false, form: "form-submit-en-construction"
%label.fr-label{ for: :dossier_pending_correction_confirm }= t('views.shared.dossiers.edit.pending_correction.confirm_label')
= render Dossiers::EditFooterComponent.new(dossier: dossier_for_editing, annotation: false) = render Dossiers::EditFooterComponent.new(dossier: dossier_for_editing, annotation: false)

View file

@ -332,6 +332,8 @@ en:
autosave: Your file is automatically saved after each modification. You can close the window at any time and pick up where you left off later. autosave: Your file is automatically saved after each modification. You can close the window at any time and pick up where you left off later.
notice: "Download the notice of the procedure" notice: "Download the notice of the procedure"
notice_title: "To help you complete your file, you can consult the notice to this procedure." notice_title: "To help you complete your file, you can consult the notice to this procedure."
pending_correction:
confirm_label: I certify that I have made all corrections requested by the administration.
messages: messages:
form: form:
send_message: "Send message" send_message: "Send message"

View file

@ -332,6 +332,8 @@ fr:
autosave: Votre dossier est enregistré automatiquement après chaque modification. Vous pouvez à tout moment fermer la fenêtre et reprendre plus tard là où vous en étiez. autosave: Votre dossier est enregistré automatiquement après chaque modification. Vous pouvez à tout moment fermer la fenêtre et reprendre plus tard là où vous en étiez.
notice: Télécharger le guide de la démarche notice: Télécharger le guide de la démarche
notice_title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." notice_title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche."
pending_correction:
confirm_label: Je certifie avoir effectué toutes les corrections demandées par ladministration.
messages: messages:
form: form:
send_message: "Envoyer le message" send_message: "Envoyer le message"

View file

@ -513,6 +513,16 @@ describe Users::DossiersController, type: :controller do
expect(flash.alert).to eq("Les modifications ont déjà été déposées") expect(flash.alert).to eq("Les modifications ont déjà été déposées")
end end
end end
context "when there are pending correction" do
let!(:correction) { create(:dossier_correction, dossier: dossier) }
subject { post :submit_en_construction, params: { id: dossier.id, dossier: { pending_correction_confirm: "1" } } }
it "resolve correction" do
expect { subject }.to change { correction.reload.resolved_at }.to be_truthy
end
end
end end
describe '#update brouillon' do describe '#update brouillon' do