diff --git a/example.custom-proposal-sample-declaration.hbs b/example.custom-proposal-sample-declaration.hbs
new file mode 100644
index 00000000..c1b5e23e
--- /dev/null
+++ b/example.custom-proposal-sample-declaration.hbs
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sample: {{sample.title}}
+
+
+
+
+ {{#each sampleQuestionaryFields}}
+ {{#if ($eq this.question.dataType 'EMBELLISHMENT')}}
+ {{#if ($notEq this.config.omitFromPdf true)}}
+
+
+ {{this.config.plain}}
+ |
+
+ {{/if}}
+ {{else}}
+
+
+ {{this.question.question}}
+ |
+
+ {{#if ($eq this.question.dataType 'NUMBER_INPUT')}}
+ {{#if this.value.value}}
+ {{this.value.value}}
+ {{this.value.unit.unit}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if ($eq this.question.dataType 'BOOLEAN')}}
+ {{#if this.value}}Yes{{else}}No{{/if}}
+ {{else if ($eq this.question.dataType 'INTERVAL')}}
+ {{#if ($or this.value.min this.value.max)}}
+ {{this.value.min}}
+ -
+ {{this.value.max}}
+ {{#if this.value.unit}}
+ {{this.value.unit.unit}}
+ {{/if}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if ($eq this.question.dataType 'DATE')}}
+ {{#if this.value}} {{$utcDate this.value}} {{else}}
+ Left blank
+ {{/if}}
+ {{else if
+ ($eq
+ this.question.dataType 'DYNAMIC_MULTIPLE_CHOICE'
+ )
+ }}
+ {{#if this.value}}
+ {{$join this.value ', '}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if
+ ($eq
+ this.question.dataType 'SELECTION_FROM_OPTIONS'
+ )
+ }}
+ {{#if this.value}}
+ {{$join this.value ', '}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if ($eq this.question.dataType 'TEXT_INPUT')}}
+ {{#if this.value}}
+ {{this.value}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if
+ ($eq this.question.dataType 'RICH_TEXT_INPUT')
+ }}
+ {{#if this.value}}
+ {{{this.value}}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if
+ ($eq this.question.dataType 'INSTRUMENT_PICKER')
+ }}
+ {{#if this.value}}
+ {{{this.value}}}
+ {{else}}
+ Left blank
+ {{/if}}
+ {{else if ($eq this.question.dataType 'FILE_UPLOAD')}}
+ {{#if this.value}}
+ See attachment below
+ {{else}}
+ Left blank
+ {{/if}}
+ {{/if}}
+ |
+
+ {{/if}}
+ {{/each}}
+
+
+
+
+
+
Status:
+ {{sample.status}}
+
+ {{#if sample.safetyComment}}
+
Comment:
+ {{sample.safetyComment}}
+ {{/if}}
+
+
+
+
+
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index b0597514..a7a26507 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -33,27 +33,27 @@
"xmldom": "^0.6.0"
},
"devDependencies": {
- "@types/archiver": "^5.3.2",
+ "@types/archiver": "^5.3.3",
"@types/cookie-parser": "^1.4.4",
"@types/cors": "^2.8.14",
"@types/express": "^4.17.17",
- "@types/gm": "^1.25.1",
+ "@types/gm": "^1.25.2",
"@types/http-errors": "^2.0.1",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.198",
- "@types/morgan": "^1.9.5",
- "@types/node": "^20.6.2",
- "@types/pg": "^8.10.2",
- "@types/pg-large-object": "^2.0.2",
+ "@types/morgan": "^1.9.6",
+ "@types/node": "^20.8.0",
+ "@types/pg": "^8.10.3",
+ "@types/pg-large-object": "^2.0.5",
"@types/qrcode": "^1.5.2",
"@types/supertest": "^2.0.12",
"@types/xmldom": "^0.1.32",
- "@typescript-eslint/eslint-plugin": "^6.6.0",
+ "@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
- "eslint-plugin-jest": "^27.4.0",
+ "eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^4.3.8",
@@ -1455,9 +1455,9 @@
"dev": true
},
"node_modules/@types/archiver": {
- "version": "5.3.2",
- "resolved": "https://registry.npmjs.org/@types/archiver/-/archiver-5.3.2.tgz",
- "integrity": "sha512-IctHreBuWE5dvBDz/0WeKtyVKVRs4h75IblxOACL92wU66v+HGAfEYAOyXkOFphvRJMhuXdI9huDXpX0FC6lCw==",
+ "version": "5.3.3",
+ "resolved": "https://registry.npmjs.org/@types/archiver/-/archiver-5.3.3.tgz",
+ "integrity": "sha512-0ABdVcXL6jOwNGY+hjWPqrxUvKelBEwNLcuv/SV2vZ4YCH8w9NttFCt+/QqI5zgMX+iX/XqVy89/r7EmLJmMpQ==",
"dev": true,
"dependencies": {
"@types/readdir-glob": "*"
@@ -1572,9 +1572,9 @@
}
},
"node_modules/@types/gm": {
- "version": "1.25.1",
- "resolved": "https://registry.npmjs.org/@types/gm/-/gm-1.25.1.tgz",
- "integrity": "sha512-WLqlPvjot5jxpt1AFxaWm0fgWZUBGXOPJC3ZrQgRpvpHYjwYbvr/4GwRzd0mXFfxzX+TrvXaow+/WbmWFHomlQ==",
+ "version": "1.25.2",
+ "resolved": "https://registry.npmjs.org/@types/gm/-/gm-1.25.2.tgz",
+ "integrity": "sha512-lS4ZYapP8lnqLhuJwHxbqp4n2R9F00H1gA/78xGoOv1TNbusmOfywkoLNN+9wC8wHCP8l02AGWTrjPmK96zbkQ==",
"dev": true,
"dependencies": {
"@types/node": "*"
@@ -1654,18 +1654,18 @@
"dev": true
},
"node_modules/@types/morgan": {
- "version": "1.9.5",
- "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.5.tgz",
- "integrity": "sha512-5TgfIWm0lcTGnbCZExwc19dCOMOMmAiiBZQj8Ko3NRxsVDgRxf+AEGRQTqNVA5Yh2xfdWp4clbAEMbYP+jkOqg==",
+ "version": "1.9.6",
+ "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.6.tgz",
+ "integrity": "sha512-xfKogz5WcKww2DAiVT9zxMgrqQt+Shq8tDVeLT+otoj6dJnkRkyJxMF51mHtUc3JCPKGk5x1EBU0buuGpfftlQ==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
- "version": "20.6.2",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz",
- "integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==",
+ "version": "20.8.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.0.tgz",
+ "integrity": "sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ==",
"devOptional": true
},
"node_modules/@types/parse-json": {
@@ -1675,9 +1675,9 @@
"dev": true
},
"node_modules/@types/pg": {
- "version": "8.10.2",
- "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.2.tgz",
- "integrity": "sha512-MKFs9P6nJ+LAeHLU3V0cODEOgyThJ3OAnmOlsZsxux6sfQs3HRXR5bBn7xG5DjckEFhTAxsXi7k7cd0pCMxpJw==",
+ "version": "8.10.3",
+ "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.3.tgz",
+ "integrity": "sha512-BACzsw64lCZesclRpZGu55tnqgFAYcrCBP92xLh1KLypZLCOsvJTSTgaoFVTy3lCys/aZTQzfeDxtjwrvdzL2g==",
"dev": true,
"dependencies": {
"@types/node": "*",
@@ -1686,9 +1686,9 @@
}
},
"node_modules/@types/pg-large-object": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/@types/pg-large-object/-/pg-large-object-2.0.4.tgz",
- "integrity": "sha512-j3Nug48gNeRjSY1Dq0nyYCAV+Bi7HBhyO2YYke9qJoBDzDo9t8p5z7LlRBYlUqphqhWlNnbRyBBtSsQXZIgB5w==",
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@types/pg-large-object/-/pg-large-object-2.0.5.tgz",
+ "integrity": "sha512-TlgNnOenLlAg83GS5S6m533n21CtHdiUaFyya226Hs/t8YbvVdWNwsQnhaThefBREJuddlddy2aTcUcm2bC8RA==",
"dev": true,
"dependencies": {
"@types/node": "*",
@@ -1876,16 +1876,16 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.6.0.tgz",
- "integrity": "sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz",
+ "integrity": "sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.5.1",
- "@typescript-eslint/scope-manager": "6.6.0",
- "@typescript-eslint/type-utils": "6.6.0",
- "@typescript-eslint/utils": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0",
+ "@typescript-eslint/scope-manager": "6.7.3",
+ "@typescript-eslint/type-utils": "6.7.3",
+ "@typescript-eslint/utils": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
@@ -1911,13 +1911,13 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz",
- "integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
+ "integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0"
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -1928,9 +1928,9 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz",
- "integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
+ "integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -1941,13 +1941,13 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz",
- "integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
+ "integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1968,17 +1968,17 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.6.0.tgz",
- "integrity": "sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
+ "integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
- "@typescript-eslint/scope-manager": "6.6.0",
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/typescript-estree": "6.6.0",
+ "@typescript-eslint/scope-manager": "6.7.3",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/typescript-estree": "6.7.3",
"semver": "^7.5.4"
},
"engines": {
@@ -1993,12 +1993,12 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz",
- "integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
+ "integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
@@ -2129,13 +2129,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.6.0.tgz",
- "integrity": "sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz",
+ "integrity": "sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==",
"dev": true,
"dependencies": {
- "@typescript-eslint/typescript-estree": "6.6.0",
- "@typescript-eslint/utils": "6.6.0",
+ "@typescript-eslint/typescript-estree": "6.7.3",
+ "@typescript-eslint/utils": "6.7.3",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
},
@@ -2156,13 +2156,13 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/scope-manager": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz",
- "integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
+ "integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0"
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -2173,9 +2173,9 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz",
- "integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
+ "integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
@@ -2186,13 +2186,13 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz",
- "integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
+ "integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -2213,17 +2213,17 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/utils": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.6.0.tgz",
- "integrity": "sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
+ "integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
- "@typescript-eslint/scope-manager": "6.6.0",
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/typescript-estree": "6.6.0",
+ "@typescript-eslint/scope-manager": "6.7.3",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/typescript-estree": "6.7.3",
"semver": "^7.5.4"
},
"engines": {
@@ -2238,12 +2238,12 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz",
- "integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
+ "integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
@@ -4453,9 +4453,9 @@
}
},
"node_modules/eslint-plugin-jest": {
- "version": "27.4.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.0.tgz",
- "integrity": "sha512-ukVeKmMPAUA5SWjHenvyyXnirKfHKMdOsTZdn5tZx5EW05HGVQwBohigjFZGGj3zuv1cV6hc82FvWv6LdIbkgg==",
+ "version": "27.4.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.2.tgz",
+ "integrity": "sha512-3Nfvv3wbq2+PZlRTf2oaAWXWwbdBejFRBR2O8tAO67o+P8zno+QGbcDYaAXODlreXVg+9gvWhKKmG2rgfb8GEg==",
"dev": true,
"dependencies": {
"@typescript-eslint/utils": "^5.10.0"
@@ -12489,9 +12489,9 @@
"dev": true
},
"@types/archiver": {
- "version": "5.3.2",
- "resolved": "https://registry.npmjs.org/@types/archiver/-/archiver-5.3.2.tgz",
- "integrity": "sha512-IctHreBuWE5dvBDz/0WeKtyVKVRs4h75IblxOACL92wU66v+HGAfEYAOyXkOFphvRJMhuXdI9huDXpX0FC6lCw==",
+ "version": "5.3.3",
+ "resolved": "https://registry.npmjs.org/@types/archiver/-/archiver-5.3.3.tgz",
+ "integrity": "sha512-0ABdVcXL6jOwNGY+hjWPqrxUvKelBEwNLcuv/SV2vZ4YCH8w9NttFCt+/QqI5zgMX+iX/XqVy89/r7EmLJmMpQ==",
"dev": true,
"requires": {
"@types/readdir-glob": "*"
@@ -12606,9 +12606,9 @@
}
},
"@types/gm": {
- "version": "1.25.1",
- "resolved": "https://registry.npmjs.org/@types/gm/-/gm-1.25.1.tgz",
- "integrity": "sha512-WLqlPvjot5jxpt1AFxaWm0fgWZUBGXOPJC3ZrQgRpvpHYjwYbvr/4GwRzd0mXFfxzX+TrvXaow+/WbmWFHomlQ==",
+ "version": "1.25.2",
+ "resolved": "https://registry.npmjs.org/@types/gm/-/gm-1.25.2.tgz",
+ "integrity": "sha512-lS4ZYapP8lnqLhuJwHxbqp4n2R9F00H1gA/78xGoOv1TNbusmOfywkoLNN+9wC8wHCP8l02AGWTrjPmK96zbkQ==",
"dev": true,
"requires": {
"@types/node": "*"
@@ -12688,18 +12688,18 @@
"dev": true
},
"@types/morgan": {
- "version": "1.9.5",
- "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.5.tgz",
- "integrity": "sha512-5TgfIWm0lcTGnbCZExwc19dCOMOMmAiiBZQj8Ko3NRxsVDgRxf+AEGRQTqNVA5Yh2xfdWp4clbAEMbYP+jkOqg==",
+ "version": "1.9.6",
+ "resolved": "https://registry.npmjs.org/@types/morgan/-/morgan-1.9.6.tgz",
+ "integrity": "sha512-xfKogz5WcKww2DAiVT9zxMgrqQt+Shq8tDVeLT+otoj6dJnkRkyJxMF51mHtUc3JCPKGk5x1EBU0buuGpfftlQ==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/node": {
- "version": "20.6.2",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz",
- "integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==",
+ "version": "20.8.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.0.tgz",
+ "integrity": "sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ==",
"devOptional": true
},
"@types/parse-json": {
@@ -12709,9 +12709,9 @@
"dev": true
},
"@types/pg": {
- "version": "8.10.2",
- "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.2.tgz",
- "integrity": "sha512-MKFs9P6nJ+LAeHLU3V0cODEOgyThJ3OAnmOlsZsxux6sfQs3HRXR5bBn7xG5DjckEFhTAxsXi7k7cd0pCMxpJw==",
+ "version": "8.10.3",
+ "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.3.tgz",
+ "integrity": "sha512-BACzsw64lCZesclRpZGu55tnqgFAYcrCBP92xLh1KLypZLCOsvJTSTgaoFVTy3lCys/aZTQzfeDxtjwrvdzL2g==",
"dev": true,
"requires": {
"@types/node": "*",
@@ -12764,9 +12764,9 @@
}
},
"@types/pg-large-object": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/@types/pg-large-object/-/pg-large-object-2.0.4.tgz",
- "integrity": "sha512-j3Nug48gNeRjSY1Dq0nyYCAV+Bi7HBhyO2YYke9qJoBDzDo9t8p5z7LlRBYlUqphqhWlNnbRyBBtSsQXZIgB5w==",
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@types/pg-large-object/-/pg-large-object-2.0.5.tgz",
+ "integrity": "sha512-TlgNnOenLlAg83GS5S6m533n21CtHdiUaFyya226Hs/t8YbvVdWNwsQnhaThefBREJuddlddy2aTcUcm2bC8RA==",
"dev": true,
"requires": {
"@types/node": "*",
@@ -12897,16 +12897,16 @@
}
},
"@typescript-eslint/eslint-plugin": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.6.0.tgz",
- "integrity": "sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz",
+ "integrity": "sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==",
"dev": true,
"requires": {
"@eslint-community/regexpp": "^4.5.1",
- "@typescript-eslint/scope-manager": "6.6.0",
- "@typescript-eslint/type-utils": "6.6.0",
- "@typescript-eslint/utils": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0",
+ "@typescript-eslint/scope-manager": "6.7.3",
+ "@typescript-eslint/type-utils": "6.7.3",
+ "@typescript-eslint/utils": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
@@ -12916,29 +12916,29 @@
},
"dependencies": {
"@typescript-eslint/scope-manager": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz",
- "integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
+ "integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0"
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3"
}
},
"@typescript-eslint/types": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz",
- "integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
+ "integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz",
- "integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
+ "integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -12947,27 +12947,27 @@
}
},
"@typescript-eslint/utils": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.6.0.tgz",
- "integrity": "sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
+ "integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
- "@typescript-eslint/scope-manager": "6.6.0",
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/typescript-estree": "6.6.0",
+ "@typescript-eslint/scope-manager": "6.7.3",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/typescript-estree": "6.7.3",
"semver": "^7.5.4"
}
},
"@typescript-eslint/visitor-keys": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz",
- "integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
+ "integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
"eslint-visitor-keys": "^3.4.1"
}
}
@@ -13040,41 +13040,41 @@
}
},
"@typescript-eslint/type-utils": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.6.0.tgz",
- "integrity": "sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz",
+ "integrity": "sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==",
"dev": true,
"requires": {
- "@typescript-eslint/typescript-estree": "6.6.0",
- "@typescript-eslint/utils": "6.6.0",
+ "@typescript-eslint/typescript-estree": "6.7.3",
+ "@typescript-eslint/utils": "6.7.3",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz",
- "integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
+ "integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0"
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3"
}
},
"@typescript-eslint/types": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz",
- "integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
+ "integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz",
- "integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
+ "integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/visitor-keys": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -13083,27 +13083,27 @@
}
},
"@typescript-eslint/utils": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.6.0.tgz",
- "integrity": "sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
+ "integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
- "@typescript-eslint/scope-manager": "6.6.0",
- "@typescript-eslint/types": "6.6.0",
- "@typescript-eslint/typescript-estree": "6.6.0",
+ "@typescript-eslint/scope-manager": "6.7.3",
+ "@typescript-eslint/types": "6.7.3",
+ "@typescript-eslint/typescript-estree": "6.7.3",
"semver": "^7.5.4"
}
},
"@typescript-eslint/visitor-keys": {
- "version": "6.6.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz",
- "integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==",
+ "version": "6.7.3",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
+ "integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "6.6.0",
+ "@typescript-eslint/types": "6.7.3",
"eslint-visitor-keys": "^3.4.1"
}
}
@@ -14717,9 +14717,9 @@
}
},
"eslint-plugin-jest": {
- "version": "27.4.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.0.tgz",
- "integrity": "sha512-ukVeKmMPAUA5SWjHenvyyXnirKfHKMdOsTZdn5tZx5EW05HGVQwBohigjFZGGj3zuv1cV6hc82FvWv6LdIbkgg==",
+ "version": "27.4.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.2.tgz",
+ "integrity": "sha512-3Nfvv3wbq2+PZlRTf2oaAWXWwbdBejFRBR2O8tAO67o+P8zno+QGbcDYaAXODlreXVg+9gvWhKKmG2rgfb8GEg==",
"dev": true,
"requires": {
"@typescript-eslint/utils": "^5.10.0"
diff --git a/package.json b/package.json
index c9ab512d..a6268661 100644
--- a/package.json
+++ b/package.json
@@ -47,27 +47,27 @@
"xmldom": "^0.6.0"
},
"devDependencies": {
- "@types/archiver": "^5.3.2",
+ "@types/archiver": "^5.3.3",
"@types/cookie-parser": "^1.4.4",
"@types/cors": "^2.8.14",
"@types/express": "^4.17.17",
- "@types/gm": "^1.25.1",
+ "@types/gm": "^1.25.2",
"@types/http-errors": "^2.0.1",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.198",
- "@types/morgan": "^1.9.5",
- "@types/node": "^20.6.2",
- "@types/pg": "^8.10.2",
- "@types/pg-large-object": "^2.0.2",
+ "@types/morgan": "^1.9.6",
+ "@types/node": "^20.8.0",
+ "@types/pg": "^8.10.3",
+ "@types/pg-large-object": "^2.0.5",
"@types/qrcode": "^1.5.2",
"@types/supertest": "^2.0.12",
"@types/xmldom": "^0.1.32",
- "@typescript-eslint/eslint-plugin": "^6.6.0",
+ "@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
- "eslint-plugin-jest": "^27.4.0",
+ "eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^4.3.8",
diff --git a/src/types.ts b/src/types.ts
index 4a35662d..73bd1580 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -13,6 +13,7 @@ export type PdfTemplate = {
templateData: string;
templateHeader: string;
templateFooter: string;
+ templateSampleDeclaration: string;
};
export type ProposalPDFData = {
diff --git a/src/workflows/pdf/proposal/CustomProposalPdfFactory.ts b/src/workflows/pdf/proposal/CustomProposalPdfFactory.ts
index be4c8b63..f488ce89 100644
--- a/src/workflows/pdf/proposal/CustomProposalPdfFactory.ts
+++ b/src/workflows/pdf/proposal/CustomProposalPdfFactory.ts
@@ -4,9 +4,10 @@ import { logger } from '@user-office-software/duo-logger';
import { ProposalPDFMeta, ProposalCountedPagesMeta } from './ProposalPDFMeta';
import { extractAnswerMap } from './QuestionAnswerMapper';
+import { FileMetadata } from '../../../models/File';
import { generatePdfFromHtml } from '../../../pdf';
import { render, renderFooter, renderHeader } from '../../../template';
-import { ProposalPDFData, Role } from '../../../types';
+import { ProposalPDFData, ProposalSampleData, Role } from '../../../types';
import { insertScriptInBottom, insertScriptInTop } from '../../../util/pdfHtml';
import { computeTableOfContents, pagedJs } from '../../../util/pdfHtmlScript';
import PdfFactory from '../PdfFactory';
@@ -21,6 +22,7 @@ export class CustomProposalPdfFactory extends PdfFactory<
protected templateBody: string;
protected templateHeader?: string;
protected templateFooter?: string;
+ protected sampleDeclaration?: string;
protected countedPagesMeta: ProposalCountedPagesMeta;
protected meta: ProposalPDFMeta = {
@@ -51,16 +53,18 @@ export class CustomProposalPdfFactory extends PdfFactory<
userRole: Role,
templateBody: string,
templateHeader?: string,
- templateFooter?: string
+ templateFooter?: string,
+ sampleDeclaration?: string
) {
super(entityId, userRole);
this.templateBody = templateBody;
this.templateHeader = templateHeader;
this.templateFooter = templateFooter;
+ this.sampleDeclaration = sampleDeclaration;
}
init(data: ProposalPDFData) {
- const { attachments } = data;
+ const { samples, attachments } = data;
const noRenders = {
waitFor: 0,
@@ -71,7 +75,7 @@ export class CustomProposalPdfFactory extends PdfFactory<
proposal: { waitFor: 1, countedPagesPerPdf: {} },
questionnaires: Object.assign({}, noRenders),
technicalReview: Object.assign({}, noRenders),
- samples: Object.assign({}, noRenders),
+ samples: { waitFor: samples.length, countedPagesPerPdf: {} },
genericTemplates: Object.assign({}, noRenders),
attachments: {
waitFor: 0 /* set by fetched:attachmentsFileMeta */,
@@ -89,6 +93,11 @@ export class CustomProposalPdfFactory extends PdfFactory<
tasksNeeded.push('fetch:attachmentsFileMeta');
tasksNeeded.push('count-pages:attachments');
}
+ // If the Sample Declaration Questionaries are present and answered And there is a template written for the sample declaration, then push the job
+ if (samples.length > 0 && this.sampleDeclaration) {
+ tasksNeeded.push('render:samples');
+ tasksNeeded.push('count-pages:samples');
+ }
logger.logDebug(this.logPrefix + 'tasks needed to complete', {
tasksNeeded,
@@ -100,6 +109,7 @@ export class CustomProposalPdfFactory extends PdfFactory<
this.on('countPages', this.countPages);
this.once('render:proposal', this.renderProposal);
+ this.once('render:samples', this.renderSamples);
this.once('fetch:attachments', this.fetchAttachments);
this.once(
'fetch:attachmentsFileMeta',
@@ -112,6 +122,15 @@ export class CustomProposalPdfFactory extends PdfFactory<
this.emit('taskFinished', 'render:proposal');
});
+ this.on('rendered:sample', (pdf) => {
+ this.meta.files.samples.push(pdf.pdfPath);
+ this.meta.toc.samples.push(pdf.toc);
+
+ if (this.meta.files.samples.length === samples.length) {
+ this.emit('taskFinished', 'render:samples');
+ }
+ });
+
this.on('fetched:attachment', (attachmentPath) => {
this.meta.files.attachments.push(attachmentPath);
@@ -136,6 +155,16 @@ export class CustomProposalPdfFactory extends PdfFactory<
userRole: this.userRole,
});
+ // If the Sample Declaration Questionaries are present and answered And there is a template written for the sample declaration, then start the job
+ if (samples.length > 0 && this.sampleDeclaration) {
+ this.emit(
+ 'render:samples',
+ { ...data, userRole: this.userRole },
+ samples,
+ attachmentsFileMeta
+ );
+ }
+
if (this.countedPagesMeta.attachments.waitFor === 0) {
this.emit('taskFinished', 'fetch:attachments');
this.emit('taskFinished', 'count-pages:attachments');
@@ -164,6 +193,16 @@ export class CustomProposalPdfFactory extends PdfFactory<
this.emit('fetch:attachmentsFileMeta', attachments);
} else {
this.emit('render:proposal', data);
+
+ // If the Sample Declaration Questionaries are present and answered And there is a template written for the sample declaration, then start the job
+ if (samples.length > 0 && this.sampleDeclaration) {
+ this.emit(
+ 'render:samples',
+ { ...data, userRole: this.userRole },
+ samples,
+ []
+ );
+ }
}
}
@@ -227,4 +266,64 @@ export class CustomProposalPdfFactory extends PdfFactory<
this.emit('error', e, 'renderProposal');
}
}
+
+ private async renderSamples(
+ data: ProposalPDFData,
+ samples: ProposalSampleData[],
+ attachmentsFileMeta: FileMetadata[]
+ ) {
+ // TODO: This needs to be tested
+ if (this.sampleDeclaration) {
+ try {
+ for (const { sample, sampleQuestionaryFields } of samples) {
+ if (this.stopped) {
+ this.emit('aborted', 'renderSamples');
+
+ return;
+ }
+
+ const renderedProposalSample = await render(this.sampleDeclaration, {
+ sample,
+ sampleQuestionaryFields,
+ attachmentsFileMeta,
+ });
+
+ // TODO: This needs to be optimised, as this is a redundant code from renderProposal method
+ const headerTemplate = this.templateHeader
+ ? await render(this.templateHeader, {
+ ...data,
+ logoPath: process.env.HEADER_LOGO_PATH
+ ? process.env.HEADER_LOGO_PATH
+ : join(process.cwd(), './templates/images/ESS.png'),
+ })
+ : await renderHeader(data.proposal.proposalId);
+
+ const footerTemplate = this.templateFooter
+ ? await render(this.templateFooter, data)
+ : await renderFooter();
+
+ const pdfOptions = {
+ margin: {
+ top: 82,
+ left: 72,
+ bottom: 72,
+ right: 72,
+ },
+ displayHeaderFooter: true,
+ headerTemplate: headerTemplate,
+ footerTemplate: footerTemplate,
+ };
+
+ const pdf = await generatePdfFromHtml(renderedProposalSample, {
+ pdfOptions: pdfOptions,
+ });
+ console.info({ pdfPath: pdf.pdfPath });
+ this.emit('countPages', pdf.pdfPath, 'samples');
+ this.emit('rendered:sample', pdf);
+ }
+ } catch (e) {
+ this.emit('error', e, 'renderSamples');
+ }
+ }
+ }
}
diff --git a/src/workflows/pdf/proposal/ProposalPdfFactoryPicker.ts b/src/workflows/pdf/proposal/ProposalPdfFactoryPicker.ts
index 88f5b87f..dcc6600c 100644
--- a/src/workflows/pdf/proposal/ProposalPdfFactoryPicker.ts
+++ b/src/workflows/pdf/proposal/ProposalPdfFactoryPicker.ts
@@ -16,6 +16,8 @@ export class AutoProposalPdfFactoryPicker extends PdfFactoryPicker<
const templateBody = data.pdfTemplate?.templateData;
const templateHeader = data.pdfTemplate?.templateHeader;
const templateFooter = data.pdfTemplate?.templateFooter;
+ const templateSampleDeclaration =
+ data.pdfTemplate?.templateSampleDeclaration;
if (templateBody === undefined) {
return new AutoProposalPdfFactory(entityId, userRole);
@@ -25,7 +27,8 @@ export class AutoProposalPdfFactoryPicker extends PdfFactoryPicker<
userRole,
templateBody,
templateHeader,
- templateFooter
+ templateFooter,
+ templateSampleDeclaration
);
}
}