ordering-ui-admin-external 1.2.0 → 1.3.1

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 (153) hide show
  1. package/_bundles/main.css +2 -2
  2. package/_bundles/{ordering-ui-admin.509785f9d6ed069b4b5d.js → ordering-ui-admin.0bfe9a0aef33a990bc0a.js} +2 -2
  3. package/_bundles/{ordering-ui-admin.509785f9d6ed069b4b5d.js.LICENSE.txt → ordering-ui-admin.0bfe9a0aef33a990bc0a.js.LICENSE.txt} +10 -4
  4. package/_modules/components/BusinessIntelligence/Reports/index.js +27 -3
  5. package/_modules/components/BusinessIntelligence/Reports/styles.js +9 -2
  6. package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +9 -1
  7. package/_modules/components/DisabledFeatureAlert/index.js +63 -0
  8. package/_modules/components/DisabledFeatureAlert/styles.js +42 -0
  9. package/_modules/components/Loyalty/RewardsPrograms/index.js +38 -12
  10. package/_modules/components/Loyalty/RewardsPrograms/styles.js +13 -6
  11. package/_modules/components/Marketing/CampaignHeader/index.js +5 -2
  12. package/_modules/components/Marketing/CampaignHeader/styles.js +7 -4
  13. package/_modules/components/Marketing/CampaignList/index.js +8 -4
  14. package/_modules/components/Marketing/CampaignList/styles.js +30 -22
  15. package/_modules/components/Marketing/CampaignListing/index.js +29 -3
  16. package/_modules/components/Marketing/EnterprisePromotionListing/index.js +46 -22
  17. package/_modules/components/Marketing/EnterprisePromotionListing/styles.js +1 -1
  18. package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +24 -428
  19. package/_modules/components/OrderingProducts/OrderingProductDetails/styles.js +35 -114
  20. package/_modules/components/OrderingProducts/OrderingProductGeneralDetails/index.js +480 -0
  21. package/_modules/components/OrderingProducts/OrderingProductGeneralDetails/styles.js +127 -0
  22. package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +3 -1
  23. package/_modules/components/OrderingProducts/OrderingProductsListing/styles.js +23 -3
  24. package/_modules/components/OrderingProducts/SiteTheme/ThemeComponent.js +119 -0
  25. package/_modules/components/OrderingProducts/SiteTheme/ThemeImage.js +267 -0
  26. package/_modules/components/OrderingProducts/SiteTheme/ThemeOption.js +135 -0
  27. package/_modules/components/OrderingProducts/SiteTheme/index.js +266 -0
  28. package/_modules/components/OrderingProducts/SiteTheme/styles.js +114 -0
  29. package/_modules/components/Orders/CountryFilter/index.js +114 -0
  30. package/_modules/components/Orders/CountryFilter/styles.js +34 -0
  31. package/_modules/components/Orders/CurrencyFilter/index.js +114 -0
  32. package/_modules/components/Orders/CurrencyFilter/styles.js +34 -0
  33. package/_modules/components/Orders/DeliveriesLocation/index.js +22 -12
  34. package/_modules/components/Orders/DriversLocation/index.js +13 -7
  35. package/_modules/components/Orders/OrdersFilterGroup/index.js +13 -1
  36. package/_modules/components/Orders/OrdersListing/index.js +8 -2
  37. package/_modules/components/Orders/OrdersTable/index.js +296 -174
  38. package/_modules/components/Orders/OrdersTable/styles.js +30 -4
  39. package/_modules/components/Orders/index.js +9 -1
  40. package/_modules/components/Settings/SettingItemUI/index.js +3 -1
  41. package/_modules/components/Settings/SettingItemUI/styles.js +18 -11
  42. package/_modules/components/Settings/Settings/index.js +1 -11
  43. package/_modules/components/Settings/SettingsDetail/index.js +40 -3
  44. package/_modules/components/Settings/SettingsDetail/styles.js +27 -8
  45. package/_modules/components/Settings/SettingsList/index.js +43 -6
  46. package/_modules/components/Shared/ColorPicker/styles.js +3 -1
  47. package/_modules/components/Shared/ColumnAllowSettingPopover/index.js +4 -2
  48. package/_modules/components/Shared/SearchBar/index.js +4 -2
  49. package/_modules/components/SidebarMenu/index.js +25 -14
  50. package/_modules/components/SidebarMenu/styles.js +19 -9
  51. package/_modules/components/Stores/BusinessMenu/index.js +36 -5
  52. package/_modules/components/Stores/BusinessMenu/styles.js +27 -16
  53. package/_modules/components/Stores/BusinessMenuOptions/styles.js +9 -4
  54. package/_modules/components/Stores/BusinessPaymentMethods/index.js +53 -16
  55. package/_modules/components/Stores/BusinessProductList/index.js +7 -10
  56. package/_modules/components/Stores/BusinessProductsCategories/index.js +2 -2
  57. package/_modules/components/Stores/BusinessProductsListing/index.js +44 -21
  58. package/_modules/components/Stores/BusinessProductsListing/styles.js +20 -16
  59. package/_modules/components/Stores/BusinessesListing/index.js +4 -1
  60. package/_modules/components/Stores/BusinessesListingHeader/index.js +20 -3
  61. package/_modules/components/Stores/BusinessesListingHeader/styles.js +6 -2
  62. package/_modules/components/Stores/ImportersList/index.js +5 -2
  63. package/_modules/components/Stores/ImportersList/styles.js +18 -15
  64. package/_modules/components/Stores/ImportersListing/index.js +31 -4
  65. package/_modules/components/Stores/PaymentOption/index.js +12 -7
  66. package/_modules/components/Stores/PaymentOption/styles.js +9 -4
  67. package/_modules/components/Stores/PaymentOptionMethods/index.js +9 -4
  68. package/_modules/components/Stores/PaymentOptionMethods/styles.js +10 -5
  69. package/_modules/components/Stores/PaymentOptionPaypal/index.js +9 -4
  70. package/_modules/components/Stores/PaymentOptionSquare/index.js +10 -5
  71. package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +10 -5
  72. package/_modules/components/Stores/PaymentOptionStripeDirect/styles.js +10 -5
  73. package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +9 -4
  74. package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +9 -4
  75. package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +9 -4
  76. package/_modules/components/Users/UsersList/index.js +8 -2
  77. package/_modules/components/Users/UsersList/styles.js +15 -12
  78. package/package.json +2 -2
  79. package/src/components/BusinessIntelligence/Reports/index.js +18 -4
  80. package/src/components/BusinessIntelligence/Reports/styles.js +11 -0
  81. package/src/components/BusinessIntelligence/ReviewsListing/index.js +12 -0
  82. package/src/components/DisabledFeatureAlert/index.js +37 -0
  83. package/src/components/DisabledFeatureAlert/styles.js +32 -0
  84. package/src/components/Loyalty/RewardsPrograms/index.js +18 -5
  85. package/src/components/Loyalty/RewardsPrograms/styles.js +10 -0
  86. package/src/components/Marketing/CampaignHeader/index.js +3 -2
  87. package/src/components/Marketing/CampaignHeader/styles.js +8 -0
  88. package/src/components/Marketing/CampaignList/index.js +5 -3
  89. package/src/components/Marketing/CampaignList/styles.js +16 -0
  90. package/src/components/Marketing/CampaignListing/index.js +18 -2
  91. package/src/components/Marketing/EnterprisePromotionListing/index.js +17 -4
  92. package/src/components/Marketing/EnterprisePromotionListing/styles.js +5 -1
  93. package/src/components/OrderingProducts/OrderingProductDetails/index.js +34 -497
  94. package/src/components/OrderingProducts/OrderingProductDetails/styles.js +38 -288
  95. package/src/components/OrderingProducts/OrderingProductGeneralDetails/index.js +514 -0
  96. package/src/components/OrderingProducts/OrderingProductGeneralDetails/styles.js +279 -0
  97. package/src/components/OrderingProducts/OrderingProductsListing/index.js +14 -2
  98. package/src/components/OrderingProducts/OrderingProductsListing/styles.js +62 -0
  99. package/src/components/OrderingProducts/SiteTheme/ThemeComponent.js +104 -0
  100. package/src/components/OrderingProducts/SiteTheme/ThemeImage.js +151 -0
  101. package/src/components/OrderingProducts/SiteTheme/ThemeOption.js +118 -0
  102. package/src/components/OrderingProducts/SiteTheme/index.js +221 -0
  103. package/src/components/OrderingProducts/SiteTheme/styles.js +160 -0
  104. package/src/components/Orders/CountryFilter/index.js +68 -0
  105. package/src/components/Orders/CountryFilter/styles.js +29 -0
  106. package/src/components/Orders/CurrencyFilter/index.js +68 -0
  107. package/src/components/Orders/CurrencyFilter/styles.js +29 -0
  108. package/src/components/Orders/DeliveriesLocation/index.js +60 -8
  109. package/src/components/Orders/DriversLocation/index.js +32 -4
  110. package/src/components/Orders/OrdersFilterGroup/index.js +15 -1
  111. package/src/components/Orders/OrdersListing/index.js +8 -1
  112. package/src/components/Orders/OrdersTable/index.js +297 -252
  113. package/src/components/Orders/OrdersTable/styles.js +33 -0
  114. package/src/components/Orders/index.js +3 -1
  115. package/src/components/Settings/SettingItemUI/index.js +2 -1
  116. package/src/components/Settings/SettingItemUI/styles.js +5 -0
  117. package/src/components/Settings/Settings/index.js +0 -11
  118. package/src/components/Settings/SettingsDetail/index.js +23 -4
  119. package/src/components/Settings/SettingsDetail/styles.js +9 -2
  120. package/src/components/Settings/SettingsList/index.js +30 -3
  121. package/src/components/Shared/ColorPicker/styles.js +1 -0
  122. package/src/components/Shared/ColumnAllowSettingPopover/index.js +2 -2
  123. package/src/components/Shared/SearchBar/index.js +3 -2
  124. package/src/components/SidebarMenu/index.js +22 -7
  125. package/src/components/SidebarMenu/styles.js +13 -0
  126. package/src/components/Stores/BusinessMenu/index.js +21 -3
  127. package/src/components/Stores/BusinessMenu/styles.js +19 -0
  128. package/src/components/Stores/BusinessMenuOptions/styles.js +6 -0
  129. package/src/components/Stores/BusinessPaymentMethods/index.js +62 -32
  130. package/src/components/Stores/BusinessProductList/index.js +2 -1
  131. package/src/components/Stores/BusinessProductsCategories/index.js +2 -2
  132. package/src/components/Stores/BusinessProductsListing/index.js +18 -4
  133. package/src/components/Stores/BusinessProductsListing/styles.js +40 -10
  134. package/src/components/Stores/BusinessesListing/index.js +3 -0
  135. package/src/components/Stores/BusinessesListingHeader/index.js +15 -3
  136. package/src/components/Stores/BusinessesListingHeader/styles.js +38 -0
  137. package/src/components/Stores/ImportersList/index.js +3 -2
  138. package/src/components/Stores/ImportersList/styles.js +8 -1
  139. package/src/components/Stores/ImportersListing/index.js +25 -1
  140. package/src/components/Stores/PaymentOption/index.js +9 -5
  141. package/src/components/Stores/PaymentOption/styles.js +8 -0
  142. package/src/components/Stores/PaymentOptionMethods/index.js +8 -3
  143. package/src/components/Stores/PaymentOptionMethods/styles.js +8 -0
  144. package/src/components/Stores/PaymentOptionPaypal/index.js +8 -3
  145. package/src/components/Stores/PaymentOptionSquare/index.js +183 -176
  146. package/src/components/Stores/PaymentOptionStripeDirect/index.js +8 -3
  147. package/src/components/Stores/PaymentOptionStripeDirect/styles.js +8 -0
  148. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +8 -3
  149. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +8 -3
  150. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +8 -3
  151. package/src/components/Users/UsersList/index.js +10 -1
  152. package/src/components/Users/UsersList/styles.js +9 -0
  153. package/template/app.js +8 -8
