@pisell/private-materials 6.6.60 → 6.6.61
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.js +23 -15
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- 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/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.js +23 -16
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- 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/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,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,250 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useState } from 'react';
|
|
14
|
+
import { PisellModal, Iconfont, Tag, Button } from '@pisell/materials';
|
|
15
|
+
import NumericStepper from "../../../../pro/NumericStepper";
|
|
16
|
+
import { locales } from '@pisell/utils';
|
|
17
|
+
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
18
|
+
import { getDenominationId, normalizeAmount } from "../../utils";
|
|
19
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
20
|
+
import { useResponsive } from "../../../../hooks/useResponsive";
|
|
21
|
+
import "./index.less";
|
|
22
|
+
var PREFIX = 'pisell-private-cash-counting-modal';
|
|
23
|
+
var formatAmount = function formatAmount(value, symbol, precision) {
|
|
24
|
+
var formatter = new Intl.NumberFormat(undefined, {
|
|
25
|
+
minimumFractionDigits: precision,
|
|
26
|
+
maximumFractionDigits: precision
|
|
27
|
+
});
|
|
28
|
+
return "".concat(symbol).concat(formatter.format(value));
|
|
29
|
+
};
|
|
30
|
+
var CashCountingModal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
31
|
+
var _context$appHelper;
|
|
32
|
+
var currencyCode = props.currencyCode,
|
|
33
|
+
currencyDenominations = props.currencyDenominations,
|
|
34
|
+
decimalPlaces = props.decimalPlaces,
|
|
35
|
+
symbol = props.symbol,
|
|
36
|
+
modalWidth = props.modalWidth,
|
|
37
|
+
onCancel = props.onCancel,
|
|
38
|
+
onConfirm = props.onConfirm;
|
|
39
|
+
var context = useEngineContext();
|
|
40
|
+
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
41
|
+
isTerminal = _ref.isTerminal;
|
|
42
|
+
var _useState = useState(false),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
open = _useState2[0],
|
|
45
|
+
setOpen = _useState2[1];
|
|
46
|
+
var _useState3 = useState({}),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
draftQuantities = _useState4[0],
|
|
49
|
+
setDraftQuantities = _useState4[1];
|
|
50
|
+
var isIpad = useResponsive(1200);
|
|
51
|
+
var isMobile = useResponsive(450);
|
|
52
|
+
|
|
53
|
+
// 暴露 ref 方法
|
|
54
|
+
useImperativeHandle(ref, function () {
|
|
55
|
+
return {
|
|
56
|
+
open: function open(_ref2) {
|
|
57
|
+
var initialQuantities = _ref2.initialQuantities;
|
|
58
|
+
setDraftQuantities(initialQuantities);
|
|
59
|
+
setOpen(true);
|
|
60
|
+
},
|
|
61
|
+
close: function close() {
|
|
62
|
+
return setOpen(false);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// 计算
|
|
68
|
+
var groupedDenominations = useMemo(function () {
|
|
69
|
+
return currencyDenominations.reduce(function (acc, item) {
|
|
70
|
+
acc[item.denomination_type].push(item);
|
|
71
|
+
return acc;
|
|
72
|
+
}, {
|
|
73
|
+
bill: [],
|
|
74
|
+
coin: []
|
|
75
|
+
});
|
|
76
|
+
}, [currencyDenominations]);
|
|
77
|
+
var calculatedDetails = useMemo(function () {
|
|
78
|
+
return currencyDenominations.map(function (d) {
|
|
79
|
+
var _draftQuantities$getD;
|
|
80
|
+
var qty = (_draftQuantities$getD = draftQuantities[getDenominationId(d)]) !== null && _draftQuantities$getD !== void 0 ? _draftQuantities$getD : 0;
|
|
81
|
+
return {
|
|
82
|
+
denomination: d,
|
|
83
|
+
quantity: qty,
|
|
84
|
+
amount: normalizeAmount(d.denomination_value * qty, decimalPlaces)
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}, [currencyDenominations, draftQuantities, decimalPlaces, getDenominationId, normalizeAmount]);
|
|
88
|
+
var billSubtotal = useMemo(function () {
|
|
89
|
+
return calculatedDetails.filter(function (i) {
|
|
90
|
+
return i.denomination.denomination_type === 'bill';
|
|
91
|
+
}).reduce(function (s, i) {
|
|
92
|
+
return s + i.amount;
|
|
93
|
+
}, 0);
|
|
94
|
+
}, [calculatedDetails]);
|
|
95
|
+
var coinSubtotal = useMemo(function () {
|
|
96
|
+
return calculatedDetails.filter(function (i) {
|
|
97
|
+
return i.denomination.denomination_type === 'coin';
|
|
98
|
+
}).reduce(function (s, i) {
|
|
99
|
+
return s + i.amount;
|
|
100
|
+
}, 0);
|
|
101
|
+
}, [calculatedDetails]);
|
|
102
|
+
var totalAmount = useMemo(function () {
|
|
103
|
+
return billSubtotal + coinSubtotal;
|
|
104
|
+
}, [billSubtotal, coinSubtotal]);
|
|
105
|
+
|
|
106
|
+
// 操作
|
|
107
|
+
var handleClose = function handleClose() {
|
|
108
|
+
setOpen(false);
|
|
109
|
+
if (typeof onCancel === 'function') {
|
|
110
|
+
onCancel();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var handleClear = function handleClear() {
|
|
114
|
+
var reset = {};
|
|
115
|
+
currencyDenominations.forEach(function (d) {
|
|
116
|
+
return reset[getDenominationId(d)] = 0;
|
|
117
|
+
});
|
|
118
|
+
setDraftQuantities(reset);
|
|
119
|
+
};
|
|
120
|
+
var handleConfirm = function handleConfirm() {
|
|
121
|
+
var payload = {
|
|
122
|
+
amount: totalAmount,
|
|
123
|
+
currencyCode: currencyCode,
|
|
124
|
+
decimalPlaces: decimalPlaces,
|
|
125
|
+
billSubtotal: billSubtotal,
|
|
126
|
+
coinSubtotal: coinSubtotal,
|
|
127
|
+
details: calculatedDetails,
|
|
128
|
+
quantities: draftQuantities
|
|
129
|
+
};
|
|
130
|
+
if (typeof onConfirm === 'function') {
|
|
131
|
+
onConfirm(payload);
|
|
132
|
+
}
|
|
133
|
+
setOpen(false);
|
|
134
|
+
};
|
|
135
|
+
var renderSection = function renderSection(type, title, subtotal) {
|
|
136
|
+
var items = groupedDenominations[type];
|
|
137
|
+
if (!items.length) return null;
|
|
138
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
className: "".concat(PREFIX, "__section")
|
|
140
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
className: "".concat(PREFIX, "__section-header")
|
|
142
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: "".concat(PREFIX, "__section-title")
|
|
144
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
145
|
+
className: "".concat(PREFIX, "__dot ").concat(PREFIX, "__dot--").concat(type)
|
|
146
|
+
}), /*#__PURE__*/React.createElement("span", null, title)), /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: "".concat(PREFIX, "__section-subtotal")
|
|
148
|
+
}, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell-cash-counting.subtotal')), /*#__PURE__*/React.createElement("strong", null, formatAmount(subtotal, symbol, decimalPlaces)))), /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
className: "".concat(PREFIX, "__denomination-list")
|
|
150
|
+
}, items.map(function (item) {
|
|
151
|
+
var _draftQuantities$id;
|
|
152
|
+
var id = getDenominationId(item);
|
|
153
|
+
var qty = (_draftQuantities$id = draftQuantities[id]) !== null && _draftQuantities$id !== void 0 ? _draftQuantities$id : 0;
|
|
154
|
+
var amt = normalizeAmount(item.denomination_value * qty, decimalPlaces);
|
|
155
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: "".concat(PREFIX, "__denomination-row"),
|
|
157
|
+
key: id
|
|
158
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "".concat(PREFIX, "__denomination-left")
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: "".concat(PREFIX, "__denomination-label ").concat(PREFIX, "__denomination-label--").concat(type)
|
|
162
|
+
}, item.denomination_label), /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: "".concat(PREFIX, "__stepper-wrap")
|
|
164
|
+
}, /*#__PURE__*/React.createElement(NumericStepper, {
|
|
165
|
+
className: "".concat(PREFIX, "__stepper"),
|
|
166
|
+
min: 0,
|
|
167
|
+
max: 9999,
|
|
168
|
+
value: qty,
|
|
169
|
+
plusOnlyAtZero: false,
|
|
170
|
+
shape: "square",
|
|
171
|
+
onChange: function onChange(val) {
|
|
172
|
+
return setDraftQuantities(function (prev) {
|
|
173
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, id, val));
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
className: "".concat(PREFIX, "__row-amount")
|
|
178
|
+
}, formatAmount(amt, symbol, decimalPlaces)));
|
|
179
|
+
})));
|
|
180
|
+
};
|
|
181
|
+
var renderHeader = useCallback(function () {
|
|
182
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
className: "".concat(PREFIX, "__modal-header")
|
|
184
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
185
|
+
type: "pisell2-cash",
|
|
186
|
+
className: "".concat(PREFIX, "__modal-header-icon")
|
|
187
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: "".concat(PREFIX, "__modal-header-title")
|
|
189
|
+
}, locales.getText('pisell-cash-counting.countCash')), /*#__PURE__*/React.createElement(Tag, {
|
|
190
|
+
color: "blue",
|
|
191
|
+
style: {
|
|
192
|
+
border: 'none'
|
|
193
|
+
}
|
|
194
|
+
}, currencyCode));
|
|
195
|
+
}, [currencyCode]);
|
|
196
|
+
var renderFooter = useCallback(function () {
|
|
197
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
198
|
+
className: "".concat(PREFIX, "__footer")
|
|
199
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
200
|
+
className: "".concat(PREFIX, "__summary")
|
|
201
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: "".concat(PREFIX, "__summary-row")
|
|
203
|
+
}, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell-cash-counting.billsSubtotal')), /*#__PURE__*/React.createElement("strong", null, formatAmount(billSubtotal, symbol, decimalPlaces))), /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
className: "".concat(PREFIX, "__summary-row")
|
|
205
|
+
}, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell-cash-counting.coinsSubtotal')), /*#__PURE__*/React.createElement("strong", null, formatAmount(coinSubtotal, symbol, decimalPlaces))), /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "".concat(PREFIX, "__total-row")
|
|
207
|
+
}, /*#__PURE__*/React.createElement("span", null, locales.getText('pisell-cash-counting.total')), /*#__PURE__*/React.createElement("strong", null, formatAmount(totalAmount, symbol, decimalPlaces)))), /*#__PURE__*/React.createElement("div", {
|
|
208
|
+
className: "".concat(PREFIX, "__actions")
|
|
209
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
210
|
+
type: "text",
|
|
211
|
+
size: "large",
|
|
212
|
+
onClick: handleClear
|
|
213
|
+
}, locales.getText('pisell-cash-counting.clearAll')), /*#__PURE__*/React.createElement(Button, {
|
|
214
|
+
size: "large",
|
|
215
|
+
onClick: handleClose
|
|
216
|
+
}, locales.getText('pisell-cash-counting.cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
217
|
+
type: "primary",
|
|
218
|
+
size: "large",
|
|
219
|
+
disabled: !currencyDenominations.length,
|
|
220
|
+
onClick: handleConfirm
|
|
221
|
+
}, locales.getText('pisell-cash-counting.confirm'))));
|
|
222
|
+
}, [coinSubtotal, billSubtotal, totalAmount, currencyDenominations, handleClear, handleClose, handleConfirm]);
|
|
223
|
+
return /*#__PURE__*/React.createElement(PisellModal, {
|
|
224
|
+
destroyOnClose: true,
|
|
225
|
+
maskClosable: false,
|
|
226
|
+
footer: renderFooter(),
|
|
227
|
+
open: open,
|
|
228
|
+
title: renderHeader(),
|
|
229
|
+
className: "".concat(PREFIX, "__modal-wrap"),
|
|
230
|
+
bodyStyle: {
|
|
231
|
+
padding: 0
|
|
232
|
+
},
|
|
233
|
+
width: modalWidth ? modalWidth : isTerminal !== null && isTerminal !== void 0 && isTerminal() ? '80%' : '880px',
|
|
234
|
+
onCancel: handleClose
|
|
235
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
236
|
+
className: "".concat(PREFIX, "__modal")
|
|
237
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
238
|
+
className: "".concat(PREFIX, "__modal-intro")
|
|
239
|
+
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
240
|
+
style: {
|
|
241
|
+
fontSize: 18,
|
|
242
|
+
color: '#F2A63A'
|
|
243
|
+
}
|
|
244
|
+
}), locales.getText('pisell-cash-counting.subtitle')), /*#__PURE__*/React.createElement("div", {
|
|
245
|
+
className: "".concat(PREFIX, "__scroll ").concat(isIpad || isMobile ? "".concat(PREFIX, "__scroll-column") : '', " ").concat(isMobile ? "".concat(PREFIX, "__scroll-mobile") : '')
|
|
246
|
+
}, currencyDenominations.length === 0 ? /*#__PURE__*/React.createElement("div", {
|
|
247
|
+
className: "".concat(PREFIX, "__empty")
|
|
248
|
+
}, locales.getText('pisell-cash-counting.empty')) : /*#__PURE__*/React.createElement(React.Fragment, null, renderSection('bill', locales.getText('pisell-cash-counting.bills'), billSubtotal), renderSection('coin', locales.getText('pisell-cash-counting.coins'), coinSubtotal)))));
|
|
249
|
+
});
|
|
250
|
+
export default CashCountingModal;
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
.pisell-private-cash-counting-modal {
|
|
2
|
+
&__modal-wrap {
|
|
3
|
+
.pisell-lowcode-modal-footer {
|
|
4
|
+
background: rgb(249, 250, 251);
|
|
5
|
+
padding: 12px 16px !important;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&__modal {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__modal-header {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
|
|
19
|
+
&__modal-header-icon {
|
|
20
|
+
font-size: 20px;
|
|
21
|
+
color: #667085;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__modal-intro {
|
|
26
|
+
padding: 10px 16px;
|
|
27
|
+
background: #FFF2C2;
|
|
28
|
+
color: #995522;
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__subtitle {
|
|
37
|
+
color: #667085;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
line-height: 20px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__currency {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
min-height: 28px;
|
|
46
|
+
margin-top: 12px;
|
|
47
|
+
padding: 4px 10px;
|
|
48
|
+
border-radius: 999px;
|
|
49
|
+
background: #f2f4f7;
|
|
50
|
+
color: #344054;
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__scroll {
|
|
56
|
+
flex: 1;
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
gap: 16px;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__empty {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
min-height: 220px;
|
|
69
|
+
color: #98a2b3;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__section {
|
|
74
|
+
padding: 16px;
|
|
75
|
+
flex: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&__section+&__section {
|
|
79
|
+
|
|
80
|
+
border-top: none;
|
|
81
|
+
padding-bottom: 16px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__section-header {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
gap: 16px;
|
|
89
|
+
margin-bottom: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__section-title {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 8px;
|
|
96
|
+
color: #667085;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
font-weight: 700;
|
|
99
|
+
letter-spacing: 0.04em;
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__dot {
|
|
104
|
+
width: 8px;
|
|
105
|
+
height: 8px;
|
|
106
|
+
border-radius: 50%;
|
|
107
|
+
background: #635bff;
|
|
108
|
+
|
|
109
|
+
&--coin {
|
|
110
|
+
background: #f59e0b;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__section-subtotal {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 10px;
|
|
118
|
+
color: #667085;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
|
|
121
|
+
strong {
|
|
122
|
+
color: #101828;
|
|
123
|
+
font-size: 15px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&__denomination-list {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__denomination-row {
|
|
134
|
+
// display: grid;
|
|
135
|
+
// grid-template-columns: 94px minmax(220px, 1fr) minmax(94px, 1fr);
|
|
136
|
+
align-items: center;
|
|
137
|
+
gap: 16px;
|
|
138
|
+
display: flex;
|
|
139
|
+
justify-content: space-between;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&__denomination-label {
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
min-width: 94px;
|
|
147
|
+
height: 32px;
|
|
148
|
+
padding: 0 12px;
|
|
149
|
+
border-radius: 6px;
|
|
150
|
+
background: #dbeafe;
|
|
151
|
+
color: #175cd3;
|
|
152
|
+
font-size: 14px;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
|
|
155
|
+
&--coin {
|
|
156
|
+
background: #fef3c7;
|
|
157
|
+
color: #92400e;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__denomination-left {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 16px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__stepper {
|
|
168
|
+
&.numeric-stepper {
|
|
169
|
+
gap: 8px;
|
|
170
|
+
grid-template-columns: auto auto auto;
|
|
171
|
+
justify-content: flex-start;
|
|
172
|
+
width: auto;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.numeric-stepper-button {
|
|
176
|
+
width: 40px;
|
|
177
|
+
height: 32px;
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.numeric-stepper-display {
|
|
182
|
+
width: 70px;
|
|
183
|
+
height: 32px;
|
|
184
|
+
max-width: 70px;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__row-amount {
|
|
189
|
+
justify-self: end;
|
|
190
|
+
color: #98a2b3;
|
|
191
|
+
font-size: 15px;
|
|
192
|
+
font-weight: 700;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&__footer {
|
|
196
|
+
width: 100%;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__summary {
|
|
200
|
+
padding-bottom: 4px;
|
|
201
|
+
border-bottom: 1px dashed #d0d5dd;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&__summary-row,
|
|
205
|
+
&__total-row {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
gap: 16px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&__summary-row {
|
|
213
|
+
color: #667085;
|
|
214
|
+
font-size: 15px;
|
|
215
|
+
|
|
216
|
+
+.pisell-private-cash-counting__summary-row {
|
|
217
|
+
margin-top: 10px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
strong {
|
|
221
|
+
color: #101828;
|
|
222
|
+
font-size: 16px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&__total-row {
|
|
227
|
+
margin-top: 4px;
|
|
228
|
+
color: #101828;
|
|
229
|
+
font-size: 18px;
|
|
230
|
+
font-weight: 700;
|
|
231
|
+
|
|
232
|
+
strong {
|
|
233
|
+
font-size: 34px;
|
|
234
|
+
line-height: 40px;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&__actions {
|
|
239
|
+
display: grid;
|
|
240
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
241
|
+
gap: 12px;
|
|
242
|
+
margin-top: 12px;
|
|
243
|
+
|
|
244
|
+
.pisell-lowcode-btn {
|
|
245
|
+
margin: 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
&__scroll-column {
|
|
250
|
+
padding: 0 0 10px;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
gap: 0;
|
|
253
|
+
|
|
254
|
+
.numeric-stepper-button {
|
|
255
|
+
width: 66px!important;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.numeric-stepper-display {
|
|
259
|
+
width: 100px!important;
|
|
260
|
+
max-width: 100px!important;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&__scroll-mobile {
|
|
265
|
+
.numeric-stepper-button {
|
|
266
|
+
width: 32px!important;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.numeric-stepper-display {
|
|
270
|
+
width: 60px!important;
|
|
271
|
+
max-width: 60px!important;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&__scroll-column &__section+&__section {
|
|
276
|
+
border-top: 1px solid #f2f4f7;
|
|
277
|
+
padding-bottom: 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CashCountingConfirmPayload, PisellCashCountingProps } from './types';
|
|
2
|
+
import type { PisellCashCountingModalRef } from './components/CashCountingModal/index';
|
|
3
|
+
export declare function usePisellCashCounting({ value, defaultValue, currencyCode, currencySymbol, amountPrecision, denominations, disabled, countDisabled, onChange, onCountConfirm, onCountCancel, }: PisellCashCountingProps): {
|
|
4
|
+
modalRef: import("react").RefObject<PisellCashCountingModalRef>;
|
|
5
|
+
triggerRef: import("react").RefObject<HTMLDivElement>;
|
|
6
|
+
keyboardOpen: boolean;
|
|
7
|
+
setKeyboardOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
currencyDenominations: import("./types").CurrencyDenominationConfig[];
|
|
9
|
+
decimalPlaces: number;
|
|
10
|
+
symbol: any;
|
|
11
|
+
currencyCode: any;
|
|
12
|
+
currentValue: string;
|
|
13
|
+
handleAmountChange: (nextValue: string | number) => void;
|
|
14
|
+
handleKeyboardClose: () => void;
|
|
15
|
+
openCountModal: () => void;
|
|
16
|
+
handleCountCancel: () => void;
|
|
17
|
+
handleCountConfirm: (payload: CashCountingConfirmPayload) => void;
|
|
18
|
+
manualCountMismatchOpen: boolean;
|
|
19
|
+
confirmUseCountedTotal: () => void;
|
|
20
|
+
confirmKeepManualAmount: () => void;
|
|
21
|
+
};
|