Header-Footer template render updates.

This commit is contained in:
Patrick Fic
2022-04-22 15:12:20 -07:00
parent 478e03cbe7
commit f72169d98f

View File

@@ -163,19 +163,44 @@ export async function RenderTemplates(
: "50px", : "50px",
}, },
}), }),
pdfOperations: templateAndData.map((template) => { pdfOperations: [
return { {
template: { template: {
name: template.useShopSpecificTemplate name: "/components/Header-Footer",
? `/${bodyshop.imexshopid}/${template.templateObject.name}` recipe: "chrome-pdf",
: `/${template.templateObject.name}`, engine: "handlebars",
...(renderAsHtml ? {} : { recipe: "chrome-pdf" }),
}, },
type: "append", type: "merge",
mergeWholeDocument: true, },
renderForEveryPage: true, ...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: { data: {
...extend( ...extend(