@@ -216,6 +216,7 @@ export const WrapperImage = styled.div`
216
216
  width: 45px;
217
217
  box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1);
218
218
  border-radius: 7.6px;
219
+ position: relative;
219
220
 
220
221
  img {
221
222
  width: 100%;
@@ -368,3 +369,35 @@ export const Timer = styled.div`
368
369
  color: #E63757;
369
370
  }
370
371
  `
372
+
373
+ export const OrdersCountWrapper = styled.div`
374
+ height: 16px;
375
+ display: flex;
376
+ align-items: center;
377
+ justify-content: center;
378
+ border-radius: 50px;
379
+ background-color: ${props => props.theme.colors.backgroundInfo};
380
+ color: ${props => props.theme.colors.primary};
381
+ font-weight: 400;
382
+ font-size: 9px;
383
+ line-height: 12px;
384
+ padding: 2px 5px;
385
+ position: absolute;
386
+ top: -9px;
387
+ right: -5px;
388
+ ${props => props.theme.rtl && css`
389
+ left: -5px;
390
+ right: initial;
391
+ `}
392
+
393
+ ${({ isNew }) => isNew && css`
394
+ background-color: ${props => props.theme.colors.lightGreen};
395
+ color: ${props => props.theme.colors.success};
396
+ `}
397
+ `
398
+ export const DragTh = styled.th`
399
+ cursor: pointer;
400
+ ${({ selectedDragOver }) => selectedDragOver && css`
401
+ border: 1px solid ${props => props.theme.colors.primary};
402
+ `}
403
+ `
@@ -44,6 +44,7 @@ import { OrdersListing } from './OrdersListing'
44
44
  import { OrdersTable } from './OrdersTable'
45
45
  import { OrdersCards } from './OrdersCards'
46
46
  import { ReviewCustomer } from './ReviewCustomer'
47
+ import { CountryFilter } from './CountryFilter'
47
48
 
48
49
  export {
49
50
  Appointments,
@@ -90,5 +91,6 @@ export {
90
91
  OrdersListing,
91
92
  OrdersTable,
92
93
  OrdersCards,
93
- ReviewCustomer
94
+ ReviewCustomer,
95
+ CountryFilter
94
96
  }
@@ -13,13 +13,14 @@ export const SettingItemUI = (props) => {
13
13
  const {
14
14
  isSkeleton,
15
15
  active,
16
+ disabledFeature,
16
17
  icon,
17
18
  title,
18
19
  description
19
20
  } = props
20
21
 
21
22
  return (
22
- <SettingItemContainer active={!isSkeleton && active}>
23
+ <SettingItemContainer active={!isSkeleton && active} disabledFeature={disabledFeature}>
23
24
  <IconWrapper>
24
25
  {
25
26
  isSkeleton
@@ -15,6 +15,11 @@ export const SettingItemContainer = styled.div`
15
15
  border: 1px solid #2C7BE5 !important;
