Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
class Form::Sales::Questions::Uprn < ::Form::Question
|
|
|
|
def initialize(id, hsh, page)
|
|
|
|
super
|
|
|
|
@id = "uprn"
|
|
|
|
@check_answer_label = "UPRN"
|
|
|
|
@header = "What is the property's UPRN"
|
|
|
|
@type = "text"
|
|
|
|
@width = 10
|
|
|
|
@question_number = 14
|
|
|
|
@inferred_check_answers_value = [
|
|
|
|
{
|
|
|
|
"condition" => { "uprn_known" => 0 },
|
|
|
|
"value" => "Not known",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def unanswered_error_message
|
|
|
|
I18n.t("validations.property.uprn.invalid")
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_extra_check_answer_value(log)
|
|
|
|
return unless log.uprn_known == 1
|
|
|
|
|
|
|
|
value = [
|
|
|
|
log.address_line1,
|
|
|
|
log.address_line2,
|
|
|
|
log.town_or_city,
|
|
|
|
log.county,
|
|
|
|
log.postcode_full,
|
|
|
|
(LocalAuthority.find_by(code: log.la)&.name if log.la.present?),
|
|
|
|
].select(&:present?)
|
|
|
|
|
|
|
|
return unless value.any?
|
|
|
|
|
|
|
|
"\n\n#{value.join("\n")}"
|
|
|
|
end
|
|
|
|
end
|