feat(svr): enablable from configuration

This commit is contained in:
Colin Darie 2023-07-27 17:35:01 +02:00
parent c9bde31ef2
commit 69e673e47e
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
3 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
---
fr:
title: "Silence Vaut Accord"
title: "Silence Vaut Accord ou Rejet"
subtitle: "Accepter ou Refuser un dossier après un délai"
ready: "Configuré"
needs_configuration: "À configurer"

View file

@ -20,7 +20,7 @@ class Procedure::SVASVRFormComponent < ApplicationComponent
[
{ 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") }
{ label: t("svr", scope:), value: "svr", hint: t("svr_hint", scope:) }
]
end

View file

@ -11,7 +11,7 @@ class SVASVRConfiguration
UNIT_OPTIONS = ['days', 'weeks', 'months']
RESUME_OPTIONS = ['continue', 'reset']
validates :decision, inclusion: { in: DECISION_OPTIONS.without('svr') }
validates :decision, inclusion: { in: DECISION_OPTIONS }
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? }