From 943a49fa431ef7c0d422b7535ac22e820963d199 Mon Sep 17 00:00:00 2001 From: elasticspoon Date: Sat, 23 Mar 2024 17:43:53 -0400 Subject: [PATCH] feat: rework court report generation Add generate docx modal with date pickers to filter dates of case contacts to include in the generated report. Modify current tests to open the modal before attempting to click within it. Allow range filtering of contacts in case report --- app/assets/stylesheets/base/variables.scss | 6 + app/assets/stylesheets/pages/casa_cases.scss | 49 +++++ .../stylesheets/pages/case_court_reports.scss | 0 app/assets/stylesheets/shared/typography.scss | 5 + .../modal/footer_component.html.erb | 2 +- .../modal/open_button_component.html.erb | 2 +- .../case_court_reports_controller.rb | 15 +- app/javascript/src/casa_case.js | 6 + app/models/case_court_report_context.rb | 31 ++- .../_generate_report_modal.html.erb | 56 ++++++ app/views/casa_cases/show.html.erb | 44 +++- .../_generate_docx.html.erb | 75 +++++++ app/views/case_court_reports/index.html.erb | 40 +--- .../modal/open_button_component_spec.rb | 8 +- spec/factories/case_court_report_context.rb | 8 +- spec/models/case_court_report_context_spec.rb | 190 +++++++++++++----- spec/models/case_court_report_spec.rb | 24 --- spec/requests/case_court_reports_spec.rb | 14 +- spec/system/casa_cases/show_spec.rb | 74 +++++-- spec/system/case_court_reports/index_spec.rb | 116 ++++------- .../case_court_reports/index.html.erb_spec.rb | 22 +- 21 files changed, 527 insertions(+), 260 deletions(-) create mode 100644 app/assets/stylesheets/pages/case_court_reports.scss create mode 100644 app/views/casa_cases/_generate_report_modal.html.erb create mode 100644 app/views/case_court_reports/_generate_docx.html.erb diff --git a/app/assets/stylesheets/base/variables.scss b/app/assets/stylesheets/base/variables.scss index ab60d692c9..3aee370434 100644 --- a/app/assets/stylesheets/base/variables.scss +++ b/app/assets/stylesheets/base/variables.scss @@ -5,3 +5,9 @@ $red: #dc3545; $sidebar-inactive: #9AA4CA; $sidebar-active: #365CF5; $sidebar-dark: #1A2142; + +:root { + --dark: #262d3f; + --gray: #5d657b; + --silver: #D9D9D9; +} diff --git a/app/assets/stylesheets/pages/casa_cases.scss b/app/assets/stylesheets/pages/casa_cases.scss index 69ed2d9131..844301019c 100644 --- a/app/assets/stylesheets/pages/casa_cases.scss +++ b/app/assets/stylesheets/pages/casa_cases.scss @@ -113,3 +113,52 @@ body.casa_cases-show { display: block; } } + +#generate-docx-report-modal { + .dates-container { + display: flex; + } + + .docx-report__modal-body { + display: flex; + flex-direction: column; + row-gap: 1rem; + + } + + .modal-footer { + [data-bs-dismiss="modal"] { + padding-block: 11px; + } + } +} + +.generate-report-button { + display: flex; + flex-direction: row; + width: 100%; + border: solid 1px var(--silver); + padding: 1.2rem; + column-gap: 1.2rem; + + &:hover { + border-color: black; + } + + svg { + min-inline-size: 40px; + width: 40px; + height: auto; + } + + div { + text-align: left; + h3 { + margin-block-end: .25rem; + + } + p { + + } + } +} diff --git a/app/assets/stylesheets/pages/case_court_reports.scss b/app/assets/stylesheets/pages/case_court_reports.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/assets/stylesheets/shared/typography.scss b/app/assets/stylesheets/shared/typography.scss index fc5b781712..7a5ec90bb8 100644 --- a/app/assets/stylesheets/shared/typography.scss +++ b/app/assets/stylesheets/shared/typography.scss @@ -1,4 +1,5 @@ // TODO check in css so tests can run without internet +@use "../base/variables.scss" as globals; @import url(https://fonts.googleapis.com/css?family=Montserrat:400,700); body { @@ -13,12 +14,16 @@ option { font-family: Inter; font-size: 16px; font-weight: 500; + line-height: 19px; + color: var(--dark); } .content-2 { font-family: Inter; font-size: 14px; font-weight: 500; + line-height: 22px; + color: var(--gray) } .content-3 { diff --git a/app/components/modal/footer_component.html.erb b/app/components/modal/footer_component.html.erb index 21320bd957..9675f4715a 100644 --- a/app/components/modal/footer_component.html.erb +++ b/app/components/modal/footer_component.html.erb @@ -1,4 +1,4 @@ diff --git a/app/components/modal/open_button_component.html.erb b/app/components/modal/open_button_component.html.erb index e210fdaf8e..dfc1410b7b 100644 --- a/app/components/modal/open_button_component.html.erb +++ b/app/components/modal/open_button_component.html.erb @@ -1,4 +1,4 @@ -