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.
39 lines
941 B
39 lines
941 B
2 years ago
|
class Form::Lettings::Questions::AddressLine1 < ::Form::Question
|
||
|
def initialize(id, hsh, page)
|
||
|
super
|
||
|
@id = "address_line1"
|
||
|
@check_answer_label = "Address"
|
||
|
@header = "Address line 1"
|
||
|
@type = "text"
|
||
|
@plain_label = true
|
||
|
@question_number = 12
|
||
|
end
|
||
|
|
||
|
def hidden_in_check_answers?(log, _current_user = nil)
|
||
|
return true if log.uprn_known.nil?
|
||
|
return false if log.uprn_known&.zero?
|
||
|
return true if log.uprn_confirmed.nil? && log.uprn.present?
|
||
|
return true if log.uprn_known == 1 && log.uprn.blank?
|
||
|
|
||
|
log.uprn_confirmed == 1
|
||
|
end
|
||
|
|
||
|
def answer_label(log, _current_user = nil)
|
||
|
[
|
||
|
log.address_line1,
|
||
|
log.address_line2,
|
||
|
log.postcode_full,
|
||
|
log.town_or_city,
|
||
|
log.county,
|
||
|
].select(&:present?).join("\n")
|
||
|
end
|
||
|
|
||
|
def get_extra_check_answer_value(log)
|
||
|
return unless log.is_la_inferred?
|
||
|
|
||
|
la = LocalAuthority.find_by(code: log.la)&.name
|
||
|
|
||
|
la.presence
|
||
|
end
|
||
|
end
|