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.

93 lines
3.8 KiB

<% content_for :title, @page.header.presence || @page.questions.first.header.html_safe %>
<% if accessed_from_duplicate_logs?(request.query_parameters["referrer"]) %>
<% content_for :before_content do %>
<%= govuk_back_link(href: duplicate_log_set_path(@log, request.query_parameters["original_log_id"])) %>
<% end %>
<% else %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Home" => root_path,
breadcrumb_logs_title(@log, current_user) => breadcrumb_logs_link(@log, current_user),
"Log #{@log.id}" => url_for(@log),
@subsection.label => relevant_check_answers_path(@log, @subsection),
}) %>
<% end %>
<div data-controller="govukfrontend"></div>
<%= form_with model: @log, url: request.original_url, method: "post", local: true do |f| %>
<div class="govuk-grid-row">
CLDC-2248 Improve soft validations (#1584) * Update interruption screen page * Update routing and add flash * Only display routed to affected questions * Add affected_question_ids to pregnancy check * lint * Add skip link and lint * Move affected_question_ids to page, because we reuse questions so they might have different affected_question_ids * typo * Fix button wording * Update action href links * Change how we route back to interruption screen * Update affected_question_ids for lettings * Update sales soft validations * Update title texts * Update styling * Update is_referrer_interruption_screen? check and naming * Add interuption screen helper specs * Add request test for fixing soft validation * Add tests for geting soft validation page * Extract interruption screen banner * Update action_href to be reusable * Extract questions out of check answers summary list * Reuse check_answers_summary_list for interruption screen * refactor string parse * Rename attribute * fix test * Add tests for sales paths * typo * Update validation message: void date, major repairs date * Update validation message: rent_value_check, 2022 * Update validation message: buyer live in * Update validation message: staircase * Update validation message: purchase price * Update validation message: income * Update validation message: savings * Update validation message: extra borrowing * Update validation message: extra borrowing * Update validation message: wheelchair * Update validation message: monthly charge * Update validation message: mortgage * Update validation message: old persons shared ownership * Update validation message: discount * Update validation: min retirement * Wording in tests and time test * Update missing question * Refactor is referrer methods * Update validation message: net income * Update validation message: deposit and savings * Update validation message: mortgage, discount and deposit * Fix test validation messages * Fix the retirement check showing on the card 8, fix tests * test * return the user back to the check_your_answers after fixing a validation from check_your_anwers * pr comments
2 years ago
<div class="govuk-grid-column-two-thirds-from-desktop">
<% remove_other_page_errors(@log, @page) %>
<%= f.govuk_error_summary %>
<% if @page.header.present? || @page.header_partial.present? %>
<h1 class="govuk-heading-l">
<% if !@page.hide_subsection_label %>
<span class="govuk-caption-l"><%= @subsection.label %></span>
<% end %>
<% if @page.header_partial.present? %>
<%= render partial: "form/headers/#{@page.header_partial}", locals: { log: @log } %>
<% else %>
<%= @page.header %>
<% end %>
</h1>
<% end %>
<% if @page.description.present? %>
<p class="govuk-body govuk-body-m"><%= @page.description.html_safe %></p>
<% end %>
<% @page.non_conditional_questions.map do |question| %>
<div id="<%= question.id %>_div" <%= display_question_key_div(@page, question) %>>
<% if question.read_only? %>
<%= govuk_section_break(visible: true, size: "m") %>
<% end %>
<% if question.type == "interruption_screen" %>
<%= render partial: "form/#{question.type}_question", locals: {
question:,
caption_text: @subsection.label,
page_header: @page.header,
lettings_log: @log,
title_text: @page.title_text,
informative_text: @page.informative_text,
form: @form,
f:,
conditional: false,
} %>
<% else %>
<%= render partial: "form/#{question.type}_question", locals: {
question:,
caption_text: @page.header_partial.present? ? nil : @subsection.label,
page_header: @page.header,
lettings_log: @log,
f:,
conditional: false,
} %>
<% end %>
</div>
<% end %>
<%= f.hidden_field :page, value: @page.id %>
CLDC-2248 Improve soft validations (#1584) * Update interruption screen page * Update routing and add flash * Only display routed to affected questions * Add affected_question_ids to pregnancy check * lint * Add skip link and lint * Move affected_question_ids to page, because we reuse questions so they might have different affected_question_ids * typo * Fix button wording * Update action href links * Change how we route back to interruption screen * Update affected_question_ids for lettings * Update sales soft validations * Update title texts * Update styling * Update is_referrer_interruption_screen? check and naming * Add interuption screen helper specs * Add request test for fixing soft validation * Add tests for geting soft validation page * Extract interruption screen banner * Update action_href to be reusable * Extract questions out of check answers summary list * Reuse check_answers_summary_list for interruption screen * refactor string parse * Rename attribute * fix test * Add tests for sales paths * typo * Update validation message: void date, major repairs date * Update validation message: rent_value_check, 2022 * Update validation message: buyer live in * Update validation message: staircase * Update validation message: purchase price * Update validation message: income * Update validation message: savings * Update validation message: extra borrowing * Update validation message: extra borrowing * Update validation message: wheelchair * Update validation message: monthly charge * Update validation message: mortgage * Update validation message: old persons shared ownership * Update validation message: discount * Update validation: min retirement * Wording in tests and time test * Update missing question * Refactor is referrer methods * Update validation message: net income * Update validation message: deposit and savings * Update validation message: mortgage, discount and deposit * Fix test validation messages * Fix the retirement check showing on the card 8, fix tests * test * return the user back to the check_your_answers after fixing a validation from check_your_anwers * pr comments
2 years ago
<%= f.hidden_field :interruption_page_id, value: @interruption_page_id %>
<%= f.hidden_field :interruption_page_referrer_type, value: @interruption_page_referrer_type %>
<%= f.hidden_field :related_question_ids, value: @related_question_ids %>
<%= f.hidden_field :original_page_id, value: @original_page_id %>
<% if @check_errors %>
<%= f.hidden_field :check_errors, value: @check_errors %>
<% end %>
<% if @pages_with_errors_count > 1 %>
<div class="govuk-button-group">
<%= f.submit "See all related answers", name: "check_errors", class: "govuk-body govuk-link submit-button-link" %>
</div>
<% end %>
<div class="govuk-button-group">
<% if !@page.interruption_screen? %>
<%= f.govuk_submit submit_button_text(@page, request.query_parameters["referrer"]) %>
<%= govuk_link_to cancel_button_text(@page, request.query_parameters["referrer"]), cancel_button_link(@page, request.query_parameters["referrer"], request.query_parameters["original_log_id"], @log) %>
<% end %>
</div>
</div>
</div>
<% end %>