diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb index 86bb456f3..8fba5a5c4 100644 --- a/app/models/form/sales/questions/deposit_amount.rb +++ b/app/models/form/sales/questions/deposit_amount.rb @@ -32,4 +32,9 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage. This excludes any grant or loan" end end + + def top_guidance_partial + return "financial_calculations_shared_ownership" if @ownershipsch == 1 + return "financial_calculations_discounted_ownership" if @ownershipsch == 2 + end end diff --git a/app/models/form/sales/questions/discount.rb b/app/models/form/sales/questions/discount.rb index fdee1e11c..f99203ebe 100644 --- a/app/models/form/sales/questions/discount.rb +++ b/app/models/form/sales/questions/discount.rb @@ -14,6 +14,7 @@ class Form::Sales::Questions::Discount < ::Form::Question If discount capped, enter capped % If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." @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_discounted_ownership" end QUESTION_NUMBER_FROM_YEAR = { 2023 => 102, 2024 => 103 }.freeze diff --git a/app/models/form/sales/questions/grant.rb b/app/models/form/sales/questions/grant.rb index 00b54e8d2..45b70d61f 100644 --- a/app/models/form/sales/questions/grant.rb +++ b/app/models/form/sales/questions/grant.rb @@ -12,6 +12,7 @@ class Form::Sales::Questions::Grant < ::Form::Question @prefix = "£" @hint_text = "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB) and Rent to Buy" @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_discounted_ownership" end QUESTION_NUMBER_FROM_YEAR = { 2023 => 101, 2024 => 102 }.freeze diff --git a/app/models/form/sales/questions/mortgage_amount.rb b/app/models/form/sales/questions/mortgage_amount.rb index e38737c89..b36acc15d 100644 --- a/app/models/form/sales/questions/mortgage_amount.rb +++ b/app/models/form/sales/questions/mortgage_amount.rb @@ -12,7 +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 + @top_guidance_partial = top_guidance_partial end QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP = { @@ -23,4 +23,9 @@ class Form::Sales::Questions::MortgageAmount < ::Form::Question def derived?(log) log&.mortgage_not_used? end + + def top_guidance_partial + return "financial_calculations_shared_ownership" if ownershipsch == 1 + return "financial_calculations_discounted_ownership" if ownershipsch == 2 + end end diff --git a/app/models/form/sales/questions/purchase_price.rb b/app/models/form/sales/questions/purchase_price.rb index 428d0cce0..68c9436d3 100644 --- a/app/models/form/sales/questions/purchase_price.rb +++ b/app/models/form/sales/questions/purchase_price.rb @@ -12,6 +12,7 @@ class Form::Sales::Questions::PurchasePrice < ::Form::Question @hint_text = hint_text @ownership_sch = 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_discounted_ownership" if ownershipsch == 2 end QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP = { diff --git a/app/views/form/guidance/_financial_calculations_dicsounted_ownership.html.erb b/app/views/form/guidance/_financial_calculations_dicsounted_ownership.html.erb new file mode 100644 index 000000000..c16980b71 --- /dev/null +++ b/app/views/form/guidance/_financial_calculations_dicsounted_ownership.html.erb @@ -0,0 +1,10 @@ +<%= govuk_details(summary_text: "How the financial values are calculated") do %> +
+ The mortgage amount (<%= govuk_link_to "Q105", send("#{log.class.name.underscore}_#{log.form.get_question('mortgage', log).page.id}_path", log) %>), + cash deposit (<%= govuk_link_to "Q109", send("#{log.class.name.underscore}_#{log.form.get_question('deposit', log).page.id}_path", log) %>) + and grant (<%= govuk_link_to "Q102", send("#{log.class.name.underscore}_#{log.form.get_question('grant', log).page.id}_path", log) %>) + added together must equal + the purchase price (<%= govuk_link_to "Q101", send("#{log.class.name.underscore}_#{log.form.get_question('value', log).page.id}_path", log) %>) + multiplied by the discount stake (<%= govuk_link_to "103", send("#{log.class.name.underscore}_#{log.form.get_question('discount', log).page.id}_path", log) %>) +
+<% 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 8edbbd375..1164a3461 100644 --- a/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb +++ b/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb @@ -1,4 +1,4 @@ -<%= govuk_details(summary_text: "How the financial values are calculated’") do %> +<%= 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) %>)