ordering-ui-admin-external 1.43.39 → 1.43.41
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.6517dff04a364c06104d.js → ordering-ui-admin.0ff5314f6e78c5c543a2.js} +2 -2
- package/_modules/components/Orders/ProductItemAccordion/index.js +38 -8
- package/_modules/components/Stores/BusinessMenu/index.js +1 -1
- package/_modules/components/Stores/BusinessMenuOptions/index.js +9 -3
- package/package.json +2 -2
- package/src/components/Orders/ProductItemAccordion/index.js +17 -3
- package/src/components/Stores/BusinessMenu/index.js +1 -1
- package/src/components/Stores/BusinessMenuOptions/index.js +7 -1
- /package/_bundles/{ordering-ui-admin.6517dff04a364c06104d.js.LICENSE.txt → ordering-ui-admin.0ff5314f6e78c5c543a2.js.LICENSE.txt} +0 -0
|
@@ -75,10 +75,38 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
|
|
|
75
75
|
var productActionsEdit = (0, _react.useRef)(null);
|
|
76
76
|
var productActionsDelete = (0, _react.useRef)(null);
|
|
77
77
|
var productInfo = function productInfo() {
|
|
78
|
+
var _product$options;
|
|
79
|
+
var options = JSON.parse(JSON.stringify(Object.values((_product$options = product.options) !== null && _product$options !== void 0 ? _product$options : {})));
|
|
80
|
+
var extraGroups = options.reduce(function (acc, option) {
|
|
81
|
+
var _option$extra$rank, _option$extra;
|
|
82
|
+
var extraRank = (_option$extra$rank = option === null || option === void 0 || (_option$extra = option.extra) === null || _option$extra === void 0 ? void 0 : _option$extra.rank) !== null && _option$extra$rank !== void 0 ? _option$extra$rank : option === null || option === void 0 ? void 0 : option.rank;
|
|
83
|
+
acc[extraRank] = acc[extraRank] || [];
|
|
84
|
+
acc[extraRank].push(option);
|
|
85
|
+
return acc;
|
|
86
|
+
}, {});
|
|
87
|
+
var sortedExtraGroups = Object.entries(extraGroups).sort(function (_ref, _ref2) {
|
|
88
|
+
var _ref3 = _slicedToArray(_ref, 1),
|
|
89
|
+
rankA = _ref3[0];
|
|
90
|
+
var _ref4 = _slicedToArray(_ref2, 1),
|
|
91
|
+
rankB = _ref4[0];
|
|
92
|
+
return rankA - rankB;
|
|
93
|
+
});
|
|
94
|
+
sortedExtraGroups.forEach(function (_ref5) {
|
|
95
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
96
|
+
_ = _ref6[0],
|
|
97
|
+
group = _ref6[1];
|
|
98
|
+
group.sort(function (a, b) {
|
|
99
|
+
return a.rank - b.rank;
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
options = sortedExtraGroups.flatMap(function (_ref7) {
|
|
103
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
104
|
+
group = _ref8[1];
|
|
105
|
+
return group;
|
|
106
|
+
});
|
|
78
107
|
if (isCartProduct) {
|
|
79
|
-
var _product$ingredients
|
|
108
|
+
var _product$ingredients;
|
|
80
109
|
var ingredients = JSON.parse(JSON.stringify(Object.values((_product$ingredients = product.ingredients) !== null && _product$ingredients !== void 0 ? _product$ingredients : {})));
|
|
81
|
-
var options = JSON.parse(JSON.stringify(Object.values((_product$options = product.options) !== null && _product$options !== void 0 ? _product$options : {})));
|
|
82
110
|
options = options.map(function (option) {
|
|
83
111
|
var _option$suboptions;
|
|
84
112
|
option.suboptions = Object.values((_option$suboptions = option.suboptions) !== null && _option$suboptions !== void 0 ? _option$suboptions : {});
|
|
@@ -89,7 +117,9 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
|
|
|
89
117
|
options: options
|
|
90
118
|
});
|
|
91
119
|
}
|
|
92
|
-
return product
|
|
120
|
+
return _objectSpread(_objectSpread({}, product), {}, {
|
|
121
|
+
options: options
|
|
122
|
+
});
|
|
93
123
|
};
|
|
94
124
|
var toggleAccordion = function toggleAccordion(e) {
|
|
95
125
|
var _productSelect$curren, _productActionsEdit$c, _productActionsDelete;
|
|
@@ -106,11 +136,11 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
|
|
|
106
136
|
changeQuantity(product, parseInt(value));
|
|
107
137
|
}
|
|
108
138
|
};
|
|
109
|
-
var getFormattedSubOptionName = function getFormattedSubOptionName(
|
|
110
|
-
var quantity =
|
|
111
|
-
name =
|
|
112
|
-
position =
|
|
113
|
-
price =
|
|
139
|
+
var getFormattedSubOptionName = function getFormattedSubOptionName(_ref9) {
|
|
140
|
+
var quantity = _ref9.quantity,
|
|
141
|
+
name = _ref9.name,
|
|
142
|
+
position = _ref9.position,
|
|
143
|
+
price = _ref9.price;
|
|
114
144
|
if (name !== 'No') {
|
|
115
145
|
var pos = position ? "(".concat(position, ")") : '';
|
|
116
146
|
return price > 0 ? "".concat(name, " ").concat(pos, " ").concat(parsePrice(quantity * price, {
|
|
@@ -192,7 +192,7 @@ var BusinessMenuUI = function BusinessMenuUI(props) {
|
|
|
192
192
|
}, /*#__PURE__*/_react.default.createElement(_styles2.CheckboxWrapper, {
|
|
193
193
|
className: "business_checkbox_control"
|
|
194
194
|
}, /*#__PURE__*/_react.default.createElement(_styles.Checkbox, {
|
|
195
|
-
|
|
195
|
+
checked: menu === null || menu === void 0 ? void 0 : menu.enabled,
|
|
196
196
|
onChange: function onChange(e) {
|
|
197
197
|
return handleChangeBusinessMenuActiveState(menu === null || menu === void 0 ? void 0 : menu.id, e.target.checked);
|
|
198
198
|
}
|
|
@@ -44,7 +44,9 @@ var BusinessMenuOptionsUI = function BusinessMenuOptionsUI(props) {
|
|
|
44
44
|
isSelectedSharedMenus = props.isSelectedSharedMenus,
|
|
45
45
|
handleDeleteMenu = props.handleDeleteMenu,
|
|
46
46
|
setIsOpenSharedProduct = props.setIsOpenSharedProduct,
|
|
47
|
-
sitesState = props.sitesState
|
|
47
|
+
sitesState = props.sitesState,
|
|
48
|
+
setMenuList = props.setMenuList,
|
|
49
|
+
menuList = props.menuList;
|
|
48
50
|
var query = new URLSearchParams((0, _reactRouterDom.useLocation)().search);
|
|
49
51
|
var theme = (0, _styledComponents.useTheme)();
|
|
50
52
|
var _useLanguage = (0, _orderingComponentsAdminExternal.useLanguage)(),
|
|
@@ -167,12 +169,16 @@ var BusinessMenuOptionsUI = function BusinessMenuOptionsUI(props) {
|
|
|
167
169
|
}, t('SHARE_WITH', 'Share with'))))), !isSelectedSharedMenus || ((_Object$keys5 = Object.keys(menu)) === null || _Object$keys5 === void 0 ? void 0 : _Object$keys5.length) === 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, selectedMenuOption === 'basic' && /*#__PURE__*/_react.default.createElement(_BusinessMenuBasicOptions.BusinessMenuBasicOptions, props), selectedMenuOption === 'channels' && /*#__PURE__*/_react.default.createElement(_BusinessMenuChannels.BusinessMenuChannels, props), selectedMenuOption === 'share_with' && /*#__PURE__*/_react.default.createElement(_BusinessMenuShare.BusinessMenuShare, {
|
|
168
170
|
menu: menu,
|
|
169
171
|
business: business,
|
|
170
|
-
handleUpdateBusinessState: handleUpdateBusinessState
|
|
172
|
+
handleUpdateBusinessState: handleUpdateBusinessState,
|
|
173
|
+
setMenuList: setMenuList,
|
|
174
|
+
menuList: menuList
|
|
171
175
|
})) : /*#__PURE__*/_react.default.createElement(_BusinessSharedMenuProducts.BusinessSharedMenuProducts, {
|
|
172
176
|
menu: menu,
|
|
173
177
|
business: business,
|
|
174
178
|
handleUpdateBusinessState: handleUpdateBusinessState,
|
|
175
|
-
setIsOpenSharedProduct: setIsOpenSharedProduct
|
|
179
|
+
setIsOpenSharedProduct: setIsOpenSharedProduct,
|
|
180
|
+
setMenuList: setMenuList,
|
|
181
|
+
menuList: menuList
|
|
176
182
|
}), /*#__PURE__*/_react.default.createElement(_Shared.Modal, {
|
|
177
183
|
width: "70%",
|
|
178
184
|
open: isCustomFieldsOpen,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-admin-external",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.41",
|
|
4
4
|
"description": "Ordering UI Admin Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lodash": "^4.17.20",
|
|
84
84
|
"moment": "^2.29.1",
|
|
85
85
|
"moment-range": "^4.0.2",
|
|
86
|
-
"ordering-components-admin-external": "1.43.
|
|
86
|
+
"ordering-components-admin-external": "1.43.27",
|
|
87
87
|
"polished": "^3.6.7",
|
|
88
88
|
"prop-types": "^15.7.2",
|
|
89
89
|
"react-big-calendar": "^1.4.2",
|
|
@@ -56,10 +56,24 @@ export const ProductItemAccordion = (props) => {
|
|
|
56
56
|
const productActionsDelete = useRef(null)
|
|
57
57
|
|
|
58
58
|
const productInfo = () => {
|
|
59
|
+
let options = JSON.parse(JSON.stringify(Object.values(product.options ?? {})))
|
|
60
|
+
const extraGroups = options.reduce((acc, option) => {
|
|
61
|
+
const extraRank = option?.extra?.rank ?? option?.rank
|
|
62
|
+
acc[extraRank] = acc[extraRank] || []
|
|
63
|
+
acc[extraRank].push(option)
|
|
64
|
+
return acc
|
|
65
|
+
}, {})
|
|
66
|
+
|
|
67
|
+
const sortedExtraGroups = Object.entries(extraGroups).sort(([rankA], [rankB]) => rankA - rankB)
|
|
68
|
+
|
|
69
|
+
sortedExtraGroups.forEach(([_, group]) => {
|
|
70
|
+
group.sort((a, b) => a.rank - b.rank)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
options = sortedExtraGroups.flatMap(([, group]) => group)
|
|
74
|
+
|
|
59
75
|
if (isCartProduct) {
|
|
60
76
|
const ingredients = JSON.parse(JSON.stringify(Object.values(product.ingredients ?? {})))
|
|
61
|
-
let options = JSON.parse(JSON.stringify(Object.values(product.options ?? {})))
|
|
62
|
-
|
|
63
77
|
options = options.map(option => {
|
|
64
78
|
option.suboptions = Object.values(option.suboptions ?? {})
|
|
65
79
|
return option
|
|
@@ -70,7 +84,7 @@ export const ProductItemAccordion = (props) => {
|
|
|
70
84
|
options
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
|
-
return product
|
|
87
|
+
return { ...product, options }
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
const toggleAccordion = (e) => {
|
|
@@ -180,7 +180,7 @@ const BusinessMenuUI = (props) => {
|
|
|
180
180
|
className='business_checkbox_control'
|
|
181
181
|
>
|
|
182
182
|
<Checkbox
|
|
183
|
-
|
|
183
|
+
checked={menu?.enabled}
|
|
184
184
|
onChange={e => handleChangeBusinessMenuActiveState(menu?.id, e.target.checked)}
|
|
185
185
|
/>
|
|
186
186
|
</CheckboxWrapper>
|
|
@@ -37,7 +37,9 @@ const BusinessMenuOptionsUI = (props) => {
|
|
|
37
37
|
isSelectedSharedMenus,
|
|
38
38
|
handleDeleteMenu,
|
|
39
39
|
setIsOpenSharedProduct,
|
|
40
|
-
sitesState
|
|
40
|
+
sitesState,
|
|
41
|
+
setMenuList,
|
|
42
|
+
menuList
|
|
41
43
|
} = props
|
|
42
44
|
|
|
43
45
|
const query = new URLSearchParams(useLocation().search)
|
|
@@ -194,6 +196,8 @@ const BusinessMenuOptionsUI = (props) => {
|
|
|
194
196
|
menu={menu}
|
|
195
197
|
business={business}
|
|
196
198
|
handleUpdateBusinessState={handleUpdateBusinessState}
|
|
199
|
+
setMenuList={setMenuList}
|
|
200
|
+
menuList={menuList}
|
|
197
201
|
/>
|
|
198
202
|
)}
|
|
199
203
|
</>
|
|
@@ -203,6 +207,8 @@ const BusinessMenuOptionsUI = (props) => {
|
|
|
203
207
|
business={business}
|
|
204
208
|
handleUpdateBusinessState={handleUpdateBusinessState}
|
|
205
209
|
setIsOpenSharedProduct={setIsOpenSharedProduct}
|
|
210
|
+
setMenuList={setMenuList}
|
|
211
|
+
menuList={menuList}
|
|
206
212
|
/>
|
|
207
213
|
)}
|
|
208
214
|
<Modal
|