From f72169d98f94a9189e263f6e662479669b080bfd Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 22 Apr 2022 15:12:20 -0700 Subject: [PATCH 1/2] Header-Footer template render updates. --- client/src/utils/RenderTemplate.js | 47 +++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index 20f6013aa..9fa495e4e 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -163,19 +163,44 @@ export async function RenderTemplates( : "50px", }, }), - pdfOperations: templateAndData.map((template) => { - return { + pdfOperations: [ + { template: { - name: template.useShopSpecificTemplate - ? `/${bodyshop.imexshopid}/${template.templateObject.name}` - : `/${template.templateObject.name}`, - ...(renderAsHtml ? {} : { recipe: "chrome-pdf" }), + name: "/components/Header-Footer", + recipe: "chrome-pdf", + engine: "handlebars", }, - type: "append", - mergeWholeDocument: true, - renderForEveryPage: true, - }; - }), + type: "merge", + }, + ...templateAndData.map((template) => { + return { + template: { + chrome: { + marginTop: + bodyshop.logo_img_path && + bodyshop.logo_img_path.headerMargin && + bodyshop.logo_img_path.headerMargin > 36 + ? bodyshop.logo_img_path.headerMargin + : "36px", + marginBottom: + bodyshop.logo_img_path && + bodyshop.logo_img_path.footerMargin && + bodyshop.logo_img_path.footerMargin > 50 + ? bodyshop.logo_img_path.footerMargin + : "50px", + }, + name: template.useShopSpecificTemplate + ? `/${bodyshop.imexshopid}/${template.templateObject.name}` + : `/${template.templateObject.name}`, + ...(renderAsHtml ? {} : { recipe: "chrome-pdf" }), + }, + type: "append", + + // mergeWholeDocument: true, + // renderForEveryPage: true, + }; + }), + ], }, data: { ...extend( From a1f6f2fe4c7ca1ea205e5dadce7584d60f00a0fb Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 22 Apr 2022 15:14:02 -0700 Subject: [PATCH 2/2] IO-1477 Update to joblines_status view. --- .../jobs-detail-rates/jobs-detail-rates.component.jsx | 2 +- .../1650656410107_run_sql_migration/down.sql | 10 ++++++++++ .../migrations/1650656410107_run_sql_migration/up.sql | 8 ++++++++ .../1650656455358_run_sql_migration/down.sql | 10 ++++++++++ .../migrations/1650656455358_run_sql_migration/up.sql | 8 ++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 hasura/migrations/1650656410107_run_sql_migration/down.sql create mode 100644 hasura/migrations/1650656410107_run_sql_migration/up.sql create mode 100644 hasura/migrations/1650656455358_run_sql_migration/down.sql create mode 100644 hasura/migrations/1650656455358_run_sql_migration/up.sql diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx index bff0440c0..7d62c7356 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.component.jsx @@ -97,7 +97,7 @@ export function JobsDetailRates({ jobRO, form, job, bodyshop }) { prev.auto_add_ats !== cur.auto_add_ats} > {() => { diff --git a/hasura/migrations/1650656410107_run_sql_migration/down.sql b/hasura/migrations/1650656410107_run_sql_migration/down.sql new file mode 100644 index 000000000..0eb55c9d8 --- /dev/null +++ b/hasura/migrations/1650656410107_run_sql_migration/down.sql @@ -0,0 +1,10 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE OR REPLACE VIEW "public"."joblines_status" AS +-- SELECT j.jobid, +-- j.status, +-- count(1) AS count, +-- j.part_type +-- FROM joblines j +-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.removed IS false)) +-- GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1650656410107_run_sql_migration/up.sql b/hasura/migrations/1650656410107_run_sql_migration/up.sql new file mode 100644 index 000000000..d7cf122ff --- /dev/null +++ b/hasura/migrations/1650656410107_run_sql_migration/up.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE VIEW "public"."joblines_status" AS + SELECT j.jobid, + j.status, + count(1) AS count, + j.part_type + FROM joblines j + WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.removed IS false)) + GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1650656455358_run_sql_migration/down.sql b/hasura/migrations/1650656455358_run_sql_migration/down.sql new file mode 100644 index 000000000..0eb55c9d8 --- /dev/null +++ b/hasura/migrations/1650656455358_run_sql_migration/down.sql @@ -0,0 +1,10 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE OR REPLACE VIEW "public"."joblines_status" AS +-- SELECT j.jobid, +-- j.status, +-- count(1) AS count, +-- j.part_type +-- FROM joblines j +-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.removed IS false)) +-- GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1650656455358_run_sql_migration/up.sql b/hasura/migrations/1650656455358_run_sql_migration/up.sql new file mode 100644 index 000000000..d7cf122ff --- /dev/null +++ b/hasura/migrations/1650656455358_run_sql_migration/up.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE VIEW "public"."joblines_status" AS + SELECT j.jobid, + j.status, + count(1) AS count, + j.part_type + FROM joblines j + WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.removed IS false)) + GROUP BY j.jobid, j.status, j.part_type;