meemup-library 1.4.50 → 1.4.52
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 +10 -0
- package/dist/controllers/PreviewContentController.js +314 -0
- package/dist/controllers/SimplePreviewController.d.ts +9 -1
- package/dist/controllers/SimplePreviewController.js +35 -1
- package/dist/statics.d.ts +1 -0
- package/dist/statics.js +1 -0
- package/package.json +2 -2
|
@@ -2,6 +2,12 @@ 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";
|
|
10
|
+
import IPointOfSaleApiClosingWorkDay from "../interfaces/pos/IPointOfSaleApiClosingWorkDay";
|
|
5
11
|
declare const _default: {
|
|
6
12
|
calculatePaperSize: (paper: number, width: string | number) => string;
|
|
7
13
|
sortProduct: (products: IOrderDetailProduct[], sortType: number) => IOrderDetailProduct[];
|
|
@@ -16,5 +22,9 @@ declare const _default: {
|
|
|
16
22
|
packageLabel(detail: IOrderDetails, template: IPrintTemplate): string;
|
|
17
23
|
preview(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
18
24
|
previewForPos(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
25
|
+
createPrintFromTurnoverDetail(data: ITurnover, currency: string, printParts: IPointOfSalePrintParts): Promise<string>;
|
|
26
|
+
createCashDrawerPaidInOutMarkup(device: IPointOfSaleActionFormCashDrawer, setting: IPointOfSaleSetting, member: IPointOfSaleTeamMember): Promise<string>;
|
|
27
|
+
openCashDrawerMarkup(label?: string): Promise<string>;
|
|
28
|
+
createClosingWorkDay(data: IPointOfSaleApiClosingWorkDay, companyTitle: string): Promise<string>;
|
|
19
29
|
};
|
|
20
30
|
export default _default;
|
|
@@ -1,7 +1,21 @@
|
|
|
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";
|
|
18
|
+
import EnumClosingWorkDaySection from "../enums/EnumClosingWorkDaySection";
|
|
5
19
|
export default new class PreviewContentController {
|
|
6
20
|
constructor() {
|
|
7
21
|
this.calculatePaperSize = (paper, width) => {
|
|
@@ -377,4 +391,304 @@ export default new class PreviewContentController {
|
|
|
377
391
|
</body>
|
|
378
392
|
</html>`;
|
|
379
393
|
}
|
|
394
|
+
createPrintFromTurnoverDetail(data, currency, printParts) {
|
|
395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
396
|
+
try {
|
|
397
|
+
// const = PrintPartsStorageController.getJson();
|
|
398
|
+
let content = `<div style="font-family : Arial; font-weight : normal; padding : 0;"> `;
|
|
399
|
+
content += SimplePreviewController.createHeader("Turnover");
|
|
400
|
+
content += SimplePreviewController.printSpace(20);
|
|
401
|
+
if (printParts.summaries && Array.isArray(data.summaries)) {
|
|
402
|
+
content += SimplePreviewController.createTitle("Summaries");
|
|
403
|
+
content += SimplePreviewController.printSolidLine();
|
|
404
|
+
data.summaries.map((item) => content += SimplePreviewController.createTextValueSpaceBetween(item.text, item.value));
|
|
405
|
+
if (data.summaries.length === 0) {
|
|
406
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
407
|
+
}
|
|
408
|
+
content += SimplePreviewController.printSpace(10);
|
|
409
|
+
}
|
|
410
|
+
if (printParts.details && Array.isArray(data.details)) {
|
|
411
|
+
content += SimplePreviewController.createTitle("Details");
|
|
412
|
+
content += SimplePreviewController.printSolidLine();
|
|
413
|
+
data.details.map(i => ({
|
|
414
|
+
text: i.title,
|
|
415
|
+
value: i.count + ', ' + MoneyController.format(i.amount, currency),
|
|
416
|
+
}))
|
|
417
|
+
.map((item) => content += SimplePreviewController.createTextValueSpaceBetween(item.text, item.value));
|
|
418
|
+
if (data.details.length === 0) {
|
|
419
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
420
|
+
}
|
|
421
|
+
content += SimplePreviewController.printSpace(10);
|
|
422
|
+
}
|
|
423
|
+
if (printParts.channels && Array.isArray(data.channels)) {
|
|
424
|
+
content += SimplePreviewController.createTitle("Channels");
|
|
425
|
+
content += SimplePreviewController.printSolidLine();
|
|
426
|
+
data.channels.map((value, index) => {
|
|
427
|
+
let channelData = [
|
|
428
|
+
{
|
|
429
|
+
text: ' Orders',
|
|
430
|
+
value: value.count,
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
text: ' Gross sales',
|
|
434
|
+
value: MoneyController.format(value.amount, currency),
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
text: ' Net sales',
|
|
438
|
+
value: MoneyController.format(value.net, currency),
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
text: ' Taxes',
|
|
442
|
+
value: MoneyController.format(value.tax, currency),
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
text: ' Tip',
|
|
446
|
+
value: MoneyController.format(value.tip, currency),
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
text: ' Discount',
|
|
450
|
+
value: MoneyController.format(value.discount, currency),
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
text: ' Delivery fee',
|
|
454
|
+
value: MoneyController.format(value.deliveryFee, currency),
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
text: ' Service fee',
|
|
458
|
+
value: MoneyController.format(value.serviceFee, currency),
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
text: ' Company fee',
|
|
462
|
+
value: MoneyController.format(value.companyFee, currency),
|
|
463
|
+
},
|
|
464
|
+
{ text: ' ', value: '' },
|
|
465
|
+
];
|
|
466
|
+
if (index > 0)
|
|
467
|
+
SimplePreviewController.printSolidLine();
|
|
468
|
+
content += SimplePreviewController.createTitle(value.title);
|
|
469
|
+
channelData.map(i => content += SimplePreviewController.createTextValueSpaceBetween(i.text, i.value + ""));
|
|
470
|
+
content += SimplePreviewController.createTitle(`${value.title} turnover per order types`);
|
|
471
|
+
for (let index = 0; index < value.orderTypes.length; index++) {
|
|
472
|
+
const value1 = value.orderTypes[index];
|
|
473
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value1.title, `${value1.count}, ${MoneyController.format(value1.amount, currency)}`);
|
|
474
|
+
content += SimplePreviewController.createTextValueSpaceBetween("Tip", MoneyController.format(value1.tip, currency));
|
|
475
|
+
content += SimplePreviewController.printDashLine(4);
|
|
476
|
+
}
|
|
477
|
+
content += SimplePreviewController.printDashLine(4);
|
|
478
|
+
content += SimplePreviewController.createTitle(`${value.title} turnover per payment types`);
|
|
479
|
+
for (let index = 0; index < value.paymentTypes.length; index++) {
|
|
480
|
+
const value1 = value.paymentTypes[index];
|
|
481
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value1.title, `${value1.count}, ${MoneyController.format(value1.amount, currency)}`);
|
|
482
|
+
content += SimplePreviewController.createTextValueSpaceBetween("Tip", MoneyController.format(value1.tip, currency));
|
|
483
|
+
content += SimplePreviewController.printDashLine(4);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
content += SimplePreviewController.printDashLine(4);
|
|
487
|
+
if (data.channels.length === 0)
|
|
488
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
489
|
+
content += SimplePreviewController.printSolidLine();
|
|
490
|
+
}
|
|
491
|
+
if (printParts.categories && Array.isArray(data.categories)) {
|
|
492
|
+
content += SimplePreviewController.createTitle("Categories");
|
|
493
|
+
content += SimplePreviewController.printSolidLine();
|
|
494
|
+
for (let index = 0; index < data.categories.length; index++) {
|
|
495
|
+
const value = data.categories[index];
|
|
496
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
497
|
+
for (let j = 0; j < value.channels.length; j++) {
|
|
498
|
+
const i = value.channels[j];
|
|
499
|
+
content += SimplePreviewController.createTextValueSpaceBetween(i.title, `${i.count}, ${MoneyController.format(i.amount, currency)}`);
|
|
500
|
+
}
|
|
501
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total', `${value.count}, ${MoneyController.format(value.amount, currency)}`);
|
|
502
|
+
content += SimplePreviewController.printSpace(20);
|
|
503
|
+
}
|
|
504
|
+
if (data.categories.length === 0) {
|
|
505
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
506
|
+
content += SimplePreviewController.printSpace(20);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (printParts.orderTypes && Array.isArray(data.orderTypes)) {
|
|
510
|
+
content += SimplePreviewController.createTitle("Order types");
|
|
511
|
+
content += SimplePreviewController.printSolidLine();
|
|
512
|
+
for (let index = 0; index < data.orderTypes.length; index++) {
|
|
513
|
+
const value = data.orderTypes[index];
|
|
514
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
515
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
516
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency));
|
|
517
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
518
|
+
content += SimplePreviewController.printSpace(10);
|
|
519
|
+
}
|
|
520
|
+
if (data.orderTypes.length === 0) {
|
|
521
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
522
|
+
content += SimplePreviewController.printSpace(10);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (printParts.payments && Array.isArray(data.payments)) {
|
|
526
|
+
content += SimplePreviewController.createTitle("Payment types");
|
|
527
|
+
content += SimplePreviewController.printSolidLine();
|
|
528
|
+
for (let index = 0; index < data.payments.length; index++) {
|
|
529
|
+
const value = data.payments[index];
|
|
530
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
531
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
532
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency));
|
|
533
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
534
|
+
content += SimplePreviewController.printSpace(10);
|
|
535
|
+
}
|
|
536
|
+
if (data.payments.length === 0) {
|
|
537
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
538
|
+
content += SimplePreviewController.printSpace(10);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (printParts.deliveryZones && Array.isArray(data.deliveryZones)) {
|
|
542
|
+
content += SimplePreviewController.createTitle("Delivery zones");
|
|
543
|
+
content += SimplePreviewController.printSolidLine();
|
|
544
|
+
for (let index = 0; index < data.deliveryZones.length; index++) {
|
|
545
|
+
const value = data.deliveryZones[index];
|
|
546
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
547
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
548
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency));
|
|
549
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
550
|
+
content += SimplePreviewController.printSpace(10);
|
|
551
|
+
}
|
|
552
|
+
if (data.deliveryZones.length === 0) {
|
|
553
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
554
|
+
content += SimplePreviewController.printSpace(10);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (printParts.drivers && Array.isArray(data.drivers)) {
|
|
558
|
+
content += SimplePreviewController.createTitle("Drivers");
|
|
559
|
+
content += SimplePreviewController.printSolidLine();
|
|
560
|
+
for (let index = 0; index < data.drivers.length; index++) {
|
|
561
|
+
const value = data.drivers[index];
|
|
562
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Amount', MoneyController.format(value.amount, currency));
|
|
563
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "");
|
|
564
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Distance', MoneyController.format(value.distance, "m"));
|
|
565
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Delivery costs', MoneyController.format(value.deliveryCosts, currency));
|
|
566
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency));
|
|
567
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Cash tip', MoneyController.format(value.cashTip, currency));
|
|
568
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Online tip', MoneyController.format(value.onlineTip, currency));
|
|
569
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Terminal tip', MoneyController.format(value.terminalTip, currency));
|
|
570
|
+
content += SimplePreviewController.printSpace(10);
|
|
571
|
+
}
|
|
572
|
+
if (data.drivers.length === 0) {
|
|
573
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
574
|
+
content += SimplePreviewController.printSpace(10);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (printParts.thirdPartySales && Array.isArray(data.thirdPartySales)) {
|
|
578
|
+
content += SimplePreviewController.createTitle("Third-party sales");
|
|
579
|
+
content += SimplePreviewController.printSolidLine();
|
|
580
|
+
for (let index = 0; index < data.thirdPartySales.length; index++) {
|
|
581
|
+
const value = data.thirdPartySales[index];
|
|
582
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value.title, value.count + ', ' + MoneyController.format(value.amount, currency) + (data.thirdPartySales.length - 1 === index ? '' : '\n'));
|
|
583
|
+
}
|
|
584
|
+
if (data.thirdPartySales.length === 0) {
|
|
585
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
586
|
+
content += SimplePreviewController.printSpace(10);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
content += `</div style="font-size:12px; color:black; text-align:center; ">
|
|
590
|
+
Printed at ${DateTimeController.toDateString(new Date())} ${DateTimeController.formatAMPMDate(new Date())}
|
|
591
|
+
</div>`;
|
|
592
|
+
content += `</div style="font-size:12px; color:black; text-align:center; font-weight:bold; ">
|
|
593
|
+
${printPoweredBy}
|
|
594
|
+
</div>`;
|
|
595
|
+
content += `</div>`;
|
|
596
|
+
return (`<div style="display: flex;"><div style="width : auto;">${content}</div></div>`);
|
|
597
|
+
}
|
|
598
|
+
catch (e) {
|
|
599
|
+
console.log(e);
|
|
600
|
+
}
|
|
601
|
+
return '';
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
createCashDrawerPaidInOutMarkup(device, setting, member) {
|
|
605
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
606
|
+
let content = '';
|
|
607
|
+
try {
|
|
608
|
+
if (device) {
|
|
609
|
+
const title = device.mode === 1 ? 'Paid in' : 'Paid out';
|
|
610
|
+
if (member.id > initPointOfSaleTeamMember.id) {
|
|
611
|
+
content += SimplePreviewController.createSubTitle(`Member ID: #${member.id}`);
|
|
612
|
+
content += SimplePreviewController.createSubTitle(`Member: ${member.firstName} ${member.lastName}`);
|
|
613
|
+
content += SimplePreviewController.printSpace(20);
|
|
614
|
+
}
|
|
615
|
+
content += SimplePreviewController.createText(`${title}: ${MoneyController.format(device.money, setting.currencySymbol)}`, 'left', true);
|
|
616
|
+
content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
617
|
+
content += SimplePreviewController.printSolidLine();
|
|
618
|
+
content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
619
|
+
content += SimplePreviewController.footer();
|
|
620
|
+
}
|
|
621
|
+
return content;
|
|
622
|
+
}
|
|
623
|
+
catch (error) {
|
|
624
|
+
console.log(`Error: ${String(error)}`);
|
|
625
|
+
}
|
|
626
|
+
return "";
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
openCashDrawerMarkup() {
|
|
630
|
+
return __awaiter(this, arguments, void 0, function* (label = "") {
|
|
631
|
+
return `<div>${label}</div>`;
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
createClosingWorkDay(data, companyTitle) {
|
|
635
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
636
|
+
let content = "";
|
|
637
|
+
try {
|
|
638
|
+
content += SimplePreviewController.createHeader(data.title, 'center');
|
|
639
|
+
content += SimplePreviewController.createTitle(companyTitle, 'center');
|
|
640
|
+
let infoList = data.details
|
|
641
|
+
.filter(i => i.section === EnumClosingWorkDaySection.INFORMATION)
|
|
642
|
+
.sort((a, b) => a.priority - b.priority);
|
|
643
|
+
let summaryList = data.details
|
|
644
|
+
.filter(i => i.section === EnumClosingWorkDaySection.SUMMARY)
|
|
645
|
+
.sort((a, b) => a.priority - b.priority);
|
|
646
|
+
let detailList = data.details
|
|
647
|
+
.filter(i => i.section === EnumClosingWorkDaySection.DETAILS)
|
|
648
|
+
.sort((a, b) => a.priority - b.priority);
|
|
649
|
+
let paymentMethodList = data.details
|
|
650
|
+
.filter(i => i.section === EnumClosingWorkDaySection.PAYMENT_METHODS)
|
|
651
|
+
.sort((a, b) => a.priority - b.priority);
|
|
652
|
+
let categoryList = data.details
|
|
653
|
+
.filter(i => i.section === EnumClosingWorkDaySection.CATEGORIES)
|
|
654
|
+
.sort((a, b) => a.priority - b.priority);
|
|
655
|
+
if (infoList.length > 0) {
|
|
656
|
+
content += SimplePreviewController.createText(data.description);
|
|
657
|
+
for (let index = 0; index < infoList.length; index++) {
|
|
658
|
+
content += SimplePreviewController.createTextValueSpaceBetween(infoList[index].text, infoList[index].value);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (summaryList.length > 0) {
|
|
662
|
+
content += SimplePreviewController.createTitle("Summaries");
|
|
663
|
+
for (let index = 0; index < summaryList.length; index++) {
|
|
664
|
+
content += SimplePreviewController.createTextValueSpaceBetween(summaryList[index].text, summaryList[index].value);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (detailList.length > 0) {
|
|
668
|
+
content += SimplePreviewController.createTitle("Details");
|
|
669
|
+
for (let index = 0; index < detailList.length; index++) {
|
|
670
|
+
content += SimplePreviewController.createTextValueSpaceBetween(detailList[index].text, detailList[index].value);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if (paymentMethodList.length > 0) {
|
|
674
|
+
content += SimplePreviewController.createTitle("Payments");
|
|
675
|
+
for (let index = 0; index < paymentMethodList.length; index++) {
|
|
676
|
+
content += SimplePreviewController.createTextValueSpaceBetween(paymentMethodList[index].text, paymentMethodList[index].value);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (categoryList.length > 0) {
|
|
680
|
+
content += SimplePreviewController.createTitle("Categories");
|
|
681
|
+
for (let index = 0; index < categoryList.length; index++) {
|
|
682
|
+
content += SimplePreviewController.createTextValueSpaceBetween(categoryList[index].text, categoryList[index].value);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
content += SimplePreviewController.footer();
|
|
686
|
+
return content;
|
|
687
|
+
}
|
|
688
|
+
catch (e) {
|
|
689
|
+
console.log(e);
|
|
690
|
+
}
|
|
691
|
+
return '';
|
|
692
|
+
});
|
|
693
|
+
}
|
|
380
694
|
}();
|
|
@@ -31,7 +31,15 @@ declare class SimplePreviewController {
|
|
|
31
31
|
private filterByCategoryList;
|
|
32
32
|
private sortProduct;
|
|
33
33
|
private pizzaSideText;
|
|
34
|
-
|
|
34
|
+
createTextValue(text: string, value: string, textLength: number, template: IPrintTemplate): string;
|
|
35
|
+
createTextValueSpaceBetween(text: string, value: string): string;
|
|
36
|
+
createHeader(text: string, align?: "left" | "center" | "right"): string;
|
|
37
|
+
createTitle(text: string, align?: "left" | "center" | "right"): string;
|
|
38
|
+
createSubTitle(text: string, align?: "left" | "center" | "right"): string;
|
|
39
|
+
createText(text: string, align?: "left" | "center" | "right", bold?: boolean): string;
|
|
40
|
+
createTextForEmptyList(text?: string): string;
|
|
41
|
+
printSpace(height: number): string;
|
|
42
|
+
footer(): string;
|
|
35
43
|
}
|
|
36
44
|
declare const controller: SimplePreviewController;
|
|
37
45
|
export default controller;
|
|
@@ -8,7 +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
|
+
import { Formats, printPoweredBy } from "../statics";
|
|
12
12
|
class SimplePreviewController {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.filterByCategoryList = (products, catList, onlyListCategory, productList, onlyListProduct) => {
|
|
@@ -619,6 +619,40 @@ class SimplePreviewController {
|
|
|
619
619
|
<div style=" font-size: ${template.fontSize}px; text-align: left; font-family: ${template.font}; color: black;">${value}</div>
|
|
620
620
|
</div>`;
|
|
621
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, align = "left") {
|
|
629
|
+
return `<div style=" font-size: 22px; text-align: ${align}; color: black;">${text}</div>`;
|
|
630
|
+
}
|
|
631
|
+
createTitle(text, align = "left") {
|
|
632
|
+
return `<div style=" font-size: 18px; text-align: ${align}; color: black;">${text}</div>`;
|
|
633
|
+
}
|
|
634
|
+
createSubTitle(text, align = "left") {
|
|
635
|
+
return `<div style=" font-size: 14px; font-weight:bold; text-align: ${align}; color: black;">${text}</div>`;
|
|
636
|
+
}
|
|
637
|
+
createText(text, align = "left", bold = false) {
|
|
638
|
+
return `<div style=" font-size: 14px; font-weight:${bold ? "normal" : "bold"}; text-align: ${align}; 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
|
+
}
|
|
622
656
|
}
|
|
623
657
|
const controller = new SimplePreviewController();
|
|
624
658
|
export default controller;
|
package/dist/statics.d.ts
CHANGED
package/dist/statics.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.52",
|
|
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.52\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|