16
16
  `}
17
17
 
18
+ ${({ disabledFeature }) => disabledFeature && css`
19
+ background-color: ${props => props.theme?.colors.disabled} !important;
20
+ cursor: not-allowed;
21
+ `}
22
+
18
23
  &:hover {
19
24
  background: #E9F2FE;
20
25
  }
@@ -102,17 +102,6 @@ const SettingsUI = (props) => {
102
102
  }
103
103
  }, [categoryList?.categories])
104
104
 
105
- // useEffect(() => {
106
- // if (Object.keys(configs).length > 0) {
107
- // const _configs = [
108
- // configs?.stripe_connect_sandbox,
109
- // { ...configs?.stripe_connect_client_id, name: t('CLIENT_ID_SANDBOX') },
110
- // { ...configs?.stripe_connect_client_id_sandbox, name: t('CLIENT_ID_PRODUCTION') }
111
- // ]
112
- // setStripeConnectConfigs([..._configs])
113
- // }
114
- // }, [configs])
115
-
116
105
  return (
117
106
  <>
118
107
  <BasicSettingsContainer>
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
2
2
  import { XLg, LifePreserver } from 'react-bootstrap-icons'
3
3
  import Skeleton from 'react-loading-skeleton'
4
4
  import { useWindowSize } from '../../../hooks/useWindowSize'
5
- import { useLanguage } from 'ordering-components-admin-external'
5
+ import { useLanguage, useConfig, useSession } from 'ordering-components-admin-external'
6
6
  import { IconButton } from '../../../styles'
7
7
  import { Modal, NotFoundSource } from '../../Shared'
8
8
  import MdcPlayCircle from '@meronex/icons/mdc/MdcPlayCircle'
@@ -10,7 +10,7 @@ import BsArrowRight from '@meronex/icons/bs/BsArrowRight'
10
10
  import { EmailSetting } from '../EmailSetting'
11
11
  import { NotificationSetting } from '../NotificationSetting'
12
12
  import { SettingsList } from '../SettingsList'
13
-
13
+ import { DisabledFeatureAlert } from '../../DisabledFeatureAlert'
14
14
  import {
15
15
  Container,
16
16
  DescriptionContent,
@@ -43,7 +43,9 @@ export const SettingsDetail = (props) => {
43
43
  const [isMenuOpen, setIsMenuOpen] = useState(false)
44
44
  const [extraInfoOpen, setExtraInfoOpen] = useState(false)
45
45
  const [extraSubCatOpen, setExtraSubCatOpen] = useState(false)
46
-
46
+ const [isDisabledFeature, setIsDisabledFeature] = useState(false)
47
+ const [{ configs }] = useConfig()
48
+ const [{ user }] = useSession()
47
49
  const actionSidebar = (value) => {
48
50
  setIsMenuOpen(value)
49
51
 
@@ -130,6 +132,22 @@ export const SettingsDetail = (props) => {
130
132
  return () => document.removeEventListener('keydown', onCloseSidebar)
131
133
  }, [open])
132
134
 
135
+ useEffect(() => {
136
+ if (configs && Object.keys(configs).length > 0 && user && category) {
137
+ const featureList = { wallet: 'cash_wallet' }
138
+
139
+ if (Object.keys(featureList).every(feature => feature !== category?.key)) {
140
+ setIsDisabledFeature(false)
141
+ return
142
+ }
143
+ if (!Object.keys(configs).includes(featureList[category?.key]) && user?.level === 0) {
144
+ setIsDisabledFeature(true)
145
+ return
146
+ }
147
+ setIsDisabledFeature(false)
148
+ }
149
+ }, [configs, category])
150
+
133
151
  return (
134
152
  <Container
135
153
  id='catDescription'
@@ -179,13 +197,14 @@ export const SettingsDetail = (props) => {
179
197
  </video>
180
198
  </VideoContainer>
181
199
  )}
182
- <AllSetting onClick={() => handleExtraOpen(false)}>
200
+ <AllSetting onClick={() => !isDisabledFeature && handleExtraOpen(false)} isDisabledFeature={isDisabledFeature}>
183
201
  <span>{t('SETTINGS', 'All settings')}</span>
184
202
  <BsArrowRight />
185
203
  </AllSetting>
186
204
  </Content>
187
205
  )}
188
206
  </DescriptionContent>
207
+ {isDisabledFeature && (<DisabledFeatureAlert />)}
189
208
  {extraInfoOpen && category.support_url && (
190
209
  <>
191
210
  {width >= 1000 ? (
@@ -141,13 +141,20 @@ export const AllSetting = styled.div`
141
141
  user-select: none;
