ordering-ui-admin-external 1.30.2 → 1.30.3
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.6be018fe653b04c6fa85.js → ordering-ui-admin.78d273d2999264e3e020.js} +2 -2
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/index.js +3 -2
- package/_modules/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/styles.js +2 -2
- package/_modules/components/BusinessIntelligence/AnalyticsSpendList/index.js +3 -2
- package/_modules/components/BusinessIntelligence/AnalyticsSpendList/styles.js +2 -2
- package/_modules/components/BusinessIntelligence/AnalyticsSpendTimes/index.js +11 -11
- package/_modules/components/Orders/BusinessesSelector/styles.js +1 -1
- package/_modules/components/Orders/CountryFilter/styles.js +1 -1
- package/_modules/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +7 -4
- package/_modules/components/Orders/CreateCustomOrder/Map/index.js +125 -3
- package/_modules/components/Orders/CreateCustomOrder/OrderTypeSelector/index.js +93 -0
- package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/index.js +7 -13
- package/_modules/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +1 -1
- package/_modules/components/Orders/CurrencyFilter/styles.js +1 -1
- package/_modules/components/Orders/DateTypeSelector/styles.js +1 -1
- package/_modules/components/Orders/DriverMultiSelector/index.js +0 -2
- package/_modules/components/Orders/DriverMultiSelector/styles.js +27 -35
- package/_modules/components/Orders/DriversGroupTypeSelector/styles.js +1 -1
- package/_modules/components/Orders/DriversList/index.js +3 -1
- package/_modules/components/Orders/DriversList/styles.js +1 -1
- package/_modules/components/Orders/OrderDetails/index.js +32 -0
- package/_modules/components/Orders/OrdersFilterGroup/styles.js +2 -2
- package/_modules/components/Shared/CitySelector/styles.js +4 -7
- package/_modules/components/Shared/InputPhoneNumber/index.js +4 -2
- package/_modules/components/Users/UserAddForm/index.js +3 -2
- package/_modules/utils/index.js +1 -1
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/index.js +2 -2
- package/src/components/BusinessIntelligence/AnalyticsOrdersAcceptSpend/styles.js +1 -1
- package/src/components/BusinessIntelligence/AnalyticsSpendList/index.js +2 -2
- package/src/components/BusinessIntelligence/AnalyticsSpendList/styles.js +1 -1
- package/src/components/BusinessIntelligence/AnalyticsSpendTimes/index.js +4 -4
- package/src/components/Orders/BusinessesSelector/styles.js +1 -1
- package/src/components/Orders/CountryFilter/styles.js +1 -1
- package/src/components/Orders/CreateCustomOrder/CustomOrderDetails/index.js +6 -4
- package/src/components/Orders/CreateCustomOrder/Map/index.js +82 -3
- package/src/components/Orders/CreateCustomOrder/OrderTypeSelector/index.js +79 -0
- package/src/components/Orders/CreateCustomOrder/SelectCustomer/index.js +7 -10
- package/src/components/Orders/CreateCustomOrder/SelectCustomer/styles.js +2 -0
- package/src/components/Orders/CurrencyFilter/styles.js +1 -1
- package/src/components/Orders/DateTypeSelector/styles.js +1 -1
- package/src/components/Orders/DriverMultiSelector/index.js +1 -2
- package/src/components/Orders/DriverMultiSelector/styles.js +1 -9
- package/src/components/Orders/DriversGroupTypeSelector/styles.js +1 -1
- package/src/components/Orders/DriversList/index.js +1 -0
- package/src/components/Orders/DriversList/styles.js +5 -1
- package/src/components/Orders/OrderDetails/index.js +21 -1
- package/src/components/Orders/OrdersFilterGroup/styles.js +4 -0
- package/src/components/Shared/CitySelector/styles.js +1 -5
- package/src/components/Shared/InputPhoneNumber/index.js +4 -2
- package/src/components/Users/UserAddForm/index.js +3 -2
- package/src/utils/index.js +1 -1
- /package/_bundles/{ordering-ui-admin.6be018fe653b04c6fa85.js.LICENSE.txt → ordering-ui-admin.78d273d2999264e3e020.js.LICENSE.txt} +0 -0
|
@@ -7,67 +7,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.WrapperDriverImage = exports.PlaceholderTitle = exports.OptionContent = exports.Option = exports.DriverText = exports.DriverNameContainer = exports.DriverName = exports.DriverImage = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
|
11
11
|
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); }
|
|
12
12
|
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; }
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
15
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
16
|
-
var Option = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: ", ";\n padding: ", ";\n white-space: nowrap;\n
|
|
16
|
+
var Option = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n color: ", ";\n padding: ", ";\n white-space: nowrap;\n\n img {\n width: 45px;\n border-radius: 8px;\n }\n\n ", "\n\n span {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 350px;\n }\n\n @media (max-width: 576px) {\n padding: ", ";\n ", "\n span {\n max-width: 280px;\n }\n }\n"])), function (props) {
|
|
17
17
|
var _props$theme$colors;
|
|
18
18
|
return (_props$theme$colors = props.theme.colors) === null || _props$theme$colors === void 0 ? void 0 : _props$theme$colors.headingColor;
|
|
19
19
|
}, function (_ref) {
|
|
20
20
|
var padding = _ref.padding;
|
|
21
|
-
return padding || '5px
|
|
21
|
+
return padding || '5px';
|
|
22
22
|
}, function (_ref2) {
|
|
23
|
-
var
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
var isRemove = _ref3.isRemove;
|
|
27
|
-
return isRemove && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n padding: 3px 10px;\n font-size: 14px;\n "])), function (props) {
|
|
28
|
-
return props.theme.colors.danger;
|
|
29
|
-
});
|
|
30
|
-
}, function (_ref4) {
|
|
31
|
-
var small = _ref4.small;
|
|
32
|
-
return small && (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: ", ";\n img {\n width: 25px;\n }\n "])), function (_ref5) {
|
|
33
|
-
var padding = _ref5.padding;
|
|
23
|
+
var small = _ref2.small;
|
|
24
|
+
return small && (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", ";\n img {\n width: 25px;\n }\n "])), function (_ref3) {
|
|
25
|
+
var padding = _ref3.padding;
|
|
34
26
|
return padding || '5px 0px';
|
|
35
27
|
});
|
|
36
|
-
}, function (
|
|
37
|
-
var padding =
|
|
28
|
+
}, function (_ref4) {
|
|
29
|
+
var padding = _ref4.padding;
|
|
38
30
|
return padding || '5px 0px';
|
|
39
31
|
}, function (props) {
|
|
40
32
|
var _props$theme;
|
|
41
|
-
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(
|
|
33
|
+
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-right: 10px;\n "]))) : (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-left: 10px;\n "])));
|
|
42
34
|
});
|
|
43
35
|
exports.Option = Option;
|
|
44
|
-
var OptionContent = _styledComponents.default.div(
|
|
36
|
+
var OptionContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: space-between;\n"])));
|
|
45
37
|
exports.OptionContent = OptionContent;
|
|
46
|
-
var DriverNameContainer = _styledComponents.default.div(
|
|
38
|
+
var DriverNameContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n line-height: 1.3;\n color: #263238;\n"])));
|
|
47
39
|
exports.DriverNameContainer = DriverNameContainer;
|
|
48
|
-
var DriverName = _styledComponents.default.p(
|
|
40
|
+
var DriverName = _styledComponents.default.p(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 14px;\n font-weight: 600;\n line-height: 1.3;\n color: ", ";\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 150px;\n margin: 0px;\n\n ", "\n\n @media (max-width: 576px) {\n max-width: 90px;\n }\n"])), function (props) {
|
|
49
41
|
return props.theme.colors.headingColor;
|
|
50
|
-
}, function (
|
|
51
|
-
var small =
|
|
52
|
-
return small && (0, _styledComponents.css)(
|
|
42
|
+
}, function (_ref5) {
|
|
43
|
+
var small = _ref5.small;
|
|
44
|
+
return small && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-weight: 400;\n "])));
|
|
53
45
|
});
|
|
54
46
|
exports.DriverName = DriverName;
|
|
55
|
-
var DriverText = _styledComponents.default.span(
|
|
47
|
+
var DriverText = _styledComponents.default.span(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: 12px;\n color: ", ";\n ", "\n"])), function (props) {
|
|
56
48
|
return props.theme.colors.lightGray;
|
|
57
|
-
}, function (
|
|
58
|
-
var small =
|
|
59
|
-
return small && (0, _styledComponents.css)(
|
|
49
|
+
}, function (_ref6) {
|
|
50
|
+
var small = _ref6.small;
|
|
51
|
+
return small && (0, _styledComponents.css)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: none;\n "])));
|
|
60
52
|
});
|
|
61
53
|
exports.DriverText = DriverText;
|
|
62
|
-
var WrapperDriverImage = _styledComponents.default.div(
|
|
63
|
-
var small =
|
|
64
|
-
return small && (0, _styledComponents.css)(
|
|
54
|
+
var WrapperDriverImage = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n width: 45px;\n height: 45px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n display: flex;\n\n svg {\n width: 100%;\n height: 100%;\n padding: 7px;\n box-sizing: border-box;\n border-radius: 50%;\n }\n\n ", "\n\n ", "\n"])), function (_ref7) {
|
|
55
|
+
var small = _ref7.small;
|
|
56
|
+
return small && (0, _styledComponents.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n width: 24px;\n height: 24px;\n border-radius: 8px;\n svg {\n padding: 3px;\n }\n "])));
|
|
65
57
|
}, function (props) {
|
|
66
58
|
var _props$theme2;
|
|
67
|
-
return (_props$theme2 = props.theme) !== null && _props$theme2 !== void 0 && _props$theme2.rtl ? (0, _styledComponents.css)(
|
|
59
|
+
return (_props$theme2 = props.theme) !== null && _props$theme2 !== void 0 && _props$theme2.rtl ? (0, _styledComponents.css)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-left: 8px;\n "]))) : (0, _styledComponents.css)(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-right: 8px;\n "])));
|
|
68
60
|
});
|
|
69
61
|
exports.WrapperDriverImage = WrapperDriverImage;
|
|
70
|
-
var DriverImageStyled = _styledComponents.default.div(
|
|
62
|
+
var DriverImageStyled = _styledComponents.default.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n position: relative;\n background-repeat: no-repeat, repeat;\n background-size: cover;\n object-fit: cover;\n background-position: center;\n border-radius: 8px;\n"])));
|
|
71
63
|
var DriverImage = function DriverImage(props) {
|
|
72
64
|
return /*#__PURE__*/_react.default.createElement(DriverImageStyled, _extends({}, props, {
|
|
73
65
|
style: {
|
|
@@ -76,8 +68,8 @@ var DriverImage = function DriverImage(props) {
|
|
|
76
68
|
}), props.children);
|
|
77
69
|
};
|
|
78
70
|
exports.DriverImage = DriverImage;
|
|
79
|
-
var PlaceholderTitle = (0, _styledComponents.default)(Option)(
|
|
80
|
-
var isSingle =
|
|
81
|
-
return isSingle && (0, _styledComponents.css)(
|
|
71
|
+
var PlaceholderTitle = (0, _styledComponents.default)(Option)(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n padding: 10px;\n\n ", "\n"])), function (_ref8) {
|
|
72
|
+
var isSingle = _ref8.isSingle;
|
|
73
|
+
return isSingle && (0, _styledComponents.css)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n padding: 0px;\n font-size: 14px;\n "])));
|
|
82
74
|
});
|
|
83
75
|
exports.PlaceholderTitle = PlaceholderTitle;
|
|
@@ -12,7 +12,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
12
12
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
13
|
var PlaceholderTitle = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n padding: 10px;\n"])));
|
|
14
14
|
exports.PlaceholderTitle = PlaceholderTitle;
|
|
15
|
-
var Option = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 10px
|
|
15
|
+
var Option = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 10px;\n column-gap: 20px;\n\n svg {\n margin-right: 5px;\n ", " \n }\n"])), function (props) {
|
|
16
16
|
var _props$theme;
|
|
17
17
|
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.rtl) && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: 5px;\n margin-right: 0px;\n "])));
|
|
18
18
|
});
|
|
@@ -86,7 +86,9 @@ var DriversList = function DriversList(props) {
|
|
|
86
86
|
onClick: function onClick() {
|
|
87
87
|
return onOpenDriverOrdersDetail(driver);
|
|
88
88
|
}
|
|
89
|
-
}, driver === null || driver === void 0 ? void 0 : driver.assigned_orders_count, " ", t('ORDERS', 'Orders'))
|
|
89
|
+
}, driver === null || driver === void 0 ? void 0 : driver.assigned_orders_count, " ", t('ORDERS', 'Orders')), /*#__PURE__*/_react.default.createElement("p", {
|
|
90
|
+
className: "text-red"
|
|
91
|
+
}, (driver === null || driver === void 0 ? void 0 : driver.busy) && "(".concat(t('BUSY', 'Busy'), ")"))), (driver === null || driver === void 0 ? void 0 : driver.qualification) && /*#__PURE__*/_react.default.createElement(_styles2.WrapperStar, {
|
|
90
92
|
width: (0, _utils.getStarWidth)(driver === null || driver === void 0 ? void 0 : driver.qualification)
|
|
91
93
|
})));
|
|
92
94
|
})));
|
|
@@ -46,7 +46,7 @@ var WrapperStar = _styledComponents.default.div(_templateObject6 || (_templateOb
|
|
|
46
46
|
return width;
|
|
47
47
|
});
|
|
48
48
|
exports.WrapperStar = WrapperStar;
|
|
49
|
-
var DriverInfo = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n > div:first-child {\n display: flex;\n align-items: center;\n\n svg {\n margin: 0 5px;\n }\n
|
|
49
|
+
var DriverInfo = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n > div:first-child {\n display: flex;\n align-items: center;\n\n svg {\n margin: 0 5px;\n }\n\n p {\n font-size: 14px;\n color: ", ";\n font-weight: 600;\n margin: 0px;\n flex: 1;\n }\n .text-red {\n margin-left: 2px;\n color: red;\n }\n }\n"])), function (props) {
|
|
50
50
|
var _props$theme;
|
|
51
51
|
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin-right: 15px;\n "]))) : (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-left: 15px;\n "])));
|
|
52
52
|
}, function (props) {
|
|
@@ -102,6 +102,13 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
|
|
|
102
102
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
103
103
|
isExpand = _useState12[0],
|
|
104
104
|
setIsExpand = _useState12[1];
|
|
105
|
+
var _useState13 = (0, _react.useState)({
|
|
106
|
+
open: false,
|
|
107
|
+
content: []
|
|
108
|
+
}),
|
|
109
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
110
|
+
alertState = _useState14[0],
|
|
111
|
+
setAlertState = _useState14[1];
|
|
105
112
|
var placeSpotEnabled = [3, 4];
|
|
106
113
|
var _props$order = props.order,
|
|
107
114
|
order = _props$order.order,
|
|
@@ -311,6 +318,13 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
|
|
|
311
318
|
handleShowOption(section, true);
|
|
312
319
|
}
|
|
313
320
|
}, [loading]);
|
|
321
|
+
(0, _react.useEffect)(function () {
|
|
322
|
+
if (!(actionStatus !== null && actionStatus !== void 0 && actionStatus.error)) return;
|
|
323
|
+
setAlertState({
|
|
324
|
+
open: true,
|
|
325
|
+
content: actionStatus === null || actionStatus === void 0 ? void 0 : actionStatus.error
|
|
326
|
+
});
|
|
327
|
+
}, [actionStatus === null || actionStatus === void 0 ? void 0 : actionStatus.error]);
|
|
314
328
|
var progressBarObjt = order !== null && order !== void 0 && order.delivery_type && (order === null || order === void 0 ? void 0 : order.delivery_type) === 2 ? _utils.getOrderStatuPickUp : _utils.getOrderStatus;
|
|
315
329
|
return /*#__PURE__*/_react.default.createElement(_styles2.Container, {
|
|
316
330
|
isSelectedOrders: isSelectedOrders,
|
|
@@ -494,6 +508,24 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
|
|
|
494
508
|
ref: printTicketRef,
|
|
495
509
|
order: order,
|
|
496
510
|
getOrderStatus: progressBarObjt
|
|
511
|
+
}), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
|
|
512
|
+
title: t('WEB_APPNAME', 'Ordering'),
|
|
513
|
+
content: alertState.content,
|
|
514
|
+
acceptText: t('ACCEPT', 'Accept'),
|
|
515
|
+
open: alertState.open,
|
|
516
|
+
onClose: function onClose() {
|
|
517
|
+
return setAlertState({
|
|
518
|
+
open: false,
|
|
519
|
+
content: []
|
|
520
|
+
});
|
|
521
|
+
},
|
|
522
|
+
onAccept: function onAccept() {
|
|
523
|
+
return setAlertState({
|
|
524
|
+
open: false,
|
|
525
|
+
content: []
|
|
526
|
+
});
|
|
527
|
+
},
|
|
528
|
+
closeOnBackdrop: false
|
|
497
529
|
}));
|
|
498
530
|
};
|
|
499
531
|
var OrderDetails = function OrderDetails(props) {
|
|
@@ -12,7 +12,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
12
12
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
13
|
var FilterGroupListContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n padding: 15px 20px;\n > h1 {\n font-size: 24px;\n font-weight: 600;\n margin-top: 10px;\n margin-bottom: 30px;\n }\n\n & > div {\n width: 48%;\n }\n\n @media (max-width: 576px) {\n flex-direction: column;\n & > div {\n width: 100%;\n }\n }\n\n @media (min-width: 768px) {\n padding: 30px;\n }\n"])));
|
|
14
14
|
exports.FilterGroupListContainer = FilterGroupListContainer;
|
|
15
|
-
var WrapperRow = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n width: 100% !important;\n flex-direction: column;\n justify-content: space-between;\n\n & > div {\n width: 100%;\n height: 57px;\n margin-bottom: 20px;\n background-color: ", ";\n border: none;\n font-size: 14px;\n border-radius: 8px;\n }\n\n .order-status-multi-select {\n p {\n padding: 0;\n color: ", " !important;\n }\n }\n\n .date-filter-container {\n z-index: 100;\n }\n\n > input {\n width: 100%;\n height: 57px;\n margin-bottom: 20px;\n padding: 10px 25px;\n box-sizing: border-box;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n -moz-appearance: textfield;\n }\n\n @media (min-width: 992px) {\n flex-direction: row;\n & > div {\n width: 48%;\n }\n\n > input {\n width: 48%;\n }\n }\n"])), function (props) {
|
|
15
|
+
var WrapperRow = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n width: 100% !important;\n flex-direction: column;\n justify-content: space-between;\n\n & > div {\n width: 100%;\n height: 57px;\n margin-bottom: 20px;\n background-color: ", ";\n border: none;\n font-size: 14px;\n border-radius: 8px;\n > div:first-child {\n height: 100%;\n }\n }\n\n .order-status-multi-select {\n p {\n padding: 0;\n color: ", " !important;\n }\n }\n\n .date-filter-container {\n z-index: 100;\n }\n\n > input {\n width: 100%;\n height: 57px;\n margin-bottom: 20px;\n padding: 10px 25px;\n box-sizing: border-box;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n -moz-appearance: textfield;\n }\n\n @media (min-width: 992px) {\n flex-direction: row;\n & > div {\n width: 48%;\n }\n\n > input {\n width: 48%;\n }\n }\n"])), function (props) {
|
|
16
16
|
return props.theme.colors.secundary;
|
|
17
17
|
}, function (props) {
|
|
18
18
|
return props.theme.colors.headingColor;
|
|
@@ -39,7 +39,7 @@ var SelectWrapper = _styledComponents.default.div(_templateObject10 || (_templat
|
|
|
39
39
|
return props.theme.colors.secundary;
|
|
40
40
|
});
|
|
41
41
|
exports.SelectWrapper = SelectWrapper;
|
|
42
|
-
var Option = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
|
|
42
|
+
var Option = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n color: ", ";\n display: flex;\n align-items: center;\n padding: 5px;\n"])), function (props) {
|
|
43
43
|
return props.theme.colors.secundaryContrast;
|
|
44
44
|
});
|
|
45
45
|
exports.Option = Option;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.PlaceholderTitle = exports.Option = void 0;
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9
|
|
9
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
12
12
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
@@ -21,16 +21,13 @@ var Option = _styledComponents.default.div(_templateObject || (_templateObject =
|
|
|
21
21
|
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.rtl) && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: 5px;\n margin-right: 0px;\n "])));
|
|
22
22
|
}, function (_ref3) {
|
|
23
23
|
var isDefault = _ref3.isDefault;
|
|
24
|
-
return !isDefault && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n
|
|
25
|
-
var _props$theme2;
|
|
26
|
-
return (_props$theme2 = props.theme) !== null && _props$theme2 !== void 0 && _props$theme2.rtl ? (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-right: 10px;\n "]))) : (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin-left: 10px;\n "])));
|
|
27
|
-
});
|
|
24
|
+
return !isDefault && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: 10px;\n "])));
|
|
28
25
|
});
|
|
29
26
|
exports.Option = Option;
|
|
30
|
-
var PlaceholderTitle = (0, _styledComponents.default)(Option)(
|
|
27
|
+
var PlaceholderTitle = (0, _styledComponents.default)(Option)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 200px;\n\n ", "\n"])), function (props) {
|
|
31
28
|
return props.theme.colors.headingColor;
|
|
32
29
|
}, function (_ref4) {
|
|
33
30
|
var isDefault = _ref4.isDefault;
|
|
34
|
-
return isDefault ? (0, _styledComponents.css)(
|
|
31
|
+
return isDefault ? (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: 5px 15px;\n "]))) : (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 10px;\n margin-right: 0px;\n margin-left: 0px;\n "])));
|
|
35
32
|
});
|
|
36
33
|
exports.PlaceholderTitle = PlaceholderTitle;
|
|
@@ -27,7 +27,9 @@ var InputPhoneNumber = function InputPhoneNumber(props) {
|
|
|
27
27
|
value = props.value,
|
|
28
28
|
setValue = props.setValue,
|
|
29
29
|
handleIsValid = props.handleIsValid,
|
|
30
|
-
disabled = props.disabled
|
|
30
|
+
disabled = props.disabled,
|
|
31
|
+
isUser = props.isUser,
|
|
32
|
+
defaultCountry = props.defaultCountry;
|
|
31
33
|
var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
|
|
32
34
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
33
35
|
t = _useLanguage2[1];
|
|
@@ -62,7 +64,7 @@ var InputPhoneNumber = function InputPhoneNumber(props) {
|
|
|
62
64
|
}), /*#__PURE__*/_react.default.createElement(_reactPhoneNumberInput.default, {
|
|
63
65
|
disabled: disabled,
|
|
64
66
|
placeholder: t('PHONE_NUMBER', 'Phone number'),
|
|
65
|
-
defaultCountry: (0, _utils.findExitingCode)(configs === null || configs === void 0 ? void 0 : (_configs$default_coun = configs.default_country_code) === null || _configs$default_coun === void 0 ? void 0 : (_configs$default_coun2 = _configs$default_coun.value) === null || _configs$default_coun2 === void 0 ? void 0 : _configs$default_coun2.toUpperCase()),
|
|
67
|
+
defaultCountry: defaultCountry !== null && defaultCountry !== void 0 ? defaultCountry : (0, _utils.findExitingCode)(configs === null || configs === void 0 ? void 0 : (_configs$default_coun = configs.default_country_code) === null || _configs$default_coun === void 0 ? void 0 : (_configs$default_coun2 = _configs$default_coun.value) === null || _configs$default_coun2 === void 0 ? void 0 : _configs$default_coun2.toUpperCase()),
|
|
66
68
|
value: value,
|
|
67
69
|
displayInitialValueAsLocalNumber: true,
|
|
68
70
|
onChange: function onChange(val) {
|
|
@@ -48,6 +48,7 @@ var UserAddFormUI = function UserAddFormUI(props) {
|
|
|
48
48
|
handleChangeUserType = props.handleChangeUserType,
|
|
49
49
|
handlechangeImage = props.handlechangeImage,
|
|
50
50
|
handleChangeSwtich = props.handleChangeSwtich,
|
|
51
|
+
defaultCountry = props.defaultCountry,
|
|
51
52
|
defaultPhoneNumber = props.defaultPhoneNumber,
|
|
52
53
|
isFromCustomOrder = props.isFromCustomOrder,
|
|
53
54
|
hideUserTypeSelector = props.hideUserTypeSelector;
|
|
@@ -238,7 +239,6 @@ var UserAddFormUI = function UserAddFormUI(props) {
|
|
|
238
239
|
}, [formMethods]);
|
|
239
240
|
(0, _react.useEffect)(function () {
|
|
240
241
|
if (defaultPhoneNumber) {
|
|
241
|
-
setUserPhoneNumber(defaultPhoneNumber);
|
|
242
242
|
handleChangePhoneNumber(defaultPhoneNumber, true);
|
|
243
243
|
}
|
|
244
244
|
}, [defaultPhoneNumber]);
|
|
@@ -302,10 +302,11 @@ var UserAddFormUI = function UserAddFormUI(props) {
|
|
|
302
302
|
autoComplete: "off"
|
|
303
303
|
}));
|
|
304
304
|
}), !!showInputPhoneNumber && /*#__PURE__*/_react.default.createElement(_Shared.InputPhoneNumber, {
|
|
305
|
+
defaultCountry: defaultCountry,
|
|
305
306
|
value: userPhoneNumber,
|
|
306
307
|
setValue: handleChangePhoneNumber,
|
|
307
308
|
handleIsValid: setIsValidPhoneNumber
|
|
308
|
-
}), !isCheckout && /*#__PURE__*/_react.default.createElement(_styles.Input, {
|
|
309
|
+
}), !isCheckout && !isFromCustomOrder && /*#__PURE__*/_react.default.createElement(_styles.Input, {
|
|
309
310
|
type: "password",
|
|
310
311
|
name: "password",
|
|
311
312
|
className: "form",
|
package/_modules/utils/index.js
CHANGED
|
@@ -365,7 +365,7 @@ var convertHMS = function convertHMS(value) {
|
|
|
365
365
|
if (seconds < 10) {
|
|
366
366
|
seconds = '0' + seconds;
|
|
367
367
|
}
|
|
368
|
-
return sec < 0 ? '-' : '' + hours + ':' + minutes + ':' + seconds; // Return is HH : MM : SS
|
|
368
|
+
return sec < 0 ? '-' : '' + (hours === '00' ? '' : hours + ':') + minutes + ':' + seconds; // Return is HH : MM : SS
|
|
369
369
|
};
|
|
370
370
|
|
|
371
371
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-admin-external",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.3",
|
|
4
4
|
"description": "Ordering UI Admin Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lodash": "^4.17.20",
|
|
84
84
|
"moment": "^2.29.1",
|
|
85
85
|
"moment-range": "^4.0.2",
|
|
86
|
-
"ordering-components-admin-external": "1.30.
|
|
86
|
+
"ordering-components-admin-external": "1.30.3",
|
|
87
87
|
"polished": "^3.6.7",
|
|
88
88
|
"prop-types": "^15.7.2",
|
|
89
89
|
"react-big-calendar": "^1.4.2",
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
EmptyContent
|
|
12
12
|
} from './styles'
|
|
13
13
|
import Skeleton from 'react-loading-skeleton'
|
|
14
|
+
import { convertHMS } from '../../../utils'
|
|
14
15
|
|
|
15
16
|
export const AnalyticsOrdersAcceptSpend = (props) => {
|
|
16
17
|
const {
|
|
@@ -41,8 +42,7 @@ export const AnalyticsOrdersAcceptSpend = (props) => {
|
|
|
41
42
|
dataList?.data ? (
|
|
42
43
|
<OrdersAcceptSpendContent>
|
|
43
44
|
<TimeContentWrapper>
|
|
44
|
-
<h1>{dataList?.data && (parseNumber(((dataList?.data * 1)
|
|
45
|
-
<p>{t('MINUTES', 'Minutes')}</p>
|
|
45
|
+
<h1>{dataList?.data && convertHMS(parseNumber(((dataList?.data * 1)), { separator: '.' }))}</h1>
|
|
46
46
|
</TimeContentWrapper>
|
|
47
47
|
<ReviewContentWrapper>
|
|
48
48
|
<ReviewBlock>
|
|
@@ -33,6 +33,7 @@ export const ReviewContentWrapper = styled.div`
|
|
|
33
33
|
export const TimeContentWrapper = styled.div`
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: column;
|
|
36
|
+
margin-bottom: 35px;
|
|
36
37
|
|
|
37
38
|
h1{
|
|
38
39
|
font-weight: 500;
|
|
@@ -51,7 +52,6 @@ export const OrdersAcceptSpendContent = styled.div`
|
|
|
51
52
|
display: flex;
|
|
52
53
|
align-items: flex-end;
|
|
53
54
|
justify-content: space-between;
|
|
54
|
-
margin-bottom: 30px;
|
|
55
55
|
`
|
|
56
56
|
|
|
57
57
|
export const ReviewBlock = styled.div`
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
EmptyContent
|
|
12
12
|
} from './styles'
|
|
13
13
|
import Skeleton from 'react-loading-skeleton'
|
|
14
|
+
import { convertHMS } from '../../../utils'
|
|
14
15
|
|
|
15
16
|
export const AnalyticsSpendList = (props) => {
|
|
16
17
|
const {
|
|
@@ -42,8 +43,7 @@ export const AnalyticsSpendList = (props) => {
|
|
|
42
43
|
dataList?.data ? (
|
|
43
44
|
<AnalyticsSpendListContent>
|
|
44
45
|
<TimeContentWrapper>
|
|
45
|
-
<h1>{parseNumber((dataList?.data * 1), { separator: '.' })}</h1>
|
|
46
|
-
<p>{t('SECONDS', 'Seconds')}</p>
|
|
46
|
+
<h1>{convertHMS(parseNumber((dataList?.data * 1), { separator: '.' }))}</h1>
|
|
47
47
|
</TimeContentWrapper>
|
|
48
48
|
<ReviewContentWrapper>
|
|
49
49
|
<ReviewBlock>
|
|
@@ -34,6 +34,7 @@ export const ReviewContentWrapper = styled.div`
|
|
|
34
34
|
export const TimeContentWrapper = styled.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
|
+
margin-bottom: 35px;
|
|
37
38
|
|
|
38
39
|
h1{
|
|
39
40
|
font-weight: 500;
|
|
@@ -53,7 +54,6 @@ export const AnalyticsSpendListContent = styled.div`
|
|
|
53
54
|
display: flex;
|
|
54
55
|
align-items: flex-end;
|
|
55
56
|
justify-content: space-between;
|
|
56
|
-
margin-bottom: 30px;
|
|
57
57
|
flex-wrap: wrap;
|
|
58
58
|
> div {
|
|
59
59
|
margin-top: 10px;
|
|
@@ -33,7 +33,7 @@ export const AnalyticsSpendTimes = (props) => {
|
|
|
33
33
|
return axe === history?.time
|
|
34
34
|
})
|
|
35
35
|
if (index !== -1) {
|
|
36
|
-
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.accept_spend })
|
|
36
|
+
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.accept_spend ? chartDataList?.data[index]?.accept_spend / 60 : 0 })
|
|
37
37
|
} else {
|
|
38
38
|
values.push({ x: axe, y: 0 })
|
|
39
39
|
}
|
|
@@ -48,7 +48,7 @@ export const AnalyticsSpendTimes = (props) => {
|
|
|
48
48
|
return axe === history?.time
|
|
49
49
|
})
|
|
50
50
|
if (index !== -1) {
|
|
51
|
-
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.pickup_spend })
|
|
51
|
+
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.pickup_spend ? chartDataList?.data[index]?.pickup_spend / 60 : 0 })
|
|
52
52
|
} else {
|
|
53
53
|
values.push({ x: axe, y: 0 })
|
|
54
54
|
}
|
|
@@ -63,7 +63,7 @@ export const AnalyticsSpendTimes = (props) => {
|
|
|
63
63
|
return axe === history?.time
|
|
64
64
|
})
|
|
65
65
|
if (index !== -1) {
|
|
66
|
-
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.delivery_spend })
|
|
66
|
+
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.delivery_spend ? chartDataList?.data[index]?.delivery_spend / 60 : 0 })
|
|
67
67
|
} else {
|
|
68
68
|
values.push({ x: axe, y: 0 })
|
|
69
69
|
}
|
|
@@ -78,7 +78,7 @@ export const AnalyticsSpendTimes = (props) => {
|
|
|
78
78
|
return axe === history?.time
|
|
79
79
|
})
|
|
80
80
|
if (index !== -1) {
|
|
81
|
-
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.complete_spend })
|
|
81
|
+
values.push({ x: chartDataList?.data[index]?.time, y: chartDataList?.data[index]?.complete_spend ? chartDataList?.data[index]?.complete_spend / 60 : 0 })
|
|
82
82
|
} else {
|
|
83
83
|
values.push({ x: axe, y: 0 })
|
|
84
84
|
}
|
|
@@ -29,11 +29,12 @@ const CustomOrderDetailsUI = (props) => {
|
|
|
29
29
|
handeUpdateProductCart,
|
|
30
30
|
cart,
|
|
31
31
|
onClose,
|
|
32
|
-
handleOpenCustomOrderDetail
|
|
32
|
+
handleOpenCustomOrderDetail,
|
|
33
|
+
defaultCountryCodeState
|
|
33
34
|
} = props
|
|
34
35
|
|
|
35
36
|
const [, t] = useLanguage()
|
|
36
|
-
const [, { changeAddress }] = useOrder()
|
|
37
|
+
const [orderState, { changeAddress }] = useOrder()
|
|
37
38
|
|
|
38
39
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
39
40
|
|
|
@@ -56,9 +57,9 @@ const CustomOrderDetailsUI = (props) => {
|
|
|
56
57
|
}, [customerAddress?.id])
|
|
57
58
|
|
|
58
59
|
useEffect(() => {
|
|
59
|
-
if (!customerAddress?.location) return
|
|
60
|
+
if (!customerAddress?.location || orderState?.loading) return
|
|
60
61
|
getBusinessList(customerAddress.location)
|
|
61
|
-
}, [customerAddress?.location])
|
|
62
|
+
}, [customerAddress?.location, orderState])
|
|
62
63
|
|
|
63
64
|
useEffect(() => {
|
|
64
65
|
if (customersPhones?.error) {
|
|
@@ -78,6 +79,7 @@ const CustomOrderDetailsUI = (props) => {
|
|
|
78
79
|
onChangeNumber={onChangeNumber}
|
|
79
80
|
handleParentSidebarMove={handleParentSidebarMove}
|
|
80
81
|
customerAddress={customerAddress}
|
|
82
|
+
defaultCountryCodeState={defaultCountryCodeState}
|
|
81
83
|
/>
|
|
82
84
|
{customerAddress?.location && (
|
|
83
85
|
<>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState, useEffect } from 'react'
|
|
2
|
-
import { useConfig } from 'ordering-components-admin-external'
|
|
2
|
+
import { useConfig, useOrder } from 'ordering-components-admin-external'
|
|
3
3
|
import GoogleMapReact, { fitBounds } from 'google-map-react'
|
|
4
4
|
import { InterActOrderMarker } from '../../InterActOrderMarker'
|
|
5
5
|
|
|
@@ -11,10 +11,13 @@ export const Map = (props) => {
|
|
|
11
11
|
customer,
|
|
12
12
|
customerLocation
|
|
13
13
|
} = props
|
|
14
|
+
|
|
14
15
|
const [{ configs }] = useConfig()
|
|
16
|
+
const [orderState] = useOrder()
|
|
15
17
|
|
|
16
18
|
const mapRef = useRef(null)
|
|
17
19
|
const googleMapsApiKey = useMemo(() => configs?.google_maps_api_key?.value, [configs])
|
|
20
|
+
const deliveryType = useMemo(() => orderState?.options?.type, [orderState])
|
|
18
21
|
const defaultLatitude = Number(configs?.location_default_latitude?.value)
|
|
19
22
|
const defaultLongitude = Number(configs?.location_default_longitude?.value)
|
|
20
23
|
const isInvalidDefaultLocation = isNaN(defaultLatitude) || isNaN(defaultLongitude)
|
|
@@ -23,10 +26,27 @@ export const Map = (props) => {
|
|
|
23
26
|
lng: !isInvalidDefaultLocation ? defaultLongitude : -73.9678064
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
const greenFillStyle = {
|
|
30
|
+
fillColor: '#008000',
|
|
31
|
+
fillOpacity: 0.3,
|
|
32
|
+
strokeColor: '#008000',
|
|
33
|
+
strokeOpacity: 0.8,
|
|
34
|
+
strokeWeight: 2
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const units = {
|
|
38
|
+
mi: 1609,
|
|
39
|
+
km: 1000
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
const defaultZoom = 10
|
|
27
43
|
const [mapLoaded, setMapLoaded] = useState(true)
|
|
28
44
|
const [mapCenter, setMapCenter] = useState(defaultCenter)
|
|
29
45
|
const [mapZoom, setMapZoom] = useState(10)
|
|
46
|
+
const [map, setMap] = useState(null)
|
|
47
|
+
const [maps, setMaps] = useState(null)
|
|
48
|
+
const [circleZones, setCircleZones] = useState([])
|
|
49
|
+
const [polygonZones, setPolygonZones] = useState([])
|
|
30
50
|
|
|
31
51
|
const handleMapChange = (data) => {
|
|
32
52
|
if (!data?.zoom) return
|
|
@@ -51,6 +71,59 @@ export const Map = (props) => {
|
|
|
51
71
|
newPoint = new window.google.maps.LatLng(marker.lat, marker.lng)
|
|
52
72
|
bounds.extend(newPoint)
|
|
53
73
|
|
|
74
|
+
// drwa delivery zones
|
|
75
|
+
circleZones.forEach(circle => circle.setMap(null))
|
|
76
|
+
polygonZones.forEach(polygon => polygon.setMap(null))
|
|
77
|
+
const _circleZones = []
|
|
78
|
+
const _polygonZones = []
|
|
79
|
+
if (map && maps && business?.zones && deliveryType === 1) {
|
|
80
|
+
const center = business?.location
|
|
81
|
+
for (const deliveryZone of business.zones) {
|
|
82
|
+
if (deliveryZone.type === 1 && deliveryZone?.data?.center && deliveryZone?.data?.radio) {
|
|
83
|
+
const newCircleZone = new window.google.maps.Circle({
|
|
84
|
+
...greenFillStyle,
|
|
85
|
+
editable: false,
|
|
86
|
+
center: deliveryZone?.data.center,
|
|
87
|
+
radius: deliveryZone?.data.radio * 1000
|
|
88
|
+
})
|
|
89
|
+
newCircleZone.setMap(map)
|
|
90
|
+
bounds.union(newCircleZone.getBounds())
|
|
91
|
+
map.fitBounds(bounds)
|
|
92
|
+
_circleZones.push(newCircleZone)
|
|
93
|
+
}
|
|
94
|
+
if (deliveryZone.type === 5 && deliveryZone?.data?.distance) {
|
|
95
|
+
const newCircleZone = new window.google.maps.Circle({
|
|
96
|
+
...greenFillStyle,
|
|
97
|
+
editable: false,
|
|
98
|
+
center: center,
|
|
99
|
+
radius: deliveryZone?.data.distance * units[deliveryZone?.data?.unit]
|
|
100
|
+
})
|
|
101
|
+
newCircleZone.setMap(map)
|
|
102
|
+
bounds.union(newCircleZone.getBounds())
|
|
103
|
+
map.fitBounds(bounds)
|
|
104
|
+
_circleZones.push(newCircleZone)
|
|
105
|
+
}
|
|
106
|
+
if (deliveryZone?.type === 2 && Array.isArray(deliveryZone?.data)) {
|
|
107
|
+
const newPolygonZone = new window.google.maps.Polygon({
|
|
108
|
+
...greenFillStyle,
|
|
109
|
+
editable: false,
|
|
110
|
+
paths: deliveryZone?.data
|
|
111
|
+
})
|
|
112
|
+
newPolygonZone.setMap(map)
|
|
113
|
+
if (Array.isArray(deliveryZone?.data)) {
|
|
114
|
+
for (const position of deliveryZone?.data) {
|
|
115
|
+
bounds.extend(position)
|
|
116
|
+
}
|
|
117
|
+
map.fitBounds(bounds)
|
|
118
|
+
}
|
|
119
|
+
_polygonZones.push(newPolygonZone)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
setCircleZones(_circleZones)
|
|
124
|
+
setPolygonZones(_polygonZones)
|
|
125
|
+
|
|
126
|
+
// fit map center and zoone
|
|
54
127
|
const newBounds = {
|
|
55
128
|
ne: {
|
|
56
129
|
lat: bounds.getNorthEast()?.lat?.(),
|
|
@@ -74,7 +147,13 @@ export const Map = (props) => {
|
|
|
74
147
|
useEffect(() => {
|
|
75
148
|
if (mapLoaded) return
|
|
76
149
|
mapFit()
|
|
77
|
-
}, [customerLocation, business?.location, mapLoaded])
|
|
150
|
+
}, [customerLocation, business?.location, mapLoaded, map, maps, business?.zones, deliveryType])
|
|
151
|
+
|
|
152
|
+
const onMapLoaded = (map, maps) => {
|
|
153
|
+
setMapLoaded(false)
|
|
154
|
+
setMap(map)
|
|
155
|
+
setMaps(maps)
|
|
156
|
+
}
|
|
78
157
|
|
|
79
158
|
return (
|
|
80
159
|
<Container ref={mapRef}>
|
|
@@ -84,7 +163,7 @@ export const Map = (props) => {
|
|
|
84
163
|
key: window.document.getElementById('__googleMapsScriptId') ? null : googleMapsApiKey,
|
|
85
164
|
libraries: ['places', 'geometry', 'drawing', 'visualization']
|
|
86
165
|
}}
|
|
87
|
-
onGoogleApiLoaded={() =>
|
|
166
|
+
onGoogleApiLoaded={({ map, maps }) => onMapLoaded(map, maps)}
|
|
88
167
|
defaultCenter={defaultCenter}
|
|
89
168
|
center={mapCenter}
|
|
90
169
|
defaultZoom={defaultZoom}
|