ordering-ui-admin-external 1.43.99 → 1.44.100

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.
@@ -7,7 +7,6 @@ exports.DeliveriesLocation = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _orderingComponentsAdminExternal = require("ordering-components-admin-external");
9
9
  var _googleMapReact = _interopRequireWildcard(require("google-map-react"));
10
- var _DriverMapMarkerAndInfo = require("../DriverMapMarkerAndInfo");
11
10
  var _InterActOrderMarker = require("../InterActOrderMarker");
12
11
  var _Shared = require("../../Shared");
13
12
  var _styledComponents = require("styled-components");
@@ -31,7 +30,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
31
30
  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; } }
32
31
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
33
32
  var DeliveriesLocation = exports.DeliveriesLocation = function DeliveriesLocation(props) {
34
- var _configState$configs, _configState$configs2, _configState$configs3, _interActionMapOrder$6, _interActionMapOrder$7, _interActionMapOrder$8, _interActionMapOrder$9, _interActionMapOrder$10, _interActionMapOrder$11, _interActionMapOrder$12, _interActionMapOrder$13, _interActionMapOrder$14;
33
+ var _configState$configs, _configState$configs2, _configState$configs3, _interActionMapOrder$2, _interActionMapOrder$7, _interActionMapOrder$8, _interActionMapOrder$9, _interActionMapOrder$10, _interActionMapOrder$11, _interActionMapOrder$12, _interActionMapOrder$13, _interActionMapOrder$14, _interActionMapOrder$15;
35
34
  var driversList = props.driversList,
36
35
  interActionMapOrder = props.interActionMapOrder;
37
36
  var theme = (0, _styledComponents.useTheme)();
@@ -75,20 +74,23 @@ var DeliveriesLocation = exports.DeliveriesLocation = function DeliveriesLocatio
75
74
  _useState10 = _slicedToArray(_useState9, 2),
76
75
  mapFitted = _useState10[0],
77
76
  setMapFitted = _useState10[1];
78
- var _useState11 = (0, _react.useState)(null),
79
- _useState12 = _slicedToArray(_useState11, 2),
80
- interActionOrderDriverLocation = _useState12[0],
81
- setInterActionOrderDriverLocation = _useState12[1];
82
77
  var defaultZoom = 10;
83
78
  var mapRef = (0, _react.useRef)(null);
79
+ var interActionOrderDriverLocation = (0, _react.useMemo)(function () {
80
+ var _driversList$drivers, _driversList$drivers$;
81
+ return (driversList === null || driversList === void 0 || (_driversList$drivers = driversList.drivers) === null || _driversList$drivers === void 0 || (_driversList$drivers$ = _driversList$drivers.find) === null || _driversList$drivers$ === void 0 || (_driversList$drivers$ = _driversList$drivers$.call(_driversList$drivers, function (driver) {
82
+ var _interActionMapOrder$;
83
+ return (driver === null || driver === void 0 ? void 0 : driver.id) === (interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$ = interActionMapOrder.driver) === null || _interActionMapOrder$ === void 0 ? void 0 : _interActionMapOrder$.id);
84
+ })) === null || _driversList$drivers$ === void 0 ? void 0 : _driversList$drivers$.location) || null;
85
+ }, [JSON.stringify(driversList === null || driversList === void 0 ? void 0 : driversList.drivers), interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$2 = interActionMapOrder.driver) === null || _interActionMapOrder$2 === void 0 ? void 0 : _interActionMapOrder$2.id]);
84
86
  var mapFit = function mapFit() {
85
87
  var bounds = new window.google.maps.LatLngBounds();
86
88
  if (interActionMapOrder === null) {
87
89
  if (driversList.drivers.length === 1) {
88
- var _driversList$drivers$, _driversList$drivers$2, _driversList$drivers$3, _driversList$drivers$4;
89
- setMapCenter(driversList.drivers[0].location !== null && _typeof(driversList.drivers[0].location) === 'object' && (_driversList$drivers$ = driversList.drivers[0].location) !== null && _driversList$drivers$ !== void 0 && _driversList$drivers$.lat && (_driversList$drivers$2 = driversList.drivers[0].location) !== null && _driversList$drivers$2 !== void 0 && _driversList$drivers$2.lng ? driversList.drivers[0].location : typeof driversList.drivers[0].location === 'string' ? {
90
- lat: parseFloat((_driversList$drivers$3 = driversList.drivers[0]) === null || _driversList$drivers$3 === void 0 || (_driversList$drivers$3 = _driversList$drivers$3.location) === null || _driversList$drivers$3 === void 0 ? void 0 : _driversList$drivers$3.split(',')[0].replace(/[^-.0-9]/g, '')),
91
- lng: parseFloat((_driversList$drivers$4 = driversList.drivers[0]) === null || _driversList$drivers$4 === void 0 || (_driversList$drivers$4 = _driversList$drivers$4.location) === null || _driversList$drivers$4 === void 0 ? void 0 : _driversList$drivers$4.split(',')[1].replace(/[^-.0-9]/g, ''))
90
+ var _driversList$drivers$2, _driversList$drivers$3, _driversList$drivers$4, _driversList$drivers$5;
91
+ setMapCenter(driversList.drivers[0].location !== null && _typeof(driversList.drivers[0].location) === 'object' && (_driversList$drivers$2 = driversList.drivers[0].location) !== null && _driversList$drivers$2 !== void 0 && _driversList$drivers$2.lat && (_driversList$drivers$3 = driversList.drivers[0].location) !== null && _driversList$drivers$3 !== void 0 && _driversList$drivers$3.lng ? driversList.drivers[0].location : typeof driversList.drivers[0].location === 'string' ? {
92
+ lat: parseFloat((_driversList$drivers$4 = driversList.drivers[0]) === null || _driversList$drivers$4 === void 0 || (_driversList$drivers$4 = _driversList$drivers$4.location) === null || _driversList$drivers$4 === void 0 ? void 0 : _driversList$drivers$4.split(',')[0].replace(/[^-.0-9]/g, '')),
93
+ lng: parseFloat((_driversList$drivers$5 = driversList.drivers[0]) === null || _driversList$drivers$5 === void 0 || (_driversList$drivers$5 = _driversList$drivers$5.location) === null || _driversList$drivers$5 === void 0 ? void 0 : _driversList$drivers$5.split(',')[1].replace(/[^-.0-9]/g, ''))
92
94
  } : defaultCenter);
93
95
  setMapZoom(defaultZoom);
94
96
  return;
@@ -113,12 +115,12 @@ var DeliveriesLocation = exports.DeliveriesLocation = function DeliveriesLocatio
113
115
  }
114
116
  }
115
117
  if (interActionMapOrder !== null) {
116
- var _interActionMapOrder$, _interActionMapOrder$2, _interActionMapOrder$3, _interActionMapOrder$4;
118
+ var _interActionMapOrder$3, _interActionMapOrder$4, _interActionMapOrder$5, _interActionMapOrder$6;
117
119
  var _marker, _newPoint;
118
- _marker = (interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$ = interActionMapOrder.business) === null || _interActionMapOrder$ === void 0 ? void 0 : _interActionMapOrder$.location) !== null ? interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$2 = interActionMapOrder.business) === null || _interActionMapOrder$2 === void 0 ? void 0 : _interActionMapOrder$2.location : defaultCenter;
120
+ _marker = (interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$3 = interActionMapOrder.business) === null || _interActionMapOrder$3 === void 0 ? void 0 : _interActionMapOrder$3.location) !== null ? interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$4 = interActionMapOrder.business) === null || _interActionMapOrder$4 === void 0 ? void 0 : _interActionMapOrder$4.location : defaultCenter;
119
121
  _newPoint = new window.google.maps.LatLng(_marker.lat, _marker.lng);