142
142
  cursor: pointer;
143
143
  margin-top: 36px;
144
+ ${({ isDisabledFeature }) => css`
145
+ cursor: ${props => isDisabledFeature ? 'not-allowed' : 'pointer'};
146
+ `}
144
147
  span {
145
148
  font-weight: 600;
146
149
  font-size: 14px;
147
- color: #03459E;
150
+ ${({ isDisabledFeature }) => css`
151
+ color: ${props => isDisabledFeature ? props.theme.colors?.disabled : '#03459E'};
152
+ `}
148
153
  }
149
154
  svg {
150
- color: #03459E;
155
+ ${({ isDisabledFeature }) => css`
156
+ color: ${props => isDisabledFeature ? props.theme.colors?.disabled : '#03459E'};
157
+ `}
151
158
  }
152
159
  `
153
160
 
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, SettingsList as SettingsListController } from 'ordering-components-admin-external'
2
+ import { useLanguage, useConfig, useSession, SettingsList as SettingsListController } from 'ordering-components-admin-external'
3
3
  import Skeleton from 'react-loading-skeleton'
4
4
  import { Alert, NotFoundSource } from '../../Shared'
5
5
  import { Button } from '../../../styles'
6
6
  import { SettingsSelectUI } from '../SettingsSelectUI'
7
7
  import { SettingsCountryFilter } from '../SettingsCountryFilter'
8
8
  import { SettingsImage } from '../SettingsImage'
9
+ import { DisabledFeatureAlert } from '../../DisabledFeatureAlert'
9
10
  import {
10
11
  SettingsListContainer,
11
12
  GeneralContainer,
@@ -25,6 +26,7 @@ export const SettingsListUI = (props) => {
25
26
  const {
26
27
  settingsState,
27
28
  configs,
29
+ category,
28
30
  formState,
29
31
  onCloseSettingsList,
30
32
  handleCheckBoxChange,
@@ -34,8 +36,11 @@ export const SettingsListUI = (props) => {
34
36
  } = props
35
37
 
36
38
  const [, t] = useLanguage()
39
+ const [configState] = useConfig()
40
+ const [isDisabledFeature, setIsDisabledFeature] = useState(false)
37
41
  const [alertState, setAlertState] = useState({ open: false, content: [] })
38
-
42
+ const [{ user }] = useSession()
43
+ const featureName = 'advanced_logistics'
39
44
  const closeAlert = () => {
40
45
  setAlertState({
41
46
  open: false,
@@ -98,6 +103,21 @@ export const SettingsListUI = (props) => {
98
103
  }
99
104
  }, [settingsState?.result])
100
105
 
106
+ useEffect(() => {
107
+ if (category?.key === 'autoassign' && !configState?.loading &&
108
+ Object.keys(configState?.configs).length > 0 && !formState?.loading &&
109
+ formState?.finalResult.length > 0 && user) {
110
+ const autoassignType = formState?.changes?.find(change => change?.key === 'autoassign_type')?.value ||
111
+ formState?.finalResult?.find(re => re?.key === 'autoassign_type')?.value
112
+ if (!Object.keys(configState?.configs).includes(featureName) &&
113
+ user?.level === 0 && autoassignType === 'enterprise') {
114
+ setIsDisabledFeature(true)
115
+ return
116
+ }
117
+ setIsDisabledFeature(false)
118
+ }
119
+ }, [configState, formState])
120
+
101
121
  return (
102
122
  <>
103
123
  <SettingsListContainer>
@@ -260,10 +280,17 @@ export const SettingsListUI = (props) => {
260
280
  )
261
281
  }
262
282
  </SettingsListContainer>
283
+ {isDisabledFeature && (<DisabledFeatureAlert />)}
263
284
  {
264
285
  settingsState?.changes?.length > 0 && (
265
286
  <SubmitBtnWrapper>
266
- <Button color='primary' onClick={handleSubmit}>{t('SAVE', 'Save')}</Button>
287
+ <Button
288
+ color='primary'
289
+ onClick={handleSubmit}
290
+ disabled={isDisabledFeature}
291
+ >
292
+ {t('SAVE', 'Save')}
293
+ </Button>
267
294
  </SubmitBtnWrapper>
268
295
  )
269
296
  }
@@ -21,6 +21,7 @@ export const ColorBox = styled.div`
21
21
  min-width: 44px;
