Skip to content

Commit

Permalink
Merge pull request #7609 from ministryofjustice/ap-5427/cya-update-me…
Browse files Browse the repository at this point in the history
…rits-report

AP-5427: CYA updates for merits report
  • Loading branch information
jsugarman authored Feb 7, 2025
2 parents 17489b0 + ad46dc1 commit 3709930
Show file tree
Hide file tree
Showing 21 changed files with 350 additions and 199 deletions.

This file was deleted.

42 changes: 0 additions & 42 deletions app/components/reports/merits/delegated_functions_component.rb

This file was deleted.

14 changes: 14 additions & 0 deletions app/views/providers/merits_reports/_applied_previously.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%= govuk_summary_card(title: t(".heading"),
heading_level: 3,
html_attributes: { id: "app-check-your-answers__applied_previously__card" }) do |card|
card.with_summary_list(actions: false, html_attributes: { id: "app-check-your-answers__applied_previously__summary" }) do |summary_list|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__applied_previously" }) do |row|
row.with_key(text: t(".has_applied_before"), classes: "govuk-!-width-one-half")
row.with_value(text: yes_no(legal_aid_application.applicant.applied_previously))
end
summary_list.with_row(html_attributes: { id: "app-check-your-answers__previous_reference" }) do |row|
row.with_key(text: t(".previous_application_reference"), classes: "govuk-!-width-one-half")
row.with_value(text: legal_aid_application.applicant.previous_reference.presence || "-")
end
end
end %>
37 changes: 37 additions & 0 deletions app/views/providers/merits_reports/_delegated_functions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<% proceedings.each do |proceeding| %>
<% if proceeding.used_delegated_functions? %>

<%= govuk_summary_card(title: proceeding.meaning,
heading_level: 3,
html_attributes: { id: "app-check-your-answers__delegated_functions__#{proceeding.name}" }) do |card|
card.with_summary_list(actions: false, html_attributes: { id: "app-check-your-answers__delegated_functions__#{proceeding.name}__summary" }) do |summary_list|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__used_delegated_functions_reported_on__#{proceeding.name}" }) do |row|
row.with_key(text: t(".reported_on"), classes: "govuk-!-width-one-half")
row.with_value(text: proceeding.used_delegated_functions_reported_on)
end

summary_list.with_row(html_attributes: { id: "app-check-your-answers__used_delegated_functions_on__#{proceeding.name}" }) do |row|
row.with_key(text: t(".used_on"), classes: "govuk-!-width-one-half")
row.with_value(text: proceeding.used_delegated_functions_on)
end

summary_list.with_row(html_attributes: { id: "app-check-your-answers__delegated_functions_days_to_report__#{proceeding.name}" }) do |row|
row.with_key(text: t(".days_to_report"), classes: "govuk-!-width-one-half")
row.with_value(text: distance_of_time_in_words(proceeding.used_delegated_functions_reported_on, proceeding.used_delegated_functions_on))
end
end
end %>

<% else %>

<%= govuk_summary_card(title: proceeding.meaning,
heading_level: 3,
html_attributes: { id: "app-check-your-answers__delegated_functions__#{proceeding.name}" }) do |card|
card.with_summary_list(actions: false, html_attributes: { id: "app-check-your-answers__delegated_functions" }) do |summary_list|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__used_delegated_functions_on__#{proceeding.name}" }) do |row|
row.with_value(text: t(".not_used"), classes: "govuk-!-width-full")
end
end
end %>
<% end %>
<% end %>
12 changes: 12 additions & 0 deletions app/views/providers/merits_reports/_proceeding_details.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%= govuk_summary_card(title: t(".heading"),
heading_level: 3,
html_attributes: { id: "app-check-your-answers__proceeding_details__card" }) do |card|
card.with_summary_list(actions: false, html_attributes: { id: "app-check-your-answers__proceeding_details__summary" }) do |summary_list|
legal_aid_application.proceedings_by_name.each_with_index do |proceeding, i|
summary_list.with_row(classes: "app-check-your-answers__#{proceeding.name}__row") do |row|
row.with_key(text: "#{t('.proceeding')} #{i + 1}", classes: "govuk-!-width-one-half")
row.with_value { proceeding.meaning }
end
end
end
end %>
34 changes: 5 additions & 29 deletions app/views/providers/merits_reports/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,17 @@
) %>
<% end %>

