Browse Source
* feat: add condition-less soft validation and update db * feat: add validation condition and update tests * feat: update validation * feat: update validation * feat: add tests * db: update * test: update * refactor: linting * test: update * feat: update text, remove separate redundant function, add value check page everywhere * feat: leave value check at end * test: update * feat: add value check everywhere * tests: update * db:update * feat: only appear at end * test: update * feat: add soft validation everywhere smoothly * test: updatepull/1169/head
natdeanlewissoftwire
2 years ago
committed by
GitHub
12 changed files with 148 additions and 17 deletions
@ -0,0 +1,21 @@
|
||||
class Form::Sales::Pages::ExtraBorrowingValueCheck < Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@depends_on = [ |
||||
{ |
||||
"extra_borrowing_expected_but_not_reported?" => true, |
||||
}, |
||||
] |
||||
@title_text = { |
||||
"translation" => "soft_validations.extra_borrowing.title", |
||||
} |
||||
@informative_text = { |
||||
} |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::ExtraBorrowingValueCheck.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,23 @@
|
||||
class Form::Sales::Questions::ExtraBorrowingValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super(id, hsh, page) |
||||
@id = "extrabor_value_check" |
||||
@check_answer_label = "Extra borrowing confirmation" |
||||
@type = "interruption_screen" |
||||
@answer_options = { |
||||
"0" => { "value" => "Yes" }, |
||||
"1" => { "value" => "No" }, |
||||
} |
||||
@hidden_in_check_answers = { |
||||
"depends_on" => [ |
||||
{ |
||||
"extrabor_value_check" => 0, |
||||
}, |
||||
{ |
||||
"extrabor_value_check" => 1, |
||||
}, |
||||
], |
||||
} |
||||
@header = "Are you sure there is no extra borrowing?" |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddExtraBorrowingValueCheckToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :extrabor_value_check, :integer |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue