Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP-5572 Use summary card component for CYA income page #7567

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/helpers/dependant_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def date_of_birth(dependant)
end

def relationship(dependant)
partner = dependant.legal_aid_application.applicant_has_partner? ? "_with_partner" : ""
build_ostruct(
t("relationship", scope: "providers.means.check_income_answers.dependants"),
t("relationship#{partner}", scope: "providers.means.check_income_answers.dependants"),
dependant.relationship.nil? ? "" : t(dependant.relationship, scope: "shared.forms.dependants.relationship.option"),
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/transaction_type_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def answer_for_transaction_type(legal_aid_application:, transaction_type:, owner
def regular_transaction_answer_by_type(legal_aid_application:, transaction_type:, owner_type:)
regular_transaction = legal_aid_application.regular_transactions.find_by(transaction_type:, owner_type:)
if regular_transaction
[number_to_currency(regular_transaction.amount), t("transaction_types.frequencies.#{regular_transaction.frequency}")]
[number_to_currency(regular_transaction.amount), t("transaction_types.frequencies.#{regular_transaction.frequency}").downcase]
else
t("generic.none")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@
read_only: false,
url: providers_legal_aid_application_means_cash_income_path,
individual: "Applicant",
individual_with_determiner: "your client",
individual_with_determiner: t("generic.client"),
type: :income,
) %>
<% end %>

<%= render(
"shared/check_answers/student_finance",
individual_text: "your client",
individual: @legal_aid_application.applicant,
individual: "Client",
individual_with_determiner: t("generic.client"),
model: @legal_aid_application.applicant,
url: providers_legal_aid_application_means_student_finance_path(@legal_aid_application),
read_only: false,
) %>
Expand All @@ -78,7 +79,7 @@
read_only: false,
url: providers_legal_aid_application_means_cash_outgoing_path,
individual: "Applicant",
individual_with_determiner: "your client",
individual_with_determiner: t("generic.client"),
type: :outgoings,
) %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% if @legal_aid_application.partner.has_multiple_employments? %>
<%= render(
"shared/check_answers/full_employment_details",
individual: "The partner",
individual: t("generic.partner"),
read_only: false,
partner: true,
) %>
Expand All @@ -17,7 +17,7 @@
<% elsif @legal_aid_application.partner.employed? %>
<%= render(
"shared/check_answers/full_employment_details",
individual: "The partner",
individual: t("generic.partner"),
read_only: false,
partner: true,
) %>
Expand All @@ -42,14 +42,15 @@
read_only: false,
url: providers_legal_aid_application_partners_cash_income_path,
individual: "Partner",
individual_with_determiner: "the partner",
individual_with_determiner: t("generic.partner"),
type: :income,
) %>

<%= render(
"shared/check_answers/student_finance",
individual_text: "the partner",
individual: @legal_aid_application.partner,
individual: "Partner",
individual_with_determiner: t("generic.partner"),
model: @legal_aid_application.partner,
url: providers_legal_aid_application_partners_student_finance_path(@legal_aid_application),
read_only: false,
) %>
Expand All @@ -69,7 +70,7 @@
read_only: false,
url: providers_legal_aid_application_partners_cash_outgoing_path,
individual: "Partner",
individual_with_determiner: "the partner",
individual_with_determiner: t("generic.partner"),
type: :outgoings,
) %>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
) %>
<% end %>

<h2 class="govuk-heading-l"><%= t("providers.means.check_income_answers.dependants.heading") %></h2>
<h2 class="govuk-heading-l"><%= t("providers.means.check_income_answers.dependants.heading-h2") %></h2>

<%= render "shared/check_answers/dependants" %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"your client"
end %>
<section class="print-no-break">
<h2 class="govuk-heading-l"><%= t("providers.means.check_income_answers.dependants.heading") %></h2>
<h2 class="govuk-heading-l"><%= t("providers.means.check_income_answers.dependants.heading-h2") %></h2>
<%= render "shared/check_answers/dependants", individual: individual_text, read_only: true, means_report: true %>
</section>

Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/check_answers/_bank_statements.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<% individual = partner ? "Partner" : "Client" %>

