ordering-ui-external 1.9.3 → 1.9.5
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/{0.ordering-ui.ea0875b41af5b7f1d809.js → 0.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{1.ordering-ui.ea0875b41af5b7f1d809.js → 1.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{2.ordering-ui.ea0875b41af5b7f1d809.js → 2.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{4.ordering-ui.ea0875b41af5b7f1d809.js → 4.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{5.ordering-ui.ea0875b41af5b7f1d809.js → 5.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{6.ordering-ui.ea0875b41af5b7f1d809.js → 6.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{7.ordering-ui.ea0875b41af5b7f1d809.js → 7.ordering-ui.55652fab015bca672f9d.js} +1 -1
- package/_bundles/{7.ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt → 7.ordering-ui.55652fab015bca672f9d.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.ea0875b41af5b7f1d809.js → 8.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/{9.ordering-ui.ea0875b41af5b7f1d809.js → 9.ordering-ui.55652fab015bca672f9d.js} +0 -0
- package/_bundles/ordering-ui.55652fab015bca672f9d.js +2 -0
- package/_bundles/{ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt → ordering-ui.55652fab015bca672f9d.js.LICENSE.txt} +0 -0
- package/_modules/components/BusinessesListing/index.js +1 -3
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +17 -2
- package/_modules/components/VerticalOrdersLayout/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +14 -6
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +24 -60
- package/_modules/themes/five/src/components/Cart/index.js +52 -96
- package/_modules/themes/five/src/components/CartContent/index.js +25 -72
- package/_modules/themes/five/src/components/MultiCheckout/index.js +2 -3
- package/_modules/themes/five/src/components/MultiOrdersDetails/index.js +7 -1
- package/_modules/themes/five/src/components/OrdersOption/index.js +2 -1
- package/_modules/utils/index.js +136 -2
- package/package.json +2 -2
- package/src/components/BusinessesListing/index.js +1 -3
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +13 -2
- package/src/components/VerticalOrdersLayout/styles.js +8 -0
- package/src/themes/five/src/components/BusinessListingSearch/index.js +4 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +218 -261
- package/src/themes/five/src/components/Cart/index.js +44 -54
- package/src/themes/five/src/components/CartContent/index.js +23 -41
- package/src/themes/five/src/components/MultiCheckout/index.js +1 -7
- package/src/themes/five/src/components/MultiOrdersDetails/index.js +19 -13
- package/src/themes/five/src/components/OrdersOption/index.js +2 -1
- package/src/utils/index.js +35 -1
- package/template/app.js +178 -65
- package/template/components/ListenPageChanges/index.js +1 -1
- package/template/pages/MultiCart/index.js +6 -0
- package/_bundles/ordering-ui.ea0875b41af5b7f1d809.js +0 -2
|
@@ -13,10 +13,6 @@ var _Cart = require("../Cart");
|
|
|
13
13
|
var _Buttons = require("../../styles/Buttons");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
17
|
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."); }
|
|
22
18
|
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); }
|
|
@@ -24,7 +20,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
24
20
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
22
|
var CartContent = function CartContent(props) {
|
|
27
|
-
var _configs$checkout_mul,
|
|
23
|
+
var _configs$checkout_mul, _theme$images, _theme$images$general;
|
|
28
24
|
var carts = props.carts,
|
|
29
25
|
isOrderStateCarts = props.isOrderStateCarts,
|
|
30
26
|
isCartPopover = props.isCartPopover,
|
|
@@ -50,10 +46,6 @@ var CartContent = function CartContent(props) {
|
|
|
50
46
|
currentCartUuid = _useState2[0],
|
|
51
47
|
setCurrentCartUuid = _useState2[1];
|
|
52
48
|
var checkoutMultiBusinessEnabled = (configs === null || configs === void 0 ? void 0 : (_configs$checkout_mul = configs.checkout_multi_business_enabled) === null || _configs$checkout_mul === void 0 ? void 0 : _configs$checkout_mul.value) === '1';
|
|
53
|
-
var openCarts = ((_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (cart) {
|
|
54
|
-
var _cart$products;
|
|
55
|
-
return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 ? void 0 : (_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (cart === null || cart === void 0 ? void 0 : cart.valid_schedule) && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.valid_maximum) && (cart === null || cart === void 0 ? void 0 : cart.valid_minimum) && !(cart !== null && cart !== void 0 && cart.wallets);
|
|
56
|
-
})) || null || [];
|
|
57
49
|
var handleAddProduct = function handleAddProduct(product, cart) {
|
|
58
50
|
setCurrentCartUuid(cart === null || cart === void 0 ? void 0 : cart.uuid);
|
|
59
51
|
};
|
|
@@ -62,76 +54,37 @@ var CartContent = function CartContent(props) {
|
|
|
62
54
|
props.onClose && props.onClose();
|
|
63
55
|
};
|
|
64
56
|
var handleClickCheckout = function handleClickCheckout() {
|
|
65
|
-
var
|
|
66
|
-
var
|
|
67
|
-
var _cart$group;
|
|
68
|
-
return cart === null || cart === void 0 ? void 0 : (_cart$group = cart.group) === null || _cart$group === void 0 ? void 0 : _cart$group.uuid;
|
|
69
|
-
});
|
|
70
|
-
var cartSelectedHasGroup = cart === null || cart === void 0 ? void 0 : (_cart$group2 = cart.group) === null || _cart$group2 === void 0 ? void 0 : _cart$group2.uuid;
|
|
71
|
-
var cartFilterValidation = function cartFilterValidation(cart) {
|
|
57
|
+
var _Object$values;
|
|
58
|
+
var cartsAvailable = (_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (cart) {
|
|
72
59
|
return (cart === null || cart === void 0 ? void 0 : cart.valid) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2;
|
|
73
|
-
};
|
|
74
|
-
var cartsGroupLength = cartSelectedHasGroup ? (_Object$values$filter = Object.values(orderState.carts).filter(function (_cart) {
|
|
75
|
-
var _cart$group3;
|
|
76
|
-
return (_cart === null || _cart === void 0 ? void 0 : (_cart$group3 = _cart.group) === null || _cart$group3 === void 0 ? void 0 : _cart$group3.uuid) === cartSelectedHasGroup && cartFilterValidation(_cart);
|
|
77
|
-
})) === null || _Object$values$filter === void 0 ? void 0 : _Object$values$filter.length : 0;
|
|
78
|
-
if (cartsGroupLength > 1 && checkoutMultiBusinessEnabled) {
|
|
79
|
-
var _cart$group4;
|
|
80
|
-
events.emit('go_to_page', {
|
|
81
|
-
page: 'multi_checkout',
|
|
82
|
-
params: {
|
|
83
|
-
cartUuid: cart === null || cart === void 0 ? void 0 : (_cart$group4 = cart.group) === null || _cart$group4 === void 0 ? void 0 : _cart$group4.uuid
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
events.emit('cart_popover_closed');
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
var cartGroupsCount = {};
|
|
90
|
-
// eslint-disable-next-line no-unused-expressions
|
|
91
|
-
(_Object$values$filter2 = Object.values(orderState.carts).filter(function (_cart) {
|
|
92
|
-
return cartFilterValidation(_cart);
|
|
93
|
-
})) === null || _Object$values$filter2 === void 0 ? void 0 : _Object$values$filter2.forEach(function (_cart) {
|
|
94
|
-
var _cart$group5;
|
|
95
|
-
if (cartGroupsCount[_cart === null || _cart === void 0 ? void 0 : (_cart$group5 = _cart.group) === null || _cart$group5 === void 0 ? void 0 : _cart$group5.uuid]) {
|
|
96
|
-
var _cart$group6;
|
|
97
|
-
cartGroupsCount[_cart === null || _cart === void 0 ? void 0 : (_cart$group6 = _cart.group) === null || _cart$group6 === void 0 ? void 0 : _cart$group6.uuid] += 1;
|
|
98
|
-
} else {
|
|
99
|
-
var _cart$group7;
|
|
100
|
-
cartGroupsCount[_cart === null || _cart === void 0 ? void 0 : (_cart$group7 = _cart.group) === null || _cart$group7 === void 0 ? void 0 : _cart$group7.uuid] = 1;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
var groupForTheCart;
|
|
104
|
-
var groupForAddCartArray = Object.keys(cartGroupsCount).filter(function (cartGroupUuid) {
|
|
105
|
-
return cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5;
|
|
106
|
-
});
|
|
107
|
-
var max = Math.max.apply(Math, _toConsumableArray(groupForAddCartArray.map(function (uuid) {
|
|
108
|
-
return cartGroupsCount[uuid];
|
|
109
|
-
})));
|
|
110
|
-
var indexes = groupForAddCartArray.filter(function (uuid) {
|
|
111
|
-
return cartGroupsCount[uuid] === max;
|
|
112
60
|
});
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
return uuid !== 'undefined';
|
|
116
|
-
});
|
|
117
|
-
} else {
|
|
118
|
-
groupForTheCart = indexes[0];
|
|
119
|
-
}
|
|
120
|
-
if (checkoutMultiBusinessEnabled && (openCarts === null || openCarts === void 0 ? void 0 : openCarts.length) > 1 && groupForTheCart) {
|
|
61
|
+
if (cartsAvailable.length === 1) {
|
|
62
|
+
var _cartsAvailable$;
|
|
121
63
|
events.emit('go_to_page', {
|
|
122
|
-
page: '
|
|
64
|
+
page: 'checkout',
|
|
123
65
|
params: {
|
|
124
|
-
cartUuid:
|
|
125
|
-
cartGroup: groupForTheCart === 'undefined' ? 'create' : groupForTheCart
|
|
66
|
+
cartUuid: (_cartsAvailable$ = cartsAvailable[0]) === null || _cartsAvailable$ === void 0 ? void 0 : _cartsAvailable$.uuid
|
|
126
67
|
}
|
|
127
68
|
});
|
|
128
69
|
} else {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
70
|
+
var groupKeys = {};
|
|
71
|
+
cartsAvailable.forEach(function (_cart) {
|
|
72
|
+
var _cart$group, _cart$group2, _cart$group$uuid, _cart$group3;
|
|
73
|
+
groupKeys[_cart === null || _cart === void 0 ? void 0 : (_cart$group = _cart.group) === null || _cart$group === void 0 ? void 0 : _cart$group.uuid] ? groupKeys[_cart === null || _cart === void 0 ? void 0 : (_cart$group2 = _cart.group) === null || _cart$group2 === void 0 ? void 0 : _cart$group2.uuid] += 1 : groupKeys[(_cart$group$uuid = _cart === null || _cart === void 0 ? void 0 : (_cart$group3 = _cart.group) === null || _cart$group3 === void 0 ? void 0 : _cart$group3.uuid) !== null && _cart$group$uuid !== void 0 ? _cart$group$uuid : 'null'] = 1;
|
|
134
74
|
});
|
|
75
|
+
if (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null' || Object.keys(groupKeys).length > 1) {
|
|
76
|
+
events.emit('go_to_page', {
|
|
77
|
+
page: 'multi_cart'
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
var _cartsAvailable$2, _cartsAvailable$2$gro;
|
|
81
|
+
events.emit('go_to_page', {
|
|
82
|
+
page: 'multi_checkout',
|
|
83
|
+
params: {
|
|
84
|
+
cartUuid: (_cartsAvailable$2 = cartsAvailable[0]) === null || _cartsAvailable$2 === void 0 ? void 0 : (_cartsAvailable$2$gro = _cartsAvailable$2.group) === null || _cartsAvailable$2$gro === void 0 ? void 0 : _cartsAvailable$2$gro.uuid
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
135
88
|
}
|
|
136
89
|
events.emit('cart_popover_closed');
|
|
137
90
|
props.onClose && props.onClose();
|
|
@@ -144,7 +97,7 @@ var CartContent = function CartContent(props) {
|
|
|
144
97
|
events.off('cart_product_added', handleAddProduct);
|
|
145
98
|
};
|
|
146
99
|
}, []);
|
|
147
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.Container, null, !isSlideBar && /*#__PURE__*/_react.default.createElement(_styles.WrapperContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Title, null, t('YOUR_CART', 'Your cart')), checkoutMultiBusinessEnabled && /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.Container, null, !isSlideBar && /*#__PURE__*/_react.default.createElement(_styles.WrapperContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Title, null, t('YOUR_CART', 'Your cart')), checkoutMultiBusinessEnabled && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
148
101
|
onClick: handleClickCheckout,
|
|
149
102
|
color: "primary"
|
|
150
103
|
}, t('CHECKOUT', 'Checkout'))), isOrderStateCarts && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && carts.map(function (cart) {
|
|
@@ -95,8 +95,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
95
95
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
96
96
|
alertState = _useState6[0],
|
|
97
97
|
setAlertState = _useState6[1];
|
|
98
|
-
var
|
|
99
|
-
var isDisablePlaceOrderButton = !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_id || paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.wallet_id) || openCarts.length > maximumCarts || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : (_paymethodSelected$pa = paymethodSelected.paymethod) === null || _paymethodSelected$pa === void 0 ? void 0 : _paymethodSelected$pa.gateway) === 'stripe' && !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_data);
|
|
98
|
+
var isDisablePlaceOrderButton = !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_id || paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.wallet_id) || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : (_paymethodSelected$pa = paymethodSelected.paymethod) === null || _paymethodSelected$pa === void 0 ? void 0 : _paymethodSelected$pa.gateway) === 'stripe' && !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_data);
|
|
100
99
|
var walletCarts = ((_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (cart) {
|
|
101
100
|
var _cart$products;
|
|
102
101
|
return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 ? void 0 : (_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (cart === null || cart === void 0 ? void 0 : cart.valid_schedule) && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.valid_maximum) && (cart === null || cart === void 0 ? void 0 : cart.valid_minimum) && (cart === null || cart === void 0 ? void 0 : cart.wallets);
|
|
@@ -232,7 +231,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
232
231
|
color: "primary",
|
|
233
232
|
disabled: isDisablePlaceOrderButton || placing || (cartGroup === null || cartGroup === void 0 ? void 0 : cartGroup.loading),
|
|
234
233
|
onClick: handlePlaceOrder
|
|
235
|
-
}, placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order')))
|
|
234
|
+
}, placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order')))), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
|
|
236
235
|
title: t('CHECKOUT ', 'Checkout'),
|
|
237
236
|
content: alertState.content,
|
|
238
237
|
acceptText: t('ACCEPT', 'Accept'),
|
|
@@ -58,6 +58,12 @@ var MultiOrdersDetailsUI = function MultiOrdersDetailsUI(props) {
|
|
|
58
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
59
59
|
alertState = _useState2[0],
|
|
60
60
|
setAlertState = _useState2[1];
|
|
61
|
+
var isTaxIncludedOnPrice = orders.every(function (_order) {
|
|
62
|
+
var _order$taxes, _order$taxes2;
|
|
63
|
+
return (_order$taxes = _order.taxes) !== null && _order$taxes !== void 0 && _order$taxes.length ? (_order$taxes2 = _order.taxes) === null || _order$taxes2 === void 0 ? void 0 : _order$taxes2.every(function (_tax) {
|
|
64
|
+
return _tax.type === 1;
|
|
65
|
+
}) : true;
|
|
66
|
+
});
|
|
61
67
|
var walletName = {
|
|
62
68
|
cash: {
|
|
63
69
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
|
|
@@ -109,7 +115,7 @@ var MultiOrdersDetailsUI = function MultiOrdersDetailsUI(props) {
|
|
|
109
115
|
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
110
116
|
key: order.id
|
|
111
117
|
}, /*#__PURE__*/_react.default.createElement("td", null, t('ORDER', 'Order'), " #", order.id), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((_order$summary$total = order === null || order === void 0 ? 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)));
|
|
112
|
-
}))), /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL_BEFORE_TAX', 'Total before tax'), ":"), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(ordersSummary === null || ordersSummary === void 0 ? void 0 : ordersSummary.subtotal))), /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected'), ":"), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(ordersSummary === null || ordersSummary === void 0 ? void 0 : ordersSummary.tax))))), /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('PAYMENT_TOTAL', 'Payment total'), ":"), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(ordersSummary === null || ordersSummary === void 0 ? void 0 : ordersSummary.total))))))), loading ? _toConsumableArray(Array(3).keys()).map(function (i) {
|
|
118
|
+
}))), !isTaxIncludedOnPrice && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL_BEFORE_TAX', 'Total before tax'), ":"), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(ordersSummary === null || ordersSummary === void 0 ? void 0 : ordersSummary.subtotal))), /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected'), ":"), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(ordersSummary === null || ordersSummary === void 0 ? void 0 : ordersSummary.tax)))))), /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement("table", null, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('PAYMENT_TOTAL', 'Payment total'), ":"), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(ordersSummary === null || ordersSummary === void 0 ? void 0 : ordersSummary.total))))))), loading ? _toConsumableArray(Array(3).keys()).map(function (i) {
|
|
113
119
|
return /*#__PURE__*/_react.default.createElement(_styles.SingleOrderContainer, {
|
|
114
120
|
key: i
|
|
115
121
|
}, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
@@ -411,6 +411,7 @@ var OrdersOptionUI = function OrdersOptionUI(props) {
|
|
|
411
411
|
return (0, _moment3.default)(b === null || b === void 0 ? void 0 : b.delivery_datetime_utc).valueOf() - (0, _moment3.default)(a === null || a === void 0 ? void 0 : a.delivery_datetime_utc).valueOf();
|
|
412
412
|
}),
|
|
413
413
|
pagination: pagination,
|
|
414
|
+
customArray: customArray,
|
|
414
415
|
loadMoreOrders: loadMoreOrders,
|
|
415
416
|
onRedirectPage: onRedirectPage,
|
|
416
417
|
getOrderStatus: getOrderStatus,
|
|
@@ -452,7 +453,7 @@ var OrdersOption = function OrdersOption(props) {
|
|
|
452
453
|
useDefualtSessionManager: true,
|
|
453
454
|
paginationSettings: {
|
|
454
455
|
initialPage: 1,
|
|
455
|
-
pageSize:
|
|
456
|
+
pageSize: getAllOrders || props.activeOrders ? 30 : 10,
|
|
456
457
|
controlType: 'infinity'
|
|
457
458
|
}
|
|
458
459
|
});
|
package/_modules/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.verifyDecimals = exports.sortInputFields = exports.shape = exports.scrollTo = exports.reviewCommentList = exports.priceList = exports.lightenDarkenColor = exports.getTraduction = exports.getTimes = exports.getStarWidth = exports.getIconCard = exports.getHourMin = exports.getGoogleMapImage = exports.getDistance = exports.formatUrlVideo = exports.formatSeconds = exports.flatArray = exports.fieldsToSort = exports.convertToRadian = exports.convertHoursToMinutes = exports.checkSiteUrl = exports.capitalize = exports.bytesConverter = void 0;
|
|
6
|
+
exports.verifyDecimals = exports.sortInputFields = exports.shape = exports.scrollTo = exports.reviewCommentList = exports.priceList = exports.lightenDarkenColor = exports.getTraduction = exports.getTimes = exports.getStarWidth = exports.getOrderStatus = exports.getIconCard = exports.getHourMin = exports.getGoogleMapImage = exports.getDistance = exports.formatUrlVideo = exports.formatSeconds = exports.flatArray = exports.fieldsToSort = exports.convertToRadian = exports.convertHoursToMinutes = exports.checkSiteUrl = exports.capitalize = exports.bytesConverter = void 0;
|
|
7
7
|
var _orderingComponentsExternal = require("ordering-components-external");
|
|
8
8
|
var _styledComponents = require("styled-components");
|
|
9
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
@@ -885,4 +885,138 @@ var getStarWidth = function getStarWidth(qualification) {
|
|
|
885
885
|
return '0%';
|
|
886
886
|
}
|
|
887
887
|
};
|
|
888
|
-
exports.getStarWidth = getStarWidth;
|
|
888
|
+
exports.getStarWidth = getStarWidth;
|
|
889
|
+
var getOrderStatus = function getOrderStatus(s) {
|
|
890
|
+
var _theme$defaultLanguag, _theme$defaultLanguag2, _theme$defaultLanguag3, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6, _theme$defaultLanguag7, _theme$defaultLanguag8, _theme$defaultLanguag9, _theme$defaultLanguag10, _theme$defaultLanguag11, _theme$defaultLanguag12, _theme$defaultLanguag13, _theme$defaultLanguag14, _theme$defaultLanguag15, _theme$defaultLanguag16, _theme$defaultLanguag17, _theme$defaultLanguag18, _theme$defaultLanguag19, _theme$defaultLanguag20, _theme$defaultLanguag21, _theme$defaultLanguag22, _theme$defaultLanguag23, _theme$defaultLanguag24;
|
|
891
|
+
var _useLanguage7 = (0, _orderingComponentsExternal.useLanguage)(),
|
|
892
|
+
_useLanguage8 = _slicedToArray(_useLanguage7, 2),
|
|
893
|
+
t = _useLanguage8[1];
|
|
894
|
+
var theme = (0, _styledComponents.useTheme)();
|
|
895
|
+
var status = parseInt(s);
|
|
896
|
+
var orderStatus = [{
|
|
897
|
+
key: 0,
|
|
898
|
+
value: t('PENDING', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag = theme.defaultLanguages) === null || _theme$defaultLanguag === void 0 ? void 0 : _theme$defaultLanguag.PENDING) || 'Pending'),
|
|
899
|
+
slug: 'PENDING',
|
|
900
|
+
percentage: 25
|
|
901
|
+
}, {
|
|
902
|
+
key: 1,
|
|
903
|
+
value: t('COMPLETED', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag2 = theme.defaultLanguages) === null || _theme$defaultLanguag2 === void 0 ? void 0 : _theme$defaultLanguag2.COMPLETED) || 'Completed'),
|
|
904
|
+
slug: 'COMPLETED',
|
|
905
|
+
percentage: 100
|
|
906
|
+
}, {
|
|
907
|
+
key: 2,
|
|
908
|
+
value: t('REJECTED', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag3 = theme.defaultLanguages) === null || _theme$defaultLanguag3 === void 0 ? void 0 : _theme$defaultLanguag3.REJECTED) || 'Rejected'),
|
|
909
|
+
slug: 'REJECTED',
|
|
910
|
+
percentage: 0
|
|
911
|
+
}, {
|
|
912
|
+
key: 3,
|
|
913
|
+
value: t('DRIVER_IN_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag4 = theme.defaultLanguages) === null || _theme$defaultLanguag4 === void 0 ? void 0 : _theme$defaultLanguag4.DRIVER_IN_BUSINESS) || 'Driver in business'),
|
|
914
|
+
slug: 'DRIVER_IN_BUSINESS',
|
|
915
|
+
percentage: 60
|
|
916
|
+
}, {
|
|
917
|
+
key: 4,
|
|
918
|
+
value: t('PREPARATION_COMPLETED', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag5 = theme.defaultLanguages) === null || _theme$defaultLanguag5 === void 0 ? void 0 : _theme$defaultLanguag5.PREPARATION_COMPLETED) || 'Preparation Completed'),
|
|
919
|
+
slug: 'PREPARATION_COMPLETED',
|
|
920
|
+
percentage: 70
|
|
921
|
+
}, {
|
|
922
|
+
key: 5,
|
|
923
|
+
value: t('REJECTED_BY_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag6 = theme.defaultLanguages) === null || _theme$defaultLanguag6 === void 0 ? void 0 : _theme$defaultLanguag6.REJECTED_BY_BUSINESS) || 'Rejected by business'),
|
|
924
|
+
slug: 'REJECTED_BY_BUSINESS',
|
|
925
|
+
percentage: 0
|
|
926
|
+
}, {
|
|
927
|
+
key: 6,
|
|
928
|
+
value: t('REJECTED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag7 = theme.defaultLanguages) === null || _theme$defaultLanguag7 === void 0 ? void 0 : _theme$defaultLanguag7.REJECTED_BY_DRIVER) || 'Rejected by Driver'),
|
|
929
|
+
slug: 'REJECTED_BY_DRIVER',
|
|
930
|
+
percentage: 0
|
|
931
|
+
}, {
|
|
932
|
+
key: 7,
|
|
933
|
+
value: t('ACCEPTED_BY_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag8 = theme.defaultLanguages) === null || _theme$defaultLanguag8 === void 0 ? void 0 : _theme$defaultLanguag8.ACCEPTED_BY_BUSINESS) || 'Accepted by business'),
|
|
934
|
+
slug: 'ACCEPTED_BY_BUSINESS',
|
|
935
|
+
percentage: 35
|
|
936
|
+
}, {
|
|
937
|
+
key: 8,
|
|
938
|
+
value: t('ACCEPTED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag9 = theme.defaultLanguages) === null || _theme$defaultLanguag9 === void 0 ? void 0 : _theme$defaultLanguag9.ACCEPTED_BY_DRIVER) || 'Accepted by driver'),
|
|
939
|
+
slug: 'ACCEPTED_BY_DRIVER',
|
|
940
|
+
percentage: 45
|
|
941
|
+
}, {
|
|
942
|
+
key: 9,
|
|
943
|
+
value: t('PICK_UP_COMPLETED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag10 = theme.defaultLanguages) === null || _theme$defaultLanguag10 === void 0 ? void 0 : _theme$defaultLanguag10.PICK_UP_COMPLETED_BY_DRIVER) || 'Pick up completed by driver'),
|
|
944
|
+
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
945
|
+
percentage: 80
|
|
946
|
+
}, {
|
|
947
|
+
key: 10,
|
|
948
|
+
value: t('PICK_UP_FAILED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag11 = theme.defaultLanguages) === null || _theme$defaultLanguag11 === void 0 ? void 0 : _theme$defaultLanguag11.PICK_UP_FAILED_BY_DRIVER) || 'Pick up Failed by driver'),
|
|
949
|
+
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
950
|
+
percentage: 0
|
|
951
|
+
}, {
|
|
952
|
+
key: 11,
|
|
953
|
+
value: t('DELIVERY_COMPLETED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag12 = theme.defaultLanguages) === null || _theme$defaultLanguag12 === void 0 ? void 0 : _theme$defaultLanguag12.DELIVERY_COMPLETED_BY_DRIVER) || 'Delivery completed by driver'),
|
|
954
|
+
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
955
|
+
percentage: 100
|
|
956
|
+
}, {
|
|
957
|
+
key: 12,
|
|
958
|
+
value: t('DELIVERY_FAILED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag13 = theme.defaultLanguages) === null || _theme$defaultLanguag13 === void 0 ? void 0 : _theme$defaultLanguag13.DELIVERY_FAILED_BY_DRIVER) || 'Delivery Failed by driver'),
|
|
959
|
+
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
960
|
+
percentage: 0
|
|
961
|
+
}, {
|
|
962
|
+
key: 13,
|
|
963
|
+
value: t('PREORDER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag14 = theme.defaultLanguages) === null || _theme$defaultLanguag14 === void 0 ? void 0 : _theme$defaultLanguag14.PREORDER) || 'PreOrder'),
|
|
964
|
+
slug: 'PREORDER',
|
|
965
|
+
percentage: 0
|
|
966
|
+
}, {
|
|
967
|
+
key: 14,
|
|
968
|
+
value: t('ORDER_NOT_READY', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag15 = theme.defaultLanguages) === null || _theme$defaultLanguag15 === void 0 ? void 0 : _theme$defaultLanguag15.ORDER_NOT_READY) || 'Order not ready'),
|
|
969
|
+
slug: 'ORDER_NOT_READY',
|
|
970
|
+
percentage: 65
|
|
971
|
+
}, {
|
|
972
|
+
key: 15,
|
|
973
|
+
value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag16 = theme.defaultLanguages) === null || _theme$defaultLanguag16 === void 0 ? void 0 : _theme$defaultLanguag16.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER) || 'Order picked up completed by customer'),
|
|
974
|
+
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
975
|
+
percentage: 100
|
|
976
|
+
}, {
|
|
977
|
+
key: 16,
|
|
978
|
+
value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag17 = theme.defaultLanguages) === null || _theme$defaultLanguag17 === void 0 ? void 0 : _theme$defaultLanguag17.ORDER_STATUS_CANCELLED_BY_CUSTOMER) || 'Order cancelled by customer'),
|
|
979
|
+
slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
|
|
980
|
+
percentage: 0
|
|
981
|
+
}, {
|
|
982
|
+
key: 17,
|
|
983
|
+
value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag18 = theme.defaultLanguages) === null || _theme$defaultLanguag18 === void 0 ? void 0 : _theme$defaultLanguag18.ORDER_NOT_PICKEDUP_BY_CUSTOMER) || 'Order not picked up by customer'),
|
|
984
|
+
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
985
|
+
percentage: 0
|
|
986
|
+
}, {
|
|
987
|
+
key: 18,
|
|
988
|
+
value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag19 = theme.defaultLanguages) === null || _theme$defaultLanguag19 === void 0 ? void 0 : _theme$defaultLanguag19.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS) || 'Driver almost arrived to business'),
|
|
989
|
+
slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
|
|
990
|
+
percentage: 55
|
|
991
|
+
}, {
|
|
992
|
+
key: 19,
|
|
993
|
+
value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag20 = theme.defaultLanguages) === null || _theme$defaultLanguag20 === void 0 ? void 0 : _theme$defaultLanguag20.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER) || 'Driver almost arrived to customer'),
|
|
994
|
+
slug: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
995
|
+
percentage: 90
|
|
996
|
+
}, {
|
|
997
|
+
key: 20,
|
|
998
|
+
value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag21 = theme.defaultLanguages) === null || _theme$defaultLanguag21 === void 0 ? void 0 : _theme$defaultLanguag21.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS) || 'Customer almost arrived to business'),
|
|
999
|
+
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
1000
|
+
percentage: 90
|
|
1001
|
+
}, {
|
|
1002
|
+
key: 21,
|
|
1003
|
+
value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag22 = theme.defaultLanguages) === null || _theme$defaultLanguag22 === void 0 ? void 0 : _theme$defaultLanguag22.ORDER_CUSTOMER_ARRIVED_BUSINESS) || 'Customer arrived to business'),
|
|
1004
|
+
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
1005
|
+
percentage: 95
|
|
1006
|
+
}, {
|
|
1007
|
+
key: 22,
|
|
1008
|
+
value: t('ORDER_LOOKING_FOR_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag23 = theme.defaultLanguages) === null || _theme$defaultLanguag23 === void 0 ? void 0 : _theme$defaultLanguag23.ORDER_LOOKING_FOR_DRIVER) || 'Looking for driver'),
|
|
1009
|
+
slug: 'ORDER_LOOKING_FOR_DRIVER',
|
|
1010
|
+
percentage: 35
|
|
1011
|
+
}, {
|
|
1012
|
+
key: 23,
|
|
1013
|
+
value: t('ORDER_DRIVER_ON_WAY', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag24 = theme.defaultLanguages) === null || _theme$defaultLanguag24 === void 0 ? void 0 : _theme$defaultLanguag24.ORDER_DRIVER_ON_WAY) || 'Driver on way'),
|
|
1014
|
+
slug: 'ORDER_DRIVER_ON_WAY',
|
|
1015
|
+
percentage: 45
|
|
1016
|
+
}];
|
|
1017
|
+
var objectStatus = orderStatus.find(function (o) {
|
|
1018
|
+
return o.key === status;
|
|
1019
|
+
});
|
|
1020
|
+
return objectStatus && objectStatus;
|
|
1021
|
+
};
|
|
1022
|
+
exports.getOrderStatus = getOrderStatus;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-external",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5",
|
|
4
4
|
"description": "Ordering UI Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"libphonenumber-js": "^1.9.4",
|
|
87
87
|
"lodash": "^4.17.19",
|
|
88
88
|
"moment": "^2.29.4",
|
|
89
|
-
"ordering-components-external": "1.9.
|
|
89
|
+
"ordering-components-external": "1.9.2",
|
|
90
90
|
"polished": "^3.6.6",
|
|
91
91
|
"react-bootstrap-icons": "^1.7.2",
|
|
92
92
|
"react-calendar": "^3.3.1",
|
|
@@ -94,9 +94,7 @@ const BusinessesListingUI = (props) => {
|
|
|
94
94
|
}, [mapErrors])
|
|
95
95
|
|
|
96
96
|
useEffect(() => {
|
|
97
|
-
if (orderState.loading
|
|
98
|
-
// const newurl = window.location.protocol + '//' + window.location.host + window.location.pathname
|
|
99
|
-
// window.history.pushState({ path: newurl }, '', newurl)
|
|
97
|
+
if (orderState.loading || businessesList.loading) {
|
|
100
98
|
const params = new URLSearchParams()
|
|
101
99
|
history.replace({ pathname: location.pathname, search: params.toString() })
|
|
102
100
|
setPrevPage({ loading: true, page: 1 })
|
|
@@ -25,7 +25,9 @@ const SingleOrderCardUI = (props) => {
|
|
|
25
25
|
reorderLoading,
|
|
26
26
|
orderID,
|
|
27
27
|
handleFavoriteOrder,
|
|
28
|
-
setOrderSelected
|
|
28
|
+
setOrderSelected,
|
|
29
|
+
onRedirectPage,
|
|
30
|
+
customArray
|
|
29
31
|
} = props
|
|
30
32
|
|
|
31
33
|
const theme = useTheme()
|
|
@@ -36,8 +38,17 @@ const SingleOrderCardUI = (props) => {
|
|
|
36
38
|
handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
const handleClickCard = (e, order) => {
|
|
42
|
+
if (e.target.closest('.favorite') || e.target.closest('.review') || e.target.closest('.reorder')) return
|
|
43
|
+
const params = {
|
|
44
|
+
[customArray ? 'cartUuid' : 'orderId']: customArray ? order.uuid : order?.cart_group_id ?? order.uuid
|
|
45
|
+
}
|
|
46
|
+
const page = customArray ? 'checkout' : order?.cart_group_id ? 'multi_orders' : 'order_detail'
|
|
47
|
+
onRedirectPage({ page, params })
|
|
48
|
+
}
|
|
49
|
+
|
|
39
50
|
return (
|
|
40
|
-
<SingleCard key={order.id} id='order-card'>
|
|
51
|
+
<SingleCard key={order.id} id='order-card' onClick={(e) => handleClickCard(e, order)}>
|
|
41
52
|
<OrderPastContent>
|
|
42
53
|
{(order.business?.logo || theme.images?.dummies?.businessLogo) && (
|
|
43
54
|
<>
|
|
@@ -6,7 +6,11 @@ export const SingleCard = styled.div`
|
|
|
6
6
|
display: flex;
|
|
7
7
|
max-height: 100px;
|
|
8
8
|
height: auto;
|
|
9
|
+
border-radius: 16px;
|
|
10
|
+
padding: 10px;
|
|
11
|
+
transition: all 0.3s ease;
|
|
9
12
|
border-bottom: 1px solid #F5F6F6;
|
|
13
|
+
cursor: pointer;
|
|
10
14
|
|
|
11
15
|
${props => (
|
|
12
16
|
props.theme.colors.backgroundPage === '#FFF' ||
|
|
@@ -24,6 +28,10 @@ export const SingleCard = styled.div`
|
|
|
24
28
|
border-top: none !important;
|
|
25
29
|
`}
|
|
26
30
|
}
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
box-shadow: rgb(0 0 0 / 20%) 0px 8px 24px;
|
|
34
|
+
}
|
|
27
35
|
`
|
|
28
36
|
|
|
29
37
|
export const OrderPastContent = styled.div`
|
|
@@ -100,6 +100,8 @@ export const BusinessListingSearchUI = (props) => {
|
|
|
100
100
|
]
|
|
101
101
|
|
|
102
102
|
const noResults = (!businessesSearchList.loading && !businessesSearchList.lengthError && businessesSearchList?.businesses?.length === 0)
|
|
103
|
+
const currentCart = Object.values(orderState?.carts).find(cart => cart?.business?.slug === curProduct?.business?.slug) ?? {}
|
|
104
|
+
|
|
103
105
|
|
|
104
106
|
const handleScroll = useCallback(() => {
|
|
105
107
|
const innerHeightScrolltop = window.innerHeight + document.documentElement?.scrollTop + PIXELS_TO_SCROLL
|
|
@@ -420,11 +422,13 @@ export const BusinessListingSearchUI = (props) => {
|
|
|
420
422
|
<ProductForm
|
|
421
423
|
businessSlug={curProduct?.business?.slug}
|
|
422
424
|
useKioskApp={props?.useKioskApp}
|
|
425
|
+
product={curProduct?.product}
|
|
423
426
|
businessId={curProduct?.business?.id}
|
|
424
427
|
categoryId={curProduct?.product?.category_id}
|
|
425
428
|
productId={curProduct?.product?.id}
|
|
426
429
|
onSave={handleRedirectToCart}
|
|
427
430
|
handleUpdateProducts={(productId, changes) => handleUpdateProducts(productId, curProduct?.product?.category_id, curProduct?.business?.id, changes)}
|
|
431
|
+
productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === curProduct?.id ? Cproduct?.quantity : 0) }, 0) || 0}
|
|
428
432
|
/>
|
|
429
433
|
)}
|
|
430
434
|
</Modal>
|