Browse Source

feat: wip commit

CLDC-1790-sales-validation-content-updates
natdeanlewissoftwire 2 years ago
parent
commit
d32a7af439
  1. 2
      app/models/form/sales/questions/property_number_of_bedrooms.rb
  2. 8
      app/models/validations/sales/property_validations.rb
  3. 3
      config/locales/en.yml

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

@ -7,7 +7,5 @@ class Form::Sales::Questions::PropertyNumberOfBedrooms < ::Form::Question
@hint_text = "A bedsit has 1 bedroom" @hint_text = "A bedsit has 1 bedroom"
@type = "numeric" @type = "numeric"
@width = 10 @width = 10
@min = 1
@max = 9
end end
end end

8
app/models/validations/sales/property_validations.rb

@ -7,4 +7,12 @@ module Validations::Sales::PropertyValidations
record.errors.add :ppostcode_full, I18n.t("validations.property.postcode.must_match_previous") record.errors.add :ppostcode_full, I18n.t("validations.property.postcode.must_match_previous")
end end
end end
def validate_bedroom_number(record)
return unless record.beds
unless record.beds.between?(1, 9)
record.errors.add :beds, I18n.t("validations.property.beds.1_9")
end
end
end end

3
config/locales/en.yml

@ -195,6 +195,7 @@ en:
beds: beds:
non_positive: "Number of bedrooms has to be greater than 0" non_positive: "Number of bedrooms has to be greater than 0"
over_max: "Number of bedrooms cannot be more than 12" over_max: "Number of bedrooms cannot be more than 12"
1_9: "Bedroom number must be 1-9"
postcode: postcode:
must_match_previous: "Buyer's last accommodation and discounted ownership postcodes must match" must_match_previous: "Buyer's last accommodation and discounted ownership postcodes must match"
@ -423,8 +424,6 @@ en:
Contract exchange date must be less than 1 year before completion date Contract exchange date must be less than 1 year before completion date
previous_property_beds: previous_property_beds:
property_type_bedsit: "Bedsit bedroom maximum 1" property_type_bedsit: "Bedsit bedroom maximum 1"
previous_property_type:
property_type_bedsit: "A bedsit can not have more than 1 bedroom"
discounted_ownership_value: "Mortgage, deposit, and grant total must equal £%{value_with_discount}" discounted_ownership_value: "Mortgage, deposit, and grant total must equal £%{value_with_discount}"
soft_validations: soft_validations:

Loading…
Cancel
Save