Skip to content

Commit

Permalink
Merge pull request #7423 from ministryofjustice/ap-4823-include-depen…
Browse files Browse the repository at this point in the history
…dants-on-means-report

AP-4823: Include dependants info on means report
  • Loading branch information
agoldstone93 authored Nov 14, 2024
2 parents a2abaa1 + 922708b commit 883ea0d
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@

<div class="govuk-!-padding-bottom-8"></div>

<% individual_text = if @legal_aid_application.applicant.has_partner_with_no_contrary_interest?
"your client or their partner"
else
"your client"
end %>
<section class="print-no-break">
<h2 class="govuk-heading-l"><%= t("providers.means.check_income_answers.dependants.heading") %></h2>
<%= render "shared/check_answers/dependants", individual: individual_text, read_only: true, means_report: true %>
</section>

<%= render "caseworker_review" %>
<% end %>

Expand Down
49 changes: 30 additions & 19 deletions app/views/shared/check_answers/_dependants.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<% url = if @legal_aid_application.has_dependants?
providers_legal_aid_application_means_has_other_dependants_path
else
providers_legal_aid_application_means_has_dependants_path
end %>

<%= govuk_summary_list(classes: "govuk-!-margin-bottom-9") do |summary_list| %>
<% read_only = false unless local_assigns.key?(:read_only) %>
<% means_report = false unless local_assigns.key?(:means_report) %>

<% unless read_only
url = if @legal_aid_application.has_dependants?
providers_legal_aid_application_means_has_other_dependants_path
else
providers_legal_aid_application_means_has_dependants_path
end
end %>

<%= govuk_summary_list(actions: !read_only,
classes: "govuk-!-margin-bottom-9",
html_attributes: { id: "dependants-questions" }) do |summary_list| %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__dependants" }) do |row| %>
<%= row.with_key(text: t("shared.check_answers.dependants.has_dependants", individual:), classes: "govuk-!-width-one-half") %>
<%= row.with_value { yes_no(@legal_aid_application.has_dependants) } %>
Expand All @@ -23,27 +31,30 @@
<h2 class="govuk-heading-m">Dependant <%= index + 1 %>: <%= dependant.name %></h2>
</div>

<div class="govuk-grid-column-one-third align-text-right">
<p>
<%= govuk_link_to(
t("generic.change"),
providers_legal_aid_application_means_dependant_path(@legal_aid_application, dependant),
"aria-label": "#{t('generic.change')} Dependant #{index + 1}: #{dependant.name}",
) %>
</p>
</div>
<% if !read_only %>
<div class="govuk-grid-column-one-third align-text-right">
<p>
<%= govuk_link_to(
t("generic.change"),
providers_legal_aid_application_means_dependant_path(@legal_aid_application, dependant),
"aria-label": "#{t('generic.change')} Dependant #{index + 1}: #{dependant.name}",
) %>
</p>
</div>
<% end %>
</div>

<%= govuk_summary_list(
actions: false,
classes: "govuk-!-margin-bottom-9",
html_attributes: { id: "app-check-your-answers__dependants_#{index + 1}_items" },
) do |summary_list| %>
<% dependant_hash(dependant)&.fetch(:items, [])&.each_with_index do |item, index| %>
<% name = item.name || "dependants_#{index + 1}_#{index}" %>
<%= summary_list.with_row do |row| %>
<%= row.with_key(text: item.label, classes: "govuk-!-width-one-half") %>
<%= row.with_value { safe_yes_or_no(item.amount_text) } %>
<% unless means_report && !item.label.in?(["Name", "Date of birth", "What is their relationship to your client?"]) %>
<%= summary_list.with_row do |row| %>
<%= row.with_key(text: item.label, classes: "govuk-!-width-one-half") %>
<%= row.with_value { safe_yes_or_no(item.amount_text) } %>
<% end %>
<% end %>
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ en:
submit: Submit
submit_and_continue: Submit and continue
success: Success
tell_us: Your statement must include
tell_us: "Your statement must include:"
total: Total
toggle_navigation: Show or hide Top Level Navigation
undefined: Undefined
Expand Down
12 changes: 10 additions & 2 deletions features/providers/means_report.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Feature: Means report
| h3 | Client employment income |
| h2 | Outgoings |
| h2 | Deductions |
| h2 | Dependants |
| h2 | Caseworker Review |
| h2 | Capital result |
| h2 | Property, savings and other assets |
Expand All @@ -38,7 +39,6 @@ Feature: Means report
| h2 | Student finance |
| h2 | Employed income result |
| h2 | Declared cash income |
| h2 | Dependants |
| h2 | Declared outgoings categories |
| h2 | Declared cash outgoings |

