ordering-ui-admin-external 1.43.56 → 1.43.58
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/_bundles/{ordering-ui-admin.630caf46d37ee75b00b8.js → ordering-ui-admin.e07c60a28fcccceee6ae.js} +2 -2
- package/_modules/components/Orders/OrderBill/RefundToWallet.js +4 -4
- package/_modules/components/Orders/OrderBill/index.js +2 -2
- package/_modules/components/Orders/OrderToPrintTicket/index.js +24 -8
- package/package.json +1 -1
- package/src/components/Orders/OrderBill/RefundToWallet.js +2 -2
- package/src/components/Orders/OrderBill/index.js +1 -1
- package/src/components/Orders/OrderToPrintTicket/index.js +22 -9
- /package/_bundles/{ordering-ui-admin.630caf46d37ee75b00b8.js.LICENSE.txt → ordering-ui-admin.e07c60a28fcccceee6ae.js.LICENSE.txt} +0 -0
|
@@ -74,7 +74,7 @@ var RefundToWallet = exports.RefundToWallet = function RefundToWallet(props) {
|
|
|
74
74
|
refundOptions = _useState14[0],
|
|
75
75
|
setRefundOptions = _useState14[1];
|
|
76
76
|
var onSubmit = function onSubmit(formData) {
|
|
77
|
-
var _order$summary;
|
|
77
|
+
var _order$summary$total, _order$summary;
|
|
78
78
|
if (!selectedRefundOption) {
|
|
79
79
|
setAlertState({
|
|
80
80
|
open: true,
|
|
@@ -87,7 +87,7 @@ var RefundToWallet = exports.RefundToWallet = function RefundToWallet(props) {
|
|
|
87
87
|
data.order_payment_event_id = selectedRefundOption;
|
|
88
88
|
}
|
|
89
89
|
if (formData.description) data.description = formData.description;
|
|
90
|
-
data.amount = isRefundAll ? (order === null || order === void 0 || (_order$summary = order.summary) === null || _order$summary === void 0 ? void 0 : _order$summary.total)
|
|
90
|
+
data.amount = isRefundAll ? (_order$summary$total = order === null || order === void 0 || (_order$summary = order.summary) === null || _order$summary === void 0 ? void 0 : _order$summary.total) !== null && _order$summary$total !== void 0 ? _order$summary$total : order === null || order === void 0 ? void 0 : order.total : formData.amount;
|
|
91
91
|
data.transfer_to = selectedRefundOption !== 'cash_wallet' ? 'source' : 'cash_wallet';
|
|
92
92
|
handleOrderRefund(data);
|
|
93
93
|
};
|
|
@@ -104,7 +104,7 @@ var RefundToWallet = exports.RefundToWallet = function RefundToWallet(props) {
|
|
|
104
104
|
}
|
|
105
105
|
}, [errors]);
|
|
106
106
|
(0, _react.useEffect)(function () {
|
|
107
|
-
var _order$paymethod, _order$payment_events, _order$summary2, _order$payment_events2;
|
|
107
|
+
var _order$paymethod, _order$payment_events, _order$summary$total2, _order$summary2, _order$payment_events2;
|
|
108
108
|
setSelectedRefundOption(null);
|
|
109
109
|
setRefundDisabled(false);
|
|
110
110
|
setRefundAllDisabled(false);
|
|
@@ -118,7 +118,7 @@ var RefundToWallet = exports.RefundToWallet = function RefundToWallet(props) {
|
|
|
118
118
|
}).reduce(function (total, event) {
|
|
119
119
|
return total + ((event === null || event === void 0 ? void 0 : event.amount) || 0);
|
|
120
120
|
}, 0)) || 0;
|
|
121
|
-
if (totalRefundAmount === ((order === null || order === void 0 || (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.total)
|
|
121
|
+
if (totalRefundAmount === ((_order$summary$total2 = order === null || order === void 0 || (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.total) !== null && _order$summary$total2 !== void 0 ? _order$summary$total2 : order === null || order === void 0 ? void 0 : order.total)) {
|
|
122
122
|
setRefundDisabled(true);
|
|
123
123
|
}
|
|
124
124
|
if (totalRefundAmount) {
|
|
@@ -26,7 +26,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
26
26
|
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; } }
|
|
27
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
28
|
var OrderBill = exports.OrderBill = function OrderBill(props) {
|
|
29
|
-
var _order$products, _order$metafields, _order$metafields$fin, _order$summary$subtot, _order$summary2, _ref, _order$summary3, _order$offers, _order$summary$discou, _order$summary4, _order$offers2, _order$offers3, _order$summary5, _order$summary6, _order$summary7, _ref2, _order$summary8, _order$summary$subtot2, _order$summary9, _order$taxes3, _order$summary$tax2, _order$summary10, _order$fees, _order$summary$servic, _order$summary11, _order$taxes4, _order$taxes5, _order$fees2, _order$fees3, _order$offers4, _order$offers5, _order$summary12, _order$summary13, _order$taxes6, _order$taxes7, _order$offers6, _order$offers7, _order$summary14, _order$summary15, _configs$driver_tip_t, _configs$driver_tip_u, _order$summary$driver, _order$summary16, _extraValueAdjustment, _order$summary17, _order$payment_events, _order$payment_events2, _order$payment_events3, _order$payment_events4, _order$delivery_optio, _order$vehicle, _order$vehicle2, _order$vehicle3, _order$vehicle4, _order$vehicle5, _order$paymethod, _order$payment_events5;
|
|
29
|
+
var _order$products, _order$metafields, _order$metafields$fin, _order$summary$subtot, _order$summary2, _ref, _order$summary3, _order$offers, _order$summary$discou, _order$summary4, _order$offers2, _order$offers3, _order$summary5, _order$summary6, _order$summary7, _ref2, _order$summary8, _order$summary$subtot2, _order$summary9, _order$taxes3, _order$summary$tax2, _order$summary10, _order$fees, _order$summary$servic, _order$summary11, _order$taxes4, _order$taxes5, _order$fees2, _order$fees3, _order$offers4, _order$offers5, _order$summary12, _order$summary13, _order$taxes6, _order$taxes7, _order$offers6, _order$offers7, _order$summary14, _order$summary15, _configs$driver_tip_t, _configs$driver_tip_u, _order$summary$driver, _order$summary16, _extraValueAdjustment, _order$summary$total, _order$summary17, _order$payment_events, _order$payment_events2, _order$payment_events3, _order$payment_events4, _order$delivery_optio, _order$vehicle, _order$vehicle2, _order$vehicle3, _order$vehicle4, _order$vehicle5, _order$paymethod, _order$payment_events5;
|
|
30
30
|
var order = props.order,
|
|
31
31
|
actionStatus = props.actionStatus,
|
|
32
32
|
handleRefundPaymentsStripe = props.handleRefundPaymentsStripe,
|
|
@@ -198,7 +198,7 @@ var OrderBill = exports.OrderBill = function OrderBill(props) {
|
|
|
198
198
|
currency: (0, _utils.getCurrenySymbol)(order === null || order === void 0 ? void 0 : order.currency)
|
|
199
199
|
}))))), /*#__PURE__*/_react.default.createElement("table", {
|
|
200
200
|
className: "total"
|
|
201
|
-
}, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((order === null || order === void 0 || (_order$summary17 = order.summary) === null || _order$summary17 === void 0 ? void 0 : _order$summary17.total)
|
|
201
|
+
}, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((_order$summary$total = order === null || order === void 0 || (_order$summary17 = order.summary) === null || _order$summary17 === void 0 ? void 0 : _order$summary17.total) !== null && _order$summary$total !== void 0 ? _order$summary$total : order === null || order === void 0 ? void 0 : order.total, {
|
|
202
202
|
currency: (0, _utils.getCurrenySymbol)(order === null || order === void 0 ? void 0 : order.currency)
|
|
203
203
|
}))))), (order === null || order === void 0 || (_order$payment_events = order.payment_events) === null || _order$payment_events === void 0 ? void 0 : _order$payment_events.length) > 0 && /*#__PURE__*/_react.default.createElement("table", {
|
|
204
204
|
className: "payments"
|
|
@@ -19,7 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
19
19
|
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; } }
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
21
|
var OrderToPrintTicket = exports.OrderToPrintTicket = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
22
|
-
var _configs$driver_tip_t, _configs$driver_tip_u, _order$
|
|
22
|
+
var _configs$driver_tip_t, _configs$driver_tip_u, _order$summary2, _replace$trim, _ref2, _order$customer$name, _order$customer, _order$customer$middl, _order$customer2, _order$customer$lastn, _order$customer3, _order$customer$secon, _order$customer4, _getOrderStatus, _order$paymethod, _order$customer5, _order$customer6, _order$customer7, _order$customer8, _order$customer9, _order$customer10, _order$customer11, _order$customer12, _order$business, _order$business2, _order$business3, _order$business4, _order$business5, _order$business6, _order$business7, _order$business8, _order$business9, _order$products, _order$products2, _ref3, _order$summary3, _order$summary4, _order$summary$subtot, _order$summary5, _order$summary6, _order$summary7, _order$summary8, _order$summary9, _order$summary$tax2, _order$summary10, _order$summary11, _order$summary12, _order$summary$driver, _order$summary13, _order$summary14, _order$summary$servic, _order$summary15, _order$summary$total, _order$summary16;
|
|
23
23
|
var order = props.order,
|
|
24
24
|
getOrderStatus = props.getOrderStatus;
|
|
25
25
|
var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
|
|
@@ -88,25 +88,38 @@ var OrderToPrintTicket = exports.OrderToPrintTicket = /*#__PURE__*/(0, _react.fo
|
|
|
88
88
|
};
|
|
89
89
|
var getSuboptions = function getSuboptions(suboptions) {
|
|
90
90
|
var array = [];
|
|
91
|
-
|
|
91
|
+
suboptions && suboptions.length > 0 && suboptions.map(function (suboption) {
|
|
92
92
|
var string = "".concat(getFormattedSubOptionName(suboption));
|
|
93
93
|
array.push(string);
|
|
94
|
-
})
|
|
94
|
+
});
|
|
95
95
|
return array.join('');
|
|
96
96
|
};
|
|
97
|
+
var getIncludedTaxes = function getIncludedTaxes(isDeliveryFee) {
|
|
98
|
+
var _order$taxes;
|
|
99
|
+
if (!(order !== null && order !== void 0 && order.taxes)) return 0;
|
|
100
|
+
if ((order === null || order === void 0 || (_order$taxes = order.taxes) === null || _order$taxes === void 0 ? void 0 : _order$taxes.length) === 0) {
|
|
101
|
+
var _order$summary$tax, _order$summary;
|
|
102
|
+
return order.tax_type === 1 ? (_order$summary$tax = order === null || order === void 0 || (_order$summary = order.summary) === null || _order$summary === void 0 ? void 0 : _order$summary.tax) !== null && _order$summary$tax !== void 0 ? _order$summary$tax : 0 : 0;
|
|
103
|
+
} else {
|
|
104
|
+
return order === null || order === void 0 ? void 0 : order.taxes.reduce(function (taxIncluded, tax) {
|
|
105
|
+
var _tax$summary;
|
|
106
|
+
return taxIncluded + (!isDeliveryFee && tax.type === 1 && tax.target === 'product' || isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee' ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
|
|
107
|
+
}, 0);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
97
110
|
var getOptions = function getOptions(options) {
|
|
98
111
|
var productComment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
99
112
|
var array = [];
|
|
100
|
-
|
|
113
|
+
options && options.length && options.map(function (option) {
|
|
101
114
|
var string = "".concat(option.name, " ").concat(getSuboptions(option.suboptions));
|
|
102
115
|
array.push(string);
|
|
103
|
-
})
|
|
116
|
+
});
|
|
104
117
|
if (productComment) {
|
|
105
118
|
array.push("".concat(t('COMMENT', 'Comment')).concat(productComment));
|
|
106
119
|
}
|
|
107
120
|
return array;
|
|
108
121
|
};
|
|
109
|
-
var percentTip = parseInt(configs === null || configs === void 0 || (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 || (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && (0, _utils.verifyDecimals)(order === null || order === void 0 || (_order$
|
|
122
|
+
var percentTip = parseInt(configs === null || configs === void 0 || (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 || (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && (0, _utils.verifyDecimals)(order === null || order === void 0 || (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.driver_tip, parseNumber);
|
|
110
123
|
var customerName = (_replace$trim = (_ref2 = "".concat((_order$customer$name = order === null || order === void 0 || (_order$customer = order.customer) === null || _order$customer === void 0 ? void 0 : _order$customer.name) !== null && _order$customer$name !== void 0 ? _order$customer$name : '', " ").concat((_order$customer$middl = order === null || order === void 0 || (_order$customer2 = order.customer) === null || _order$customer2 === void 0 ? void 0 : _order$customer2.middle_name) !== null && _order$customer$middl !== void 0 ? _order$customer$middl : '', " ").concat((_order$customer$lastn = order === null || order === void 0 || (_order$customer3 = order.customer) === null || _order$customer3 === void 0 ? void 0 : _order$customer3.lastname) !== null && _order$customer$lastn !== void 0 ? _order$customer$lastn : '', " ").concat((_order$customer$secon = order === null || order === void 0 || (_order$customer4 = order.customer) === null || _order$customer4 === void 0 ? void 0 : _order$customer4.second_lastname) !== null && _order$customer$secon !== void 0 ? _order$customer$secon : '')) === null || _ref2 === void 0 || (_ref2 = _ref2.replace(' ', ' ')) === null || _ref2 === void 0 ? void 0 : _ref2.trim()) !== null && _replace$trim !== void 0 ? _replace$trim : '';
|
|
111
124
|
return /*#__PURE__*/_react.default.createElement(_styles.PrintContainer, {
|
|
112
125
|
ref: ref
|
|
@@ -121,5 +134,8 @@ var OrderToPrintTicket = exports.OrderToPrintTicket = /*#__PURE__*/(0, _react.fo
|
|
|
121
134
|
key: i
|
|
122
135
|
}, option);
|
|
123
136
|
})));
|
|
124
|
-
}))), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('SUBTOTAL', 'Subtotal')), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((order === null || order === void 0 ? void 0 : order.tax_type) === 1 ? (_ref3 = (order === null || order === void 0 || (_order$
|
|
125
|
-
|
|
137
|
+
}))), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('SUBTOTAL', 'Subtotal')), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((order === null || order === void 0 ? void 0 : order.tax_type) === 1 ? (_ref3 = (order === null || order === void 0 || (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.subtotal) + (order === null || order === void 0 || (_order$summary4 = order.summary) === null || _order$summary4 === void 0 ? void 0 : _order$summary4.tax)) !== null && _ref3 !== void 0 ? _ref3 : 0 : (_order$summary$subtot = order === null || order === void 0 || (_order$summary5 = order.summary) === null || _order$summary5 === void 0 ? void 0 : _order$summary5.subtotal) !== null && _order$summary$subtot !== void 0 ? _order$summary$subtot : 0))), /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, (order === null || order === void 0 || (_order$summary6 = order.summary) === null || _order$summary6 === void 0 ? void 0 : _order$summary6.discount) > 0 ? (order === null || order === void 0 ? void 0 : order.offer_type) === 1 ? /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('DISCOUNT', 'Discount'), " (", (0, _utils.verifyDecimals)(order === null || order === void 0 ? void 0 : order.offer_rate, parsePrice), "%)") : /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, " ", t('DISCOUNT', 'Discount')) : '', (order === null || order === void 0 || (_order$summary7 = order.summary) === null || _order$summary7 === void 0 ? void 0 : _order$summary7.discount) > 0 ? /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, "- ", parsePrice(order === null || order === void 0 || (_order$summary8 = order.summary) === null || _order$summary8 === void 0 ? void 0 : _order$summary8.discount)) : ''), (order === null || order === void 0 ? void 0 : order.tax_type) !== 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('TAX', 'Tax'), ' ', "(".concat((0, _utils.verifyDecimals)(order === null || order === void 0 || (_order$summary9 = order.summary) === null || _order$summary9 === void 0 ? void 0 : _order$summary9.tax_rate, parseNumber), "%)")), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((_order$summary$tax2 = order === null || order === void 0 || (_order$summary10 = order.summary) === null || _order$summary10 === void 0 ? void 0 : _order$summary10.tax) !== null && _order$summary$tax2 !== void 0 ? _order$summary$tax2 : 0)))), (order === null || order === void 0 || (_order$summary11 = order.summary) === null || _order$summary11 === void 0 ? void 0 : _order$summary11.delivery_price) > 0 && /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('DELIVERY_FEE', 'Delivery Fee')), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((order === null || order === void 0 || (_order$summary12 = order.summary) === null || _order$summary12 === void 0 ? void 0 : _order$summary12.delivery_price) + getIncludedTaxes(true), {
|
|
138
|
+
currency: (0, _utils.getCurrenySymbol)(order === null || order === void 0 ? void 0 : order.currency)
|
|
139
|
+
}))), /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('DRIVER_TIP', 'Driver tip'), percentTip ? "(".concat(percentTip, "%)") : ''), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((_order$summary$driver = order === null || order === void 0 || (_order$summary13 = order.summary) === null || _order$summary13 === void 0 ? void 0 : _order$summary13.driver_tip) !== null && _order$summary$driver !== void 0 ? _order$summary$driver : 0))), /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('SERVICE_FEE', 'Service Fee'), "(", (0, _utils.verifyDecimals)(order === null || order === void 0 || (_order$summary14 = order.summary) === null || _order$summary14 === void 0 ? void 0 : _order$summary14.service_fee, parseNumber), "%)"), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((_order$summary$servic = order === null || order === void 0 || (_order$summary15 = order.summary) === null || _order$summary15 === void 0 ? void 0 : _order$summary15.service_fee) !== null && _order$summary$servic !== void 0 ? _order$summary$servic : 0))), /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, null, /*#__PURE__*/_react.default.createElement(_styles.InsideInfo, null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement(_styles.InsideInfo2, null, parsePrice((_order$summary$total = order === null || order === void 0 || (_order$summary16 = order.summary) === null || _order$summary16 === void 0 ? void 0 : _order$summary16.total) !== null && _order$summary$total !== void 0 ? _order$summary$total : 0))));
|
|
140
|
+
});
|
|
141
|
+
OrderToPrintTicket.displayName = 'OrderToPrintTicket';
|
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ export const RefundToWallet = (props) => {
|
|
|
54
54
|
data.order_payment_event_id = selectedRefundOption
|
|
55
55
|
}
|
|
56
56
|
if (formData.description) data.description = formData.description
|
|
57
|
-
data.amount = isRefundAll ? (order?.summary?.total
|
|
57
|
+
data.amount = isRefundAll ? (order?.summary?.total ?? order?.total) : formData.amount
|
|
58
58
|
data.transfer_to = selectedRefundOption !== 'cash_wallet' ? 'source' : 'cash_wallet'
|
|
59
59
|
handleOrderRefund(data)
|
|
60
60
|
}
|
|
@@ -79,7 +79,7 @@ export const RefundToWallet = (props) => {
|
|
|
79
79
|
}
|
|
80
80
|
if (!order?.payment_events) return
|
|
81
81
|
const totalRefundAmount = order?.payment_events?.filter(item => item.event === 'refund').reduce((total, event) => total + (event?.amount || 0), 0) || 0
|
|
82
|
-
if (totalRefundAmount === (order?.summary?.total
|
|
82
|
+
if (totalRefundAmount === (order?.summary?.total ?? order?.total)) {
|
|
83
83
|
setRefundDisabled(true)
|
|
84
84
|
}
|
|
85
85
|
if (totalRefundAmount) {
|
|
@@ -252,7 +252,7 @@ export const OrderBill = (props) => {
|
|
|
252
252
|
<tbody>
|
|
253
253
|
<tr>
|
|
254
254
|
<td>{t('TOTAL', 'Total')}</td>
|
|
255
|
-
<td>{parsePrice(order?.summary?.total
|
|
255
|
+
<td>{parsePrice(order?.summary?.total ?? order?.total, { currency: getCurrenySymbol(order?.currency) })}</td>
|
|
256
256
|
</tr>
|
|
257
257
|
</tbody>
|
|
258
258
|
</table>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
|
-
import { verifyDecimals } from '../../../utils'
|
|
2
|
+
import { getCurrenySymbol, verifyDecimals } from '../../../utils'
|
|
3
3
|
import { useUtils, useLanguage, useConfig } from 'ordering-components-admin-external'
|
|
4
4
|
import { PrintContainer, PrintTextContainer, ProductComments, ProdcutCommentsContainer, Products, InfoContainer, InsideInfo2, InsideInfo, PrintProductsContainer, PrintProducts } from './styles'
|
|
5
5
|
|
|
@@ -50,8 +50,8 @@ export const OrderToPrintTicket = forwardRef((props, ref) => {
|
|
|
50
50
|
|
|
51
51
|
const getSuboptions = (suboptions) => {
|
|
52
52
|
const array = []
|
|
53
|
-
suboptions
|
|
54
|
-
suboptions
|
|
53
|
+
suboptions && suboptions.length > 0 &&
|
|
54
|
+
suboptions.map((suboption) => {
|
|
55
55
|
const string = `${getFormattedSubOptionName(suboption)}`
|
|
56
56
|
array.push(string)
|
|
57
57
|
})
|
|
@@ -59,11 +59,22 @@ export const OrderToPrintTicket = forwardRef((props, ref) => {
|
|
|
59
59
|
return array.join('')
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
const getIncludedTaxes = (isDeliveryFee) => {
|
|
63
|
+
if (!order?.taxes) return 0
|
|
64
|
+
if (order?.taxes?.length === 0) {
|
|
65
|
+
return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
|
|
66
|
+
} else {
|
|
67
|
+
return order?.taxes.reduce((taxIncluded, tax) => {
|
|
68
|
+
return taxIncluded + (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') || (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
|
|
69
|
+
}, 0)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
const getOptions = (options, productComment = '') => {
|
|
63
74
|
const array = []
|
|
64
75
|
|
|
65
|
-
options
|
|
66
|
-
options
|
|
76
|
+
options && options.length &&
|
|
77
|
+
options.map((option) => {
|
|
67
78
|
const string =
|
|
68
79
|
`${option.name} ${getSuboptions(option.suboptions)}`
|
|
69
80
|
array.push(string)
|
|
@@ -175,9 +186,9 @@ export const OrderToPrintTicket = forwardRef((props, ref) => {
|
|
|
175
186
|
</InsideInfo>
|
|
176
187
|
<InsideInfo2>
|
|
177
188
|
{parsePrice(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
order?.tax_type === 1
|
|
190
|
+
? order?.summary?.subtotal + order?.summary?.tax ?? 0
|
|
191
|
+
: order?.summary?.subtotal ?? 0
|
|
181
192
|
)}
|
|
182
193
|
</InsideInfo2>
|
|
183
194
|
</InfoContainer>
|
|
@@ -213,7 +224,7 @@ export const OrderToPrintTicket = forwardRef((props, ref) => {
|
|
|
213
224
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
214
225
|
</InsideInfo>
|
|
215
226
|
<InsideInfo2>
|
|
216
|
-
{parsePrice(order?.summary?.delivery_price)}
|
|
227
|
+
{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true), { currency: getCurrenySymbol(order?.currency) })}
|
|
217
228
|
</InsideInfo2>
|
|
218
229
|
</InfoContainer>
|
|
219
230
|
)}
|
|
@@ -249,3 +260,5 @@ export const OrderToPrintTicket = forwardRef((props, ref) => {
|
|
|
249
260
|
</PrintContainer>
|
|
250
261
|
)
|
|
251
262
|
})
|
|
263
|
+
|
|
264
|
+
OrderToPrintTicket.displayName = 'OrderToPrintTicket'
|