meemup-library 1.4.49 → 1.4.51
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/PreviewContentController.d.ts +8 -0
- package/dist/controllers/PreviewContentController.js +266 -3
- package/dist/controllers/SimplePreviewController.d.ts +11 -1
- package/dist/controllers/SimplePreviewController.js +99 -36
- package/dist/statics.d.ts +10 -0
- package/dist/statics.js +10 -0
- package/package.json +2 -2
|
@@ -2,6 +2,11 @@ import IAccount from "../interfaces/IAccount";
|
|
|
2
2
|
import IPrintTemplate from "../interfaces/IPrintTemplate";
|
|
3
3
|
import IOrderDetails from "../interfaces/print/IOrderDetails";
|
|
4
4
|
import IOrderDetailProduct from "../interfaces/print/IOrderDetailProduct";
|
|
5
|
+
import ITurnover from "../interfaces/turnover/ITurnover";
|
|
6
|
+
import IPointOfSaleSetting from "../interfaces/pos/IPointOfSaleSetting";
|
|
7
|
+
import IPointOfSalePrintParts from "../interfaces/pos/IPointOfSalePrintParts";
|
|
8
|
+
import IPointOfSaleActionFormCashDrawer from "../interfaces/pos/IPointOfSaleActionFormCashDrawer";
|
|
9
|
+
import IPointOfSaleTeamMember from "../interfaces/pos/IPointOfSaleTeamMember";
|
|
5
10
|
declare const _default: {
|
|
6
11
|
calculatePaperSize: (paper: number, width: string | number) => string;
|
|
7
12
|
sortProduct: (products: IOrderDetailProduct[], sortType: number) => IOrderDetailProduct[];
|
|
@@ -16,5 +21,8 @@ declare const _default: {
|
|
|
16
21
|
packageLabel(detail: IOrderDetails, template: IPrintTemplate): string;
|
|
17
22
|
preview(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
18
23
|
previewForPos(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
24
|
+
createPrintFromTurnoverDetail(data: ITurnover, currency: string, printParts: IPointOfSalePrintParts): Promise<string>;
|
|
25
|
+
createCashDrawerPaidInOutMarkup(device: IPointOfSaleActionFormCashDrawer, setting: IPointOfSaleSetting, member: IPointOfSaleTeamMember): Promise<string>;
|
|
26
|
+
openCashDrawerMarkup(label?: string): Promise<string>;
|
|
19
27
|
};
|
|
20
28
|
export default _default;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import EnumPrintLayout from "../enums/EnumPrintLayout";
|
|
2
11
|
import SimplePreviewController from "./SimplePreviewController";
|
|
3
12
|
import LabelPreviewController from "./LabelPreviewController";
|
|
4
13
|
import EnumOrderSummaryPrintPlacementType from "../enums/EnumOrderSummaryPrintPlacementType";
|
|
14
|
+
import MoneyController from "./MoneyController";
|
|
15
|
+
import DateTimeController from "./DateTimeController";
|
|
16
|
+
import { printPoweredBy } from "../statics";
|
|
17
|
+
import { initPointOfSaleTeamMember } from "../interfaces/pos/IPointOfSaleTeamMember";
|
|
5
18
|
export default new class PreviewContentController {
|
|
6
19
|
constructor() {
|
|
7
20
|
this.calculatePaperSize = (paper, width) => {
|
|
@@ -339,20 +352,30 @@ export default new class PreviewContentController {
|
|
|
339
352
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
340
353
|
<style>
|
|
341
354
|
|
|
342
|
-
|
|
355
|
+
html {
|
|
343
356
|
font-size: 14px;
|
|
344
357
|
}
|
|
345
358
|
|
|
346
359
|
* {
|
|
347
360
|
padding: 0;
|
|
348
361
|
margin: 0;
|
|
349
|
-
background-color: #ffffff;
|
|
350
362
|
}
|
|
351
|
-
|
|
363
|
+
|
|
364
|
+
p,strong {
|
|
365
|
+
line-height: 1.5rem;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
td{
|
|
369
|
+
padding-top: 2px;
|
|
370
|
+
padding-bottom: 2px;
|
|
371
|
+
line-height: 1.6rem;
|
|
372
|
+
}
|
|
373
|
+
|
|
352
374
|
body {
|
|
353
375
|
width : 100%;
|
|
354
376
|
margin: 0;
|
|
355
377
|
padding: 0;
|
|
378
|
+
background-color: #ffffff;
|
|
356
379
|
font-family: -apple-system, BlinkMacSystemFont, 'Arial', "Arial Black", "Comic Sans MS", "Georgia", "Impact", "Lucida Console", "Lucida Sans Unicode", 'Segoe UI', 'Roboto', 'Oxygen',
|
|
357
380
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
358
381
|
sans-serif;
|
|
@@ -367,4 +390,244 @@ export default new class PreviewContentController {
|
|
|
367
390
|
</body>
|
|
368
391
|
</html>`;
|
|
369
392
|
}
|
|
393
|
+
createPrintFromTurnoverDetail(data, currency, printParts) {
|
|
394
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
+
try {
|
|
396
|
+
// const = PrintPartsStorageController.getJson();
|
|
397
|
+
let content = `<div style="font-family : Arial; font-weight : normal; padding : 0;"> `;
|
|
398
|
+
content += SimplePreviewController.createHeader("Turnover");
|
|
399
|
+
content += SimplePreviewController.printSpace(20);
|
|
400
|
+
if (printParts.summaries && Array.isArray(data.summaries)) {
|
|
401
|
+
content += SimplePreviewController.createTitle("Summaries");
|
|
402
|
+
content += SimplePreviewController.printSolidLine();
|
|
403
|
+
data.summaries.map((item) => content += SimplePreviewController.createTextValueSpaceBetween(item.text, item.value));
|
|
404
|
+
if (data.summaries.length === 0) {
|
|
405
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
406
|
+
}
|
|
407
|
+
content += SimplePreviewController.printSpace(10);
|
|
408
|
+
}
|
|
409
|
+
if (printParts.details && Array.isArray(data.details)) {
|
|
410
|
+
content += SimplePreviewController.createTitle("Details");
|
|
411
|
+
content += SimplePreviewController.printSolidLine();
|
|
412
|
+
data.details.map(i => ({
|
|
413
|
+
text: i.title,
|
|
414
|
+
value: i.count + ', ' + MoneyController.format(i.amount, currency),
|
|
415
|
+
}))
|
|
416
|
+
.map((item) => content += SimplePreviewController.createTextValueSpaceBetween(item.text, item.value));
|
|
417
|
+
if (data.details.length === 0) {
|
|
418
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
419
|
+
}
|
|
420
|
+
content += SimplePreviewController.printSpace(10);
|
|
421
|
+
}
|
|
422
|
+
if (printParts.channels && Array.isArray(data.channels)) {
|
|
423
|
+
content += SimplePreviewController.createTitle("Channels");
|
|
424
|
+
content += SimplePreviewController.printSolidLine();
|
|
425
|
+
data.channels.map((value, index) => {
|
|
426
|
+
let channelData = [
|
|
427
|
+
{
|
|
428
|
+
text: ' Orders',
|
|
429
|
+
value: value.count,
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
text: ' Gross sales',
|
|
433
|
+
value: MoneyController.format(value.amount, currency),
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
text: ' Net sales',
|
|
437
|
+
value: MoneyController.format(value.net, currency),
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
text: ' Taxes',
|
|
441
|
+
value: MoneyController.format(value.tax, currency),
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
text: ' Tip',
|
|
445
|
+
value: MoneyController.format(value.tip, currency),
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
text: ' Discount',
|
|
449
|
+
value: MoneyController.format(value.discount, currency),
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
text: ' Delivery fee',
|
|
453
|
+
value: MoneyController.format(value.deliveryFee, currency),
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
text: ' Service fee',
|
|
457
|
+
value: MoneyController.format(value.serviceFee, currency),
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
text: ' Company fee',
|
|
461
|
+
value: MoneyController.format(value.companyFee, currency),
|
|
462
|
+
},
|
|
463
|
+
{ text: ' ', value: '' },
|
|
464
|
+
];
|
|
465
|
+
if (index > 0)
|
|
466
|
+
SimplePreviewController.printSolidLine();
|
|
467
|
+
content += SimplePreviewController.createTitle(value.title);
|
|
468
|
+
channelData.map(i => content += SimplePreviewController.createTextValueSpaceBetween(i.text, i.value + ""));
|
|
469
|
+
content += SimplePreviewController.createTitle(`${value.title} turnover per order types`);
|
|
470
|
+
for (let index = 0; index < value.orderTypes.length; index++) {
|
|
471
|
+
const value1 = value.orderTypes[index];
|
|
472
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value1.title, `${value1.count}, ${MoneyController.format(value1.amount, currency)}`);
|
|
473
|
+
content += SimplePreviewController.createTextValueSpaceBetween("Tip", MoneyController.format(value1.tip, currency));
|
|
474
|
+
content += SimplePreviewController.printDashLine(4);
|
|
475
|
+
}
|
|
476
|
+
content += SimplePreviewController.printDashLine(4);
|
|
477
|
+
content += SimplePreviewController.createTitle(`${value.title} turnover per payment types`);
|
|
478
|
+
for (let index = 0; index < value.paymentTypes.length; index++) {
|
|
479
|
+
const value1 = value.paymentTypes[index];
|
|
480
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value1.title, `${value1.count}, ${MoneyController.format(value1.amount, currency)}`);
|
|
481
|
+
content += SimplePreviewController.createTextValueSpaceBetween("Tip", MoneyController.format(value1.tip, currency));
|
|
482
|
+
content += SimplePreviewController.printDashLine(4);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
content += SimplePreviewController.printDashLine(4);
|
|
486
|
+
if (data.channels.length === 0)
|
|
487
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
488
|
+
content += SimplePreviewController.printSolidLine();
|
|
489
|
+
}
|
|
490
|
+
if (printParts.categories && Array.isArray(data.categories)) {
|
|
491
|
+
content += SimplePreviewController.createTitle("Categories");
|
|
492
|
+
content += SimplePreviewController.printSolidLine();
|
|
493
|
+
for (let index = 0; index < data.categories.length; index++) {
|
|
494
|
+
const value = data.categories[index];
|
|
495
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
496
|
+
for (let j = 0; j < value.channels.length; j++) {
|
|
497
|
+
const i = value.channels[j];
|
|
498
|
+
content += SimplePreviewController.createTextValueSpaceBetween(i.title, `${i.count}, ${MoneyController.format(i.amount, currency)}`);
|
|
499
|
+
}
|
|
500
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total', `${value.count}, ${MoneyController.format(value.amount, currency)}`);
|
|
501
|
+
content += SimplePreviewController.printSpace(20);
|
|
502
|
+
}
|
|
503
|
+
if (data.categories.length === 0) {
|
|
504
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
505
|
+
content += SimplePreviewController.printSpace(20);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (printParts.orderTypes && Array.isArray(data.orderTypes)) {
|
|
509
|
+
content += SimplePreviewController.createTitle("Order types");
|
|
510
|
+
content += SimplePreviewController.printSolidLine();
|
|
511
|
+
for (let index = 0; index < data.orderTypes.length; index++) {
|
|
512
|
+
const value = data.orderTypes[index];
|
|
513
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
514
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
515
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency));
|
|
516
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
517
|
+
content += SimplePreviewController.printSpace(10);
|
|
518
|
+
}
|
|
519
|
+
if (data.orderTypes.length === 0) {
|
|
520
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
521
|
+
content += SimplePreviewController.printSpace(10);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
if (printParts.payments && Array.isArray(data.payments)) {
|
|
525
|
+
content += SimplePreviewController.createTitle("Payment types");
|
|
526
|
+
content += SimplePreviewController.printSolidLine();
|
|
527
|
+
for (let index = 0; index < data.payments.length; index++) {
|
|
528
|
+
const value = data.payments[index];
|
|
529
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
530
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
531
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency));
|
|
532
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
533
|
+
content += SimplePreviewController.printSpace(10);
|
|
534
|
+
}
|
|
535
|
+
if (data.payments.length === 0) {
|
|
536
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
537
|
+
content += SimplePreviewController.printSpace(10);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (printParts.deliveryZones && Array.isArray(data.deliveryZones)) {
|
|
541
|
+
content += SimplePreviewController.createTitle("Delivery zones");
|
|
542
|
+
content += SimplePreviewController.printSolidLine();
|
|
543
|
+
for (let index = 0; index < data.deliveryZones.length; index++) {
|
|
544
|
+
const value = data.deliveryZones[index];
|
|
545
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
546
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
547
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency));
|
|
548
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
549
|
+
content += SimplePreviewController.printSpace(10);
|
|
550
|
+
}
|
|
551
|
+
if (data.deliveryZones.length === 0) {
|
|
552
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
553
|
+
content += SimplePreviewController.printSpace(10);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (printParts.drivers && Array.isArray(data.drivers)) {
|
|
557
|
+
content += SimplePreviewController.createTitle("Drivers");
|
|
558
|
+
content += SimplePreviewController.printSolidLine();
|
|
559
|
+
for (let index = 0; index < data.drivers.length; index++) {
|
|
560
|
+
const value = data.drivers[index];
|
|
561
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Amount', MoneyController.format(value.amount, currency));
|
|
562
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
563
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Distance', MoneyController.format(value.distance, "m"));
|
|
564
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Delivery costs', MoneyController.format(value.deliveryCosts, currency));
|
|
565
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
566
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Cash tip', MoneyController.format(value.cashTip, currency));
|
|
567
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Online tip', MoneyController.format(value.onlineTip, currency));
|
|
568
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Terminal tip', MoneyController.format(value.terminalTip, currency));
|
|
569
|
+
content += SimplePreviewController.printSpace(10);
|
|
570
|
+
}
|
|
571
|
+
if (data.drivers.length === 0) {
|
|
572
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
573
|
+
content += SimplePreviewController.printSpace(10);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (printParts.thirdPartySales && Array.isArray(data.thirdPartySales)) {
|
|
577
|
+
content += SimplePreviewController.createTitle("Third-party sales");
|
|
578
|
+
content += SimplePreviewController.printSolidLine();
|
|
579
|
+
for (let index = 0; index < data.thirdPartySales.length; index++) {
|
|
580
|
+
const value = data.thirdPartySales[index];
|
|
581
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value.title, value.count + ', ' + MoneyController.format(value.amount, currency) + (data.thirdPartySales.length - 1 === index ? '' : '\n'));
|
|
582
|
+
}
|
|
583
|
+
if (data.thirdPartySales.length === 0) {
|
|
584
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
585
|
+
content += SimplePreviewController.printSpace(10);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
content += `</div style="font-size:12px; color:black; text-align:center; ">
|
|
589
|
+
Printed at ${DateTimeController.toDateString(new Date())} ${DateTimeController.formatAMPMDate(new Date())}
|
|
590
|
+
</div>`;
|
|
591
|
+
content += `</div style="font-size:12px; color:black; text-align:center; font-weight:bold; ">
|
|
592
|
+
${printPoweredBy}
|
|
593
|
+
</div>`;
|
|
594
|
+
content += `</div>`;
|
|
595
|
+
return (`<div style="display: flex;"><div style="width : auto;">${content}</div></div>`);
|
|
596
|
+
}
|
|
597
|
+
catch (e) {
|
|
598
|
+
console.log(e);
|
|
599
|
+
}
|
|
600
|
+
return '';
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
createCashDrawerPaidInOutMarkup(device, setting, member) {
|
|
604
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
605
|
+
let content = '';
|
|
606
|
+
try {
|
|
607
|
+
if (device) {
|
|
608
|
+
const title = device.mode === 1 ? 'Paid in' : 'Paid out';
|
|
609
|
+
if (member.id > initPointOfSaleTeamMember.id) {
|
|
610
|
+
content += SimplePreviewController.createSubTitle(`Member ID: #${member.id}`);
|
|
611
|
+
content += SimplePreviewController.createSubTitle(`Member: ${member.firstName} ${member.lastName}`);
|
|
612
|
+
content += SimplePreviewController.printSpace(20);
|
|
613
|
+
}
|
|
614
|
+
content += SimplePreviewController.createText(`${title}: ${MoneyController.format(device.money, setting.currencySymbol)}`, true);
|
|
615
|
+
content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
616
|
+
content += SimplePreviewController.printSolidLine();
|
|
617
|
+
content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
618
|
+
content += SimplePreviewController.footer();
|
|
619
|
+
}
|
|
620
|
+
return content;
|
|
621
|
+
}
|
|
622
|
+
catch (error) {
|
|
623
|
+
console.log(`Error: ${String(error)}`);
|
|
624
|
+
}
|
|
625
|
+
return "";
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
openCashDrawerMarkup() {
|
|
629
|
+
return __awaiter(this, arguments, void 0, function* (label = "") {
|
|
630
|
+
return `<div>${label}</div>`;
|
|
631
|
+
});
|
|
632
|
+
}
|
|
370
633
|
}();
|
|
@@ -24,12 +24,22 @@ 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
|
+
createTextValue(text: string, value: string, textLength: number, template: IPrintTemplate): string;
|
|
35
|
+
createTextValueSpaceBetween(text: string, value: string): string;
|
|
36
|
+
createHeader(text: string): string;
|
|
37
|
+
createTitle(text: string): string;
|
|
38
|
+
createSubTitle(text: string): string;
|
|
39
|
+
createText(text: string, bold?: boolean): string;
|
|
40
|
+
createTextForEmptyList(text?: string): string;
|
|
41
|
+
printSpace(height: number): string;
|
|
42
|
+
footer(): string;
|
|
33
43
|
}
|
|
34
44
|
declare const controller: SimplePreviewController;
|
|
35
45
|
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, printPoweredBy } 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,46 @@ 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
|
+
}
|
|
622
|
+
createTextValueSpaceBetween(text, value) {
|
|
623
|
+
return `<div style="display:flex; flex-direction:row; justify-content:space-between; align-items:flex-start;">
|
|
624
|
+
<div style=" font-size:14px; text-align: left; color: black;">${text}</div>
|
|
625
|
+
<div style=" font-size: 14px; text-align: left; color: black;">${value}</div>
|
|
626
|
+
</div>`;
|
|
627
|
+
}
|
|
628
|
+
createHeader(text) {
|
|
629
|
+
return `<div style=" font-size: 22px; text-align: left; color: black;">${text}</div>`;
|
|
630
|
+
}
|
|
631
|
+
createTitle(text) {
|
|
632
|
+
return `<div style=" font-size: 18px; text-align: left; color: black;">${text}</div>`;
|
|
633
|
+
}
|
|
634
|
+
createSubTitle(text) {
|
|
635
|
+
return `<div style=" font-size: 14px; font-weight:bold; text-align: left; color: black;">${text}</div>`;
|
|
636
|
+
}
|
|
637
|
+
createText(text, bold = false) {
|
|
638
|
+
return `<div style=" font-size: 14px; font-weight:${bold ? "normal" : "bold"}; text-align: left; color: black;">${text}</div>`;
|
|
639
|
+
}
|
|
640
|
+
createTextForEmptyList(text = "There is no data!") {
|
|
641
|
+
return `<i style=" font-size: 14px; text-align: left; color:rgb(49, 49, 49);">${text}</i>`;
|
|
642
|
+
}
|
|
643
|
+
printSpace(height) {
|
|
644
|
+
return `<div style="height : ${height}px;"></div>`;
|
|
645
|
+
}
|
|
646
|
+
footer() {
|
|
647
|
+
return `<div>
|
|
648
|
+
<div style="text-align:center; font-size:12px; font-weight:normal; color:black;">
|
|
649
|
+
Printed at ${moment().format(Formats.printedAt)}
|
|
650
|
+
</div>
|
|
651
|
+
<div style="text-align:center; font-size:12px; font-weight:bold; color:black;">
|
|
652
|
+
${printPoweredBy}
|
|
653
|
+
</div>
|
|
654
|
+
</div>`;
|
|
655
|
+
}
|
|
593
656
|
}
|
|
594
657
|
const controller = new SimplePreviewController();
|
|
595
658
|
export default controller;
|
package/dist/statics.d.ts
CHANGED
|
@@ -40,3 +40,13 @@ 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
|
+
};
|
|
52
|
+
export declare const printPoweredBy = "Powered by Meemup.com";
|
package/dist/statics.js
CHANGED
|
@@ -42,3 +42,13 @@ 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
|
+
};
|
|
54
|
+
export const printPoweredBy = 'Powered by Meemup.com';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.51",
|
|
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.51\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|