@measurequick/measurequick-report-generator 1.0.63 → 1.0.65
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 +26 -23
- 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);
|
|
@@ -84,7 +86,6 @@ function printBoilerPlateDiagnostic() {
|
|
|
84
86
|
doc.text('Corrective Actions', .25, 3.5);
|
|
85
87
|
doc.setFontSize(8);
|
|
86
88
|
doc.setFontStyle('normal');
|
|
87
|
-
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
function printHeaderData() {
|
|
@@ -92,7 +93,9 @@ function printHeaderData() {
|
|
|
92
93
|
do { size -= .5; } while ((doc.getStringUnitWidth(reportData.meta.reportName) * size / 72) > 4.5);
|
|
93
94
|
doc.setFontSize(size);
|
|
94
95
|
doc.setFontStyle("bold");
|
|
96
|
+
JSON.parse(reportData.reportSettings).colorTheme == "dark" ? doc.setTextColor(255, 255, 255) : doc.setTextColor(0, 0, 0);
|
|
95
97
|
doc.text(reportData.meta.reportName, 0.25, .75);
|
|
98
|
+
doc.setTextColor(255, 255, 255);
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
function printBodyData(currentSnapshot) {
|
|
@@ -114,8 +117,7 @@ function printBodyData(currentSnapshot) {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
function printBodySection(currentSnapshot, measurementSection, xLeft, xRight, y) {
|
|
117
|
-
let dataPoints = JSON.parse(
|
|
118
|
-
let printRangeIcons = true;
|
|
120
|
+
let dataPoints = JSON.parse(currentSnapshot[measurementSection]);
|
|
119
121
|
let units = "";
|
|
120
122
|
let labelText = "";
|
|
121
123
|
let valueText = "";
|
|
@@ -159,12 +161,13 @@ function printBodySection(currentSnapshot, measurementSection, xLeft, xRight, y)
|
|
|
159
161
|
doc.setFontSize(8);
|
|
160
162
|
y += .05;
|
|
161
163
|
}
|
|
162
|
-
if (
|
|
164
|
+
if (JSON.parse(reportData.reportSettings).includeRangeIndicators) {
|
|
163
165
|
let rangeIconRef = getRangeIcon(key, valueBeforeEditing, currentSnapshot);
|
|
164
166
|
if (rangeIconRef) doc.addImage(graphics[rangeIconRef], "JPEG", xRight + .05, y - .12, .16, .16);
|
|
165
167
|
}
|
|
166
|
-
let toolIconRef = getToolIcon(
|
|
168
|
+
let toolIconRef = getToolIcon(JSON.parse(currentSnapshot.toolIcons)[key]);
|
|
167
169
|
if (toolIconRef) doc.addImage(graphics[toolIconRef], "JPEG", xRight + .25, y - .12, .16, .16);
|
|
170
|
+
else if (currentSnapshot.calculated && JSON.parse(currentSnapshot.calculated)[key]) doc.addImage(graphics.iconCalculator, "JPEG", xRight + .25, y - .12, .16, .16);
|
|
168
171
|
y += (s * sMultiplier);
|
|
169
172
|
} else if (key == "newColumn") {
|
|
170
173
|
sMultiplier = 1;
|
|
@@ -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]);
|