ordering-ui-admin-external 1.7.3 → 1.8.0

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.
Files changed (102) hide show
  1. package/_bundles/{ordering-ui-admin.499cd3aed4f9480d7496.js → ordering-ui-admin.22db20d62f2d39ead727.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.499cd3aed4f9480d7496.js.LICENSE.txt → ordering-ui-admin.22db20d62f2d39ead727.js.LICENSE.txt} +0 -0
  3. package/_modules/components/Delivery/DriversGroupDeliveryDetails/index.js +104 -0
  4. package/_modules/components/Delivery/DriversGroupDeliveryDetails/styles.js +12 -0
  5. package/_modules/components/Delivery/DriversGroupDeliveryZoneInformation/index.js +274 -0
  6. package/_modules/components/Delivery/DriversGroupDeliveryZoneInformation/styles.js +40 -0
  7. package/_modules/components/Delivery/DriversGroupDeliveryZoneList/index.js +119 -0
  8. package/_modules/components/Delivery/DriversGroupDeliveryZoneList/styles.js +54 -0
  9. package/_modules/components/Delivery/DriversGroupDetails/index.js +37 -8
  10. package/_modules/components/Delivery/DriversGroupsDeliveryZoneDetails/index.js +125 -0
  11. package/_modules/components/Delivery/DriversGroupsDeliveryZoneDetails/styles.js +62 -0
  12. package/_modules/components/Delivery/DriversGroupsList/index.js +2 -1
  13. package/_modules/components/Delivery/DriversGroupsListing/index.js +12 -6
  14. package/_modules/components/Home/HomePage/index.js +2 -2
  15. package/_modules/components/Orders/Messages/index.js +1 -1
  16. package/_modules/components/SidebarMenu/index.js +4 -3
  17. package/_modules/components/SidebarMenu/styles.js +22 -18
  18. package/_modules/components/Stores/BusinessDelete/index.js +99 -0
  19. package/_modules/components/Stores/BusinessDelete/styles.js +19 -0
  20. package/_modules/components/Stores/BusinessDeliveryGroupsDetails/index.js +181 -0
  21. package/_modules/components/Stores/BusinessDeliveryGroupsDetails/styles.js +14 -0
  22. package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +5 -1
  23. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +34 -12
  24. package/_modules/components/Stores/BusinessDeliveryZoneInformation/styles.js +1 -1
  25. package/_modules/components/Stores/BusinessProductAddForm/index.js +4 -4
  26. package/_modules/components/Stores/BusinessWidgets/index.js +12 -82
  27. package/_modules/components/Stores/BusinessWidgets/styles.js +3 -7
  28. package/_modules/components/Stores/BusinessesList/index.js +75 -10
  29. package/_modules/components/Stores/BusinessesList/styles.js +26 -3
  30. package/_modules/components/Stores/BusinessesListing/index.js +19 -4
  31. package/_modules/components/Stores/BusinessesListing/styles.js +10 -3
  32. package/_modules/components/Stores/PaymentOptionMethods/index.js +11 -12
  33. package/_modules/components/Stores/PaymentOptionMethods/styles.js +1 -5
  34. package/_modules/components/Stores/PaymentOptionPaypal/index.js +6 -7
  35. package/_modules/components/Stores/PaymentOptionPaypal/styles.js +1 -5
  36. package/_modules/components/Stores/PaymentOptionSquare/index.js +1 -1
  37. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +11 -12
  38. package/_modules/components/Stores/PaymentOptionStripeDirect/styles.js +1 -5
  39. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +11 -12
  40. package/_modules/components/Stores/PaymethodOptionPaypalExpress/styles.js +1 -5
  41. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +11 -12
  42. package/_modules/components/Stores/PaymethodOptionStripeRedirect/styles.js +1 -5
  43. package/_modules/components/Stores/SingleBusiness/index.js +37 -19
  44. package/_modules/components/Stores/SingleBusiness/styles.js +20 -3
  45. package/_modules/components/Stores/index.js +7 -0
  46. package/package.json +2 -2
  47. package/src/components/Delivery/DriversGroupDeliveryDetails/index.js +84 -0
  48. package/src/components/Delivery/DriversGroupDeliveryDetails/styles.js +11 -0
  49. package/src/components/Delivery/DriversGroupDeliveryZoneInformation/index.js +278 -0
  50. package/src/components/Delivery/DriversGroupDeliveryZoneInformation/styles.js +93 -0
  51. package/src/components/Delivery/DriversGroupDeliveryZoneList/index.js +134 -0
  52. package/src/components/Delivery/DriversGroupDeliveryZoneList/styles.js +87 -0
  53. package/src/components/Delivery/DriversGroupDetails/index.js +29 -6
  54. package/src/components/Delivery/DriversGroupsDeliveryZoneDetails/index.js +123 -0
  55. package/src/components/Delivery/DriversGroupsDeliveryZoneDetails/styles.js +125 -0
  56. package/src/components/Delivery/DriversGroupsList/index.js +2 -2
  57. package/src/components/Delivery/DriversGroupsListing/index.js +4 -1
  58. package/src/components/Home/HomePage/index.js +3 -3
  59. package/src/components/Orders/Messages/index.js +1 -1
  60. package/src/components/SidebarMenu/index.js +25 -15
  61. package/src/components/SidebarMenu/styles.js +10 -2
  62. package/src/components/Stores/BusinessDelete/index.js +99 -0
  63. package/src/components/Stores/BusinessDelete/styles.js +40 -0
  64. package/src/components/Stores/BusinessDeliveryGroupsDetails/index.js +127 -0
  65. package/src/components/Stores/BusinessDeliveryGroupsDetails/styles.js +16 -0
  66. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +6 -1
  67. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +35 -10
  68. package/src/components/Stores/BusinessDeliveryZoneInformation/styles.js +1 -1
  69. package/src/components/Stores/BusinessProductAddForm/index.js +2 -2
  70. package/src/components/Stores/BusinessWidgets/index.js +76 -143
  71. package/src/components/Stores/BusinessWidgets/styles.js +0 -10
  72. package/src/components/Stores/BusinessesList/index.js +83 -10
  73. package/src/components/Stores/BusinessesList/styles.js +52 -0
  74. package/src/components/Stores/BusinessesListing/index.js +27 -8
  75. package/src/components/Stores/BusinessesListing/styles.js +34 -0
  76. package/src/components/Stores/PaymentOptionMethods/index.js +9 -12
  77. package/src/components/Stores/PaymentOptionMethods/styles.js +0 -10
  78. package/src/components/Stores/PaymentOptionPaypal/index.js +9 -12
  79. package/src/components/Stores/PaymentOptionPaypal/styles.js +0 -10
  80. package/src/components/Stores/PaymentOptionSquare/index.js +1 -1
  81. package/src/components/Stores/PaymentOptionStripeDirect/index.js +9 -12
  82. package/src/components/Stores/PaymentOptionStripeDirect/styles.js +0 -10
  83. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +9 -12
  84. package/src/components/Stores/PaymethodOptionPaypalExpress/styles.js +0 -10
  85. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +9 -12
  86. package/src/components/Stores/PaymethodOptionStripeRedirect/styles.js +0 -10
  87. package/src/components/Stores/SingleBusiness/index.js +38 -13
  88. package/src/components/Stores/SingleBusiness/styles.js +30 -0
  89. package/src/components/Stores/index.js +2 -0
  90. package/template/assets/images/myProducts/driver-app-brand.png +0 -0
  91. package/template/assets/images/myProducts/driver-app-free.png +0 -0
  92. package/template/assets/images/myProducts/multi-store-customer-app.png +0 -0
  93. package/template/assets/images/myProducts/my-callcenter-app-brand.png +0 -0
  94. package/template/assets/images/myProducts/my-callcenter-app-live.png +0 -0
  95. package/template/assets/images/myProducts/my-kiosk-app-brand.png +0 -0
  96. package/template/assets/images/myProducts/my-kiosk-app-live.png +0 -0
  97. package/template/assets/images/myProducts/my-pos-app-brand.png +0 -0
  98. package/template/assets/images/myProducts/my-pos-app-live.png +0 -0
  99. package/template/assets/images/myProducts/ordering-website.png +0 -0
  100. package/template/assets/images/myProducts/single-store-customer-app.png +0 -0
  101. package/template/assets/images/myProducts/store-app-brand.png +0 -0
  102. package/template/assets/images/myProducts/store-app-free.png +0 -0
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DriverGroupDeliveryDetails = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _orderingComponentsAdminExternal = require("ordering-components-admin-external");
10
+ var _DriversGroupDeliveryZoneList = require("../DriversGroupDeliveryZoneList");
11
+ var _styles = require("../../../styles");
12
+ var _Shared = require("../../Shared");
13
+ var _styles2 = require("./styles");
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
+ 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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+ 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."); }
21
+ 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); }
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+ var DriverGroupDeliveryDetailsUI = function DriverGroupDeliveryDetailsUI(props) {
26
+ var _Object$keys;
27
+ var drivergroup = props.drivergroup,
28
+ setIsExtendExtraOpen = props.setIsExtendExtraOpen,
29
+ formState = props.formState,
30
+ onDeliveryStateSave = props.onDeliveryStateSave,
31
+ actionState = props.actionState,
32
+ zoneListState = props.zoneListState,
33
+ handleChangeZoneState = props.handleChangeZoneState,
34
+ handleChangeAllZoneState = props.handleChangeAllZoneState,
35
+ handleParentSidebarMove = props.handleParentSidebarMove,
36
+ zoneList = props.zoneList,
37
+ setZoneList = props.setZoneList,
38
+ setIsOpenDetails = props.setIsOpenDetails,
39
+ isOpenDetails = props.isOpenDetails;
40
+ var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
41
+ _useLanguage2 = _slicedToArray(_useLanguage, 2),
42
+ t = _useLanguage2[1];
43
+ var _useState = (0, _react.useState)({
44
+ open: false,
45
+ content: []
46
+ }),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ alertState = _useState2[0],
49
+ setAlertState = _useState2[1];
50
+ (0, _react.useEffect)(function () {
51
+ if (!(actionState !== null && actionState !== void 0 && actionState.error)) return;
52
+ setAlertState({
53
+ open: true,
54
+ content: actionState === null || actionState === void 0 ? void 0 : actionState.error
55
+ });
56
+ }, [actionState === null || actionState === void 0 ? void 0 : actionState.error]);
57
+ return /*#__PURE__*/_react.default.createElement(_styles2.Container, null, /*#__PURE__*/_react.default.createElement(_DriversGroupDeliveryZoneList.DriverGroupDeliveryZoneList, {
58
+ setZoneList: setZoneList,
59
+ handleParentSidebarMove: handleParentSidebarMove,
60
+ drivergroup: drivergroup,
61
+ zoneList: zoneList,
62
+ setIsExtendExtraOpen: setIsExtendExtraOpen,
63
+ onClose: function onClose() {
64
+ return setIsExtendExtraOpen(false);
65
+ },
66
+ zoneListState: zoneListState,
67
+ handleChangeZoneState: handleChangeZoneState,
68
+ handleChangeAllZoneState: handleChangeAllZoneState,
69
+ setIsOpenDetails: setIsOpenDetails,
70
+ isOpenDetails: isOpenDetails
71
+ }), /*#__PURE__*/_react.default.createElement(_styles.Button, {
72
+ borderRadius: "8px",
73
+ color: "primary",
74
+ disabled: (actionState === null || actionState === void 0 ? void 0 : actionState.loading) || (Object === null || Object === void 0 ? void 0 : (_Object$keys = Object.keys(formState === null || formState === void 0 ? void 0 : formState.changes)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) === 0 && !(zoneListState !== null && zoneListState !== void 0 && zoneListState.isDirty),
75
+ onClick: function onClick() {
76
+ return onDeliveryStateSave();
77
+ }
78
+ }, t('SAVE', 'Save')), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
79
+ title: t('WEB_APPNAME', 'Ordering'),
80
+ content: alertState === null || alertState === void 0 ? void 0 : alertState.content,
81
+ acceptText: t('ACCEPT', 'Accept'),
82
+ open: alertState === null || alertState === void 0 ? void 0 : alertState.open,
83
+ onClose: function onClose() {
84
+ return setAlertState({
85
+ open: false,
86
+ content: []
87
+ });
88
+ },
89
+ onAccept: function onAccept() {
90
+ return setAlertState({
91
+ open: false,
92
+ content: []
93
+ });
94
+ },
95
+ closeOnBackdrop: false
96
+ }));
97
+ };
98
+ var DriverGroupDeliveryDetails = function DriverGroupDeliveryDetails(props) {
99
+ var driverGroupDeliveryProps = _objectSpread(_objectSpread({}, props), {}, {
100
+ UIComponent: DriverGroupDeliveryDetailsUI
101
+ });
102
+ return /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.DriverGroupDeliveryDetails, driverGroupDeliveryProps);
103
+ };
104
+ exports.DriverGroupDeliveryDetails = DriverGroupDeliveryDetails;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Container = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ var _templateObject;
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: calc(100% - 130px);\n > button {\n position: sticky;\n top: 100%;\n margin-top: 30px;\n height: 44px;\n }\n"])));
12
+ exports.Container = Container;
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DriverGroupDeliveryZoneInformation = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _orderingComponentsAdminExternal = require("ordering-components-admin-external");
10
+ var _FirstSelect = require("../../../styles/Select/FirstSelect");
11
+ var _styles = require("../../../styles");
12
+ var _Shared = require("../../Shared");
13
+ var _reactHookForm = require("react-hook-form");
14
+ var _styles2 = require("./styles");
15
+ 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); }
16
+ 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; }
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+ 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."); }
19
+ 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); }
20
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ var DriverGroupDeliveryZoneInformation = function DriverGroupDeliveryZoneInformation(props) {
24
+ var _ref, _formState$changes$na, _formState$changes2, _formState$changes3, _ref2, _formState$changes$mi, _formState$changes4, _ref3, _formState$changes$pr, _formState$changes5, _configState$configs2, _configState$configs3, _formState$changes6, _formState$changes6$d, _configState$configs4, _configState$configs5, _formState$changes7, _Object$keys2;
25
+ var zone = props.zone,
26
+ driverGroupsZones = props.driverGroupsZones,
27
+ formState = props.formState,
28
+ handleChangeInput = props.handleChangeInput,
29
+ handleChangeFormState = props.handleChangeFormState,
30
+ handleUpdateDriverGroupDeliveryZone = props.handleUpdateDriverGroupDeliveryZone,
31
+ handleAddDriverGroupDeliveryZone = props.handleAddDriverGroupDeliveryZone,
32
+ handleUploadKmlFiles = props.handleUploadKmlFiles,
33
+ kmlData = props.kmlData;
34
+ var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
35
+ _useLanguage2 = _slicedToArray(_useLanguage, 2),
36
+ t = _useLanguage2[1];
37
+ var _useForm = (0, _reactHookForm.useForm)(),
38
+ handleSubmit = _useForm.handleSubmit,
39
+ register = _useForm.register,
40
+ errors = _useForm.errors;
41
+ var _useUtils = (0, _orderingComponentsAdminExternal.useUtils)(),
42
+ _useUtils2 = _slicedToArray(_useUtils, 1),
43
+ parseNumber = _useUtils2[0].parseNumber;
44
+ var _useConfig = (0, _orderingComponentsAdminExternal.useConfig)(),
45
+ _useConfig2 = _slicedToArray(_useConfig, 1),
46
+ configState = _useConfig2[0];
47
+ var _useState = (0, _react.useState)(false),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ clearState = _useState2[0],
50
+ setClearState = _useState2[1];
51
+ var _useState3 = (0, _react.useState)(''),
52
+ _useState4 = _slicedToArray(_useState3, 2),
53
+ infoContentString = _useState4[0],
54
+ setInfoContentString = _useState4[1];
55
+ var _useState5 = (0, _react.useState)((zone === null || zone === void 0 ? void 0 : zone.type) || 2),
56
+ _useState6 = _slicedToArray(_useState5, 2),
57
+ zoneType = _useState6[0],
58
+ setZoneType = _useState6[1];
59
+ var _useState7 = (0, _react.useState)(zone === null || zone === void 0 ? void 0 : zone.data),
60
+ _useState8 = _slicedToArray(_useState7, 2),
61
+ zoneData = _useState8[0],
62
+ setZoneData = _useState8[1];
63
+ var _useState9 = (0, _react.useState)({
64
+ open: false,
65
+ content: []
66
+ }),
67
+ _useState10 = _slicedToArray(_useState9, 2),
68
+ alertState = _useState10[0],
69
+ setAlertState = _useState10[1];
70
+ var _useState11 = (0, _react.useState)(false),
71
+ _useState12 = _slicedToArray(_useState11, 2),
72
+ isShowMap = _useState12[0],
73
+ setIsShowMap = _useState12[1];
74
+ var kmlRef = (0, _react.useRef)(null);
75
+ var typeOptions = [{
76
+ value: 1,
77
+ content: t('CIRCLE', 'Circle')
78
+ }, {
79
+ value: 2,
80
+ content: t('POLYGON', 'Polygon')
81
+ }, {
82
+ value: 4,
83
+ content: t('EVERYWHERE', 'Everywhere')
84
+ }];
85
+ var googleMapsControls = {
86
+ defaultZoom: 8,
87
+ zoomControl: true,
88
+ streetViewControl: false,
89
+ fullscreenControl: false,
90
+ mapTypeId: 'roadmap',
91
+ // 'roadmap', 'satellite', 'hybrid', 'terrain'
92
+ mapTypeControl: false,
93
+ mapTypeControlOptions: {
94
+ mapTypeIds: ['roadmap', 'satellite']
95
+ },
96
+ isMarkerDraggable: false,
97
+ defaultPosition: {
98
+ lat: 40.77473399999999,
99
+ lng: -73.9653844
100
+ }
101
+ };
102
+ var fillStyle = {
103
+ fillColor: '#2C7BE5',
104
+ strokeColor: '#03459E',
105
+ fillOpacity: 0.2,
106
+ strokeWeight: 2,
107
+ editable: true
108
+ };
109
+ var greenFillStyle = {
110
+ fillColor: '#008000',
111
+ fillOpacity: 0.3,
112
+ strokeColor: '#008000',
113
+ strokeOpacity: 0.8,
114
+ strokeWeight: 2
115
+ };
116
+ var handleChangeType = function handleChangeType(type) {
117
+ handleChangeFormState({
118
+ type: type
119
+ });
120
+ setClearState(true);
121
+ setZoneType(type);
122
+ };
123
+ var handleZoneData = function handleZoneData(data) {
124
+ setZoneData(data);
125
+ handleChangeFormState({
126
+ data: data
127
+ });
128
+ };
129
+ var onSubmit = function onSubmit() {
130
+ var _formState$changes;
131
+ if (formState !== null && formState !== void 0 && (_formState$changes = formState.changes) !== null && _formState$changes !== void 0 && _formState$changes.data || zoneType === 4) {
132
+ if (!zone) handleAddDriverGroupDeliveryZone();else handleUpdateDriverGroupDeliveryZone();
133
+ } else {
134
+ setAlertState({
135
+ open: true,
136
+ content: t('REQUIRED_POLYGON_CIRCLE', 'Add a distance based or draw a polygon or circle.')
137
+ });
138
+ }
139
+ };
140
+ var closeAlert = function closeAlert() {
141
+ setAlertState({
142
+ open: false,
143
+ content: []
144
+ });
145
+ };
146
+ (0, _react.useEffect)(function () {
147
+ if (clearState) {
148
+ handleZoneData(null);
149
+ }
150
+ }, [clearState]);
151
+ (0, _react.useEffect)(function () {
152
+ var _configState$configs, _configState$configs$;
153
+ if (zoneType === 2 || zoneType === 4) return;
154
+ var content = '<div style="width: 90px; height: 30px">' + '<span>Radius: </span>';
155
+ content += parseNumber((zoneData === null || zoneData === void 0 ? void 0 : zoneData.radio) || (zoneData === null || zoneData === void 0 ? void 0 : zoneData.distance));
156
+ content += "<span>".concat(zoneType === 5 ? configState === null || configState === void 0 ? void 0 : (_configState$configs = configState.configs) === null || _configState$configs === void 0 ? void 0 : (_configState$configs$ = _configState$configs.distance_unit) === null || _configState$configs$ === void 0 ? void 0 : _configState$configs$.value : 'km', "</span>") + '</div>';
157
+ setInfoContentString(content);
158
+ }, [zoneData, zoneType]);
159
+ (0, _react.useEffect)(function () {
160
+ setClearState(false);
161
+ setZoneType((zone === null || zone === void 0 ? void 0 : zone.type) || 2);
162
+ setZoneData(zone === null || zone === void 0 ? void 0 : zone.data);
163
+ setIsShowMap(false);
164
+ setTimeout(function () {
165
+ setIsShowMap(true);
166
+ }, [100]);
167
+ }, [zone === null || zone === void 0 ? void 0 : zone.id]);
168
+ (0, _react.useEffect)(function () {
169
+ var _Object$keys;
170
+ if ((Object === null || Object === void 0 ? void 0 : (_Object$keys = Object.keys(errors)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) {
171
+ var _Object$values;
172
+ setAlertState({
173
+ open: true,
174
+ content: Object === null || Object === void 0 ? void 0 : (_Object$values = Object.values(errors)) === null || _Object$values === void 0 ? void 0 : _Object$values.map(function (error) {
175
+ return error === null || error === void 0 ? void 0 : error.message;
176
+ })
177
+ });
178
+ }
179
+ }, [errors]);
180
+ (0, _react.useEffect)(function () {
181
+ if (formState !== null && formState !== void 0 && formState.error) {
182
+ setAlertState({
183
+ open: true,
184
+ content: formState === null || formState === void 0 ? void 0 : formState.error
185
+ });
186
+ }
187
+ }, [formState]);
188
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles2.FormContainer, {
189
+ onSubmit: handleSubmit(onSubmit),
190
+ autoComplete: "off"
191
+ }, /*#__PURE__*/_react.default.createElement(_styles2.Row, null, /*#__PURE__*/_react.default.createElement(_styles2.FormControl, null, /*#__PURE__*/_react.default.createElement("label", null, t('NAME', 'Name')), /*#__PURE__*/_react.default.createElement(_styles.Input, {
192
+ placeholder: t('NAME', 'Name'),
193
+ name: "name",
194
+ value: (_ref = (_formState$changes$na = formState === null || formState === void 0 ? void 0 : (_formState$changes2 = formState.changes) === null || _formState$changes2 === void 0 ? void 0 : _formState$changes2.name) !== null && _formState$changes$na !== void 0 ? _formState$changes$na : zone === null || zone === void 0 ? void 0 : zone.name) !== null && _ref !== void 0 ? _ref : '',
195
+ onChange: handleChangeInput,
196
+ ref: register({
197
+ required: t('NAME_REQUIRED', 'The name is required.')
198
+ })
199
+ })), /*#__PURE__*/_react.default.createElement(_styles2.FormControl, null, /*#__PURE__*/_react.default.createElement("label", null, t('TYPE', 'Type')), /*#__PURE__*/_react.default.createElement(_styles2.TypeSelectWrapper, null, /*#__PURE__*/_react.default.createElement(_FirstSelect.Select, {
200
+ defaultValue: parseInt((formState === null || formState === void 0 ? void 0 : (_formState$changes3 = formState.changes) === null || _formState$changes3 === void 0 ? void 0 : _formState$changes3.type) || zoneType),
201
+ options: typeOptions,
202
+ onChange: handleChangeType
203
+ })))), /*#__PURE__*/_react.default.createElement(_styles2.Row, null, /*#__PURE__*/_react.default.createElement(_styles2.FormControl, null, /*#__PURE__*/_react.default.createElement("label", null, t('MINIMUN_PURCHASED', 'Minimum purchase')), /*#__PURE__*/_react.default.createElement(_styles.Input, {
204
+ placeholder: "$0.00",
205
+ name: "minimum",
206
+ value: (_ref2 = (_formState$changes$mi = formState === null || formState === void 0 ? void 0 : (_formState$changes4 = formState.changes) === null || _formState$changes4 === void 0 ? void 0 : _formState$changes4.minimum) !== null && _formState$changes$mi !== void 0 ? _formState$changes$mi : zone === null || zone === void 0 ? void 0 : zone.minimum) !== null && _ref2 !== void 0 ? _ref2 : '',
207
+ onChange: handleChangeInput,
208
+ ref: register({
209
+ required: t('MINIMUN_PURCHASED_REQUIRED', 'The minimum purchase is required.')
210
+ })
211
+ })), /*#__PURE__*/_react.default.createElement(_styles2.FormControl, null, /*#__PURE__*/_react.default.createElement("label", null, t('DELIVERY_FEE', 'Delivery fee')), /*#__PURE__*/_react.default.createElement(_styles.Input, {
212
+ placeholder: "$0.00",
213
+ name: "price",
214
+ value: (_ref3 = (_formState$changes$pr = formState === null || formState === void 0 ? void 0 : (_formState$changes5 = formState.changes) === null || _formState$changes5 === void 0 ? void 0 : _formState$changes5.price) !== null && _formState$changes$pr !== void 0 ? _formState$changes$pr : zone === null || zone === void 0 ? void 0 : zone.price) !== null && _ref3 !== void 0 ? _ref3 : '',
215
+ onChange: handleChangeInput,
216
+ ref: register({
217
+ required: t('DELIVERY_PRICE_REQUIRED', 'The delivery price is required.')
218
+ })
219
+ }))), zoneType !== 4 && isShowMap && (configState !== null && configState !== void 0 && (_configState$configs2 = configState.configs) !== null && _configState$configs2 !== void 0 && (_configState$configs3 = _configState$configs2.google_maps_api_key) !== null && _configState$configs3 !== void 0 && _configState$configs3.value ? /*#__PURE__*/_react.default.createElement(_styles2.WrapperMap, null, /*#__PURE__*/_react.default.createElement("button", {
220
+ type: "button",
221
+ onClick: function onClick() {
222
+ return setClearState(true);
223
+ }
224
+ }, t('CLEAR', 'Clear')), /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.BusinessZoneGoogleMaps, {
225
+ distance: formState === null || formState === void 0 ? void 0 : (_formState$changes6 = formState.changes) === null || _formState$changes6 === void 0 ? void 0 : (_formState$changes6$d = _formState$changes6.data) === null || _formState$changes6$d === void 0 ? void 0 : _formState$changes6$d.distance,
226
+ apiKey: configState === null || configState === void 0 ? void 0 : (_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 ? void 0 : (_configState$configs5 = _configState$configs4.google_maps_api_key) === null || _configState$configs5 === void 0 ? void 0 : _configState$configs5.value,
227
+ mapControls: googleMapsControls,
228
+ clearState: clearState,
229
+ setClearState: setClearState,
230
+ type: zoneType,
231
+ data: (formState === null || formState === void 0 ? void 0 : (_formState$changes7 = formState.changes) === null || _formState$changes7 === void 0 ? void 0 : _formState$changes7.data) || zoneData,
232
+ handleData: handleZoneData,
233
+ fillStyle: fillStyle,
234
+ infoContentString: infoContentString,
235
+ greenFillStyle: greenFillStyle,
236
+ isAddMode: !zone,
237
+ businessZones: driverGroupsZones,
238
+ kmlData: kmlData,
239
+ isDriverGroup: true
240
+ })) : /*#__PURE__*/_react.default.createElement(_styles2.ErrorText, null, t('REQUIRED_GOOGLE_MAP_API_KEY', 'Google Maps api key is required'))), !zone && /*#__PURE__*/_react.default.createElement(_styles2.KmlButtonWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.Button, {
241
+ color: "primary",
242
+ borderRadius: "8px",
243
+ type: "button",
244
+ onClick: function onClick() {
245
+ return kmlRef.current.click();
246
+ }
247
+ }, /*#__PURE__*/_react.default.createElement(_orderingComponentsAdminExternal.ExamineClick, {
248
+ onFiles: function onFiles(files) {
249
+ return handleUploadKmlFiles(files);
250
+ },
251
+ childRef: function childRef(e) {
252
+ kmlRef.current = e;
253
+ },
254
+ accept: ".kml,.kmz"
255
+ }, /*#__PURE__*/_react.default.createElement("span", null, t('UPLOAD_KML', 'Upload KML'))))), /*#__PURE__*/_react.default.createElement(_styles.Button, {
256
+ color: "primary",
257
+ borderRadius: "8px",
258
+ type: "submit",
259
+ disabled: (formState === null || formState === void 0 ? void 0 : formState.loading) || (Object === null || Object === void 0 ? void 0 : (_Object$keys2 = Object.keys(formState === null || formState === void 0 ? void 0 : formState.changes)) === null || _Object$keys2 === void 0 ? void 0 : _Object$keys2.length) === 0
260
+ }, !zone ? t('ADD', 'Add') : t('SAVE', 'Save'))), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
261
+ title: t('WEB_APPNAME', 'Ordering'),
262
+ content: alertState === null || alertState === void 0 ? void 0 : alertState.content,
263
+ acceptText: t('ACCEPT', 'Accept'),
264
+ open: alertState === null || alertState === void 0 ? void 0 : alertState.open,
265
+ onClose: function onClose() {
266
+ return closeAlert();
267
+ },
268
+ onAccept: function onAccept() {
269
+ return closeAlert();
270
+ },
271
+ closeOnBackdrop: false
272
+ }));
273
+ };
274
+ exports.DriverGroupDeliveryZoneInformation = DriverGroupDeliveryZoneInformation;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.WrapperMap = exports.TypeSelectWrapper = exports.Row = exports.KmlButtonWrapper = exports.FormControl = exports.FormContainer = exports.ErrorText = void 0;
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
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
+ 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
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
+ var FormContainer = _styledComponents.default.form(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n min-height: calc(100% - 130px);\n\n > button {\n width: fit-content;\n position: sticky;\n top: 100%;\n margin-top: 30px;\n height: 42px;\n }\n"])));
14
+ exports.FormContainer = FormContainer;
15
+ var TypeSelectWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .select {\n background: ", ";\n width: 100%;\n border: none;\n font-size: 14px;\n color: ", ";\n > div:first-child {\n padding-top: 4px;\n padding-bottom: 4px;\n }\n }\n"])), function (props) {
16
+ return props.theme.colors.secundary;
17
+ }, function (props) {
18
+ return props.theme.colors.headingColor;
19
+ });
20
+ exports.TypeSelectWrapper = TypeSelectWrapper;
21
+ var WrapperMap = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n height: 300px;\n display: flex;\n justify-content: center;\n box-sizing: border-box;\n margin: 29px 0 20px 0;\n position: relative;\n > div {\n position: relative !important; \n width: 100% !important;\n height: 100% !important;\n border-radius: 8px;\n }\n\n > button {\n position: absolute;\n font-size: 14px;\n padding: 0 5px;\n background: ", ";\n top: 10px;\n z-index: 10;\n border: none;\n box-shadow: rgb(0 0 0 / 30%) 0px 1px 4px;\n color: ", ";\n ", "\n &:hover {\n background: #eee;\n }\n }\n"])), function (props) {
22
+ var _props$theme$colors;
23
+ return ((_props$theme$colors = props.theme.colors) === null || _props$theme$colors === void 0 ? void 0 : _props$theme$colors.backgroundPage) || '#FFF';
24
+ }, function (props) {
25
+ return props.theme.colors.headingColor;
26
+ }, function (props) {
27
+ var _props$theme;
28
+ return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n right: 10px;\n "]))) : (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n left: 10px;\n "])));
29
+ });
30
+ exports.WrapperMap = WrapperMap;
31
+ var ErrorText = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 14px;\n color: ", ";\n text-align: center;\n margin: 20px 0;\n"])), function (props) {
32
+ return props.theme.colors.lightGray;
33
+ });
34
+ exports.ErrorText = ErrorText;
35
+ var FormControl = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n label {\n font-size: 14px;\n margin-bottom: 9px;\n }\n input {\n width: 100%;\n }\n"])));
36
+ exports.FormControl = FormControl;
37
+ var Row = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n margin-bottom: 29px;\n\n > div {\n width: 45%;\n }\n"])));
38
+ exports.Row = Row;
39
+ var KmlButtonWrapper = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-bottom: 20px;\n"])));
40
+ exports.KmlButtonWrapper = KmlButtonWrapper;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DriverGroupDeliveryZoneList = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _orderingComponentsAdminExternal = require("ordering-components-admin-external");
10
+ var _DriversGroupsDeliveryZoneDetails = require("../DriversGroupsDeliveryZoneDetails");
11
+ var _Shared = require("../../Shared");
12
+ var _reactBootstrapIcons = require("react-bootstrap-icons");
13
+ var _styles = require("../../../styles");
14
+ var _styles2 = require("./styles");
15
+ var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ 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); }
18
+ 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; }
19
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
20
+ 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."); }
21
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
22
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
23
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
24
+ 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."); }
25
+ 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); }
26
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
28
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
+ var DriverGroupDeliveryZoneList = function DriverGroupDeliveryZoneList(props) {
30
+ var _zoneList$zones, _zoneList$zones$filte;
31
+ var drivergroup = props.drivergroup,
32
+ setIsExtendExtraOpen = props.setIsExtendExtraOpen,
33
+ handleSuccessUpdate = props.handleSuccessUpdate,
34
+ zoneListState = props.zoneListState,
35
+ handleChangeZoneState = props.handleChangeZoneState,
36
+ handleChangeAllZoneState = props.handleChangeAllZoneState,
37
+ handleParentSidebarMove = props.handleParentSidebarMove,
38
+ zoneList = props.zoneList,
39
+ setZoneList = props.setZoneList,
40
+ setIsOpenDetails = props.setIsOpenDetails,
41
+ isOpenDetails = props.isOpenDetails;
42
+ var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
43
+ _useLanguage2 = _slicedToArray(_useLanguage, 2),
44
+ t = _useLanguage2[1];
45
+ var _useState = (0, _react.useState)(null),
46
+ _useState2 = _slicedToArray(_useState, 2),
47
+ curZone = _useState2[0],
48
+ setCurZone = _useState2[1];
49
+ var handleCloseOption = function handleCloseOption() {
50
+ setIsOpenDetails(false);
51
+ setIsExtendExtraOpen(false);
52
+ setCurZone(null);
53
+ handleParentSidebarMove(0);
54
+ };
55
+ var handleOpenZone = function handleOpenZone(e, zone) {
56
+ var isInvalid = e.target.closest('.zone-enabled');
57
+ if (isInvalid) return;
58
+ setCurZone(zone);
59
+ handleParentSidebarMove(500);
60
+ setIsExtendExtraOpen(true);
61
+ setIsOpenDetails(true);
62
+ };
63
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles2.ZoneContainer, null, zoneList.loading ? _toConsumableArray(Array(5).keys()).map(function (i) {
64
+ return /*#__PURE__*/_react.default.createElement(_styles2.DeliveryZonesTableWrapper, {
65
+ key: i
66
+ }, /*#__PURE__*/_react.default.createElement(_styles2.CheckSkeleteon, null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
67
+ width: 18,
68
+ height: 18
69
+ })), /*#__PURE__*/_react.default.createElement(_styles2.InfoBlock, null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
70
+ width: "100%",
71
+ height: 18
72
+ })));
73
+ }) : /*#__PURE__*/_react.default.createElement(_styles2.DeliveryZonesTable, null, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", null, /*#__PURE__*/_react.default.createElement(_styles2.CheckboxWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.Checkbox, {
74
+ checked: zoneListState === null || zoneListState === void 0 ? void 0 : zoneListState.isCheckAll,
75
+ onChange: function onChange(e) {
76
+ return handleChangeAllZoneState(e.target.checked);
77
+ }
78
+ }))), /*#__PURE__*/_react.default.createElement("th", null, t('NAME', 'Name')), /*#__PURE__*/_react.default.createElement("th", null, t('MINIMUM', 'Minimum')), /*#__PURE__*/_react.default.createElement("th", null, t('PRICE', 'Price')), /*#__PURE__*/_react.default.createElement("th", null))), zoneList === null || zoneList === void 0 ? void 0 : (_zoneList$zones = zoneList.zones) === null || _zoneList$zones === void 0 ? void 0 : (_zoneList$zones$filte = _zoneList$zones.filter(function (zone) {
79
+ return (zone === null || zone === void 0 ? void 0 : zone.type) !== 3;
80
+ })) === null || _zoneList$zones$filte === void 0 ? void 0 : _zoneList$zones$filte.map(function (zone) {
81
+ return /*#__PURE__*/_react.default.createElement(_styles2.ZoneTbody, {
82
+ key: zone === null || zone === void 0 ? void 0 : zone.id,
83
+ active: (zone === null || zone === void 0 ? void 0 : zone.id) === (curZone === null || curZone === void 0 ? void 0 : curZone.id),
84
+ onClick: function onClick(e) {
85
+ return handleOpenZone(e, zone);
86
+ }
87
+ }, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, /*#__PURE__*/_react.default.createElement(_styles2.CheckboxWrapper, {
88
+ className: "zone-enabled"
89
+ }, /*#__PURE__*/_react.default.createElement(_styles.Checkbox, {
90
+ checked: !!(zoneListState !== null && zoneListState !== void 0 && zoneListState.changes[zone.id]),
91
+ onChange: function onChange(e) {
92
+ var _e$target;
93
+ return handleChangeZoneState(zone === null || zone === void 0 ? void 0 : zone.id, e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.checked);
94
+ }
95
+ }))), /*#__PURE__*/_react.default.createElement("td", null, zone === null || zone === void 0 ? void 0 : zone.name), /*#__PURE__*/_react.default.createElement("td", null, zone === null || zone === void 0 ? void 0 : zone.minimum), /*#__PURE__*/_react.default.createElement("td", null, zone === null || zone === void 0 ? void 0 : zone.price), /*#__PURE__*/_react.default.createElement("td", {
96
+ className: "arrow"
97
+ }, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ChevronRight, null))));
98
+ })), /*#__PURE__*/_react.default.createElement(_styles2.AddDeliveryZoneButton, {
99
+ onClick: function onClick(e) {
100
+ return handleOpenZone(e, null);
101
+ }
102
+ }, t('ADD_DELIVERY_ZONE', 'Add delivery zone'))), isOpenDetails && /*#__PURE__*/_react.default.createElement(_Shared.SideBar, {
103
+ isBorderShow: true,
104
+ open: isOpenDetails,
105
+ onClose: function onClose() {
106
+ return handleCloseOption();
107
+ }
108
+ }, /*#__PURE__*/_react.default.createElement(_DriversGroupsDeliveryZoneDetails.DriverGroupDeliveryZoneDetails, {
109
+ zone: curZone,
110
+ setZoneList: setZoneList,
111
+ drivergroup: drivergroup,
112
+ onClose: function onClose() {
113
+ return handleCloseOption();
114
+ },
115
+ handleSuccessUpdate: handleSuccessUpdate,
116
+ driverGroupsZones: zoneList
117
+ })));
118
+ };
119
+ exports.DriverGroupDeliveryZoneList = DriverGroupDeliveryZoneList;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ZoneTbody = exports.ZoneContainer = exports.InfoBlock = exports.DeliveryZonesTableWrapper = exports.DeliveryZonesTable = exports.CheckboxWrapper = exports.CheckSkeleteon = exports.AddDeliveryZoneButton = exports.ActionsWrapper = void 0;
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
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
+ 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
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
+ var ZoneContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 30px 0 20px 0;\n @media (min-width: 1000px) {\n max-width: 500px;\n }\n"])));
14
+ exports.ZoneContainer = ZoneContainer;
15
+ var DeliveryZonesTable = _styledComponents.default.table(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n border-collapse: collapse;\n thead {\n border-bottom: 1px solid ", ";\n tr {\n th {\n font-size: 12px;\n font-weight: 700;\n padding: 10px 0;\n }\n }\n }\n"])), function (props) {
16
+ return props.theme.colors.borderColor;
17
+ });
18
+ exports.DeliveryZonesTable = DeliveryZonesTable;
19
+ var DeliveryZonesTableWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n margin-bottom: 20px;\n"])));
20
+ exports.DeliveryZonesTableWrapper = DeliveryZonesTableWrapper;
21
+ var CheckSkeleteon = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 18px;\n height: 18px;\n margin-right: 5px;\n"])));
22
+ exports.CheckSkeleteon = CheckSkeleteon;
23
+ var InfoBlock = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: 100%;\n"])));
24
+ exports.InfoBlock = InfoBlock;
25
+ var ZoneTbody = _styledComponents.default.tbody(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n cursor: pointer;\n border-bottom: 1px solid ", ";\n tr {\n td {\n font-size: 14px;\n padding: 13px 0;\n &.arrow {\n font-size: 13px;\n color: ", ";\n }\n }\n }\n &:hover {\n background-color: ", ";\n }\n ", "\n"])), function (props) {
26
+ return props.theme.colors.borderColor;
27
+ }, function (props) {
28
+ return props.theme.colors.secundaryLight;
29
+ }, function (props) {
30
+ return props.theme.colors.lightPrimary;
31
+ }, function (_ref) {
32
+ var active = _ref.active;
33
+ return active && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: ", ";\n td {\n border-top: 1px solid ", ";\n border-bottom: 1px solid ", ";\n }\n "])), function (props) {
34
+ return props.theme.colors.lightPrimary;
35
+ }, function (props) {
36
+ return props.theme.colors.primary;
37
+ }, function (props) {
38
+ return props.theme.colors.primary;
39
+ });
40
+ });
41
+ exports.ZoneTbody = ZoneTbody;
42
+ var ActionsWrapper = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n"])));
43
+ exports.ActionsWrapper = ActionsWrapper;
44
+ var AddDeliveryZoneButton = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 14px;\n padding: 10px 0;\n cursor: pointer;\n width: fit-content;\n &:hover {\n color: ", ";\n }\n"])), function (props) {
45
+ return props.theme.colors.lightGray;
46
+ }, function (props) {
47
+ return props.theme.colors.primary;
48
+ });
49
+ exports.AddDeliveryZoneButton = AddDeliveryZoneButton;
50
+ var CheckboxWrapper = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n ", "\n"])), function (props) {
51
+ var _props$theme;
52
+ return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-left: 10px;\n "]))) : (0, _styledComponents.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-right: 10px;\n "])));
53
+ });
54
+ exports.CheckboxWrapper = CheckboxWrapper;