From c2dc8987d3f4f1f33a5286b61576eb3002545d63 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 13 Aug 2024 08:07:36 +0100 Subject: [PATCH] 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 --- app/models/form/sales/pages/mortgageused.rb | 1 + .../sales/sale_information_validations.rb | 4 +-- ...ial_calculations_shared_ownership.html.erb | 27 +++++++++++++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/models/form/sales/pages/mortgageused.rb b/app/models/form/sales/pages/mortgageused.rb index f9d8eae2e..a4912b12d 100644 --- a/app/models/form/sales/pages/mortgageused.rb +++ b/app/models/form/sales/pages/mortgageused.rb @@ -1,6 +1,7 @@ class Form::Sales::Pages::Mortgageused < ::Form::Page def initialize(id, hsh, subsection, ownershipsch:) super(id, hsh, subsection) + @header = "Mortgage Amount" @ownershipsch = ownershipsch end diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb index 648b2a0bc..42c6a6172 100644 --- a/app/models/validations/sales/sale_information_validations.rb +++ b/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", deposit: record.field_formatted_as_currency("deposit"), 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 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"), 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 diff --git a/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb b/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb index 1a8db70ea..209fcb4fe 100644 --- a/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb +++ b/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 %>

- <% if log.type == 18 %> - The mortgage amount <%= question_link("mortgage", log, current_user) %>, - cash deposit <%= question_link("deposit", log, current_user) %>, - and cash discount <%= question_link("cashdis", log, current_user) %> - <% else %> - The mortgage amount <%= question_link("mortgage", log, current_user) %> - and cash deposit <%= question_link("deposit", log, current_user) %> + <% if log.mortgage_used? || log.mortgageused.blank? %> + The mortgage amount <%= log.mortgageused.blank? ? question_link("mortgageused", log, current_user) : question_link("mortgage", log, current_user) %> + <% if log.type == 18 %> + , cash deposit <%= question_link("deposit", log, current_user) %>, + and cash discount <%= question_link("cashdis", log, current_user) %> + added together + <% 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 %> - added together must equal + must equal the purchase price <%= question_link("value", log, current_user) %> <% stairbought_page = log.form.get_question("stairbought", log).page %> <% if stairbought_page.routed_to?(log, current_user) %>