meemup-library 1.4.51 → 1.4.53

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.
@@ -7,6 +7,10 @@ import IPointOfSaleSetting from "../interfaces/pos/IPointOfSaleSetting";
7
7
  import IPointOfSalePrintParts from "../interfaces/pos/IPointOfSalePrintParts";
8
8
  import IPointOfSaleActionFormCashDrawer from "../interfaces/pos/IPointOfSaleActionFormCashDrawer";
9
9
  import IPointOfSaleTeamMember from "../interfaces/pos/IPointOfSaleTeamMember";
10
+ import IPointOfSaleApiClosingWorkDay from "../interfaces/pos/IPointOfSaleApiClosingWorkDay";
11
+ import IPointOfSaleCashDrawer from "../interfaces/pos/IPointOfSaleCashDrawer";
12
+ import IPointOfSaleCashDrawerReportForm from "../interfaces/pos/IPointOfSaleCashDrawerReportForm";
13
+ import IPointOfSaleCashDrawerReportRecord from "../interfaces/pos/IPointOfSaleCashDrawerReportRecord";
10
14
  declare const _default: {
11
15
  calculatePaperSize: (paper: number, width: string | number) => string;
12
16
  sortProduct: (products: IOrderDetailProduct[], sortType: number) => IOrderDetailProduct[];
@@ -24,5 +28,7 @@ declare const _default: {
24
28
  createPrintFromTurnoverDetail(data: ITurnover, currency: string, printParts: IPointOfSalePrintParts): Promise<string>;
25
29
  createCashDrawerPaidInOutMarkup(device: IPointOfSaleActionFormCashDrawer, setting: IPointOfSaleSetting, member: IPointOfSaleTeamMember): Promise<string>;
26
30
  openCashDrawerMarkup(label?: string): Promise<string>;
31
+ createClosingWorkDay(data: IPointOfSaleApiClosingWorkDay, companyTitle: string): Promise<string>;
32
+ createCashDrawerReport(device: IPointOfSaleCashDrawer, form: IPointOfSaleCashDrawerReportForm, records: IPointOfSaleCashDrawerReportRecord[], company: string, currency: string, member: IPointOfSaleTeamMember, formatDate: (value: string) => string): Promise<string>;
27
33
  };
28
34
  export default _default;
@@ -15,6 +15,7 @@ import MoneyController from "./MoneyController";
15
15
  import DateTimeController from "./DateTimeController";
16
16
  import { printPoweredBy } from "../statics";
17
17
  import { initPointOfSaleTeamMember } from "../interfaces/pos/IPointOfSaleTeamMember";
18
+ import EnumClosingWorkDaySection from "../enums/EnumClosingWorkDaySection";
18
19
  export default new class PreviewContentController {
19
20
  constructor() {
20
21
  this.calculatePaperSize = (paper, width) => {
@@ -611,7 +612,7 @@ export default new class PreviewContentController {
611
612
  content += SimplePreviewController.createSubTitle(`Member: ${member.firstName} ${member.lastName}`);
612
613
  content += SimplePreviewController.printSpace(20);
613
614
  }
614
- content += SimplePreviewController.createText(`${title}: ${MoneyController.format(device.money, setting.currencySymbol)}`, true);
615
+ content += SimplePreviewController.createText(`${title}: ${MoneyController.format(device.money, setting.currencySymbol)}`, 'left', true);
615
616
  content += SimplePreviewController.createText(`Reason: ${device.reason}`);
616
617
  content += SimplePreviewController.printSolidLine();
617
618
  content += SimplePreviewController.createText(`Reason: ${device.reason}`);
@@ -630,4 +631,95 @@ export default new class PreviewContentController {
630
631
  return `<div>${label}</div>`;
631
632
  });
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
+ }
694
+ createCashDrawerReport(device, form, records, company, currency, member, formatDate) {
695
+ return __awaiter(this, void 0, void 0, function* () {
696
+ let content = '';
697
+ try {
698
+ const sum = MoneyController.sumField(records, 'amount');
699
+ content += SimplePreviewController.createHeader('Cash drawer report', 'center');
700
+ content += SimplePreviewController.createText(company, 'center', true);
701
+ content += SimplePreviewController.createTextValueSpaceBetween('Cash drawer:', `#${form.cashDrawerId} - ${device.name}`);
702
+ content += SimplePreviewController.createTextValueSpaceBetween('Since:', `#${form.cashDrawerId} - ${device.name}`);
703
+ content += SimplePreviewController.createTextValueSpaceBetween('Until:', `#${form.cashDrawerId} - ${device.name}`);
704
+ if (member.id > initPointOfSaleTeamMember.id) {
705
+ content += SimplePreviewController.createTextValueSpaceBetween('Member ID:', `#${member.id}`);
706
+ content += SimplePreviewController.createTextValueSpaceBetween('Member:', `${member.firstName} ${member.lastName}`);
707
+ }
708
+ content += SimplePreviewController.printSolidLine();
709
+ records.map(record => {
710
+ //moment(record.dateTime).format(Formats.printedAt)
711
+ content += SimplePreviewController.createTextValueSpaceBetween(formatDate(record.dateTime), MoneyController.format(record.amount, currency));
712
+ content += SimplePreviewController.createText(record.reason);
713
+ content += SimplePreviewController.printSolidLine();
714
+ });
715
+ content += SimplePreviewController.createTextValueSpaceBetween('Total:', MoneyController.format(sum, currency));
716
+ content += SimplePreviewController.footer();
717
+ return content;
718
+ }
719
+ catch (error) {
720
+ console.log(`Error: ${String(error)}`);
721
+ }
722
+ return '';
723
+ });
724
+ }
633
725
  }();
@@ -33,10 +33,10 @@ declare class SimplePreviewController {
33
33
  private pizzaSideText;
34
34
  createTextValue(text: string, value: string, textLength: number, template: IPrintTemplate): string;
35
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;
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
40
  createTextForEmptyList(text?: string): string;
41
41
  printSpace(height: number): string;
42
42
  footer(): string;
@@ -625,17 +625,17 @@ class SimplePreviewController {
625
625
  <div style=" font-size: 14px; text-align: left; color: black;">${value}</div>
626
626
  </div>`;
627
627
  }
628
- createHeader(text) {
629
- return `<div style=" font-size: 22px; text-align: left; color: black;">${text}</div>`;
628
+ createHeader(text, align = "left") {
629
+ return `<div style=" font-size: 22px; text-align: ${align}; color: black;">${text}</div>`;
630
630
  }
631
- createTitle(text) {
632
- return `<div style=" font-size: 18px; text-align: left; color: black;">${text}</div>`;
631
+ createTitle(text, align = "left") {
632
+ return `<div style=" font-size: 18px; text-align: ${align}; color: black;">${text}</div>`;
633
633
  }
634
- createSubTitle(text) {
635
- return `<div style=" font-size: 14px; font-weight:bold; text-align: left; color: black;">${text}</div>`;
634
+ createSubTitle(text, align = "left") {
635
+ return `<div style=" font-size: 14px; font-weight:bold; text-align: ${align}; color: black;">${text}</div>`;
636
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>`;
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
639
  }
640
640
  createTextForEmptyList(text = "There is no data!") {
641
641
  return `<i style=" font-size: 14px; text-align: left; color:rgb(49, 49, 49);">${text}</i>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.4.51",
3
+ "version": "1.4.53",
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.51\" && git push origin "
14
+ "commit": "git add . && git commit -m \"version.1.4.53\" && git push origin "
15
15
  },
16
16
  "files": [
17
17
  "/dist"