ordering-ui-admin-external 1.3.6 → 1.3.7

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.
@@ -42,7 +42,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
42
42
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
43
 
44
44
  var DeliveriesLocation = function DeliveriesLocation(props) {
45
- var _configState$configs, _configState$configs$, _interActionMapOrder$7, _interActionMapOrder$8, _interActionMapOrder$9, _interActionMapOrder$10, _interActionMapOrder$11, _interActionMapOrder$12, _interActionMapOrder$13, _interActionMapOrder$14, _interActionMapOrder$15, _interActionMapOrder$16, _interActionMapOrder$17, _interActionMapOrder$18, _interActionMapOrder$19, _interActionMapOrder$20, _interActionMapOrder$21;
45
+ var _configState$configs, _configState$configs$, _configState$configs2, _configState$configs3, _configState$configs4, _configState$configs5, _interActionMapOrder$7, _interActionMapOrder$8, _interActionMapOrder$9, _interActionMapOrder$10, _interActionMapOrder$11, _interActionMapOrder$12, _interActionMapOrder$13, _interActionMapOrder$14, _interActionMapOrder$15, _interActionMapOrder$16, _interActionMapOrder$17, _interActionMapOrder$18, _interActionMapOrder$19, _interActionMapOrder$20, _interActionMapOrder$21;
46
46
 
47
47
  var driversList = props.driversList,
48
48
  interActionMapOrder = props.interActionMapOrder;
@@ -57,11 +57,15 @@ var DeliveriesLocation = function DeliveriesLocation(props) {
57
57
  configState = _useConfig2[0];
58
58
 
59
59
  var googleMapsApiKey = configState === null || configState === void 0 ? void 0 : (_configState$configs = configState.configs) === null || _configState$configs === void 0 ? void 0 : (_configState$configs$ = _configState$configs.google_maps_api_key) === null || _configState$configs$ === void 0 ? void 0 : _configState$configs$.value;
60
+ var defaultLatitude = Number(configState === null || configState === void 0 ? void 0 : (_configState$configs2 = configState.configs) === null || _configState$configs2 === void 0 ? void 0 : (_configState$configs3 = _configState$configs2.location_default_latitude) === null || _configState$configs3 === void 0 ? void 0 : _configState$configs3.value);
61
+ var defaultLongitude = Number(configState === null || configState === void 0 ? void 0 : (_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 ? void 0 : (_configState$configs5 = _configState$configs4.location_default_longitude) === null || _configState$configs5 === void 0 ? void 0 : _configState$configs5.value);
62
+ var isInvalidDefaultLocation = isNaN(defaultLatitude) || isNaN(defaultLongitude);
63
+ var defaultCenter = {
64
+ lat: !isInvalidDefaultLocation ? defaultLatitude : 40.7744146,
65
+ lng: !isInvalidDefaultLocation ? defaultLongitude : -73.9678064
66
+ };
60
67
 
61
- var _useState = (0, _react.useState)({
62
- lat: 19.4326,
63
- lng: -99.1332
64
- }),
68
+ var _useState = (0, _react.useState)(defaultCenter),
65
69
  _useState2 = _slicedToArray(_useState, 2),
66
70
  mapCenter = _useState2[0],
67
71
  setMapCenter = _useState2[1];
@@ -91,10 +95,6 @@ var DeliveriesLocation = function DeliveriesLocation(props) {
91
95
  interActionOrderDriverLocation = _useState12[0],
92
96
  setInterActionOrderDriverLocation = _useState12[1];
93
97
 
94
- var defaultCenter = {
95
- lat: 19.4326,
96
- lng: -99.1332
97
- };
98
98
  var defaultZoom = 10;
99
99
  var mapRef = (0, _react.useRef)(null);
100
100
 
@@ -36,7 +36,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
36
36
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
37
 
38
38
  var DriversLocation = function DriversLocation(props) {
39
- var _configState$configs, _configState$configs$;
39
+ var _configState$configs, _configState$configs$, _configState$configs2, _configState$configs3, _configState$configs4, _configState$configs5;
40
40
 
41
41
  var driversIsOnline = props.driversIsOnline,
42
42
  onlineDrivers = props.onlineDrivers,
@@ -48,16 +48,21 @@ var DriversLocation = function DriversLocation(props) {
48
48
  configState = _useConfig2[0];
49
49
 
50
50
  var googleMapsApiKey = configState === null || configState === void 0 ? void 0 : (_configState$configs = configState.configs) === null || _configState$configs === void 0 ? void 0 : (_configState$configs$ = _configState$configs.google_maps_api_key) === null || _configState$configs$ === void 0 ? void 0 : _configState$configs$.value;
51
+ var defaultLatitude = Number(configState === null || configState === void 0 ? void 0 : (_configState$configs2 = configState.configs) === null || _configState$configs2 === void 0 ? void 0 : (_configState$configs3 = _configState$configs2.location_default_latitude) === null || _configState$configs3 === void 0 ? void 0 : _configState$configs3.value);
52
+ var defaultLongitude = Number(configState === null || configState === void 0 ? void 0 : (_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 ? void 0 : (_configState$configs5 = _configState$configs4.location_default_longitude) === null || _configState$configs5 === void 0 ? void 0 : _configState$configs5.value);
53
+ var isInvalidDefaultLocation = isNaN(defaultLatitude) || isNaN(defaultLongitude);
54
+ var defaultCenter = {
55
+ lat: !isInvalidDefaultLocation ? defaultLatitude : 40.7744146,
56
+ lng: !isInvalidDefaultLocation ? defaultLongitude : -73.9678064
57
+ };
58
+ var defaultZoom = 10;
51
59
 
52
- var _useState = (0, _react.useState)({
53
- lat: 19.4326,
54
- lng: -99.1332
55
- }),
60
+ var _useState = (0, _react.useState)(defaultCenter),
56
61
  _useState2 = _slicedToArray(_useState, 2),
57
62
  mapCenter = _useState2[0],
58
63
  setMapCenter = _useState2[1];
59
64
 
60
- var _useState3 = (0, _react.useState)(10),
65
+ var _useState3 = (0, _react.useState)(defaultZoom),
61
66
  _useState4 = _slicedToArray(_useState3, 2),
62
67
  mapZoom = _useState4[0],
63
68
  setMapZoom = _useState4[1];
@@ -72,11 +77,6 @@ var DriversLocation = function DriversLocation(props) {
72
77
  mapFitted = _useState8[0],
73
78
  setMapFitted = _useState8[1];
74
79
 
75
- var defaultCenter = {
76
- lat: 19.4326,
77
- lng: -99.1332
78
- };
79
- var defaultZoom = 10;
80
80
  var mapRef = (0, _react.useRef)(null);
81
81
 
82
82
  var _useState9 = (0, _react.useState)([]),
@@ -145,7 +145,14 @@ var DriversLocation = function DriversLocation(props) {
145
145
 
146
146
 
147
147
  (0, _react.useEffect)(function () {
148
- if (showDrivers.length === 0 || mapLoaded) return;
148
+ if (mapLoaded) return;
149
+
150
+ if (showDrivers.length === 0) {
151
+ setMapZoom(defaultZoom);
152
+ setMapCenter(defaultCenter);
153
+ setMapFitted(false);
154
+ return;
155
+ }
149
156
 
150
157
  if (!mapFitted) {
151
158
  mapFit();
@@ -56,7 +56,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
56
56
  var DriversManagerUI = function DriversManagerUI(props) {
57
57
  var onDriverRedirect = props.onDriverRedirect,
58
58
  handleChangeSearch = props.handleChangeSearch,
59
- searchValue = props.searchValue;
59
+ searchValue = props.searchValue,
60
+ driversIsOnline = props.driversIsOnline;
60
61
  var _props$driversList = props.driversList,
61
62
  drivers = _props$driversList.drivers,
62
63
  loading = _props$driversList.loading;
@@ -117,6 +118,9 @@ var DriversManagerUI = function DriversManagerUI(props) {
117
118
  setIsOpenDriverOrders(true);
118
119
  }
119
120
  }, [drivers, loading]);
121
+ (0, _react.useEffect)(function () {
122
+ setSelectedDriver(null);
123
+ }, [driversIsOnline]);
120
124
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriversContainer, null, /*#__PURE__*/_react.default.createElement(_styles.DriversHeader, null, /*#__PURE__*/_react.default.createElement(_styles.HeaderTitleContainer, null, isCollapse && /*#__PURE__*/_react.default.createElement(_Buttons.IconButton, {
121
125
  color: "black",
122
126
  onClick: function onClick() {
@@ -60,7 +60,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
60
60
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
61
61
 
62
62
  var PluginListUI = function PluginListUI(props) {
63
- var _pluginListState$sysP, _currentPlugins$plugi, _pluginListState$sysP2, _currentPlugins$sysPl;
63
+ var _pluginListState$sysP, _currentPlugins$plugi;
64
64
 
65
65
  var pluginListState = props.pluginListState,
66
66
  isAddMode = props.isAddMode,
@@ -289,36 +289,6 @@ var PluginListUI = function PluginListUI(props) {
289
289
  handleChangePageSize: function handleChangePageSize(e) {
290
290
  return _handleChangePageSize(e, 'plugins');
291
291
  }
292
- }))), !pluginListState.loading && ((_pluginListState$sysP2 = pluginListState.sysPlugins) === null || _pluginListState$sysP2 === void 0 ? void 0 : _pluginListState$sysP2.length) > 0 && /*#__PURE__*/_react.default.createElement(_styles2.PLuginsSeparator, {
293
- h: "50%"
294
- }, /*#__PURE__*/_react.default.createElement(_styles2.Header, {
295
- mb: 0
296
- }, /*#__PURE__*/_react.default.createElement("h1", {
297
- style: {
298
- marginTop: 20
299
- }
300
- }, t('SYSTEM_PLUGINS', 'System Plugins'))), /*#__PURE__*/_react.default.createElement(_styles2.PluginsTable, null, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", null, t('PLUGINS', 'Plugins')), /*#__PURE__*/_react.default.createElement("th", null, t('ACTIONS', 'Actions')))), currentPlugins.sysPlugins.map(function (plugin) {
301
- return /*#__PURE__*/_react.default.createElement(_styles2.PluginTbody, {
302
- key: plugin.id
303
- }, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, plugin === null || plugin === void 0 ? void 0 : plugin.name), /*#__PURE__*/_react.default.createElement("td", null, /*#__PURE__*/_react.default.createElement(_styles2.ActionsContainer, null, plugin !== null && plugin !== void 0 && plugin.installed ? /*#__PURE__*/_react.default.createElement("span", null, t('SYSTEM_PLUGIN_INSTALLED', 'Installed')) : /*#__PURE__*/_react.default.createElement(_styles.Button, {
304
- borderRadius: "8px",
305
- color: "lightPrimary",
306
- onClick: function onClick() {
307
- return handleInstallSysPlugin(plugin.id);
308
- }
309
- }, /*#__PURE__*/_react.default.createElement("span", null, t('INSTALL', 'Install')))))));
310
- })), /*#__PURE__*/_react.default.createElement(_styles2.PagesBottomContainer, {
311
- justifyContent: "flex-end"
312
- }, ((_currentPlugins$sysPl = currentPlugins.sysPlugins) === null || _currentPlugins$sysPl === void 0 ? void 0 : _currentPlugins$sysPl.length) > 0 && /*#__PURE__*/_react.default.createElement(_Shared.Pagination, {
313
- currentPage: currentPage.sysPlugins,
314
- totalPages: totalPages.sysPlugins,
315
- handleChangePage: function handleChangePage(e) {
316
- return _handleChangePage(e, 'sysPlugins');
317
- },
318
- defaultPageSize: pluginsPerPage.sysPlugins,
319
- handleChangePageSize: function handleChangePageSize(e) {
320
- return _handleChangePageSize(e, 'sysPlugins');
321
- }
322
292
  })))), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
323
293
  title: t('WEB_APPNAME', 'Ordering'),
324
294
  content: alertState.content,
@@ -85,11 +85,12 @@ var SidebarMenu = function SidebarMenu(props) {
85
85
  id: 3,
86
86
  title: t('DRIVERS_DASHBOARD', 'Drivers Dashboard'),
87
87
  pageName: 'drivers'
88
- }, {
89
- id: 4,
90
- title: t('APPOINTMENTS', 'Appointments'),
91
- pageName: 'appointments'
92
- }];
88
+ } // {
89
+ // id: 4,
90
+ // title: t('APPOINTMENTS', 'Appointments'),
91
+ // pageName: 'appointments'
92
+ // }
93
+ ];
93
94
  var loyaltySubMenus = [{
94
95
  id: 1,
95
96
  title: t('REWARDS_PROGRAMS', 'Rewards programs'),
@@ -145,12 +146,13 @@ var SidebarMenu = function SidebarMenu(props) {
145
146
  title: t('MANAGERS', 'Managers'),
146
147
  pageName: 'managers',
147
148
  url: '/users/managers'
148
- }, {
149
- id: 3,
150
- title: t('PROFESSIONALS', 'Professionals'),
151
- pageName: 'professionals',
152
- url: '/users/professionals'
153
- }];
149
+ } // {
150
+ // id: 3,
151
+ // title: t('PROFESSIONALS', 'Professionals'),
152
+ // pageName: 'professionals',
153
+ // url: '/users/professionals'
154
+ // }
155
+ ];
154
156
  var settingsSubMenus = [{
155
157
  id: 1,
156
158
  title: t('BASIC_SETTINGS', 'Basic settings'),
@@ -106,10 +106,8 @@ var BusinessProductAddFormUI = function BusinessProductAddFormUI(props) {
106
106
  var typeList = [{
107
107
  value: 'item',
108
108
  content: /*#__PURE__*/_react.default.createElement(_styles2.Option, null, t('ITEM', 'Item'))
109
- }, {
110
- value: 'service',
111
- content: /*#__PURE__*/_react.default.createElement(_styles2.Option, null, t('SERVICE', 'Service'))
112
- }];
109
+ } // { value: 'service', content: <Option>{t('SERVICE', 'Service')}</Option> }
110
+ ];
113
111
  var durationList = [{
114
112
  value: 15,
115
113
  content: /*#__PURE__*/_react.default.createElement(_styles2.Option, null, "15 ", /*#__PURE__*/_react.default.createElement("span", null, t('MINUTES', 'minutes')))
@@ -89,13 +89,7 @@ var BusinessesListingHeader = function BusinessesListingHeader(props) {
89
89
  onClick: function onClick() {
90
90
  return handleOpenAddBusiness();
91
91
  }
92
- }, t('ADD_NEW_STORE', 'Add new store')), /*#__PURE__*/_react.default.createElement(_styles.Button, {
93
- color: "lightPrimary",
94
- borderRadius: "8px",
95
- onClick: function onClick() {
96
- return handleOpenSync();
97
- }
98
- }, t('SYNC', 'Sync')), /*#__PURE__*/_react.default.createElement(_Shared.SearchBar, {
92
+ }, t('ADD_NEW_STORE', 'Add new store')), /*#__PURE__*/_react.default.createElement(_Shared.SearchBar, {
99
93
  isCustomLayout: true,
100
94
  lazyLoad: true,
101
95
  onSearch: onSearch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
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.3.0",
86
+ "ordering-components-admin-external": "1.3.1",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -27,15 +27,21 @@ export const DeliveriesLocation = (props) => {
27
27
  const [configState] = useConfig()
28
28
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
29
29
 
30
- const [mapCenter, setMapCenter] = useState({ lat: 19.4326, lng: -99.1332 })
30
+ const defaultLatitude = Number(configState?.configs?.location_default_latitude?.value)
31
+ const defaultLongitude = Number(configState?.configs?.location_default_longitude?.value)
32
+ const isInvalidDefaultLocation = isNaN(defaultLatitude) || isNaN(defaultLongitude)
33
+ const defaultCenter = {
34
+ lat: !isInvalidDefaultLocation ? defaultLatitude : 40.7744146,
35
+ lng: !isInvalidDefaultLocation ? defaultLongitude : -73.9678064
36
+ }
37
+
38
+ const [mapCenter, setMapCenter] = useState(defaultCenter)
31
39
  const [mapZoom, setMapZoom] = useState(10)
32
40
  const [activeDrivers, setActiveDrivers] = useState([])
33
41
  const [mapLoaded, setMapLoaded] = useState(true)
34
42
  const [mapFitted, setMapFitted] = useState(false)
35
43
 
36
44
  const [interActionOrderDriverLocation, setInterActionOrderDriverLocation] = useState(null)
37
-
38
- const defaultCenter = { lat: 19.4326, lng: -99.1332 }
39
45
  const defaultZoom = 10
40
46
  const mapRef = useRef(null)
41
47
 
@@ -18,13 +18,20 @@ export const DriversLocation = (props) => {
18
18
  const [configState] = useConfig()
19
19
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
20
20
 
21
- const [mapCenter, setMapCenter] = useState({ lat: 19.4326, lng: -99.1332 })
22
- const [mapZoom, setMapZoom] = useState(10)
21
+ const defaultLatitude = Number(configState?.configs?.location_default_latitude?.value)
22
+ const defaultLongitude = Number(configState?.configs?.location_default_longitude?.value)
23
+ const isInvalidDefaultLocation = isNaN(defaultLatitude) || isNaN(defaultLongitude)
24
+ const defaultCenter = {
25
+ lat: !isInvalidDefaultLocation ? defaultLatitude : 40.7744146,
26
+ lng: !isInvalidDefaultLocation ? defaultLongitude : -73.9678064
27
+ }
28
+ const defaultZoom = 10
29
+
30
+ const [mapCenter, setMapCenter] = useState(defaultCenter)
31
+ const [mapZoom, setMapZoom] = useState(defaultZoom)
23
32
  const [mapLoaded, setMapLoaded] = useState(true)
24
33
  const [mapFitted, setMapFitted] = useState(false)
25
34
 
26
- const defaultCenter = { lat: 19.4326, lng: -99.1332 }
27
- const defaultZoom = 10
28
35
  const mapRef = useRef(null)
29
36
 
30
37
  const [showDrivers, setShowDrivers] = useState([])
@@ -83,7 +90,13 @@ export const DriversLocation = (props) => {
83
90
 
84
91
  // Fit bounds on mount, and when the markers change
85
92
  useEffect(() => {
86
- if (showDrivers.length === 0 || mapLoaded) return
93
+ if (mapLoaded) return
94
+ if (showDrivers.length === 0) {
95
+ setMapZoom(defaultZoom)
96
+ setMapCenter(defaultCenter)
97
+ setMapFitted(false)
98
+ return
99
+ }
87
100
  if (!mapFitted) {
88
101
  mapFit()
89
102
  }
@@ -20,7 +20,8 @@ const DriversManagerUI = (props) => {
20
20
  const {
21
21
  onDriverRedirect,
22
22
  handleChangeSearch,
23
- searchValue
23
+ searchValue,
24
+ driversIsOnline
24
25
  } = props
25
26
 
26
27
  const { drivers, loading } = props.driversList
@@ -63,6 +64,10 @@ const DriversManagerUI = (props) => {
63
64
  }
64
65
  }, [drivers, loading])
65
66
 
67
+ useEffect(() => {
68
+ setSelectedDriver(null)
69
+ }, [driversIsOnline])
70
+
66
71
  return (
67
72
  <>
68
73
  <DriversContainer>
@@ -234,7 +234,7 @@ const PluginListUI = (props) => {
234
234
  )}
235
235
  </PLuginsSeparator>
236
236
 
237
- {!pluginListState.loading && pluginListState.sysPlugins?.length > 0 && (
237
+ {/* {!pluginListState.loading && pluginListState.sysPlugins?.length > 0 && (
238
238
  <PLuginsSeparator h='50%'>
239
239
  <Header mb={0}>
240
240
  <h1 style={{ marginTop: 20 }}>{t('SYSTEM_PLUGINS', 'System Plugins')}</h1>
@@ -282,7 +282,7 @@ const PluginListUI = (props) => {
282
282
  )}
283
283
  </PagesBottomContainer>
284
284
  </PLuginsSeparator>
285
- )}
285
+ )} */}
286
286
  </PluginListContainer>
287
287
  <Alert
288
288
  title={t('WEB_APPNAME', 'Ordering')}
@@ -64,12 +64,12 @@ export const SidebarMenu = (props) => {
64
64
  id: 3,
65
65
  title: t('DRIVERS_DASHBOARD', 'Drivers Dashboard'),
66
66
  pageName: 'drivers'
67
- },
68
- {
69
- id: 4,
70
- title: t('APPOINTMENTS', 'Appointments'),
71
- pageName: 'appointments'
72
67
  }
68
+ // {
69
+ // id: 4,
70
+ // title: t('APPOINTMENTS', 'Appointments'),
71
+ // pageName: 'appointments'
72
+ // }
73
73
  ]
74
74
 
75
75
  const loyaltySubMenus = [
@@ -141,13 +141,13 @@ export const SidebarMenu = (props) => {
141
141
  title: t('MANAGERS', 'Managers'),
142
142
  pageName: 'managers',
143
143
  url: '/users/managers'
144
- },
145
- {
146
- id: 3,
147
- title: t('PROFESSIONALS', 'Professionals'),
148
- pageName: 'professionals',
149
- url: '/users/professionals'
150
144
  }
145
+ // {
146
+ // id: 3,
147
+ // title: t('PROFESSIONALS', 'Professionals'),
148
+ // pageName: 'professionals',
149
+ // url: '/users/professionals'
150
+ // }
151
151
  ]
152
152
 
153
153
  const settingsSubMenus = [
@@ -51,8 +51,8 @@ const BusinessProductAddFormUI = (props) => {
51
51
  const [isCustom, setIsCustom] = useState(false)
52
52
 
53
53
  const typeList = [
54
- { value: 'item', content: <Option>{t('ITEM', 'Item')}</Option> },
55
- { value: 'service', content: <Option>{t('SERVICE', 'Service')}</Option> }
54
+ { value: 'item', content: <Option>{t('ITEM', 'Item')}</Option> }
55
+ // { value: 'service', content: <Option>{t('SERVICE', 'Service')}</Option> }
56
56
  ]
57
57
 
58
58
  const durationList = [
@@ -73,13 +73,13 @@ export const BusinessesListingHeader = (props) => {
73
73
  >
74
74
  {t('ADD_NEW_STORE', 'Add new store')}
75
75
  </Button>
76
- <Button
76
+ {/* <Button
77
77
  color='lightPrimary'
78
78
  borderRadius='8px'
79
79
  onClick={() => handleOpenSync()}
80
80
  >
81
81
  {t('SYNC', 'Sync')}
82
- </Button>
82
+ </Button> */}
83
83
  <SearchBar
84
84
  isCustomLayout
85
85
  lazyLoad