@measurequick/measurequick-report-generator 1.0.9 → 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 +16 -29
- 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
|
@@ -55,18 +55,15 @@ function printBoilerPlate(theme) {
|
|
|
55
55
|
doc.setFontSize(6.5);
|
|
56
56
|
doc.setFontStyle("bolditalic");
|
|
57
57
|
doc.setTextColor(255, 255, 255);
|
|
58
|
-
disclaimer =
|
|
59
|
-
doc.
|
|
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
|
+
doc.text(disclaimer, .125, 10.66);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
function printHeaderData(reportName, techName, profilePicture, companyLogo) {
|
|
63
|
-
var x = 0;
|
|
64
|
-
var y = 0;
|
|
65
|
-
var w = 0;
|
|
66
|
-
var h = 0;
|
|
67
64
|
doc.text(reportName, 0.25, .75);
|
|
68
|
-
if (profilePicture) printProfilePicture(techName, profilePicture);
|
|
69
|
-
if (companyLogo) printCompanyLogo(companyLogo);
|
|
65
|
+
if (profilePicture) printProfilePicture("header", techName, profilePicture);
|
|
66
|
+
if (companyLogo) printCompanyLogo("header", companyLogo);
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
function printBodyData(geolocationMap) {
|
|
@@ -100,34 +97,24 @@ function printMap(geolocationMap) {
|
|
|
100
97
|
doc.addImage(geolocationMap, "JPEG", 4.3125, 4.25, 4.0625, 3.375);
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
function printProfilePicture(techName, profilePicture) {
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var h = 0;
|
|
108
|
-
doc.addImage(profilePicture, "JPEG", x, y, w, h);
|
|
109
|
-
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);
|
|
110
104
|
}
|
|
111
105
|
|
|
112
|
-
function printCompanyLogo(companyLogo) {
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
var w = 0;
|
|
116
|
-
var h = 0;
|
|
117
|
-
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);
|
|
118
109
|
}
|
|
119
110
|
|
|
120
111
|
function printFooterData(techName, profilePicture, companyLogo) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
var w = 0;
|
|
124
|
-
var h = 0;
|
|
125
|
-
if (profilePicture) printProfilePicture(techName, profilePicture);
|
|
126
|
-
if (companyLogo) printCompanyLogo(companyLogo);
|
|
112
|
+
if (profilePicture) printProfilePicture("footer", techName, profilePicture);
|
|
113
|
+
if (companyLogo) printCompanyLogo("footer", companyLogo);
|
|
127
114
|
|
|
128
115
|
var s = .2;
|
|
129
|
-
var x =
|
|
130
|
-
var y =
|
|
116
|
+
var x = 1;
|
|
117
|
+
var y = 7;
|
|
131
118
|
templates.footerData.forEach(key => {
|
|
132
119
|
doc.text(reportData.values[key], x, y);
|
|
133
120
|
y += s;
|