diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index 9dad4e9fe..8d7b927b2 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -35,10 +35,7 @@ <% row.cell(header: true, text: "Common unit type", html_attributes: { scope: "col", }) %> - <% row.cell(header: true, text: "Mobility type", html_attributes: { - scope: "col", - }) %> - <% row.cell(header: true, text: "Local authority", html_attributes: { + <% row.cell(header: true, text: "Available from", html_attributes: { scope: "col", }) %> <% end %> @@ -50,8 +47,7 @@ <% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit-name"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: location.units) %> <% row.cell(text: simple_format("#{location.type_of_unit}")) %> - <% row.cell(text: location.mobility_type) %> - <% row.cell(text: location.location_admin_district) %> + <% row.cell(text: location.startdate&.to_formatted_s(:govuk_date)) %> <% end %> <% end %> <% end %> diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb index 4d068e9ca..561fca9c9 100644 --- a/app/views/schemes/check_answers.html.erb +++ b/app/views/schemes/check_answers.html.erb @@ -3,7 +3,6 @@ <%= form_for(@scheme, as: :scheme, method: :patch) do |f| %>
-
<%= f.govuk_error_summary %> <%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %> <% component.tab(label: "Scheme") do %> @@ -52,10 +51,7 @@ <% row.cell(header: true, text: "Common unit type", html_attributes: { scope: "col", }) %> - <% row.cell(header: true, text: "Mobility type", html_attributes: { - scope: "col", - }) %> - <% row.cell(header: true, text: "Local authority", html_attributes: { + <% row.cell(header: true, text: "Available from", html_attributes: { scope: "col", }) %> <% end %> @@ -67,8 +63,7 @@ <% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: location.units) %> <% row.cell(text: simple_format("#{location.type_of_unit}")) %> - <% row.cell(text: location.mobility_type) %> - <% row.cell(text: location.location_admin_district) %> + <% row.cell(text: location.startdate&.to_formatted_s(:govuk_date)) %> <% end %> <% end %> <% end %> @@ -76,7 +71,6 @@ <%= govuk_button_link_to "Add a location", new_location_path(id: @scheme.id), secondary: true %> <% end %> <% end %> -
<%= f.hidden_field :page, value: "check-answers" %> <%= f.hidden_field :confirmed, value: "true" %> diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index 8e091bc02..2c700fd14 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -13,16 +13,14 @@ <%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
-
- <%= govuk_summary_list do |summary_list| %> - <% @scheme.display_attributes.each do |attr| %> - <% next if current_user.data_coordinator? && attr[:name] == ("Housing stock owned by") %> - <%= summary_list.row do |row| %> - <% row.key { attr[:name].eql?("Registered under Care Standards Act 2000") ? "Registered under Care Standards Act 2000" : attr[:name].to_s.humanize } %> - <% row.value { details_html(attr) } %> - <% row.action(text: "Change", href: scheme_edit_name_path(scheme_id: @scheme.id)) if attr[:edit] %> - <% end %> + <%= govuk_summary_list do |summary_list| %> + <% @scheme.display_attributes.each do |attr| %> + <% next if current_user.data_coordinator? && attr[:name] == ("Housing stock owned by") %> + <%= summary_list.row do |row| %> + <% row.key { attr[:name].eql?("Registered under Care Standards Act 2000") ? "Registered under Care Standards Act 2000" : attr[:name].to_s.humanize } %> + <% row.value { details_html(attr) } %> + <% row.action(text: "Change", href: scheme_edit_name_path(scheme_id: @scheme.id)) if attr[:edit] %> <% end %> <% end %> -
+ <% end %>
diff --git a/spec/factories/location.rb b/spec/factories/location.rb index 4041fe337..4d3fb1e4c 100644 --- a/spec/factories/location.rb +++ b/spec/factories/location.rb @@ -8,6 +8,7 @@ FactoryBot.define do mobility_type { %w[A M N W X].sample } location_code { "E09000033" } location_admin_district { "Westminster" } + startdate { Faker::Date.between(from: 6.months.ago, to: Time.zone.today) } scheme trait :export do postcode { "SW1A 2AA" } diff --git a/spec/features/schemes_helpers.rb b/spec/features/schemes_helpers.rb index 3814a2f4c..5db3917fa 100644 --- a/spec/features/schemes_helpers.rb +++ b/spec/features/schemes_helpers.rb @@ -57,7 +57,10 @@ module SchemesHelpers def fill_in_and_save_location fill_in "Postcode", with: "AA1 1AA" fill_in "Location name (optional)", with: "Some name" - fill_in "Total number of units at this location", with: 1 + fill_in "Total number of units at this location", with: 5 + fill_in "Day", with: 2 + fill_in "Month", with: 2 + fill_in "Year", with: 2022 choose "Self-contained house" choose "location-add-another-location-no-field" choose "location-mobility-type-none-field" diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index f1b8aafde..b0ab10d18 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -175,7 +175,7 @@ RSpec.describe "Schemes scheme Features" do context "when there are locations that belong to the selected scheme" do let!(:schemes) { FactoryBot.create_list(:scheme, 5) } let(:scheme) { schemes.first } - let!(:locations) { FactoryBot.create_list(:location, 3, scheme:, postcode: "AA11AA") } + let!(:locations) { FactoryBot.create_list(:location, 3, scheme:, postcode: "AA11AA", startdate: Time.utc(2022, 1, 1)) } before do visit("schemes") @@ -198,8 +198,7 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_content(location.postcode) expect(page).to have_content(location.units) expect(page).to have_content(location.type_of_unit) - expect(page).to have_content(location.mobility_type) - expect(page).to have_content(location.location_admin_district) + expect(page).to have_content(location.startdate&.to_formatted_s(:govuk_date)) end end end @@ -471,10 +470,9 @@ RSpec.describe "Schemes scheme Features" do it "displays information about the first created location" do expect(page).to have_content "AA11AA" expect(page).to have_content "Some name" + expect(page).to have_content "5" expect(page).to have_content "Self-contained house" - expect(page).to have_content "None" - expect(page).to have_content "Local authority" - expect(page).to have_content "Westminster" + expect(page).to have_content "2 February 2022" end it "displays information about another location" do @@ -508,7 +506,6 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_content "Locations" expect(page).to have_content "#{scheme.locations.count} location" expect(page).to have_content "ZZ11ZZ" - expect(page).to have_content("Wheelchair-user standard") end end diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index ea9018c0c..bd0aee42c 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -804,7 +804,7 @@ RSpec.describe LocationsController, type: :request do expect(page).to have_content(location.id) expect(page).to have_content(location.postcode) expect(page).to have_content(location.type_of_unit) - expect(page).to have_content(location.mobility_type) + expect(page).to have_content(location.startdate&.to_formatted_s(:govuk_date)) end end @@ -906,7 +906,7 @@ RSpec.describe LocationsController, type: :request do expect(page).to have_content(location.id) expect(page).to have_content(location.postcode) expect(page).to have_content(location.type_of_unit) - expect(page).to have_content(location.mobility_type) + expect(page).to have_content(location.startdate&.to_formatted_s(:govuk_date)) end end