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.
- package/README.md +1 -0
- package/lib/cjs/controllers/ApiController.d.ts +19 -0
- package/lib/cjs/controllers/ApiController.js +98 -0
- package/lib/cjs/controllers/DashboardController.d.ts +20 -0
- package/lib/cjs/controllers/DashboardController.js +155 -0
- package/lib/cjs/controllers/DateTimeController.d.ts +20 -0
- package/lib/cjs/controllers/DateTimeController.js +303 -0
- package/lib/cjs/controllers/LogController.d.ts +14 -0
- package/lib/cjs/controllers/LogController.js +105 -0
- package/lib/cjs/controllers/LogScreenController.d.ts +10 -0
- package/lib/cjs/controllers/LogScreenController.js +68 -0
- package/lib/cjs/controllers/MoneyController.d.ts +10 -0
- package/lib/cjs/controllers/MoneyController.js +42 -0
- package/lib/cjs/controllers/OrderScreenController.d.ts +14 -0
- package/lib/cjs/controllers/OrderScreenController.js +72 -0
- package/lib/cjs/controllers/PhoneController.d.ts +6 -0
- package/lib/cjs/controllers/PhoneController.js +37 -0
- package/lib/cjs/controllers/PrintContentController.d.ts +25 -0
- package/lib/cjs/controllers/PrintContentController.js +515 -0
- package/lib/cjs/controllers/ProductModalController.d.ts +36 -0
- package/lib/cjs/controllers/ProductModalController.js +445 -0
- package/lib/cjs/controllers/ToolController.d.ts +6 -0
- package/lib/cjs/controllers/ToolController.js +24 -0
- package/lib/cjs/controllers/ZoneController.d.ts +13 -0
- package/lib/cjs/controllers/ZoneController.js +24 -0
- package/lib/cjs/enums/EnumBasketStep.d.ts +5 -0
- package/lib/cjs/enums/EnumBasketStep.js +8 -0
- package/lib/cjs/enums/EnumCategoryAvailableIn.d.ts +7 -0
- package/lib/cjs/enums/EnumCategoryAvailableIn.js +10 -0
- package/lib/cjs/enums/EnumChannels.d.ts +9 -0
- package/lib/cjs/enums/EnumChannels.js +12 -0
- package/lib/cjs/enums/EnumDashboardSort.d.ts +7 -0
- package/lib/cjs/enums/EnumDashboardSort.js +10 -0
- package/lib/cjs/enums/EnumDiscountType.d.ts +6 -0
- package/lib/cjs/enums/EnumDiscountType.js +9 -0
- package/lib/cjs/enums/EnumFeeCalculationMode.d.ts +7 -0
- package/lib/cjs/enums/EnumFeeCalculationMode.js +10 -0
- package/lib/cjs/enums/EnumFeeType.d.ts +5 -0
- package/lib/cjs/enums/EnumFeeType.js +8 -0
- package/lib/cjs/enums/EnumGender.d.ts +6 -0
- package/lib/cjs/enums/EnumGender.js +9 -0
- package/lib/cjs/enums/EnumLogType.d.ts +7 -0
- package/lib/cjs/enums/EnumLogType.js +10 -0
- package/lib/cjs/enums/EnumNewOrderWarning.d.ts +6 -0
- package/lib/cjs/enums/EnumNewOrderWarning.js +9 -0
- package/lib/cjs/enums/EnumOpenCashDrawer.d.ts +5 -0
- package/lib/cjs/enums/EnumOpenCashDrawer.js +8 -0
- package/lib/cjs/enums/EnumOrderScreenTab.d.ts +6 -0
- package/lib/cjs/enums/EnumOrderScreenTab.js +9 -0
- package/lib/cjs/enums/EnumOrderState.d.ts +12 -0
- package/lib/cjs/enums/EnumOrderState.js +15 -0
- package/lib/cjs/enums/EnumOrderType.d.ts +6 -0
- package/lib/cjs/enums/EnumOrderType.js +9 -0
- package/lib/cjs/enums/EnumPaymentState.d.ts +6 -0
- package/lib/cjs/enums/EnumPaymentState.js +9 -0
- package/lib/cjs/enums/EnumPaymentType.d.ts +12 -0
- package/lib/cjs/enums/EnumPaymentType.js +15 -0
- package/lib/cjs/enums/EnumPizzaSide.d.ts +7 -0
- package/lib/cjs/enums/EnumPizzaSide.js +10 -0
- package/lib/cjs/enums/EnumPriceMidpointRounding.d.ts +13 -0
- package/lib/cjs/enums/EnumPriceMidpointRounding.js +58 -0
- package/lib/cjs/enums/EnumPrintCommand.d.ts +6 -0
- package/lib/cjs/enums/EnumPrintCommand.js +9 -0
- package/lib/cjs/enums/EnumProductAvailableMode.d.ts +8 -0
- package/lib/cjs/enums/EnumProductAvailableMode.js +11 -0
- package/lib/cjs/enums/EnumShowOrderMode.d.ts +6 -0
- package/lib/cjs/enums/EnumShowOrderMode.js +9 -0
- package/lib/cjs/enums/EnumSortMode.d.ts +5 -0
- package/lib/cjs/enums/EnumSortMode.js +8 -0
- package/lib/cjs/enums/EnumTipType.d.ts +6 -0
- package/lib/cjs/enums/EnumTipType.js +9 -0
- package/lib/cjs/interfaces/IAccount.d.ts +12 -0
- package/lib/cjs/interfaces/IAccount.js +13 -0
- package/lib/cjs/interfaces/IAction.d.ts +6 -0
- package/lib/cjs/interfaces/IAction.js +2 -0
- package/lib/cjs/interfaces/IAllergicStuffs.d.ts +7 -0
- package/lib/cjs/interfaces/IAllergicStuffs.js +2 -0
- package/lib/cjs/interfaces/IAnswer.d.ts +9 -0
- package/lib/cjs/interfaces/IAnswer.js +10 -0
- package/lib/cjs/interfaces/IApiAllOrder.d.ts +7 -0
- package/lib/cjs/interfaces/IApiAllOrder.js +7 -0
- package/lib/cjs/interfaces/IApiEstimatedTimeBody.d.ts +6 -0
- package/lib/cjs/interfaces/IApiEstimatedTimeBody.js +2 -0
- package/lib/cjs/interfaces/IApiPayOnTerminalBody.d.ts +7 -0
- package/lib/cjs/interfaces/IApiPayOnTerminalBody.js +8 -0
- package/lib/cjs/interfaces/IApiShop.d.ts +31 -0
- package/lib/cjs/interfaces/IApiShop.js +25 -0
- package/lib/cjs/interfaces/ICalculateFeeResult.d.ts +6 -0
- package/lib/cjs/interfaces/ICalculateFeeResult.js +2 -0
- package/lib/cjs/interfaces/ICard.d.ts +9 -0
- package/lib/cjs/interfaces/ICard.js +2 -0
- package/lib/cjs/interfaces/ICategory.d.ts +31 -0
- package/lib/cjs/interfaces/ICategory.js +31 -0
- package/lib/cjs/interfaces/ICheckoutOption.d.ts +39 -0
- package/lib/cjs/interfaces/ICheckoutOption.js +39 -0
- package/lib/cjs/interfaces/ICompanyFee.d.ts +21 -0
- package/lib/cjs/interfaces/ICompanyFee.js +2 -0
- package/lib/cjs/interfaces/ICompanyInvoiceDetail.d.ts +14 -0
- package/lib/cjs/interfaces/ICompanyInvoiceDetail.js +2 -0
- package/lib/cjs/interfaces/IConfigTodayReport.d.ts +11 -0
- package/lib/cjs/interfaces/IConfigTodayReport.js +12 -0
- package/lib/cjs/interfaces/ICustomer.d.ts +12 -0
- package/lib/cjs/interfaces/ICustomer.js +16 -0
- package/lib/cjs/interfaces/ICustomerAddress.d.ts +17 -0
- package/lib/cjs/interfaces/ICustomerAddress.js +2 -0
- package/lib/cjs/interfaces/IDailyReportOtherData.d.ts +16 -0
- package/lib/cjs/interfaces/IDailyReportOtherData.js +2 -0
- package/lib/cjs/interfaces/IDashboardScreenState.d.ts +6 -0
- package/lib/cjs/interfaces/IDashboardScreenState.js +13 -0
- package/lib/cjs/interfaces/IExtra.d.ts +29 -0
- package/lib/cjs/interfaces/IExtra.js +2 -0
- package/lib/cjs/interfaces/IExtraItem.d.ts +18 -0
- package/lib/cjs/interfaces/IExtraItem.js +19 -0
- package/lib/cjs/interfaces/IGeneralInformation.d.ts +33 -0
- package/lib/cjs/interfaces/IGeneralInformation.js +46 -0
- package/lib/cjs/interfaces/IGeneralItems.d.ts +36 -0
- package/lib/cjs/interfaces/IGeneralItems.js +37 -0
- package/lib/cjs/interfaces/IKitchenScreenSetting.d.ts +8 -0
- package/lib/cjs/interfaces/IKitchenScreenSetting.js +9 -0
- package/lib/cjs/interfaces/ILocalSetting.d.ts +18 -0
- package/lib/cjs/interfaces/ILocalSetting.js +22 -0
- package/lib/cjs/interfaces/ILocation.d.ts +6 -0
- package/lib/cjs/interfaces/ILocation.js +7 -0
- package/lib/cjs/interfaces/ILog.d.ts +11 -0
- package/lib/cjs/interfaces/ILog.js +15 -0
- package/lib/cjs/interfaces/ILogin.d.ts +5 -0
- package/lib/cjs/interfaces/ILogin.js +2 -0
- package/lib/cjs/interfaces/IOnlineOrderItem.d.ts +33 -0
- package/lib/cjs/interfaces/IOnlineOrderItem.js +2 -0
- package/lib/cjs/interfaces/IOrderDetailOrderItem.d.ts +6 -0
- package/lib/cjs/interfaces/IOrderDetailOrderItem.js +2 -0
- package/lib/cjs/interfaces/IOrderScreenState.d.ts +11 -0
- package/lib/cjs/interfaces/IOrderScreenState.js +15 -0
- package/lib/cjs/interfaces/IOrderState.d.ts +6 -0
- package/lib/cjs/interfaces/IOrderState.js +2 -0
- package/lib/cjs/interfaces/IOrderTypeModal.d.ts +19 -0
- package/lib/cjs/interfaces/IOrderTypeModal.js +2 -0
- package/lib/cjs/interfaces/IPaymentStatusChanged.d.ts +8 -0
- package/lib/cjs/interfaces/IPaymentStatusChanged.js +8 -0
- package/lib/cjs/interfaces/IPreviuosOrder.d.ts +30 -0
- package/lib/cjs/interfaces/IPreviuosOrder.js +2 -0
- package/lib/cjs/interfaces/IPrintTemplate.d.ts +54 -0
- package/lib/cjs/interfaces/IPrintTemplate.js +56 -0
- package/lib/cjs/interfaces/IPrinterAndPrintCount.d.ts +5 -0
- package/lib/cjs/interfaces/IPrinterAndPrintCount.js +2 -0
- package/lib/cjs/interfaces/IProduct.d.ts +47 -0
- package/lib/cjs/interfaces/IProduct.js +2 -0
- package/lib/cjs/interfaces/IProductExtra.d.ts +16 -0
- package/lib/cjs/interfaces/IProductExtra.js +2 -0
- package/lib/cjs/interfaces/IProductModalState.d.ts +14 -0
- package/lib/cjs/interfaces/IProductModalState.js +13 -0
- package/lib/cjs/interfaces/ISaveOrder.d.ts +74 -0
- package/lib/cjs/interfaces/ISaveOrder.js +2 -0
- package/lib/cjs/interfaces/ISearchAddressDetail.d.ts +11 -0
- package/lib/cjs/interfaces/ISearchAddressDetail.js +2 -0
- package/lib/cjs/interfaces/ISelectedExtraItem.d.ts +7 -0
- package/lib/cjs/interfaces/ISelectedExtraItem.js +7 -0
- package/lib/cjs/interfaces/ISelectedProductExtra.d.ts +7 -0
- package/lib/cjs/interfaces/ISelectedProductExtra.js +7 -0
- package/lib/cjs/interfaces/ISetting.d.ts +31 -0
- package/lib/cjs/interfaces/ISetting.js +37 -0
- package/lib/cjs/interfaces/ISignalOrderChanged.d.ts +5 -0
- package/lib/cjs/interfaces/ISignalOrderChanged.js +2 -0
- package/lib/cjs/interfaces/ISpecificPayment.d.ts +8 -0
- package/lib/cjs/interfaces/ISpecificPayment.js +9 -0
- package/lib/cjs/interfaces/IStarMicronicPrintTask.d.ts +11 -0
- package/lib/cjs/interfaces/IStarMicronicPrintTask.js +2 -0
- package/lib/cjs/interfaces/IStarMicronicPrinter.d.ts +6 -0
- package/lib/cjs/interfaces/IStarMicronicPrinter.js +0 -0
- package/lib/cjs/interfaces/IStorageControler.d.ts +6 -0
- package/lib/cjs/interfaces/IStorageControler.js +2 -0
- package/lib/cjs/interfaces/IStore.d.ts +53 -0
- package/lib/cjs/interfaces/IStore.js +2 -0
- package/lib/cjs/interfaces/ISystem.d.ts +64 -0
- package/lib/cjs/interfaces/ISystem.js +61 -0
- package/lib/cjs/interfaces/ITask.d.ts +8 -0
- package/lib/cjs/interfaces/ITask.js +9 -0
- package/lib/cjs/interfaces/ITextValue.d.ts +5 -0
- package/lib/cjs/interfaces/ITextValue.js +2 -0
- package/lib/cjs/interfaces/ITodayOrderCount.d.ts +5 -0
- package/lib/cjs/interfaces/ITodayOrderCount.js +2 -0
- package/lib/cjs/interfaces/IUdpPacket.d.ts +7 -0
- package/lib/cjs/interfaces/IUdpPacket.js +8 -0
- package/lib/cjs/interfaces/IWebMessage.d.ts +5 -0
- package/lib/cjs/interfaces/IWebMessage.js +2 -0
- package/lib/cjs/interfaces/IWorkScreen.d.ts +10 -0
- package/lib/cjs/interfaces/IWorkScreen.js +10 -0
- package/lib/cjs/interfaces/IZone.d.ts +13 -0
- package/lib/cjs/interfaces/IZone.js +2 -0
- package/lib/cjs/interfaces/IZoneCost.d.ts +6 -0
- package/lib/cjs/interfaces/IZoneCost.js +2 -0
- package/lib/cjs/interfaces/agent/IPrintOrder.d.ts +10 -0
- package/lib/cjs/interfaces/agent/IPrintOrder.js +0 -0
- package/lib/cjs/interfaces/database/IDExtra.d.ts +14 -0
- package/lib/cjs/interfaces/database/IDExtra.js +2 -0
- package/lib/cjs/interfaces/database/IDExtraItem.d.ts +17 -0
- package/lib/cjs/interfaces/database/IDExtraItem.js +2 -0
- package/lib/cjs/interfaces/database/IDProduct.d.ts +48 -0
- package/lib/cjs/interfaces/database/IDProduct.js +2 -0
- package/lib/cjs/interfaces/database/IDProductDefaultExtra.d.ts +6 -0
- package/lib/cjs/interfaces/database/IDProductDefaultExtra.js +2 -0
- package/lib/cjs/interfaces/database/IDProductDefaultExtraItem.d.ts +7 -0
- package/lib/cjs/interfaces/database/IDProductDefaultExtraItem.js +2 -0
- package/lib/cjs/interfaces/database/IDProductExtra.d.ts +12 -0
- package/lib/cjs/interfaces/database/IDProductExtra.js +13 -0
- package/lib/cjs/interfaces/order/IOrder.d.ts +75 -0
- package/lib/cjs/interfaces/order/IOrder.js +88 -0
- package/lib/cjs/interfaces/order/IOrderExtraItem.d.ts +14 -0
- package/lib/cjs/interfaces/order/IOrderExtraItem.js +2 -0
- package/lib/cjs/interfaces/order/IOrderItem.d.ts +22 -0
- package/lib/cjs/interfaces/order/IOrderItem.js +2 -0
- package/lib/cjs/interfaces/print/IModifiedDetails.d.ts +7 -0
- package/lib/cjs/interfaces/print/IModifiedDetails.js +2 -0
- package/lib/cjs/interfaces/print/IModifiedDetailsItem.d.ts +6 -0
- package/lib/cjs/interfaces/print/IModifiedDetailsItem.js +2 -0
- package/lib/cjs/interfaces/print/IOrderDetailCustomer.d.ts +16 -0
- package/lib/cjs/interfaces/print/IOrderDetailCustomer.js +17 -0
- package/lib/cjs/interfaces/print/IOrderDetailDriver.d.ts +4 -0
- package/lib/cjs/interfaces/print/IOrderDetailDriver.js +2 -0
- package/lib/cjs/interfaces/print/IOrderDetailOrder.d.ts +50 -0
- package/lib/cjs/interfaces/print/IOrderDetailOrder.js +55 -0
- package/lib/cjs/interfaces/print/IOrderDetailPaymentInfo.d.ts +7 -0
- package/lib/cjs/interfaces/print/IOrderDetailPaymentInfo.js +2 -0
- package/lib/cjs/interfaces/print/IOrderDetailProduct.d.ts +17 -0
- package/lib/cjs/interfaces/print/IOrderDetailProduct.js +2 -0
- package/lib/cjs/interfaces/print/IOrderDetailProductsExtra.d.ts +14 -0
- package/lib/cjs/interfaces/print/IOrderDetailProductsExtra.js +2 -0
- package/lib/cjs/interfaces/print/IOrderDetails.d.ts +22 -0
- package/lib/cjs/interfaces/print/IOrderDetails.js +18 -0
- package/lib/cjs/regx/CreditCardRegx.d.ts +2 -0
- package/lib/cjs/regx/CreditCardRegx.js +5 -0
- package/lib/cjs/regx/DomainRegx.d.ts +2 -0
- package/lib/cjs/regx/DomainRegx.js +4 -0
- package/lib/cjs/regx/EmailRegx.d.ts +2 -0
- package/lib/cjs/regx/EmailRegx.js +4 -0
- package/lib/cjs/regx/MoneyRegx.d.ts +2 -0
- package/lib/cjs/regx/MoneyRegx.js +4 -0
- package/lib/cjs/regx/PhoneRegx.d.ts +2 -0
- package/lib/cjs/regx/PhoneRegx.js +5 -0
- package/lib/cjs/regx/PostalCodeRegx.d.ts +2 -0
- package/lib/cjs/regx/PostalCodeRegx.js +4 -0
- package/lib/cjs/statics.d.ts +6 -0
- package/lib/cjs/statics.js +11 -0
- package/lib/cjs/types/IOrderPayStatus.d.ts +1 -0
- package/lib/cjs/types/IOrderPayStatus.js +2 -0
- package/lib/cjs/types/TAnswer.d.ts +2 -0
- package/lib/cjs/types/TAnswer.js +2 -0
- package/lib/cjs/types/TBaseExtra.d.ts +3 -0
- package/lib/cjs/types/TBaseExtra.js +2 -0
- package/package.json +28 -0
|
@@ -0,0 +1,105 @@
|
|
|
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 EnumLogType_1 = __importDefault(require("../enums/EnumLogType"));
|
|
7
|
+
const DateTimeController_1 = __importDefault(require("./DateTimeController"));
|
|
8
|
+
const statics_1 = require("../statics");
|
|
9
|
+
class LogController {
|
|
10
|
+
constructor(pre_label, storageController, state) {
|
|
11
|
+
this.active = false;
|
|
12
|
+
this.label = "";
|
|
13
|
+
this.active = state;
|
|
14
|
+
this.label = pre_label;
|
|
15
|
+
this.storage = storageController;
|
|
16
|
+
}
|
|
17
|
+
console(data) {
|
|
18
|
+
if (this.active)
|
|
19
|
+
console.log(data);
|
|
20
|
+
}
|
|
21
|
+
description(title, description = null) {
|
|
22
|
+
if (!this.active)
|
|
23
|
+
return;
|
|
24
|
+
let log = {
|
|
25
|
+
partition: this.label,
|
|
26
|
+
title: title,
|
|
27
|
+
data: this.createLogDescription(description),
|
|
28
|
+
showDetail: false,
|
|
29
|
+
date: new Date(),
|
|
30
|
+
type: EnumLogType_1.default.description
|
|
31
|
+
};
|
|
32
|
+
this._log(log);
|
|
33
|
+
}
|
|
34
|
+
error(title, description = null) {
|
|
35
|
+
if (!this.active)
|
|
36
|
+
return;
|
|
37
|
+
let log = {
|
|
38
|
+
partition: this.label,
|
|
39
|
+
title: title,
|
|
40
|
+
data: this.createLogDescription(description),
|
|
41
|
+
showDetail: false,
|
|
42
|
+
date: new Date(),
|
|
43
|
+
type: EnumLogType_1.default.error
|
|
44
|
+
};
|
|
45
|
+
this._log(log);
|
|
46
|
+
}
|
|
47
|
+
info(title, description = null) {
|
|
48
|
+
if (!this.active)
|
|
49
|
+
return;
|
|
50
|
+
let log = {
|
|
51
|
+
partition: this.label,
|
|
52
|
+
title: title,
|
|
53
|
+
data: this.createLogDescription(description),
|
|
54
|
+
showDetail: false,
|
|
55
|
+
date: new Date(),
|
|
56
|
+
type: EnumLogType_1.default.info
|
|
57
|
+
};
|
|
58
|
+
this._log(log);
|
|
59
|
+
}
|
|
60
|
+
log(title, description = null) {
|
|
61
|
+
if (!this.active)
|
|
62
|
+
return;
|
|
63
|
+
let log = {
|
|
64
|
+
partition: this.label,
|
|
65
|
+
title: title,
|
|
66
|
+
data: this.createLogDescription(description),
|
|
67
|
+
showDetail: false,
|
|
68
|
+
date: new Date(),
|
|
69
|
+
type: EnumLogType_1.default.info
|
|
70
|
+
};
|
|
71
|
+
this._log(log);
|
|
72
|
+
}
|
|
73
|
+
createLogDescription(description) {
|
|
74
|
+
switch (typeof description) {
|
|
75
|
+
case "boolean":
|
|
76
|
+
return description ? "true" : "false";
|
|
77
|
+
case "bigint":
|
|
78
|
+
return description + "";
|
|
79
|
+
case "number":
|
|
80
|
+
return description + "";
|
|
81
|
+
case "object":
|
|
82
|
+
return JSON.stringify(description, null, 4);
|
|
83
|
+
case "string":
|
|
84
|
+
return description;
|
|
85
|
+
case "undefined":
|
|
86
|
+
return "undefined";
|
|
87
|
+
case "function":
|
|
88
|
+
return "Content is a function!";
|
|
89
|
+
case "symbol":
|
|
90
|
+
return "content is a symbol";
|
|
91
|
+
default:
|
|
92
|
+
return "";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
_log(item) {
|
|
96
|
+
let value = this.storage.keys();
|
|
97
|
+
let logKeys = value.filter((i) => i.startsWith(statics_1.STORAGE_PRE_LOG_NAME)).sort((a, b) => a > b ? -1 : 1);
|
|
98
|
+
while (logKeys.length > 100) {
|
|
99
|
+
this.storage.remove(logKeys[0]);
|
|
100
|
+
logKeys.shift();
|
|
101
|
+
}
|
|
102
|
+
this.storage.setKeyValue(`${statics_1.STORAGE_PRE_LOG_NAME}${DateTimeController_1.default.dateToNumber(item.date)}`, item);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.default = LogController;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import EnumLogType from "../enums/EnumLogType";
|
|
2
|
+
import ILog from "../interfaces/ILog";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
filterModeText(mode: EnumLogType): string;
|
|
5
|
+
getIcon(type: EnumLogType): "info" | "warning" | "assignment" | undefined;
|
|
6
|
+
getIconColor(type: EnumLogType): "info.300" | "danger.500" | "light.500" | "text.500";
|
|
7
|
+
filter(logs: ILog[], filterMode: EnumLogType): ILog[];
|
|
8
|
+
count(logs: ILog[], filterMode: EnumLogType): number;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 EnumLogType_1 = __importDefault(require("../enums/EnumLogType"));
|
|
7
|
+
exports.default = new class LogScreenController {
|
|
8
|
+
filterModeText(mode) {
|
|
9
|
+
switch (mode) {
|
|
10
|
+
case EnumLogType_1.default.all:
|
|
11
|
+
return "Logs";
|
|
12
|
+
case EnumLogType_1.default.description:
|
|
13
|
+
return "Description";
|
|
14
|
+
case EnumLogType_1.default.error:
|
|
15
|
+
return "Error";
|
|
16
|
+
case EnumLogType_1.default.info:
|
|
17
|
+
return "Information";
|
|
18
|
+
default:
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getIcon(type) {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case EnumLogType_1.default.info:
|
|
25
|
+
return "info";
|
|
26
|
+
case EnumLogType_1.default.error:
|
|
27
|
+
return "warning";
|
|
28
|
+
case EnumLogType_1.default.description:
|
|
29
|
+
return "assignment";
|
|
30
|
+
default:
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
getIconColor(type) {
|
|
35
|
+
switch (type) {
|
|
36
|
+
case EnumLogType_1.default.info:
|
|
37
|
+
return "info.300";
|
|
38
|
+
case EnumLogType_1.default.error:
|
|
39
|
+
return "danger.500";
|
|
40
|
+
case EnumLogType_1.default.description:
|
|
41
|
+
return "light.500";
|
|
42
|
+
default:
|
|
43
|
+
return "text.500";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// getDataBgColor(type: EnumLogType) {
|
|
47
|
+
// switch (type) {
|
|
48
|
+
// case EnumLogType.info:
|
|
49
|
+
// return "lightBlue.100";
|
|
50
|
+
// case EnumLogType.error:
|
|
51
|
+
// return "red.100";
|
|
52
|
+
// case EnumLogType.description:
|
|
53
|
+
// return "light.100";
|
|
54
|
+
// default:
|
|
55
|
+
// return ThemeConfigs.isDark ? "light.700" : "light.300";
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
filter(logs, filterMode) {
|
|
59
|
+
if (filterMode === EnumLogType_1.default.all)
|
|
60
|
+
return logs;
|
|
61
|
+
return logs.filter(i => i.type === filterMode);
|
|
62
|
+
}
|
|
63
|
+
count(logs, filterMode) {
|
|
64
|
+
if (filterMode === EnumLogType_1.default.all)
|
|
65
|
+
return logs.length;
|
|
66
|
+
return logs.filter(i => i.type === filterMode).length;
|
|
67
|
+
}
|
|
68
|
+
}();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare class MoneyController {
|
|
2
|
+
private dollarUSLocale;
|
|
3
|
+
constructor();
|
|
4
|
+
round: (money: number | string) => number;
|
|
5
|
+
format(money: number | string, currency?: string, preText?: string): string;
|
|
6
|
+
sum(values: Array<number>): number;
|
|
7
|
+
sumAndFormat(values: number[], currency?: string, preText?: string): string;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: MoneyController;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class MoneyController {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.dollarUSLocale = null;
|
|
6
|
+
this.round = (money) => {
|
|
7
|
+
try {
|
|
8
|
+
let decimalPlaces = 2;
|
|
9
|
+
// let parts = (money + "").split(".");
|
|
10
|
+
// if (parts.length === 2 && parts[1].length === 2) {
|
|
11
|
+
// decimalPlaces = 1;
|
|
12
|
+
// }
|
|
13
|
+
let num = +(money + "");
|
|
14
|
+
let d = decimalPlaces || 0;
|
|
15
|
+
let m = Math.pow(10, d);
|
|
16
|
+
let n = +(d ? num * m : num).toFixed(8); // Avoid rounding errors
|
|
17
|
+
let i = Math.floor(n), f = n - i;
|
|
18
|
+
let e = 1e-8; // Allow for rounding errors in f
|
|
19
|
+
let r = (f > 0.5 - e && f < 0.5 + e) ?
|
|
20
|
+
((i % 2 == 0) ? i : i + 1) : Math.round(n);
|
|
21
|
+
return d ? r / m : r;
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return +(money + "");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.dollarUSLocale = Intl.NumberFormat("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
28
|
+
}
|
|
29
|
+
format(money, currency = "$", preText = "") {
|
|
30
|
+
return `${preText}${currency}${this.dollarUSLocale.format(money)}`;
|
|
31
|
+
}
|
|
32
|
+
sum(values) {
|
|
33
|
+
let sum = 0;
|
|
34
|
+
values.forEach(value => sum += value);
|
|
35
|
+
return sum;
|
|
36
|
+
}
|
|
37
|
+
sumAndFormat(values, currency = "$", preText = "") {
|
|
38
|
+
return this.format(this.sum(values), currency, preText);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
;
|
|
42
|
+
exports.default = new MoneyController();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import IOrderScreenState from "../interfaces/IOrderScreenState";
|
|
2
|
+
import EnumOrderType from "../enums/EnumOrderType";
|
|
3
|
+
import IOrderItem from "../interfaces/order/IOrderItem";
|
|
4
|
+
import IDProduct from "../interfaces/database/IDProduct";
|
|
5
|
+
import ICategory from "../interfaces/ICategory";
|
|
6
|
+
declare const _default: {
|
|
7
|
+
checkDayWeek: (index: number, weekDays: number) => boolean;
|
|
8
|
+
fetchCategories(categories: ICategory[]): ICategory[];
|
|
9
|
+
fetchProducts(arg: IOrderScreenState, products: IDProduct[], categories: ICategory[]): IDProduct[];
|
|
10
|
+
searchProduct(products: IDProduct[], word: string): IDProduct[];
|
|
11
|
+
productPrice(product: IDProduct, orderType: EnumOrderType): number;
|
|
12
|
+
productCountInOrder(product: IDProduct, items: IOrderItem[]): number;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
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 EnumOrderType_1 = __importDefault(require("../enums/EnumOrderType"));
|
|
7
|
+
const EnumCategoryAvailableIn_1 = __importDefault(require("../enums/EnumCategoryAvailableIn"));
|
|
8
|
+
exports.default = new class OrderScreenController {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.checkDayWeek = (index, weekDays) => {
|
|
11
|
+
let val = 0;
|
|
12
|
+
while (val < weekDays)
|
|
13
|
+
val += 1;
|
|
14
|
+
const arr = [64, 32, 16, 8, 4, 2, 1];
|
|
15
|
+
for (let i = 0; i < arr.length; i++)
|
|
16
|
+
if (val >= arr[i] && arr[i] === Math.pow(2, index))
|
|
17
|
+
return true;
|
|
18
|
+
else
|
|
19
|
+
val -= arr[i];
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
fetchCategories(categories) {
|
|
24
|
+
let list = categories.filter(i => i.availableIn === EnumCategoryAvailableIn_1.default.EVERY_WHERE || i.availableIn === EnumCategoryAvailableIn_1.default.POS_ONLY);
|
|
25
|
+
list = list.filter(i => {
|
|
26
|
+
if (!i.informationTransmitter)
|
|
27
|
+
return true;
|
|
28
|
+
if (i.products.length === 0)
|
|
29
|
+
return false;
|
|
30
|
+
const { showToTime, showFromTime, showFromDate, showToDate, onlyOnWeekDays } = i;
|
|
31
|
+
let date = new Date().toISOString().split("T")[0];
|
|
32
|
+
let time = new Date().toISOString().split("T")[1];
|
|
33
|
+
let dateIsOk = (showFromDate !== null && showToDate !== null) ? date >= showFromDate && date <= showToDate : true;
|
|
34
|
+
let timeIsOk = (showFromTime !== null && showToTime !== null) ? time >= showFromTime && time <= showToTime : true;
|
|
35
|
+
let dayOfWeekIsOk = (onlyOnWeekDays === null || onlyOnWeekDays === undefined) ? true : this.checkDayWeek(new Date().getDay(), onlyOnWeekDays);
|
|
36
|
+
return dateIsOk && timeIsOk && dayOfWeekIsOk;
|
|
37
|
+
});
|
|
38
|
+
return list;
|
|
39
|
+
}
|
|
40
|
+
fetchProducts(arg, products, categories) {
|
|
41
|
+
var _a;
|
|
42
|
+
let productIdList = (_a = categories.find(i => i.id === arg.category)) === null || _a === void 0 ? void 0 : _a.products;
|
|
43
|
+
if (productIdList === undefined) {
|
|
44
|
+
return this.searchProduct(products, arg.word.toLowerCase());
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
productIdList = [...productIdList];
|
|
48
|
+
return this.searchProduct(products.filter(i => productIdList === null || productIdList === void 0 ? void 0 : productIdList.includes(i.id)), arg.word.toLowerCase());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
searchProduct(products, word) {
|
|
52
|
+
if (word.trim().length === 0)
|
|
53
|
+
return products;
|
|
54
|
+
return [...products].filter(i => i.posName.toLowerCase().search(word) !== -1 || i.name.toLowerCase().search(word) !== -1);
|
|
55
|
+
}
|
|
56
|
+
productPrice(product, orderType) {
|
|
57
|
+
switch (orderType) {
|
|
58
|
+
case EnumOrderType_1.default.delivery:
|
|
59
|
+
return product.deliveryPrice;
|
|
60
|
+
case EnumOrderType_1.default.pickup:
|
|
61
|
+
return product.pickupPrice;
|
|
62
|
+
default:
|
|
63
|
+
return product.diningPrice;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
productCountInOrder(product, items) {
|
|
67
|
+
let quantities = items.filter(i => i.productId === product.id).map(i => +i.quantity);
|
|
68
|
+
if (quantities.length === 0)
|
|
69
|
+
return 0;
|
|
70
|
+
return quantities.reduce((previousValue, currentValue) => previousValue + currentValue);
|
|
71
|
+
}
|
|
72
|
+
}();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = new class {
|
|
4
|
+
unFormatPhoneNumber(phone = "(000) 000-0000") {
|
|
5
|
+
if (!phone)
|
|
6
|
+
return "";
|
|
7
|
+
phone = phone.replace(/\(/g, "");
|
|
8
|
+
phone = phone.replace(/\)/g, "");
|
|
9
|
+
phone = phone.replace(/-/g, "");
|
|
10
|
+
phone = phone.replace(/ /g, "");
|
|
11
|
+
phone = phone.replace(/\+/g, "");
|
|
12
|
+
return phone;
|
|
13
|
+
}
|
|
14
|
+
formatPhoneNumber(phone = "0000000000") {
|
|
15
|
+
let unFormat = this.unFormatPhoneNumber(phone);
|
|
16
|
+
const len = unFormat.length;
|
|
17
|
+
if (len < 10)
|
|
18
|
+
return unFormat;
|
|
19
|
+
let p1 = unFormat.slice(len - 10, len - 7);
|
|
20
|
+
let p2 = unFormat.slice(len - 7, len - 4);
|
|
21
|
+
let p3 = unFormat.slice(len - 4, len);
|
|
22
|
+
return `(${p1}) ${p2}-${p3}`;
|
|
23
|
+
}
|
|
24
|
+
formatAccordingToLength(phone = "0000000000") {
|
|
25
|
+
let unFormat = this.unFormatPhoneNumber(phone);
|
|
26
|
+
if (unFormat.length < 4)
|
|
27
|
+
return `(${unFormat}`;
|
|
28
|
+
else if (unFormat.length < 7)
|
|
29
|
+
return `(${unFormat.substring(0, 3)}) ${unFormat.substring(3, 6)}`;
|
|
30
|
+
else
|
|
31
|
+
return `(${unFormat.substring(0, 3)}) ${unFormat.substring(3, 6)}-${unFormat.substring(6)}`;
|
|
32
|
+
// let p1 = unFormat.slice(len - 10, len - 7);
|
|
33
|
+
// let p2 = unFormat.slice(len - 7, len - 4);
|
|
34
|
+
// let p3 = unFormat.slice(len - 4, len);
|
|
35
|
+
// return `(${p1}) ${p2}-${p3}`;
|
|
36
|
+
}
|
|
37
|
+
}();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import IAccount from "../interfaces/IAccount";
|
|
2
|
+
import IPrintTemplate from "../interfaces/IPrintTemplate";
|
|
3
|
+
import IOrderDetails from "../interfaces/print/IOrderDetails";
|
|
4
|
+
import IOrderDetailCustomer from "../interfaces/print/IOrderDetailCustomer";
|
|
5
|
+
import IOrderDetailProduct from "../interfaces/print/IOrderDetailProduct";
|
|
6
|
+
declare const _default: {
|
|
7
|
+
createAddressText: (customer: IOrderDetailCustomer) => null | [string, string];
|
|
8
|
+
ccyFormat: (num: number, pre?: string) => string;
|
|
9
|
+
calculatePaperSize: (paper: number, width: string | number) => string;
|
|
10
|
+
sortProduct: (products: IOrderDetailProduct[], sortType: number) => IOrderDetailProduct[];
|
|
11
|
+
filterByCategoryList: (products: IOrderDetailProduct[], catList: number[], onlyListCategory: boolean, productList: number[], onlyListProduct: boolean) => IOrderDetailProduct[];
|
|
12
|
+
sum(values: number[]): number;
|
|
13
|
+
convertTimeStringToDateByT(data?: Date | string | null): Date | string | null;
|
|
14
|
+
formatAMPMDate(date: Date | string | null): string;
|
|
15
|
+
formatDateTime(dateTime: string, mode?: string): string;
|
|
16
|
+
weekDayName(date: Date | string): string;
|
|
17
|
+
formatDate(date: Date | string): string | null;
|
|
18
|
+
substring(value: string | null, start: number, end: number): string;
|
|
19
|
+
defaultLayout(account: IAccount, detail: IOrderDetails, template: IPrintTemplate, symbol?: string): string;
|
|
20
|
+
labelLayout(detail: IOrderDetails, template: IPrintTemplate): string;
|
|
21
|
+
paymentFailed(detail: IOrderDetails, currency: string): string;
|
|
22
|
+
packageLabel(detail: IOrderDetails): string;
|
|
23
|
+
preview(account: IAccount, detail: IOrderDetails, template: IPrintTemplate, symbol?: string): string;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|