meemup-library 1.0.0

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.
Files changed (250) hide show
  1. package/README.md +1 -0
  2. package/lib/cjs/controllers/ApiController.d.ts +19 -0
  3. package/lib/cjs/controllers/ApiController.js +98 -0
  4. package/lib/cjs/controllers/DashboardController.d.ts +20 -0
  5. package/lib/cjs/controllers/DashboardController.js +155 -0
  6. package/lib/cjs/controllers/DateTimeController.d.ts +20 -0
  7. package/lib/cjs/controllers/DateTimeController.js +303 -0
  8. package/lib/cjs/controllers/LogController.d.ts +14 -0
  9. package/lib/cjs/controllers/LogController.js +105 -0
  10. package/lib/cjs/controllers/LogScreenController.d.ts +10 -0
  11. package/lib/cjs/controllers/LogScreenController.js +68 -0
  12. package/lib/cjs/controllers/MoneyController.d.ts +10 -0
  13. package/lib/cjs/controllers/MoneyController.js +42 -0
  14. package/lib/cjs/controllers/OrderScreenController.d.ts +14 -0
  15. package/lib/cjs/controllers/OrderScreenController.js +72 -0
  16. package/lib/cjs/controllers/PhoneController.d.ts +6 -0
  17. package/lib/cjs/controllers/PhoneController.js +37 -0
  18. package/lib/cjs/controllers/PrintContentController.d.ts +25 -0
  19. package/lib/cjs/controllers/PrintContentController.js +515 -0
  20. package/lib/cjs/controllers/ProductModalController.d.ts +36 -0
  21. package/lib/cjs/controllers/ProductModalController.js +445 -0
  22. package/lib/cjs/controllers/ToolController.d.ts +6 -0
  23. package/lib/cjs/controllers/ToolController.js +24 -0
  24. package/lib/cjs/controllers/ZoneController.d.ts +13 -0
  25. package/lib/cjs/controllers/ZoneController.js +24 -0
  26. package/lib/cjs/enums/EnumBasketStep.d.ts +5 -0
  27. package/lib/cjs/enums/EnumBasketStep.js +8 -0
  28. package/lib/cjs/enums/EnumCategoryAvailableIn.d.ts +7 -0
  29. package/lib/cjs/enums/EnumCategoryAvailableIn.js +10 -0
  30. package/lib/cjs/enums/EnumChannels.d.ts +9 -0
  31. package/lib/cjs/enums/EnumChannels.js +12 -0
  32. package/lib/cjs/enums/EnumDashboardSort.d.ts +7 -0
  33. package/lib/cjs/enums/EnumDashboardSort.js +10 -0
  34. package/lib/cjs/enums/EnumDiscountType.d.ts +6 -0
  35. package/lib/cjs/enums/EnumDiscountType.js +9 -0
  36. package/lib/cjs/enums/EnumFeeCalculationMode.d.ts +7 -0
  37. package/lib/cjs/enums/EnumFeeCalculationMode.js +10 -0
  38. package/lib/cjs/enums/EnumFeeType.d.ts +5 -0
  39. package/lib/cjs/enums/EnumFeeType.js +8 -0
  40. package/lib/cjs/enums/EnumGender.d.ts +6 -0
  41. package/lib/cjs/enums/EnumGender.js +9 -0
  42. package/lib/cjs/enums/EnumLogType.d.ts +7 -0
  43. package/lib/cjs/enums/EnumLogType.js +10 -0
  44. package/lib/cjs/enums/EnumNewOrderWarning.d.ts +6 -0
  45. package/lib/cjs/enums/EnumNewOrderWarning.js +9 -0
  46. package/lib/cjs/enums/EnumOpenCashDrawer.d.ts +5 -0
  47. package/lib/cjs/enums/EnumOpenCashDrawer.js +8 -0
  48. package/lib/cjs/enums/EnumOrderScreenTab.d.ts +6 -0
  49. package/lib/cjs/enums/EnumOrderScreenTab.js +9 -0
  50. package/lib/cjs/enums/EnumOrderState.d.ts +12 -0
  51. package/lib/cjs/enums/EnumOrderState.js +15 -0
  52. package/lib/cjs/enums/EnumOrderType.d.ts +6 -0
  53. package/lib/cjs/enums/EnumOrderType.js +9 -0
  54. package/lib/cjs/enums/EnumPaymentState.d.ts +6 -0
  55. package/lib/cjs/enums/EnumPaymentState.js +9 -0
  56. package/lib/cjs/enums/EnumPaymentType.d.ts +12 -0
  57. package/lib/cjs/enums/EnumPaymentType.js +15 -0
  58. package/lib/cjs/enums/EnumPizzaSide.d.ts +7 -0
  59. package/lib/cjs/enums/EnumPizzaSide.js +10 -0
  60. package/lib/cjs/enums/EnumPriceMidpointRounding.d.ts +13 -0
  61. package/lib/cjs/enums/EnumPriceMidpointRounding.js +58 -0
  62. package/lib/cjs/enums/EnumPrintCommand.d.ts +6 -0
  63. package/lib/cjs/enums/EnumPrintCommand.js +9 -0
  64. package/lib/cjs/enums/EnumProductAvailableMode.d.ts +8 -0
  65. package/lib/cjs/enums/EnumProductAvailableMode.js +11 -0
  66. package/lib/cjs/enums/EnumShowOrderMode.d.ts +6 -0
  67. package/lib/cjs/enums/EnumShowOrderMode.js +9 -0
  68. package/lib/cjs/enums/EnumSortMode.d.ts +5 -0
  69. package/lib/cjs/enums/EnumSortMode.js +8 -0
  70. package/lib/cjs/enums/EnumTipType.d.ts +6 -0
  71. package/lib/cjs/enums/EnumTipType.js +9 -0
  72. package/lib/cjs/interfaces/IAccount.d.ts +12 -0
  73. package/lib/cjs/interfaces/IAccount.js +13 -0
  74. package/lib/cjs/interfaces/IAction.d.ts +6 -0
  75. package/lib/cjs/interfaces/IAction.js +2 -0
  76. package/lib/cjs/interfaces/IAllergicStuffs.d.ts +7 -0
  77. package/lib/cjs/interfaces/IAllergicStuffs.js +2 -0
  78. package/lib/cjs/interfaces/IAnswer.d.ts +9 -0
  79. package/lib/cjs/interfaces/IAnswer.js +10 -0
  80. package/lib/cjs/interfaces/IApiAllOrder.d.ts +7 -0
  81. package/lib/cjs/interfaces/IApiAllOrder.js +7 -0
  82. package/lib/cjs/interfaces/IApiEstimatedTimeBody.d.ts +6 -0
  83. package/lib/cjs/interfaces/IApiEstimatedTimeBody.js +2 -0
  84. package/lib/cjs/interfaces/IApiPayOnTerminalBody.d.ts +7 -0
  85. package/lib/cjs/interfaces/IApiPayOnTerminalBody.js +8 -0
  86. package/lib/cjs/interfaces/IApiShop.d.ts +31 -0
  87. package/lib/cjs/interfaces/IApiShop.js +25 -0
  88. package/lib/cjs/interfaces/ICalculateFeeResult.d.ts +6 -0
  89. package/lib/cjs/interfaces/ICalculateFeeResult.js +2 -0
  90. package/lib/cjs/interfaces/ICard.d.ts +9 -0
  91. package/lib/cjs/interfaces/ICard.js +2 -0
  92. package/lib/cjs/interfaces/ICategory.d.ts +31 -0
  93. package/lib/cjs/interfaces/ICategory.js +31 -0
  94. package/lib/cjs/interfaces/ICheckoutOption.d.ts +39 -0
  95. package/lib/cjs/interfaces/ICheckoutOption.js +39 -0
  96. package/lib/cjs/interfaces/ICompanyFee.d.ts +21 -0
  97. package/lib/cjs/interfaces/ICompanyFee.js +2 -0
  98. package/lib/cjs/interfaces/ICompanyInvoiceDetail.d.ts +14 -0
  99. package/lib/cjs/interfaces/ICompanyInvoiceDetail.js +2 -0
  100. package/lib/cjs/interfaces/IConfigTodayReport.d.ts +11 -0
  101. package/lib/cjs/interfaces/IConfigTodayReport.js +12 -0
  102. package/lib/cjs/interfaces/ICustomer.d.ts +12 -0
  103. package/lib/cjs/interfaces/ICustomer.js +16 -0
  104. package/lib/cjs/interfaces/ICustomerAddress.d.ts +17 -0
  105. package/lib/cjs/interfaces/ICustomerAddress.js +2 -0
  106. package/lib/cjs/interfaces/IDailyReportOtherData.d.ts +16 -0
  107. package/lib/cjs/interfaces/IDailyReportOtherData.js +2 -0
  108. package/lib/cjs/interfaces/IDashboardScreenState.d.ts +6 -0
  109. package/lib/cjs/interfaces/IDashboardScreenState.js +13 -0
  110. package/lib/cjs/interfaces/IExtra.d.ts +29 -0
  111. package/lib/cjs/interfaces/IExtra.js +2 -0
  112. package/lib/cjs/interfaces/IExtraItem.d.ts +18 -0
  113. package/lib/cjs/interfaces/IExtraItem.js +19 -0
  114. package/lib/cjs/interfaces/IGeneralInformation.d.ts +33 -0
  115. package/lib/cjs/interfaces/IGeneralInformation.js +46 -0
  116. package/lib/cjs/interfaces/IGeneralItems.d.ts +36 -0
  117. package/lib/cjs/interfaces/IGeneralItems.js +37 -0
  118. package/lib/cjs/interfaces/IKitchenScreenSetting.d.ts +8 -0
  119. package/lib/cjs/interfaces/IKitchenScreenSetting.js +9 -0
  120. package/lib/cjs/interfaces/ILocalSetting.d.ts +18 -0
  121. package/lib/cjs/interfaces/ILocalSetting.js +22 -0
  122. package/lib/cjs/interfaces/ILocation.d.ts +6 -0
  123. package/lib/cjs/interfaces/ILocation.js +7 -0
  124. package/lib/cjs/interfaces/ILog.d.ts +11 -0
  125. package/lib/cjs/interfaces/ILog.js +15 -0
  126. package/lib/cjs/interfaces/ILogin.d.ts +5 -0
  127. package/lib/cjs/interfaces/ILogin.js +2 -0
  128. package/lib/cjs/interfaces/IOnlineOrderItem.d.ts +33 -0
  129. package/lib/cjs/interfaces/IOnlineOrderItem.js +2 -0
  130. package/lib/cjs/interfaces/IOrderDetailOrderItem.d.ts +6 -0
  131. package/lib/cjs/interfaces/IOrderDetailOrderItem.js +2 -0
  132. package/lib/cjs/interfaces/IOrderScreenState.d.ts +11 -0
  133. package/lib/cjs/interfaces/IOrderScreenState.js +15 -0
  134. package/lib/cjs/interfaces/IOrderState.d.ts +6 -0
  135. package/lib/cjs/interfaces/IOrderState.js +2 -0
  136. package/lib/cjs/interfaces/IOrderTypeModal.d.ts +19 -0
  137. package/lib/cjs/interfaces/IOrderTypeModal.js +2 -0
  138. package/lib/cjs/interfaces/IPaymentStatusChanged.d.ts +8 -0
  139. package/lib/cjs/interfaces/IPaymentStatusChanged.js +8 -0
  140. package/lib/cjs/interfaces/IPreviuosOrder.d.ts +30 -0
  141. package/lib/cjs/interfaces/IPreviuosOrder.js +2 -0
  142. package/lib/cjs/interfaces/IPrintTemplate.d.ts +54 -0
  143. package/lib/cjs/interfaces/IPrintTemplate.js +56 -0
  144. package/lib/cjs/interfaces/IPrinterAndPrintCount.d.ts +5 -0
  145. package/lib/cjs/interfaces/IPrinterAndPrintCount.js +2 -0
  146. package/lib/cjs/interfaces/IProduct.d.ts +47 -0
  147. package/lib/cjs/interfaces/IProduct.js +2 -0
  148. package/lib/cjs/interfaces/IProductExtra.d.ts +16 -0
  149. package/lib/cjs/interfaces/IProductExtra.js +2 -0
  150. package/lib/cjs/interfaces/IProductModalState.d.ts +14 -0
  151. package/lib/cjs/interfaces/IProductModalState.js +13 -0
  152. package/lib/cjs/interfaces/ISaveOrder.d.ts +74 -0
  153. package/lib/cjs/interfaces/ISaveOrder.js +2 -0
  154. package/lib/cjs/interfaces/ISearchAddressDetail.d.ts +11 -0
  155. package/lib/cjs/interfaces/ISearchAddressDetail.js +2 -0
  156. package/lib/cjs/interfaces/ISelectedExtraItem.d.ts +7 -0
  157. package/lib/cjs/interfaces/ISelectedExtraItem.js +7 -0
  158. package/lib/cjs/interfaces/ISelectedProductExtra.d.ts +7 -0
  159. package/lib/cjs/interfaces/ISelectedProductExtra.js +7 -0
  160. package/lib/cjs/interfaces/ISetting.d.ts +31 -0
  161. package/lib/cjs/interfaces/ISetting.js +37 -0
  162. package/lib/cjs/interfaces/ISignalOrderChanged.d.ts +5 -0
  163. package/lib/cjs/interfaces/ISignalOrderChanged.js +2 -0
  164. package/lib/cjs/interfaces/ISpecificPayment.d.ts +8 -0
  165. package/lib/cjs/interfaces/ISpecificPayment.js +9 -0
  166. package/lib/cjs/interfaces/IStarMicronicPrintTask.d.ts +11 -0
  167. package/lib/cjs/interfaces/IStarMicronicPrintTask.js +2 -0
  168. package/lib/cjs/interfaces/IStarMicronicPrinter.d.ts +6 -0
  169. package/lib/cjs/interfaces/IStarMicronicPrinter.js +0 -0
  170. package/lib/cjs/interfaces/IStorageControler.d.ts +6 -0
  171. package/lib/cjs/interfaces/IStorageControler.js +2 -0
  172. package/lib/cjs/interfaces/IStore.d.ts +53 -0
  173. package/lib/cjs/interfaces/IStore.js +2 -0
  174. package/lib/cjs/interfaces/ISystem.d.ts +64 -0
  175. package/lib/cjs/interfaces/ISystem.js +61 -0
  176. package/lib/cjs/interfaces/ITask.d.ts +8 -0
  177. package/lib/cjs/interfaces/ITask.js +9 -0
  178. package/lib/cjs/interfaces/ITextValue.d.ts +5 -0
  179. package/lib/cjs/interfaces/ITextValue.js +2 -0
  180. package/lib/cjs/interfaces/ITodayOrderCount.d.ts +5 -0
  181. package/lib/cjs/interfaces/ITodayOrderCount.js +2 -0
  182. package/lib/cjs/interfaces/IUdpPacket.d.ts +7 -0
  183. package/lib/cjs/interfaces/IUdpPacket.js +8 -0
  184. package/lib/cjs/interfaces/IWebMessage.d.ts +5 -0
  185. package/lib/cjs/interfaces/IWebMessage.js +2 -0
  186. package/lib/cjs/interfaces/IWorkScreen.d.ts +10 -0
  187. package/lib/cjs/interfaces/IWorkScreen.js +10 -0
  188. package/lib/cjs/interfaces/IZone.d.ts +13 -0
  189. package/lib/cjs/interfaces/IZone.js +2 -0
  190. package/lib/cjs/interfaces/IZoneCost.d.ts +6 -0
  191. package/lib/cjs/interfaces/IZoneCost.js +2 -0
  192. package/lib/cjs/interfaces/agent/IPrintOrder.d.ts +10 -0
  193. package/lib/cjs/interfaces/agent/IPrintOrder.js +0 -0
  194. package/lib/cjs/interfaces/database/IDExtra.d.ts +14 -0
  195. package/lib/cjs/interfaces/database/IDExtra.js +2 -0
  196. package/lib/cjs/interfaces/database/IDExtraItem.d.ts +17 -0
  197. package/lib/cjs/interfaces/database/IDExtraItem.js +2 -0
  198. package/lib/cjs/interfaces/database/IDProduct.d.ts +48 -0
  199. package/lib/cjs/interfaces/database/IDProduct.js +2 -0
  200. package/lib/cjs/interfaces/database/IDProductDefaultExtra.d.ts +6 -0
  201. package/lib/cjs/interfaces/database/IDProductDefaultExtra.js +2 -0
  202. package/lib/cjs/interfaces/database/IDProductDefaultExtraItem.d.ts +7 -0
  203. package/lib/cjs/interfaces/database/IDProductDefaultExtraItem.js +2 -0
  204. package/lib/cjs/interfaces/database/IDProductExtra.d.ts +12 -0
  205. package/lib/cjs/interfaces/database/IDProductExtra.js +13 -0
  206. package/lib/cjs/interfaces/order/IOrder.d.ts +75 -0
  207. package/lib/cjs/interfaces/order/IOrder.js +88 -0
  208. package/lib/cjs/interfaces/order/IOrderExtraItem.d.ts +14 -0
  209. package/lib/cjs/interfaces/order/IOrderExtraItem.js +2 -0
  210. package/lib/cjs/interfaces/order/IOrderItem.d.ts +22 -0
  211. package/lib/cjs/interfaces/order/IOrderItem.js +2 -0
  212. package/lib/cjs/interfaces/print/IModifiedDetails.d.ts +7 -0
  213. package/lib/cjs/interfaces/print/IModifiedDetails.js +2 -0
  214. package/lib/cjs/interfaces/print/IModifiedDetailsItem.d.ts +6 -0
  215. package/lib/cjs/interfaces/print/IModifiedDetailsItem.js +2 -0
  216. package/lib/cjs/interfaces/print/IOrderDetailCustomer.d.ts +16 -0
  217. package/lib/cjs/interfaces/print/IOrderDetailCustomer.js +17 -0
  218. package/lib/cjs/interfaces/print/IOrderDetailDriver.d.ts +4 -0
  219. package/lib/cjs/interfaces/print/IOrderDetailDriver.js +2 -0
  220. package/lib/cjs/interfaces/print/IOrderDetailOrder.d.ts +50 -0
  221. package/lib/cjs/interfaces/print/IOrderDetailOrder.js +55 -0
  222. package/lib/cjs/interfaces/print/IOrderDetailPaymentInfo.d.ts +7 -0
  223. package/lib/cjs/interfaces/print/IOrderDetailPaymentInfo.js +2 -0
  224. package/lib/cjs/interfaces/print/IOrderDetailProduct.d.ts +17 -0
  225. package/lib/cjs/interfaces/print/IOrderDetailProduct.js +2 -0
  226. package/lib/cjs/interfaces/print/IOrderDetailProductsExtra.d.ts +14 -0
  227. package/lib/cjs/interfaces/print/IOrderDetailProductsExtra.js +2 -0
  228. package/lib/cjs/interfaces/print/IOrderDetails.d.ts +22 -0
  229. package/lib/cjs/interfaces/print/IOrderDetails.js +18 -0
  230. package/lib/cjs/regx/CreditCardRegx.d.ts +2 -0
  231. package/lib/cjs/regx/CreditCardRegx.js +5 -0
  232. package/lib/cjs/regx/DomainRegx.d.ts +2 -0
  233. package/lib/cjs/regx/DomainRegx.js +4 -0
  234. package/lib/cjs/regx/EmailRegx.d.ts +2 -0
  235. package/lib/cjs/regx/EmailRegx.js +4 -0
  236. package/lib/cjs/regx/MoneyRegx.d.ts +2 -0
  237. package/lib/cjs/regx/MoneyRegx.js +4 -0
  238. package/lib/cjs/regx/PhoneRegx.d.ts +2 -0
  239. package/lib/cjs/regx/PhoneRegx.js +5 -0
  240. package/lib/cjs/regx/PostalCodeRegx.d.ts +2 -0
  241. package/lib/cjs/regx/PostalCodeRegx.js +4 -0
  242. package/lib/cjs/statics.d.ts +6 -0
  243. package/lib/cjs/statics.js +11 -0
  244. package/lib/cjs/types/IOrderPayStatus.d.ts +1 -0
  245. package/lib/cjs/types/IOrderPayStatus.js +2 -0
  246. package/lib/cjs/types/TAnswer.d.ts +2 -0
  247. package/lib/cjs/types/TAnswer.js +2 -0
  248. package/lib/cjs/types/TBaseExtra.d.ts +3 -0
  249. package/lib/cjs/types/TBaseExtra.js +2 -0
  250. package/package.json +28 -0
