ordering-ui-admin-external 1.11.0 → 1.12.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.
- package/_bundles/{ordering-ui-admin.7d0c2b695c88927fa9b3.js → ordering-ui-admin.1a739d9a2d4d7fdd023f.js} +2 -2
- package/_bundles/{ordering-ui-admin.7d0c2b695c88927fa9b3.js.LICENSE.txt → ordering-ui-admin.1a739d9a2d4d7fdd023f.js.LICENSE.txt} +0 -0
- package/_modules/components/Delivery/DriversGroupDeliveryZoneInformation/index.js +8 -6
- package/_modules/components/Delivery/DriversGroupDetails/index.js +1 -1
- package/_modules/components/Delivery/DriversGroupDetails/styles.js +1 -1
- package/_modules/components/Delivery/DriversGroupGeneralForm/index.js +5 -2
- package/_modules/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -2
- package/_modules/components/Shared/Confirm/index.js +6 -2
- package/_modules/components/SidebarMenu/index.js +17 -12
- package/_modules/components/Stores/BusinessDeliveryZoneDetails/index.js +3 -2
- package/_modules/components/Stores/BusinessWalletsList/index.js +5 -1
- package/_modules/components/Stores/ProductExtraOptionDetails/index.js +48 -12
- package/_modules/components/Stores/ProductExtraOptions/index.js +46 -8
- package/_modules/components/Stores/ProductExtraSuboption/index.js +34 -0
- package/_modules/components/Stores/ProductExtras/index.js +6 -3
- package/_modules/components/Stores/ProductOptionExternalId/index.js +39 -0
- package/_modules/components/Stores/ProductOptionExternalId/styles.js +14 -0
- package/package.json +2 -2
- package/src/components/Delivery/DriversGroupDeliveryDetails/index.js +1 -1
- package/src/components/Delivery/DriversGroupDeliveryZoneInformation/index.js +7 -5
- package/src/components/Delivery/DriversGroupDeliveryZoneList/index.js +2 -2
- package/src/components/Delivery/DriversGroupDetails/index.js +1 -1
- package/src/components/Delivery/DriversGroupDetails/styles.js +1 -0
- package/src/components/Delivery/DriversGroupGeneralForm/index.js +16 -13
- package/src/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -2
- package/src/components/Shared/Confirm/index.js +11 -1
- package/src/components/SidebarMenu/index.js +19 -9
- package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +3 -2
- package/src/components/Stores/BusinessWalletsList/index.js +6 -1
- package/src/components/Stores/ProductExtraOptionDetails/index.js +28 -0
- package/src/components/Stores/ProductExtraOptions/index.js +30 -1
- package/src/components/Stores/ProductExtraSuboption/index.js +32 -0
- package/src/components/Stores/ProductExtras/index.js +4 -1
- package/src/components/Stores/ProductOptionExternalId/index.js +29 -0
- package/src/components/Stores/ProductOptionExternalId/styles.js +22 -0
|
File without changes
|
|
@@ -224,17 +224,19 @@ var DriverGroupDeliveryZoneInformation = function DriverGroupDeliveryZoneInforma
|
|
|
224
224
|
name: "distance",
|
|
225
225
|
maxLength: 2,
|
|
226
226
|
value: (_ref4 = (_formState$changes$da = (_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) !== null && _formState$changes$da !== void 0 ? _formState$changes$da : zone === null || zone === void 0 ? void 0 : (_zone$data = zone.data) === null || _zone$data === void 0 ? void 0 : _zone$data.distance) !== null && _ref4 !== void 0 ? _ref4 : '',
|
|
227
|
-
onInput: function onInput(e) {
|
|
228
|
-
e.target.value = e.target.value.match('^[1-9]{1,2}$');
|
|
229
|
-
},
|
|
230
227
|
onChange: function onChange(e) {
|
|
231
228
|
var _configState$configs4, _configState$configs5;
|
|
232
229
|
return handleChangeInput(e, configState === null || configState === void 0 ? void 0 : (_configState$configs4 = configState.configs) === null || _configState$configs4 === void 0 ? void 0 : (_configState$configs5 = _configState$configs4.distance_unit) === null || _configState$configs5 === void 0 ? void 0 : _configState$configs5.value);
|
|
233
230
|
},
|
|
234
231
|
ref: register({
|
|
235
232
|
required: t('DISTANCE_FROM_STORE', 'Distance from store')
|
|
236
|
-
})
|
|
237
|
-
|
|
233
|
+
}),
|
|
234
|
+
onKeyPress: function onKeyPress(e) {
|
|
235
|
+
if (!/^[0-9]$/.test(e.key)) {
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}))), zoneType !== 4 && zoneType !== 5 && isShowMap && (configState !== null && configState !== void 0 && (_configState$configs6 = configState.configs) !== null && _configState$configs6 !== void 0 && (_configState$configs7 = _configState$configs6.google_maps_api_key) !== null && _configState$configs7 !== void 0 && _configState$configs7.value ? /*#__PURE__*/_react.default.createElement(_styles2.WrapperMap, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
238
240
|
type: "button",
|
|
239
241
|
onClick: function onClick() {
|
|
240
242
|
return setClearState(true);
|
|
@@ -255,7 +257,7 @@ var DriverGroupDeliveryZoneInformation = function DriverGroupDeliveryZoneInforma
|
|
|
255
257
|
businessZones: driverGroupsZones,
|
|
256
258
|
kmlData: kmlData,
|
|
257
259
|
isDriverGroup: true
|
|
258
|
-
})) : /*#__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, {
|
|
260
|
+
})) : /*#__PURE__*/_react.default.createElement(_styles2.ErrorText, null, t('REQUIRED_GOOGLE_MAP_API_KEY', 'Google Maps api key is required'))), !zone && zoneType !== 5 && /*#__PURE__*/_react.default.createElement(_styles2.KmlButtonWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.Button, {
|
|
259
261
|
color: "primary",
|
|
260
262
|
borderRadius: "8px",
|
|
261
263
|
type: "button",
|
|
@@ -126,7 +126,7 @@ var DriversGroupDetailsUI = function DriversGroupDetailsUI(props) {
|
|
|
126
126
|
value: t('LOGS', 'Logs')
|
|
127
127
|
}];
|
|
128
128
|
setDriversGroupMenus(_driversGroupMenus);
|
|
129
|
-
}, [useAdvanced]);
|
|
129
|
+
}, [useAdvanced, driversGroupState === null || driversGroupState === void 0 ? void 0 : driversGroupState.driversGroup]);
|
|
130
130
|
var onDeleteGroup = function onDeleteGroup() {
|
|
131
131
|
setConfirm({
|
|
132
132
|
open: true,
|
|
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
13
13
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
14
|
var DetailsContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n padding: 20px;\n box-sizing: border-box;\n"])));
|
|
15
15
|
exports.DetailsContainer = DetailsContainer;
|
|
16
|
-
var Header = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: 15px;\n margin-top: 4px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n ", "\n\n > div:first-child {\n flex: 1;\n display: flex;\n align-items: center;\n h1 {\n font-size: 20px;\n font-weight: 700;\n margin: 0px;\n }\n \n label {\n margin: 0 20px;\n }\n }\n"])), function (props) {
|
|
16
|
+
var Header = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-bottom: 15px;\n margin-top: 4px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n ", "\n\n > div:first-child {\n flex: 1;\n display: flex;\n align-items: center;\n h1 {\n font-size: 20px;\n font-weight: 700;\n margin: 0px;\n flex: 1;\n }\n \n label {\n margin: 0 20px;\n }\n }\n"])), function (props) {
|
|
17
17
|
var _props$theme;
|
|
18
18
|
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-left: 40px;\n "]))) : (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-right: 40px;\n "])));
|
|
19
19
|
});
|
|
@@ -50,6 +50,9 @@ var DriversGroupGeneralForm = function DriversGroupGeneralForm(props) {
|
|
|
50
50
|
var _useConfig = (0, _orderingComponentsAdminExternal.useConfig)(),
|
|
51
51
|
_useConfig2 = _slicedToArray(_useConfig, 1),
|
|
52
52
|
configState = _useConfig2[0];
|
|
53
|
+
var _useSession = (0, _orderingComponentsAdminExternal.useSession)(),
|
|
54
|
+
_useSession2 = _slicedToArray(_useSession, 1),
|
|
55
|
+
user = _useSession2[0].user;
|
|
53
56
|
var autoAssignType = configState === null || configState === void 0 ? void 0 : (_configState$configs = configState.configs) === null || _configState$configs === void 0 ? void 0 : (_configState$configs$ = _configState$configs.autoassign_type) === null || _configState$configs$ === void 0 ? void 0 : _configState$configs$.value;
|
|
54
57
|
var typeOptions = [{
|
|
55
58
|
value: 0,
|
|
@@ -98,7 +101,7 @@ var DriversGroupGeneralForm = function DriversGroupGeneralForm(props) {
|
|
|
98
101
|
}
|
|
99
102
|
handleUpdateDriversGroup(changesState);
|
|
100
103
|
} else {
|
|
101
|
-
if (!(changesState !== null && changesState !== void 0 && changesState.administrator_id)) {
|
|
104
|
+
if ((user === null || user === void 0 ? void 0 : user.level) !== 5 && !(changesState !== null && changesState !== void 0 && changesState.administrator_id)) {
|
|
102
105
|
setAlertState({
|
|
103
106
|
open: true,
|
|
104
107
|
content: [t('VALIDATION_ERROR_REQUIRED', 'The manager is required.').replace('_attribute_', t('DRIVER_MANAGER', 'Driver manager'))]
|
|
@@ -159,7 +162,7 @@ var DriversGroupGeneralForm = function DriversGroupGeneralForm(props) {
|
|
|
159
162
|
required: t('VALIDATION_ERROR_REQUIRED', 'Project is required').replace('_attribute_', t('NAME', 'Name'))
|
|
160
163
|
}),
|
|
161
164
|
autoComplete: "off"
|
|
162
|
-
})), /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, null, /*#__PURE__*/_react.default.createElement("label", null, t('DRIVER_MANAGER', 'Driver manager')), /*#__PURE__*/_react.default.createElement(_styles.SecondSelect, {
|
|
165
|
+
})), (user === null || user === void 0 ? void 0 : user.level) !== 5 && /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, null, /*#__PURE__*/_react.default.createElement("label", null, t('DRIVER_MANAGER', 'Driver manager')), /*#__PURE__*/_react.default.createElement(_styles.SecondSelect, {
|
|
163
166
|
isSecondIcon: true,
|
|
164
167
|
placeholder: t('SELECT_MANAGER', 'Select driver manager'),
|
|
165
168
|
options: driversManagersOptions,
|
|
@@ -142,8 +142,8 @@ var EnterprisePromotionGeneralDetails = function EnterprisePromotionGeneralDetai
|
|
|
142
142
|
};
|
|
143
143
|
var handleChangeDates = function handleChangeDates(item) {
|
|
144
144
|
handleChangeItem({
|
|
145
|
-
start: (0, _moment.default)(item.selection.startDate).format('YYYY-MM-DD'),
|
|
146
|
-
end: item.selection.endDate ? (0, _moment.default)(item.selection.endDate).format('YYYY-MM-DD') : null
|
|
145
|
+
start: (0, _moment.default)(item.selection.startDate).format('YYYY-MM-DD 00:00:00'),
|
|
146
|
+
end: item.selection.endDate ? (0, _moment.default)(item.selection.endDate).format('YYYY-MM-DD 23:59:59') : null
|
|
147
147
|
});
|
|
148
148
|
setDateRange([item.selection]);
|
|
149
149
|
};
|
|
@@ -48,9 +48,13 @@ var ConfirmUI = function ConfirmUI(props) {
|
|
|
48
48
|
return onClose();
|
|
49
49
|
}
|
|
50
50
|
}, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.XLg, null))), title && /*#__PURE__*/_react.default.createElement(_styles2.PopupTitle, null, title), /*#__PURE__*/_react.default.createElement(_styles2.PopupContent, null, content && typeof content === 'string' && content, content && _typeof(content) === 'object' && Array.isArray(content) && /*#__PURE__*/_react.default.createElement("ul", null, content.map(function (item, i) {
|
|
51
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
52
52
|
key: i
|
|
53
|
-
},
|
|
53
|
+
}, Array.isArray(item) ? item.map(function (err, index) {
|
|
54
|
+
return typeof err === 'string' && /*#__PURE__*/_react.default.createElement("li", {
|
|
55
|
+
key: index
|
|
56
|
+
}, t(err.toUpperCase(), errors[err] || err));
|
|
57
|
+
}) : typeof item === 'string' && /*#__PURE__*/_react.default.createElement("li", null, t(item.toUpperCase(), errors[item] || item)));
|
|
54
58
|
})), children), (onCancel || onAccept || onClose) && /*#__PURE__*/_react.default.createElement(_styles2.PopupActions, null, onCancel && /*#__PURE__*/_react.default.createElement(_styles.Button, {
|
|
55
59
|
outline: true,
|
|
56
60
|
onClick: function onClick() {
|
|
@@ -73,19 +73,24 @@ var SidebarMenuUI = function SidebarMenuUI(props) {
|
|
|
73
73
|
}, {
|
|
74
74
|
id: 2,
|
|
75
75
|
title: t('DELIVERY_DASHBOARD', 'Deliveries dashboard'),
|
|
76
|
-
pageName: 'deliveries'
|
|
76
|
+
pageName: 'deliveries',
|
|
77
|
+
url: '/deliveries'
|
|
77
78
|
}, {
|
|
78
79
|
id: 3,
|
|
79
80
|
title: t('DRIVERS_DASHBOARD', 'Drivers Dashboard'),
|
|
80
|
-
pageName: 'drivers'
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
pageName: 'drivers',
|
|
82
|
+
url: '/drivers'
|
|
83
|
+
}, {
|
|
84
|
+
id: 4,
|
|
85
|
+
title: t('APPOINTMENTS', 'Appointments'),
|
|
86
|
+
pageName: 'appointments',
|
|
87
|
+
url: '/appointments'
|
|
88
|
+
}, {
|
|
89
|
+
id: 5,
|
|
90
|
+
title: t('GIFT_CARD_MANAGER', 'Gift card manager'),
|
|
91
|
+
pageName: 'giftCards',
|
|
92
|
+
url: '/gift-cards'
|
|
93
|
+
}];
|
|
89
94
|
var loyaltySubMenus = [{
|
|
90
95
|
id: 1,
|
|
91
96
|
title: t('LOYALTY_AUTOMATION', 'Loyalty automation'),
|
|
@@ -490,7 +495,7 @@ var SidebarMenuUI = function SidebarMenuUI(props) {
|
|
|
490
495
|
}, (0, _utils.firstLetterCapital)(item.title));
|
|
491
496
|
})))), (sessionState === null || sessionState === void 0 ? void 0 : (_sessionState$user28 = sessionState.user) === null || _sessionState$user28 === void 0 ? void 0 : _sessionState$user28.level) === 0 && /*#__PURE__*/_react.default.createElement(_styles.MenuContainer, null, /*#__PURE__*/_react.default.createElement(ContextAwareToggle, {
|
|
492
497
|
eventKey: "8",
|
|
493
|
-
active: location.pathname === '/marketing/promotions-enterprise' || location.pathname === '/marketing/campaign'
|
|
498
|
+
active: location.pathname === '/marketing/promotions-enterprise' || location.pathname === '/marketing/campaign' || location.pathname === '/marketing/ad-banners'
|
|
494
499
|
}, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.GraphUp, null), /*#__PURE__*/_react.default.createElement("span", null, t('MARKETING', 'Marketing'))), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Accordion.Collapse, {
|
|
495
500
|
eventKey: "8"
|
|
496
501
|
}, /*#__PURE__*/_react.default.createElement(_styles.MenuContent, null, marketingSubmenus.map(function (item) {
|
|
@@ -552,7 +557,7 @@ var SidebarMenuUI = function SidebarMenuUI(props) {
|
|
|
552
557
|
className: "d-flex flex-column mt-4"
|
|
553
558
|
}, /*#__PURE__*/_react.default.createElement(_styles.LanguageSelectorContainer, null, /*#__PURE__*/_react.default.createElement(_LanguageSelector.LanguageSelector, null)), (sessionState === null || sessionState === void 0 ? void 0 : (_sessionState$user32 = sessionState.user) === null || _sessionState$user32 === void 0 ? void 0 : _sessionState$user32.level) === 0 && /*#__PURE__*/_react.default.createElement(_reactBootstrap.Accordion, null, /*#__PURE__*/_react.default.createElement(_styles.MenuContainer, null, /*#__PURE__*/_react.default.createElement(ContextAwareToggle, {
|
|
554
559
|
eventKey: "5",
|
|
555
|
-
active: location.pathname === '/settings/basic' || location.pathname === '/settings/operation' || location.pathname === '/settings/pages' || location.pathname === '/settings/integrations' || location.pathname === '/settings/places' || location.pathname === '/settings/advanced' || location.pathname === '/settings/language'
|
|
560
|
+
active: location.pathname === '/settings/basic' || location.pathname === '/settings/operation' || location.pathname === '/settings/plugin' || location.pathname === '/settings/pages' || location.pathname === '/settings/integrations' || location.pathname === '/settings/places' || location.pathname === '/settings/advanced' || location.pathname === '/settings/language'
|
|
556
561
|
}, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.Gear, null), /*#__PURE__*/_react.default.createElement("span", null, t('SETTINGS', 'Settings'))), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Accordion.Collapse, {
|
|
557
562
|
eventKey: "5"
|
|
558
563
|
}, /*#__PURE__*/_react.default.createElement(_styles.MenuContent, null, settingsSubMenus.map(function (item) {
|
|
@@ -39,7 +39,8 @@ var BusinessDeliveryZoneDetailsUI = function BusinessDeliveryZoneDetailsUI(props
|
|
|
39
39
|
handleAddBusinessDeliveryZone = props.handleAddBusinessDeliveryZone,
|
|
40
40
|
handleDeleteBusinessDeliveryZone = props.handleDeleteBusinessDeliveryZone,
|
|
41
41
|
kmlData = props.kmlData,
|
|
42
|
-
handleUploadKmlFiles = props.handleUploadKmlFiles
|
|
42
|
+
handleUploadKmlFiles = props.handleUploadKmlFiles,
|
|
43
|
+
handleSuccessUpdate = props.handleSuccessUpdate;
|
|
43
44
|
var theme = (0, _styledComponents.useTheme)();
|
|
44
45
|
var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
|
|
45
46
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -108,7 +109,7 @@ var BusinessDeliveryZoneDetailsUI = function BusinessDeliveryZoneDetailsUI(props
|
|
|
108
109
|
}), selectedMenuOption === 'share_with' && /*#__PURE__*/_react.default.createElement(_BusinessDeliveryZoneShare.BusinessDeliveryZoneShare, {
|
|
109
110
|
business: business,
|
|
110
111
|
zone: zoneState.zone,
|
|
111
|
-
|
|
112
|
+
handleSuccessUpdate: handleSuccessUpdate
|
|
112
113
|
})), /*#__PURE__*/_react.default.createElement(_Shared.Confirm, {
|
|
113
114
|
width: "700px",
|
|
114
115
|
title: t('WEB_APPNAME', 'Ordering'),
|
|
@@ -59,6 +59,10 @@ var BusinessWalletsListUI = function BusinessWalletsListUI(props) {
|
|
|
59
59
|
wallet_cash_enabled: isWalletCashEnabled,
|
|
60
60
|
wallet_credit_point_enabled: isWalletPointsEnabled && loyaltyPlanState.created
|
|
61
61
|
};
|
|
62
|
+
var walletsLangs = {
|
|
63
|
+
wallet_cash_enabled: t('WALLET_CASH_ENABLED', 'Wallet cash enabled'),
|
|
64
|
+
wallet_credit_point_enabled: t('WALLET_CREDIT_POINT_ENABLED', 'Wallet credit point enabled')
|
|
65
|
+
};
|
|
62
66
|
var handleOpenWallet = function handleOpenWallet(config) {
|
|
63
67
|
setIsOpenWalletDetails(true);
|
|
64
68
|
handleClosePaymethodDetails();
|
|
@@ -100,7 +104,7 @@ var BusinessWalletsListUI = function BusinessWalletsListUI(props) {
|
|
|
100
104
|
onClick: function onClick() {
|
|
101
105
|
return handleOpenWallet(config);
|
|
102
106
|
}
|
|
103
|
-
}, /*#__PURE__*/_react.default.createElement(_styles.WalletName, null, config.
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.WalletName, null, walletsLangs[config.key]), /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ChevronRight, null));
|
|
104
108
|
}))), isOpenDetails && /*#__PURE__*/_react.default.createElement(_Shared.SideBar, {
|
|
105
109
|
isBorderShow: true,
|
|
106
110
|
open: isOpenDetails,
|
|
@@ -19,6 +19,7 @@ var _reactBootstrapIcons = require("react-bootstrap-icons");
|
|
|
19
19
|
var _reactHookForm = require("react-hook-form");
|
|
20
20
|
var _ProductExtraSuboption = require("../ProductExtraSuboption");
|
|
21
21
|
var _ProductExtraOptionForm = require("../ProductExtraOptionForm");
|
|
22
|
+
var _ProductOptionExternalId = require("../ProductOptionExternalId");
|
|
22
23
|
var _styles2 = require("./styles");
|
|
23
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
25
|
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); }
|
|
@@ -35,7 +36,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
35
36
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
36
37
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
38
|
var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
38
|
-
var _settingChangeState$c, _settingChangeState$c2, _optionState$
|
|
39
|
+
var _optionState$option2, _settingChangeState$c, _settingChangeState$c2, _optionState$option3, _settingChangeState$c3, _settingChangeState$c4, _optionState$option4, _optionState$option5, _optionState$option5$, _optionState$option7, _optionState$option7$, _changesState$changes3, _optionState$option8, _optionState$option8$, _changesState$changes4, _settingChangeState$c5, _settingChangeState$c6, _optionState$option9, _optionState$option10, _optionState$option11, _changesState$changes5, _settingChangeState$c7, _settingChangeState$c8, _optionState$option12, _optionState$option13, _optionState$option14, _changesState$changes6;
|
|
39
40
|
var optionState = props.optionState,
|
|
40
41
|
optionChangesState = props.optionChangesState,
|
|
41
42
|
handleOptionFiles = props.handleOptionFiles,
|
|
@@ -111,6 +112,10 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
111
112
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
112
113
|
cropState = _useState10[0],
|
|
113
114
|
setCropState = _useState10[1];
|
|
115
|
+
var _useState11 = (0, _react.useState)(),
|
|
116
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
117
|
+
externalId = _useState12[0],
|
|
118
|
+
setExternalId = _useState12[1];
|
|
114
119
|
var handleClickSubOptionImage = function handleClickSubOptionImage(id) {
|
|
115
120
|
document.getElementById(id).click();
|
|
116
121
|
};
|
|
@@ -178,6 +183,14 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
178
183
|
handleSubmit(handleAddOption)();
|
|
179
184
|
}
|
|
180
185
|
};
|
|
186
|
+
var handleUpdateExternalId = function handleUpdateExternalId() {
|
|
187
|
+
handleUpdateOption({
|
|
188
|
+
external_id: externalId
|
|
189
|
+
});
|
|
190
|
+
setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
191
|
+
externalId: false
|
|
192
|
+
}));
|
|
193
|
+
};
|
|
181
194
|
(0, _react.useEffect)(function () {
|
|
182
195
|
if (Object.keys(errors).length > 0) {
|
|
183
196
|
setAlertState({
|
|
@@ -188,6 +201,10 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
188
201
|
});
|
|
189
202
|
}
|
|
190
203
|
}, [errors]);
|
|
204
|
+
(0, _react.useEffect)(function () {
|
|
205
|
+
var _optionState$option;
|
|
206
|
+
setExternalId(optionState === null || optionState === void 0 ? void 0 : (_optionState$option = optionState.option) === null || _optionState$option === void 0 ? void 0 : _optionState$option.external_id);
|
|
207
|
+
}, [optionState === null || optionState === void 0 ? void 0 : (_optionState$option2 = optionState.option) === null || _optionState$option2 === void 0 ? void 0 : _optionState$option2.external_id]);
|
|
191
208
|
return /*#__PURE__*/_react.default.createElement(_styles2.MainContainer, null, /*#__PURE__*/_react.default.createElement(_styles2.Header, null, /*#__PURE__*/_react.default.createElement("h1", null, t('PRODUCT_OPTION', 'Product option')), /*#__PURE__*/_react.default.createElement(_styles2.ActionSelectorWrapper, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.DropdownButton, {
|
|
192
209
|
className: "product_actions",
|
|
193
210
|
menuAlign: theme !== null && theme !== void 0 && theme.rtl ? 'left' : 'right',
|
|
@@ -200,6 +217,12 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
200
217
|
}));
|
|
201
218
|
}
|
|
202
219
|
}, t('CUSTOM_FIELDS', 'Custom Fields')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
|
|
220
|
+
onClick: function onClick() {
|
|
221
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
222
|
+
externalId: true
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
}, t('EXTERNAL_ID', 'External ID')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
|
|
203
226
|
onClick: function onClick() {
|
|
204
227
|
return handleDeleteOption();
|
|
205
228
|
}
|
|
@@ -224,19 +247,19 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
224
247
|
header: true
|
|
225
248
|
}, /*#__PURE__*/_react.default.createElement("label", null, t('NAME', 'Name')), /*#__PURE__*/_react.default.createElement(_styles.Input, null))), /*#__PURE__*/_react.default.createElement(_styles2.RightSubOptionContent, null, /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
226
249
|
header: true
|
|
227
|
-
}, /*#__PURE__*/_react.default.createElement("label", null, t('PRICE', 'Price')), /*#__PURE__*/_react.default.createElement(_styles.Input, null)), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c = settingChangeState.changes) === null || _settingChangeState$c === void 0 ? void 0 : _settingChangeState$c.with_half_option) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c2 = settingChangeState.changes) === null || _settingChangeState$c2 === void 0 ? void 0 : _settingChangeState$c2.with_half_option : optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
250
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, t('PRICE', 'Price')), /*#__PURE__*/_react.default.createElement(_styles.Input, null)), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c = settingChangeState.changes) === null || _settingChangeState$c === void 0 ? void 0 : _settingChangeState$c.with_half_option) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c2 = settingChangeState.changes) === null || _settingChangeState$c2 === void 0 ? void 0 : _settingChangeState$c2.with_half_option : optionState === null || optionState === void 0 ? void 0 : (_optionState$option3 = optionState.option) === null || _optionState$option3 === void 0 ? void 0 : _optionState$option3.with_half_option) && /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
228
251
|
header: true
|
|
229
|
-
}, /*#__PURE__*/_react.default.createElement("label", null, t('HALF_PRICE', 'Half price')), /*#__PURE__*/_react.default.createElement(_styles.Input, null)), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c3 = settingChangeState.changes) === null || _settingChangeState$c3 === void 0 ? void 0 : _settingChangeState$c3.allow_suboption_quantity) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c4 = settingChangeState.changes) === null || _settingChangeState$c4 === void 0 ? void 0 : _settingChangeState$c4.allow_suboption_quantity : optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
252
|
+
}, /*#__PURE__*/_react.default.createElement("label", null, t('HALF_PRICE', 'Half price')), /*#__PURE__*/_react.default.createElement(_styles.Input, null)), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c3 = settingChangeState.changes) === null || _settingChangeState$c3 === void 0 ? void 0 : _settingChangeState$c3.allow_suboption_quantity) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c4 = settingChangeState.changes) === null || _settingChangeState$c4 === void 0 ? void 0 : _settingChangeState$c4.allow_suboption_quantity : optionState === null || optionState === void 0 ? void 0 : (_optionState$option4 = optionState.option) === null || _optionState$option4 === void 0 ? void 0 : _optionState$option4.allow_suboption_quantity) && /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
230
253
|
header: true
|
|
231
254
|
}, /*#__PURE__*/_react.default.createElement("label", null, t('MAX', 'Max')), /*#__PURE__*/_react.default.createElement(_styles.Input, null)), /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
232
255
|
header: true
|
|
233
256
|
}, /*#__PURE__*/_react.default.createElement("label", null, t('PRESELECT', 'Preselect'))), /*#__PURE__*/_react.default.createElement(_styles2.ActionsContainer, {
|
|
234
257
|
header: true
|
|
235
|
-
}))), optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
258
|
+
}))), optionState === null || optionState === void 0 ? void 0 : (_optionState$option5 = optionState.option) === null || _optionState$option5 === void 0 ? void 0 : (_optionState$option5$ = _optionState$option5.suboptions) === null || _optionState$option5$ === void 0 ? void 0 : _optionState$option5$.sort(function (a, b) {
|
|
236
259
|
return a.rank - b.rank;
|
|
237
260
|
}).map(function (subOption, index) {
|
|
238
|
-
var _optionState$
|
|
239
|
-
var isLastSubOption = index === (optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
261
|
+
var _optionState$option6;
|
|
262
|
+
var isLastSubOption = index === (optionState === null || optionState === void 0 ? void 0 : (_optionState$option6 = optionState.option) === null || _optionState$option6 === void 0 ? void 0 : _optionState$option6.suboptions.length) - 1;
|
|
240
263
|
return /*#__PURE__*/_react.default.createElement(_ProductExtraSuboption.ProductExtraSuboption, {
|
|
241
264
|
key: subOption.id,
|
|
242
265
|
subOption: subOption,
|
|
@@ -298,7 +321,7 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
298
321
|
},
|
|
299
322
|
defaultValue: ""
|
|
300
323
|
}), /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
301
|
-
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
324
|
+
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$option7 = optionState.option) === null || _optionState$option7 === void 0 ? void 0 : (_optionState$option7$ = _optionState$option7.suboptions) === null || _optionState$option7$ === void 0 ? void 0 : _optionState$option7$.length) === 0
|
|
302
325
|
}, /*#__PURE__*/_react.default.createElement(_styles.Input, {
|
|
303
326
|
name: "name",
|
|
304
327
|
autoComplete: "off",
|
|
@@ -308,7 +331,7 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
308
331
|
required: t('NAME_REQUIRED', 'The name is required.')
|
|
309
332
|
})
|
|
310
333
|
}))), /*#__PURE__*/_react.default.createElement(_styles2.RightSubOptionContent, null, /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
311
|
-
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
334
|
+
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$option8 = optionState.option) === null || _optionState$option8 === void 0 ? void 0 : (_optionState$option8$ = _optionState$option8.suboptions) === null || _optionState$option8$ === void 0 ? void 0 : _optionState$option8$.length) === 0
|
|
312
335
|
}, /*#__PURE__*/_react.default.createElement(_styles.Input, {
|
|
313
336
|
name: "price",
|
|
314
337
|
placeholder: t('PRICE', 'Price'),
|
|
@@ -320,8 +343,8 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
320
343
|
}
|
|
321
344
|
handleEnterAddSuboption(e);
|
|
322
345
|
}
|
|
323
|
-
})), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c5 = settingChangeState.changes) === null || _settingChangeState$c5 === void 0 ? void 0 : _settingChangeState$c5.with_half_option) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c6 = settingChangeState.changes) === null || _settingChangeState$c6 === void 0 ? void 0 : _settingChangeState$c6.with_half_option : optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
324
|
-
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
346
|
+
})), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c5 = settingChangeState.changes) === null || _settingChangeState$c5 === void 0 ? void 0 : _settingChangeState$c5.with_half_option) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c6 = settingChangeState.changes) === null || _settingChangeState$c6 === void 0 ? void 0 : _settingChangeState$c6.with_half_option : optionState === null || optionState === void 0 ? void 0 : (_optionState$option9 = optionState.option) === null || _optionState$option9 === void 0 ? void 0 : _optionState$option9.with_half_option) && /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
347
|
+
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$option10 = optionState.option) === null || _optionState$option10 === void 0 ? void 0 : (_optionState$option11 = _optionState$option10.suboptions) === null || _optionState$option11 === void 0 ? void 0 : _optionState$option11.length) === 0
|
|
325
348
|
}, /*#__PURE__*/_react.default.createElement(_styles.Input, {
|
|
326
349
|
name: "half_price",
|
|
327
350
|
placeholder: t('HALF_PRICE', 'Half price'),
|
|
@@ -333,8 +356,8 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
333
356
|
}
|
|
334
357
|
handleEnterAddSuboption(e);
|
|
335
358
|
}
|
|
336
|
-
})), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c7 = settingChangeState.changes) === null || _settingChangeState$c7 === void 0 ? void 0 : _settingChangeState$c7.allow_suboption_quantity) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c8 = settingChangeState.changes) === null || _settingChangeState$c8 === void 0 ? void 0 : _settingChangeState$c8.allow_suboption_quantity : optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
337
|
-
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$
|
|
359
|
+
})), (typeof (settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c7 = settingChangeState.changes) === null || _settingChangeState$c7 === void 0 ? void 0 : _settingChangeState$c7.allow_suboption_quantity) !== 'undefined' ? settingChangeState === null || settingChangeState === void 0 ? void 0 : (_settingChangeState$c8 = settingChangeState.changes) === null || _settingChangeState$c8 === void 0 ? void 0 : _settingChangeState$c8.allow_suboption_quantity : optionState === null || optionState === void 0 ? void 0 : (_optionState$option12 = optionState.option) === null || _optionState$option12 === void 0 ? void 0 : _optionState$option12.allow_suboption_quantity) && /*#__PURE__*/_react.default.createElement(_styles2.InputWrapper, {
|
|
360
|
+
primary: (optionState === null || optionState === void 0 ? void 0 : (_optionState$option13 = optionState.option) === null || _optionState$option13 === void 0 ? void 0 : (_optionState$option14 = _optionState$option13.suboptions) === null || _optionState$option14 === void 0 ? void 0 : _optionState$option14.length) === 0
|
|
338
361
|
}, /*#__PURE__*/_react.default.createElement(_styles.Input, {
|
|
339
362
|
name: "max",
|
|
340
363
|
placeholder: t('MAX', 'Max'),
|
|
@@ -422,6 +445,19 @@ var ProductExtraOptionDetailsUI = function ProductExtraOptionDetailsUI(props) {
|
|
|
422
445
|
extraId: extra.id,
|
|
423
446
|
optionId: optionState.option.id,
|
|
424
447
|
subOptionId: selectedSubOptionId
|
|
448
|
+
})), /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
449
|
+
width: "70%",
|
|
450
|
+
title: t('PRODUCT_SUBOPTION', 'Product suboption'),
|
|
451
|
+
open: openModal === null || openModal === void 0 ? void 0 : openModal.externalId,
|
|
452
|
+
onClose: function onClose() {
|
|
453
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
454
|
+
externalId: false
|
|
455
|
+
}));
|
|
456
|
+
}
|
|
457
|
+
}, /*#__PURE__*/_react.default.createElement(_ProductOptionExternalId.ProductOptionExternalId, {
|
|
458
|
+
value: externalId,
|
|
459
|
+
handleChange: setExternalId,
|
|
460
|
+
handleUpdate: handleUpdateExternalId
|
|
425
461
|
})), /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
426
462
|
width: "700px",
|
|
427
463
|
height: "80vh",
|
|
@@ -17,6 +17,7 @@ var _Shared = require("../../Shared");
|
|
|
17
17
|
var _styles = require("../../../styles");
|
|
18
18
|
var _ProductExtraMetaFields = require("../ProductExtraMetaFields");
|
|
19
19
|
var _ProductExtraOptionDetails = require("../ProductExtraOptionDetails");
|
|
20
|
+
var _ProductOptionExternalId = require("../ProductOptionExternalId");
|
|
20
21
|
var _styles2 = require("./styles");
|
|
21
22
|
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); }
|
|
22
23
|
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; }
|
|
@@ -32,7 +33,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
32
33
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
33
34
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
35
|
var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
35
|
-
var _extraState$extra, _extraState$
|
|
36
|
+
var _extraState$extra, _extraState$extra4, _extraState$extra6, _extraState$extra7, _extraState$extra8;
|
|
36
37
|
var open = props.open,
|
|
37
38
|
onClose = props.onClose,
|
|
38
39
|
extraState = props.extraState,
|
|
@@ -59,7 +60,8 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
59
60
|
handleDragStart = props.handleDragStart,
|
|
60
61
|
hanldeDragOver = props.hanldeDragOver,
|
|
61
62
|
handleDrop = props.handleDrop,
|
|
62
|
-
handleDragEnd = props.handleDragEnd
|
|
63
|
+
handleDragEnd = props.handleDragEnd,
|
|
64
|
+
handleUpdateExtraState = props.handleUpdateExtraState;
|
|
63
65
|
var theme = (0, _styledComponents.useTheme)();
|
|
64
66
|
var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
|
|
65
67
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -112,6 +114,10 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
112
114
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
113
115
|
cropState = _useState14[0],
|
|
114
116
|
setCropState = _useState14[1];
|
|
117
|
+
var _useState15 = (0, _react.useState)(),
|
|
118
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
119
|
+
externalId = _useState16[0],
|
|
120
|
+
setExternalId = _useState16[1];
|
|
115
121
|
var closeAlert = function closeAlert() {
|
|
116
122
|
setAlertState({
|
|
117
123
|
open: false,
|
|
@@ -220,6 +226,15 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
220
226
|
}, 750);
|
|
221
227
|
setTimer(_timer);
|
|
222
228
|
};
|
|
229
|
+
var handleUpdateExternalId = function handleUpdateExternalId() {
|
|
230
|
+
var _extraState$extra2;
|
|
231
|
+
handleUpdateExtraState((_extraState$extra2 = extraState.extra) === null || _extraState$extra2 === void 0 ? void 0 : _extraState$extra2.id, {
|
|
232
|
+
external_id: externalId
|
|
233
|
+
});
|
|
234
|
+
setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
235
|
+
externalId: false
|
|
236
|
+
}));
|
|
237
|
+
};
|
|
223
238
|
(0, _react.useEffect)(function () {
|
|
224
239
|
if (!(addChangesState !== null && addChangesState !== void 0 && addChangesState.name) && (addChangesState === null || addChangesState === void 0 ? void 0 : addChangesState.min) === 1 && (addChangesState === null || addChangesState === void 0 ? void 0 : addChangesState.max) === 1) {
|
|
225
240
|
setValue('name', (addChangesState === null || addChangesState === void 0 ? void 0 : addChangesState.name) || '');
|
|
@@ -228,9 +243,13 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
228
243
|
}
|
|
229
244
|
}, [addChangesState]);
|
|
230
245
|
(0, _react.useEffect)(function () {
|
|
231
|
-
var _extraState$
|
|
232
|
-
setExtraName((_extraState$
|
|
233
|
-
}, [(_extraState$
|
|
246
|
+
var _extraState$extra3;
|
|
247
|
+
setExtraName((_extraState$extra3 = extraState.extra) === null || _extraState$extra3 === void 0 ? void 0 : _extraState$extra3.name);
|
|
248
|
+
}, [(_extraState$extra4 = extraState.extra) === null || _extraState$extra4 === void 0 ? void 0 : _extraState$extra4.name]);
|
|
249
|
+
(0, _react.useEffect)(function () {
|
|
250
|
+
var _extraState$extra5;
|
|
251
|
+
setExternalId(extraState === null || extraState === void 0 ? void 0 : (_extraState$extra5 = extraState.extra) === null || _extraState$extra5 === void 0 ? void 0 : _extraState$extra5.external_id);
|
|
252
|
+
}, [extraState === null || extraState === void 0 ? void 0 : (_extraState$extra6 = extraState.extra) === null || _extraState$extra6 === void 0 ? void 0 : _extraState$extra6.external_id]);
|
|
234
253
|
return /*#__PURE__*/_react.default.createElement(_styles2.MainContainer, {
|
|
235
254
|
id: "extra_options"
|
|
236
255
|
}, /*#__PURE__*/_react.default.createElement(_styles2.OptionsContainer, null, /*#__PURE__*/_react.default.createElement(_styles2.Header, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
@@ -252,6 +271,12 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
252
271
|
}));
|
|
253
272
|
}
|
|
254
273
|
}, t('CUSTOM_FIELDS', 'Custom Fields')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
|
|
274
|
+
onClick: function onClick() {
|
|
275
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
276
|
+
externalId: true
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
}, t('EXTERNAL_ID', 'External ID')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
|
|
255
280
|
onClick: function onClick() {
|
|
256
281
|
return handleDeleteExtraClick();
|
|
257
282
|
}
|
|
@@ -268,11 +293,11 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
268
293
|
isHeader: true
|
|
269
294
|
}, t('MINIMUM', 'Min')), /*#__PURE__*/_react.default.createElement(_styles2.MaxPurchase, {
|
|
270
295
|
isHeader: true
|
|
271
|
-
}, t('MAX', 'Max')), /*#__PURE__*/_react.default.createElement(_styles2.ArrowWrpper, null)), ((_extraState$
|
|
296
|
+
}, t('MAX', 'Max')), /*#__PURE__*/_react.default.createElement(_styles2.ArrowWrpper, null)), ((_extraState$extra7 = extraState.extra) === null || _extraState$extra7 === void 0 ? void 0 : _extraState$extra7.options) && ((_extraState$extra8 = extraState.extra) === null || _extraState$extra8 === void 0 ? void 0 : _extraState$extra8.options.sort(function (a, b) {
|
|
272
297
|
return a.rank - b.rank;
|
|
273
298
|
}).map(function (option, index) {
|
|
274
|
-
var _extraState$
|
|
275
|
-
var isLastOption = index === ((_extraState$
|
|
299
|
+
var _extraState$extra9, _theme$images$icons;
|
|
300
|
+
var isLastOption = index === ((_extraState$extra9 = extraState.extra) === null || _extraState$extra9 === void 0 ? void 0 : _extraState$extra9.options.length) - 1;
|
|
276
301
|
return /*#__PURE__*/_react.default.createElement(_styles2.OptionItem, {
|
|
277
302
|
key: option.id,
|
|
278
303
|
active: option.id === (curOption === null || curOption === void 0 ? void 0 : curOption.id),
|
|
@@ -441,6 +466,19 @@ var ProductExtraOptionsUI = function ProductExtraOptionsUI(props) {
|
|
|
441
466
|
}, /*#__PURE__*/_react.default.createElement(_ProductExtraMetaFields.ProductExtraMetaFields, {
|
|
442
467
|
businessId: business.id,
|
|
443
468
|
extraId: extraState.extra.id
|
|
469
|
+
})), /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
470
|
+
width: "70%",
|
|
471
|
+
title: t('PRODUCT_EXTRA', 'Product extra'),
|
|
472
|
+
open: openModal === null || openModal === void 0 ? void 0 : openModal.externalId,
|
|
473
|
+
onClose: function onClose() {
|
|
474
|
+
return setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
475
|
+
externalId: false
|
|
476
|
+
}));
|
|
477
|
+
}
|
|
478
|
+
}, /*#__PURE__*/_react.default.createElement(_ProductOptionExternalId.ProductOptionExternalId, {
|
|
479
|
+
value: externalId,
|
|
480
|
+
handleChange: setExternalId,
|
|
481
|
+
handleUpdate: handleUpdateExternalId
|
|
444
482
|
})), /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
445
483
|
width: "700px",
|
|
446
484
|
height: "80vh",
|
|
@@ -16,6 +16,7 @@ var _reactBootstrap = require("react-bootstrap");
|
|
|
16
16
|
var _styledComponents = require("styled-components");
|
|
17
17
|
var _reactHookForm = require("react-hook-form");
|
|
18
18
|
var _styles2 = require("./styles");
|
|
19
|
+
var _ProductOptionExternalId = require("../ProductOptionExternalId");
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
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); }
|
|
21
22
|
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; }
|
|
@@ -89,6 +90,14 @@ var ProductExtraSuboption = function ProductExtraSuboption(props) {
|
|
|
89
90
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
90
91
|
formState = _useState10[0],
|
|
91
92
|
setFormState = _useState10[1];
|
|
93
|
+
var _useState11 = (0, _react.useState)(false),
|
|
94
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
95
|
+
externalIdOpen = _useState12[0],
|
|
96
|
+
setExternalIdOpen = _useState12[1];
|
|
97
|
+
var _useState13 = (0, _react.useState)(),
|
|
98
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
99
|
+
externalId = _useState14[0],
|
|
100
|
+
setExternalId = _useState14[1];
|
|
92
101
|
var handleClickSubOptionImage = function handleClickSubOptionImage(id) {
|
|
93
102
|
document.getElementById(id).click();
|
|
94
103
|
};
|
|
@@ -155,6 +164,13 @@ var ProductExtraSuboption = function ProductExtraSuboption(props) {
|
|
|
155
164
|
var handleChangeInput = function handleChangeInput(e) {
|
|
156
165
|
setFormState(_objectSpread(_objectSpread({}, formState), {}, _defineProperty({}, e.target.name, e.target.value)));
|
|
157
166
|
};
|
|
167
|
+
var handleUpdateExternalId = function handleUpdateExternalId() {
|
|
168
|
+
handleUpdateSubOption({
|
|
169
|
+
id: subOption.id,
|
|
170
|
+
external_id: externalId
|
|
171
|
+
});
|
|
172
|
+
setExternalIdOpen(false);
|
|
173
|
+
};
|
|
158
174
|
(0, _react.useEffect)(function () {
|
|
159
175
|
if (Object.keys(errors).length > 0) {
|
|
160
176
|
setAlertState({
|
|
@@ -173,6 +189,9 @@ var ProductExtraSuboption = function ProductExtraSuboption(props) {
|
|
|
173
189
|
}, 500);
|
|
174
190
|
setTimer(_timer);
|
|
175
191
|
}, [formState]);
|
|
192
|
+
(0, _react.useEffect)(function () {
|
|
193
|
+
setExternalId(subOption === null || subOption === void 0 ? void 0 : subOption.external_id);
|
|
194
|
+
}, [subOption === null || subOption === void 0 ? void 0 : subOption.external_id]);
|
|
176
195
|
return /*#__PURE__*/_react.default.createElement(_styles2.SubOptionContainer, {
|
|
177
196
|
onSubmit: handleSubmit(onSubmit),
|
|
178
197
|
isDragOver: dragoverSubOptionId === subOption.id,
|
|
@@ -341,6 +360,10 @@ var ProductExtraSuboption = function ProductExtraSuboption(props) {
|
|
|
341
360
|
}));
|
|
342
361
|
}
|
|
343
362
|
}, t('CUSTOM_FIELDS', 'Custom fields')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
|
|
363
|
+
onClick: function onClick() {
|
|
364
|
+
return setExternalIdOpen(true);
|
|
365
|
+
}
|
|
366
|
+
}, t('EXTERNAL_ID', 'External ID')), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Dropdown.Item, {
|
|
344
367
|
onClick: function onClick() {
|
|
345
368
|
return handleDeteteClick(subOption.id);
|
|
346
369
|
}
|
|
@@ -394,6 +417,17 @@ var ProductExtraSuboption = function ProductExtraSuboption(props) {
|
|
|
394
417
|
}, /*#__PURE__*/_react.default.createElement(_Shared.ImageCrop, {
|
|
395
418
|
photo: cropState === null || cropState === void 0 ? void 0 : cropState.data,
|
|
396
419
|
handleChangePhoto: handleChangePhoto
|
|
420
|
+
})), /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
421
|
+
width: "70%",
|
|
422
|
+
title: t('MODIFIER_OPTION', 'Modifier option'),
|
|
423
|
+
open: externalIdOpen,
|
|
424
|
+
onClose: function onClose() {
|
|
425
|
+
return setExternalIdOpen(false);
|
|
426
|
+
}
|
|
427
|
+
}, /*#__PURE__*/_react.default.createElement(_ProductOptionExternalId.ProductOptionExternalId, {
|
|
428
|
+
value: externalId,
|
|
429
|
+
handleChange: setExternalId,
|
|
430
|
+
handleUpdate: handleUpdateExternalId
|
|
397
431
|
})));
|
|
398
432
|
};
|
|
399
433
|
exports.ProductExtraSuboption = ProductExtraSuboption;
|
|
@@ -49,7 +49,8 @@ var ProductExtrasUI = function ProductExtrasUI(props) {
|
|
|
49
49
|
handleDragStart = props.handleDragStart,
|
|
50
50
|
hanldeDragOver = props.hanldeDragOver,
|
|
51
51
|
handleDrop = props.handleDrop,
|
|
52
|
-
handleDragEnd = props.handleDragEnd
|
|
52
|
+
handleDragEnd = props.handleDragEnd,
|
|
53
|
+
handleUpdateExtraState = props.handleUpdateExtraState;
|
|
53
54
|
var theme = (0, _styledComponents.useTheme)();
|
|
54
55
|
var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
|
|
55
56
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -222,7 +223,8 @@ var ProductExtrasUI = function ProductExtrasUI(props) {
|
|
|
222
223
|
business: business,
|
|
223
224
|
extra: currentExtra,
|
|
224
225
|
handleChangeExtraName: handleChangeExtraInput,
|
|
225
|
-
handleUpdateBusinessState: handleUpdateBusinessState
|
|
226
|
+
handleUpdateBusinessState: handleUpdateBusinessState,
|
|
227
|
+
handleUpdateExtraState: handleUpdateExtraState
|
|
226
228
|
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, openExtraDetails && /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
227
229
|
width: "80%",
|
|
228
230
|
open: openExtraDetails,
|
|
@@ -238,7 +240,8 @@ var ProductExtrasUI = function ProductExtrasUI(props) {
|
|
|
238
240
|
business: business,
|
|
239
241
|
extra: currentExtra,
|
|
240
242
|
handleChangeExtraName: handleChangeExtraInput,
|
|
241
|
-
handleUpdateBusinessState: handleUpdateBusinessState
|
|
243
|
+
handleUpdateBusinessState: handleUpdateBusinessState,
|
|
244
|
+
handleUpdateExtraState: handleUpdateExtraState
|
|
242
245
|
}))), /*#__PURE__*/_react.default.createElement(_Shared.Alert, {
|
|
243
246
|
title: t('WEB_APPNAME', 'Ordering'),
|
|
244
247
|
content: alertState.content,
|