Browse Source

feat: wip po updates

pull/1259/head
natdeanlewissoftwire 3 years ago
parent
commit
f653805677
  1. 5
      app/models/form/sales/pages/handover_date_check.rb
  2. 18
      app/models/form/sales/pages/sale_date_check.rb
  3. 2
      app/models/form/sales/questions/handover_date_check.rb
  4. 23
      app/models/form/sales/questions/sale_date_check.rb
  5. 2
      app/models/form/sales/subsections/setup.rb
  6. 2
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  7. 2
      app/models/validations/sales/soft_validations.rb
  8. 2
      config/locales/en.yml

5
app/models/form/sales/pages/handover_date_check.rb

@ -1,8 +1,13 @@
class Form::Sales::Pages::HandoverDateCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "handover_date_check"
@depends_on = [{ "hodate_3_years_or_more_saledate?" => true }]
@informative_text = {}
@title_text = {
"translation" => "validations.sale_information.hodate.must_be_less_than_3_years_from_saledate",
"arguments" => [],
}
end
def questions

18
app/models/form/sales/pages/sale_date_check.rb

@ -0,0 +1,18 @@
class Form::Sales::Pages::SaleDateCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "sale_date_check"
@depends_on = [{ "hodate_3_years_or_more_saledate?" => true }]
@informative_text = {}
@title_text = {
"translation" => "validations.sale_information.saledate.must_be_less_than_3_years_from_hodate",
"arguments" => [],
}
end
def questions
@questions ||= [
Form::Sales::Questions::SaleDateCheck.new(nil, nil, self),
]
end
end

2
app/models/form/sales/questions/handover_date_check.rb

@ -3,7 +3,7 @@ class Form::Sales::Questions::HandoverDateCheck < ::Form::Question
super
@id = "hodate_check"
@check_answer_label = "Practical completion or handover date check"
@header = "Are you sure practical completion or handover date is more than 3 years before exchange date?"
@header = "Are you sure?"
@type = "interruption_screen"
@answer_options = {
"0" => { "value" => "Yes" },

23
app/models/form/sales/questions/sale_date_check.rb

@ -0,0 +1,23 @@
class Form::Sales::Questions::SaleDateCheck < ::Form::Question
def initialize(id, hsh, page)
super
@id = "hodate_check"
@check_answer_label = "Completion date check"
@header = "Are you sure?"
@type = "interruption_screen"
@answer_options = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}
@hidden_in_check_answers = {
"depends_on" => [
{
"hodate_check" => 0,
},
{
"hodate_check" => 1,
},
],
}
end
end

2
app/models/form/sales/subsections/setup.rb

@ -10,7 +10,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection
Form::Common::Pages::Organisation.new(nil, nil, self),
Form::Common::Pages::CreatedBy.new(nil, nil, self),
Form::Sales::Pages::SaleDate.new(nil, nil, self),
Form::Sales::Pages::HandoverDateCheck.new("handover_date_sale_date_check", nil, self),
# Form::Sales::Pages::SaleDateCheck.new(nil, nil, self),
Form::Sales::Pages::PurchaserCode.new(nil, nil, self),
Form::Sales::Pages::OwnershipScheme.new(nil, nil, self),
Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self),

2
app/models/form/sales/subsections/shared_ownership_scheme.rb

@ -15,7 +15,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::Resale.new(nil, nil, self),
Form::Sales::Pages::ExchangeDate.new(nil, nil, self),
Form::Sales::Pages::HandoverDate.new(nil, nil, self),
Form::Sales::Pages::HandoverDateCheck.new("handover_date_check", nil, self),
Form::Sales::Pages::HandoverDateCheck.new(nil, nil, self),
Form::Sales::Pages::LaNominations.new(nil, nil, self),
Form::Sales::Pages::BuyerPrevious.new(nil, nil, self),
Form::Sales::Pages::PreviousBedrooms.new(nil, nil, self),

2
app/models/validations/sales/soft_validations.rb

@ -67,7 +67,7 @@ module Validations::Sales::SoftValidations
def hodate_3_years_or_more_saledate?
return unless hodate && saledate
((saledate.to_date - hodate.to_date).to_i / 365) >= 3
saledate - hodate >= 3.years
end
def grant_outside_common_range?

2
config/locales/en.yml

@ -426,12 +426,14 @@ en:
rent_to_buy: "Rent to Buy buyers should not have lived here before"
hodate:
must_be_before_saledate: "Practical completion or handover date must be before exchange date"
must_be_less_than_3_years_from_saledate: "You told us practical completion or handover date is more than 3 years before completion date"
exdate:
must_be_before_saledate: "Contract exchange date must be before completion date"
must_be_less_than_1_year_from_saledate: "Contract exchange date must be less than 1 year before completion date"
saledate:
must_be_after_exdate: "Completion date must be after contract exchange date"
must_be_less_than_1_year_from_exdate: "Completion date must be less than 1 year after contract exchange date"
must_be_less_than_3_years_from_hodate: "You told us completion date is more than 3 years after practical completion or handover date"
must_be_after_hodate: "Completion date must be after practical completion or handover date"
previous_property_beds:
property_type_bedsit: "Bedsit bedroom maximum 1"

Loading…
Cancel
Save