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;
}
label,
label:not(.fr-label),
legend.form-label {
font-size: 18px;
margin-bottom: $default-padding;

View file

@ -27,7 +27,8 @@ class Dossiers::EditFooterComponent < ApplicationComponent
{
class: 'fr-btn fr-btn--sm',
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

View file

@ -227,6 +227,10 @@ module Users
editing_fork_origin.merge_fork(@dossier)
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)
else
flash.now.alert = errors

View file

@ -39,6 +39,12 @@
dossier.procedure.groupe_instructeurs.active.map { |gi| [gi.label, gi.id] },
{ include_blank: dossier.brouillon? }
= 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)

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.
notice: "Download the notice of the 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:
form:
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.
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."
pending_correction:
confirm_label: Je certifie avoir effectué toutes les corrections demandées par ladministration.
messages:
form:
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")
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
describe '#update brouillon' do