forked from demarches-simplifiees/demarches-simplifiees.fr
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/import-2023-07-11'
- Loading branch information
Showing
93 changed files
with
1,834 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
class Dsfr::RadioButtonListComponent < ApplicationComponent | ||
def initialize(form:, target:, buttons:) | ||
attr_reader :error | ||
|
||
def initialize(form:, target:, buttons:, error: nil) | ||
@form = form | ||
@target = target | ||
@buttons = buttons | ||
@error = error | ||
end | ||
|
||
def error? | ||
# TODO: mettre correctement le aria-labelled-by avec l'id du div qui contient les erreurs | ||
# https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bouton-radio/ | ||
@error.present? | ||
end | ||
|
||
def each_button | ||
@buttons.each do |button| | ||
yield(*button.values_at(:label, :value, :hint), **button.except(:label, :value, :hint)) | ||
end | ||
end | ||
end |
16 changes: 11 additions & 5 deletions
16
app/components/dsfr/radio_button_list_component/radio_button_list_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
%fieldset.fr-fieldset{ 'aria-labelledby': 'radio-hint-element-legend radio-hint-element-messages' } | ||
%fieldset{ class: class_names("fr-fieldset": true, "fr-fieldset--error": error?), 'aria-labelledby': 'radio-hint-element-legend radio-hint-element-messages', role: error? ? :group : nil } | ||
%legend.fr-fieldset__legend--regular.fr-fieldset__legend | ||
= content | ||
- @buttons.map { _1.values_at(:label, :value, :hint) }.each do |label, value, hint| | ||
- each_button do |label, value, hint, **button_options| | ||
.fr-fieldset__element | ||
.fr-radio-group | ||
= @form.radio_button @target, value | ||
= @form.radio_button @target, value, **button_options | ||
= @form.label @target, value: value, class: 'fr-label' do | ||
- capture do | ||
= label | ||
%span.fr-hint-text= hint | ||
.fr-messages-group{ 'aria-live': 'assertive' } | ||
= button_options[:after_label] if button_options[:after_label] | ||
%span.fr-hint-text= hint if hint | ||
.fr-messages-group{ 'aria-live': 'assertive' } | ||
- if error? | ||
%p.fr-message.fr-message--error= error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/components/instructeurs/sva_svr_decision_badge_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
class Instructeurs::SVASVRDecisionBadgeComponent < ApplicationComponent | ||
attr_reader :object | ||
attr_reader :procedure | ||
attr_reader :with_label | ||
|
||
def initialize(projection_or_dossier:, procedure:, with_label: false) | ||
@object = projection_or_dossier | ||
@procedure = procedure | ||
@decision = procedure.sva_svr_configuration.decision.to_sym | ||
@with_label = with_label | ||
end | ||
|
||
def render? | ||
return false unless procedure.sva_svr_enabled? | ||
|
||
[:en_construction, :en_instruction].include? object.state.to_sym | ||
end | ||
|
||
def without_date? | ||
object.sva_svr_decision_on.nil? | ||
end | ||
|
||
def classes | ||
class_names( | ||
'fr-badge fr-badge--sm': true, | ||
'fr-badge--warning': soon?, | ||
'fr-badge--info': !soon? | ||
) | ||
end | ||
|
||
def soon? | ||
object.sva_svr_decision_on < 7.days.from_now.to_date | ||
end | ||
|
||
def pending_correction? | ||
object.pending_correction? | ||
end | ||
|
||
def days_count | ||
(object.sva_svr_decision_on - Date.current).to_i | ||
end | ||
|
||
def sva? | ||
@decision == :sva | ||
end | ||
|
||
def svr? | ||
@decision == :svr | ||
end | ||
|
||
def label_for_badge | ||
sva? ? "SVA :" : "SVR :" | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
...nts/instructeurs/sva_svr_decision_badge_component/sva_svr_decision_badge_component.en.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
en: | ||
no_sva: Submitted before SVA | ||
no_svr: Submitted before SVR | ||
in_days: | ||
zero: Today | ||
one: Tomorrow | ||
other: in %{count} days | ||
remaining_days_after_correction: | ||
other: "%{count} d. after correction" |
10 changes: 10 additions & 0 deletions
10
...nts/instructeurs/sva_svr_decision_badge_component/sva_svr_decision_badge_component.fr.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
fr: | ||
no_sva: Déposé avant SVA | ||
no_svr: Déposé avant SVR | ||
in_days: | ||
zero: Aujourd’hui | ||
one: Demain | ||
other: dans %{count} jours | ||
remaining_days_after_correction: | ||
other: "%{count} j. après correction" |
11 changes: 11 additions & 0 deletions
11
.../instructeurs/sva_svr_decision_badge_component/sva_svr_decision_badge_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- if without_date? | ||
%span.fr-badge.fr-badge--sm | ||
= t(sva? ? '.no_sva' : '.no_svr') | ||
- else | ||
%span{ class: classes } | ||
- if with_label.present? | ||
= label_for_badge | ||
- if pending_correction? | ||
= t('.remaining_days_after_correction', count: days_count) | ||
- else | ||
= t('.in_days', count: days_count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class Procedure::Card::SVASVRComponent < ApplicationComponent | ||
def initialize(procedure:) | ||
@procedure = procedure | ||
end | ||
end |
4 changes: 4 additions & 0 deletions
4
app/components/procedure/card/sva_svr_component/sva_svr_component.en.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
en: | ||
ready: "Configuré" | ||
needs_configuration: "À configurer" |
6 changes: 6 additions & 0 deletions
6
app/components/procedure/card/sva_svr_component/sva_svr_component.fr.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
fr: | ||
title: "Silence Vaut Accord" | ||
subtitle: "Accepter ou Refuser un dossier après un délai" | ||
ready: "Configuré" | ||
needs_configuration: "À configurer" |
14 changes: 14 additions & 0 deletions
14
app/components/procedure/card/sva_svr_component/sva_svr_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.fr-col-6.fr-col-md-4.fr-col-lg-3 | ||
= link_to edit_admin_procedure_sva_svr_path(@procedure), class: 'fr-tile fr-enlarge-link', id: 'sva' do | ||
.fr-tile__body.flex.justify-between | ||
- if @procedure.sva_svr_enabled? | ||
%div | ||
%span.icon.accept | ||
%p.fr-tile-status-accept= t('.ready') | ||
- else | ||
%div | ||
%span.icon.clock | ||
%p.fr-tile-status-todo= t('.needs_configuration') | ||
%h3.fr-h6.fr-mt-10v= t('.title') | ||
%p.fr-tile-subtitle= t('.subtitle') | ||
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.edit') |
2 changes: 1 addition & 1 deletion
2
app/components/procedure/notice_component/notice_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
- if link? | ||
= link_to url, t(".name"), class: "fr-download__link", title: new_tab_suffix(t(".name")), **external_link_attributes | ||
= link_to url, t(".name"), class: "fr-download__link", title: helpers.new_tab_suffix(t(".name")), **helpers.external_link_attributes | ||
- elsif attachment? | ||
= render Dsfr::DownloadComponent.new(attachment:, name: t(".name"), ephemeral_link: helpers.administrateur_signed_in?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
class Procedure::SVASVRFormComponent < ApplicationComponent | ||
attr_reader :procedure, :configuration | ||
|
||
def initialize(procedure:, configuration:) | ||
@procedure = procedure | ||
@configuration = configuration | ||
end | ||
|
||
def form_disabled? | ||
return false if procedure.brouillon? | ||
|
||
procedure.sva_svr_enabled? | ||
end | ||
|
||
def decision_buttons | ||
scope = ".decision_buttons" | ||
|
||
[ | ||
{ label: t("disabled", scope:), value: "disabled", disabled: form_disabled? }, | ||
{ label: t("sva", scope:), value: "sva", hint: t("sva_hint", scope:) }, | ||
{ label: t("svr", scope:), value: "svr", hint: t("svr_hint", scope:), disabled: true, after_label: tag.span("Disponible prochainement", class: "fr-badge fr-badge--sm fr-ml-1w") } | ||
] | ||
end | ||
|
||
def resume_buttons | ||
scope = ".resume_buttons" | ||
|
||
[ | ||
{ | ||
value: "continue", | ||
label: t("continue_label", scope: scope), | ||
hint: t("continue_hint", scope: scope) | ||
}, | ||
{ | ||
value: "reset", | ||
label: t("reset_label", scope: scope), | ||
hint: t("reset_hint", scope: scope) | ||
} | ||
] | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
app/components/procedure/sva_svr_form_component/sva_svr_form_component.en.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
en: | ||
rule: Rule to apply | ||
delay: Configuration of the delay before decision | ||
unit_labels: | ||
months: months | ||
weeks: weeks | ||
days: days | ||
resume_method: How to calculate the delay when the applicant resubmits their corrected file? | ||
resume_intro: | | ||
When an instructor asks for a file to be corrected, the countdown of the delay is interrupted. | ||
The delay resumes when the applicant resubmits their file stating that they have made the requested corrections. | ||
If the file has been declared incomplete, the delay will be reset, regardless of the configuration below. | ||
submit: Apply SVA/SVR configuration | ||
cancel: Cancel | ||
decision_buttons: | ||
disabled: "Disabled" | ||
sva: "Silence Equals Acceptation (SVA)" | ||
sva_hint: "A file is automatically accepted if no instructor has pronounced before the allotted time" | ||
svr: "Silence Equals Rejection (SVR)" | ||
svr_hint: "A file is automatically rejected if no instructor has pronounced before the allotted time" | ||
resume_buttons: | ||
continue_label: "Resume countdown from where it stopped" | ||
continue_hint: "Example: if the instructor requests corrections to a complete file with 10 days to go before the automatic decision, and the file is resubmitted on April 15, it will be automatically accepted on April 25, unless the instructor makes a decision by then or requests corrections again. On the other hand, if the inspector asks for the file to be completed, the deadline will be reset." | ||
reset_label: "Reset the delay" | ||
reset_hint: "Example: if the file is resubmitted on April 15 and the delay is 2 months, the decision will be automatically made on June 15, unless the instructor pronounces in the meantime or asks for corrections again." | ||
notice_new_files_only: "Information: if you activate this rule, only the newly submitted files will be subject to it." | ||
notice_edit_denied: "Warning: SVA/SVR cannot be changed or disabled." |
28 changes: 28 additions & 0 deletions
28
app/components/procedure/sva_svr_form_component/sva_svr_form_component.fr.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
fr: | ||
rule: Règle à appliquer | ||
delay: Configuration du délai avant décision | ||
unit_labels: | ||
months: mois | ||
weeks: semaines | ||
days: jours | ||
resume_method: Comment calculer le délai lorsque le demandeur re-dépose son dossier corrigé ? | ||
resume_intro: | | ||
Lorsqu’un instructeur demande de corriger un dossier, le décompte du délai est interrompu. | ||
Le délai reprend lorsque le demandeur redépose son dossier en déclarant avoir effectué les corrections demandées. | ||
Si le dossier avait été déclaré incomplet, le délai sera réinitialisé, quelle que soit la configuration ci-dessous. | ||
submit: Appliquer la configuration SVA/SVR | ||
cancel: Annuler | ||
decision_buttons: | ||
disabled: "Désactivé" | ||
sva: "Silence Vaut Accord" | ||
sva_hint: "Un dossier est automatiquement accepté si aucun n’instructeur ne s’est prononcé avant le délai imparti" | ||
svr: "Silence Vaut Rejet" | ||
svr_hint: "Un dossier est automatiquement refusé si aucun n’instructeur ne s’est prononcé avant le délai imparti" | ||
resume_buttons: | ||
continue_label: "Reprendre le décompte depuis le moment où il s’était arrêté" | ||
continue_hint: "Exemple: si l’instructeur demande des corrections d’un dossier complet alors qu’il reste 10 jours avant la décision automatique, et que le dossier est re-déposé le 15 avril, il sera automatiquement accepté le 25 avril, sauf à ce que l’instructeur se prononce d’ici là ou demande à nouveau des corrections. En revanche si l’instructeur demande à compléter le dossier, le délai sera réinitialisé." | ||
reset_label: "Réinitialiser le délai" | ||
reset_hint: "Exemple: si le dossier est re-déposé le 15 avril et que le délai est de 2 mois, la décision sera automatiquement prise le 15 juin, sauf à ce que l’instructeur se prononce d’ici là ou demande à nouveau des corrections." | ||
notice_new_files_only: "Information : si vous activez cette règle, seuls les nouveaux dossiers déposés y seront soumis." | ||
notice_edit_denied: "Avertissement : le changement ou la désactivation du SVA/SVR est impossible." |
Oops, something went wrong.