@measurequick/measurequick-report-generator 1.2.2 → 1.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measurequick/measurequick-report-generator",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Generates PDF documents for various MeasureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@ export async function getReport(payload) { console.log("Photos Report"); console
26
26
  for (let i = 0; i < pageCount; i++) {
27
27
  const doc = await PDFDocument.load(util._base64ToArrayBuffer(page.base64));
28
28
  const form = doc.getForm();
29
- form.getTextField("Header").setText(`${util.properNoun(keys[k])} Photos`);
29
+ form.getTextField("Header").setText(`${util.capitalizeFirstLetter(keys[k])} Photos`);
30
30
  const mqLogoBytes = util._base64ToArrayBuffer(base64.mqLogo);
31
31
  const mqLogo = await doc.embedPng(mqLogoBytes);
32
32
  form.getButton("FullWidthLogo").setImage(mqLogo);
@@ -47,14 +47,13 @@ export async function getReport(payload) { console.log("Photos Report"); console
47
47
  else if (photo.includes("image/png")) image = await doc.embedPng(util._base64ToArrayBuffer(photo));
48
48
  if (image) form.getButton(`photo${size}${j}`).setImage(image);
49
49
  let firstPhoto = (lastTag != currentTag);
50
- if (payload.photos[keys[k]][sections[sectionNum]].hasNotes && firstPhoto) {
51
- let notesPrefix = keys[k] ? `${keys[k]}: ` : "";
52
- form.getTextField(`Notes${j}`).setText(`${notesPrefix}${payload.photos[keys[k]][sections[sectionNum]].notes}`);
53
- }
50
+ lastTag = currentTag;
51
+ let notes = payload.photos[keys[k]][sections[sectionNum]].name;
52
+ if (payload.photos[keys[k]][sections[sectionNum]].hasNotes && firstPhoto) notes += ": " + payload.photos[keys[k]][sections[sectionNum]].notes;
53
+ form.getTextField(`Notes${j}`).setText(`${notes}`);
54
54
  }
55
55
  }
56
56
  }
57
- lastTag = currentTag;
58
57
  }
59
58
  }
60
59
  forms.forEach(form => { form.flatten() });
package/util.js CHANGED
@@ -35,10 +35,8 @@ export function getColorFromGrade(grade) {
35
35
  else return "Red";
36
36
  }
37
37
 
38
- export function properNoun(improperNoun) {
39
- let properNoun = improperNoun;
40
- // properNoun = improperNoun.CAPITALIZE_FIRST_LETTER();
41
- return properNoun;
38
+ export function capitalizeFirstLetter(string) {
39
+ return string.charAt(0).toUpperCase() + string.slice(1);
42
40
  }
43
41
 
44
42
  export function getToolIcon(test, ref, embeddedIcons) {