Expand Down Expand Up @@ -95,6 +95,15 @@ Feature: Means report
| question |
| Dependants allowance |
| Total deductions |

And the Dependants questions should exist:
| question |
| Does your client have any dependants? |

And the Dependants detail questions should exist:
| Name |
| Date of birth |
| What is their relationship to your client? |

And the Caseworker review section should contain:
| question | answer |
Expand Down Expand Up @@ -205,7 +214,6 @@ Feature: Means report
| h2 | Student finance |
| h2 | Employed income result |
| h2 | Declared cash income |
| h2 | Dependants |
| h2 | Declared outgoings categories |
| h2 | Declared cash outgoings |
| h3 | Bank statements |
Expand Down
22 changes: 20 additions & 2 deletions features/providers/mtr_accelerated/means_report.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Feature: Means report
| h3 | Client employment income |
| h2 | Outgoings |
| h2 | Deductions |
| h2 | Dependants |
| h2 | Caseworker Review |
| h2 | Capital result |
| h2 | Property, savings and other assets |
Expand All @@ -41,7 +42,6 @@ Feature: Means report
| h2 | Student finance |
| h2 | Employed income result |
| h2 | Declared cash income |
| h2 | Dependants |
| h2 | Declared outgoings categories |
| h2 | Declared cash outgoings |
| h2 | Payments from scheme or charities |
Expand Down Expand Up @@ -104,6 +104,15 @@ Feature: Means report
| Dependants allowance |
| Total deductions |

And the Dependants questions should exist:
| question |
| Does your client have any dependants? |

And the Dependants detail questions should exist:
| Name |
| Date of birth |
| What is their relationship to your client? |

And the Caseworker review section should contain:
| question | answer |
| Caseworker review required? | Yes |
Expand Down Expand Up @@ -193,6 +202,7 @@ Feature: Means report
| h3 | Client employment income |
| h2 | Outgoings |
| h2 | Deductions |
| h2 | Dependants |
| h2 | Caseworker Review |
| h2 | Capital result |
| h2 | Property, savings and other assets |
Expand All @@ -213,7 +223,6 @@ Feature: Means report
| h2 | Student finance |
| h2 | Employed income result |
| h2 | Declared cash income |
| h2 | Dependants |
| h2 | Declared outgoings categories |
| h2 | Declared cash outgoings |
| h2 | Payments from scheme or charities |
Expand Down Expand Up @@ -277,6 +286,15 @@ Feature: Means report
| Dependants allowance |
| Total deductions |

And the Dependants questions should exist:
| question |
| Does your client have any dependants? |

And the Dependants detail questions should exist:
| Name |
| Date of birth |
| What is their relationship to your client? |

And the Caseworker review section should contain:
| question | answer |
| Caseworker review required? | Yes |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Feature: Means report when partner is present
| h2 | Student finance |
| h2 | Employed income result |
| h2 | Declared cash income |
| h2 | Dependants |
| h2 | Declared outgoings categories |
| h2 | Declared cash outgoings |

Expand Down Expand Up @@ -113,6 +112,15 @@ Feature: Means report when partner is present
| Dependants allowance |
| Total deductions |

And the Dependants questions should exist:
| question |
| Does your client or their partner have any dependants? |

And the Dependants detail questions should exist:
| Name |
| Date of birth |
| What is their relationship to your client or their partner? |

And the Caseworker review section should contain:
| question | answer |
| Caseworker review required? | Yes |
Expand Down

0 comments on commit 883ea0d

Please sign in to comment.