<%= govuk_summary_card(title: t(".section_heading")) do |card| %>
<%= govuk_summary_card(title: t(".section_heading"), html_attributes: { id: "app-check-your-answers__bank_statements" }, heading_level: 3) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{individual} #{t('.bank_statement_question')}") } %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/check_answers/_benefits_income.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end
end %>

<%= govuk_summary_card(title: t(".#{transactions_for}.heading"), html_attributes: { id: "state-benefit-section-#{transactions_for}" }) do |card| %>
<%= govuk_summary_card(title: t(".#{transactions_for}.heading"), heading_level: 3, html_attributes: { id: "app-check-your-answers__#{transactions_for}__state_benefits_question" }) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": t(".#{transactions_for}.change_aria")) } %>
<% end %>
Expand All @@ -22,7 +22,7 @@

<% state_benefits.each_with_index do |state_benefit, index| %>

<%= govuk_summary_card(title: t(".benefit_heading", index: index + 1), html_attributes: { id: "app-check-your-answers__#{transactions_for}__state_benefits_#{index + 1}" }) do |card| %>
<%= govuk_summary_card(title: t(".benefit_heading", index: index + 1), heading_level: 3, html_attributes: { id: "app-check-your-answers__#{transactions_for}__state_benefits_#{index + 1}" }) do |card| %>
<%= unless read_only
card.with_action do
govuk_link_to(t("generic.change"),
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/check_answers/_cash_payments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<% cash_transactions = @legal_aid_application.cash_transactions.where(owner_type: individual) %>

<%= govuk_summary_card(title: t(".#{type}_heading", individual_with_determiner:)) do |card| %>
<%= govuk_summary_card(title: t(".#{type}_heading", individual_with_determiner:), heading_level: 3, html_attributes: { id: "app-check-your-answers__#{individual.downcase}__cash_#{type}" }) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{t('generic.change')} #{t(".#{type}_heading", individual_with_determiner:)}") } %>
<% end %>
Expand All @@ -23,7 +23,7 @@
<%= row.with_value do %>
<% if cash_transactions.for_transaction_type(category.id).any? %>
<% cash_transactions.for_transaction_type(category.id).each do |ctx| %>
<strong><%= ctx.transaction_date.strftime("%B") %></strong>: <%= gds_number_to_currency(ctx.amount, precision: 2) %><br>
<%= "#{gds_number_to_currency(ctx.amount, precision: 2)} in #{ctx.transaction_date.strftime('%B')}" %> <br>
jsugarman marked this conversation as resolved.
Show resolved Hide resolved
<% end %>
<% else %>
<%= t("generic.none") %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/shared/check_answers/_dependants.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
end
end %>

<%= govuk_summary_card(title: t("providers.means.check_income_answers.dependants.heading"), html_attributes: { id: "app-check-your-answers__dependants" }) do |card| %>
<%= govuk_summary_card(title: t("providers.means.check_income_answers.dependants.heading-h3"), html_attributes: { id: "app-check-your-answers__dependants" }) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{t('generic.change')} #{t("shared.check_answers.dependants.#{individual}_has_dependants")}") } %>
<% end %>
<%= card.with_summary_list do |summary_list| %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__dependants" }) do |row| %>
<%= summary_list.with_row do |row| %>
<%= row.with_key(text: t("shared.check_answers.dependants.#{individual}_has_dependants"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { yes_no(@legal_aid_application.has_dependants) } %>
<% end %>
Expand All @@ -27,7 +27,7 @@
<% if @legal_aid_application.dependants %>
<% @legal_aid_application.dependants.each_with_index do |dependant, index| %>
<%= govuk_summary_card(title: t(".dependant_name", position: index + 1),
html_attributes: { id: "app-check-your-answers__dependants_#{index + 1}_items" }) do |card| %>
html_attributes: { id: "app-check-your-answers__dependant_#{index + 1}" }) do |card| %>
<% unless read_only %>
<%= card.with_action { 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}") } %>
<% end %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/shared/check_answers/_employed_income.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<% if partner
individual = "partner"
individual_with_determiner = "the partner"
jsugarman marked this conversation as resolved.
Show resolved Hide resolved
model = @legal_aid_application.partner
url = providers_legal_aid_application_partners_employment_income_path(@legal_aid_application)
else
individual = "client"
individual_with_determiner = "your partner"
jsugarman marked this conversation as resolved.
Show resolved Hide resolved
model = @legal_aid_application.applicant
url = providers_legal_aid_application_means_employment_income_path(@legal_aid_application)
end %>

<%= govuk_summary_card(title: t(".heading", individual_with_determiner:).upcase_first) do |card| %>
<%= govuk_summary_card(title: t(".heading").upcase_first, heading_level: 3) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": t(".aria_label", individual_with_determiner:)) } %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
content = @legal_aid_application.full_employment_details
end %>

<%= govuk_summary_card(title: t(".employment")) do |card| %>
<%= govuk_summary_card(title: t(".employment"), heading_level: 3) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{t('generic.change')} #{individual_with_determiner}'s #{t('.employment')}") } %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% read_only = false unless local_assigns.key?(:read_only) %>

<%= govuk_summary_card(title: payment_type, html_attributes: { id: "app-check-your-answers__#{payment_type.parameterize(separator: '_')}" }) do |card| %>
<%= govuk_summary_card(title: payment_type, heading_level: 3, html_attributes: { id: "app-check-your-answers__#{payment_type.parameterize(separator: '_')}" }) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{t('generic.change')} #{payment_type}") } %>
<% end %>
Expand Down
18 changes: 9 additions & 9 deletions app/views/shared/check_answers/_student_finance.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<%= govuk_summary_card(title: t(".heading")) do |card| %>
<%= govuk_summary_card(title: t(".heading"), heading_level: 3, html_attributes: { id: "app-check-your-answers__#{model.class.to_s.downcase}__student_finance" }) do |card| %>
<% unless read_only %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{t('generic.change')} #{individual_text}'s #{t('.heading')}") } %>
<%= card.with_action { govuk_link_to(t("generic.change"), url, "aria-label": "#{t('generic.change')} #{individual_with_determiner}'s #{t('.heading')}") } %>
<% end %>
<% card.with_summary_list(html_attributes: { id: "app-check-your-answers__#{individual.class.to_s.downcase}_student_finance" }) do |summary_list| %>
<% if individual.student_finance? %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{individual.class.to_s.downcase}_student_finance_annual_amount" }) do |row| %>
<% card.with_summary_list(html_attributes: { id: "app-check-your-answers__#{individual.downcase}_student_finance" }) do |summary_list| %>
<% if model.student_finance? %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{individual.downcase}_student_finance_annual_amount" }) do |row| %>
<%= row.with_key(text: t(".how_much"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { gds_number_to_currency(individual.student_finance_amount) } %>
<%= row.with_value(text: t(".amount", amount: gds_number_to_currency(model.student_finance_amount))) %>
<% end %>
<% else %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{individual.class.to_s.downcase}_student_finance_question" }) do |row| %>
<%= row.with_key(text: t(".question", individual_text:), classes: "govuk-!-width-one-half") %>
<%= row.with_value { "#{yes_no(individual.student_finance?)} every year" } %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{individual.downcase}_student_finance_question" }) do |row| %>
<%= row.with_key(text: t(".question", individual:), classes: "govuk-!-width-one-half") %>
<%= row.with_value { yes_no(model.student_finance?) } %>
<% end %>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<section>
<%= govuk_summary_list(actions: false, classes: "govuk-!-margin-top-6") do |summary_list| %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__student_finance_question" }) do |row| %>
<%= row.with_key(text: t("shared.check_answers.student_finance.question", individual_text: "your client"), classes: "govuk-!-width-one-half") %>
<%= row.with_key(text: t("shared.check_answers.student_finance.question", individual: "client"), classes: "govuk-!-width-one-half") %>
<%= row.with_value(text: yes_no(@legal_aid_application.applicant.student_finance?), classes: "govuk-!-text-align-right") %>
<% end %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@

<%= render(
"shared/check_answers/student_finance",
individual_text: t("generic.client"),
individual: @legal_aid_application.applicant,
individual: "Client",
individual_with_determiner: t("generic.client"),
model: @legal_aid_application.applicant,
read_only: true,
) %>

Expand Down
5 changes: 3 additions & 2 deletions app/views/shared/review_application/_partner_income.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@

<%= render(
"shared/check_answers/student_finance",
individual_text: t("generic.partner"),
individual: @legal_aid_application.partner,
individual: "Partner",
individual_with_determiner: t("generic.partner"),
model: @legal_aid_application.partner,
read_only: true,
) %>

Expand Down
20 changes: 11 additions & 9 deletions config/locales/en/providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,8 @@ en:
page_heading: Select payments the partner pays in cash
cash_incomes:
show:
page_title: Select payments the partner receives in cash
none_of_the_above: The partner receives none of these payments in cash
page_title: Select payments the partner gets in cash
none_of_the_above: The partner gets none of these payments in cash
has_national_insurance_numbers:
show:
page_title: Does your client have a National Insurance number?
Expand Down Expand Up @@ -1034,8 +1034,8 @@ en:
none_and_another_option_selected: If you select 'My client does not get any of these payments', you cannot select any of the other options
cash_incomes:
show:
page_title: Select payments your client receives in cash
none_of_the_above: My client receives none of these payments in cash
page_title: Select payments your client gets in cash
none_of_the_above: My client gets none of these payments in cash
identify_types_of_outgoings:
show:
page_heading: Which of these payments does your client pay?
Expand Down Expand Up @@ -1123,17 +1123,19 @@ en:
credits-section-heading: Payments the partner gets
debits-section-heading: Payments the partner pays
dependants:
heading: Any dependants
heading-h2: Dependants
heading-h3: Any dependants
client_with_partner_has_dependants: Client or their partner has dependants?
client_has_dependants: Client has dependants?
add-new: Add dependant
delete: Delete dependant
name: Name
date_of_birth: Date of birth
relationship: What is their relationship to your client?
in_full_time_education: Are they in full-time education or training?
income: Do they receive any income?
assets: Do they have assets worth more than £8,000?
relationship: Relationship to your client?
relationship_with_partner: Relationship to your client or their partner?
in_full_time_education: In full-time education or training?
income: Has income?
assets: Has assets worth more than £8,000?
own_homes:
show:
h1_heading: Does your client own the home they usually live in?
Expand Down
21 changes: 10 additions & 11 deletions config/locales/en/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,11 @@ en:
new_cost_limit: Amount requested
new_limit_reasons: Reason
employed_income:
employment: Employment income
heading: Employment income
employment_details: Details
heading: "#{individual} employment income"
details_for: "Details for #{individual}"
question: "Do you need to tell us anything else about #{individual_with_determiner}'s employment?"
aria_label: "Change #{individual_with_determiner}'s employment details"
details_for: "Details for %{individual_with_determiner}"
question: "Do you need to tell us anything else about %{individual_with_determiner}'s employment?"
aria_label: "Change %{individual_with_determiner}'s employment details"
benefits_income:
applicant:
heading: Client benefits, charitable or government payments
Expand Down Expand Up @@ -597,9 +596,9 @@ en:
no_transactions: "No"
student_finance:
heading: Student finance
question: "%{individual_text} gets student finance?"
question: "%{individual} gets student finance?"
how_much: Amount of student finance
info_html: '<strong>%{student_finance}</strong> this academic year.'
amount: "%{amount} a year"
cash_payments:
income_heading: Payments %{individual_with_determiner} gets in cash
outgoings_heading: Payments %{individual_with_determiner} pays in cash
Expand Down Expand Up @@ -938,15 +937,15 @@ en:
income_payments_and_assets_for_bank_statement_upload:
capital-heading: "Your client's capital"
capital-heading_with_partner: "Your client and their partner's capital"
credits-section-heading: Payments your client receives
debits-section-heading: Payments your client makes
credits-section-heading: Payments your client gets
debits-section-heading: Payments your client pays
income-heading: Your client's income
outgoings-heading: Your client's outgoings
partner_income:
income-heading: The partner's income
outgoings-heading: The partner's outgoings
credits-section-heading: Payments the partner receives
debits-section-heading: Payments the partner makes
credits-section-heading: Payments the partner gets
debits-section-heading: Payments the partner pays
questions_and_answers:
client_name: Client
case_reference_html: <abbr title='Legal Aid Agency'>LAA</abbr> reference
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/transaction_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ en:
two_weekly: Every 2 weeks
four_weekly: Every 4 weeks
monthly: Monthly
three_monthly: Total in the last 3 months
three_monthly: Total in last 3 months
table_label:
benefits: Benefits
child_care: Childcare
Expand Down
Loading
Loading