@pisell/private-materials 6.6.60 → 6.6.62
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/booking/components/footer/amount.js +3 -4
- package/es/components/booking/components/footer/utils.js +82 -85
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/dashboard/index.d.ts +5 -0
- package/es/components/booking/dashboard/index.js +9 -6
- package/es/components/booking/info/service2/Group/utils.js +30 -1
- package/es/components/booking/info2/service/editService/index.js +6 -49
- package/es/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/es/components/booking/info2/service/editService/utils.js +0 -16
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +23 -15
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
- package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/es/components/pisellCashCounting/hooks.d.ts +21 -0
- package/es/components/pisellCashCounting/hooks.js +193 -0
- package/es/components/pisellCashCounting/index.d.ts +2 -0
- package/es/components/pisellCashCounting/index.js +1 -0
- package/es/components/pisellCashCounting/locales.d.ts +118 -0
- package/es/components/pisellCashCounting/locales.js +117 -0
- package/es/components/pisellCashCounting/types.d.ts +85 -0
- package/es/components/pisellCashCounting/types.js +1 -0
- package/es/components/pisellCashCounting/utils.d.ts +10 -0
- package/es/components/pisellCashCounting/utils.js +40 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/es/components/ticketBooking/components/bookingDataPanel/index.js +5 -2
- package/es/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +2 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +156 -37
- package/es/components/ticketBooking/index.js +7 -1
- package/es/components/ticketBooking/utils/formatProductMessage.js +47 -2
- package/es/hooks/useResponsive.d.ts +8 -0
- package/es/hooks/useResponsive.js +43 -0
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/pro/Login2.0/components/phoneValidation.js +65 -58
- package/es/pro/NumericStepper/index.d.ts +75 -0
- package/es/pro/NumericStepper/index.js +301 -0
- package/es/pro/NumericStepper/index.less +364 -0
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +38 -0
- package/es/pro/keyboards/locales.js +57 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +523 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +11 -15
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/dashboard/index.d.ts +5 -0
- package/lib/components/booking/dashboard/index.js +6 -5
- package/lib/components/booking/info/service2/Group/utils.js +42 -3
- package/lib/components/booking/info2/service/editService/index.js +5 -39
- package/lib/components/booking/info2/service/editService/utils.d.ts +0 -1
- package/lib/components/booking/info2/service/editService/utils.js +0 -16
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +23 -16
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
- package/lib/components/pisellCashCounting/hooks.js +189 -0
- package/lib/components/pisellCashCounting/index.d.ts +2 -0
- package/lib/components/pisellCashCounting/index.js +35 -0
- package/lib/components/pisellCashCounting/locales.d.ts +118 -0
- package/lib/components/pisellCashCounting/locales.js +141 -0
- package/lib/components/pisellCashCounting/types.d.ts +85 -0
- package/lib/components/pisellCashCounting/types.js +17 -0
- package/lib/components/pisellCashCounting/utils.d.ts +10 -0
- package/lib/components/pisellCashCounting/utils.js +59 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +0 -1
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/bookingDashboard/index.js +3 -2
- package/lib/components/ticketBooking/components/bookingDataPanel/index.d.ts +2 -0
- package/lib/components/ticketBooking/components/bookingDataPanel/index.js +10 -3
- package/lib/components/ticketBooking/components/bookingDataPanel/pisellFloatingPanel/index.js +10 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +114 -14
- package/lib/components/ticketBooking/index.js +11 -1
- package/lib/components/ticketBooking/utils/formatProductMessage.js +44 -2
- package/lib/hooks/useResponsive.d.ts +8 -0
- package/lib/hooks/useResponsive.js +48 -0
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/pro/Login2.0/components/phoneValidation.js +4 -2
- package/lib/pro/NumericStepper/index.d.ts +75 -0
- package/lib/pro/NumericStepper/index.js +338 -0
- package/lib/pro/NumericStepper/index.less +364 -0
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +38 -0
- package/lib/pro/keyboards/locales.js +61 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lowcode/pisell-cash-counting/meta.ts +167 -0
- package/lowcode/pisell-cash-counting/snippets.ts +13 -0
- package/package.json +4 -4
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellCashCounting/PisellCashCounting.tsx
|
|
30
|
+
var PisellCashCounting_exports = {};
|
|
31
|
+
__export(PisellCashCounting_exports, {
|
|
32
|
+
default: () => PisellCashCounting_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(PisellCashCounting_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_utils = require("@pisell/utils");
|
|
39
|
+
var import_pisellPriceKeyboardModal = __toESM(require("../../pro/pisellPriceKeyboardModal"));
|
|
40
|
+
var import_locales = __toESM(require("./locales"));
|
|
41
|
+
var import_materials = require("@pisell/materials");
|
|
42
|
+
var import_CashCountingModal = __toESM(require("./components/CashCountingModal/index"));
|
|
43
|
+
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
44
|
+
var import_hooks = require("./hooks");
|
|
45
|
+
var import_PisellCashCounting = require("./PisellCashCounting.less");
|
|
46
|
+
var PREFIX = "pisell-private-cash-counting";
|
|
47
|
+
var PisellCashCounting = (props) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const context = (0, import_useEngineContext.default)();
|
|
50
|
+
import_utils.locales.init(import_locales.default, ((_b = (_a = context == null ? void 0 : context.engine) == null ? void 0 : _a.props) == null ? void 0 : _b.locale) || "en");
|
|
51
|
+
const {
|
|
52
|
+
disabled = false,
|
|
53
|
+
countDisabled = false,
|
|
54
|
+
placeholder,
|
|
55
|
+
layout = "vertical",
|
|
56
|
+
countCashButtonText,
|
|
57
|
+
showCurrencySymbol = true,
|
|
58
|
+
useThousandsSeparator = false,
|
|
59
|
+
inputNumberProps,
|
|
60
|
+
buttonProps,
|
|
61
|
+
className,
|
|
62
|
+
style,
|
|
63
|
+
modalWidth
|
|
64
|
+
} = props;
|
|
65
|
+
const {
|
|
66
|
+
modalRef,
|
|
67
|
+
triggerRef,
|
|
68
|
+
keyboardOpen,
|
|
69
|
+
setKeyboardOpen,
|
|
70
|
+
currencyDenominations,
|
|
71
|
+
decimalPlaces,
|
|
72
|
+
symbol,
|
|
73
|
+
currencyCode,
|
|
74
|
+
currentValue,
|
|
75
|
+
handleAmountChange,
|
|
76
|
+
handleKeyboardClose,
|
|
77
|
+
openCountModal,
|
|
78
|
+
handleCountCancel,
|
|
79
|
+
handleCountConfirm,
|
|
80
|
+
manualCountMismatchOpen,
|
|
81
|
+
confirmUseCountedTotal,
|
|
82
|
+
confirmKeepManualAmount
|
|
83
|
+
} = (0, import_hooks.usePisellCashCounting)(props);
|
|
84
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(PREFIX, className), style }, /* @__PURE__ */ import_react.default.createElement(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: (0, import_classnames.default)(`${PREFIX}__field`, {
|
|
88
|
+
[`${PREFIX}__field--horizontal`]: layout === "horizontal"
|
|
89
|
+
}),
|
|
90
|
+
ref: triggerRef
|
|
91
|
+
},
|
|
92
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
93
|
+
import_antd.InputNumber,
|
|
94
|
+
{
|
|
95
|
+
...inputNumberProps,
|
|
96
|
+
controls: false,
|
|
97
|
+
disabled,
|
|
98
|
+
precision: decimalPlaces,
|
|
99
|
+
value: currentValue,
|
|
100
|
+
placeholder: placeholder ?? import_utils.locales.getText("pisell-cash-counting.placeholder"),
|
|
101
|
+
className: (0, import_classnames.default)(`${PREFIX}__input`, inputNumberProps == null ? void 0 : inputNumberProps.className),
|
|
102
|
+
readOnly: true,
|
|
103
|
+
addonBefore: symbol,
|
|
104
|
+
size: "large",
|
|
105
|
+
style: { width: "100%" },
|
|
106
|
+
onClick: () => {
|
|
107
|
+
if (!disabled) {
|
|
108
|
+
setKeyboardOpen(true);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
onChange: handleAmountChange
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
115
|
+
import_antd.Button,
|
|
116
|
+
{
|
|
117
|
+
...buttonProps,
|
|
118
|
+
type: "primary",
|
|
119
|
+
disabled: disabled || countDisabled || (buttonProps == null ? void 0 : buttonProps.disabled),
|
|
120
|
+
className: (0, import_classnames.default)(`${PREFIX}__button`, buttonProps == null ? void 0 : buttonProps.className),
|
|
121
|
+
onClick: (event) => {
|
|
122
|
+
var _a2;
|
|
123
|
+
(_a2 = buttonProps == null ? void 0 : buttonProps.onClick) == null ? void 0 : _a2.call(buttonProps, event);
|
|
124
|
+
openCountModal();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
countCashButtonText ?? import_utils.locales.getText("pisell-cash-counting.countCash")
|
|
128
|
+
)
|
|
129
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
130
|
+
import_pisellPriceKeyboardModal.default,
|
|
131
|
+
{
|
|
132
|
+
symbol,
|
|
133
|
+
visible: keyboardOpen,
|
|
134
|
+
value: currentValue,
|
|
135
|
+
triggerRef,
|
|
136
|
+
showCurrencySymbol,
|
|
137
|
+
useThousandsSeparator,
|
|
138
|
+
onChange: handleAmountChange,
|
|
139
|
+
onClose: handleKeyboardClose
|
|
140
|
+
}
|
|
141
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
142
|
+
import_materials.PisellModal.Information,
|
|
143
|
+
{
|
|
144
|
+
open: manualCountMismatchOpen,
|
|
145
|
+
closable: false,
|
|
146
|
+
maskClosable: false,
|
|
147
|
+
title: import_utils.locales.getText("pisell-cash-counting.manual-vs-count-message-title"),
|
|
148
|
+
describe: import_utils.locales.getText("pisell-cash-counting.manual-vs-count-message"),
|
|
149
|
+
okText: import_utils.locales.getText("pisell-cash-counting.keep-manual-amount"),
|
|
150
|
+
cancelText: import_utils.locales.getText("pisell-cash-counting.use-count-total"),
|
|
151
|
+
onOk: confirmKeepManualAmount,
|
|
152
|
+
onCancel: confirmUseCountedTotal
|
|
153
|
+
}
|
|
154
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
155
|
+
import_CashCountingModal.default,
|
|
156
|
+
{
|
|
157
|
+
ref: modalRef,
|
|
158
|
+
modalWidth,
|
|
159
|
+
currencyCode,
|
|
160
|
+
currencyDenominations,
|
|
161
|
+
decimalPlaces,
|
|
162
|
+
symbol,
|
|
163
|
+
onCancel: handleCountCancel,
|
|
164
|
+
onConfirm: handleCountConfirm
|
|
165
|
+
}
|
|
166
|
+
));
|
|
167
|
+
};
|
|
168
|
+
var PisellCashCounting_default = PisellCashCounting;
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
.pisell-private-cash-counting {
|
|
2
|
+
&__field {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
|
|
7
|
+
&--horizontal {
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: center;
|
|
10
|
+
flex-wrap: nowrap;
|
|
11
|
+
|
|
12
|
+
.pisell-private-cash-counting__input {
|
|
13
|
+
flex: 1;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pisell-private-cash-counting__button {
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.pisell-lowcode-input-number-wrapper{
|
|
24
|
+
width: auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__input {
|
|
28
|
+
input {
|
|
29
|
+
width: 100%;
|
|
30
|
+
min-width: none;
|
|
31
|
+
max-width: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__button {
|
|
36
|
+
width: max-content;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__modal {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
height: min(720px, calc(90vh - 72px));
|
|
43
|
+
min-height: 520px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&__modal-intro {
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
padding: 16px 24px 12px;
|
|
50
|
+
border-bottom: 1px solid #eaecf0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&__subtitle {
|
|
54
|
+
color: #667085;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
line-height: 20px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&__currency {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
min-height: 28px;
|
|
63
|
+
margin-top: 12px;
|
|
64
|
+
padding: 4px 10px;
|
|
65
|
+
border-radius: 999px;
|
|
66
|
+
background: #f2f4f7;
|
|
67
|
+
color: #344054;
|
|
68
|
+
font-size: 13px;
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__scroll {
|
|
73
|
+
flex: 1;
|
|
74
|
+
min-height: 0;
|
|
75
|
+
overflow-y: auto;
|
|
76
|
+
padding: 20px 24px 24px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&__empty {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
min-height: 220px;
|
|
84
|
+
color: #98a2b3;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__section+&__section {
|
|
89
|
+
margin-top: 24px;
|
|
90
|
+
padding-top: 24px;
|
|
91
|
+
border-top: 1px solid #f2f4f7;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__section-header {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
gap: 16px;
|
|
99
|
+
margin-bottom: 12px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&__section-title {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 8px;
|
|
106
|
+
color: #667085;
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
font-weight: 700;
|
|
109
|
+
letter-spacing: 0.04em;
|
|
110
|
+
text-transform: uppercase;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&__dot {
|
|
114
|
+
width: 8px;
|
|
115
|
+
height: 8px;
|
|
116
|
+
border-radius: 50%;
|
|
117
|
+
background: #635bff;
|
|
118
|
+
|
|
119
|
+
&--coin {
|
|
120
|
+
background: #f59e0b;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__section-subtotal {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: 10px;
|
|
128
|
+
color: #667085;
|
|
129
|
+
font-size: 14px;
|
|
130
|
+
|
|
131
|
+
strong {
|
|
132
|
+
color: #101828;
|
|
133
|
+
font-size: 15px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&__denomination-list {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
gap: 12px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&__denomination-row {
|
|
144
|
+
display: grid;
|
|
145
|
+
grid-template-columns: 92px minmax(150px, 220px) minmax(92px, 1fr);
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 16px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&__denomination-label {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
min-width: 78px;
|
|
155
|
+
height: 32px;
|
|
156
|
+
padding: 0 12px;
|
|
157
|
+
border-radius: 6px;
|
|
158
|
+
background: #dbeafe;
|
|
159
|
+
color: #175cd3;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
font-weight: 700;
|
|
162
|
+
|
|
163
|
+
&--coin {
|
|
164
|
+
background: #fef3c7;
|
|
165
|
+
color: #92400e;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&__stepper {
|
|
170
|
+
&.numeric-stepper {
|
|
171
|
+
gap: 8px;
|
|
172
|
+
grid-template-columns: auto auto auto;
|
|
173
|
+
justify-content: flex-start;
|
|
174
|
+
width: auto;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.numeric-stepper-button {
|
|
178
|
+
width: 32px;
|
|
179
|
+
height: 32px;
|
|
180
|
+
border-radius: 6px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.numeric-stepper-display {
|
|
184
|
+
width: 60px;
|
|
185
|
+
height: 32px;
|
|
186
|
+
max-width: 70px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&__row-amount {
|
|
191
|
+
justify-self: end;
|
|
192
|
+
color: #98a2b3;
|
|
193
|
+
font-size: 15px;
|
|
194
|
+
font-weight: 700;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&__footer {
|
|
198
|
+
flex-shrink: 0;
|
|
199
|
+
padding: 20px 24px 24px;
|
|
200
|
+
border-top: 1px solid #eaecf0;
|
|
201
|
+
background: #ffffff;
|
|
202
|
+
box-shadow: 0 -8px 20px rgba(16, 24, 40, 0.04);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&__summary {
|
|
206
|
+
padding-bottom: 16px;
|
|
207
|
+
border-bottom: 1px dashed #d0d5dd;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&__summary-row,
|
|
211
|
+
&__total-row {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: space-between;
|
|
215
|
+
gap: 16px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&__summary-row {
|
|
219
|
+
color: #667085;
|
|
220
|
+
font-size: 15px;
|
|
221
|
+
|
|
222
|
+
+.pisell-private-cash-counting__summary-row {
|
|
223
|
+
margin-top: 10px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
strong {
|
|
227
|
+
color: #101828;
|
|
228
|
+
font-size: 16px;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&__total-row {
|
|
233
|
+
margin-top: 16px;
|
|
234
|
+
color: #101828;
|
|
235
|
+
font-size: 18px;
|
|
236
|
+
font-weight: 700;
|
|
237
|
+
|
|
238
|
+
strong {
|
|
239
|
+
color: #5b4be8;
|
|
240
|
+
font-size: 34px;
|
|
241
|
+
line-height: 40px;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
&__actions {
|
|
246
|
+
display: grid;
|
|
247
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
248
|
+
gap: 12px;
|
|
249
|
+
margin-top: 18px;
|
|
250
|
+
|
|
251
|
+
.pisell-lowcode-btn {
|
|
252
|
+
margin: 0;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.pisell-lowcode-modal-root {
|
|
258
|
+
.pisell-private-cash-counting__modal-wrap {
|
|
259
|
+
.pisell-lowcode-modal-body {
|
|
260
|
+
overflow: hidden;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CashCountingConfirmPayload, CurrencyDenominationConfig } from '../../types';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface PisellCashCountingModalRef {
|
|
5
|
+
open: (config: {
|
|
6
|
+
initialQuantities: Record<string, number>;
|
|
7
|
+
}) => void;
|
|
8
|
+
close: () => void;
|
|
9
|
+
}
|
|
10
|
+
interface PisellCashCountingModalProps {
|
|
11
|
+
currencyCode: string;
|
|
12
|
+
currencyDenominations: CurrencyDenominationConfig[];
|
|
13
|
+
decimalPlaces: number;
|
|
14
|
+
symbol: string;
|
|
15
|
+
modalWidth?: number | string;
|
|
16
|
+
onCancel: () => void;
|
|
17
|
+
onConfirm: (payload: CashCountingConfirmPayload) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const CashCountingModal: React.ForwardRefExoticComponent<PisellCashCountingModalProps & React.RefAttributes<PisellCashCountingModalRef>>;
|
|
20
|
+
export default CashCountingModal;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellCashCounting/components/CashCountingModal/index.tsx
|
|
30
|
+
var CashCountingModal_exports = {};
|
|
31
|
+
__export(CashCountingModal_exports, {
|
|
32
|
+
default: () => CashCountingModal_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(CashCountingModal_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_materials = require("@pisell/materials");
|
|
37
|
+
var import_NumericStepper = __toESM(require("../../../../pro/NumericStepper"));
|
|
38
|
+
var import_utils = require("@pisell/utils");
|
|
39
|
+
var import_icons = require("@ant-design/icons");
|
|
40
|
+
var import_utils2 = require("../../utils");
|
|
41
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
42
|
+
var import_useResponsive = require("../../../../hooks/useResponsive");
|
|
43
|
+
var import_index = require("./index.less");
|
|
44
|
+
var PREFIX = "pisell-private-cash-counting-modal";
|
|
45
|
+
var formatAmount = (value, symbol, precision) => {
|
|
46
|
+
const formatter = new Intl.NumberFormat(void 0, {
|
|
47
|
+
minimumFractionDigits: precision,
|
|
48
|
+
maximumFractionDigits: precision
|
|
49
|
+
});
|
|
50
|
+
return `${symbol}${formatter.format(value)}`;
|
|
51
|
+
};
|
|
52
|
+
var CashCountingModal = (0, import_react.forwardRef)(
|
|
53
|
+
(props, ref) => {
|
|
54
|
+
var _a;
|
|
55
|
+
const {
|
|
56
|
+
currencyCode,
|
|
57
|
+
currencyDenominations,
|
|
58
|
+
decimalPlaces,
|
|
59
|
+
symbol,
|
|
60
|
+
modalWidth,
|
|
61
|
+
onCancel,
|
|
62
|
+
onConfirm
|
|
63
|
+
} = props;
|
|
64
|
+
const context = (0, import_useEngineContext.default)();
|
|
65
|
+
const { isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
66
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
67
|
+
const [draftQuantities, setDraftQuantities] = (0, import_react.useState)({});
|
|
68
|
+
const isIpad = (0, import_useResponsive.useResponsive)(1200);
|
|
69
|
+
const isMobile = (0, import_useResponsive.useResponsive)(450);
|
|
70
|
+
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
71
|
+
open: ({ initialQuantities }) => {
|
|
72
|
+
setDraftQuantities(initialQuantities);
|
|
73
|
+
setOpen(true);
|
|
74
|
+
},
|
|
75
|
+
close: () => setOpen(false)
|
|
76
|
+
}));
|
|
77
|
+
const groupedDenominations = (0, import_react.useMemo)(() => {
|
|
78
|
+
return currencyDenominations.reduce(
|
|
79
|
+
(acc, item) => {
|
|
80
|
+
acc[item.denomination_type].push(item);
|
|
81
|
+
return acc;
|
|
82
|
+
},
|
|
83
|
+
{ bill: [], coin: [] }
|
|
84
|
+
);
|
|
85
|
+
}, [currencyDenominations]);
|
|
86
|
+
const calculatedDetails = (0, import_react.useMemo)(() => {
|
|
87
|
+
return currencyDenominations.map((d) => {
|
|
88
|
+
const qty = draftQuantities[(0, import_utils2.getDenominationId)(d)] ?? 0;
|
|
89
|
+
return { denomination: d, quantity: qty, amount: (0, import_utils2.normalizeAmount)(d.denomination_value * qty, decimalPlaces) };
|
|
90
|
+
});
|
|
91
|
+
}, [currencyDenominations, draftQuantities, decimalPlaces, import_utils2.getDenominationId, import_utils2.normalizeAmount]);
|
|
92
|
+
const billSubtotal = (0, import_react.useMemo)(
|
|
93
|
+
() => calculatedDetails.filter((i) => i.denomination.denomination_type === "bill").reduce((s, i) => s + i.amount, 0),
|
|
94
|
+
[calculatedDetails]
|
|
95
|
+
);
|
|
96
|
+
const coinSubtotal = (0, import_react.useMemo)(
|
|
97
|
+
() => calculatedDetails.filter((i) => i.denomination.denomination_type === "coin").reduce((s, i) => s + i.amount, 0),
|
|
98
|
+
[calculatedDetails]
|
|
99
|
+
);
|
|
100
|
+
const totalAmount = (0, import_react.useMemo)(() => billSubtotal + coinSubtotal, [billSubtotal, coinSubtotal]);
|
|
101
|
+
const handleClose = () => {
|
|
102
|
+
setOpen(false);
|
|
103
|
+
if (typeof onCancel === "function") {
|
|
104
|
+
onCancel();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleClear = () => {
|
|
108
|
+
const reset = {};
|
|
109
|
+
currencyDenominations.forEach((d) => reset[(0, import_utils2.getDenominationId)(d)] = 0);
|
|
110
|
+
setDraftQuantities(reset);
|
|
111
|
+
};
|
|
112
|
+
const handleConfirm = () => {
|
|
113
|
+
const payload = {
|
|
114
|
+
amount: totalAmount,
|
|
115
|
+
currencyCode,
|
|
116
|
+
decimalPlaces,
|
|
117
|
+
billSubtotal,
|
|
118
|
+
coinSubtotal,
|
|
119
|
+
details: calculatedDetails,
|
|
120
|
+
quantities: draftQuantities
|
|
121
|
+
};
|
|
122
|
+
if (typeof onConfirm === "function") {
|
|
123
|
+
onConfirm(payload);
|
|
124
|
+
}
|
|
125
|
+
setOpen(false);
|
|
126
|
+
};
|
|
127
|
+
const renderSection = (type, title, subtotal) => {
|
|
128
|
+
const items = groupedDenominations[type];
|
|
129
|
+
if (!items.length) return null;
|
|
130
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__section` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__section-header` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__section-title` }, /* @__PURE__ */ import_react.default.createElement("span", { className: `${PREFIX}__dot ${PREFIX}__dot--${type}` }), /* @__PURE__ */ import_react.default.createElement("span", null, title)), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__section-subtotal` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-cash-counting.subtotal")), /* @__PURE__ */ import_react.default.createElement("strong", null, formatAmount(subtotal, symbol, decimalPlaces)))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__denomination-list` }, items.map((item) => {
|
|
131
|
+
const id = (0, import_utils2.getDenominationId)(item);
|
|
132
|
+
const qty = draftQuantities[id] ?? 0;
|
|
133
|
+
const amt = (0, import_utils2.normalizeAmount)(item.denomination_value * qty, decimalPlaces);
|
|
134
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__denomination-row`, key: id }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__denomination-left` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__denomination-label ${PREFIX}__denomination-label--${type}` }, item.denomination_label), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__stepper-wrap` }, /* @__PURE__ */ import_react.default.createElement(
|
|
135
|
+
import_NumericStepper.default,
|
|
136
|
+
{
|
|
137
|
+
className: `${PREFIX}__stepper`,
|
|
138
|
+
min: 0,
|
|
139
|
+
max: 9999,
|
|
140
|
+
value: qty,
|
|
141
|
+
plusOnlyAtZero: false,
|
|
142
|
+
shape: "square",
|
|
143
|
+
onChange: (val) => setDraftQuantities((prev) => ({ ...prev, [id]: val }))
|
|
144
|
+
}
|
|
145
|
+
))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__row-amount` }, formatAmount(amt, symbol, decimalPlaces)));
|
|
146
|
+
})));
|
|
147
|
+
};
|
|
148
|
+
const renderHeader = (0, import_react.useCallback)(() => {
|
|
149
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__modal-header` }, /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-cash", className: `${PREFIX}__modal-header-icon` }), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__modal-header-title` }, import_utils.locales.getText("pisell-cash-counting.countCash")), /* @__PURE__ */ import_react.default.createElement(import_materials.Tag, { color: "blue", style: { border: "none" } }, currencyCode));
|
|
150
|
+
}, [currencyCode]);
|
|
151
|
+
const renderFooter = (0, import_react.useCallback)(() => {
|
|
152
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__footer` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__summary` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__summary-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-cash-counting.billsSubtotal")), /* @__PURE__ */ import_react.default.createElement("strong", null, formatAmount(billSubtotal, symbol, decimalPlaces))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__summary-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-cash-counting.coinsSubtotal")), /* @__PURE__ */ import_react.default.createElement("strong", null, formatAmount(coinSubtotal, symbol, decimalPlaces))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__total-row` }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils.locales.getText("pisell-cash-counting.total")), /* @__PURE__ */ import_react.default.createElement("strong", null, formatAmount(totalAmount, symbol, decimalPlaces)))), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__actions` }, /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { type: "text", size: "large", onClick: handleClear }, import_utils.locales.getText("pisell-cash-counting.clearAll")), /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { size: "large", onClick: handleClose }, import_utils.locales.getText("pisell-cash-counting.cancel")), /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { type: "primary", size: "large", disabled: !currencyDenominations.length, onClick: handleConfirm }, import_utils.locales.getText("pisell-cash-counting.confirm"))));
|
|
153
|
+
}, [coinSubtotal, billSubtotal, totalAmount, currencyDenominations, handleClear, handleClose, handleConfirm]);
|
|
154
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
155
|
+
import_materials.PisellModal,
|
|
156
|
+
{
|
|
157
|
+
destroyOnClose: true,
|
|
158
|
+
maskClosable: false,
|
|
159
|
+
footer: renderFooter(),
|
|
160
|
+
open,
|
|
161
|
+
title: renderHeader(),
|
|
162
|
+
className: `${PREFIX}__modal-wrap`,
|
|
163
|
+
bodyStyle: { padding: 0 },
|
|
164
|
+
width: modalWidth ? modalWidth : (isTerminal == null ? void 0 : isTerminal()) ? "80%" : "880px",
|
|
165
|
+
onCancel: handleClose
|
|
166
|
+
},
|
|
167
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__modal` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__modal-intro` }, /* @__PURE__ */ import_react.default.createElement(import_icons.ExclamationCircleOutlined, { style: { fontSize: 18, color: "#F2A63A" } }), import_utils.locales.getText("pisell-cash-counting.subtitle")), /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__scroll ${isIpad || isMobile ? `${PREFIX}__scroll-column` : ""} ${isMobile ? `${PREFIX}__scroll-mobile` : ""}` }, currencyDenominations.length === 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${PREFIX}__empty` }, import_utils.locales.getText("pisell-cash-counting.empty")) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderSection("bill", import_utils.locales.getText("pisell-cash-counting.bills"), billSubtotal), renderSection("coin", import_utils.locales.getText("pisell-cash-counting.coins"), coinSubtotal))))
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
var CashCountingModal_default = CashCountingModal;
|