22
22
  margin-right: 10px;
23
23
  background-color: ${props => props.theme.colors.backgroundInfo};
24
+ border: 1px solid ${props => props.theme.colors.borderColor};
24
25
 
25
26
  ${props => props.theme.rtl && css`
26
27
  margin-left: 10px;
@@ -92,10 +92,10 @@ export const ColumnAllowSettingPopover = (props) => {
92
92
  {optionsDefault.map(option => (
93
93
  <AllowItem
94
94
  key={option.value}
95
- isChecked={allowColumns[option.value]}
95
+ isChecked={allowColumns?.[option.value]?.visable}
96
96
  onClick={() => handleChangeAllowColumns(option.value)}
97
97
  >
98
- {allowColumns[option.value] ? (
98
+ {allowColumns?.[option.value]?.visable ? (
99
99
  <RiCheckboxFill />
100
100
  ) : (
101
101
  <RiCheckboxBlankLine />
@@ -8,7 +8,8 @@ export const SearchBar = (props) => {
8
8
  search,
9
9
  placeholder,
10
10
  isCustomLayout,
11
- lazyLoad
11
+ lazyLoad,
12
+ customClass
12
13
  } = props
13
14
  let timeout = null
14
15
  let previousSearch
@@ -45,7 +46,7 @@ export const SearchBar = (props) => {
45
46
  }, [search])
46
47
 
47
48
  return (
48
- <SearchContainer isCustomLayout={isCustomLayout}>
49
+ <SearchContainer isCustomLayout={isCustomLayout} className={customClass || ''}>
49
50
  <IosSearch />
50
51
  <input type='text' ref={el} name='search' placeholder={placeholder} autoComplete='off' />
51
52
  </SearchContainer>
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useContext } from 'react'
1
+ import React, { useEffect, useContext, useState } from 'react'
2
2
  import { useLocation } from 'react-router-dom'
3
3
  import { LogoutButton } from '../LogoutButton'
4
4
  import {
@@ -251,6 +251,21 @@ export const SidebarMenu = (props) => {
251
251
  }
252
252
  ]
253
253
 
254
+ const driverManagerSubMenus = [
255
+ {
256
+ id: 1,
257
+ title: t('DRIVERS', 'Drivers'),
258
+ pageName: 'delivery_drivers',
259
+ url: '/delivery/drivers-list'
260
+ },
261
+ {
262
+ id: 2,
263
+ title: t('DRIVERS_GROUPS', 'Drivers groups'),
264
+ pageName: 'drivers_groups',
265
+ url: '/delivery/drivers-groups'
266
+ }
267
+ ]
268
+
254
269
  const marketingSubmenus = [
255
270
  {
256
271
  id: 1,
@@ -483,7 +498,7 @@ export const SidebarMenu = (props) => {
483
498
  </MenuContainer>
484
499
  )}
485
500
 
486
- {sessionState?.user?.level === 0 && (
501
+ {(sessionState?.user?.level === 0 || sessionState?.user?.level === 5) && (
487
502
  <MenuContainer>
488
503
  <ContextAwareToggle
489
504
  eventKey='7'
@@ -499,7 +514,7 @@ export const SidebarMenu = (props) => {
499
514
  </ContextAwareToggle>
500
515
  <Accordion.Collapse eventKey='7'>
501
516
  <MenuContent>
502
- {deliverySubmenus.map(item => (
517
+ {(sessionState?.user?.level === 5 ? driverManagerSubMenus : deliverySubmenus).map(item => (
503
518
  <SubMenu
504
519
  key={item.id}
505
520
  active={location.pathname.includes(item.pageName) || location.pathname.includes(item?.url)}
@@ -513,7 +528,7 @@ export const SidebarMenu = (props) => {
513
528
  </MenuContainer>
514
529
  )}
515
530
 
516
- {sessionState?.user?.level !== 5 && (
531
+ {sessionState?.user?.level !== 5 && sessionState?.user?.level !== 2 && (
517
532
  <MenuContainer>
518
533
  <ContextAwareToggle
519
534
  eventKey='8'
@@ -541,7 +556,7 @@ export const SidebarMenu = (props) => {
541
556
  </MenuContainer>
542
557
  )}
543
558
 
544
- {sessionState?.user?.level !== 5 && (
559
+ {sessionState?.user?.level !== 5 && sessionState?.user?.level !== 2 && (
545
560
  <MenuContainer>
546
561
  <ContextAwareToggle
547
562
  eventKey='9'
@@ -570,7 +585,7 @@ export const SidebarMenu = (props) => {
570
585
  </MenuContainer>
571
586
  )}
572
587
 
573
- {sessionState?.user?.level !== 5 && (
588
+ {sessionState?.user?.level !== 5 && sessionState?.user?.level !== 2 && (
574
589
  <MenuContainer>
575
590
  <ContextAwareToggle
576
591
  eventKey='10'
@@ -637,7 +652,7 @@ export const SidebarMenu = (props) => {
637
652
  </MenuContainer>
638
653
  </Accordion>
639
654
  )}
640
- {sessionState?.user?.level !== 5 && (
655
+ {sessionState?.user?.level !== 5 && sessionState?.user?.level !== 2 && (
641
656
  <Button
642
657
  className='d-flex align-items-center'
643
658
  variant={location.pathname === '/ordering-products' && 'primary'}
@@ -160,6 +160,14 @@ export const MenuContainer = styled.div`
160
160
  width: 100%;
161
161
  text-align: initial;
162
162
  }
