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.

35 lines
1.5 KiB

Cldc 1669 add location redesign (#1034) * feat: wip postcode page * feat: wip add new flow * feat: add check answers page, continue updating flow * feat: add back behaviour * feat: more flow work * feat: further flow work and flash notice, name tidying * feat: add check_answers referrer linking * feat: add controller and details linking and lint * refactor: erblinting * feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates * feat: add validations to controller (could later be added to model) * fix: correct date order * feat: validate on model (except startdate) * feat: copy update * refactor: railsification * feat: add date model validation * feat: add updated availability text in check_answers * feat: more updated dynamic text and linking * refactor: erblinting * refactor: cleanup of redundant code * refactor: remove redundant create * feat: use rails route * test: wip tests * test: wip tests * feat: add new back behaviour for new scheme path and tests wip * feat: add more back behaviour for new scheme path and fix local auth validation * feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes * feat: if location with no details added, route to normal path rather than check answers * test: update model and helper location tests * test: more test updates * test: more test updates and remove redundant files * test: remove redundant tests, add postcode test * test: add new #new tests * test: add test for all new controller methods * test: add more startdate tests * refactor: erblinting * test: fix failing tests * test: update scheme test * feat: respond to PR comments * feat: make postcode clear only if changed * feat: add _update methods * refactor: simplify validation and location_edit_path method * refactor: add helper method for action text * refactor: remove redundant logic * refactor: simplify routing * refactor: reintroduce location_params * refactor: use presence validation for postcode * refactor: use presence validation for la * feat: validate confirmed * tests: make tests pass with new startdate validation * WIP * refactor: simplify display attributes helpers and update tests * refactor: linting * feat: design change to save behaviour * test: fix failing tests * feat: location code copy tweak * refactor: remove redundant function * refactor: remove add_another_location and new location page * feat: simplify startdate validations to move to model, use scheme available_from date for in range validation * test: fix failing tests * refactor: linting * feat: remove name validation as a result of PO review * test: update tests * refactor: remove redundant context Co-authored-by: James Rose <james@jbpr.net>
2 years ago
<% content_for :title, "Add a location to this scheme" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location, route: params[:route]) : scheme_location_name_path(@scheme, @location, route: params[:route]),
) %>
<% end %>
<%= form_for(@location, method: :patch, url: scheme_location_units_path(@scheme, @location, route: params[:route], referrer: params[:referrer])) do |f| %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= 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 %>
<div class="govuk-button-group">
<% if params[:referrer] == "check_answers" %>
<%= f.govuk_submit "Save changes" %>
<%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %>
<% else %>
<%= f.govuk_submit "Save and continue" %>
<%= govuk_link_to "Skip for now", scheme_location_type_of_unit_path(@scheme, @location), secondary: true %>
<% end %>
</div>
</div>
</div>
<% end %>