Browse Source

Add guidance

pull/2541/head
Kat 2 years ago
parent
commit
a30b4fc0ee
  1. 1
      app/models/form/sales/questions/deposit_amount.rb
  2. 1
      app/models/form/sales/questions/deposit_discount.rb
  3. 1
      app/models/form/sales/questions/equity.rb
  4. 1
      app/models/form/sales/questions/mortgage_amount.rb
  5. 1
      app/models/form/sales/questions/value.rb
  6. 2
      app/views/form/_numeric_question.html.erb
  7. 10
      app/views/form/guidance/_financial_calculations_shared_ownership.html.erb

1
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)

1
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

1
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

1
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 = {

1
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

2
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,

10
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 %>
<p class="govuk-body">
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) %>)
</p>
<% end %>
Loading…
Cancel
Save