Browse Source

feat: add wip housing provider behaviour without functioning search

pull/954/head
natdeanlewissoftwire 3 years ago
parent
commit
3ffafaa51c
  1. 14
      app/components/related_organisation_search_component.html.erb
  2. 2
      app/components/related_organisation_search_component.rb
  3. 15
      app/views/organisation_relationships/_related_organisation_select_question.html.erb
  4. 28
      app/views/organisation_relationships/add_housing_provider.html.erb
  5. 1
      config/routes.rb

14
app/components/related_organisation_search_component.html.erb

@ -1,14 +0,0 @@
<%= form_with model: @user, url: path(current_user), method: "get", local: true do |f| %>
<div class="app-search govuk-!-margin-bottom-4">
<%= f.govuk_text_field :search,
form_group: {
class: "app-search__form-group",
},
label: { text: search_label },
type: "search",
value:,
autocomplete: "off",
class: "app-search__input" %>
</div>
<%= f.govuk_submit "Add" %>
<% end %>

2
app/components/related_organisation_search_component.rb

@ -1,2 +0,0 @@
class RelatedOrganisationSearchComponent < SearchComponent
end

15
app/views/organisation_relationships/_related_organisation_select_question.html.erb

@ -0,0 +1,15 @@
<% answers = [OpenStruct.new(id: 1, name: "test1", resource: nil), OpenStruct.new(id: 2, name: "test2", resource: nil)] %>
<%= f.govuk_select(question.id.to_sym,
label: legend(question, page_header, conditional),
"data-controller": "accessible-autocomplete",
caption: caption(caption_text, page_header, conditional),
hint: { text: question.hint_text&.html_safe }) do %>
<% answers.each do |answer| %>
<option value="<%= answer.id %>"
data-synonyms="<%= question.answer_option_synonyms(answer.resource) %>"
data-append="<%= question.answer_option_append(answer.resource) %>"
data-hint="<%= question.answer_option_hint(answer.resource) %>"
<%= question.answer_selected?(@log, answer) ? "selected" : "" %>
<%= answer.id == "" ? "disabled" : "" %>><%= answer.name || answer.resource %></option>
<% end %>
<% end %>

28
app/views/organisation_relationships/add_housing_provider.html.erb

@ -1,11 +1,19 @@
<%= render partial: "organisations/headings", locals: { main: "What is the name of your housing provider?", sub: nil } %>
<%= render RelatedOrganisationSearchComponent.new(current_user:, search_label: "Start typing to search for your housing provider", value: @searched) %>
<%= govuk_details(summary_text: "Can't find the housing provider you're looking for?") do %>
<ul class="govuk-list govuk-list--bullet">
<li>Double check the spelling and try again</li>
<li>Type the first few letters to see the suggestions</li>
<li>If you still can't find it,
<%= govuk_link_to("contact the DLUHC service desk", "https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/group/21", rel: "noreferrer noopener", target: "_blank") %>
</li>
</ul>
<%= form_with model: nil, url: housing_providers_add_organisation_path, method: "post", local: true do |f| %>
<%# remove_other_page_errors(@log, @page) %>
<%#= f.govuk_error_summary %>
<%= render partial: "organisations/headings", locals: { main: "What is the name of your housing provider?", sub: nil } %>
<%#= render partial: "form/#{question.type}_question", locals: { question:, caption_text: @subsection.label, page_header: @page.header, lettings_log: @log, f:, conditional: false } %>
<%= f.govuk_submit "Add" %>
<%= govuk_details(summary_text: "Can't find the housing provider you're looking for?") do %>
<ul class="govuk-list govuk-list--bullet">
<li>Double check the spelling and try again</li>
<li>Type the first few letters to see the suggestions</li>
<li>If you still can't find it,
<%= govuk_link_to("contact the DLUHC service desk", "https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/group/21", rel: "noreferrer noopener", target: "_blank") %>
</li>
</ul>
<% end %>
<% end %>

1
config/routes.rb

@ -81,6 +81,7 @@ Rails.application.routes.draw do
get "schemes", to: "organisations#schemes"
get "housing-providers", to: "organisation_relationships#housing_providers"
get "housing-providers/add", to: "organisation_relationships#add_housing_provider"
post "housing-providers/add", to: "organisation_relationships#housing_providers"
end
end

Loading…
Cancel
Save