Speed print resolution.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project version="1.2" be_version="2.7.1">
|
<babeledit_project be_version="2.7.1" version="1.2">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
@@ -25424,6 +25424,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>coversheet_portrait</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>diagnostic_authorization</name>
|
<name>diagnostic_authorization</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -25487,6 +25508,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>filing_coverhseet_portrait</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>final_invoice</name>
|
<name>final_invoice</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
26777
client/package-lock.json
generated
26777
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1541,9 +1541,11 @@
|
|||||||
"appointment_confirmation": "Appointment Confirmation",
|
"appointment_confirmation": "Appointment Confirmation",
|
||||||
"appointment_reminder": "Appointment Reminder",
|
"appointment_reminder": "Appointment Reminder",
|
||||||
"casl_authorization": "CASL Authorization",
|
"casl_authorization": "CASL Authorization",
|
||||||
|
"coversheet_portrait": "Coversheet Portrait",
|
||||||
"diagnostic_authorization": "Diagnostic Authorization",
|
"diagnostic_authorization": "Diagnostic Authorization",
|
||||||
"estimate": "Estimate Only",
|
"estimate": "Estimate Only",
|
||||||
"estimate_detail": "Estimate Details",
|
"estimate_detail": "Estimate Details",
|
||||||
|
"filing_coverhseet_portrait": "Filing Coversheet (Portrait)",
|
||||||
"final_invoice": "Final Invoice",
|
"final_invoice": "Final Invoice",
|
||||||
"fippa_authorization": "FIPPA Authorization",
|
"fippa_authorization": "FIPPA Authorization",
|
||||||
"glass_express_checklist": "Glass Express Checklist",
|
"glass_express_checklist": "Glass Express Checklist",
|
||||||
|
|||||||
@@ -1541,9 +1541,11 @@
|
|||||||
"appointment_confirmation": "",
|
"appointment_confirmation": "",
|
||||||
"appointment_reminder": "",
|
"appointment_reminder": "",
|
||||||
"casl_authorization": "",
|
"casl_authorization": "",
|
||||||
|
"coversheet_portrait": "",
|
||||||
"diagnostic_authorization": "",
|
"diagnostic_authorization": "",
|
||||||
"estimate": "",
|
"estimate": "",
|
||||||
"estimate_detail": "",
|
"estimate_detail": "",
|
||||||
|
"filing_coverhseet_portrait": "",
|
||||||
"final_invoice": "",
|
"final_invoice": "",
|
||||||
"fippa_authorization": "",
|
"fippa_authorization": "",
|
||||||
"glass_express_checklist": "",
|
"glass_express_checklist": "",
|
||||||
|
|||||||
@@ -1541,9 +1541,11 @@
|
|||||||
"appointment_confirmation": "",
|
"appointment_confirmation": "",
|
||||||
"appointment_reminder": "",
|
"appointment_reminder": "",
|
||||||
"casl_authorization": "",
|
"casl_authorization": "",
|
||||||
|
"coversheet_portrait": "",
|
||||||
"diagnostic_authorization": "",
|
"diagnostic_authorization": "",
|
||||||
"estimate": "",
|
"estimate": "",
|
||||||
"estimate_detail": "",
|
"estimate_detail": "",
|
||||||
|
"filing_coverhseet_portrait": "",
|
||||||
"final_invoice": "",
|
"final_invoice": "",
|
||||||
"fippa_authorization": "",
|
"fippa_authorization": "",
|
||||||
"glass_express_checklist": "",
|
"glass_express_checklist": "",
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import { gql } from "@apollo/client";
|
|||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import jsreport from "jsreport-browser-client-dist";
|
import jsreport from "jsreport-browser-client-dist";
|
||||||
|
import _ from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
import { auth } from "../firebase/firebase.utils";
|
import { auth } from "../firebase/firebase.utils";
|
||||||
import { setEmailOptions } from "../redux/email/email.actions";
|
import { setEmailOptions } from "../redux/email/email.actions";
|
||||||
import { store } from "../redux/store";
|
import { store } from "../redux/store";
|
||||||
import client from "../utils/GraphQLClient";
|
import client from "../utils/GraphQLClient";
|
||||||
import { TemplateList } from "./TemplateConstants";
|
import { TemplateList } from "./TemplateConstants";
|
||||||
import moment from "moment";
|
|
||||||
|
|
||||||
const server = process.env.REACT_APP_REPORTS_SERVER_URL;
|
const server = process.env.REACT_APP_REPORTS_SERVER_URL;
|
||||||
jsreport.serverUrl = server;
|
jsreport.serverUrl = server;
|
||||||
|
|
||||||
@@ -61,46 +61,23 @@ export async function RenderTemplates(
|
|||||||
) {
|
) {
|
||||||
//Query assets that match the template name. Must be in format <<templateName>>.query
|
//Query assets that match the template name. Must be in format <<templateName>>.query
|
||||||
let templateAndData = [];
|
let templateAndData = [];
|
||||||
|
let proms = [];
|
||||||
console.log("About to await all promises.");
|
templateObjects.forEach((template) => {
|
||||||
await Promise.all(
|
proms.push(
|
||||||
templateObjects.map(async (template) => {
|
(async () => {
|
||||||
console.log("executing for", template);
|
let { contextData, useShopSpecificTemplate } = await fetchContextData(
|
||||||
let { contextData, useShopSpecificTemplate } = await fetchContextData(
|
template
|
||||||
template
|
);
|
||||||
);
|
templateAndData.push({
|
||||||
templateAndData.push({
|
templateObject: template,
|
||||||
templateObject: template,
|
contextData,
|
||||||
contextData,
|
useShopSpecificTemplate,
|
||||||
useShopSpecificTemplate,
|
});
|
||||||
});
|
})()
|
||||||
})
|
);
|
||||||
);
|
});
|
||||||
console.log("All promises awaited.", templateAndData);
|
await Promise.all(proms);
|
||||||
let rootTemplate = templateAndData[0];
|
let rootTemplate = templateAndData.shift();
|
||||||
const pdfOps = [];
|
|
||||||
|
|
||||||
for (var i = 1; i < templateAndData.length; i++) {
|
|
||||||
pdfOps.push({
|
|
||||||
template: {
|
|
||||||
name: templateAndData[i].useShopSpecificTemplate
|
|
||||||
? `/${bodyshop.imexshopid}/${templateAndData[i].templateObject.name}`
|
|
||||||
: `/${templateAndData[i].templateObject.name}`,
|
|
||||||
...(renderAsHtml ? {} : { recipe: "chrome-pdf" }),
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
...templateAndData[i].contextData,
|
|
||||||
...templateAndData[i].templateObject.variables,
|
|
||||||
...templateAndData[i].templateObject.context,
|
|
||||||
headerpath: `/${bodyshop.imexshopid}/header.html`,
|
|
||||||
bodyshop: bodyshop,
|
|
||||||
offset: moment().utcOffset(),
|
|
||||||
},
|
|
||||||
type: "append",
|
|
||||||
mergeWholeDocument: true,
|
|
||||||
renderForEveryPage: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let reportRequest = {
|
let reportRequest = {
|
||||||
template: {
|
template: {
|
||||||
@@ -108,15 +85,30 @@ export async function RenderTemplates(
|
|||||||
? `/${bodyshop.imexshopid}/${rootTemplate.templateObject.name}`
|
? `/${bodyshop.imexshopid}/${rootTemplate.templateObject.name}`
|
||||||
: `/${rootTemplate.templateObject.name}`,
|
: `/${rootTemplate.templateObject.name}`,
|
||||||
...(renderAsHtml ? {} : { recipe: "chrome-pdf" }),
|
...(renderAsHtml ? {} : { recipe: "chrome-pdf" }),
|
||||||
pdfOperations: pdfOps,
|
pdfOperations: templateAndData.map((template) => {
|
||||||
|
return {
|
||||||
|
template: {
|
||||||
|
name: template.useShopSpecificTemplate
|
||||||
|
? `/${bodyshop.imexshopid}/${template.templateObject.name}`
|
||||||
|
: `/${template.templateObject.name}`,
|
||||||
|
...(renderAsHtml ? {} : { recipe: "chrome-pdf" }),
|
||||||
|
},
|
||||||
|
type: "append",
|
||||||
|
mergeWholeDocument: true,
|
||||||
|
renderForEveryPage: true,
|
||||||
|
};
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
...rootTemplate.contextData,
|
...extend(
|
||||||
...rootTemplate.templateObject.variables,
|
rootTemplate.contextData,
|
||||||
...rootTemplate.templateObject.context,
|
...templateAndData.map((temp) => temp.contextData)
|
||||||
|
),
|
||||||
|
|
||||||
|
// ...rootTemplate.templateObject.variables,
|
||||||
|
// ...rootTemplate.templateObject.context,
|
||||||
headerpath: `/${bodyshop.imexshopid}/header.html`,
|
headerpath: `/${bodyshop.imexshopid}/header.html`,
|
||||||
bodyshop: bodyshop,
|
bodyshop: bodyshop,
|
||||||
offset: moment().utcOffset(),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -230,3 +222,23 @@ const fetchContextData = async (templateObject) => {
|
|||||||
// console.log("Unable to write to new window.", error);
|
// console.log("Unable to write to new window.", error);
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
function extend(o1, o2, o3) {
|
||||||
|
var result = {},
|
||||||
|
obj;
|
||||||
|
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
obj = arguments[i];
|
||||||
|
for (var key in obj) {
|
||||||
|
if (Object.prototype.toString.call(obj[key]) === "[object Object]") {
|
||||||
|
if (typeof result[key] === "undefined") {
|
||||||
|
result[key] = {};
|
||||||
|
}
|
||||||
|
result[key] = extend(result[key], obj[key]);
|
||||||
|
} else {
|
||||||
|
result[key] = obj[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -196,6 +196,23 @@ export const TemplateList = (type, context) => {
|
|||||||
key: "parts_list",
|
key: "parts_list",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
|
coversheet_portrait: {
|
||||||
|
title: i18n.t("printcenter.jobs.coversheet_portrait"),
|
||||||
|
description: "All Jobs Notes",
|
||||||
|
subject: `${i18n.t("printcenter.jobs.coversheet_portrait")} - ${
|
||||||
|
context && context.job && context.job.ro_number
|
||||||
|
}`,
|
||||||
|
key: "coversheet_portrait",
|
||||||
|
disabled: false,
|
||||||
|
}, filing_coverhseet_portrait: {
|
||||||
|
title: i18n.t("printcenter.jobs.filing_coverhseet_portrait"),
|
||||||
|
description: "All Jobs Notes",
|
||||||
|
subject: `${i18n.t("printcenter.jobs.filing_coverhseet_portrait")} - ${
|
||||||
|
context && context.job && context.job.ro_number
|
||||||
|
}`,
|
||||||
|
key: "filing_coverhseet_portrait",
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
...(!type || type === "job_special"
|
...(!type || type === "job_special"
|
||||||
|
|||||||
Reference in New Issue
Block a user