meemup-library 1.5.30 → 1.5.32

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.
@@ -102,7 +102,7 @@ class LabelPreviewController {
102
102
  printProductTitle(template, row) {
103
103
  let content = this.createDivContainer(template);
104
104
  let largeFontSize = template.printer === 5 ? "22px" : parseInt((template.fontSize + 10) + "") + "px";
105
- if (template.showProductKitchenName)
105
+ if (template.showProductKitchenName && row.kitchenReceiptName !== null)
106
106
  content += `<strong style="display:block; font-size: ${largeFontSize};">${row.kitchenReceiptName}</strong>`;
107
107
  else
108
108
  content += `<strong style="display:block; font-size: ${largeFontSize};">${row.title}</strong>`;
@@ -771,29 +771,36 @@ class _PreviewContentController {
771
771
  });
772
772
  }
773
773
  createPaymentInfoReceipt(detail, template) {
774
- var _a;
774
+ var _a, _b, _c, _d;
775
775
  const { font, width, paper, paddingTop, paddingBottom, } = template;
776
776
  const fontFamily = (font === "Font A" || font === "Font B") ? "arial" : font;
777
- let content = `<div style="font-family : ${fontFamily}; font-weight : normal; padding : ${paddingTop}px 0 ${paddingBottom}px 0; width: ${this.calculatePaperSize(paper, width)};"> `;
778
- content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: center;">${detail.company.title}</p>`;
777
+ let content = `<div style="font-family : ${fontFamily}; font-weight : normal; line-height:1.6rem; padding : ${paddingTop}px 0 ${paddingBottom}px 0; width: ${this.calculatePaperSize(paper, width)};"> `;
778
+ content += `<p style="display:block; font-size: ${template.fontSize * 2}px; text-align: center;">${detail.company.title}</p>`;
779
779
  content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: center;">${detail.company.address}</p>`;
780
780
  content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: center;">${PhoneController.toDisplay(detail.company.phone)}</p>`;
781
781
  content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left; margin-top:24px;">Payment type and status:</p>`;
782
782
  const total = MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol);
783
783
  const afterTotal = detail.order.paymentState === EnumPaymentState.Paid ? "PAID" : "NOT PAID";
784
- content += `<p style="display:block; font-size: ${template.fontSize * 2}px; text-align: left; margin-bottom:24px;">${total + ", " + afterTotal}</p>`;
785
- content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Reg. date ${dayjs(detail.order.registrationDate).format(Formats.displayDateTime)}</p>`;
786
- content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Order REF:${detail.order.id} , #${detail.order.orderNumber}</p>`;
784
+ content += `<p style="display:block; font-size: ${template.fontSize * 2}px; text-align: left; margin-bottom:16px;">${total + ", " + afterTotal}</p>`;
785
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Reg. date &nbsp;&nbsp; ${dayjs(detail.order.registrationDate).format(Formats.displayDateTime)}</p>`;
786
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Order &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; REF:${detail.order.id} , #${detail.order.orderNumber}</p>`;
787
787
  content += `<div style="display:flex; flex-direction : row; justify-content: space-between; align-items :center; ">
788
788
  <p style="font-size: ${template.fontSize * 2}px; text-align: left;">Total, ${afterTotal}</p>
789
789
  <p style="font-size: ${template.fontSize * 2}px; text-align: right;">${total}</p>
790
790
  </div>`;
791
- content += `<div style="display:flex; flex-direction : row; justify-content:center; align-items:center; gap : 8px; margin-top:24px; margin-bottom: 24px;">
791
+ content += `<div style="display:flex; flex-direction : row; justify-content:center; align-items:center; gap : 8px; margin-top:16px; margin-bottom: 16px;">
792
792
  <div style="border-top:1px solid black; flex:1;"></div>
793
- <p style="font-size: ${template.fontSize * 2}px; text-align: right;">${(_a = detail.paymentInfo) === null || _a === void 0 ? void 0 : _a.state}</p>
793
+ <p style="font-size: ${template.fontSize}px; text-align: right;">${(_a = detail.paymentInfo) === null || _a === void 0 ? void 0 : _a.state}</p>
794
794
  <div style="border-top:1px solid black; flex:1;"></div>