163
+
164
+ ${({ disabledFeature }) => disabledFeature && css`
165
+ background-color: ${props => props.theme.colors.disabled};
166
+ cursor: not-allowed;
167
+ > button {
168
+ pointer-events: none;
169
+ }
170
+ `}
163
171
  `
164
172
 
165
173
  export const MenuContent = styled.div`
@@ -183,6 +191,11 @@ export const SubMenu = styled.div`
183
191
  ${({ active }) => active && css`
184
192
  color: ${props => props.theme.colors.primary};
185
193
  `}
194
+ ${({ disabledFeature }) => disabledFeature && css`
195
+ background-color: ${props => props.theme.colors.disabled}!important;
196
+ cursor: not-allowed;
197
+ `}
198
+
186
199
  ${props => props.theme?.rtl ? css`
187
200
  padding-right: 40px;
188
201
  ` : css`
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessMenu as BusinessMenuController } from 'ordering-components-admin-external'
2
+ import { useLanguage, useConfig, useSession, BusinessMenu as BusinessMenuController } from 'ordering-components-admin-external'
3
3
  import { BusinessMenuOptions } from '../BusinessMenuOptions'
4
4
  import { Confirm, Modal, SearchBar } from '../../Shared'
5
5
  import { useWindowSize } from '../../../hooks/useWindowSize'
