diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb index 3cef0db8d..86bb456f3 100644 --- a/app/models/form/sales/questions/deposit_amount.rb +++ b/app/models/form/sales/questions/deposit_amount.rb @@ -13,6 +13,7 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question @ownershipsch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] @optional = optional + @top_guidance_partial = "financial_calculations_shared_ownership" if ownershipsch == 1 end def derived?(log) diff --git a/app/models/form/sales/questions/deposit_discount.rb b/app/models/form/sales/questions/deposit_discount.rb index 52a7e90c7..faf8d76f7 100644 --- a/app/models/form/sales/questions/deposit_discount.rb +++ b/app/models/form/sales/questions/deposit_discount.rb @@ -12,6 +12,7 @@ class Form::Sales::Questions::DepositDiscount < ::Form::Question @prefix = "£" @hint_text = "Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @top_guidance_partial = "financial_calculations_shared_ownership" end QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 97 }.freeze diff --git a/app/models/form/sales/questions/equity.rb b/app/models/form/sales/questions/equity.rb index 6ee8d692f..2e1ad4dee 100644 --- a/app/models/form/sales/questions/equity.rb +++ b/app/models/form/sales/questions/equity.rb @@ -12,6 +12,7 @@ class Form::Sales::Questions::Equity < ::Form::Question @suffix = "%" @hint_text = "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @top_guidance_partial = "financial_calculations_shared_ownership" end QUESTION_NUMBER_FROM_YEAR = { 2023 => 89, 2024 => 90 }.freeze diff --git a/app/models/form/sales/questions/mortgage_amount.rb b/app/models/form/sales/questions/mortgage_amount.rb index f3ec338ee..e38737c89 100644 --- a/app/models/form/sales/questions/mortgage_amount.rb +++ b/app/models/form/sales/questions/mortgage_amount.rb @@ -12,6 +12,7 @@ class Form::Sales::Questions::MortgageAmount < ::Form::Question @hint_text = "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." @ownershipsch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] + @top_guidance_partial = "financial_calculations_shared_ownership" if ownershipsch == 1 end QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP = { diff --git a/app/models/form/sales/questions/value.rb b/app/models/form/sales/questions/value.rb index 61668aa83..3ec96e76e 100644 --- a/app/models/form/sales/questions/value.rb +++ b/app/models/form/sales/questions/value.rb @@ -11,6 +11,7 @@ class Form::Sales::Questions::Value < ::Form::Question @prefix = "£" @hint_text = "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @top_guidance_partial = "financial_calculations_shared_ownership" end QUESTION_NUMBER_FROM_YEAR = { 2023 => 88, 2024 => 89 }.freeze diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb index aa147767b..8bd2ce7bc 100644 --- a/app/views/form/_numeric_question.html.erb +++ b/app/views/form/_numeric_question.html.erb @@ -1,4 +1,4 @@ -<%= render partial: "form/guidance/#{question.top_guidance_partial}" if question.top_guidance? %> +<%= render partial: "form/guidance/#{question.top_guidance_partial}", locals: { log: @log } if question.top_guidance? %> <%= f.govuk_text_field( question.id.to_sym, diff --git a/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb b/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb new file mode 100644 index 000000000..8edbbd375 --- /dev/null +++ b/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb @@ -0,0 +1,10 @@ +<%= govuk_details(summary_text: "How the financial values are calculated’") do %> +

+ The mortgage amount (<%= govuk_link_to "Q92", send("#{log.class.name.underscore}_#{log.form.get_question('mortgage', log).page.id}_path", log) %>), + cash deposit (<%= govuk_link_to "Q95", send("#{log.class.name.underscore}_#{log.form.get_question('deposit', log).page.id}_path", log) %>) + and cash discount (<%= govuk_link_to "Q97", send("#{log.class.name.underscore}_#{log.form.get_question('cashdis', log).page.id}_path", log) %>) + added together must equal + the purchase price (<%= govuk_link_to "Q88", send("#{log.class.name.underscore}_#{log.form.get_question('value', log).page.id}_path", log) %>) + multiplied by the percentage equity stake (<%= govuk_link_to "Q89", send("#{log.class.name.underscore}_#{log.form.get_question('equity', log).page.id}_path", log) %>) +

+<% end %>