<h2 class="govuk-heading-m"><%= t(".previous_legal_aid") %></h2>

<%= govuk_summary_list(card: { title: t(".previous_legal_aid") },
html_attributes: { id: "previous-legal-aid-question" }) do |summary_list| %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__applied_previously" }) do |row| %>
<%= row.with_key(text: t(".has_applied_before"), classes: "govuk-!-width-one-half") %>
<%= row.with_value(text: yes_no(@legal_aid_application.applicant.applied_previously)) %>
<% end %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__applied_previously" }) do |row| %>
<%= row.with_key(text: t(".previous_application_reference"), classes: "govuk-!-width-one-half") %>
<%= row.with_value(text: @legal_aid_application.applicant.previous_reference.presence || "-") %>
<% end %>
<% end %>
<h2 class="govuk-heading-m"><%= t(".previous_legal_aid_heading") %></h2>
<%= render("applied_previously", legal_aid_application: @legal_aid_application) %>

<h2 class="govuk-heading-m"><%= t(".applying_for") %></h2>
<%= render("proceeding_details", legal_aid_application: @legal_aid_application) %>

<%= render(
"shared/check_answers/proceedings_details",
legal_aid_application: @legal_aid_application,
read_only: true,
show_client_involvment_type: true,
) %>

<h2 class="govuk-heading-m"><%= t ".delegated_functions" %></h2>

<%= render(
Reports::Merits::DelegatedFunctionsComponent.with_collection(
@legal_aid_application.proceedings.in_order_of_addition,
),
) %>
<h2 class="govuk-heading-m"><%= t ".delegated_functions_heading" %></h2>
<%= render("delegated_functions", proceedings: @legal_aid_application.proceedings.in_order_of_addition) %>

<% if @legal_aid_application.non_sca_used_delegated_functions? %>
<h2 class="govuk-heading-m"><%= t ".emergency_cost_limit" %></h2>