6
6
  import { Button, Checkbox } from '../../../styles'
7
7
  import { ChevronRight } from 'react-bootstrap-icons'
8
+ import { DisabledFeatureAlert } from '../../DisabledFeatureAlert'
8
9
 
9
10
  import {
10
11
  MainContainer,
@@ -32,6 +33,8 @@ const BusinessMenuUI = (props) => {
32
33
  sitesState
33
34
  } = props
34
35
  const [, t] = useLanguage()
36
+ const [{ configs }] = useConfig()
37
+ const [{ user }] = useSession()
35
38
  const { width } = useWindowSize()
36
39
 
37
40
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
@@ -40,6 +43,8 @@ const BusinessMenuUI = (props) => {
40
43
  const [isOpenSharedProduct, setIsOpenSharedProduct] = useState(false)
41
44
  const [searchValue, setSearchValue] = useState('')
42
45
  const [menuList, setMenuList] = useState([])
46
+ const [isDisabledFeature, setIsDisabledFeature] = useState(false)
47
+ const featureName = 'shared_menus'
43
48
 
44
49
  const handleOpenOptions = (name, menu) => {
45
50
  setCurrentMenu(menu)
@@ -66,6 +71,16 @@ const BusinessMenuUI = (props) => {
66
71
  setMenuList(filteredMenus)
67
72
  }, [JSON.stringify(businessMenusState.menus), JSON.stringify(businessMenusState.menusShared), searchValue, isSelectedSharedMenus])
68
73
 
74
+ useEffect(() => {
75
+ if (configs && Object.keys(configs).length > 0 && user) {
76
+ if (!Object.keys(configs).includes(featureName) && user?.level === 0 && isSelectedSharedMenus) {
77
+ setIsDisabledFeature(true)
78
+ return
79
+ }
80
+ setIsDisabledFeature(false)
81
+ }
82
+ }, [configs, isSelectedSharedMenus])
83
+
69
84
  return (
70
85
  <MainContainer>
71
86
  <MenuContainer isHide={isOpenSharedProduct}>
@@ -75,6 +90,7 @@ const BusinessMenuUI = (props) => {
75
90
  borderRadius='8px'
76
91
  color='lightPrimary'
77
92
  onClick={() => handleOpenOptions('option', {})}
93
+ disabled={isDisabledFeature}
78
94
  >
79
95
  {t('ADD_MENU', 'Add menu')}
80
96
  </Button>
@@ -100,7 +116,7 @@ const BusinessMenuUI = (props) => {
100
116
  {t('SHARED_MENUS', 'Shared menus')}
101
117
  </Tab>
102
118
  </TabsContainer>
103
- <SearchBarWrapper>
119
+ <SearchBarWrapper isDisabledFeature={isDisabledFeature}>
104
120
  <SearchBar
105
121
  isCustomLayout
106
122
  lazyLoad
@@ -129,7 +145,8 @@ const BusinessMenuUI = (props) => {
129
145
  key={menu.id}
130
146
  isBorderTop={index === 0}
131
147
  active={menu.id === currentMenu?.id}
132
- onClick={(e) => handleOpenEdit(e, menu)}
148
+ onClick={(e) => !isDisabledFeature && handleOpenEdit(e, menu)}
149
+ isDisabledFeature={isDisabledFeature}
133
150
  >
134
151
  <CheckboxWrapper
135
152
  className='business_checkbox_control'
@@ -151,6 +168,7 @@ const BusinessMenuUI = (props) => {
151
168
  </AddMenuButton>
152
169
  )}
153
170
  </MenuContainer>
171
+ {isDisabledFeature && (<DisabledFeatureAlert />)}
154
172
  {width >= 1000 ? (
155
173
  <>
156
174
  {showOption === 'option' && (
@@ -73,6 +73,14 @@ export const MeunItem = styled.div`
73
73
  margin: 0 3px;
74
74
  font-size: 13px;
75
75
  }
76
+
77
+ ${({ isDisabledFeature }) => isDisabledFeature && css`
78
+ cursor: not-allowed;
79
+ opacity: 0.4;
80
+ &:hover {
81
+ background-color: ${props => props.theme.colors.white};
82
+ }
83
+ `}
76
84
  `
77
85
 
78
86
  export const MenuName = styled.span`
@@ -124,10 +132,21 @@ export const Tab = styled.div`
124
132
  ${({ active }) => !active && css`
125
133
  color: ${props => props.theme.colors?.lightGray};
126
134
  `}
135
+
136
+ ${({ disabledFeature }) => disabledFeature && css`
137
+ cursor: not-allowed;
138
+ `}
127
139
  `
128
140
 
129
141
  export const SearchBarWrapper = styled.div`
130
142
  margin-bottom: 15px;
143
+ ${({ isDisabledFeature }) => isDisabledFeature && css`
144
+ cursor: not-allowed;
145
+ > div {
146
+ pointer-events: none;
147
+ opacity: 0.4;
148
+ }
149
+ `}
131
150
  `
132
151
  export const SelectButtonGroup = styled.div`
133
152
  display: flex;
@@ -159,6 +159,12 @@ export const Tab = styled.div`
159
159
  ${({ active }) => !active && css`
160
160
  color: ${props => props.theme.colors.lightGray};
161
161
  `}
162
+
163
+ ${({ disabledFeature }) => disabledFeature && css`
164
+ background-color: ${props => props.theme.colors.disabled};
165
+ border-radius: 5px;
166
+ cursor: not-allowed;
167
+ `}
162
168
  `
163
169
 
164
170
  export const BusinessMenuBasicContainer = styled.div`