From f7e74c50437ea9a572763f3bf8af63b43b997c13 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Fri, 11 Sep 2020 14:43:04 -0700 Subject: [PATCH] Modified how template list is generated to be a function to allow checking whether the templates can be printed. --- client/public/render-styles.css | 56 ++++--- client/src/components/_test/paymentMethod.jsx | 4 +- ...bs-detail-header-actions.csi.component.jsx | 12 +- .../parts-order-modal.container.jsx | 8 +- .../payment-modal/payment-modal.container.jsx | 4 +- .../print-center-jobs.component.jsx | 26 ++-- .../print-center-jobs.list.js | 60 -------- .../print-center-speed-print.component.jsx | 4 +- .../schedule-job-modal.container.jsx | 2 +- .../shop-info/shop-info.intake.component.jsx | 12 +- .../shop-info.speedprint.component.jsx | 4 +- .../shop-template-add.component.jsx | 2 +- ...-template-editor-save-button.component.jsx | 9 +- .../shop-template-editor.component.jsx | 12 +- .../shop-template-test-render.component.jsx | 7 +- .../shop-templates-list.container.jsx | 6 +- ...me-tickets-summary-employees.component.jsx | 2 +- client/src/utils/TemplateConstants.js | 140 ++++++++++-------- client/templates/helpers.md | 3 + server/render/renderHandlebars.js | 1 + 20 files changed, 167 insertions(+), 207 deletions(-) delete mode 100644 client/src/components/print-center-jobs/print-center-jobs.list.js diff --git a/client/public/render-styles.css b/client/public/render-styles.css index 8e7aef8ec..f4232a02a 100644 --- a/client/public/render-styles.css +++ b/client/public/render-styles.css @@ -1,36 +1,13 @@ body { - font-family: "Open Sans", sans-serif; - line-height: 1.25; + /* font-family: "Open Sans", sans-serif; */ + /* line-height: 1.25; */ /* padding: 10mm 10mm 10mm 10mm !important; */ } + @page { - size: auto; /* auto is the initial value */ - - /* this affects the margin in the printer settings */ - margin: 25mm 25mm 25mm 25mm; - color: tomato; + margin: 50px; } -/* Unknown whether the below actually gets embedded */ -/* @media print { - @page { - size: Letter; - margin: 0; - } - html, - body { - width: 210mm; - - height: 282mm; - font-size: 11px; - background: #fff; - overflow: visible; - } - body { - padding-top: 15mm; - } -} */ - table.imex-table { border: 1px solid #ccc; border-collapse: collapse; @@ -38,27 +15,44 @@ table.imex-table { padding: 0; width: 100%; table-layout: fixed; + font-size: inherit; + + page-break-inside: auto; } table.imex-table caption { - font-size: 1.5em; + /* font-size: 1.5em; */ margin: 0.5em 0 0.75em; + font-size: inherit; } table.imex-table tr { - background-color: #f8f8f8; + /* background-color: #f8f8f8; */ border: 1px solid #ddd; - padding: 0.1rem; + padding: 0.2rem; + font-size: inherit; + + page-break-inside: avoid; + page-break-after: auto; } table.imex-table th, table.imex-table td { padding: 0.3rem; text-align: center; + font-size: inherit; +} +table.imex-table th.left, +table.imex-table td.left { + padding: 0.3rem; + text-align: left; + font-size: inherit; } table.imex-table th { - font-size: 0.85em; + /* font-size: 0.85em; */ letter-spacing: 0.1em; text-transform: uppercase; + + /* display: table-header-group; */ } diff --git a/client/src/components/_test/paymentMethod.jsx b/client/src/components/_test/paymentMethod.jsx index e32ebc2c9..af5c38d1c 100644 --- a/client/src/components/_test/paymentMethod.jsx +++ b/client/src/components/_test/paymentMethod.jsx @@ -1,6 +1,6 @@ import { PaymentRequestButtonElement, - useStripe + useStripe, } from "@stripe/react-stripe-js"; import React, { useEffect, useState } from "react"; import { connect } from "react-redux"; @@ -72,7 +72,7 @@ function Test({ bodyshop, setEmailOptions }) { replyTo: bodyshop.email, }, template: { - name: TemplateList.parts_order_confirmation.key, + name: TemplateList().parts_order_confirmation.key, variables: { id: "a7c2d4e1-f519-42a9-a071-c48cf0f22979", }, diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx index 6cecc1ff2..436f9fa66 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx @@ -89,7 +89,7 @@ export function JobsDetailHeaderCsi({ replyTo: bodyshop.email, }, template: { - name: TemplateList.csi_invitation.key, + name: TemplateList().csi_invitation.key, variables: { id: result.data.insert_csi.returning[0].id, }, @@ -108,14 +108,16 @@ export function JobsDetailHeaderCsi({