120
122
  bounds.extend(_newPoint);
121
- _marker = (interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$3 = interActionMapOrder.customer) === null || _interActionMapOrder$3 === void 0 ? void 0 : _interActionMapOrder$3.location) !== null && interActionMapOrder !== null && interActionMapOrder !== void 0 && (_interActionMapOrder$4 = interActionMapOrder.customer) !== null && _interActionMapOrder$4 !== void 0 && (_interActionMapOrder$4 = _interActionMapOrder$4.location) !== null && _interActionMapOrder$4 !== void 0 && _interActionMapOrder$4.lat ? interActionMapOrder.customer.location : defaultCenter;
123
+ _marker = (interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$5 = interActionMapOrder.customer) === null || _interActionMapOrder$5 === void 0 ? void 0 : _interActionMapOrder$5.location) !== null && interActionMapOrder !== null && interActionMapOrder !== void 0 && (_interActionMapOrder$6 = interActionMapOrder.customer) !== null && _interActionMapOrder$6 !== void 0 && (_interActionMapOrder$6 = _interActionMapOrder$6.location) !== null && _interActionMapOrder$6 !== void 0 && _interActionMapOrder$6.lat ? interActionMapOrder.customer.location : defaultCenter;
122
124
  _newPoint = new window.google.maps.LatLng(_marker.lat, _marker.lng);
