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.
32 lines
1.0 KiB
32 lines
1.0 KiB
class Form::Lettings::Pages::UprnSelection < ::Form::Page |
|
def initialize(id, hsh, subsection) |
|
super |
|
@id = "uprn_selection" |
|
@header = "We found some addresses that might be this property" |
|
@depends_on = [ |
|
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => true }, |
|
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => true }, |
|
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => true }, |
|
] |
|
end |
|
|
|
def questions |
|
@questions ||= [ |
|
Form::Lettings::Questions::UprnSelection.new(nil, nil, self), |
|
] |
|
end |
|
|
|
def routed_to?(log, _current_user = nil) |
|
(log.uprn_known.nil? || log.uprn_known.zero?) && log.address_line1_input.present? && log.postcode_full_input.present? && (1..10).cover?(log.address_options&.count) |
|
end |
|
|
|
def skip_text |
|
"Search for address again" |
|
end |
|
|
|
def skip_href(log = nil) |
|
return unless log |
|
|
|
"/#{log.model_name.param_key.dasherize}s/#{log.id}/address-matcher" |
|
end |
|
end
|
|
|