795
795
  </div>`;
796
- content += SimplePreviewController.printMetaData(template, detail);
796
+ if (detail.paymentInfo !== null && Array.isArray((_b = detail.paymentInfo) === null || _b === void 0 ? void 0 : _b.metadata) && ((_d = (_c = detail.paymentInfo) === null || _c === void 0 ? void 0 : _c.metadata) === null || _d === void 0 ? void 0 : _d.length) > 0) {
797
+ content += `<div style="margin-bottom:16px;">`;
798
+ detail.paymentInfo.metadata.forEach(item => {
799
+ content += `<p style="display: block; text-align: left; font-size: ${template.fontSize}px;">${item.text}: ${item.value}</p>`;
800
+ });
801
+ content += `</div>`;
802
+ }
803
+ // content += SimplePreviewController.printMetaData(template, detail);
797
804
  content += SimplePreviewController.printFooter(template, detail);
798
805
  content += `</div>`;
799
806
  return (`<div style="display: flex;"><div style="width : auto;">${content}</div></div>`);
@@ -294,7 +294,7 @@ export default new class {
294
294
 
295
295
  <div style="flex-wrap : wrap; word-wrap : break-word; text-align : left;">
296
296
 
297
- ${(showCategoryTitle && row.categoryTitle !== "" && row.categoryTitle !== null) ? "[" + row.categoryTitle + "]" : ""} ${showProductKitchenName && row.kitchenReceiptName !== "" ? row.kitchenReceiptName : row.title}
297
+ ${(showCategoryTitle && row.categoryTitle !== "" && row.categoryTitle !== null) ? "[" + row.categoryTitle + "]" : ""} ${showProductKitchenName && row.kitchenReceiptName !== null ? row.kitchenReceiptName : row.title}
298
298
  ${row.extrasNames ? row.extrasNames.split(" , ").map(i => `<div>+${i}</div>`).join("") : ""}
299
299
  ${row.note ? `<div><span style="font-size: x-large;">&#128488;</span>{note}</div>` : ""}
300
300
 
@@ -424,7 +424,7 @@ export default new class {
424
424
  <p style="margin-bottom: 5px; padding-bottom: 5px; border-bottom: 2px solid black;">
425
425
  ${row.quantity}X &nbsp;
426
426
  ${showCategoryTitle && row.categoryTitle ? "[" + row.categoryTitle.toUpperCase() + "]" : ""}
427
- ${showProductKitchenName && row.kitchenReceiptName !== "" ? row.kitchenReceiptName : row.title}
427
+ ${showProductKitchenName && row.kitchenReceiptName !== null ? row.kitchenReceiptName : row.title}
428
428
  ${row.extrasNames !== "" && `<div>${row.extrasNames}</div>`}
429
429
  </p>
430
430
 
@@ -219,7 +219,7 @@ class SimplePreviewController {
219
219
  cat = "";
220
220
  else
221
221
  cat = `[${row.categoryTitle.trim()}] `;
222
- const productName = cat + ((template.showProductKitchenName && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.productName);
222
+ const productName = cat + ((template.showProductKitchenName && row.kitchenReceiptName !== null) ? row.kitchenReceiptName : row.productName);
223
223
  const amount = template.showPrices ? MoneyController.format(row.totalAmount, detail.company.currencySymbol) : "";
224
224
  content += `<tr style="height: 28px;">
225
225
  <td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;">${row.quantity}X</td>
@@ -348,7 +348,7 @@ class SimplePreviewController {
348
348
  <tbody>
349
349
  `;
350
350
  detail.products.forEach((row) => {
351
- const productName = (template.showCategoryTitle ? `[${row.categoryTitle}] ` : "") + ((template.showProductKitchenName && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.title);
351
+ const productName = (template.showCategoryTitle ? `[${row.categoryTitle}] ` : "") + ((template.showProductKitchenName && row.kitchenReceiptName !== null) ? row.kitchenReceiptName : row.title);
352
352
  const amount = template.showPrices ? MoneyController.format(row.totalAmount, detail.company.currencySymbol) : "";
353
353
  content += `<tr>
354
354
  <td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;">${row.quantity}X</td>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.5.30",
3
+ "version": "1.5.32",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "remove:one": "rimraf dist",
12
12
  "remove:two": "rimraf ./src/dist",
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
- "commit": "git add . && git commit -m \"version.1.5.30\" && git push origin "
14
+ "commit": "git add . && git commit -m \"version.1.5.32\" && git push origin "
15
15
  },
16
16
  "files": [
17
17
  "/dist"