@medicus.ai/medicus-report-pdf-generator 1.0.404 → 1.0.405

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.
@@ -7,6 +7,7 @@ const LocaleService = require('../app/services/localeService.js');
7
7
  const i18n = require('../app/i18n_wellbeing.config.js');
8
8
  const puppeteer = require("puppeteer");
9
9
  const { renderReportItems, find, renderSummary, renderReportSummary, renderHTMLTemplate, renderAllergyClasses } = require("./template.js");
10
+ const { cli } = require("webpack");
10
11
 
11
12
 
12
13
  var localeService = new LocaleService(i18n);
@@ -610,6 +611,11 @@ const renderHeaderTemplate = (template, data, logo, userImage, topInsight) => {
610
611
  * @returns {object} Object containing all loaded templates
611
612
  */
612
613
  const loadExtendedTemplates = (isRtl, clientName, hasProfileInfo = false) => {
614
+ if (clientName.toLowerCase() === 'pha') {
615
+ clientName = 'Pha';
616
+ } else if (clientName.toLowerCase() === 'mediclinic') {
617
+ clientName = 'Mediclinic';
618
+ }
613
619
  const basePath = path.resolve(__dirname + `/../templates/${clientName}`);
614
620
 
615
621
  const templates = {
@@ -1278,12 +1284,12 @@ const cleanStyledHeader = (html, profileInfo, language = 'ar', clientName = 'med
1278
1284
  const dom = new JSDOM(html);
1279
1285
  const document = dom.window.document;
1280
1286
  const logo = document.querySelector("img.report-logo");
1281
- const allClientLabs = config.labs_logos;
1282
- console.log('selected labs : ',selectedLabs);
1283
- const addedLogos = Object.keys(allClientLabs).filter(lab =>
1287
+ const allClientLabs = config.labs_logos.map(item => item.toLowerCase());
1288
+ console.log('selected labs : ', selectedLabs);
1289
+ const addedLogos = Object.keys(allClientLabs).filter(lab =>
1284
1290
  selectedLabs?.some(otherLab => otherLab.toLowerCase() === lab.toLowerCase())
1285
1291
  );
1286
- console.log('added logos',addedLogos);
1292
+ console.log('added logos', addedLogos);
1287
1293
  const logoSrc = logo?.src || "";
1288
1294
  const headerTitle = document.querySelector(".client-name")?.textContent?.trim() || "";
1289
1295
  const fontFamily = language.startsWith('ar') ? 'Cairo' : 'Open Sans';
@@ -1293,7 +1299,7 @@ const cleanStyledHeader = (html, profileInfo, language = 'ar', clientName = 'med
1293
1299
  const headerStylesCustomization = () => {
1294
1300
  let logoStyle = 'width:130px;height:40px;margin:0 8px;';
1295
1301
  let titleStyle = `font-family: ${fontFamily};font-weight: 700;font-style: Bold;font-size: 14px;line-height: 100%;letter-spacing: 0;text-transform: uppercase;`;
1296
-
1302
+
1297
1303
  if (clientName.toLocaleLowerCase() == 'mediclinic') {
1298
1304
  logoStyle = 'width: 92px;height: 28px;';
1299
1305
  titleStyle = titleStyle;
@@ -1302,7 +1308,7 @@ const cleanStyledHeader = (html, profileInfo, language = 'ar', clientName = 'med
1302
1308
  logoStyle = 'max-height: 32px; max-width: 60px; width: auto; object-fit: contain; display: block;margin:0 4px;';
1303
1309
  titleStyle = `font-family: ${fontFamily};font-weight: 500;font-style: Bold;font-size: 12px;line-height: 100%;letter-spacing: 0;text-transform: uppercase;`;
1304
1310
  }
1305
-
1311
+
1306
1312
  return {
1307
1313
  logoStyle,
1308
1314
  titleStyle
@@ -1332,10 +1338,10 @@ const cleanStyledHeader = (html, profileInfo, language = 'ar', clientName = 'med
1332
1338
  <div style="display: flex; gap: 12px; align-items: center;">
1333
1339
  <img src="${logoSrc}" alt="Logo" style="${styles?.logoStyle || ""}" />
1334
1340
  ${addedLogos.length > 0 ? addedLogos.map(lab =>
1335
- (!!lab && !!allClientLabs[lab])
1336
- ? `<img src="${allClientLabs[lab]}" style="${styles?.logoStyle || ""}" />`
1337
- : ''
1338
- ).join('') : ''}
1341
+ (!!lab && !!allClientLabs[lab])
1342
+ ? `<img src="${allClientLabs[lab]}" style="${styles?.logoStyle || ""}" />`
1343
+ : ''
1344
+ ).join('') : ''}
1339
1345
  </div>
1340
1346
  ` : '';
1341
1347
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medicus.ai/medicus-report-pdf-generator",
3
- "version": "1.0.404",
3
+ "version": "1.0.405",
4
4
  "description": "Nasco corporate report - latest update in 12/10/2023 - Fix HRC for bionext",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -44,4 +44,4 @@
44
44
  "babel-preset-stage-0": "^6.24.1",
45
45
  "webpack": "^4.28.4"
46
46
  }
47
- }
47
+ }