Skip to content

Commit

Permalink
Create table to display maat data
Browse files Browse the repository at this point in the history
  • Loading branch information
Katy600 committed Mar 28, 2024
1 parent 4c7ebd7 commit 45c3e88
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ GEM
net-ssh (7.2.1)
netrc (0.11.0)
nio4r (2.7.1)
nokogiri (1.16.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
Expand Down Expand Up @@ -675,6 +677,7 @@ GEM

PLATFORMS
arm64-darwin-22
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down
1 change: 1 addition & 0 deletions app/controllers/external_users/claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def set_user_and_provider
def set_presenters
@defendant_presenter = ExternalUsers::DefendantPresenter
end

def set_claims_context
context = Claims::ContextMapper.new(@external_user, scheme:)
@claims_context = context.available_claims
Expand Down
46 changes: 21 additions & 25 deletions app/views/shared/_claim_defendant_details.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,28 @@
%h4.govuk-heading-s
= t('.defendant', context: index)

= govuk_summary_list do
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.full_name') ) { defendant.name }
= govuk_summary_list do
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.full_name') ) { defendant.name }

- if defendant.date_of_birth.present?
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.date_of_birth') ) { defendant.date_of_birth.strftime(Settings.date_format) rescue '' }
- if defendant.date_of_birth.present?
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.date_of_birth') ) { defendant.date_of_birth.strftime(Settings.date_format) rescue '' }

- unless @claim.lgfs? && @claim.interim?
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.judical_apportionment') ) { defendant.order_for_judicial_apportionment == true ? t('global_yes') : t('global_no') }
- unless @claim.lgfs? && @claim.interim?
= govuk_summary_list_row_collection( t('external_users.claims.defendants.defendant_fields.judical_apportionment') ) { defendant.order_for_judicial_apportionment == true ? t('global_yes') : t('global_no') }


- if defendant.representation_orders.any?
= govuk_table do
= govuk_table_caption do
- if defendant.representation_orders.any?
%h5.govuk-heading-s
= t('shared.claim.reporders')

= govuk_table_thead_collection [t('.date'),
t('external_users.claims.defendants.representation_order_fields.maat_reference_number')]

= govuk_table_tbody do
- defendant.representation_orders.each do | representation_order |
= govuk_table_row do
= govuk_table_td('data-label': t('.date')) do
= representation_order.representation_order_date.strftime(Settings.date_format) rescue ''

= govuk_table_td('data-label': t('external_users.claims.defendants.representation_order_fields.maat_reference_number')) do
= representation_order.maat_reference

- else
= govuk_inset_text(t('.no_reporder'))
= govuk_table do
= govuk_table_thead_collection [t('.date'),
t('external_users.claims.defendants.representation_order_fields.maat_reference_number')]

= govuk_table_tbody do
- defendant.representation_orders.each do | representation_order |
= govuk_table_row do
= govuk_table_td('data-label': t('.date')) do
= representation_order.representation_order_date.strftime(Settings.date_format) rescue ''
= govuk_table_td('data-label': t('external_users.claims.defendants.representation_order_fields.maat_reference_number')) do
= representation_order.maat_reference
- else
= govuk_inset_text(t('.no_reporder'))
2 changes: 1 addition & 1 deletion app/views/shared/_claim_defendants.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
- defendants.each_with_index do | defendant, index |
.govuk-grid-column-one-half
= render partial: 'shared/claim_defendant_details', locals: { defendant: defendant, index: index += 1 }
= render partial: 'shared/claim_defendant_details', locals: { defendant: present(defendant, CaseWorkers::DefendantPresenter), index: index += 1 }
11 changes: 11 additions & 0 deletions app/views/shared/_representation_order_details.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
= govuk_table do |table|
- table.with_caption(size: 's', text: 'Details from MAAT (beta)')

- table.with_body do |body|
- body.with_row do |row|
- row.with_cell(header: true, text: 'Case number')
- row.with_cell(text: representation_order.maat_details[:case_number])

- body.with_row do |row|
- row.with_cell(header: true, text: 'Date')
- row.with_cell(text: representation_order.maat_details[:representation_order_date])

0 comments on commit 45c3e88

Please sign in to comment.