@pisell/private-materials 6.5.4 → 6.5.6
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 +1 -1
- package/build/lowcode/preview.js +160 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/actionButtons/index.js +37 -42
- package/es/components/booking/components/actionButtons/index.less +0 -28
- package/es/components/booking/components/footer/amount.d.ts +3 -3
- package/es/components/booking/components/footer/amount.js +51 -31
- package/es/components/booking/components/footer/index.js +177 -68
- package/es/components/booking/components/footer/utils.js +62 -33
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/model.js +5 -0
- package/es/components/booking/info/service/addService/index.js +2 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/index.js +42 -2
- package/es/components/booking/info2/service/addService/index.js +2 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/editService/index.js +12 -4
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.js +10 -5
- package/es/components/checkout/PaymentModal.d.ts +2 -0
- package/es/components/checkout/PaymentModal.js +462 -263
- package/es/components/checkout/components/AdditionalModule/index.less +1 -1
- package/es/components/checkout/components/AmountSummary/index.js +176 -65
- package/es/components/checkout/components/AmountSummary/index.less +13 -0
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/es/components/checkout/components/CashPaymentModule/index.js +110 -132
- package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +214 -0
- package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
- package/es/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/es/components/checkout/components/PaymentResultToast/index.js +38 -8
- package/es/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
- package/es/components/checkout/components/WalletPassModule/index.js +4 -3
- package/es/components/checkout/components/WalletPassModule/utils.js +10 -4
- package/es/components/checkout/hooks/useWalletPass.js +11 -4
- package/es/components/checkout/index.less +1 -1
- package/es/components/checkout/locales.d.ts +36 -0
- package/es/components/checkout/locales.js +43 -4
- package/es/components/checkout/types.d.ts +1 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/shoppingCart/components/Cart/Product.js +143 -71
- package/es/components/shoppingCart/components/Cart/index.js +1 -1
- package/es/components/shoppingCart/components/Cart/index.less +31 -0
- package/es/components/shoppingCart/locales.d.ts +3 -0
- package/es/components/shoppingCart/locales.js +12 -3
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +9 -12
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/es/components/ticketBooking/components/menuBar/index.js +3 -1
- package/es/components/ticketBooking/components/menuBar/index.less +7 -0
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/components/ticketBooking/utils/index.js +2 -1
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +331 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.js +465 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
- package/es/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
- package/es/pro/priceKeyboard/index.d.ts +3 -0
- package/es/pro/priceKeyboard/index.js +3 -0
- package/es/pro/priceKeyboard/index.less +215 -0
- package/es/pro/priceKeyboard/utils.d.ts +31 -0
- package/es/pro/priceKeyboard/utils.js +51 -0
- package/es/pro/skuDetailModal/index.js +19 -16
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/actionButtons/index.js +31 -28
- package/lib/components/booking/components/actionButtons/index.less +0 -28
- package/lib/components/booking/components/footer/amount.d.ts +3 -3
- package/lib/components/booking/components/footer/amount.js +49 -34
- package/lib/components/booking/components/footer/index.js +114 -40
- package/lib/components/booking/components/footer/utils.js +35 -7
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/service/addService/index.js +2 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/index.js +18 -1
- package/lib/components/booking/info2/service/addService/index.js +2 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/editService/index.js +12 -4
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.js +10 -5
- package/lib/components/checkout/PaymentModal.d.ts +2 -0
- package/lib/components/checkout/PaymentModal.js +208 -91
- package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
- package/lib/components/checkout/components/AmountSummary/index.js +120 -50
- package/lib/components/checkout/components/AmountSummary/index.less +13 -0
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/lib/components/checkout/components/CashPaymentModule/index.js +101 -134
- package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +163 -0
- package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
- package/lib/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/lib/components/checkout/components/PaymentResultToast/index.js +26 -1
- package/lib/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
- package/lib/components/checkout/components/WalletPassModule/index.js +4 -3
- package/lib/components/checkout/components/WalletPassModule/utils.js +8 -4
- package/lib/components/checkout/hooks/useWalletPass.js +11 -6
- package/lib/components/checkout/index.less +1 -1
- package/lib/components/checkout/locales.d.ts +36 -0
- package/lib/components/checkout/locales.js +43 -4
- package/lib/components/checkout/types.d.ts +1 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
- package/lib/components/shoppingCart/components/Cart/index.js +1 -1
- package/lib/components/shoppingCart/components/Cart/index.less +31 -0
- package/lib/components/shoppingCart/locales.d.ts +3 -0
- package/lib/components/shoppingCart/locales.js +6 -3
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -4
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/menuBar/index.js +1 -1
- package/lib/components/ticketBooking/components/menuBar/index.less +7 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/components/ticketBooking/utils/index.js +2 -1
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +360 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +504 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
- package/lib/pro/priceKeyboard/index.d.ts +3 -0
- package/lib/pro/priceKeyboard/index.js +45 -0
- package/lib/pro/priceKeyboard/index.less +215 -0
- package/lib/pro/priceKeyboard/utils.d.ts +31 -0
- package/lib/pro/priceKeyboard/utils.js +75 -0
- package/lib/pro/skuDetailModal/index.js +18 -22
- package/package.json +12 -12
@@ -41,7 +41,8 @@ var import_utils = require("@pisell/utils");
|
|
41
41
|
var import_decimal = __toESM(require("decimal.js"));
|
42
42
|
var import_locales = __toESM(require("../../locales"));
|
43
43
|
var import_PaymentDetailModal = __toESM(require("../PaymentDetailModal"));
|
44
|
-
var
|
44
|
+
var import_pisellSimplePriceKeyboardPopover = __toESM(require("../../../../pro/pisellSimplePriceKeyboardPopover"));
|
45
|
+
var import_priceKeyboard = require("../../../../pro/priceKeyboard");
|
45
46
|
var import_index = require("./index.less");
|
46
47
|
var import_classnames = __toESM(require("classnames"));
|
47
48
|
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
@@ -105,6 +106,7 @@ function AmountSummary({
|
|
105
106
|
const [summaryData, setSummaryData] = (0, import_react.useState)([]);
|
106
107
|
const [partialPaidAmount, setPartialPaidAmount] = (0, import_react.useState)("0");
|
107
108
|
const checkoutModule = pisellos.getModule("checkout");
|
109
|
+
const [isKeyboardVisible, setIsKeyboardVisible] = (0, import_react.useState)(false);
|
108
110
|
const labelMaps = {
|
109
111
|
deposit: getText("pisell2.subtotal.deposit") || "Deposit",
|
110
112
|
total: getText("pisell2.subtotal.total") || "Total",
|
@@ -117,13 +119,15 @@ function AmountSummary({
|
|
117
119
|
expect_amount: getText("pisell2.subtotal.expect-amount") || "Expected Amount"
|
118
120
|
};
|
119
121
|
const getBalanceDueAmount = () => {
|
120
|
-
|
121
|
-
(
|
122
|
-
);
|
123
|
-
if (expectAmountItem) {
|
124
|
-
return expectAmountItem.value;
|
122
|
+
if (paymentType === "deposit") {
|
123
|
+
return (orderInfo == null ? void 0 : orderInfo.depositAmount) || "0";
|
125
124
|
}
|
126
|
-
return 0
|
125
|
+
return (paymentItems == null ? void 0 : paymentItems.reduce((acc, item) => {
|
126
|
+
if (item.isSynced || !item.voucher_id) {
|
127
|
+
return acc;
|
128
|
+
}
|
129
|
+
return acc.plus(item.amount);
|
130
|
+
}, new import_decimal.default(0)).toNumber()) || 0;
|
127
131
|
};
|
128
132
|
const parseFormattedAmount = (formattedAmount) => {
|
129
133
|
if (typeof formattedAmount === "number") {
|
@@ -155,6 +159,7 @@ function AmountSummary({
|
|
155
159
|
if (Array.isArray(summary)) {
|
156
160
|
setSummaryData(summary);
|
157
161
|
}
|
162
|
+
setPaymentType(orderInfo.isDeposit ? "deposit" : "regular");
|
158
163
|
} catch (error) {
|
159
164
|
console.warn("Failed to get cart summary:", error);
|
160
165
|
}
|
@@ -223,26 +228,12 @@ function AmountSummary({
|
|
223
228
|
);
|
224
229
|
return totalDecimal.toNumber();
|
225
230
|
};
|
226
|
-
const getOrderDueAmount = () => {
|
227
|
-
const expectAmountItem = summaryData.find(
|
228
|
-
(item) => item.key === "expect_amount"
|
229
|
-
);
|
230
|
-
if (expectAmountItem) {
|
231
|
-
return expectAmountItem.value;
|
232
|
-
}
|
233
|
-
return paymentType === "deposit" ? 15.1 : 130.2;
|
234
|
-
};
|
235
231
|
const getKeyboardLimits = () => {
|
236
|
-
const
|
237
|
-
const orderDue = getOrderDueAmount();
|
238
|
-
const walletTotalDecimal = new import_decimal.default(walletTotal);
|
239
|
-
const orderDueDecimal = new import_decimal.default(orderDue);
|
232
|
+
const orderDueDecimal = new import_decimal.default(Number(balanceDueAmount || 0));
|
240
233
|
const minDecimal = new import_decimal.default(0.01);
|
241
|
-
const diffDecimal = orderDueDecimal.minus(walletTotalDecimal);
|
242
|
-
const maxAmountDecimal = import_decimal.default.max(minDecimal, diffDecimal);
|
243
234
|
return {
|
244
235
|
min: minDecimal.toNumber(),
|
245
|
-
max:
|
236
|
+
max: orderDueDecimal.toNumber()
|
246
237
|
};
|
247
238
|
};
|
248
239
|
const _formatInputAmount = (value) => {
|
@@ -271,9 +262,6 @@ function AmountSummary({
|
|
271
262
|
);
|
272
263
|
return;
|
273
264
|
}
|
274
|
-
if (!inputStr || numericValue <= 0) {
|
275
|
-
numericValue = getOrderDueAmount();
|
276
|
-
}
|
277
265
|
const minDecimal = new import_decimal.default(limits.min);
|
278
266
|
const maxDecimal = new import_decimal.default(limits.max);
|
279
267
|
const valueDecimal = new import_decimal.default(numericValue);
|
@@ -302,7 +290,7 @@ function AmountSummary({
|
|
302
290
|
var _a2;
|
303
291
|
const partialPaidAmountDecimal = new import_decimal.default(partialPaidAmount || "0");
|
304
292
|
const voucherPaymentAmount = ((_a2 = paymentItems == null ? void 0 : paymentItems.reduce((acc, item) => {
|
305
|
-
if (item.voucher_id) {
|
293
|
+
if (item.voucher_id && !item.isSynced) {
|
306
294
|
try {
|
307
295
|
const amount = new import_decimal.default(item.amount || "0");
|
308
296
|
const roundingAmount = new import_decimal.default(item.rounding_amount || "0");
|
@@ -314,6 +302,10 @@ function AmountSummary({
|
|
314
302
|
return acc;
|
315
303
|
}, new import_decimal.default(0))) == null ? void 0 : _a2.toNumber()) || 0;
|
316
304
|
const totalPaidAmount = partialPaidAmountDecimal.plus(voucherPaymentAmount).toNumber();
|
305
|
+
const syncedPaymentItems = (paymentItems == null ? void 0 : paymentItems.filter((item) => item.isSynced && !item.voucher_id)) || [];
|
306
|
+
if ((syncedPaymentItems == null ? void 0 : syncedPaymentItems.length) > 0 && totalPaidAmount < totalAmount) {
|
307
|
+
return true;
|
308
|
+
}
|
317
309
|
if (totalPaidAmount >= totalAmount) {
|
318
310
|
return false;
|
319
311
|
}
|
@@ -351,7 +343,8 @@ function AmountSummary({
|
|
351
343
|
return false;
|
352
344
|
}
|
353
345
|
if (amount <= 0) {
|
354
|
-
const
|
346
|
+
const unSyncedPaymentItems = paymentItems == null ? void 0 : paymentItems.filter((item) => !item.isSynced);
|
347
|
+
const allItemsHaveVoucherId = unSyncedPaymentItems == null ? void 0 : unSyncedPaymentItems.every(
|
355
348
|
(item) => item.voucher_id
|
356
349
|
);
|
357
350
|
return allItemsHaveVoucherId || (((_a2 = walletPassData == null ? void 0 : walletPassData.selectedDiscountList) == null ? void 0 : _a2.length) ?? 0) > 0;
|
@@ -393,7 +386,7 @@ function AmountSummary({
|
|
393
386
|
};
|
394
387
|
const getMiddleContent = () => {
|
395
388
|
if (paymentType === "deposit") {
|
396
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("payment-details") }, shouldShowPartialPaidCard() && /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("partial-paid-card") }, /* @__PURE__ */ import_react2.default.createElement("span", { className: (0, import_classnames.default)("partial-paid-label") }, getText("partial.paid") || "Partial Paid"), /* @__PURE__ */ import_react2.default.createElement("span", { className: (0, import_classnames.default)("partial-paid-amount") }, (0, import_utils.formatAmountWithOptions)(partialPaidAmount, amountSymbol, {
|
389
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("payment-details") }, shouldShowPartialPaidCard() && /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("partial-paid-card") }, /* @__PURE__ */ import_react2.default.createElement("span", { className: (0, import_classnames.default)("partial-paid-label") }, paymentType === "deposit" ? getText("deposit.partial.paid") || "Deposit Paid" : getText("partial.paid") || "Partial Paid"), /* @__PURE__ */ import_react2.default.createElement("span", { className: (0, import_classnames.default)("partial-paid-amount") }, (0, import_utils.formatAmountWithOptions)(partialPaidAmount, amountSymbol, {
|
397
390
|
precision: 2,
|
398
391
|
hideDecimalForWholeNumbers: false,
|
399
392
|
useThousandsSeparator: true,
|
@@ -440,6 +433,36 @@ function AmountSummary({
|
|
440
433
|
));
|
441
434
|
}
|
442
435
|
};
|
436
|
+
const canSwitch = (0, import_react.useMemo)(() => {
|
437
|
+
if (Number(orderInfo == null ? void 0 : orderInfo.totalAmount) === 0) {
|
438
|
+
return false;
|
439
|
+
}
|
440
|
+
if (paymentType === "regular") {
|
441
|
+
const depositPaidAmount = paymentItems == null ? void 0 : paymentItems.reduce((acc, item) => {
|
442
|
+
if (item.order_payment_type === "deposit") {
|
443
|
+
return acc.plus(item.amount).plus(Math.abs(item.rounding_amount));
|
444
|
+
}
|
445
|
+
return acc;
|
446
|
+
}, new import_decimal.default(0)).toNumber();
|
447
|
+
const depositFlag = depositPaidAmount >= new import_decimal.default((orderInfo == null ? void 0 : orderInfo.depositAmount) || "0").toNumber() && Number(orderInfo == null ? void 0 : orderInfo.depositAmount) > 0;
|
448
|
+
return !(paymentItems == null ? void 0 : paymentItems.some((item) => item.order_payment_type === "normal")) && !depositFlag;
|
449
|
+
} else {
|
450
|
+
const depositPaidAmount = paymentItems == null ? void 0 : paymentItems.reduce((acc, item) => {
|
451
|
+
if (item.order_payment_type === "deposit") {
|
452
|
+
return acc.plus(item.amount);
|
453
|
+
}
|
454
|
+
return acc;
|
455
|
+
}, new import_decimal.default(0)).toNumber();
|
456
|
+
return depositPaidAmount < new import_decimal.default(totalAmount).toNumber();
|
457
|
+
}
|
458
|
+
}, [paymentItems, paymentType, totalAmount]);
|
459
|
+
const showCancelSplitPayment = (0, import_react.useMemo)(() => {
|
460
|
+
return balanceDueAmount !== customAmount;
|
461
|
+
}, [customAmount, balanceDueAmount]);
|
462
|
+
const handleChangeDepositAmount = (value) => {
|
463
|
+
console.log("handleChangeDepositAmount", value);
|
464
|
+
checkoutModule == null ? void 0 : checkoutModule.setDepositAmountAsync(value);
|
465
|
+
};
|
443
466
|
return /* @__PURE__ */ import_react2.default.createElement(
|
444
467
|
"div",
|
445
468
|
{
|
@@ -448,7 +471,7 @@ function AmountSummary({
|
|
448
471
|
"amount-summary-container"
|
449
472
|
)
|
450
473
|
},
|
451
|
-
/* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("left-section") }, open_deposit ? /* @__PURE__ */ import_react2.default.createElement(
|
474
|
+
/* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("left-section") }, open_deposit && canSwitch ? /* @__PURE__ */ import_react2.default.createElement(
|
452
475
|
import_antd.Dropdown,
|
453
476
|
{
|
454
477
|
menu: {
|
@@ -475,11 +498,35 @@ function AmountSummary({
|
|
475
498
|
/* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("middle-section") }, getMiddleContent()),
|
476
499
|
/* @__PURE__ */ import_react2.default.createElement(
|
477
500
|
"div",
|
478
|
-
{
|
479
|
-
"
|
480
|
-
|
501
|
+
{
|
502
|
+
className: (0, import_classnames.default)("balance-due-card", {
|
503
|
+
"confirm-mode": shouldShowConfirmMode()
|
504
|
+
})
|
505
|
+
},
|
481
506
|
// 如果应该显示确认模式,直接返回确认界面
|
482
|
-
shouldShowConfirmMode() ? renderConfirmMode() : /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("balance-due-info") },
|
507
|
+
shouldShowConfirmMode() ? renderConfirmMode() : /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("balance-due-info") }, paymentType === "deposit" ? /* @__PURE__ */ import_react2.default.createElement(
|
508
|
+
import_pisellSimplePriceKeyboardPopover.default,
|
509
|
+
{
|
510
|
+
value: balanceDueAmount || "0",
|
511
|
+
onConfirm: handleChangeDepositAmount,
|
512
|
+
showCurrencySymbol: true,
|
513
|
+
useThousandsSeparator: true,
|
514
|
+
selectType: "dark",
|
515
|
+
overlayClassName: "cash-payment-keyboard-popover"
|
516
|
+
},
|
517
|
+
/* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("balance-due-label") }, getText("deposit.due") || "Deposit Due"), /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("balance-due-amount") }, (0, import_utils.formatAmountWithOptions)(balanceDueAmount, amountSymbol, {
|
518
|
+
precision: 2,
|
519
|
+
hideDecimalForWholeNumbers: false,
|
520
|
+
useThousandsSeparator: true,
|
521
|
+
showCurrencySymbol: true
|
522
|
+
}), /* @__PURE__ */ import_react2.default.createElement(
|
523
|
+
import_icon.Edit05,
|
524
|
+
{
|
525
|
+
className: (0, import_classnames.default)("edit-icon"),
|
526
|
+
style: { color: "#7F56DA" }
|
527
|
+
}
|
528
|
+
)))
|
529
|
+
) : /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("balance-due-label") }, getText("balance.due") || "Balance Due"), /* @__PURE__ */ import_react2.default.createElement("div", { className: (0, import_classnames.default)("balance-due-amount"), onClick: () => {
|
483
530
|
onBalanceDueAmountClick == null ? void 0 : onBalanceDueAmountClick("manual-discount");
|
484
531
|
} }, (0, import_utils.formatAmountWithOptions)(balanceDueAmount, amountSymbol, {
|
485
532
|
precision: 2,
|
@@ -492,8 +539,8 @@ function AmountSummary({
|
|
492
539
|
className: (0, import_classnames.default)("edit-icon"),
|
493
540
|
style: { color: "#7F56DA" }
|
494
541
|
}
|
495
|
-
))),
|
496
|
-
/* @__PURE__ */ import_react2.default.createElement(
|
542
|
+
)))),
|
543
|
+
Number(currentAmount) > 0 && /* @__PURE__ */ import_react2.default.createElement(
|
497
544
|
"div",
|
498
545
|
{
|
499
546
|
className: (0, import_classnames.default)("pay-section"),
|
@@ -519,24 +566,47 @@ function AmountSummary({
|
|
519
566
|
))
|
520
567
|
)
|
521
568
|
),
|
522
|
-
!shouldShowConfirmMode() && /* @__PURE__ */ import_react2.default.createElement(
|
523
|
-
|
569
|
+
!shouldShowConfirmMode() && (showCancelSplitPayment ? /* @__PURE__ */ import_react2.default.createElement(import_antd.Button, { className: (0, import_classnames.default)("cancel-split-payment-button"), onClick: () => onAmountChange == null ? void 0 : onAmountChange(balanceDueAmount) }, getText("split.cancel") || "取消部\n分支付") : /* @__PURE__ */ import_react2.default.createElement(
|
570
|
+
import_antd.Popover,
|
524
571
|
{
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
572
|
+
content: /* @__PURE__ */ import_react2.default.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react2.default.createElement(
|
573
|
+
import_priceKeyboard.PaymentKeyboard,
|
574
|
+
{
|
575
|
+
paymentOriginalValue: balanceDueAmount,
|
576
|
+
paymentDefaultValue: String(customAmount || 0),
|
577
|
+
enableExceedMaxAmount: false,
|
578
|
+
payment: {
|
579
|
+
enable: true
|
580
|
+
},
|
581
|
+
surcharge: {
|
582
|
+
enable: false
|
583
|
+
},
|
584
|
+
surchargeDefaultValue: {
|
585
|
+
percent: "0",
|
586
|
+
fixed: "0"
|
587
|
+
},
|
588
|
+
selectType: "light",
|
589
|
+
onChange: (value) => {
|
590
|
+
console.log(value);
|
591
|
+
},
|
592
|
+
doneText: getText("confirm"),
|
593
|
+
onPay: (args) => {
|
594
|
+
console.log(args);
|
595
|
+
setIsKeyboardVisible(false);
|
596
|
+
handleKeyboardConfirm(args.amount);
|
597
|
+
}
|
530
598
|
}
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
overlayClassName: "
|
599
|
+
)),
|
600
|
+
trigger: "click",
|
601
|
+
open: isKeyboardVisible,
|
602
|
+
onOpenChange: setIsKeyboardVisible,
|
603
|
+
placement: "bottom",
|
604
|
+
overlayClassName: "payment-keyboard-popover",
|
605
|
+
arrow: true,
|
606
|
+
destroyTooltipOnHide: true
|
537
607
|
},
|
538
608
|
/* @__PURE__ */ import_react2.default.createElement(import_antd.Button, { className: (0, import_classnames.default)("split-payment-button") }, getText("split.payment") || "拆分支付")
|
539
|
-
),
|
609
|
+
)),
|
540
610
|
/* @__PURE__ */ import_react2.default.createElement(
|
541
611
|
import_materials.PisellModal,
|
542
612
|
{
|
@@ -476,6 +476,7 @@
|
|
476
476
|
}
|
477
477
|
|
478
478
|
.split-payment-button {
|
479
|
+
width: 80px;
|
479
480
|
padding: 0 8px;
|
480
481
|
background: #079455;
|
481
482
|
color: white;
|
@@ -485,4 +486,16 @@
|
|
485
486
|
white-space: pre-line; // 让换行符(\n)生效
|
486
487
|
text-align: left; // 确保文本居中对齐
|
487
488
|
min-width: 68px;
|
489
|
+
}
|
490
|
+
.cancel-split-payment-button {
|
491
|
+
width: 80px;
|
492
|
+
padding: 0 8px;
|
493
|
+
background: #DF5342;
|
494
|
+
color: white;
|
495
|
+
font-size: 14px;
|
496
|
+
border: 1px solid #C3B2E7;
|
497
|
+
height: 80px;
|
498
|
+
white-space: pre-line; // 让换行符(\n)生效
|
499
|
+
text-align: left; // 确保文本居中对齐
|
500
|
+
min-width: 68px;
|
488
501
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import './index.less';
|
3
2
|
import { CurrentOrderInfo } from '../../types';
|
3
|
+
import './index.less';
|
4
4
|
export interface CashPaymentModuleProps {
|
5
5
|
amountSymbol?: string;
|
6
6
|
orderInfo?: CurrentOrderInfo;
|
@@ -13,8 +13,10 @@ export interface CashPaymentModuleProps {
|
|
13
13
|
roundingDifference: number;
|
14
14
|
}>;
|
15
15
|
balanceDueAmount?: string;
|
16
|
+
syncingLock?: boolean;
|
16
17
|
}
|
17
|
-
export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, //
|
18
|
+
export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表,默认5个推荐金额
|
18
19
|
disabled, // 禁用状态
|
19
|
-
roundingFunction, balanceDueAmount,
|
20
|
+
roundingFunction, balanceDueAmount, // 剩余支付金额
|
21
|
+
syncingLock, }: CashPaymentModuleProps): JSX.Element;
|
20
22
|
export default CashPaymentModule;
|
@@ -34,40 +34,36 @@ __export(CashPaymentModule_exports, {
|
|
34
34
|
});
|
35
35
|
module.exports = __toCommonJS(CashPaymentModule_exports);
|
36
36
|
var import_react = __toESM(require("react"));
|
37
|
-
var import_index = require("./index.less");
|
38
|
-
var import_classnames = __toESM(require("classnames"));
|
39
|
-
var import_icon = require("@pisell/icon");
|
40
|
-
var import_pisellPriceKeyboardPopover = __toESM(require("../../../../pro/pisellPriceKeyboardPopover"));
|
41
37
|
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
42
38
|
var import_utils = require("@pisell/utils");
|
43
39
|
var import_locales = __toESM(require("../../locales"));
|
44
40
|
var import_useToast = __toESM(require("../../../../hooks/useToast"));
|
45
41
|
var import_ahooks = require("ahooks");
|
42
|
+
var import_priceKeyboard = require("../../../../pro/priceKeyboard");
|
43
|
+
var import_index = require("./index.less");
|
46
44
|
function CashPaymentModule({
|
47
45
|
amountSymbol,
|
48
46
|
orderInfo,
|
49
47
|
onPaymentComplete,
|
50
48
|
customAmount,
|
51
49
|
amountButtons = [],
|
52
|
-
//
|
50
|
+
// 按钮列表,默认5个推荐金额
|
53
51
|
disabled = false,
|
54
52
|
// 禁用状态
|
55
53
|
roundingFunction,
|
56
|
-
balanceDueAmount = "0"
|
54
|
+
balanceDueAmount = "0",
|
57
55
|
// 剩余支付金额
|
56
|
+
syncingLock = false
|
57
|
+
// 是否锁定
|
58
58
|
}) {
|
59
59
|
const [amount, setAmount] = (0, import_react.useState)(customAmount || "");
|
60
60
|
const [roundingAmount, setRoundingAmount] = (0, import_react.useState)(0);
|
61
|
-
const [amountList, setAmountList] = (0, import_react.useState)(amountButtons.length ? amountButtons : new Array(6).fill(0));
|
62
|
-
(0, import_react.useEffect)(() => {
|
63
|
-
setAmountList(amountButtons.length ? amountButtons : new Array(6).fill(0));
|
64
|
-
}, [amountButtons]);
|
65
61
|
const context = (0, import_useEngineContext.default)();
|
66
62
|
const Toast = (0, import_useToast.default)();
|
67
63
|
const getText = (key, fallback) => {
|
68
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
69
|
-
const currentLang = ((_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 :
|
70
|
-
const checkoutText = (
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
65
|
+
const currentLang = ((_f = (_e = (_d = (_c = (_b = (_a = context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.locales) == null ? void 0 : _e.getLocale) == null ? void 0 : _f.call(_e)) || ((_h = (_g = context.appHelper.utils) == null ? void 0 : _g.storage) == null ? void 0 : _h.get("umi_locale")) || "en";
|
66
|
+
const checkoutText = (_i = import_locales.default[currentLang]) == null ? void 0 : _i[key];
|
71
67
|
if (checkoutText) {
|
72
68
|
return checkoutText;
|
73
69
|
}
|
@@ -88,7 +84,12 @@ function CashPaymentModule({
|
|
88
84
|
if (isAmountButtonsDisabled) return;
|
89
85
|
if (onPaymentComplete) {
|
90
86
|
if (Number(amount) === 0 && Math.abs(roundingAmount) === 0) {
|
91
|
-
Toast.fail(
|
87
|
+
Toast.fail(
|
88
|
+
getText(
|
89
|
+
"cash-payment-amount-cannot-be-zero",
|
90
|
+
"The amount cannot be 0"
|
91
|
+
)
|
92
|
+
);
|
92
93
|
return;
|
93
94
|
}
|
94
95
|
const finalAmount = typeof amount === "number" ? amount : Number(amount) || 0;
|
@@ -102,7 +103,9 @@ function CashPaymentModule({
|
|
102
103
|
}
|
103
104
|
};
|
104
105
|
const { run: handleCashPay } = (0, import_ahooks.useDebounceFn)(handleCashPayInternal, {
|
105
|
-
wait:
|
106
|
+
wait: 500,
|
107
|
+
leading: true,
|
108
|
+
trailing: false
|
106
109
|
});
|
107
110
|
const handleKeyboardConfirm = async (value) => {
|
108
111
|
if (isInputDisabled) {
|
@@ -110,11 +113,12 @@ function CashPaymentModule({
|
|
110
113
|
setRoundingAmount(0);
|
111
114
|
return;
|
112
115
|
}
|
113
|
-
;
|
114
116
|
const finalValue = String(value);
|
115
117
|
console.log("键盘确认:", finalValue);
|
116
118
|
if (Number(finalValue) === 0) {
|
117
|
-
Toast.fail(
|
119
|
+
Toast.fail(
|
120
|
+
getText("cash-payment-amount-cannot-be-zero", "The amount cannot be 0")
|
121
|
+
);
|
118
122
|
return;
|
119
123
|
}
|
120
124
|
if (finalValue === "" || finalValue === null || finalValue === void 0) {
|
@@ -131,9 +135,21 @@ function CashPaymentModule({
|
|
131
135
|
const { roundedAmount = numValue, roundingDifference = 0 } = result || {};
|
132
136
|
finalAmount = roundedAmount;
|
133
137
|
roundingDiff = roundingDifference;
|
134
|
-
console.log(
|
138
|
+
console.log(
|
139
|
+
"应用抹零:",
|
140
|
+
numValue,
|
141
|
+
"->",
|
142
|
+
roundedAmount,
|
143
|
+
"差额:",
|
144
|
+
roundingDifference
|
145
|
+
);
|
135
146
|
} else {
|
136
|
-
console.log(
|
147
|
+
console.log(
|
148
|
+
"不应用抹零,用户输入金额:",
|
149
|
+
numValue,
|
150
|
+
"剩余支付金额:",
|
151
|
+
balanceDue
|
152
|
+
);
|
137
153
|
}
|
138
154
|
setRoundingAmount(roundingDiff);
|
139
155
|
if (isNaN(numValue)) {
|
@@ -144,126 +160,77 @@ function CashPaymentModule({
|
|
144
160
|
}
|
145
161
|
}
|
146
162
|
};
|
147
|
-
const
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
const
|
153
|
-
|
154
|
-
|
163
|
+
const handleReset = async () => {
|
164
|
+
if (isAmountButtonsDisabled) return;
|
165
|
+
const resetAmount = balanceDueAmount || "0";
|
166
|
+
const cleanValue = resetAmount.replace(/[$\s]/g, "");
|
167
|
+
const numValue = parseFloat(cleanValue);
|
168
|
+
const balanceDue = parseFloat(balanceDueAmount);
|
169
|
+
const shouldApplyRounding = Math.abs(numValue - balanceDue) < 0.01;
|
170
|
+
let finalAmount = numValue;
|
171
|
+
let roundingDiff = 0;
|
172
|
+
if (shouldApplyRounding && roundingFunction) {
|
173
|
+
const result = await roundingFunction(finalAmount);
|
174
|
+
const { roundedAmount = numValue, roundingDifference = 0 } = result || {};
|
175
|
+
finalAmount = roundedAmount;
|
176
|
+
roundingDiff = roundingDifference;
|
177
|
+
console.log(
|
178
|
+
"应用抹零:",
|
179
|
+
numValue,
|
180
|
+
"->",
|
181
|
+
roundedAmount,
|
182
|
+
"差额:",
|
183
|
+
roundingDifference
|
184
|
+
);
|
185
|
+
} else {
|
186
|
+
console.log(
|
187
|
+
"不应用抹零,用户输入金额:",
|
188
|
+
numValue,
|
189
|
+
"剩余支付金额:",
|
190
|
+
balanceDue
|
191
|
+
);
|
192
|
+
}
|
193
|
+
setAmount(finalAmount.toString());
|
194
|
+
setRoundingAmount(roundingDiff);
|
155
195
|
};
|
156
196
|
return /* @__PURE__ */ import_react.default.createElement(
|
157
|
-
|
197
|
+
import_priceKeyboard.CashKeyboard,
|
158
198
|
{
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
className: (0, import_classnames.default)("cash-pay-main-content", {
|
168
|
-
"cash-pay-main-content--disabled": disabled
|
169
|
-
})
|
199
|
+
variant: "intact",
|
200
|
+
originalValue: customAmount,
|
201
|
+
value: amount,
|
202
|
+
disabled,
|
203
|
+
hiddenChangeDue: roundingAmount > 0,
|
204
|
+
onChange: (value) => {
|
205
|
+
setAmount(value);
|
206
|
+
setRoundingAmount(0);
|
170
207
|
},
|
171
|
-
|
172
|
-
|
173
|
-
{
|
174
|
-
|
175
|
-
onConfirm: handleKeyboardConfirm,
|
176
|
-
onCancel: handleKeyboardCancel,
|
177
|
-
showCurrencySymbol: true,
|
178
|
-
useThousandsSeparator: true,
|
179
|
-
selectType: "dark",
|
180
|
-
overlayClassName: "cash-payment-keyboard-popover",
|
181
|
-
disabled: isInputDisabled
|
182
|
-
},
|
183
|
-
/* @__PURE__ */ import_react.default.createElement(
|
184
|
-
"div",
|
185
|
-
{
|
186
|
-
className: (0, import_classnames.default)("cash-pay-amount-input-area", {
|
187
|
-
"cash-pay-amount-input-area--disabled": isInputDisabled
|
188
|
-
})
|
189
|
-
},
|
190
|
-
/* @__PURE__ */ import_react.default.createElement(
|
191
|
-
import_icon.Edit05,
|
192
|
-
{
|
193
|
-
className: (0, import_classnames.default)("cash-pay-amount-edit-icon", {
|
194
|
-
"cash-pay-amount-edit-icon--disabled": isInputDisabled
|
195
|
-
})
|
196
|
-
}
|
197
|
-
),
|
198
|
-
/* @__PURE__ */ import_react.default.createElement(
|
199
|
-
"div",
|
200
|
-
{
|
201
|
-
className: (0, import_classnames.default)("cash-pay-amount-input-wrapper", {
|
202
|
-
"cash-pay-amount-input-wrapper--disabled": isInputDisabled
|
203
|
-
})
|
204
|
-
},
|
205
|
-
/* @__PURE__ */ import_react.default.createElement(
|
206
|
-
"span",
|
207
|
-
{
|
208
|
-
className: (0, import_classnames.default)("cash-pay-currency-symbol", {
|
209
|
-
"cash-pay-currency-symbol--disabled": isInputDisabled
|
210
|
-
})
|
211
|
-
},
|
212
|
-
amountSymbol
|
213
|
-
),
|
214
|
-
/* @__PURE__ */ import_react.default.createElement(
|
215
|
-
"div",
|
216
|
-
{
|
217
|
-
className: (0, import_classnames.default)("cash-pay-amount-display", {
|
218
|
-
"cash-pay-amount-display--disabled": isInputDisabled
|
219
|
-
})
|
220
|
-
},
|
221
|
-
amount || "0.00"
|
222
|
-
)
|
223
|
-
)
|
224
|
-
)
|
225
|
-
), /* @__PURE__ */ import_react.default.createElement(
|
226
|
-
"div",
|
227
|
-
{
|
228
|
-
className: (0, import_classnames.default)("cash-pay-button", {
|
229
|
-
"cash-pay-button--disabled": isAmountButtonsDisabled
|
230
|
-
}),
|
231
|
-
...isAmountButtonsDisabled ? {} : { onClick: handleCashPay },
|
232
|
-
style: { cursor: isAmountButtonsDisabled ? "not-allowed" : "pointer" }
|
233
|
-
},
|
234
|
-
/* @__PURE__ */ import_react.default.createElement(
|
235
|
-
"div",
|
236
|
-
{
|
237
|
-
className: (0, import_classnames.default)("cash-pay-button-text", {
|
238
|
-
"cash-pay-button-text--disabled": isAmountButtonsDisabled
|
239
|
-
})
|
240
|
-
},
|
241
|
-
getText("cash.payment") || "Cash Pay"
|
242
|
-
)
|
243
|
-
)),
|
244
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("cash-pay-amount-button-grid", {
|
245
|
-
"cash-pay-amount-button-grid--disabled": isAmountButtonsDisabled
|
246
|
-
}) }, amountList.slice(0, 6).map((amount2, index) => /* @__PURE__ */ import_react.default.createElement(
|
247
|
-
"div",
|
248
|
-
{
|
249
|
-
key: index,
|
250
|
-
className: (0, import_classnames.default)("cash-pay-amount-button", {
|
251
|
-
"cash-pay-amount-button--disabled": isAmountButtonsDisabled
|
252
|
-
}),
|
253
|
-
...isAmountButtonsDisabled ? {} : { onClick: () => handleAmountClick(amount2) },
|
254
|
-
style: { cursor: isAmountButtonsDisabled ? "not-allowed" : "pointer" }
|
208
|
+
titleArea: {
|
209
|
+
visible: true,
|
210
|
+
title: {
|
211
|
+
text: getText("cash-payment-title", "Cash Payment")
|
255
212
|
},
|
256
|
-
|
257
|
-
|
258
|
-
{
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
213
|
+
subtitle: {
|
214
|
+
visible: Math.abs(roundingAmount) > 0,
|
215
|
+
text: `${getText(
|
216
|
+
"cash-payment-rounding",
|
217
|
+
"Rounding"
|
218
|
+
)}: ${(0, import_utils.formatAmount)(roundingAmount, 2, amountSymbol)}`
|
219
|
+
}
|
220
|
+
},
|
221
|
+
style: {
|
222
|
+
width: "100%",
|
223
|
+
backgroundColor: "transparent"
|
224
|
+
},
|
225
|
+
presets: amountButtons.slice(0, 5).map((buttonAmount) => {
|
226
|
+
return {
|
227
|
+
label: (0, import_utils.formatAmount)(buttonAmount, 2, amountSymbol),
|
228
|
+
value: buttonAmount
|
229
|
+
};
|
230
|
+
}),
|
231
|
+
onReset: handleReset,
|
232
|
+
onEnter: syncingLock ? void 0 : handleCashPay
|
233
|
+
}
|
267
234
|
);
|
268
235
|
}
|
269
236
|
var CashPaymentModule_default = CashPaymentModule;
|