@measurequick/measurequick-report-generator 1.0.63 → 1.0.64
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/jspdf/mq-report-generator.js +25 -22
- package/package.json +1 -1
|
@@ -11,16 +11,11 @@ export function generateReport(reportType, payload) {
|
|
|
11
11
|
try {
|
|
12
12
|
doc = new jsPDF(templates.docOptions);
|
|
13
13
|
reportData = JSON.parse(JSON.stringify(payload));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
printBodyData(currentSnapshot);
|
|
20
|
-
printFooterData();
|
|
21
|
-
resizeAndPrintStaticImages();
|
|
22
|
-
testNumber++;
|
|
23
|
-
}
|
|
14
|
+
printBoilerPlateStandard();
|
|
15
|
+
printHeaderData();
|
|
16
|
+
printBodyData(reportData.test);
|
|
17
|
+
printFooterData();
|
|
18
|
+
resizeAndPrintStaticImages();
|
|
24
19
|
printDiagnosticPage();
|
|
25
20
|
printInfoPage();
|
|
26
21
|
printPhotoPages();
|
|
@@ -31,11 +26,12 @@ export function generateReport(reportType, payload) {
|
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
function printBoilerPlateStandard() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
let theme = JSON.parse(reportData.reportSettings).colorTheme;
|
|
30
|
+
if (theme == "dark") {
|
|
31
|
+
doc.addImage(graphics.headerMeasureQuick, "JPEG", 0, 0, 8.5, 1);
|
|
32
|
+
doc.addImage(graphics.footerMeasureQuick, "JPEG", 0, 7.75, 8.5, 4.5);
|
|
33
|
+
}
|
|
34
|
+
let mqLogo = theme == "dark" ? graphics.companyLogoMeasureQuickLight : graphics.companyLogoMeasureQuickDark;
|
|
39
35
|
doc.addImage(mqLogo, "JPEG", .25, 10, 2.15625, .5);
|
|
40
36
|
doc.setLineWidth(0.025);
|
|
41
37
|
doc.setDrawColor(0);
|
|
@@ -62,14 +58,20 @@ function printBoilerPlateStandard() {
|
|
|
62
58
|
doc.text(headers.headerSection4Subsection3, 2.25, 5.655);
|
|
63
59
|
doc.setFontSize(6.5);
|
|
64
60
|
doc.setFontStyle("bolditalic");
|
|
65
|
-
doc.setTextColor(255, 255, 255);
|
|
61
|
+
theme == "dark" ? doc.setTextColor(255, 255, 255) : doc.setTextColor(0, 0, 0);
|
|
66
62
|
let 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.`;
|
|
67
63
|
disclaimer = doc.splitTextToSize(disclaimer.toUpperCase(), 8);
|
|
68
64
|
doc.text(disclaimer, .125, 10.66);
|
|
65
|
+
doc.setTextColor(255, 255, 255);
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
function printBoilerPlateDiagnostic() {
|
|
72
|
-
doc.addImage(graphics.headerMeasureQuick, "JPEG", 0, 0, 8.5, 1);
|
|
69
|
+
if (JSON.parse(reportData.reportSettings).colorTheme == "dark") doc.addImage(graphics.headerMeasureQuick, "JPEG", 0, 0, 8.5, 1);
|
|
70
|
+
doc.setFontSize(12);
|
|
71
|
+
doc.setFontStyle("bold");
|
|
72
|
+
JSON.parse(reportData.reportSettings).colorTheme == "dark" ? doc.setTextColor(255, 255, 255) : doc.setTextColor(0, 0, 0);
|
|
73
|
+
doc.text("Diagnostic Report", .25, .35);
|
|
74
|
+
doc.setTextColor(255, 255, 255);
|
|
73
75
|
doc.setLineWidth(0.025);
|
|
74
76
|
doc.setDrawColor(0);
|
|
75
77
|
doc.setFillColor(242, 242, 242);
|
|
@@ -92,7 +94,9 @@ function printHeaderData() {
|
|
|
92
94
|
do { size -= .5; } while ((doc.getStringUnitWidth(reportData.meta.reportName) * size / 72) > 4.5);
|
|
93
95
|
doc.setFontSize(size);
|
|
94
96
|
doc.setFontStyle("bold");
|
|
97
|
+
JSON.parse(reportData.reportSettings).colorTheme == "dark" ? doc.setTextColor(255, 255, 255) : doc.setTextColor(0, 0, 0);
|
|
95
98
|
doc.text(reportData.meta.reportName, 0.25, .75);
|
|
99
|
+
doc.setTextColor(255, 255, 255);
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
function printBodyData(currentSnapshot) {
|
|
@@ -114,8 +118,7 @@ function printBodyData(currentSnapshot) {
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
function printBodySection(currentSnapshot, measurementSection, xLeft, xRight, y) {
|
|
117
|
-
let dataPoints = JSON.parse(
|
|
118
|
-
let printRangeIcons = true;
|
|
121
|
+
let dataPoints = JSON.parse(currentSnapshot[measurementSection]);
|
|
119
122
|
let units = "";
|
|
120
123
|
let labelText = "";
|
|
121
124
|
let valueText = "";
|
|
@@ -159,11 +162,11 @@ function printBodySection(currentSnapshot, measurementSection, xLeft, xRight, y)
|
|
|
159
162
|
doc.setFontSize(8);
|
|
160
163
|
y += .05;
|
|
161
164
|
}
|
|
162
|
-
if (
|
|
165
|
+
if (JSON.parse(reportData.reportSettings).includeRangeIndicators) {
|
|
163
166
|
let rangeIconRef = getRangeIcon(key, valueBeforeEditing, currentSnapshot);
|
|
164
167
|
if (rangeIconRef) doc.addImage(graphics[rangeIconRef], "JPEG", xRight + .05, y - .12, .16, .16);
|
|
165
168
|
}
|
|
166
|
-
let toolIconRef = getToolIcon(
|
|
169
|
+
let toolIconRef = getToolIcon(JSON.parse(currentSnapshot.toolIcons)[key]);
|
|
167
170
|
if (toolIconRef) doc.addImage(graphics[toolIconRef], "JPEG", xRight + .25, y - .12, .16, .16);
|
|
168
171
|
y += (s * sMultiplier);
|
|
169
172
|
} else if (key == "newColumn") {
|
|
@@ -496,7 +499,7 @@ function getRangeIcon(key, actualValue, currentSnapshot) {
|
|
|
496
499
|
else if (actualValue == 'Yes, under duress') rangeIconRef = "iconCautionTriangleYellow";
|
|
497
500
|
else rangeIconRef = "iconThumbprintRed";
|
|
498
501
|
} else {
|
|
499
|
-
let ranges = JSON.parse(
|
|
502
|
+
let ranges = JSON.parse(currentSnapshot.rangeIcons);
|
|
500
503
|
let target = null, low = null, high = null;
|
|
501
504
|
if (ranges[key]) {
|
|
502
505
|
target = parseFloat(ranges[key]);
|