fix(sva): disable svr configuration since until implementation

This commit is contained in:
Colin Darie 2023-06-21 12:37:21 +02:00
parent f369775d5b
commit 07f10070e9
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 16 additions and 6 deletions

View file

@ -13,4 +13,10 @@ class Dsfr::RadioButtonListComponent < ApplicationComponent
# 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

View file

@ -2,14 +2,18 @@
%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
= 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

View file

@ -18,9 +18,9 @@ class Procedure::SVASVRFormComponent < ApplicationComponent
scope = ".decision_buttons"
[
{ label: t("disabled", scope:), value: "disabled" },
{ 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:) }
{ 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

View file

@ -11,7 +11,7 @@ class SVASVRConfiguration
UNIT_OPTIONS = ['days', 'weeks', 'months']
RESUME_OPTIONS = ['continue', 'reset']
validates :decision, inclusion: { in: DECISION_OPTIONS }
validates :decision, inclusion: { in: DECISION_OPTIONS.without('svr') }
validates :period, presence: true, numericality: { only_integer: true }, if: -> { enabled? }
validates :unit, presence: true, inclusion: { in: UNIT_OPTIONS }, if: -> { enabled? }
validates :resume, presence: true, inclusion: { in: RESUME_OPTIONS }, if: -> { enabled? }