@medicus.ai/medicus-report-pdf-generator 1.0.185 → 1.0.188
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/index.js +3 -5
- package/lib/corporate_report_generator.js +15 -11
- package/locales/wellbeing/en.json +4 -0
- package/locales/wellbeing/es.json +133 -121
- package/package.json +2 -2
- package/templates/rtl_no_pages.html +1 -1
package/index.js
CHANGED
|
@@ -213,7 +213,6 @@ module.exports = {
|
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
let html = await generateHTMLCorporateReport(decodedJSON, isDebugging);
|
|
216
|
-
console.log('n7lllll', html);
|
|
217
216
|
|
|
218
217
|
|
|
219
218
|
// 3: save PDF buffer
|
|
@@ -225,11 +224,10 @@ module.exports = {
|
|
|
225
224
|
}
|
|
226
225
|
|
|
227
226
|
|
|
228
|
-
fs.writeFileSync(PDF_FILE_PATH, fileBuffer, '
|
|
227
|
+
fs.writeFileSync(PDF_FILE_PATH, fileBuffer, 'utf8');
|
|
229
228
|
|
|
230
229
|
// 4: save encoded base64
|
|
231
|
-
const base64data = Buffer.from(fileBuffer, '
|
|
232
|
-
console.log('tasneem', Buffer.from(fileBuffer, 'utf-8').toString());
|
|
230
|
+
const base64data = Buffer.from(fileBuffer, 'utf8').toString('base64');
|
|
233
231
|
if (isDebugging) {
|
|
234
232
|
console.log('4: save encoded base64');
|
|
235
233
|
LOGS += '4: save encoded base64' + '\n' + '=============' + '\n';
|
|
@@ -238,7 +236,7 @@ module.exports = {
|
|
|
238
236
|
|
|
239
237
|
|
|
240
238
|
// 5: save logs to file
|
|
241
|
-
fs.writeFileSync(LOGS_FILE_PATH, LOGS, '
|
|
239
|
+
fs.writeFileSync(LOGS_FILE_PATH, LOGS, 'utf8');
|
|
242
240
|
if (isDebugging) {
|
|
243
241
|
console.log('5: save logs to file');
|
|
244
242
|
}
|
|
@@ -54,7 +54,7 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
54
54
|
OUT_FILE = path.resolve(__dirname + '/../output/corporate-report-pdf' + dateNow + '.html');
|
|
55
55
|
Pdf_file = '/output/corporate-report-pdf' + dateNow + '.html'
|
|
56
56
|
let isRtl = false;
|
|
57
|
-
data.language = '
|
|
57
|
+
// data.language = 'es'
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
let client = data.clientName ? data.clientName.toLowerCase() : 'default'
|
|
@@ -85,16 +85,20 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
85
85
|
}*/
|
|
86
86
|
|
|
87
87
|
/*check if the language is an RTL language*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (!data.language) {
|
|
89
|
+
localeService.setLocale("en")
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
localeService.setLocale(data.language);
|
|
93
|
+
debugLog("pdf language:", data.language);
|
|
94
|
+
}
|
|
91
95
|
/*choose the right template*/
|
|
92
|
-
let html = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/ltr_no_pages.html'), '
|
|
96
|
+
let html = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/ltr_no_pages.html'), 'utf8');
|
|
93
97
|
|
|
94
|
-
let coverPageTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/cover_page.html'), '
|
|
95
|
-
let participantAnalyticsTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/participant_analytics.html'), '
|
|
96
|
-
let pageAnalyticsTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/page.html'), '
|
|
97
|
-
let footerTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/footer.html'), '
|
|
98
|
+
let coverPageTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/cover_page.html'), 'utf8');
|
|
99
|
+
let participantAnalyticsTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/participant_analytics.html'), 'utf8');
|
|
100
|
+
let pageAnalyticsTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/page.html'), 'utf8');
|
|
101
|
+
let footerTemplate = fs.readFileSync(path.resolve(__dirname + '/../templates/corporate_report/footer.html'), 'utf8');
|
|
98
102
|
footerTemplate = footerTemplate
|
|
99
103
|
.replace("{{logo}}", logo)
|
|
100
104
|
.replace("{{footer_Color}}", report_date_color)
|
|
@@ -103,7 +107,7 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
103
107
|
const dom = new JSDOM(html);
|
|
104
108
|
let historyData = [];
|
|
105
109
|
debugLog("templates loaded");
|
|
106
|
-
|
|
110
|
+
|
|
107
111
|
let display_second_log = show_second_footer_logo ? "" : "display:none";
|
|
108
112
|
coverPageTemplate = coverPageTemplate
|
|
109
113
|
.replace("{{logo}}", logo)
|
|
@@ -215,7 +219,7 @@ let generateHTMLCorporateReport = async (data, isDebugging) => {
|
|
|
215
219
|
|
|
216
220
|
|
|
217
221
|
if (!empty(element.sources)) {
|
|
218
|
-
let sourcesHTML =
|
|
222
|
+
let sourcesHTML = `<div class=\'sources-title\'>${recommends_title} ${localeService.t('Sources')}</div>`
|
|
219
223
|
element.sources.map((source) => {
|
|
220
224
|
sourcesHTML += "<span>"
|
|
221
225
|
if (!empty(source.link)) {
|
|
@@ -1,122 +1,134 @@
|
|
|
1
|
-
{
|
|
2
|
-
"yearsOld": {
|
|
3
|
-
"message": "años de edad",
|
|
4
|
-
"description": "After the patient old in the header"
|
|
5
|
-
},
|
|
6
|
-
"lifeStyle": {
|
|
7
|
-
"message": "Estilo de vida",
|
|
8
|
-
"description": "my lifestyle part header"
|
|
9
|
-
},
|
|
10
|
-
"body": {
|
|
11
|
-
"message": "Cuerpo",
|
|
12
|
-
"description": "my body part header"
|
|
13
|
-
},
|
|
14
|
-
"mind": {
|
|
15
|
-
"message": "Mente",
|
|
16
|
-
"description": "my mind part header"
|
|
17
|
-
},
|
|
18
|
-
"psychological": {
|
|
19
|
-
"message": "Emocional",
|
|
20
|
-
"description": "Psychological title"
|
|
21
|
-
},
|
|
22
|
-
"physical": {
|
|
23
|
-
"message": "Físico",
|
|
24
|
-
"description": "Physical title"
|
|
25
|
-
},
|
|
26
|
-
"weRecommend": {
|
|
27
|
-
"message": "Recomendamos",
|
|
28
|
-
"description": "tips section title"
|
|
29
|
-
},
|
|
30
|
-
"wellbeingReport": {
|
|
31
|
-
"message": "Reporte de Bienestar Inteligente",
|
|
32
|
-
"description": "Report header"
|
|
33
|
-
},
|
|
34
|
-
"scoresNote": {
|
|
35
|
-
"message": "Mientras más alto sea el score, eres más saludable",
|
|
36
|
-
"description": "scores note"
|
|
37
|
-
},
|
|
38
|
-
"reportHeaderDescription": {
|
|
39
|
-
"message": "Tu Score de Bienestar Inteligente está a un paso de recibir una medalla, y tus hábitos de estilo de vida te podrían estar deteniendo. Déjanos ayudarte a cambiar eso.",
|
|
40
|
-
"description": "Text showing in the report header"
|
|
41
|
-
},
|
|
42
|
-
"sincerely": {
|
|
43
|
-
"message": "Sinceramente",
|
|
44
|
-
"description": "part of message showing in email template preview in general configuration page"
|
|
45
|
-
},
|
|
46
|
-
"hospital": {
|
|
47
|
-
"message": "HOSPITAL",
|
|
48
|
-
"description": "name of field showing at add user"
|
|
49
|
-
},
|
|
50
|
-
"healthRisk": {
|
|
51
|
-
"message": "Riesgos para la salud",
|
|
52
|
-
"description": "part header"
|
|
53
|
-
},
|
|
54
|
-
"Disclaimer": {
|
|
55
|
-
"message": "Exclusión de responsabilidad:",
|
|
56
|
-
"description": "Label showing in the footer as disclaimer title"
|
|
57
|
-
},
|
|
58
|
-
"Disclaimer Text": {
|
|
59
|
-
"message": "Este reporte, el cual fue elaborado específicamente para tí, muestra de manera gráfica tu progreso comparando tus hábitos del estilo de vida actuales y del pasado. El objetivo de este reporte es guiarte en el camino a un estilo de vida saludable. Sin embargo, este reporte no debe reemplazar una consulta médica y los resultados de este no ofrecen un diagnóstico médico. Esta herramienta busca brindar información valiosa acerca de los principales riesgos a tu salud y tu estado de salud en general. Nuestra misión es ayudarte a idear un plan para adoptar habitos saludables y mejorar tu salud.",
|
|
60
|
-
"description": "text showing in the footer as disclaimer"
|
|
61
|
-
},
|
|
62
|
-
"January": {
|
|
63
|
-
"message": "Enero",
|
|
64
|
-
"description": "Month name"
|
|
65
|
-
},
|
|
66
|
-
"February": {
|
|
67
|
-
"message": "Febrero",
|
|
68
|
-
"description": "Month name"
|
|
69
|
-
},
|
|
70
|
-
"March": {
|
|
71
|
-
"message": "Marzo",
|
|
72
|
-
"description": "Month name"
|
|
73
|
-
},
|
|
74
|
-
"April": {
|
|
75
|
-
"message": "Abril",
|
|
76
|
-
"description": "Month name"
|
|
77
|
-
},
|
|
78
|
-
"May": {
|
|
79
|
-
"message": "Mayo",
|
|
80
|
-
"description": "Month name"
|
|
81
|
-
},
|
|
82
|
-
"June": {
|
|
83
|
-
"message": "Junio",
|
|
84
|
-
"description": "Month name"
|
|
85
|
-
},
|
|
86
|
-
"July": {
|
|
87
|
-
"message": "Julio",
|
|
88
|
-
"description": "Month name"
|
|
89
|
-
},
|
|
90
|
-
"August": {
|
|
91
|
-
"message": "Agosto",
|
|
92
|
-
"description": "Month name"
|
|
93
|
-
},
|
|
94
|
-
"September": {
|
|
95
|
-
"message": "Septiembre",
|
|
96
|
-
"description": "Month name"
|
|
97
|
-
},
|
|
98
|
-
"October": {
|
|
99
|
-
"message": "Octubre",
|
|
100
|
-
"description": "Month name"
|
|
101
|
-
},
|
|
102
|
-
"November": {
|
|
103
|
-
"message": "Noviembre",
|
|
104
|
-
"description": "Month name"
|
|
105
|
-
},
|
|
106
|
-
"December": {
|
|
107
|
-
"message": "Diciembre",
|
|
108
|
-
"description": "Month name"
|
|
109
|
-
},
|
|
110
|
-
"Moxie recommends...": {
|
|
111
|
-
"message": "Moxie recommends...",
|
|
112
|
-
"description": "Title in corporate report"
|
|
113
|
-
},
|
|
114
|
-
"Copyright": {
|
|
115
|
-
"message": "© Copyright NASCO Insurance 2020",
|
|
116
|
-
"description": "Copyright text in corporate report"
|
|
117
|
-
},
|
|
118
|
-
"Participant Analytics": {
|
|
119
|
-
"message": "Análisis de los Resultados",
|
|
120
|
-
"description": "Section title in corporate report"
|
|
121
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"yearsOld": {
|
|
3
|
+
"message": "años de edad",
|
|
4
|
+
"description": "After the patient old in the header"
|
|
5
|
+
},
|
|
6
|
+
"lifeStyle": {
|
|
7
|
+
"message": "Estilo de vida",
|
|
8
|
+
"description": "my lifestyle part header"
|
|
9
|
+
},
|
|
10
|
+
"body": {
|
|
11
|
+
"message": "Cuerpo",
|
|
12
|
+
"description": "my body part header"
|
|
13
|
+
},
|
|
14
|
+
"mind": {
|
|
15
|
+
"message": "Mente",
|
|
16
|
+
"description": "my mind part header"
|
|
17
|
+
},
|
|
18
|
+
"psychological": {
|
|
19
|
+
"message": "Emocional",
|
|
20
|
+
"description": "Psychological title"
|
|
21
|
+
},
|
|
22
|
+
"physical": {
|
|
23
|
+
"message": "Físico",
|
|
24
|
+
"description": "Physical title"
|
|
25
|
+
},
|
|
26
|
+
"weRecommend": {
|
|
27
|
+
"message": "Recomendamos",
|
|
28
|
+
"description": "tips section title"
|
|
29
|
+
},
|
|
30
|
+
"wellbeingReport": {
|
|
31
|
+
"message": "Reporte de Bienestar Inteligente",
|
|
32
|
+
"description": "Report header"
|
|
33
|
+
},
|
|
34
|
+
"scoresNote": {
|
|
35
|
+
"message": "Mientras más alto sea el score, eres más saludable",
|
|
36
|
+
"description": "scores note"
|
|
37
|
+
},
|
|
38
|
+
"reportHeaderDescription": {
|
|
39
|
+
"message": "Tu Score de Bienestar Inteligente está a un paso de recibir una medalla, y tus hábitos de estilo de vida te podrían estar deteniendo. Déjanos ayudarte a cambiar eso.",
|
|
40
|
+
"description": "Text showing in the report header"
|
|
41
|
+
},
|
|
42
|
+
"sincerely": {
|
|
43
|
+
"message": "Sinceramente",
|
|
44
|
+
"description": "part of message showing in email template preview in general configuration page"
|
|
45
|
+
},
|
|
46
|
+
"hospital": {
|
|
47
|
+
"message": "HOSPITAL",
|
|
48
|
+
"description": "name of field showing at add user"
|
|
49
|
+
},
|
|
50
|
+
"healthRisk": {
|
|
51
|
+
"message": "Riesgos para la salud",
|
|
52
|
+
"description": "part header"
|
|
53
|
+
},
|
|
54
|
+
"Disclaimer": {
|
|
55
|
+
"message": "Exclusión de responsabilidad:",
|
|
56
|
+
"description": "Label showing in the footer as disclaimer title"
|
|
57
|
+
},
|
|
58
|
+
"Disclaimer Text": {
|
|
59
|
+
"message": "Este reporte, el cual fue elaborado específicamente para tí, muestra de manera gráfica tu progreso comparando tus hábitos del estilo de vida actuales y del pasado. El objetivo de este reporte es guiarte en el camino a un estilo de vida saludable. Sin embargo, este reporte no debe reemplazar una consulta médica y los resultados de este no ofrecen un diagnóstico médico. Esta herramienta busca brindar información valiosa acerca de los principales riesgos a tu salud y tu estado de salud en general. Nuestra misión es ayudarte a idear un plan para adoptar habitos saludables y mejorar tu salud.",
|
|
60
|
+
"description": "text showing in the footer as disclaimer"
|
|
61
|
+
},
|
|
62
|
+
"January": {
|
|
63
|
+
"message": "Enero",
|
|
64
|
+
"description": "Month name"
|
|
65
|
+
},
|
|
66
|
+
"February": {
|
|
67
|
+
"message": "Febrero",
|
|
68
|
+
"description": "Month name"
|
|
69
|
+
},
|
|
70
|
+
"March": {
|
|
71
|
+
"message": "Marzo",
|
|
72
|
+
"description": "Month name"
|
|
73
|
+
},
|
|
74
|
+
"April": {
|
|
75
|
+
"message": "Abril",
|
|
76
|
+
"description": "Month name"
|
|
77
|
+
},
|
|
78
|
+
"May": {
|
|
79
|
+
"message": "Mayo",
|
|
80
|
+
"description": "Month name"
|
|
81
|
+
},
|
|
82
|
+
"June": {
|
|
83
|
+
"message": "Junio",
|
|
84
|
+
"description": "Month name"
|
|
85
|
+
},
|
|
86
|
+
"July": {
|
|
87
|
+
"message": "Julio",
|
|
88
|
+
"description": "Month name"
|
|
89
|
+
},
|
|
90
|
+
"August": {
|
|
91
|
+
"message": "Agosto",
|
|
92
|
+
"description": "Month name"
|
|
93
|
+
},
|
|
94
|
+
"September": {
|
|
95
|
+
"message": "Septiembre",
|
|
96
|
+
"description": "Month name"
|
|
97
|
+
},
|
|
98
|
+
"October": {
|
|
99
|
+
"message": "Octubre",
|
|
100
|
+
"description": "Month name"
|
|
101
|
+
},
|
|
102
|
+
"November": {
|
|
103
|
+
"message": "Noviembre",
|
|
104
|
+
"description": "Month name"
|
|
105
|
+
},
|
|
106
|
+
"December": {
|
|
107
|
+
"message": "Diciembre",
|
|
108
|
+
"description": "Month name"
|
|
109
|
+
},
|
|
110
|
+
"Moxie recommends...": {
|
|
111
|
+
"message": "Moxie recommends...",
|
|
112
|
+
"description": "Title in corporate report"
|
|
113
|
+
},
|
|
114
|
+
"Copyright": {
|
|
115
|
+
"message": "© Copyright NASCO Insurance 2020",
|
|
116
|
+
"description": "Copyright text in corporate report"
|
|
117
|
+
},
|
|
118
|
+
"Participant Analytics": {
|
|
119
|
+
"message": "Análisis de los Resultados",
|
|
120
|
+
"description": "Section title in corporate report"
|
|
121
|
+
},
|
|
122
|
+
"Page": {
|
|
123
|
+
"message": "Página",
|
|
124
|
+
"description": "page number in the corporate report PDF"
|
|
125
|
+
},
|
|
126
|
+
"Sources": {
|
|
127
|
+
"message": "Más información",
|
|
128
|
+
"descripition": "sources in the corporate report PDF"
|
|
129
|
+
},
|
|
130
|
+
"recommends...": {
|
|
131
|
+
"message": "recomienda...",
|
|
132
|
+
"description": "Title in corporate report"
|
|
133
|
+
}
|
|
122
134
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medicus.ai/medicus-report-pdf-generator",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.188",
|
|
4
|
+
"description": "Coroporate report - latest update in 27/4/2022 - fix check language",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node index.js"
|
|
@@ -87,6 +87,6 @@
|
|
|
87
87
|
<script src="../assets/translation.min.js"></script>
|
|
88
88
|
<script src="../assets/jquery-1.4.min.js"></script>
|
|
89
89
|
<script src="../assets/js.min.js"></script>
|
|
90
|
-
|
|
90
|
+
<!--<link href="https://fonts.googleapis.com/css?family=Cairo" rel="stylesheet">-->
|
|
91
91
|
</body>
|
|
92
92
|
</html>
|