2023-05-25 19:09:59 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Procedure::SVASVRFormComponent < ApplicationComponent
|
|
|
|
attr_reader :procedure, :configuration
|
|
|
|
|
|
|
|
def initialize(procedure:, configuration:)
|
|
|
|
@procedure = procedure
|
|
|
|
@configuration = configuration
|
|
|
|
end
|
|
|
|
|
2023-06-02 18:34:46 +02:00
|
|
|
def form_disabled?
|
|
|
|
return false if procedure.brouillon?
|
2024-04-18 16:03:31 +02:00
|
|
|
return true if !procedure.feature_enabled?(:sva)
|
2023-06-02 18:34:46 +02:00
|
|
|
|
|
|
|
procedure.sva_svr_enabled?
|
|
|
|
end
|
|
|
|
|
2023-05-25 19:09:59 +02:00
|
|
|
def decision_buttons
|
|
|
|
scope = ".decision_buttons"
|
|
|
|
|
|
|
|
[
|
2023-06-21 12:37:21 +02:00
|
|
|
{ label: t("disabled", scope:), value: "disabled", disabled: form_disabled? },
|
2023-05-25 19:09:59 +02:00
|
|
|
{ label: t("sva", scope:), value: "sva", hint: t("sva_hint", scope:) },
|
2023-07-27 17:35:01 +02:00
|
|
|
{ label: t("svr", scope:), value: "svr", hint: t("svr_hint", scope:) }
|
2023-05-25 19:09:59 +02:00
|
|
|
]
|
|
|
|
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
|