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.
 
 
 
 

65 lines
3.0 KiB

<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<div class="govuk-grid-column-three-quarters">
<h1 class="govuk-heading-l">User input</h1>
<%= form_with(url: uprn_address_spike_path, method: 'get', local: true) do |form| %>
<div class="govuk-form-group">
<%= form.label :uprn, "Enter a UPRN", class: "govuk-label" %>
<%= form.text_field :uprn, class: "govuk-input", placeholder: "e.g. 100023336956" %>
</div>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m">
<p>OR enter an address</p>
<div class="govuk-form-group">
<%= form.label :address_line1, "Address line 1", class: "govuk-label" %>
<%= form.text_field :address_line1, class: "govuk-input", placeholder: "e.g. HOME OFFICE" %>
</div>
<div class="govuk-form-group">
<%= form.label :address_line2, "Address line 2", class: "govuk-label" %>
<%= form.text_field :address_line2, class: "govuk-input", placeholder: "e.g. 2, MARSHAM STREET" %>
</div>
<div class="govuk-form-group">
<%= form.label :town_or_city, "Town or city", class: "govuk-label" %>
<%= form.text_field :town_or_city, class: "govuk-input", placeholder: "e.g. LONDON" %>
</div>
<div class="govuk-form-group">
<%= form.label :postcode, "Postcode", class: "govuk-label" %>
<%= form.text_field :postcode, class: "govuk-input", placeholder: "e.g. SW1P 4DF" %>
</div>
<%= form.submit "Submit", class: "govuk-button" %>
<% end %>
</div>
</div>
<div class="govuk-grid-column-one-half">
<%if params[:uprn].present? || @address_given.present? %>
<h1 class="govuk-heading-l">OS Places API output</h1>
<%end %>
<% if params[:uprn].present? %>
<h1 class="govuk-heading-m">UPRN given:</h1>
<p><%= params[:uprn] %></p>
<% if @error.present? %>
<h1 class="govuk-heading-m"><%= @error %></h1>
<% elsif @address_returned.present? %>
<h1 class="govuk-heading-m">Match:</h1>
<p><%= @address_returned.address_line1 %></p>
<p><%= @address_returned.address_line2 %></p>
<p><%= @address_returned.town_or_city %></p>
<p><%= @address_returned.postcode %></p>
<% end %>
<% elsif @address_given.present? %>
<h1 class="govuk-heading-m">Address given:</h1>
<p><%= @address_given %></p>
<% if @error.present? %>
<h1 class="govuk-heading-m"><%= @error %></h1>
<% elsif @addresses_returned.present? %>
<h1 class="govuk-heading-m">Matches:</h1>
<% @addresses_returned.each do |address_returned| %>
<p>Address: <%= address_returned.address %></p>
<p>UPRN: <%= address_returned.uprn %></p>
<p>Confidence: <span style="color:<%= match_colour(address_returned.match) %>"><%= address_returned.match%> (<%= address_returned.match_description %>)</span></p>
<br>
<% end %>
<% end %>
<% end %>
</div>
</div>