@medicus.ai/medicus-report-pdf-generator 1.0.246 → 1.0.247
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/lib/sanusx_report_generator.js +0 -159
- package/package.json +1 -1
|
@@ -153,179 +153,20 @@ let generateHTMLSanusXReport = async (data, isDebugging, clientName, language) =
|
|
|
153
153
|
.replace("{{avatarDesc1}}", localeService.t(avatar + 'Desc'))
|
|
154
154
|
.replace("{{avatarDesc2}}", localeService.t(avatar + 'Details'))
|
|
155
155
|
|
|
156
|
-
/* Super powers section */
|
|
157
|
-
superPowerSectionTemplate = superPowerSectionTemplate.replace("{{superpowerImage}}", path.resolve(__dirname + '/../assets/sanusx/images/superpower_icon.png'))
|
|
158
|
-
.replace("{{SuperPowerTitle}}", localeService.t('SUPERPOWER'))
|
|
159
|
-
.replace("{{SuperPowerMsg}}", localeService.t(avatar + 'SUPERPOWER-msg'))
|
|
160
|
-
.replace("{{strengthImage}}", path.resolve(__dirname + '/../assets/sanusx/images/strength_icon.png'))
|
|
161
|
-
.replace("{{StrengthTitle}}", localeService.t('STRENGTH'))
|
|
162
|
-
.replace("{{StrengthMsg}}", localeService.t('STRENGTH-msg'))
|
|
163
|
-
|
|
164
|
-
.replace("{{weaknessImage}}", path.resolve(__dirname + '/../assets/sanusx/images/weakness_icon.png'))
|
|
165
|
-
.replace("{{WeaknessTitle}}", localeService.t('WEAKNESS'))
|
|
166
|
-
.replace("{{WeaknessMsg}}", localeService.t('WEAKNESS-msg'))
|
|
167
|
-
.replace("{{highestElementName}}", highestElementName[0].name)
|
|
168
|
-
.replace("{{lowestElementScore}}", lowestElementScore.name)
|
|
169
|
-
|
|
170
|
-
/* Personal Details section */
|
|
171
|
-
let physicalScore = data.calculation.physicalScore.toFixed(1)
|
|
172
|
-
let physicalAmount = ((physicalScore > 40 && physicalScore < 70) ? 255 : (physicalScore >= 70) ? 253 : 214);
|
|
173
|
-
let physicalColor = (physicalScore > 40 && physicalScore < 70) ? second_level_color : (physicalScore >= 70) ? third_level_color : first_level_color;
|
|
174
|
-
|
|
175
|
-
const rotatePhysicalAmount = (physicalScore / 100) * physicalAmount;
|
|
176
|
-
let psychologicalScore = data.calculation.psychologicalScore.toFixed(1)
|
|
177
|
-
let psychologicalAmount = ((psychologicalScore > 40 && psychologicalScore < 70) ? 255 : (psychologicalScore >= 70) ? 253 : 214);
|
|
178
|
-
let psychologicalColor = (psychologicalScore > 40 && psychologicalScore < 70) ? second_level_color : (psychologicalScore >= 70) ? third_level_color : first_level_color;
|
|
179
|
-
const rotatePsychologicalAmount = (psychologicalScore / 100) * psychologicalAmount;
|
|
180
|
-
let psychologicalScoreImage = (psychologicalScore > 40 && psychologicalScore < 70) ? "med" : (psychologicalScore >= 70) ? 'high' : 'low';
|
|
181
|
-
let physicalScoreImage = (physicalScore > 40 && physicalScore < 70) ? "med" : (physicalScore >= 70) ? 'high' : 'low';
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
personalDetailsSectionTemplate = personalDetailsSectionTemplate.replace("{{physicalScore}}", parseFloat(Math.floor(data.calculation.physicalScore)))
|
|
185
|
-
.replace("{{physicalScoreDecimalPart}}", parseFloat((data.calculation.physicalScore).toFixed(1) % 1).toFixed(1).substring(1))
|
|
186
|
-
.replace("{{physicalScoreStatement}}", data.calculation.physicalScoreStatement)
|
|
187
|
-
.replace("{{PhysicalWord}}", localeService.t('physicalScore'))
|
|
188
|
-
.replace(/{{rotatePhysicalAmount}}/gi, rotatePhysicalAmount)
|
|
189
|
-
.replace(/{{physicalColor}}/gi, physicalColor)
|
|
190
|
-
.replace("{{psychologicalScore}}", Math.floor(data.calculation.psychologicalScore))
|
|
191
|
-
.replace("{{psychologicalScoreDecimalPart}}", parseFloat((data.calculation.psychologicalScore).toFixed(1) % 1).toFixed(1).substring(1))
|
|
192
|
-
.replace("{{psychologicalWord}}", localeService.t('psychologicalScore'))
|
|
193
|
-
.replace("{{psychologicalScoreStatement}}", data.calculation.psychologicalScoreStatement)
|
|
194
|
-
.replace(/{{rotatePsychologicalAmount}}/gi, rotatePsychologicalAmount)
|
|
195
|
-
.replace("{{psychologicalColor}}", psychologicalColor)
|
|
196
|
-
.replace("{{tigerIcon}}", path.resolve(__dirname + '/../assets/sanusx/images/tiger_icon.png'))
|
|
197
|
-
.replace("{{monkeyIcon}}", path.resolve(__dirname + '/../assets/sanusx/images/monkey_icon.png'))
|
|
198
|
-
.replace("{{owlIcon}}", path.resolve(__dirname + '/../assets/sanusx/images/owl_icon.png'))
|
|
199
|
-
.replace("{{middleArrowsImage}}", path.resolve(__dirname + '/../assets/sanusx/images/middle_arrows_image.png'))
|
|
200
|
-
.replace("{{physicalScoreImage}}", path.resolve(__dirname + '/../assets/sanusx/images/' + physicalScoreImage + '-segments-circle-SanusX.png'))
|
|
201
|
-
.replace("{{psychologicalScoreImage}}", path.resolve(__dirname + '/../assets/sanusx/images/' + psychologicalScoreImage + '-segments-circle-SanusX.png'))
|
|
202
|
-
.replaceAll("{{indicatorImage}}", path.resolve(__dirname + '/../assets/sanusx/images/indicator.png'))
|
|
203
|
-
.replace(/{{physicalColor}}/gi, physicalColor)
|
|
204
|
-
.replace("{{psychologicalColor}}", psychologicalColor)
|
|
205
|
-
.replace("{{closerLookTitle}}", localeService.t('closerLook'))
|
|
206
|
-
.replace("{{BodyTitle}}", localeService.t('body'))
|
|
207
|
-
.replace("{{MindTitle}}", localeService.t('mind'))
|
|
208
|
-
.replace("{{LifeStyleTitle}}", localeService.t('lifeStyle'))
|
|
209
|
-
.replace("{{LifeStyleExample}}", localeService.t('lifestyleExample'))
|
|
210
|
-
.replace("{{MindExample}}", localeService.t('mindExample'))
|
|
211
|
-
.replace("{{BodyExample}}", localeService.t('bodyExample'))
|
|
212
|
-
|
|
213
|
-
let bodyIcon = path.resolve(__dirname + '/../assets/sanusx/images/right_icon.png')
|
|
214
|
-
let lifestyleIcon = path.resolve(__dirname + '/../assets/sanusx/images/wrong_icon.png')
|
|
215
|
-
let mindIcon = path.resolve(__dirname + '/../assets/sanusx/images/right_icon.png')
|
|
216
|
-
|
|
217
|
-
let predictedBodyMsg, predictedLifestyleMsg, predictedHeartMsg = ''
|
|
218
|
-
let finalScore = 0;
|
|
219
|
-
if (!data.PartScoresHighestValues.body[0].isPredictiveElement) {
|
|
220
|
-
predictedBodyMsg = localeService.t('youPredictedWrong').replace("{$value}", data.PartScoresHighestValues.body[0].name)
|
|
221
|
-
} else {
|
|
222
|
-
finalScore++
|
|
223
|
-
predictedBodyMsg = localeService.t('youPredictedRight').replace("{$value}", data.PartScoresHighestValues.body[0].name)
|
|
224
|
-
}
|
|
225
|
-
if (!data.PartScoresHighestValues.mind[0].isPredictiveElement) {
|
|
226
|
-
predictedHeartMsg = localeService.t('youPredictedWrong').replace("{$value}", data.PartScoresHighestValues.mind[0].name)
|
|
227
|
-
} else {
|
|
228
|
-
finalScore++
|
|
229
|
-
predictedHeartMsg = localeService.t('youPredictedRight').replace("{$value}", data.PartScoresHighestValues.mind[0].name)
|
|
230
|
-
}
|
|
231
|
-
if (!data.PartScoresHighestValues.lifeStyle[0].isPredictiveElement) {
|
|
232
|
-
predictedLifestyleMsg = localeService.t('youPredictedWrong').replace("{$value}", data.PartScoresHighestValues.lifeStyle[0].name)
|
|
233
|
-
} else {
|
|
234
|
-
finalScore++
|
|
235
|
-
predictedLifestyleMsg = localeService.t('youPredictedRight').replace("{$value}", data.PartScoresHighestValues.lifeStyle[0].name)
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
let predictionsDesc= localeService.t('predictionsDesc').replace('{$val}',finalScore)
|
|
240
|
-
predictionsSectionTemplate = predictionsSectionTemplate
|
|
241
|
-
.replace("{{predictionsTitle}}", localeService.t('predictionsTitle'))
|
|
242
|
-
.replace("{{predictionsDesc}}", predictionsDesc)
|
|
243
|
-
.replace("{{bodyResultSanusX}}", localeService.t('bodyResultSanusX'))
|
|
244
|
-
.replace("{{lifestyleResultSanusX}}", localeService.t('lifeStyleResultSanusX'))
|
|
245
|
-
.replace("{{mindResultSanusX}}", localeService.t('mindResultSanusX'))
|
|
246
|
-
.replace("{{bodyResultPred}}", data.PartScoresHighestValues.body[0].name)
|
|
247
|
-
.replace("{{lifestyleResultPred}}", data.PartScoresHighestValues.lifeStyle[0].name)
|
|
248
|
-
.replace("{{mindResultPred}}", data.PartScoresHighestValues.mind[0].name)
|
|
249
|
-
.replace("{{forkIcon}}", path.resolve(__dirname + '/../assets/sanusx/images/fork_icon.png'))
|
|
250
|
-
.replace("{{heartIcon}}", path.resolve(__dirname + '/../assets/sanusx/images/heart_icon.png'))
|
|
251
|
-
.replace("{{leavesIcon}}", path.resolve(__dirname + '/../assets/sanusx/images/leaves_icon.png'))
|
|
252
|
-
.replace("{{predictedBodyMsg}}", predictedBodyMsg)
|
|
253
|
-
.replace("{{predictedLifestyleMsg}}", predictedLifestyleMsg)
|
|
254
|
-
.replace("{{predictedHeartMsg}}", predictedHeartMsg)
|
|
255
|
-
.replace("{{predictedBodyMsgIcon}}", bodyIcon)
|
|
256
|
-
.replace("{{predictedLifestyleMsgIcon}}", lifestyleIcon)
|
|
257
|
-
.replace("{{predictedHeartMsgIcon}}", mindIcon)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
/* Recommendations section*/
|
|
261
|
-
/*tips*/
|
|
262
|
-
let tips = data.insights.tips
|
|
263
|
-
let allTips = []
|
|
264
|
-
let lifeStyleTips = []
|
|
265
|
-
let mindTips = []
|
|
266
|
-
let bodyTips = []
|
|
267
|
-
tips.map((tip, index) => {
|
|
268
|
-
if (index === 0) {
|
|
269
|
-
lifeStyleTips.push(tip)
|
|
270
|
-
}
|
|
271
|
-
if (index === 1) {
|
|
272
|
-
bodyTips.push(tip)
|
|
273
|
-
}
|
|
274
|
-
if (index === 2) {
|
|
275
|
-
mindTips.push(tip)
|
|
276
|
-
}
|
|
277
|
-
})
|
|
278
|
-
allTips.push(lifeStyleTips)
|
|
279
|
-
allTips.push(bodyTips)
|
|
280
|
-
allTips.push(mindTips)
|
|
281
156
|
|
|
282
|
-
let elementScores = data.insights.elementScores
|
|
283
|
-
|
|
284
|
-
recommendationsSectionTemplate = recommendationsSectionTemplate
|
|
285
|
-
.replace("{{recommendationsTitle}}", localeService.t('recommendationsTitle'))
|
|
286
157
|
/*get the window from the dom to be used as a jquery function*/
|
|
287
158
|
const $ = (require('jquery'))(dom.window);
|
|
288
159
|
|
|
289
160
|
$('#content').addClass(language);
|
|
290
161
|
$('#content').append(headerTemplate);
|
|
291
|
-
$('#content').append(superPowerSectionTemplate);
|
|
292
|
-
$('#content').append(personalDetailsSectionTemplate);
|
|
293
|
-
$('#content').append(predictionsSectionTemplate);
|
|
294
|
-
$('#content').append(recommendationsSectionTemplate);
|
|
295
162
|
|
|
296
|
-
$(".tips-section").append(renderInsightTips(allTips, elementScores));
|
|
297
163
|
|
|
298
164
|
/*Footer*/
|
|
299
165
|
let footerTemplateHTML = footerTemplate.replace("{{footerLogo}}", path.resolve(__dirname + '/../assets/sanusx/images/footer-logo.png'))
|
|
300
166
|
.replace("{{sanusXReportFooter}}", localeService.t('sanusXReportFooter'));
|
|
301
167
|
|
|
302
168
|
$('#content').append(footerTemplateHTML);
|
|
303
|
-
if (!data.PartScoresHighestValues.lifeStyle[0].isPredictiveElement) {
|
|
304
|
-
$(".prediction-component.lifestyle").addClass('prediction-wrong')
|
|
305
|
-
}
|
|
306
|
-
if (!data.PartScoresHighestValues.mind[0].isPredictiveElement) {
|
|
307
|
-
$(".prediction-component.mind").addClass('prediction-wrong')
|
|
308
|
-
}
|
|
309
|
-
if (!data.PartScoresHighestValues.body[0].isPredictiveElement) {
|
|
310
|
-
$(".prediction-component.body").addClass('prediction-wrong')
|
|
311
|
-
}
|
|
312
|
-
|
|
313
169
|
|
|
314
|
-
if (parseFloat(psychologicalScore) > 40 && parseFloat(psychologicalScore) < 70) {
|
|
315
|
-
$(".first-section-scores .psychological-score-section .part-1,.first-section-scores .psychological-score-section .part-3").addClass('inactive')
|
|
316
|
-
} else if (psychologicalScore >= 70) {
|
|
317
|
-
$(".first-section-scores .psychological-score-section .part-3,.first-section-scores .psychological-score-section .part-2").addClass('inactive')
|
|
318
|
-
} else {
|
|
319
|
-
$(".first-section-scores .psychological-score-section .part-1,.first-section-scores .psychological-score-section .part-2").addClass('inactive')
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (parseFloat(physicalScore) > 40 && parseFloat(physicalScore) < 70) {
|
|
323
|
-
$(".first-section-scores .physical-score-section .part-1,.first-section-scores .physical-score-section .part-3").addClass('inactive')
|
|
324
|
-
} else if (physicalScore >= 70) {
|
|
325
|
-
$(".first-section-scores .physical-score-section .part-3,.first-section-scores .physical-score-section .part-2").addClass('inactive')
|
|
326
|
-
} else {
|
|
327
|
-
$(".first-section-scores .physical-score-section .part-1,.first-section-scores .physical-score-section .part-2").addClass('inactive')
|
|
328
|
-
}
|
|
329
170
|
$(".score-main").addClass(client);
|
|
330
171
|
|
|
331
172
|
|
package/package.json
CHANGED