Browse Source

CLDC-3569 Update guidance for shared ownership without mortgage (#2562)

* Update how we display errors for BU

* Update guidance for shared ownership

* Add header to mortgage used question

* Update shared ownership guidance
pull/2569/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
e5903c1947
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/components/bulk_upload_error_row_component.html.erb
  2. 1
      app/models/form/sales/pages/mortgageused.rb
  3. 4
      app/models/validations/sales/sale_information_validations.rb
  4. 27
      app/views/form/guidance/_financial_calculations_shared_ownership.html.erb

4
app/components/bulk_upload_error_row_component.html.erb

@ -25,7 +25,7 @@
<% body.with_row do |row| %> <% body.with_row do |row| %>
<% row.with_cell(text: error.cell) %> <% row.with_cell(text: error.cell) %>
<% row.with_cell(text: question_for_field(error.field)) %> <% row.with_cell(text: question_for_field(error.field)) %>
<% row.with_cell(text: error.error, html_attributes: { class: "govuk-!-font-weight-bold" }) %> <% row.with_cell(text: error.error.html_safe, html_attributes: { class: "govuk-!-font-weight-bold" }) %>
<% row.with_cell(text: error.field.humanize) %> <% row.with_cell(text: error.field.humanize) %>
<% end %> <% end %>
<% end %> <% end %>
@ -56,7 +56,7 @@
<% row.with_cell(text: error.cell) %> <% row.with_cell(text: error.cell) %>
<% row.with_cell(text: question_for_field(error.field)) %> <% row.with_cell(text: question_for_field(error.field)) %>
<% if index == 0 %> <% if index == 0 %>
<% row.with_cell(text: error_message, rowspan: errors.size, html_attributes: { class: "govuk-!-font-weight-bold grouped-multirow-cell" }) %> <% row.with_cell(text: error_message.html_safe, rowspan: errors.size, html_attributes: { class: "govuk-!-font-weight-bold grouped-multirow-cell" }) %>
<% end %> <% end %>
<% row.with_cell(text: error.field.humanize) %> <% row.with_cell(text: error.field.humanize) %>
<% end %> <% end %>

1
app/models/form/sales/pages/mortgageused.rb

@ -1,6 +1,7 @@
class Form::Sales::Pages::Mortgageused < ::Form::Page class Form::Sales::Pages::Mortgageused < ::Form::Page
def initialize(id, hsh, subsection, ownershipsch:) def initialize(id, hsh, subsection, ownershipsch:)
super(id, hsh, subsection) super(id, hsh, subsection)
@header = "Mortgage Amount"
@ownershipsch = ownershipsch @ownershipsch = ownershipsch
end end

4
app/models/validations/sales/sale_information_validations.rb

@ -238,12 +238,12 @@ module Validations::Sales::SaleInformationValidations
record.errors.add field, I18n.t("validations.sale_information.non_staircasing_mortgage.mortgage_not_used", record.errors.add field, I18n.t("validations.sale_information.non_staircasing_mortgage.mortgage_not_used",
deposit: record.field_formatted_as_currency("deposit"), deposit: record.field_formatted_as_currency("deposit"),
value: record.field_formatted_as_currency("value"), value: record.field_formatted_as_currency("value"),
expected_shared_ownership_deposit_value: record.field_formatted_as_currency("expected_shared_ownership_deposit_value")) expected_shared_ownership_deposit_value: record.field_formatted_as_currency("expected_shared_ownership_deposit_value")).html_safe
end end
record.errors.add :type, :skip_bu_error, message: I18n.t("validations.sale_information.non_staircasing_mortgage.mortgage_not_used", record.errors.add :type, :skip_bu_error, message: I18n.t("validations.sale_information.non_staircasing_mortgage.mortgage_not_used",
deposit: record.field_formatted_as_currency("deposit"), deposit: record.field_formatted_as_currency("deposit"),
value: record.field_formatted_as_currency("value"), value: record.field_formatted_as_currency("value"),
expected_shared_ownership_deposit_value: record.field_formatted_as_currency("expected_shared_ownership_deposit_value")) expected_shared_ownership_deposit_value: record.field_formatted_as_currency("expected_shared_ownership_deposit_value")).html_safe
end end
end end
end end

27
app/views/form/guidance/_financial_calculations_shared_ownership.html.erb

@ -1,14 +1,25 @@
<%= govuk_details(summary_text: "How the financial values are calculated") do %> <%= govuk_details(summary_text: "How the financial values are calculated") do %>
<p class="govuk-body"> <p class="govuk-body">
<% if log.type == 18 %> <% if log.mortgage_used? || log.mortgageused.blank? %>
The mortgage amount <%= question_link("mortgage", log, current_user) %>, The mortgage amount <%= log.mortgageused.blank? ? question_link("mortgageused", log, current_user) : question_link("mortgage", log, current_user) %>
cash deposit <%= question_link("deposit", log, current_user) %>, <% if log.type == 18 %>
and cash discount <%= question_link("cashdis", log, current_user) %> , cash deposit <%= question_link("deposit", log, current_user) %>,
<% else %> and cash discount <%= question_link("cashdis", log, current_user) %>
The mortgage amount <%= question_link("mortgage", log, current_user) %> added together
and cash deposit <%= question_link("deposit", log, current_user) %> <% else %>
and cash deposit <%= question_link("deposit", log, current_user) %>
added together
<% end %>
<% elsif log.mortgage_not_used? || log.mortgage_use_unknown? %>
<% if log.type == 18 %>
The cash deposit <%= question_link("deposit", log, current_user) %>,
and cash discount <%= question_link("cashdis", log, current_user) %>
added together
<% else %>
Cash deposit <%= question_link("deposit", log, current_user) %>
<% end %>
<% end %> <% end %>
added together must equal must equal
the purchase price <%= question_link("value", log, current_user) %> the purchase price <%= question_link("value", log, current_user) %>
<% stairbought_page = log.form.get_question("stairbought", log).page %> <% stairbought_page = log.form.get_question("stairbought", log).page %>
<% if stairbought_page.routed_to?(log, current_user) %> <% if stairbought_page.routed_to?(log, current_user) %>

Loading…
Cancel
Save