meemup-library 1.4.49 → 1.4.50
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.
|
@@ -339,20 +339,30 @@ export default new class PreviewContentController {
|
|
|
339
339
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
340
340
|
<style>
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
html {
|
|
343
343
|
font-size: 14px;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
* {
|
|
347
347
|
padding: 0;
|
|
348
348
|
margin: 0;
|
|
349
|
-
background-color: #ffffff;
|
|
350
349
|
}
|
|
351
|
-
|
|
350
|
+
|
|
351
|
+
p,strong {
|
|
352
|
+
line-height: 1.5rem;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
td{
|
|
356
|
+
padding-top: 2px;
|
|
357
|
+
padding-bottom: 2px;
|
|
358
|
+
line-height: 1.6rem;
|
|
359
|
+
}
|
|
360
|
+
|
|
352
361
|
body {
|
|
353
362
|
width : 100%;
|
|
354
363
|
margin: 0;
|
|
355
364
|
padding: 0;
|
|
365
|
+
background-color: #ffffff;
|
|
356
366
|
font-family: -apple-system, BlinkMacSystemFont, 'Arial', "Arial Black", "Comic Sans MS", "Georgia", "Impact", "Lucida Console", "Lucida Sans Unicode", 'Segoe UI', 'Roboto', 'Oxygen',
|
|
357
367
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
358
368
|
sans-serif;
|
|
@@ -24,12 +24,14 @@ declare class SimplePreviewController {
|
|
|
24
24
|
printQrCode(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
25
25
|
printTextEnd(template: IPrintTemplate): string;
|
|
26
26
|
printFooter(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
27
|
-
printDashLine(): string;
|
|
27
|
+
printDashLine(my?: number): string;
|
|
28
|
+
printSimpleDashLine(): string;
|
|
28
29
|
printSolidLine(): string;
|
|
29
30
|
private createDivContainer;
|
|
30
31
|
private filterByCategoryList;
|
|
31
32
|
private sortProduct;
|
|
32
33
|
private pizzaSideText;
|
|
34
|
+
private createTextValue;
|
|
33
35
|
}
|
|
34
36
|
declare const controller: SimplePreviewController;
|
|
35
37
|
export default controller;
|
|
@@ -8,6 +8,7 @@ import EnumPizzaSide from "../enums/EnumPizzaSide";
|
|
|
8
8
|
import EnumPaymentState from "../enums/EnumPaymentState";
|
|
9
9
|
import OrderToolController from "./OrderToolController";
|
|
10
10
|
import EnumOrderDateTimePrintModeType from "../enums/EnumOrderDateTimePrintModeType";
|
|
11
|
+
import { Formats } from "../statics";
|
|
11
12
|
class SimplePreviewController {
|
|
12
13
|
constructor() {
|
|
13
14
|
this.filterByCategoryList = (products, catList, onlyListCategory, productList, onlyListProduct) => {
|
|
@@ -49,7 +50,7 @@ class SimplePreviewController {
|
|
|
49
50
|
// let largeFontSize = parseInt((template.fontSize + 10) + "") + "px";
|
|
50
51
|
let largeFontSize = template.printer === 5 ? "22px" : parseInt((template.fontSize + 10) + "") + "px";
|
|
51
52
|
let content = this.createDivContainer(template);
|
|
52
|
-
content += `<div style="display:grid; grid-template-columns: repeat(1 , 1fr);">`;
|
|
53
|
+
content += `<div style="display:grid; grid-template-columns: repeat(1 , 1fr); gap : 8px;">`;
|
|
53
54
|
let summary = `<strong style="font-size: ${largeFontSize}; text-align: center;">#${order.orderNumber} ${order.orderTypeString}</strong>`;
|
|
54
55
|
content += summary;
|
|
55
56
|
if (order.orderType === EnumOrderType.dining && order.tableId !== null) {
|
|
@@ -123,9 +124,11 @@ class SimplePreviewController {
|
|
|
123
124
|
if (!template.showPrices)
|
|
124
125
|
return "";
|
|
125
126
|
let content = this.createDivContainer(template);
|
|
126
|
-
content += this.printDashLine();
|
|
127
|
-
content += `<p style="display : block; font-size: ${template.fontSize}px; text-align: left;">Payment information</p>`;
|
|
128
|
-
content += `<
|
|
127
|
+
// content += this.printDashLine();
|
|
128
|
+
// content += `<p style="display : block; font-size: ${template.fontSize}px; text-align: left;">Payment information</p>`;
|
|
129
|
+
content += `<div style="font-size: ${template.fontSize}px; font-weight: bold; padding: 4px; background-color: black; color: white; text-align: center;">
|
|
130
|
+
${detail.order.paymentTypeString + (detail.order.paymentType === EnumPaymentType.Cash ? `: ${MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol)} ` : " ") + " - " + detail.order.paymentStateString}
|
|
131
|
+
</div>`;
|
|
129
132
|
if (detail.order.paymentType === EnumPaymentType.Online)
|
|
130
133
|
content += `<p style="display:block;">Credit Card: **** **** **** ${detail.order.lastFourDigits}</p>`;
|
|
131
134
|
content += `</div>`;
|
|
@@ -135,13 +138,23 @@ class SimplePreviewController {
|
|
|
135
138
|
var _a;
|
|
136
139
|
if (!template.orderInfo)
|
|
137
140
|
return "";
|
|
138
|
-
let content = this.createDivContainer(template);
|
|
139
|
-
content += this.
|
|
140
|
-
content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Order number: ${detail.order.orderNumber}</p>`;
|
|
141
|
-
content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;"
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
content += `<p style="display:
|
|
141
|
+
let content = this.createDivContainer(template, 8, 8);
|
|
142
|
+
// content += this.printSimpleDashLine();
|
|
143
|
+
// content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Order number: ${detail.order.orderNumber}</p>`;
|
|
144
|
+
// content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">
|
|
145
|
+
// Reference: ${detail.order.via}, #${detail.order.id}
|
|
146
|
+
// </p>`;
|
|
147
|
+
// content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">${detail.order.orderTypeString}: on ${moment(detail.order.desiredDate).format(Formats.displayTime)}</p>`;
|
|
148
|
+
// if (typeof detail.order.estimatedTime === "string" && detail.order.estimatedTime.length > 0)
|
|
149
|
+
// content += `<p style="display: block; font-size: ${template.fontSize}px; text-align:left;">Est. Time:   ${detail.order.estimatedTime?.substring(0, 5)}</p>`;
|
|
150
|
+
content += this.createTextValue('Order number:', detail.order.orderNumber.toString(), 110, template);
|
|
151
|
+
content += this.createTextValue('Reference:', `${detail.order.via}, #${detail.order.id}`, 110, template);
|
|
152
|
+
content += this.createTextValue(`${detail.order.orderTypeString}:`, moment(detail.order.desiredDate).format(Formats.displayDateTime), 110, template);
|
|
153
|
+
if (typeof detail.order.estimatedTime === "string" && detail.order.estimatedTime.length > 0) {
|
|
154
|
+
content += this.createTextValue('Est. Time:', (_a = detail.order.estimatedTime) === null || _a === void 0 ? void 0 : _a.substring(0, 5), 110, template);
|
|
155
|
+
}
|
|
156
|
+
content += this.createTextValue('Reg. Time:', moment(detail.order.registrationDate).format(Formats.displayDateTime), 110, template);
|
|
157
|
+
content += `<!--<p style="display: block; font-size: ${template.fontSize}px; text-align:left;">Reg. Time:   ${moment(detail.order.registrationDate).format(Formats.displayDateTime)}</p>-->`;
|
|
145
158
|
content += `</div>`;
|
|
146
159
|
return content;
|
|
147
160
|
}
|
|
@@ -150,21 +163,19 @@ class SimplePreviewController {
|
|
|
150
163
|
return "";
|
|
151
164
|
if (template.showCustomerInfo === EnumShowCustomer.YES_WHEN_DELIVERY_ORDER && detail.order.orderType !== EnumOrderType.delivery)
|
|
152
165
|
return "";
|
|
153
|
-
let content = this.createDivContainer(template);
|
|
154
|
-
content += this.printDashLine();
|
|
166
|
+
let content = this.createDivContainer(template, 4, 8);
|
|
167
|
+
// content += this.printDashLine(4);
|
|
155
168
|
if (template.printCustomerDetailsInLarge) {
|
|
156
169
|
let largeFontSize = template.printer === 5 ? 22 : parseInt((template.fontSize + 10) + "");
|
|
157
|
-
content +=
|
|
170
|
+
content += `<!--<p style="display : block; font-size: ${largeFontSize}px; text-align: left;">Customer information</p>-->`;
|
|
158
171
|
content += `<strong style="display:block; font-size: ${largeFontSize}px;">${detail.customer.fullName}</strong>`;
|
|
159
172
|
content += `<strong style="display:block; font-size: ${largeFontSize}px;">${PhoneController.toDisplay(detail.customer.phoneNumber)}</strong>`;
|
|
160
|
-
// content += `<p style="display:block; font-size: ${template.fontSize}px;">${detail.customer.email}</p>`;
|
|
161
173
|
content += `<strong style="display:block; font-size: ${largeFontSize}px;">${detail.customer.address}</strong>`;
|
|
162
174
|
}
|
|
163
175
|
else {
|
|
164
|
-
content += `<p style="display : block; font-size: ${template.fontSize}px; text-align: left;">Customer information</p>`;
|
|
176
|
+
// content += `<p style="display : block; font-size: ${template.fontSize}px; text-align: left;">Customer information</p>`;
|
|
165
177
|
content += `<strong style="display:block; font-size: ${template.fontSize}px;">${detail.customer.fullName}</strong>`;
|
|
166
178
|
content += `<strong style="display:block; font-size: ${template.fontSize}px;">${PhoneController.toDisplay(detail.customer.phoneNumber)}</strong>`;
|
|
167
|
-
// content += `<p style="display:block; font-size: ${template.fontSize}px;">${detail.customer.email}</p>`;
|
|
168
179
|
content += `<strong style="display:block; font-size: ${template.fontSize}px;">${detail.customer.address}</strong>`;
|
|
169
180
|
}
|
|
170
181
|
content += `</div>`;
|
|
@@ -174,7 +185,7 @@ class SimplePreviewController {
|
|
|
174
185
|
let list = this.filterByCategoryList(this.sortProduct(detail.products, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
175
186
|
let count = MoneyController.sum(list.map(i => i.quantity));
|
|
176
187
|
let content = this.createDivContainer(template);
|
|
177
|
-
content += `<p style="display: block; font-size: ${template.fontSize + 10}px; text-align: left;">${count} ITEM</p>`;
|
|
188
|
+
content += `<p style="display: block; font-size: ${template.fontSize + 10}px; text-align: left; margin-top : 8px;">${count} ITEM</p>`;
|
|
178
189
|
content += `</div>`;
|
|
179
190
|
return content;
|
|
180
191
|
}
|
|
@@ -194,24 +205,32 @@ class SimplePreviewController {
|
|
|
194
205
|
let content = this.createDivContainer(template);
|
|
195
206
|
content += `<table style="width: 100%; border-collapse: collapse;">
|
|
196
207
|
<thead style="border-bottom: 1px solid #000000;">
|
|
197
|
-
<tr>
|
|
208
|
+
<tr style="height: 28px;">
|
|
198
209
|
<th style="font-size:${template.fontSize}px;min-width:40px; width: 40px; text-align: left; font-weight: bold;">#</th>
|
|
199
|
-
<th style="font-size:${template.fontSize}px;flex: 1; width: 100%; text-align: left; font-weight: bold;">Product</th>
|
|
210
|
+
<th style="font-size:${template.fontSize}px;flex: 1; width: 100%; text-align: left; font-weight: bold; ">Product</th>
|
|
200
211
|
<th style="font-size:${template.fontSize}px;max-width: 90px; text-align: right; font-weight: bold;">Price</th>
|
|
201
212
|
</tr>
|
|
202
213
|
</thead>
|
|
203
214
|
<tbody>
|
|
204
215
|
`;
|
|
205
216
|
detail.products.forEach((row) => {
|
|
206
|
-
let productName = (template.showCategoryTitle ? `[${row.categoryTitle}] ` : "") + ((template.showProductKitchenName && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.
|
|
217
|
+
let productName = (template.showCategoryTitle ? `[${row.categoryTitle}] ` : "") + ((template.showProductKitchenName && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.productName);
|
|
207
218
|
let amount = template.showPrices ? MoneyController.format(row.totalAmount, detail.company.currencySymbol) : "";
|
|
208
|
-
content += `<tr>
|
|
219
|
+
content += `<tr style="height: 28px;">
|
|
209
220
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;">${row.quantity}X</td>
|
|
210
221
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left; font-weight: bold;">${productName}</td>
|
|
211
222
|
<td style="font-size:${template.fontSize}px; max-width: 90px; text-align: right;">${amount}</td>
|
|
212
223
|
</tr>`;
|
|
213
224
|
row.extras.forEach(element => {
|
|
214
|
-
let extraText = this.pizzaSideText(element.pizzaSide) + element.quantity + "X " + element.extraItemTitle;
|
|
225
|
+
// let extraText = this.pizzaSideText(element.pizzaSide) + element.quantity + "X " + element.extraItemTitle;
|
|
226
|
+
let side = this.pizzaSideText(element.pizzaSide);
|
|
227
|
+
let extraText = "";
|
|
228
|
+
if (side !== "")
|
|
229
|
+
extraText += side;
|
|
230
|
+
if (element.quantity > 1)
|
|
231
|
+
extraText += element.quantity + "x ";
|
|
232
|
+
extraText += element.extraItemTitle;
|
|
233
|
+
extraText = extraText.trim();
|
|
215
234
|
let extraAmount = template.showPrices ? MoneyController.format(element.totalAmount, detail.company.currencySymbol) : "";
|
|
216
235
|
content += `<tr>
|
|
217
236
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
@@ -229,7 +248,7 @@ class SimplePreviewController {
|
|
|
229
248
|
});
|
|
230
249
|
if (template.showPrices) {
|
|
231
250
|
//order amount
|
|
232
|
-
content += `<tr style=" border-top: 1px dashed #000000;
|
|
251
|
+
content += `<tr style=" border-top: 1px dashed #000000; padding: 4px 0;">
|
|
233
252
|
<td style="font-size:${template.fontSize}px; width: 40px; text-align: left;"></td>
|
|
234
253
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
235
254
|
Order Amount:
|
|
@@ -299,15 +318,15 @@ class SimplePreviewController {
|
|
|
299
318
|
}
|
|
300
319
|
content += `</tbody></table>`;
|
|
301
320
|
//total amount
|
|
302
|
-
content += `<div style="display: flex; flex-direction: row; align-items: center;
|
|
303
|
-
<div style="font-size:${template.fontSize + 6}px; flex: 1; text-align: right; padding-right: 8px;">
|
|
304
|
-
${detail.order.paymentState !== EnumPaymentState.Paid ? "Total &
|
|
321
|
+
content += `<div style="display: flex; flex-direction: row; align-items: center; background-color: black; padding: 4px;">
|
|
322
|
+
<div style="font-size:${template.fontSize + 6}px; flex: 1; text-align: right; padding-right: 8px; background-color: transparent; color: white;">
|
|
323
|
+
${detail.order.paymentState !== EnumPaymentState.Paid ? "Total & NOT PAID" : "Total"}:
|
|
305
324
|
</div>
|
|
306
|
-
<div style="font-size:${(template.fontSize + 10) + "px"}; width: 90px; text-align: right;">
|
|
325
|
+
<div style="font-size:${(template.fontSize + 10) + "px"}; width: 90px; text-align: right; background-color: transparent; color: white;">
|
|
307
326
|
${MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol)}
|
|
308
327
|
</div>
|
|
309
328
|
</div>`;
|
|
310
|
-
content += this.printSolidLine();
|
|
329
|
+
// content += this.printSolidLine();
|
|
311
330
|
content += `</div>`;
|
|
312
331
|
return content;
|
|
313
332
|
}
|
|
@@ -520,21 +539,25 @@ class SimplePreviewController {
|
|
|
520
539
|
return content;
|
|
521
540
|
}
|
|
522
541
|
printFooter(template, detail) {
|
|
542
|
+
const fs = template.fontSize - 4 <= 0 ? template.fontSize : template.fontSize - 4;
|
|
523
543
|
let content = this.createDivContainer(template);
|
|
524
|
-
content += `<p style="display: block; font-size: ${
|
|
525
|
-
content += `<p style="display: block; font-size: ${
|
|
526
|
-
content += `<strong style="display: block; font-size: ${
|
|
544
|
+
content += `<p style="display: block; font-size: ${fs}px; text-align: center; line-height: 1rem; margin-top: 8px;">FS.${detail.company.id}.${detail.order.id}.${template.id}</p>`;
|
|
545
|
+
content += `<p style="display: block; font-size: ${fs}px; text-align: center; line-height: 1rem;">Printed on ${new Date().toDateString()} ${new Date().toTimeString().substring(0, 8)}</p>`;
|
|
546
|
+
content += `<strong style="display: block; font-size: ${fs}px; text-align: center; line-height: 1rem;">Powered by Meemup.com</strong>`;
|
|
527
547
|
content += `</div>`;
|
|
528
548
|
return content;
|
|
529
549
|
}
|
|
530
|
-
printDashLine() {
|
|
531
|
-
return `<div style="display: block; border-top: 1px dashed #000000; margin:
|
|
550
|
+
printDashLine(my = 4) {
|
|
551
|
+
return `<div style="display: block; border-top: 1px dashed #000000; margin: ${my}px 0;"></div>`;
|
|
552
|
+
}
|
|
553
|
+
printSimpleDashLine() {
|
|
554
|
+
return `<div style="display: block; border-top: 1px solid #000000; margin:0;"></div>`;
|
|
532
555
|
}
|
|
533
556
|
printSolidLine() {
|
|
534
557
|
return `<div style="display: block; border-top: 1px solid #000000; margin: 4px 0;"></div>`;
|
|
535
558
|
}
|
|
536
|
-
createDivContainer(template) {
|
|
537
|
-
return `<div style="display: block; padding-left: ${template.paddingLeft}mm; padding-right: ${template.paddingRight}mm;" >`;
|
|
559
|
+
createDivContainer(template, pt = 0, pb = 0) {
|
|
560
|
+
return `<div style="display: block; padding-left: ${template.paddingLeft}mm; padding-right: ${template.paddingRight}mm; padding-top: ${pt + "px"}; padding-bottom: ${pb + "px"};" >`;
|
|
538
561
|
}
|
|
539
562
|
sortProduct(products, sortType) {
|
|
540
563
|
const new_product = [];
|
|
@@ -590,6 +613,12 @@ class SimplePreviewController {
|
|
|
590
613
|
return "";
|
|
591
614
|
}
|
|
592
615
|
}
|
|
616
|
+
createTextValue(text, value, textLength, template) {
|
|
617
|
+
return `<div style="display: grid; grid-template-columns: ${textLength}px auto;">
|
|
618
|
+
<div style=" font-size: ${template.fontSize}px; text-align: left; font-family: ${template.font}; color: black;">${text}</div>
|
|
619
|
+
<div style=" font-size: ${template.fontSize}px; text-align: left; font-family: ${template.font}; color: black;">${value}</div>
|
|
620
|
+
</div>`;
|
|
621
|
+
}
|
|
593
622
|
}
|
|
594
623
|
const controller = new SimplePreviewController();
|
|
595
624
|
export default controller;
|
package/dist/statics.d.ts
CHANGED
|
@@ -40,3 +40,12 @@ export declare const FIND_STAR_MICRONIC_PRINTER_TIMEOUT_POST_NAME = " Sec";
|
|
|
40
40
|
export declare const DASHBOARD_ITEM_MINIMUM_WITH = 300;
|
|
41
41
|
export declare const TOKEN_REFRESH_AFTER_THIS_AMOUNT_OF_MINUTE = 60;
|
|
42
42
|
export declare const SIGNALR_AUTO_RECONNECT_TIMES_ARRAY: number[];
|
|
43
|
+
export declare const Formats: {
|
|
44
|
+
date: string;
|
|
45
|
+
time: string;
|
|
46
|
+
displayTime: string;
|
|
47
|
+
displayDate: string;
|
|
48
|
+
displayDateTime: string;
|
|
49
|
+
standard: string;
|
|
50
|
+
printedAt: string;
|
|
51
|
+
};
|
package/dist/statics.js
CHANGED
|
@@ -42,3 +42,12 @@ export const FIND_STAR_MICRONIC_PRINTER_TIMEOUT_POST_NAME = " Sec";
|
|
|
42
42
|
export const DASHBOARD_ITEM_MINIMUM_WITH = 300;
|
|
43
43
|
export const TOKEN_REFRESH_AFTER_THIS_AMOUNT_OF_MINUTE = 60;
|
|
44
44
|
export const SIGNALR_AUTO_RECONNECT_TIMES_ARRAY = [180000, 240000, 300000, 360000, 420000];
|
|
45
|
+
export const Formats = {
|
|
46
|
+
date: 'YYYY-MM-DD',
|
|
47
|
+
time: 'HH:mm:ss',
|
|
48
|
+
displayTime: 'hh:mm A',
|
|
49
|
+
displayDate: 'ddd, DD MMM',
|
|
50
|
+
displayDateTime: 'ddd, DD MMM, hh:mm A',
|
|
51
|
+
standard: 'YYYY-MM-DDTHH:mm:ss',
|
|
52
|
+
printedAt: 'YYYY-MM-DD HH:mm A',
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.50",
|
|
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.4.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.4.50\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|