<%= render(
"shared/check_answers/emergency_costs",
legal_aid_application: @legal_aid_application,
Expand All @@ -64,7 +41,6 @@

<% if @legal_aid_application.substantive_cost_overridable? %>
<h2 class="govuk-heading-m"><%= t ".substantive_cost_limit" %></h2>

<%= render(
"shared/check_answers/substantive_costs",
legal_aid_application: @legal_aid_application,
Expand Down
36 changes: 20 additions & 16 deletions app/views/shared/check_answers/_emergency_costs.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<%= govuk_summary_list(card: { title: t(".heading") }, actions: false) do |summary_list| %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__emergency_cost_override" }) do |row| %>
<%= row.with_key(text: t(".request_higher_limit"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { yes_no(@legal_aid_application.emergency_cost_override) } %>
<% end %>
<%= govuk_summary_card(title: t(".heading"),
heading_level: 3,
html_attributes: { id: "app-check-your-answers__emergency_cost_override__card" }) do |card|
card.with_summary_list(actions: !read_only, html_attributes: { id: "app-check-your-answers__emergency_cost_override__summary" }) do |summary_list|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__emergency_cost_override" }) do |row|
row.with_key(text: t(".request_higher_limit"), classes: "govuk-!-width-one-half")
row.with_value { yes_no(@legal_aid_application.emergency_cost_override) }
end

<% if @legal_aid_application.emergency_cost_override %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__emergency_cost_requested" }) do |row| %>
<%= row.with_key(text: t(".new_cost_limit"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { gds_number_to_currency(@legal_aid_application.emergency_cost_requested, precision: 2) } %>
<% end %>
if @legal_aid_application.emergency_cost_override
summary_list.with_row(html_attributes: { id: "app-check-your-answers__emergency_cost_requested" }) do |row|
row.with_key(text: t(".new_cost_limit"), classes: "govuk-!-width-one-half")
row.with_value { gds_number_to_currency(@legal_aid_application.emergency_cost_requested, precision: 2) }
end

<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__emergency_cost_reasons" }) do |row| %>
<%= row.with_key(text: t(".new_limit_reasons"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { @legal_aid_application.emergency_cost_reasons } %>
<% end %>
<% end %>
<% end %>
summary_list.with_row(html_attributes: { id: "app-check-your-answers__emergency_cost_reasons" }) do |row|
row.with_key(text: t(".new_limit_reasons"), classes: "govuk-!-width-one-half")
row.with_value { @legal_aid_application.emergency_cost_reasons }
end
end
end
end %>
8 changes: 0 additions & 8 deletions app/views/shared/check_answers/_proceedings_details.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

police_question = domestic_abuse_summary.police_notified? ? "police_notified_details" : "police_not_notified"
summary_list.with_row(html_attributes: { id: "app-check-your-answers__opponent_warning_letter_sent" }) do |row|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__police_notified_details" }) do |row|
row.with_key(text: t(".#{police_question}"), classes: "govuk-!-width-one-third")
row.with_value(text: domestic_abuse_summary.police_notified_details)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<% end %>

<section class="proceeding_details print-no-break">
<h2 class="govuk-heading-l"><%= t(".proceedings_details_heading") %></h2>
<h2 class="govuk-heading-l"><%= t(".proceeding_details_section_heading") %></h2>
<%= render("shared/check_answers/proceeding_details_section") %>
</section>

Expand Down
8 changes: 0 additions & 8 deletions config/locales/en/components.yml

This file was deleted.

20 changes: 15 additions & 5 deletions config/locales/en/providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1491,13 +1491,23 @@ en:
heading: Merits report
client_details_heading: Client details
partner_details_heading: Partner details
previous_legal_aid: Previous Legal Aid
has_applied_before: Has your client applied for civil legal aid before?
previous_application_reference: Previous CCMS reference number
applying_for: What you’re applying for
delegated_functions: Delegated functions
previous_legal_aid_heading: Previous Legal Aid
applying_for: What you're applying for
delegated_functions_heading: Delegated functions
emergency_cost_limit: Emergency cost limit
substantive_cost_limit: Substantive cost limit
applied_previously:
heading: Previous Legal Aid
has_applied_before: Has your client applied for civil legal aid before?
previous_application_reference: Previous CCMS reference number
proceeding_details:
heading: Proceedings
proceeding: Proceeding
delegated_functions:
reported_on: Date reported
used_on: Date delegated functions were used
days_to_report: Days to report
not_used: Not used
means_reports:
assets_heading: &assets_heading Property, savings and other assets
benefit_check_heading: Passported means
Expand Down
5 changes: 1 addition & 4 deletions config/locales/en/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,6 @@ en:
heading: Proceedings
proceeding: Proceeding
proceedings_details:
heading: Proceedings
proceeding: Proceeding
section_proceeding:
client_involvement_type: Client involvement type
client_involvement_type_applicant: Applicant
Expand Down Expand Up @@ -653,7 +651,6 @@ en:
request_higher_substantive: Higher substantive cost limit requested
higher_substantive_reasons: Reason for higher emergency cost limit
delegated_functions:
not_used: Not used
section_delegated:
used_delegated_functions: Have you used delegated functions?
used_delegated_functions_on: Date you used delegated functions
Expand Down Expand Up @@ -963,7 +960,7 @@ en:
client_details_heading: Client details
partner_details_heading: Partner details
linking_and_copying_heading: Cases linked to this one
proceedings_details_heading: What you're applying for
proceeding_details_section_heading: What you're applying for
change: Change
emergency_cost_limit: Emergency cost limit
substantive_cost_limit: Substantive cost limit
Expand Down
2 changes: 1 addition & 1 deletion features/providers/check_merits_answers.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: Check merits answers
@javascript @vcr
Scenario: Checking merits answers for an application with multiple procedings
Scenario: Checking merits answers for an application with multiple proceedings
Given I complete the journey as far as check merits answers with multiple proceedings
Then I should be on a page showing "Fake gateway evidence file"
Then I should be on a page showing "Fake file name 1 (15.7 KB)"
Expand Down
Loading

0 comments on commit 3709930

Please sign in to comment.