Ignore custom margins on certain templates.

This commit is contained in:
Patrick Fic
2022-03-22 13:41:06 -06:00
parent 15c305317a
commit f2b2011900
2 changed files with 27 additions and 18 deletions

View File

@@ -24,6 +24,7 @@ export default async function RenderTemplate(
let { contextData, useShopSpecificTemplate } = await fetchContextData(
templateObject
);
const { ignoreCustomMargins } = Templates[templateObject.name];
let reportRequest = {
template: {
@@ -34,18 +35,22 @@ export default async function RenderTemplate(
? {}
: {
recipe: "chrome-pdf",
chrome: {
marginTop:
(bodyshop.logo_img_path &&
...(!ignoreCustomMargins && {
chrome: {
marginTop:
bodyshop.logo_img_path &&
bodyshop.logo_img_path.headerMargin &&
bodyshop.logo_img_path.headerMargin > 36) ||
"36px",
marginBottom:
(bodyshop.logo_img_path &&
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 > 36) ||
"36px",
},
bodyshop.logo_img_path.footerMargin > 36
? bodyshop.logo_img_path.footerMargin
: "36px",
},
}),
}),
...(renderAsExcel ? { recipe: "html-to-xlsx" } : {}),
},
@@ -143,15 +148,17 @@ export async function RenderTemplates(
recipe: "chrome-pdf",
chrome: {
marginTop:
(bodyshop.logo_img_path &&
bodyshop.logo_img_path.headerMargin &&
bodyshop.logo_img_path.headerMargin > 36) ||
"36px",
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 > 36) ||
"36px",
bodyshop.logo_img_path &&
bodyshop.logo_img_path.footerMargin &&
bodyshop.logo_img_path.footerMargin > 36
? bodyshop.logo_img_path.footerMargin
: "36px",
},
}),
pdfOperations: templateAndData.map((template) => {

View File

@@ -371,6 +371,7 @@ export const TemplateList = (type, context) => {
subject: i18n.t("printcenter.jobs.parts_label_single"),
disabled: false,
group: "ro",
ignoreCustomMargins: true,
},
envelope_return_address: {
title: i18n.t("printcenter.jobs.envelope_return_address"),
@@ -379,6 +380,7 @@ export const TemplateList = (type, context) => {
key: "envelope_return_address",
disabled: false,
group: "ro",
ignoreCustomMargins: true,
},
sgi_certificate_of_repairs: {
title: i18n.t("printcenter.jobs.sgi_certificate_of_repairs"),