@measurequick/measurequick-report-generator 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates.js +31 -1
- package/index.js +17 -31
- package/package.json +1 -1
package/assets/templates.js
CHANGED
|
@@ -249,4 +249,34 @@ export const footerData = [
|
|
|
249
249
|
"systemSerial"
|
|
250
250
|
];
|
|
251
251
|
|
|
252
|
-
export const
|
|
252
|
+
export const profilePictureCoordinates = {
|
|
253
|
+
"header": {
|
|
254
|
+
"x": 1,
|
|
255
|
+
"y": 1,
|
|
256
|
+
"w": 1,
|
|
257
|
+
"h": 1
|
|
258
|
+
},
|
|
259
|
+
"footer": {
|
|
260
|
+
"x": 1,
|
|
261
|
+
"y": 9,
|
|
262
|
+
"w": 1,
|
|
263
|
+
"h": 1
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export const companyLogoCoordinates = {
|
|
268
|
+
"header": {
|
|
269
|
+
"x": 6.5,
|
|
270
|
+
"y": 1,
|
|
271
|
+
"w": 1,
|
|
272
|
+
"h": 1
|
|
273
|
+
},
|
|
274
|
+
"footer": {
|
|
275
|
+
"x": 6.5,
|
|
276
|
+
"y": 9,
|
|
277
|
+
"w": 1,
|
|
278
|
+
"h": 1
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// export const disclaimer = `Disclaimer: This report was prepared by your service technician who is solely responsible for its content. This report is provided “as-is” excluding all warranties expressed or implied including without limitation the warranty of merchantability. ©2017-${new Date().getFullYear()} Manifold Cloud Services Ltd.`;
|
package/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export function getReport(data=null) {
|
|
|
36
36
|
|
|
37
37
|
function printBoilerPlate(theme) {
|
|
38
38
|
doc.addImage(graphics.headerMeasureQuick, "JPEG", 0, 0, 8.5, 1);
|
|
39
|
+
doc.addImage(graphics.footerMeasureQuick, "JPEG", 0, 7.75, 8.5, 4.5);
|
|
39
40
|
doc.addImage(graphics.companyLogoMeasureQuickLight, "JPEG", .25, 10, 2.15625, .5);
|
|
40
41
|
|
|
41
42
|
doc.setLineWidth(0.025);
|
|
@@ -51,23 +52,18 @@ function printBoilerPlate(theme) {
|
|
|
51
52
|
doc.addImage(graphics.iconInfo, "JPEG", 6.044, 1.625, 2, 2);
|
|
52
53
|
doc.addImage(graphics.iconPerformance, "JPEG", 1.15625, 4.9375, 2, 2);
|
|
53
54
|
|
|
54
|
-
doc.addImage(graphics.footerMeasureQuick, "JPEG", 0, 7.75, 8.5, 4.5);
|
|
55
|
-
|
|
56
55
|
doc.setFontSize(6.5);
|
|
57
56
|
doc.setFontStyle("bolditalic");
|
|
58
|
-
|
|
59
|
-
disclaimer =
|
|
57
|
+
doc.setTextColor(255, 255, 255);
|
|
58
|
+
var disclaimer = `Disclaimer: This report was prepared by your service technician who is solely responsible for its content. This report is provided “as-is” excluding all warranties expressed or implied including without limitation the warranty of merchantability. ©2017-${new Date().getFullYear()} Manifold Cloud Services Ltd.`;
|
|
59
|
+
disclaimer = doc.splitTextToSize(disclaimer.toUpperCase(), 8);
|
|
60
60
|
doc.text(disclaimer, .125, 10.66);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function printHeaderData(reportName, techName, profilePicture, companyLogo) {
|
|
64
|
-
var x = 0;
|
|
65
|
-
var y = 0;
|
|
66
|
-
var w = 0;
|
|
67
|
-
var h = 0;
|
|
68
64
|
doc.text(reportName, 0.25, .75);
|
|
69
|
-
if (profilePicture) printProfilePicture(techName, profilePicture);
|
|
70
|
-
if (companyLogo) printCompanyLogo(companyLogo);
|
|
65
|
+
if (profilePicture) printProfilePicture("header", techName, profilePicture);
|
|
66
|
+
if (companyLogo) printCompanyLogo("header", companyLogo);
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
function printBodyData(geolocationMap) {
|
|
@@ -101,34 +97,24 @@ function printMap(geolocationMap) {
|
|
|
101
97
|
doc.addImage(geolocationMap, "JPEG", 4.3125, 4.25, 4.0625, 3.375);
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
function printProfilePicture(techName, profilePicture) {
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var h = 0;
|
|
109
|
-
doc.addImage(profilePicture, "JPEG", x, y, w, h);
|
|
110
|
-
doc.text(techName, x, y, w, h);
|
|
100
|
+
function printProfilePicture(picturePlacement, techName, profilePicture) {
|
|
101
|
+
var coords = templates.profilePictureCoordinates[picturePlacement];
|
|
102
|
+
doc.addImage(profilePicture, "JPEG", coords.x, coords.y, coords.w, coords.h);
|
|
103
|
+
doc.text(techName, coords.x, coords.y + 1, coords.w, coords.h);
|
|
111
104
|
}
|
|
112
105
|
|
|
113
|
-
function printCompanyLogo(companyLogo) {
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
var w = 0;
|
|
117
|
-
var h = 0;
|
|
118
|
-
doc.addImage(companyLogo, "JPEG", x, y, w, h);
|
|
106
|
+
function printCompanyLogo(logoPlacement, companyLogo) {
|
|
107
|
+
var coords = templates.profilePictureCoordinates[picturePlacement];
|
|
108
|
+
doc.addImage(companyLogo, "JPEG", coords.x, coords.y, coords.w, coords.h);
|
|
119
109
|
}
|
|
120
110
|
|
|
121
111
|
function printFooterData(techName, profilePicture, companyLogo) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var w = 0;
|
|
125
|
-
var h = 0;
|
|
126
|
-
if (profilePicture) printProfilePicture(techName, profilePicture);
|
|
127
|
-
if (companyLogo) printCompanyLogo(companyLogo);
|
|
112
|
+
if (profilePicture) printProfilePicture("footer", techName, profilePicture);
|
|
113
|
+
if (companyLogo) printCompanyLogo("footer", companyLogo);
|
|
128
114
|
|
|
129
115
|
var s = .2;
|
|
130
|
-
var x =
|
|
131
|
-
var y =
|
|
116
|
+
var x = 1;
|
|
117
|
+
var y = 7;
|
|
132
118
|
templates.footerData.forEach(key => {
|
|
133
119
|
doc.text(reportData.values[key], x, y);
|
|
134
120
|
y += s;
|