9 changed files with 188 additions and 35 deletions
@ -0,0 +1,22 @@
|
||||
class Form::Lettings::Pages::ReasonotherValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "reasonother_value_check" |
||||
@depends_on = [{ "reasonother_might_be_existing_category?" => true }] |
||||
@title_text = { |
||||
"translation" => "soft_validations.reasonother.title_text", |
||||
"arguments" => [{ "key" => "reasonother", "i18n_template" => "reasonother" }], |
||||
} |
||||
@informative_text = "The reason you have entered looks very similar to one of the existing response categories. |
||||
Please check the categories and select the appropriate one. |
||||
If the existing categories are not suitable, please confirm here to move onto the next question." |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::ReasonotherValueCheck.new(nil, nil, self)] |
||||
end |
||||
|
||||
def interruption_screen_question_ids |
||||
%w[reason reasonother] |
||||
end |
||||
end |
||||
@ -0,0 +1,13 @@
|
||||
class Form::Lettings::Questions::ReasonotherValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "reasonother_value_check" |
||||
@check_answer_label = "Reason other confirmation" |
||||
@header = "Are you sure this doesn’t fit an existing category?" |
||||
@type = "interruption_screen" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@hidden_in_check_answers = { "depends_on" => [{ "reasonother_value_check" => 0 }, { "reasonother_value_check" => 1 }] } |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze |
||||
end |
||||
@ -0,0 +1,5 @@
|
||||
class AddReasonotherValueCheckToLettingsLogs < ActiveRecord::Migration[7.0] |
||||
def change |
||||
add_column :lettings_logs, :reasonother_value_check, :integer |
||||
end |
||||
end |
||||
Loading…
Reference in new issue