From 3b01c44eae250a917dce79443da17ce1e5d34eb0 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 7 Apr 2022 19:28:37 +0200 Subject: [PATCH] Reports: Improve Exports Improve PDF style and encoding Include header_row and summary_row, except for CSV and JSON Style spreadsheets Use only Xlsx no more Ods format --- .../reports/_rendering_options.html.haml | 10 +++---- app/views/layouts/pdf.html.haml | 30 +++++++++++++++++-- app/webpacker/css/admin/reports.scss | 6 ++-- config/locales/en.yml | 7 ++--- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/app/views/admin/reports/_rendering_options.html.haml b/app/views/admin/reports/_rendering_options.html.haml index 9da74a6a11..e51b1d5862 100644 --- a/app/views/admin/reports/_rendering_options.html.haml +++ b/app/views/admin/reports/_rendering_options.html.haml @@ -28,11 +28,9 @@ .alpha.two.columns = label_tag :report_format, t(".generate_report") .omega.fourteen.columns - = select_tag :report_format, options_for_select({ | - t('.on_screen') => '', | - t('.pdf') => 'pdf', | - t('.csv_spreadsheet') => 'csv', | - t('.excel_spreadsheet') => 'xlsx', | - t('.openoffice_spreadsheet') => 'ods'}) + = select_tag :report_format, grouped_options_for_select({ | + t('.formatted_data') => { t('.on_screen') => '', "PDF" => 'pdf', t('.spreadsheet') => 'xlsx' }, | + t('.raw_data') => { "CSV" => 'csv', "JSON" => 'json'}, | + }) diff --git a/app/views/layouts/pdf.html.haml b/app/views/layouts/pdf.html.haml index f1cf20a008..81b43b6588 100644 --- a/app/views/layouts/pdf.html.haml +++ b/app/views/layouts/pdf.html.haml @@ -1,7 +1,7 @@ !!! %html %head - %meta{:content => "charset=UTF-8"} + %meta{charset: 'utf-8'} -# Using wicked_pdf_stylesheet_pack_tag with a new pdf pack was not working when using -# WickedPdf.new.pdf_from_string cause the css file reference was not absolute -# So I ended up putting inline css here, so it's included for sure in the PDF @@ -11,7 +11,8 @@ height: 100%; margin: 0; padding: 0; - font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; + font-family: system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif; + color: #212529; } table { width: 100%; @@ -21,12 +22,35 @@ text-align: left; } th, td { - padding: 5px; + padding: 7px 5px; + vertical-align: middle; + text-overflow: ellipsis; + padding-top: 12px; + } + tr { + border-bottom: 1px solid #e2e2e2; } thead { background-color: #f6f6f6; border-bottom: 1px solid grey; } + .h1, .h2, .h3 { + font-weight: bold; + padding-top: 15px; + } + .h1 { + font-size: 1.6rem; + padding-top: 20px; + } + .h2 { + font-size: 1.3rem; + } + .h3 { + font-size: 1.15rem; + } + .text-bold { + font-weight: bold; + } %body = yield diff --git a/app/webpacker/css/admin/reports.scss b/app/webpacker/css/admin/reports.scss index fceab15629..d51d54204b 100644 --- a/app/webpacker/css/admin/reports.scss +++ b/app/webpacker/css/admin/reports.scss @@ -2,6 +2,10 @@ table.report__table { margin-top: 1em; @media print { margin: 0; + td, th { + border-left: none; + border-right: none; + } } thead th { text-align: left; @@ -48,8 +52,6 @@ table.report__table { } } - - .customer-names-tip { margin-top: 1em; } diff --git a/config/locales/en.yml b/config/locales/en.yml index 7224a5d9da..82c667fb07 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1325,13 +1325,12 @@ en: rendering_options: generate_report: "Generate report" on_screen: "On screen" - pdf: PDF - csv_spreadsheet: "CSV Spreadsheet" - excel_spreadsheet: "Excel Spreadsheet" - openoffice_spreadsheet: "OpenOffice Spreadsheet" + spreadsheet: "Spreadsheet (Excel, OpenOffice..)" display: Display summary_row: Summary Row header_row: Header Row + raw_data: Raw Data + formatted_data: Formatted Data packing: name: "Packing Reports" subscriptions: