diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb
index 766501260..0ef688570 100644
--- a/app/controllers/locations_controller.rb
+++ b/app/controllers/locations_controller.rb
@@ -15,9 +15,23 @@ class LocationsController < ApplicationController
end
def new
- @location = Location.new
+ @location = Location.new(scheme_id: @scheme.id)
+ @location.save!
+ redirect_to scheme_location_postcode_path(@scheme, @location)
end
+ def postcode; end
+
+ def name; end
+
+ def type_of_unit; end
+
+ def mobility_standards; end
+
+ def startdate; end
+
+ def check_answers; end
+
def show; end
def new_deactivation
diff --git a/app/models/location.rb b/app/models/location.rb
index c05a2351b..1158edc95 100644
--- a/app/models/location.rb
+++ b/app/models/location.rb
@@ -1,6 +1,6 @@
class Location < ApplicationRecord
- validate :validate_postcode
- validates :units, :type_of_unit, :mobility_type, presence: true
+ # validate :validate_postcode
+ # validates :units, :type_of_unit, :mobility_type, presence: true
belongs_to :scheme
has_many :lettings_logs, class_name: "LettingsLog"
has_many :location_deactivation_periods, class_name: "LocationDeactivationPeriod"
diff --git a/app/views/locations/mobility_standards.html.erb b/app/views/locations/mobility_standards.html.erb
new file mode 100644
index 000000000..f71b63359
--- /dev/null
+++ b/app/views/locations/mobility_standards.html.erb
@@ -0,0 +1,30 @@
+<% content_for :title, "Add a location to this scheme" %>
+
+<% content_for :before_content do %>
+ <%= govuk_back_link(
+ text: "Back",
+ href: "/schemes/#{@scheme.id}/support",
+ ) %>
+<% end %>
+
+<%= form_for(@location, method: :patch, url: scheme_location_startdate_path(@scheme, @location)) do |f| %>
+
+
+ <%= f.govuk_error_summary %>
+
+ <%= render partial: "organisations/headings", locals: { main: I18n.t("questions.location.mobility_type"), sub: "Add a location to #{@scheme.service_name}" } %>
+
+ <%= f.govuk_collection_radio_buttons :mobility_type,
+ mobility_type_selection,
+ :id,
+ :name,
+ :description,
+ legend: nil %>
+
+
+ <%= f.govuk_submit "Continue" %>
+ <%= govuk_link_to "Cancel", new_scheme_location_path(@scheme) %>
+
+
+
+<% end %>
diff --git a/app/views/locations/name.html.erb b/app/views/locations/name.html.erb
new file mode 100644
index 000000000..5491108b4
--- /dev/null
+++ b/app/views/locations/name.html.erb
@@ -0,0 +1,27 @@
+<% content_for :title, "Add a location to this scheme" %>
+
+<% content_for :before_content do %>
+ <%= govuk_back_link(
+ text: "Back",
+ href: "/schemes/#{@scheme.id}/support",
+ ) %>
+<% end %>
+
+<%= form_for(@location, method: :patch, url: scheme_location_units_path(@scheme, @location)) do |f| %>
+
+
+ <%= f.govuk_error_summary %>
+
+ <%= render partial: "organisations/headings", locals: { main: I18n.t("questions.location.name"), sub: "Add a location to #{@scheme.service_name}" } %>
+
+ <%= f.govuk_text_field :name,
+ label: nil,
+ hint: { text: I18n.t("hints.location.name") } %>
+
+
+ <%= f.govuk_submit "Continue" %>
+ <%= govuk_link_to "Cancel", new_scheme_location_path(@scheme) %>
+
+
+
+<% end %>
diff --git a/app/views/locations/postcode.html.erb b/app/views/locations/postcode.html.erb
index 74c55c5c7..dd1ab22b1 100644
--- a/app/views/locations/postcode.html.erb
+++ b/app/views/locations/postcode.html.erb
@@ -7,12 +7,12 @@
) %>
<% end %>
-<%= form_for(@location, method: :post, url: scheme_locations_path) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_name_path(@scheme, @location)) do |f| %>
<%= f.govuk_error_summary %>
- <%= render partial: "organisations/headings", locals: { main: "What is the postcode?", sub: "Add a location to #{@scheme.service_name}" } %>
+ <%= render partial: "organisations/headings", locals: { main: I18n.t("questions.location.postcode"), sub: "Add a location to #{@scheme.service_name}" } %>
<%= f.govuk_text_field :postcode,
label: { size: "m" },
@@ -21,7 +21,7 @@
<%= f.govuk_submit "Continue" %>
- <%= govuk_link_to "Cancel", scheme_locations_path(@scheme) %>
+ <%= govuk_link_to "Cancel", new_scheme_location_path(@scheme) %>
diff --git a/app/views/locations/startdate.html.erb b/app/views/locations/startdate.html.erb
new file mode 100644
index 000000000..11df00aed
--- /dev/null
+++ b/app/views/locations/startdate.html.erb
@@ -0,0 +1,28 @@
+<% content_for :title, "Add a location to this scheme" %>
+
+<% content_for :before_content do %>
+ <%= govuk_back_link(
+ text: "Back",
+ href: "/schemes/#{@scheme.id}/support",
+ ) %>
+<% end %>
+
+<%= form_for(@location, method: :patch, url: scheme_location_check_answers_path(@scheme, @location)) do |f| %>
+
+
+ <%= f.govuk_error_summary %>
+
+ <%= render partial: "organisations/headings", locals: { main: I18n.t("questions.location.startdate"), sub: "Add a location to #{@scheme.service_name}" } %>
+
+ <%= f.govuk_date_field :startdate,
+ hint: { text: I18n.t("hints.location.startdate") },
+ legend: nil,
+ width: 20 %>
+
+
+ <%= f.govuk_submit "Continue" %>
+ <%= govuk_link_to "Cancel", new_scheme_location_path(@scheme) %>
+
+
+
+<% end %>
diff --git a/app/views/locations/type_of_unit.html.erb b/app/views/locations/type_of_unit.html.erb
new file mode 100644
index 000000000..990245b64
--- /dev/null
+++ b/app/views/locations/type_of_unit.html.erb
@@ -0,0 +1,29 @@
+<% content_for :title, "Add a location to this scheme" %>
+
+<% content_for :before_content do %>
+ <%= govuk_back_link(
+ text: "Back",
+ href: "/schemes/#{@scheme.id}/support",
+ ) %>
+<% end %>
+
+<%= form_for(@location, method: :patch, url: scheme_location_mobility_standards_path(@scheme, @location)) do |f| %>
+
+
+ <%= f.govuk_error_summary %>
+
+ <%= render partial: "organisations/headings", locals: { main: I18n.t("questions.location.type_of_unit"), sub: "Add a location to #{@scheme.service_name}" } %>
+
+ <%= f.govuk_collection_radio_buttons :type_of_unit,
+ type_of_units_selection,
+ :id,
+ :name,
+ legend: nil %>
+
+
+ <%= f.govuk_submit "Continue" %>
+ <%= govuk_link_to "Cancel", new_scheme_location_path(@scheme) %>
+
+
+
+<% end %>
diff --git a/app/views/locations/units.html.erb b/app/views/locations/units.html.erb
new file mode 100644
index 000000000..5d1e1c677
--- /dev/null
+++ b/app/views/locations/units.html.erb
@@ -0,0 +1,29 @@
+<% content_for :title, "Add a location to this scheme" %>
+
+<% content_for :before_content do %>
+ <%= govuk_back_link(
+ text: "Back",
+ href: "/schemes/#{@scheme.id}/support",
+ ) %>
+<% end %>
+
+<%= form_for(@location, method: :patch, url: scheme_location_type_of_unit_path(@scheme, @location)) do |f| %>
+
+
+ <%= f.govuk_error_summary %>
+
+ <%= render partial: "organisations/headings", locals: { main: I18n.t("questions.location.units"), sub: "Add a location to #{@scheme.service_name}" } %>
+
+ <%= f.govuk_number_field :units,
+ label: nil,
+ width: 2,
+ hint: { text: I18n.t("hints.location.units") },
+ autofocus: true %>
+
+
+ <%= f.govuk_submit "Continue" %>
+ <%= govuk_link_to "Cancel", new_scheme_location_path(@scheme) %>
+
+
+
+<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index f839ccf7e..d00554f34 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -325,7 +325,7 @@ en:
out_of_range: "The date must be on or after the %{date}"
reactivation:
before_deactivation: "This location was deactivated on %{date}\nThe reactivation date must be on or after deactivation date"
- deactivation:
+ deactivation:
during_deactivated_period: "The location is already deactivated during this date, please enter a different date"
soft_validations:
@@ -372,10 +372,11 @@ en:
questions:
location:
- name: "Location name (optional)"
- units: "Total number of units at this location"
+ postcode: "What is the postcode?"
+ name: "What is the name of this location?"
+ units: "How many units are at this location?"
type_of_unit: "What is the most common type of unit at this location?"
- startdate: "When did the first property in this location become available under this scheme? (optional)"
+ startdate: "When did the first property in this location become available under this scheme?"
add_another_location: "Do you want to add another location?"
mobility_type: "What are the mobility standards for the majority of units in this location?"
toggle_active:
@@ -394,8 +395,9 @@ en:
location:
postcode: "For example, SW1P 4DF."
name: "This is how you refer to this location within your organisation"
- units: "A unit can be a bedroom in a shared house or flat, or a house with 4 bedrooms. Do not include bedrooms used for wardens, managers, volunteers or sleep-in staff."
+ units: "A unit is the space being let. For example, the property might be a block of flats and the unit would be the specific flat being let. A unit can also be a bedroom in a shared house or flat. Do not include spaces used for staff."
toggle_active: "If the date is before %{date}, select ‘From the start of the current collection period’ because the previous period has now closed."
+ startdate: "For example, 27 3 2021"
scheme:
deactivation: "If the date is before %{date}, select ‘From the start of the current collection period’ because the previous period has now closed."
@@ -404,7 +406,7 @@ en:
deactivate:
existing_logs: "It will not be possible to add logs with this location if their tenancy start date is on or after the date you enter. Any existing logs may be affected."
review_logs: "Your data providers will need to review these logs and answer a few questions again. We’ll email each log creator with a list of logs that need updating."
- reactivate:
+ reactivate:
existing_logs: "You’ll be able to add logs with this location if their tenancy start date is on or after the date you enter."
scheme:
deactivation:
diff --git a/config/routes.rb b/config/routes.rb
index 98d7151b1..2bdcedaf2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -62,6 +62,19 @@ Rails.application.routes.draw do
get "deactivate-confirm", to: "locations#deactivate_confirm"
get "reactivate", to: "locations#reactivate"
get "new-reactivation", to: "locations#new_reactivation"
+ get "postcode", to: "locations#postcode"
+ get "name", to: "locations#name"
+ patch "name", to: "locations#name"
+ get "units", to: "locations#units"
+ patch "units", to: "locations#units"
+ get "type-of-unit", to: "locations#type_of_unit"
+ patch "type-of-unit", to: "locations#type_of_unit"
+ get "mobility-standards", to: "locations#mobility_standards"
+ patch "mobility-standards", to: "locations#mobility_standards"
+ get "startdate", to: "locations#startdate"
+ patch "startdate", to: "locations#startdate"
+ get "check-answers", to: "locations#show"
+ patch "check-answers", to: "locations#show"
patch "new-deactivation", to: "locations#new_deactivation"
patch "deactivate", to: "locations#deactivate"
patch "reactivate", to: "locations#reactivate"