@@ -0,0 +1,515 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const PhoneController_1 = __importDefault(require("./PhoneController"));
7
+ exports.default = new class {
8
+ constructor() {
9
+ this.createAddressText = (customer) => {
10
+ let text = "";
11
+ if (customer === null || customer === undefined)
12
+ return ["", ""];
13
+ if (customer.buzzer !== "") {
14
+ text += `buzzer ${customer.buzzer}, `;
15
+ }
16
+ if (customer.apartment !== "") {
17
+ text += `Apt ${customer.apartment}, `;
18
+ }
19
+ if (customer.houseNo !== "") {
20
+ text += `houseNo: ${customer.houseNo}, `;
21
+ }
22
+ if (customer.address !== "") {
23
+ if (customer.city === "")
24
+ text += `${customer.address} `;
25
+ else {
26
+ const address = customer.address
27
+ .split(customer.city)[0]
28
+ .split(customer.postalCode)[0];
29
+ text += `${address} `;
30
+ text += ` ${customer.city},`;
31
+ }
32
+ }
33
+ if (text === "")
34
+ return null;
35
+ if (text.substring(text.length - 1) === ",") {
36
+ text = text.substring(0, text.length - 1);
37
+ }
38
+ return [text, customer.postalCode];
39
+ };
40
+ this.ccyFormat = (num, pre = "") => {
41
+ return `${pre}${num.toFixed(2)}`;
42
+ };
43
+ this.calculatePaperSize = (paper, width) => {
44
+ switch (paper) {
45
+ case 1:
46
+ return width + "mm";
47
+ case 2:
48
+ return "210mm";
49
+ case 3:
50
+ return "148mm";
51
+ case 4:
52
+ return "105mm";
53
+ default:
54
+ return width + "mm";
55
+ }
56
+ };
57
+ this.sortProduct = (products, sortType) => {
58
+ const new_product = [];
59
+ if (sortType === 1) {
60
+ return products;
61
+ }
62
+ else if (sortType === 2) {
63
+ products.sort((a, b) => {
64
+ let nameA = a.title.toUpperCase(); // ignore upper and lowercase
65
+ let nameB = b.title.toUpperCase(); // ignore upper and lowercase
66
+ if (nameA < nameB) {
67
+ return -1;
68
+ }
69
+ if (nameA > nameB) {
70
+ return 1;
71
+ }
72
+ // names must be equal
73
+ return 0;
74
+ }).forEach((row) => new_product.push(row));
75
+ }
76
+ else if (sortType === 3) {
77
+ products.sort(function (a, b) {
78
+ let nameA = a.title.toUpperCase(); // ignore upper and lowercase
79
+ let nameB = b.title.toUpperCase(); // ignore upper and lowercase
80
+ if (nameA > nameB) {
81
+ return -1;
82
+ }
83
+ if (nameA < nameB) {
84
+ return 1;
85
+ }
86
+ // names must be equal
87
+ return 0;
88
+ }).forEach((row) => new_product.push(row));
89
+ }
90
+ else if (sortType === 4) {
91
+ products.sort((a, b) => a.totalAmount > b.totalAmount ? 1 : -1).forEach((row) => new_product.push(row));
92
+ }
93
+ else if (sortType === 5) {
94
+ products.sort((a, b) => a.totalAmount < b.totalAmount ? 1 : -1).forEach((row) => new_product.push(row));
95
+ }
96
+ return new_product;
97
+ };
98
+ this.filterByCategoryList = (products, catList, onlyListCategory, productList, onlyListProduct) => {
99
+ if (!onlyListCategory && !onlyListProduct) {
100
+ return products;
101
+ }
102
+ const new_product = [];
103
+ if (onlyListCategory && !onlyListProduct) {
104
+ products.filter(x => catList.find(element => element === x.categoryId)).forEach((row) => new_product.push(row));
105
+ }
106
+ else if (!onlyListCategory && onlyListProduct) {
107
+ products.filter(x => productList.find(element => element === x.productId)).forEach((row) => new_product.push(row));
108
+ }
109
+ else {
110
+ const arr = [];
111
+ products.filter(x => catList.find(element => element === x.categoryId)).forEach((row) => arr.push(row));
112
+ arr.filter(x => productList.find(element => element === x.productId)).forEach((row) => {
113
+ new_product.push(row);
114
+ });
115
+ }
116
+ return new_product;
117
+ };
118
+ }
119
+ sum(values) {
120
+ let sum = 0;
121
+ values.forEach(value => sum += value);
122
+ return sum;
123
+ }
124
+ convertTimeStringToDateByT(data = null) {
125
+ if (data instanceof Date) {
126
+ return data;
127
+ }
128
+ else if (typeof data === "string" && data.length > 0) {
129
+ try {
130
+ const time_ = data.split("T");
131
+ const parts = time_[1].split(":");
132
+ let dd = new Date();
133
+ dd.setHours(isNaN(Number(parts[0])) ? 0 : Number(parts[0]));
134
+ dd.setMinutes(isNaN(Number(parts[1])) ? 0 : Number(parts[1]));
135
+ dd.setSeconds(isNaN(Number(parts[2])) ? 0 : Number(parts[2]));
136
+ return dd;
137
+ }
138
+ catch (e) {
139
+ return null;
140
+ }
141
+ }
142
+ else {
143
+ return null;
144
+ }
145
+ }
146
+ formatAMPMDate(date) {
147
+ let datetime = this.convertTimeStringToDateByT(date);
148
+ if (datetime instanceof Date) {
149
+ let hours = datetime.getHours();
150
+ let minutes = datetime.getMinutes();
151
+ let ampm = hours >= 12 ? "PM" : "AM";
152
+ hours = hours % 12;
153
+ hours = hours ? hours : 12;
154
+ minutes = minutes < 10 ? "0" + minutes : minutes;
155
+ return (hours < 10 ? "0" + hours : hours) + ":" + minutes + " " + ampm;
156
+ }
157
+ else {
158
+ return "";
159
+ }
160
+ }
161
+ formatDateTime(dateTime, mode = "full") {
162
+ try {
163
+ let dt = Date.parse(dateTime);
164
+ let time_ = this.formatAMPMDate(dateTime);
165
+ if (mode !== "full") {
166
+ return time_;
167
+ }
168
+ return (new Intl.DateTimeFormat("en-GB", {
169
+ weekday: "short",
170
+ year: "2-digit",
171
+ month: "short",
172
+ day: "2-digit"
173
+ // hour: "2-digit",
174
+ // minute: "2-digit"
175
+ }).format(dt ? dt : Date.now()) +
176
+ " " +
177
+ time_);
178
+ }
179
+ catch (e) {
180
+ return dateTime;
181
+ }
182
+ }
183
+ weekDayName(date) {
184
+ const days = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
185
+ try {
186
+ return days[new Date(date).getDay()];
187
+ }
188
+ catch (e) {
189
+ return days[0];
190
+ }
191
+ }
192
+ formatDate(date) {
193
+ let d = new Date(date), month = "" + (d.getMonth() + 1), day = "" + d.getDate(), year = d.getFullYear();
194
+ if (month.length < 2)
195
+ month = "0" + month;
196
+ if (day.length < 2)
197
+ day = "0" + day;
198
+ return [year, month, day].join("-");
199
+ }
200
+ substring(value, start, end) {
201
+ try {
202
+ if (!value)
203
+ return "";
204
+ return value.substring(start, end);
205
+ }
206
+ catch (e) {
207
+ return "";
208
+ }
209
+ }
210
+ defaultLayout(account, detail, template, symbol = "$") {
211
+ var _a, _b;
212
+ const { rootUrl } = account;
213
+ const { order, company, customer, products, paymentInfo } = detail;
214
+ const { printOnlyCertainCategoriesList, printOnlyCertainCategories, printOnlyCertainProductsList, printOnlyCertainProducts, customerAddressFontSize, showCustomerInfo, orderInfo, showPrices, textAfterAddress, textAfterAddressCenter, nameAddressShow, nameAddressCenter, font, fontSize, marginBottom, marginLeft, marginRight, marginTop, logoAvailable, logoCenter, logoUrl, sortProducts, textBeforeProducts, textBeforeProductsCenter, customerOnlinePaymentAgrementSection, id, promotionCodeNote, promotionId, qrCodeOrderDetails, showCategoryTitle, showProductKitchenName, textEnd, textEndCenter, width, paper } = template;
215
+ const address = this.createAddressText(customer);
216
+ return (`
217
+ <div style="font-family: ${font}; font-weight: 500; font-size: ${fontSize + "px"}; min-width: ${this.calculatePaperSize(paper, width)}; width: ${this.calculatePaperSize(paper, width)}; padding : ${marginTop + "mm"} ${marginRight + "mm"} ${marginBottom + "mm"} ${marginLeft + "mm"};">
218
+ <img alt="" style=" display : ${logoAvailable ? "block" : "none"}; margin : ${logoCenter ? "auto" : "0"}; width: 200px; min-height : 50px;" src="${rootUrl}${company.id}/${logoUrl}" />
219
+ <p style=" margin: 5px 0; line-height: 1; display: ${nameAddressShow ? "block" : "none"}; text-align:${nameAddressCenter ? "center" : "start"};">
220
+ ${company.title}
221
+ </p>
222
+ <p style="margin:5px 0; display:${nameAddressShow ? "block" : "none"}; text-align:${nameAddressCenter ? "center" : "start"};">
223
+ ${company.address}
224
+ </p>
225
+ <p style="margin: 5px 0; line-height: 1; display: ${nameAddressShow ? "block" : "none"}; text-align:${nameAddressCenter ? "center" : "start"};">
226
+ ${PhoneController_1.default.formatPhoneNumber(company.phone)}
227
+ </p>
228
+ <p style="margin: 5px 0; line-height: 1; display: ${textAfterAddress ? "block" : "none"}; text-align:${textAfterAddressCenter ? "center" : "start"};">
229
+ ${textAfterAddress}
230
+ </p>
231
+
232
+ <div style=" display:${order.orderTypeString ? "flex" : "none"}; flex-direction: column; align-items: center; justify-content: center; margin: 8px 0;" >
233
+
234
+ <p style=" font-size: x-large; font-weight: bold; text-align: center;line-height: 0.7; margin: 5px 0;"> #${order.orderNumber}&nbsp;&nbsp;&nbsp;${order.orderTypeString} </p>
235
+
236
+ <strong style="font-size: x-large; text-align: center;">
237
+ &#9201;${order.asSoonAsPossible && "ASAP"}&nbsp;${this.formatDateTime(order.desiredDate, "time")}
238
+ </strong>
239
+
240
+ ${order.estimatedTime ? `<strong style="display:block; font-size:x-large; text-align:center;">Est. Time ${this.substring(order.estimatedTime, 0, order.estimatedTime.length - 3)}</strong>` : ""}
241
+ </div>
242
+
243
+
244
+ <div style="display: ${showPrices ? "block" : "none"}; border-top: 1px solid black;">
245
+ <strong style="display : block; margin: 5px 0; line-height: 1;">PAY INFORMATION: </strong>
246
+ <strong style="font-size: large; margin: 0 0 16px 0; line-height: 1.5;">${order.paymentTypeString + (order.paymentType === 2 ? `: ${this.ccyFormat(order.totalAmount, symbol)} ` : " ") + " - " + order.paymentStateString}</strong>
247
+
248
+ <p style="margin: 5px 0; line-height: 1; display: ${order.paymentType === 1 ? "block" : "none"};">Credit Card : <strong>**** **** **** ${order.lastFourDigits}</strong></p>
249
+
250
+ </div>
251
+
252
+ <p style="display:${orderInfo ? "block" : "none"}; margin: 5px 0; line-height: 1;"> Order number : <strong>#${order.orderNumber}</strong> </p>
253
+ <p style="display:${orderInfo ? "block" : "none"}; margin: 5px 0; line-height: 1;">
254
+ ${order.orderTypeString}:<span style="font-size: x-large;">&#9201;</span><strong>on ${this.formatDateTime(order.desiredDate)}</strong>
255
+ </p>
256
+
257
+ ${order.estimatedTime ? `<p style="display: block; margin: 5px 0; line-height: 1;">Estimated Time : <strong>${(_a = order.estimatedTime) === null || _a === void 0 ? void 0 : _a.substring(0, order.estimatedTime.length - 3)}</strong></p>` : ""}
258
+
259
+ <p style="display:block; margin: 5px 0; line-height: 1;">Reg. Date:<strong>${this.formatDateTime(order.registrationDate)}</strong> </p>
260
+
261
+ <div style="border-top: 1px solid black;">
262
+
263
+ <div style="display:${showCustomerInfo ? "block" : "none"}">
264
+
265
+ <strong style="display:block; margin: 5px 0; line-height: 1;"> CUSTOMER DATA : </strong>
266
+ <p style="display:${customer.fullName ? "block" : "none"}; margin: 5px 0; line-height: 1;">${customer.fullName}</p>
267
+ <p style="display:${customer.phoneNumber ? "block" : "none"}; margin: 5px 0; line-height: 1;">${PhoneController_1.default.formatPhoneNumber(customer.phoneNumber)}</p>
268
+ <p style="display:${address ? "block" : "none"}; font-size: ${customerAddressFontSize + "px"}; margin: 5px 0; line-height: 1;">
269
+ ${address !== null ? address[0] : null}
270
+ <br/>
271
+ ${address !== null ? address[1] : null}
272
+ </p>
273
+ <p style="display:${customer.email ? "block" : "none"}; margin: 5px 0; line-height: 1;">${customer.email}</p>
274
+
275
+ </div>
276
+
277
+ <strong style="display:block; font-size: ${(fontSize * 1.2).toFixed(0) + "px"}; margin: 10px 0; line-height: 1;">
278
+ ${this.sum(this.filterByCategoryList(this.sortProduct(products, sortProducts), printOnlyCertainCategoriesList, printOnlyCertainCategories, printOnlyCertainProductsList, printOnlyCertainProducts).map((row) => row.quantity))} ITEM
279
+ </strong>
280
+
281
+ <p style="display:${textBeforeProducts ? "block" : "none"}; margin: 5px 0; padding-left : 15px; text-align : ${textBeforeProductsCenter ? "center" : "start"}; line-height: 1;"> ${textBeforeProducts} </p>
282
+
283
+ </div>
284
+
285
+ <div style="border-top : 1px solid black;">
286
+
287
+ <div style="padding : 4px 1px; display : flex; flex-direction : row; border-bottom : 1px solid black; font-weight : bold;">
288
+
289
+ <div style="width : 40px; min-width : 40px; max-width : 40px;">#</div>
290
+ <div style="flex-wrap : wrap; word-wrap : break-word;">Products</div>
291
+ <div style="flex-grow : 1; text-align: end;">Price</div>
292
+
293
+ </div>
294
+
295
+
296
+ ${this.filterByCategoryList(this.sortProduct(products, sortProducts), printOnlyCertainCategoriesList, printOnlyCertainCategories, printOnlyCertainProductsList, printOnlyCertainProducts).map((row) => (`<div style="border-bottom : 1px solid black; padding : 0 1px; display : flex; flex-direction : row; justify-content : flex-end;">
297
+
298
+ <div style="width : 40px; min-width : 40px; max-width : 40px">${row.quantity}X</div>
299
+
300
+ <div style="flex-wrap : wrap; word-wrap : break-word; text-align : left;">
301
+
302
+ ${(showCategoryTitle && row.categoryTitle !== "" && row.categoryTitle !== null) ? "[" + row.categoryTitle + "]" : ""} ${showProductKitchenName && row.kitchenReceiptName !== "" ? row.kitchenReceiptName : row.title}
303
+ ${row.extrasNames ? row.extrasNames.split(" , ").map(i => `<div>+${i}</div>`).join("") : ""}
304
+ ${row.note ? `<div><span style="font-size: x-large;">&#128488;</span>{note}</div>` : ""}
305
+
306
+ </div>
307
+
308
+ <div style="flex-grow : 1; text-align : right;">${this.ccyFormat(row.totalAmount, symbol)}</div>
309
+ </div>`)).join("")}
310
+
311
+ <div style="display : ${showPrices ? "flex" : "none"}; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px dotted black;">
312
+ <div style="min-width : 150px; flex-grow : 1; text-align: end;">Order Amount :</div>
313
+ <div style="min-width : 100px; text-align: end;">${this.ccyFormat(order.orderAmount, symbol)}</div>
314
+ </div>
315
+
316
+ <div style="display : ${order.orderType === 1 && order.deliveryCosts > 0 ? "flex" : "none"}; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px dotted black;">
317
+ <div style="min-width : 150px; flex-grow : 1; text-align: end;">Delivery costs : </div>
318
+ <div style="min-width : 100px; text-align: end;">${this.ccyFormat(order.deliveryCosts, symbol)}</div>
319
+ </div>
320
+
321
+ <div style="display : ${order.discountAmount > 0 ? "flex" : "none"}; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px dotted black;">
322
+ <div style="min-width : 150px; flex-grow : 1; text-align: end;">Discount : </div>
323
+ <div style="min-width : 100px; text-align: end;">${(order.discountAmount > 0 ? "- " : "") + this.ccyFormat(order.discountAmount, symbol)}</div>
324
+ </div>
325
+
326
+ <div style="display : flex; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px dotted black;">
327
+ <div style="min-width : 150px; flex-grow : 1; text-align: end;">Subtotal : </div>
328
+ <div style="min-width : 100px; text-align: end;">${this.ccyFormat(order.subtotalAmount, symbol)}</div>
329
+ </div>
330
+
331
+ <div style="display : ${order.hstAmount > 0 && order.serviceFee < 1 ? "flex" : "none"}; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px dotted black;">
332
+ <div style="min-width : 150px; flex-grow : 1; text-align: end;">HST(${this.ccyFormat(order.hstPercentage)}%) : </div>
333
+ <div style="min-width : 100px; text-align: end;">${this.ccyFormat(order.hstAmount, symbol)}</div>
334
+ </div>
335
+
336
+ <div style="display : ${order.tipAmount > 0 ? "flex" : "none"}; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px dotted black;">
337
+ <div style="min-width : 150px; flex-grow : 1; text-align: end;">Tip : </div>
338
+ <div style="min-width : 100px; text-align: end;">${this.ccyFormat(order.tipAmount, symbol)}</div>
339
+ </div>
340
+
341
+ <div style="display : flex; padding : 1px; flex-direction : row; justify-content : flex-end; border-bottom: 1px solid black;">
342
+ <strong style="min-width : 150px; flex-grow : 1; font-size: larger; text-align: end;">${order.paymentType === 1 ? "Total" : "Total & Still to pay"} : </strong>
343
+ <strong style="min-width : 100px; font-size: larger; text-align: end;">${this.ccyFormat(order.totalAmount, symbol)}</strong>
344
+ </div>
345
+
346
+ </div>
347
+
348
+ <div class="border-top : 1px solid black;">
349
+ <div style="margin : 5px 0; line-height: 1;">
350
+ <strong>Remarks customer:</strong>
351
+ <em style="display : ${!order.remarks ? "initial" : "none"}">There are no remarks</em>
352
+ </div>
353
+ <strong style="display : ${order.remarks ? "block" : "none"};">${order.remarks}</strong>
354
+ </div>
355
+
356
+ <div style="display : ${order.paymentType === 1 && customerOnlinePaymentAgrementSection ? "block" : "none"}; border-top : 1px solid black; text-align : center;">
357
+
358
+ <p style="margin : 5px 0; line-height: 1;"><strong>CREDIT CARD : </strong>**** **** **** ${order.lastFourDigits}</p>
359
+
360
+ <strong style="margin : 5px 0; line-height: 1;">
361
+ I agree to pay above total amount according to card issuer agreement
362
+ </strong>
363
+ <br/>
364
+ <br/>
365
+ <strong style="margin : 5px 0; line-height: 1;">SIGNATURE</strong>
366
+ </div>
367
+
368
+ <div style="display : ${promotionId ? "block" : "none"}; border-top : 1px solid black; margin : 5px 0; line-height: 1; text-align : ${textEndCenter ? "center" : "start"}">
369
+ ${promotionCodeNote}
370
+ </div>
371
+
372
+ <div style="margin : 0 16px; display : ${(paymentInfo !== null && order.paymentType === 8 && ((_b = paymentInfo === null || paymentInfo === void 0 ? void 0 : paymentInfo.metadata) === null || _b === void 0 ? void 0 : _b.length) > 0) ? "block" : "none"};">
373
+ ${paymentInfo === null || paymentInfo === void 0 ? void 0 : paymentInfo.metadata.map((item) => (`<div style="display : flex; flex-direction : row; align-items : center; justify-content : flex-start; margin-bottom : 8px;">
374
+ <strong style="margin : 0 16px 0 0; line-height: 1;"> ${item.text} </strong>
375
+ <strong style="margin : 0 16px 0 0; line-height: 1;" > ${item.value}</strong>
376
+ </div>`))}
377
+ </div>
378
+
379
+ <div style="display : ${qrCodeOrderDetails ? "flex" : "none"}; justify-content: center; align-items: center; border-top : 1px solid black; border-bottom : 1px solid black;">
380
+ <img alt="" style="width: 100px; height: 100px; margin: auto;" src="${order.qrCodeDetailUrl}" />
381
+ </div>
382
+
383
+ <p style="display : ${textEnd ? "block" : "none"}; text-align : ${textEndCenter ? "center" : "start"}; line-height: 1; margin-top: 4px;">${textEnd}</p>
384
+
385
+ <strong style="display: block; font-size : x-small; text-align : center; margin-top: 4px; ">fs-${company.id}-${order.id}-${id}</strong>
386
+
387
+
388
+ </div>
389
+ `);
390
+ }
391
+ labelLayout(detail, template) {
392
+ const { products, customer, order } = detail;
393
+ const { orderSummary } = template;
394
+ const { font, fontSize, marginBottom, marginLeft, marginRight, marginTop, showCategoryTitle, showProductKitchenName, width, paper } = template;
395
+ return (`
396
+ <div style="font-family : ${font};font-weight : normal;">
397
+ ${products.map((row) => (`<div>
398
+ <div
399
+ style="
400
+ display: block;
401
+ min-width: ${this.calculatePaperSize(paper, width)};
402
+ width: ${this.calculatePaperSize(paper, width)};
403
+ padding : ${marginTop + "mm"} ${marginRight + "mm"} ${marginBottom + "mm"} ${marginLeft + "mm"};">
404
+
405
+ ${orderSummary ?
406
+ `<p style="font-size:${fontSize - 2};">
407
+ #${order.orderNumber}&nbsp;&nbsp;- &nbsp;&nbsp;
408
+ ${order.orderTypeString}
409
+ </p>` : ""}
410
+
411
+ ${orderSummary ?
412
+ `<p style="font-size:${fontSize - 4};">
413
+ ${this.weekDayName(order.desiredDate)},&nbsp;
414
+ ${this.formatDate(order.desiredDate)}
415
+ &nbsp;&nbsp;&nbsp;
416
+ ${this.formatAMPMDate(order.desiredDate)}
417
+ </p>` : ""}
418
+
419
+ <p style="font-size:${fontSize - 2}; border-bottom : ${orderSummary ? "2px" : "0px"} dotted black; padding-bottom : 5px margin-bottom : 5px;">
420
+ ${customer.fullName}
421
+ </p>
422
+
423
+
424
+ <p style="margin-bottom: 5px; padding-bottom: 5px; border-bottom: 2px solid black;">
425
+ ${row.quantity}X &nbsp;
426
+ ${showCategoryTitle && row.categoryTitle ? "[" + row.categoryTitle.toUpperCase() + "]" : ""}
427
+ ${showProductKitchenName && row.kitchenReceiptName !== "" ? row.kitchenReceiptName : row.title}
428
+ ${row.extrasNames !== "" && `<div>${row.extrasNames}</div>`}
429
+ </p>
430
+
431
+
432
+ ${row.note !== "" ?
433
+ `<p style="margin-bottom: 5px; padding-bottom: 5px; border-bottom: 2px solid black;">
434
+ ${row.note}
435
+ </p>` : ""}
436
+
437
+ </div>
438
+
439
+ <div style="clear: both; page-break-after: always;" ></div>
440
+ </div>
441
+ `)).join("")}
442
+ </div>
443
+
444
+ `);
445
+ }
446
+ paymentFailed(detail, currency) {
447
+ var _a, _b, _c;
448
+ return `<div style="padding-top: 16px; padding-bottom: 16px;">
449
+ <div style="display: flex; flex-direction: row; align-items: center; justify-content: center;">
450
+ <img alt="" src="https://beta.meemup.com/api/shop/logo/${detail.company.id}"
451
+ style="width: 100px; min-width: 100px; max-width: 100px; aspect-ratio: auto;">
452
+ </div>
453
+ <div
454
+ style="display: flex; flex-direction: row; align-items: center; justify-content: space-between; margin-left: 10%; margin-right: 10%; margin-top: 16px; padding-left: 16px; padding-right: 16px;">
455
+ <strong style="font-size: 18px;">AMOUNT</strong>
456
+ <strong style="font-size: 18px;">${currency} ${detail.order.totalAmount}</strong>
457
+ </div>
458
+ <div
459
+ style="display: flex; flex-direction: row; align-items: center; justify-content: center; border-bottom: 2px solid black; margin-left: 10%; margin-right: 10%; padding: 16px;">
460
+ <strong style="font-size: 18px; padding-right: 16px;"></strong>
461
+ <strong style="font-size: 18px;">#0</strong>
462
+ </div>
463
+ <div
464
+ style="display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 16px 10%; border-bottom: 2px solid black;">
465
+ <strong style="font-size: 18px;">${(_a = detail.paymentInfo) === null || _a === void 0 ? void 0 : _a.state}</strong>
466
+ <p style="font-size: 12px; font-weight: bold; margin-top: 8px; padding-bottom: 16px;">${(_b = detail.paymentInfo) === null || _b === void 0 ? void 0 : _b.message}</p>
467
+ </div>
468
+ <div style="margin-left: 16px; margin-right: 16px;">
469
+ ${(_c = detail.paymentInfo) === null || _c === void 0 ? void 0 : _c.metadata.map(i => (`<div style="display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin-bottom: 8px;">
470
+ <strong style="font-size: 12px; margin-right: 16px;">${i.text}</strong>
471
+ <strong style="font-size: 12px;">${i.value}</strong>
472
+ </div>`))}
473
+
474
+ </div>
475
+ </div>`;
476
+ }
477
+ packageLabel(detail) {
478
+ return `<div style="padding: 16px;">
479
+ <div
480
+ style="display: flex; flex-direction: row; align-items: center; justify-content: space-between; border-bottom: 2px solid black;">
481
+ <strong style="font-size: 22px;">${detail.order.orderTypeString}</strong>
482
+ <strong style="font-size: 22px;">${detail.order.orderNumber}</strong>
483
+ </div>
484
+ <div style="border-bottom: 2px solid black; padding-top: 8px; padding-bottom: 8px;">
485
+ ${detail.products.map((i) => (`<strong style="font-size: 16px; padding-top: 2px; padding-bottom: 2px;">${i.quantity}X ${i.title}</strong>`))}
486
+ </div>
487
+ <div
488
+ style="margin-top: 16px; margin-bottom: 16px; padding-bottom: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 2px solid black;">
489
+ <strong style="font-size: 22px;">${detail.order.orderTypeString}</strong>
490
+ <strong style="font-size: 42px;">${detail.order.orderNumber}</strong>
491
+ <strong style="font-size: 16px;">${detail.customer.fullName}</strong>
492
+ </div>
493
+ <div style="display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 16px; margin-left: 10%; margin-right: 10%;">
494
+ <strong style="font-size: 16px;">${detail.order.desiredDate}</strong>
495
+ <div style="display: flex; flex-direction: row; align-items: center; justify-content: center; margin-top: 16px;">
496
+ <img alt="" src="https://beta.meemup.com/api/ordering/${detail.order.id}/${detail.company.id}/QR"
497
+ style="width: 100px; min-width: 100px; max-width: 100px; aspect-ratio: auto;">
498
+ </div>
499
+ </div>
500
+ </div>`;
501
+ }
502
+ preview(account, detail, template, symbol = "$") {
503
+ switch (template.layout) {
504
+ case 2:
505
+ return this.defaultLayout(account, detail, template, symbol);
506
+ case 4:
507
+ const products = this.filterByCategoryList(this.sortProduct(detail.products, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
508
+ if (products.length === 0)
509
+ return `<div>no product </div>`;
510
+ return this.labelLayout(detail, template);
511
+ default:
512
+ return `<div> template.layout : ${template.layout}</div>`;
513
+ }
514
+ }
515
+ }();
@@ -0,0 +1,36 @@
1
+ import EnumOrderType from "../enums/EnumOrderType";
2
+ import IExtra from "../interfaces/IExtra";
3
+ import ISelectedExtraItem from "../interfaces/ISelectedExtraItem";
4
+ import ISelectedProductExtra from "../interfaces/ISelectedProductExtra";
5
+ import ITextValue from "../interfaces/ITextValue";
6
+ import IDExtraItem from "../interfaces/database/IDExtraItem";
7
+ import IDExtra from "../interfaces/database/IDExtra";
8
+ import { TBaseExtra } from "../types/TBaseExtra";
9
+ import IOrderItem from "../interfaces/order/IOrderItem";
10
+ import IDProduct from "../interfaces/database/IDProduct";
11
+ import IProduct from "../interfaces/IProduct";
12
+ import IDProductExtra from "../interfaces/database/IDProductExtra";
13
+ declare const _default: {
14
+ getExtraSelectedItems(list: ISelectedProductExtra[], extraId: number): ISelectedExtraItem[];
15
+ canAddToBasket(product: IDProduct, selected: ISelectedProductExtra[], extras: IDExtra[]): boolean;
16
+ productModalToBasketItem(product: IDProduct, selectedExtraList: ISelectedProductExtra[], extras: IDExtra[], count: number, price: number, note: string): IOrderItem;
17
+ productName(product: IDProduct | IProduct): string;
18
+ productImage(product: IDProduct | IProduct): string;
19
+ productPrice(product: IDProduct | IProduct, orderType: EnumOrderType): number;
20
+ baseItem(list: ISelectedProductExtra[], extraList: IDExtra[]): TBaseExtra;
21
+ defaultExtraOfProductToSelectedExtras(product: IDProduct, extras: IDExtra[]): ISelectedProductExtra[];
22
+ defaultExtraOfProductToBasketItem(product: IDProduct, extras: IDExtra[], orderType: EnumOrderType): IOrderItem;
23
+ singleSelectExtraItemPrice: (extra: IExtra, base: TBaseExtra, item: IDExtraItem) => number;
24
+ multiSelectExtraPrice: (extra: IDExtra, base: TBaseExtra, item: IDExtraItem, selectedList?: ISelectedExtraItem[]) => number;
25
+ multiSelectExtraItemOptions(item: IDExtraItem, max: number, selectedList: ISelectedExtraItem[]): ITextValue[];
26
+ scaleSum(array?: ISelectedExtraItem[]): number;
27
+ calculatePrice(orderType: EnumOrderType, product: any, list: ISelectedProductExtra[], base: TBaseExtra, extraList: IDExtra[]): number;
28
+ plusString(first: string, second: string): string;
29
+ getValidateExtras(extras: IDProductExtra[], extraSelected: ISelectedProductExtra[]): IDProductExtra[];
30
+ getProductExtras(pExtras: IDProductExtra[], sExtras: ISelectedProductExtra[], extras: IDExtra[]): IDExtra[];
31
+ quantitySum(array?: ISelectedExtraItem[]): number;
32
+ productMinAndMaxOptions(product: IDProduct): ITextValue[];
33
+ sortByKey(array: any[], key: string, conditionForSort?: boolean): any[];
34
+ extraItemsSortAction: (a: IDExtraItem, b: IDExtraItem) => 0 | 1 | -1;
35
+ };
36
+ export default _default;