@measurequick/measurequick-report-generator 1.2.85 → 1.2.87
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.
|
@@ -50,11 +50,16 @@ export async function getReport(payload, _test) {
|
|
|
50
50
|
// get form for filling
|
|
51
51
|
const form = pdfDoc.getForm();
|
|
52
52
|
|
|
53
|
-
let header =
|
|
53
|
+
let header = "Heating System Vitals";
|
|
54
54
|
form.getTextField('Header').setText(header);
|
|
55
55
|
|
|
56
|
+
let test = payload.tests[0];
|
|
57
|
+
if (_test) test = _test;
|
|
58
|
+
|
|
56
59
|
// get text fields
|
|
57
|
-
let
|
|
60
|
+
let t = payload.tests[0].testInfo;
|
|
61
|
+
if (_test) t = _test.testInfo;
|
|
62
|
+
let textFields = getTextFields(payload, t);
|
|
58
63
|
|
|
59
64
|
// print company logo and profile picture
|
|
60
65
|
if (profileImage && companyImage) {
|
|
@@ -101,11 +106,10 @@ export async function getReport(payload, _test) {
|
|
|
101
106
|
form.getTextField('TimeOfServiceUpper').setText(date.toLocaleTimeString("en-US"));
|
|
102
107
|
}
|
|
103
108
|
|
|
104
|
-
|
|
105
109
|
let systemScorePercentage = test.testInfo.data.vitals_score ? +test.testInfo.data.vitals_score.toFixed(0) : 0;
|
|
106
110
|
let systemScoreGrade = util.getGradeFromScore(systemScorePercentage);
|
|
107
111
|
let systemScoreColor = util.getColorFromGrade(systemScoreGrade);
|
|
108
|
-
if (!
|
|
112
|
+
if (!t.data.vitals_score) {
|
|
109
113
|
systemScorePercentage = "--";
|
|
110
114
|
systemScoreGrade = "";
|
|
111
115
|
} else systemScorePercentage += "%";
|
|
@@ -138,9 +142,6 @@ export async function getReport(payload, _test) {
|
|
|
138
142
|
form.getTextField(`AirDistributionLosses${lossColor}`).setText(`${prefix}${textFields.staticLoss}`);
|
|
139
143
|
form.getTextField('YourSystemScorePage2').setText(`${systemScorePercentage} ${systemScoreGrade}`);
|
|
140
144
|
|
|
141
|
-
let test = payload.tests[0];
|
|
142
|
-
if (_test) test = _test;
|
|
143
|
-
|
|
144
145
|
// print targets and range icons
|
|
145
146
|
const measureLabels = ["ManifoldPressure", "TempSplit", "Tesp", "FilterFace"];
|
|
146
147
|
const targetKeys = ["pressure_manifold", "temperature_rise", "pressure_static_total_external", "velocity_face_filter1"];
|
|
@@ -205,11 +206,10 @@ export async function getReport(payload, _test) {
|
|
|
205
206
|
form.flatten();
|
|
206
207
|
const pdfBase64 = await pdfDoc.saveAsBase64({ dataUri: true });
|
|
207
208
|
return pdfBase64;
|
|
208
|
-
} catch (error) { }
|
|
209
|
+
} catch (error) { console.log(error) }
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
function getTextFields(payload) {
|
|
212
|
-
let test = test.testInfo;
|
|
212
|
+
function getTextFields(payload, test) {
|
|
213
213
|
return {
|
|
214
214
|
"cName": payload.site.customer.first_name && payload.site.customer.last_name ? `${payload.site.customer.first_name} ${payload.site.customer.last_name}` : "",
|
|
215
215
|
"address": payload.site.location.address ? payload.site.location.address : "",
|