123
125
  bounds.extend(_newPoint);
124
126
  if (interActionMapOrder.driver !== null) {
@@ -168,23 +170,6 @@ var DeliveriesLocation = exports.DeliveriesLocation = function DeliveriesLocatio
168
170
  // Fit bounds on mount, and when the markers change
169
171
  (0, _react.useEffect)(function () {
170
172
  if (driversList.loading || driversList.drivers.length === 0 || mapLoaded) return;
171
- if (interActionMapOrder !== null) {
172
- var _iterator3 = _createForOfIteratorHelper(driversList.drivers),
173
- _step3;
174
- try {
175
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
176
- var _interActionMapOrder$5;
177
- var driver = _step3.value;
178
- if (driver.id === (interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$5 = interActionMapOrder.driver) === null || _interActionMapOrder$5 === void 0 ? void 0 : _interActionMapOrder$5.id)) {
179
- setInterActionOrderDriverLocation(driver.location);
180
- }
181
- }
182
- } catch (err) {
183
- _iterator3.e(err);
184
- } finally {
185
- _iterator3.f();
186
- }
187
- }
188
173
  if (!mapFitted) {
189
174
  mapFit();
190
175
  }
@@ -318,20 +303,20 @@ var DeliveriesLocation = exports.DeliveriesLocation = function DeliveriesLocatio
318
303
  yesIWantToUseGoogleMapApiInternals: true
319
304
  }, interActionMapOrder !== null && /*#__PURE__*/_react.default.createElement(_InterActOrderMarker.InterActOrderMarker, {
320
305
  business: interActionMapOrder === null || interActionMapOrder === void 0 ? void 0 : interActionMapOrder.business,
321
- lat: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$6 = interActionMapOrder.business) === null || _interActionMapOrder$6 === void 0 || (_interActionMapOrder$6 = _interActionMapOrder$6.location) === null || _interActionMapOrder$6 === void 0 ? void 0 : _interActionMapOrder$6.lat,
322
- lng: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$7 = interActionMapOrder.business) === null || _interActionMapOrder$7 === void 0 || (_interActionMapOrder$7 = _interActionMapOrder$7.location) === null || _interActionMapOrder$7 === void 0 ? void 0 : _interActionMapOrder$7.lng,
323
- image: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$8 = interActionMapOrder.business) === null || _interActionMapOrder$8 === void 0 ? void 0 : _interActionMapOrder$8.logo
306
+ lat: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$7 = interActionMapOrder.business) === null || _interActionMapOrder$7 === void 0 || (_interActionMapOrder$7 = _interActionMapOrder$7.location) === null || _interActionMapOrder$7 === void 0 ? void 0 : _interActionMapOrder$7.lat,
307
+ lng: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$8 = interActionMapOrder.business) === null || _interActionMapOrder$8 === void 0 || (_interActionMapOrder$8 = _interActionMapOrder$8.location) === null || _interActionMapOrder$8 === void 0 ? void 0 : _interActionMapOrder$8.lng,
308
+ image: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$9 = interActionMapOrder.business) === null || _interActionMapOrder$9 === void 0 ? void 0 : _interActionMapOrder$9.logo
324
309
  }), interActionMapOrder !== null && /*#__PURE__*/_react.default.createElement(_InterActOrderMarker.InterActOrderMarker, {
325
310
  customer: interActionMapOrder === null || interActionMapOrder === void 0 ? void 0 : interActionMapOrder.customer,
326
- lat: interActionMapOrder !== null && interActionMapOrder !== void 0 && (_interActionMapOrder$9 = interActionMapOrder.customer) !== null && _interActionMapOrder$9 !== void 0 && (_interActionMapOrder$9 = _interActionMapOrder$9.location) !== null && _interActionMapOrder$9 !== void 0 && _interActionMapOrder$9.lat ? interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$10 = interActionMapOrder.customer) === null || _interActionMapOrder$10 === void 0 || (_interActionMapOrder$10 = _interActionMapOrder$10.location) === null || _interActionMapOrder$10 === void 0 ? void 0 : _interActionMapOrder$10.lat : defaultCenter.lat,
327
- lng: interActionMapOrder !== null && interActionMapOrder !== void 0 && (_interActionMapOrder$11 = interActionMapOrder.customer) !== null && _interActionMapOrder$11 !== void 0 && (_interActionMapOrder$11 = _interActionMapOrder$11.location) !== null && _interActionMapOrder$11 !== void 0 && _interActionMapOrder$11.lng ? interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$12 = interActionMapOrder.customer) === null || _interActionMapOrder$12 === void 0 || (_interActionMapOrder$12 = _interActionMapOrder$12.location) === null || _interActionMapOrder$12 === void 0 ? void 0 : _interActionMapOrder$12.lng : defaultCenter.lng,
328
- image: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$13 = interActionMapOrder.customer) === null || _interActionMapOrder$13 === void 0 ? void 0 : _interActionMapOrder$13.photo
311
+ lat: interActionMapOrder !== null && interActionMapOrder !== void 0 && (_interActionMapOrder$10 = interActionMapOrder.customer) !== null && _interActionMapOrder$10 !== void 0 && (_interActionMapOrder$10 = _interActionMapOrder$10.location) !== null && _interActionMapOrder$10 !== void 0 && _interActionMapOrder$10.lat ? interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$11 = interActionMapOrder.customer) === null || _interActionMapOrder$11 === void 0 || (_interActionMapOrder$11 = _interActionMapOrder$11.location) === null || _interActionMapOrder$11 === void 0 ? void 0 : _interActionMapOrder$11.lat : defaultCenter.lat,
312
+ lng: interActionMapOrder !== null && interActionMapOrder !== void 0 && (_interActionMapOrder$12 = interActionMapOrder.customer) !== null && _interActionMapOrder$12 !== void 0 && (_interActionMapOrder$12 = _interActionMapOrder$12.location) !== null && _interActionMapOrder$12 !== void 0 && _interActionMapOrder$12.lng ? interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$13 = interActionMapOrder.customer) === null || _interActionMapOrder$13 === void 0 || (_interActionMapOrder$13 = _interActionMapOrder$13.location) === null || _interActionMapOrder$13 === void 0 ? void 0 : _interActionMapOrder$13.lng : defaultCenter.lng,
313
+ image: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$14 = interActionMapOrder.customer) === null || _interActionMapOrder$14 === void 0 ? void 0 : _interActionMapOrder$14.photo
329
314
  }), interActionMapOrder !== null && (interActionMapOrder === null || interActionMapOrder === void 0 ? void 0 : interActionMapOrder.driver) !== null && /*#__PURE__*/_react.default.createElement(_InterActOrderMarker.InterActOrderMarker, {
330
315
  driver: interActionMapOrder === null || interActionMapOrder === void 0 ? void 0 : interActionMapOrder.driver,
331
316
  timeStatus: interActionMapOrder === null || interActionMapOrder === void 0 ? void 0 : interActionMapOrder.time_status,
332
317
  lat: interActionOrderDriverLocation !== null && _typeof(interActionOrderDriverLocation) === 'object' && interActionOrderDriverLocation !== null && interActionOrderDriverLocation !== void 0 && interActionOrderDriverLocation.lat ? interActionOrderDriverLocation.lat : typeof interActionOrderDriverLocation === 'string' ? parseFloat(interActionOrderDriverLocation === null || interActionOrderDriverLocation === void 0 ? void 0 : interActionOrderDriverLocation.split(',')[0].replace(/[^-.0-9]/g, '')) : defaultCenter.lat,
333
318
  lng: interActionOrderDriverLocation !== null && _typeof(interActionOrderDriverLocation) === 'object' && interActionOrderDriverLocation !== null && interActionOrderDriverLocation !== void 0 && interActionOrderDriverLocation.lng ? interActionOrderDriverLocation.lng : typeof interActionOrderDriverLocation === 'string' ? parseFloat(interActionOrderDriverLocation === null || interActionOrderDriverLocation === void 0 ? void 0 : interActionOrderDriverLocation.split(',')[1].replace(/[^-.0-9]/g, '')) : defaultCenter.lng,
334
- image: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$14 = interActionMapOrder.driver) === null || _interActionMapOrder$14 === void 0 ? void 0 : _interActionMapOrder$14.photo
319
+ image: interActionMapOrder === null || interActionMapOrder === void 0 || (_interActionMapOrder$15 = interActionMapOrder.driver) === null || _interActionMapOrder$15 === void 0 ? void 0 : _interActionMapOrder$15.photo
335
320
  }), interActionMapOrder === null && activeDrivers.length > 0 && activeDrivers.map(function (driver) {
336
321
  var _driver$location5, _driver$location6, _driver$location7, _driver$location8;
337
322
  return /*#__PURE__*/_react.default.createElement(_InterActOrderMarker.InterActOrderMarker, {
@@ -144,8 +144,10 @@ var DeliveriesManagerUI = function DeliveriesManagerUI(props) {
144
144
  franchisesList: props.franchisesList,
145
145
  driverGroupList: driverGroupList,
146
146
  handleChangeFilterValues: handleChangeFilterValues,
147
- handleChangeSearch: handleChangeSearch
147
+ handleChangeSearch: handleChangeSearch,
148
+ setDetailsOrder: setDetailsOrder
148
149
  })))), isOpenOrderDetail && /*#__PURE__*/_react.default.createElement(_OrderDetails.OrderDetails, {
150
+ disableSocketRoomDriver: true,
149
151
  open: isOpenOrderDetail,
150
152
  order: detailsOrder,
151
153
  orderId: orderDetailId,
@@ -29,7 +29,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
29
29
  var DeliveryDashboard = exports.DeliveryDashboard = function DeliveryDashboard(props) {
30
30
  var _configs$optimize_ord;
31
31
  var driversList = props.driversList,
32
- searchValue = props.searchValue,
33
32
  ordersStatusGroup = props.ordersStatusGroup,
34
33
  selectedSubOrderStatus = props.selectedSubOrderStatus,
35
34
  handleOrdersStatusGroupFilter = props.handleOrdersStatusGroupFilter,
@@ -37,9 +36,7 @@ var DeliveryDashboard = exports.DeliveryDashboard = function DeliveryDashboard(p
37
36
  ordersAmountByStatus = props.ordersAmountByStatus,
38
37
  setOrdersAmountByStatus = props.setOrdersAmountByStatus,
39
38
  isUseQuery = props.isUseQuery,
40
- driverGroupList = props.driverGroupList,
41
- handleChangeFilterValues = props.handleChangeFilterValues,
42
- handleChangeSearch = props.handleChangeSearch;
39
+ setDetailsOrder = props.setDetailsOrder;
43
40
  var ordersDashboardListProps = _objectSpread({}, props);
44
41
  var _useConfig = (0, _orderingComponentsAdminExternal.useConfig)(),
45
42
  _useConfig2 = _slicedToArray(_useConfig, 1),
@@ -57,8 +54,10 @@ var DeliveryDashboard = exports.DeliveryDashboard = function DeliveryDashboard(p
57
54
  var handleLocation = function handleLocation(order) {
58
55
  if ((interActionMapOrder === null || interActionMapOrder === void 0 ? void 0 : interActionMapOrder.id) === (order === null || order === void 0 ? void 0 : order.id)) {
59
56
  setInterActionMapOrder(null);
57
+ setDetailsOrder(null);
60
58
  } else {
61
- setInterActionMapOrder(_objectSpread({}, order));
59
+ setInterActionMapOrder(order);
60
+ setDetailsOrder(order);
62
61
  }
63
62
  };
64
63
  return /*#__PURE__*/_react.default.createElement(_styles.DeliveryDashboardContainer, null, /*#__PURE__*/_react.default.createElement(_styles.OrdersContainer, null, /*#__PURE__*/_react.default.createElement(_styles.FilterContainer, null, /*#__PURE__*/_react.default.createElement(_OrderStatusFilterBar.OrderStatusFilterBar, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.43.99",
3
+ "version": "1.44.100",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -1,7 +1,6 @@
1
- import React, { useEffect, useRef, useState } from 'react'
1
+ import React, { useEffect, useRef, useState, useMemo } from 'react'
2
2
  import { useConfig, useLanguage, useApi, useSession } from 'ordering-components-admin-external'
3
3
  import GoogleMapReact, { fitBounds } from 'google-map-react'
4
- import { DriverMapMarkerAndInfo } from '../DriverMapMarkerAndInfo'
5
4
  import { InterActOrderMarker } from '../InterActOrderMarker'
6
5
  import { AutoScroll } from '../../Shared'
7
6
  import { useTheme } from 'styled-components'
@@ -44,10 +43,13 @@ export const DeliveriesLocation = (props) => {
44
43
  const [mapLoaded, setMapLoaded] = useState(true)
45
44
  const [mapFitted, setMapFitted] = useState(false)
46
45
 
47
- const [interActionOrderDriverLocation, setInterActionOrderDriverLocation] = useState(null)
48
46
  const defaultZoom = 10
49
47
  const mapRef = useRef(null)
50
48
 
49
+ const interActionOrderDriverLocation = useMemo(() => {
50
+ return driversList?.drivers?.find?.(driver => driver?.id === interActionMapOrder?.driver?.id)?.location || null
51
+ }, [JSON.stringify(driversList?.drivers), interActionMapOrder?.driver?.id])
52
+
51
53
  const mapFit = () => {
52
54
  const bounds = new window.google.maps.LatLngBounds()
53
55
 
@@ -127,13 +129,6 @@ export const DeliveriesLocation = (props) => {
127
129
  // Fit bounds on mount, and when the markers change
128
130
  useEffect(() => {
129
131
  if (driversList.loading || driversList.drivers.length === 0 || mapLoaded) return
130
- if (interActionMapOrder !== null) {
131
- for (const driver of driversList.drivers) {
132
- if (driver.id === interActionMapOrder?.driver?.id) {
133
- setInterActionOrderDriverLocation(driver.location)
134
- }
135
- }
136
- }
137
132
  if (!mapFitted) {
138
133
  mapFit()
139
134
  }
@@ -124,6 +124,7 @@ const DeliveriesManagerUI = (props) => {
124
124
  driverGroupList={driverGroupList}
125
125
  handleChangeFilterValues={handleChangeFilterValues}
126
126
  handleChangeSearch={handleChangeSearch}
127
+ setDetailsOrder={setDetailsOrder}
127
128
  />
128
129
  </WrapItemView>
129
130
  </OrdersContent>
@@ -131,6 +132,7 @@ const DeliveriesManagerUI = (props) => {
131
132
 
132
133
  {isOpenOrderDetail && (
133
134
  <OrderDetails
135
+ disableSocketRoomDriver
134
136
  open={isOpenOrderDetail}
135
137
  order={detailsOrder}
136
138
  orderId={orderDetailId}
@@ -16,7 +16,6 @@ import {
16
16
  export const DeliveryDashboard = (props) => {
17
17
  const {
18
18
  driversList,
19
- searchValue,
20
19
  ordersStatusGroup,
21
20
  selectedSubOrderStatus,
22
21
  handleOrdersStatusGroupFilter,
@@ -24,9 +23,7 @@ export const DeliveryDashboard = (props) => {
24
23
  ordersAmountByStatus,
25
24
  setOrdersAmountByStatus,
26
25
  isUseQuery,
27
- driverGroupList,
28
- handleChangeFilterValues,
29
- handleChangeSearch
26
+ setDetailsOrder
30
27
  } = props
31
28
 
32
29
  const ordersDashboardListProps = {
@@ -48,8 +45,10 @@ export const DeliveryDashboard = (props) => {
48
45
  const handleLocation = (order) => {
49
46
  if (interActionMapOrder?.id === order?.id) {
50
47
  setInterActionMapOrder(null)
48
+ setDetailsOrder(null)
51
49
  } else {
52
- setInterActionMapOrder({ ...order })
50
+ setInterActionMapOrder(order)
51
+ setDetailsOrder(order)
53
52
  }
54
53
  }
55
54