meemup-library 1.5.31 → 1.5.33
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/dist/controllers/LabelPreviewController.js +1 -1
- package/dist/controllers/PrintContentController.js +2 -2
- package/dist/controllers/PrintToolController.d.ts +12 -0
- package/dist/controllers/PrintToolController.js +99 -0
- package/dist/controllers/SimplePreviewController.js +2 -2
- package/dist/statics.d.ts +6 -0
- package/dist/statics.js +6 -0
- package/package.json +2 -2
|
@@ -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>`;
|
|
@@ -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 !==
|
|
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;">🗨</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
|
|
426
426
|
${showCategoryTitle && row.categoryTitle ? "[" + row.categoryTitle.toUpperCase() + "]" : ""}
|
|
427
|
-
${showProductKitchenName && row.kitchenReceiptName !==
|
|
427
|
+
${showProductKitchenName && row.kitchenReceiptName !== null ? row.kitchenReceiptName : row.title}
|
|
428
428
|
${row.extrasNames !== "" && `<div>${row.extrasNames}</div>`}
|
|
429
429
|
</p>
|
|
430
430
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import IOrderDetailProductsExtra from '../interfaces/print/IOrderDetailProductsExtra';
|
|
2
|
+
import IOrderDetailProduct from '../interfaces/print/IOrderDetailProduct';
|
|
3
|
+
declare class _PrintToolController {
|
|
4
|
+
extraItemToText(item: IOrderDetailProductsExtra, ignoreWholeText?: boolean): string;
|
|
5
|
+
productNote(item: IOrderDetailProduct): string;
|
|
6
|
+
orderItemCountText: (products: IOrderDetailProduct[], catList: number[], onlyListCategory: boolean, productList: number[], onlyListProduct: boolean) => string;
|
|
7
|
+
filterProductsByCategoryList: (products: IOrderDetailProduct[], catList: number[], onlyListCategory: boolean, productList: number[], onlyListProduct: boolean) => IOrderDetailProduct[];
|
|
8
|
+
textWithIndent(text: string, indent?: number, lineWidth?: number): string;
|
|
9
|
+
createBundleLines(bundleTitle: string, price: string, lineWidth?: number): string;
|
|
10
|
+
}
|
|
11
|
+
declare const PrintToolController: _PrintToolController;
|
|
12
|
+
export default PrintToolController;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import EnumPizzaSide from '../enums/EnumPizzaSide';
|
|
2
|
+
import MoneyController from './MoneyController';
|
|
3
|
+
class _PrintToolController {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.orderItemCountText = (products, catList, onlyListCategory, productList, onlyListProduct) => {
|
|
6
|
+
let list = this.filterProductsByCategoryList(products, catList, onlyListCategory, productList, onlyListProduct);
|
|
7
|
+
return `${MoneyController.sum(list.map(row => row.quantity))} ITEM`;
|
|
8
|
+
};
|
|
9
|
+
this.filterProductsByCategoryList = (products, catList, onlyListCategory, productList, onlyListProduct) => {
|
|
10
|
+
if (!onlyListCategory && !onlyListProduct) {
|
|
11
|
+
return products;
|
|
12
|
+
}
|
|
13
|
+
const new_product = [];
|
|
14
|
+
if (onlyListCategory && !onlyListProduct) {
|
|
15
|
+
products
|
|
16
|
+
.filter(x => catList.find(element => element === x.categoryId))
|
|
17
|
+
.forEach(row => new_product.push(row));
|
|
18
|
+
}
|
|
19
|
+
else if (!onlyListCategory && onlyListProduct) {
|
|
20
|
+
products
|
|
21
|
+
.filter(x => productList.find(element => element === x.productId))
|
|
22
|
+
.forEach(row => new_product.push(row));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const arr = [];
|
|
26
|
+
products
|
|
27
|
+
.filter(x => catList.find(element => element === x.categoryId))
|
|
28
|
+
.forEach(row => arr.push(row));
|
|
29
|
+
arr
|
|
30
|
+
.filter(x => productList.find(element => element === x.productId))
|
|
31
|
+
.forEach(row => {
|
|
32
|
+
new_product.push(row);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return new_product;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
extraItemToText(item, ignoreWholeText = false) {
|
|
39
|
+
let parts = [];
|
|
40
|
+
switch (item.pizzaSide) {
|
|
41
|
+
case EnumPizzaSide.all:
|
|
42
|
+
if (!ignoreWholeText) {
|
|
43
|
+
parts.push('[WHOLE]');
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case EnumPizzaSide.left:
|
|
47
|
+
parts.push('[LEFT]');
|
|
48
|
+
break;
|
|
49
|
+
case EnumPizzaSide.right:
|
|
50
|
+
parts.push('[RIGHT]');
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
if (item.quantity > 1) {
|
|
54
|
+
parts.push(`${item.quantity}x`);
|
|
55
|
+
}
|
|
56
|
+
parts.push(item.extraItemTitle.trim());
|
|
57
|
+
if (item.extraItemOptionId !== null && item.extraItemOptionId !== -1) {
|
|
58
|
+
parts.push(`[${item.extraItemOptionTitle.trim()}] `);
|
|
59
|
+
}
|
|
60
|
+
if (item.totalAmount !== 0) {
|
|
61
|
+
parts.push(`(${MoneyController.format(item.totalAmount, '')})`);
|
|
62
|
+
}
|
|
63
|
+
return parts.join(' ').trim();
|
|
64
|
+
}
|
|
65
|
+
productNote(item) {
|
|
66
|
+
if (item.note && (item.note + '').trim().length > 0) {
|
|
67
|
+
return item.note.trim().split(' ').join(' ');
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
textWithIndent(text, indent = 2, lineWidth = 48) {
|
|
72
|
+
function splitString(str, chunkSize) {
|
|
73
|
+
return Array.from({ length: Math.ceil(str.length / chunkSize) }, (_, i) => str.slice(i * chunkSize, (i + 1) * chunkSize));
|
|
74
|
+
}
|
|
75
|
+
let lineCharLength = lineWidth - indent;
|
|
76
|
+
let parts = splitString(text, lineCharLength);
|
|
77
|
+
const indentStr = ' '.repeat(indent);
|
|
78
|
+
parts = parts.map(i => indentStr + i);
|
|
79
|
+
return parts.join('\n') + '\n';
|
|
80
|
+
}
|
|
81
|
+
createBundleLines(bundleTitle, price, lineWidth = 48) {
|
|
82
|
+
function splitString(str, chunkSize) {
|
|
83
|
+
return Array.from({ length: Math.ceil(str.length / chunkSize) }, (_, i) => str.slice(i * chunkSize, (i + 1) * chunkSize));
|
|
84
|
+
}
|
|
85
|
+
let lineCharLength = lineWidth - (price.length) - 1;
|
|
86
|
+
let parts = splitString(bundleTitle, lineCharLength);
|
|
87
|
+
if (parts.length >= 1) {
|
|
88
|
+
while ((parts[0].length + price.length + 1) < lineWidth) {
|
|
89
|
+
parts[0] = parts[0] + ' ';
|
|
90
|
+
}
|
|
91
|
+
parts[0] = parts[0] + ' ' + price;
|
|
92
|
+
}
|
|
93
|
+
// const indentStr : string = ' '.repeat(indent);
|
|
94
|
+
// parts = parts.map(i=> indentStr + i);
|
|
95
|
+
return parts.join('\n') + '\n';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const PrintToolController = new _PrintToolController();
|
|
99
|
+
export default PrintToolController;
|
|
@@ -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
|
|
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
|
|
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/dist/statics.d.ts
CHANGED
|
@@ -50,3 +50,9 @@ export declare const Formats: {
|
|
|
50
50
|
printedAt: string;
|
|
51
51
|
};
|
|
52
52
|
export declare const printPoweredBy = "Powered by Meemup.com";
|
|
53
|
+
export declare const SeatTagPreName = "Seat #";
|
|
54
|
+
export declare const BundleGroupPreName = "BG #";
|
|
55
|
+
export declare const BundleIdPreName = "BI #";
|
|
56
|
+
export declare const BundleProductQuantityPreName = "BQ #";
|
|
57
|
+
export declare const BundleFeeKey = "BundleProduct";
|
|
58
|
+
export declare const OpenItemText = "Open item";
|
package/dist/statics.js
CHANGED
|
@@ -52,3 +52,9 @@ export const Formats = {
|
|
|
52
52
|
printedAt: 'YYYY-MM-DD HH:mm A',
|
|
53
53
|
};
|
|
54
54
|
export const printPoweredBy = 'Powered by Meemup.com';
|
|
55
|
+
export const SeatTagPreName = 'Seat #';
|
|
56
|
+
export const BundleGroupPreName = 'BG #';
|
|
57
|
+
export const BundleIdPreName = 'BI #';
|
|
58
|
+
export const BundleProductQuantityPreName = 'BQ #';
|
|
59
|
+
export const BundleFeeKey = 'BundleProduct';
|
|
60
|
+
export const OpenItemText = "Open item";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.33",
|
|
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.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.5.33\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|