ordering-ui-admin-external 1.8.5 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/_bundles/{ordering-ui-admin.66a745752c35fb204c80.js → ordering-ui-admin.46b3298439d9527907e3.js} +2 -2
  2. package/_bundles/{ordering-ui-admin.66a745752c35fb204c80.js.LICENSE.txt → ordering-ui-admin.46b3298439d9527907e3.js.LICENSE.txt} +0 -0
  3. package/_modules/components/MyProducts/OrderingWebsite/index.js +50 -8
  4. package/_modules/components/Settings/Deliverect/index.js +103 -0
  5. package/_modules/components/Settings/Deliverect/styles.js +115 -0
  6. package/_modules/components/Settings/IntegrationListing/index.js +41 -2
  7. package/_modules/components/Settings/IntegrationListing/styles.js +7 -4
  8. package/_modules/components/Settings/ItsaCheckmate/index.js +112 -0
  9. package/_modules/components/Settings/ItsaCheckmate/styles.js +118 -0
  10. package/_modules/components/Settings/PickerExpress/index.js +178 -0
  11. package/_modules/components/Settings/PickerExpress/styles.js +111 -0
  12. package/_modules/components/Stores/BusinessAdd/BusinessDetails/index.js +95 -0
  13. package/_modules/components/Stores/BusinessAdd/BusinessDetails/styles.js +43 -0
  14. package/_modules/components/Stores/BusinessAdd/DeliveryZone/index.js +233 -0
  15. package/_modules/components/Stores/BusinessAdd/DeliveryZone/styles.js +40 -0
  16. package/_modules/components/Stores/BusinessAdd/Images/index.js +181 -0
  17. package/_modules/components/Stores/BusinessAdd/Images/styles.js +42 -0
  18. package/_modules/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +53 -0
  19. package/_modules/components/Stores/BusinessAdd/OrderTypePriceLevel/styles.js +31 -0
  20. package/_modules/components/Stores/BusinessAdd/OtherDetails/index.js +43 -0
  21. package/_modules/components/Stores/BusinessAdd/OtherDetails/styles.js +25 -0
  22. package/_modules/components/Stores/BusinessAdd/PaymentMethods/index.js +48 -0
  23. package/_modules/components/Stores/BusinessAdd/PaymentMethods/styles.js +31 -0
  24. package/_modules/components/Stores/BusinessAdd/Photos/index.js +174 -0
  25. package/_modules/components/Stores/BusinessAdd/Photos/styles.js +46 -0
  26. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/index.js +48 -0
  27. package/_modules/components/Stores/BusinessAdd/ReceiveOrders/styles.js +24 -0
  28. package/_modules/components/Stores/BusinessAdd/Schedule/index.js +31 -0
  29. package/_modules/components/Stores/BusinessAdd/Schedule/styles.js +14 -0
  30. package/_modules/components/Stores/BusinessAdd/index.js +170 -0
  31. package/_modules/components/Stores/BusinessAdd/styles.js +29 -0
  32. package/_modules/components/Stores/BusinessDeliveryDetails/styles.js +1 -1
  33. package/_modules/components/Stores/BusinessDeliveryPickupMore/index.js +4 -0
  34. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -1
  35. package/_modules/components/Stores/BusinessPickupDetails/styles.js +1 -1
  36. package/_modules/components/Stores/BusinessProductAddForm/index.js +4 -4
  37. package/_modules/components/Stores/BusinessProductsCategoyInfo/index.js +1 -6
  38. package/_modules/components/Stores/BusinessProductsListing/index.js +38 -14
  39. package/_modules/components/Stores/BusinessesList/index.js +3 -2
  40. package/_modules/components/Stores/BusinessesListing/index.js +51 -26
  41. package/_modules/components/Stores/BusinessesListing/styles.js +22 -15
  42. package/_modules/components/Stores/BusinessesListingHeader/index.js +6 -5
  43. package/_modules/components/Stores/ProductStartGuide/index.js +69 -0
  44. package/_modules/components/Stores/ProductStartGuide/styles.js +28 -0
  45. package/_modules/components/Stores/ProductStep/index.js +92 -0
  46. package/_modules/components/Stores/ProductStep/styles.js +18 -0
  47. package/_modules/components/Stores/RestaurantSelectGuide/index.js +104 -0
  48. package/_modules/components/Stores/RestaurantSelectGuide/styles.js +44 -0
  49. package/_modules/components/Stores/index.js +7 -0
  50. package/_modules/index.js +6 -0
  51. package/index-template.js +64 -2
  52. package/package.json +2 -2
  53. package/src/components/MyProducts/OrderingWebsite/index.js +45 -3
  54. package/src/components/Settings/Deliverect/index.js +149 -0
  55. package/src/components/Settings/Deliverect/styles.js +344 -0
  56. package/src/components/Settings/IntegrationListing/index.js +46 -12
  57. package/src/components/Settings/IntegrationListing/styles.js +7 -1
  58. package/src/components/Settings/ItsaCheckmate/index.js +170 -0
  59. package/src/components/Settings/ItsaCheckmate/styles.js +366 -0
  60. package/src/components/Settings/PickerExpress/index.js +222 -0
  61. package/src/components/Settings/PickerExpress/styles.js +330 -0
  62. package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +106 -0
  63. package/src/components/Stores/BusinessAdd/BusinessDetails/styles.js +107 -0
  64. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +250 -0
  65. package/src/components/Stores/BusinessAdd/DeliveryZone/styles.js +101 -0
  66. package/src/components/Stores/BusinessAdd/Images/index.js +168 -0
  67. package/src/components/Stores/BusinessAdd/Images/styles.js +94 -0
  68. package/src/components/Stores/BusinessAdd/OrderTypePriceLevel/index.js +43 -0
  69. package/src/components/Stores/BusinessAdd/OrderTypePriceLevel/styles.js +70 -0
  70. package/src/components/Stores/BusinessAdd/OtherDetails/index.js +51 -0
  71. package/src/components/Stores/BusinessAdd/OtherDetails/styles.js +49 -0
  72. package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +39 -0
  73. package/src/components/Stores/BusinessAdd/PaymentMethods/styles.js +46 -0
  74. package/src/components/Stores/BusinessAdd/Photos/index.js +156 -0
  75. package/src/components/Stores/BusinessAdd/Photos/styles.js +108 -0
  76. package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +46 -0
  77. package/src/components/Stores/BusinessAdd/ReceiveOrders/styles.js +69 -0
  78. package/src/components/Stores/BusinessAdd/Schedule/index.js +23 -0
  79. package/src/components/Stores/BusinessAdd/Schedule/styles.js +14 -0
  80. package/src/components/Stores/BusinessAdd/index.js +184 -0
  81. package/src/components/Stores/BusinessAdd/styles.js +85 -0
  82. package/src/components/Stores/BusinessDeliveryDetails/styles.js +1 -0
  83. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +9 -1
  84. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +8 -10
  85. package/src/components/Stores/BusinessPickupDetails/styles.js +1 -0
  86. package/src/components/Stores/BusinessProductAddForm/index.js +1 -1
  87. package/src/components/Stores/BusinessProductsCategoyInfo/index.js +4 -7
  88. package/src/components/Stores/BusinessProductsListing/index.js +20 -0
  89. package/src/components/Stores/BusinessesList/index.js +3 -2
  90. package/src/components/Stores/BusinessesListing/index.js +101 -67
  91. package/src/components/Stores/BusinessesListing/styles.js +36 -0
  92. package/src/components/Stores/BusinessesListingHeader/index.js +58 -51
  93. package/src/components/Stores/ProductStartGuide/index.js +60 -0
  94. package/src/components/Stores/ProductStartGuide/styles.js +62 -0
  95. package/src/components/Stores/ProductStep/index.js +84 -0
  96. package/src/components/Stores/ProductStep/styles.js +29 -0
  97. package/src/components/Stores/RestaurantSelectGuide/index.js +119 -0
  98. package/src/components/Stores/RestaurantSelectGuide/styles.js +150 -0
  99. package/src/components/Stores/index.js +2 -0
  100. package/src/index.js +2 -0
  101. package/template/app.js +4 -0
  102. package/template/assets/images/dummies/no-businesses.png +0 -0
  103. package/template/assets/images/import-menu.png +0 -0
  104. package/template/assets/images/imported-menu.png +0 -0
  105. package/template/assets/images/picker-express.png +0 -0
  106. package/template/components/ListenPageChanges/index.js +1 -0
  107. package/template/config.json +1 -1
  108. package/template/helmetdata.json +7 -0
  109. package/template/pages/BusinessAdd/index.js +11 -0
@@ -1,17 +1,18 @@
1
- import React, { useState, useEffect } from 'react'
1
+ import React, { useState, useEffect, useMemo } from 'react'
2
2
  import { useLocation } from 'react-router-dom'
3
- import { DashboardBusinessList as BusinessListController } from 'ordering-components-admin-external'
3
+ import { useLanguage, useEvent, DashboardBusinessList as BusinessListController } from 'ordering-components-admin-external'
4
4
  import BsGrid from '@meronex/icons/bs/BsGrid'
5
5
  import BsViewList from '@meronex/icons/bs/BsViewList'
6
6
  import { getStorageItem, setStorageItem } from '../../../utils'
7
7
  import { SideBar } from '../../Shared'
8
+ import { useTheme } from 'styled-components'
8
9
 
9
10
  import { BusinessesList } from '../BusinessesList'
10
11
  import { BusinessesListingHeader } from '../BusinessesListingHeader'
11
12
  import { BusinessActiveStateFilter } from '../BusinessActiveStateFilter'
12
13
  import { BusinessTypeFilter } from '../BusinessTypeFilter'
13
14
  import { BusinessDetails } from '../BusinessDetails'
14
- import { AddBusinessForm } from '../AddBusinessForm'
15
+ // import { AddBusinessForm } from '../AddBusinessForm'
15
16
  import { WizardBusiness } from '../WizardBusiness'
16
17
 
17
18
  import {
@@ -19,10 +20,12 @@ import {
19
20
  ViewContainer,
20
21
  WrapperView,
21
22
  ViewMethodButton,
22
- ButtonGroup
23
+ ButtonGroup,
24
+ EmptyBusinessWrapper
23
25
  } from './styles'
24
26
  import { BusinessSync } from '../BusinessSync'
25
27
  import { BusinessDelete } from '../BusinessDelete'
28
+ import { Button } from '../../../styles'
26
29
 
27
30
  const BusinessesListingUI = (props) => {
28
31
  const {
@@ -48,6 +51,9 @@ const BusinessesListingUI = (props) => {
48
51
  } = props
49
52
 
50
53
  const query = new URLSearchParams(useLocation().search)
54
+ const theme = useTheme()
55
+ const [, t] = useLanguage()
56
+ const [events] = useEvent()
51
57
 
52
58
  const [isTutorialMode, setIsTutorialMode] = useState(false)
53
59
  const [openTutorialSidebarState, setOpenTutorialSidebarState] = useState(null)
@@ -61,6 +67,14 @@ const BusinessesListingUI = (props) => {
61
67
  const [openSync, setOpenSync] = useState(false)
62
68
  const [moveDistance, setMoveDistance] = useState(0)
63
69
 
70
+ const noBusinesses = useMemo(() => {
71
+ return !businessList?.loading && businessList?.businesses?.length === 0 && pagination?.currentPage === 1 && !searchValue
72
+ }, [businessList?.loading, businessList?.businesses, pagination, searchValue])
73
+
74
+ const handleGotToAdd = () => {
75
+ events.emit('go_to_page', { page: 'business_add' })
76
+ }
77
+
64
78
  const handleBackRedirect = () => {
65
79
  setOpenBusinessDetails(false)
66
80
  setDetailsBusiness(null)
@@ -84,16 +98,16 @@ const BusinessesListingUI = (props) => {
84
98
  setOpenAddBusiness(true)
85
99
  }
86
100
 
87
- const onhandleSuccessAddBusiness = (business) => {
88
- handleSucessAddBusiness(business)
89
- setOpenAddBusiness(false)
90
- setDetailsBusiness(business)
91
- if (isTutorialMode) {
92
- setOpenTutorialSidebarState('schedule')
93
- } else {
94
- handleOpenBusinessDetails(business)
95
- }
96
- }
101
+ // const onhandleSuccessAddBusiness = (business) => {
102
+ // handleSucessAddBusiness(business)
103
+ // setOpenAddBusiness(false)
104
+ // setDetailsBusiness(business)
105
+ // if (isTutorialMode) {
106
+ // setOpenTutorialSidebarState('schedule')
107
+ // } else {
108
+ // handleOpenBusinessDetails(business)
109
+ // }
110
+ // }
97
111
 
98
112
  useEffect(() => {
99
113
  const id = query.get('id')
@@ -147,68 +161,88 @@ const BusinessesListingUI = (props) => {
147
161
 
148
162
  return (
149
163
  <>
150
- <BusinessListingContainer>
164
+ <BusinessListingContainer isAdd={openAddBusiness}>
151
165
  <BusinessesListingHeader
152
166
  searchValue={searchValue}
153
167
  onSearch={onSearch}
154
168
  handleOpenAddBusiness={handleOpenAddBusiness}
169
+ handleGotToAdd={handleGotToAdd}
155
170
  handleStartTutorial={handleStartTutorial}
156
171
  handleOpenSync={handleOpenSync}
157
172
  handleRefreshBusinesses={loadBusinesses}
158
173
  loading={businessList.loading}
174
+ noBusinesses={noBusinesses}
175
+ openAddBusiness={openAddBusiness}
159
176
  />
160
- <ViewContainer>
161
- <BusinessActiveStateFilter
162
- selectedBusinessActiveState={selectedBusinessActiveState}
163
- handleChangeBusinessActiveState={handleChangeBusinessActiveState}
164
- />
165
- <WrapperView>
166
- <ViewMethodButton
167
- active={viewMethod === 'card'}
168
- onClick={() => handleViewMethod('card')}
177
+ {noBusinesses ? (
178
+ <EmptyBusinessWrapper>
179
+ <img src={theme.images.dummies.noBusinesses} alt='' />
180
+ <h2>{t('NO_BUSINESSES_DESCRIPTION', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse cursus adipiscing risus odio. Turpis nibh phasellus interdum vulputate urna, cursus pellentesque. Nec quis donec lobortis enim magna non turpis faucibus. ')}</h2>
181
+ <Button
182
+ color='primary'
183
+ borderRadius='7.6px'
184
+ onClick={() => handleGotToAdd()}
169
185
  >
170
- <BsGrid />
171
- </ViewMethodButton>
172
- <ViewMethodButton
173
- active={viewMethod === 'list'}
174
- onClick={() => handleViewMethod('list')}
175
- >
176
- <BsViewList />
177
- </ViewMethodButton>
178
- </WrapperView>
179
- </ViewContainer>
180
- <ButtonGroup isSelect={businessIds?.length > 0}>
181
- <BusinessTypeFilter
182
- businessTypes={props.businessTypes}
183
- defaultBusinessType={props.defaultBusinessType}
184
- handleChangeBusinessType={handleChangeBusinessType}
185
- setBusinessTypes={setBusinessTypes}
186
- />
187
- {businessIds?.length > 0 && (
188
- <BusinessDelete
189
- handleDeleteMultiBusinesses={handleDeleteMultiBusinesses}
186
+ {t('ADD_NEW_STORE', 'Add new store')}
187
+ </Button>
188
+ </EmptyBusinessWrapper>
189
+ ) : (
190
+ <>
191
+ <ViewContainer>
192
+ <BusinessActiveStateFilter
193
+ selectedBusinessActiveState={selectedBusinessActiveState}
194
+ handleChangeBusinessActiveState={handleChangeBusinessActiveState}
195
+ />
196
+ <WrapperView>
197
+ <ViewMethodButton
198
+ active={viewMethod === 'card'}
199
+ onClick={() => handleViewMethod('card')}
200
+ >
201
+ <BsGrid />
202
+ </ViewMethodButton>
203
+ <ViewMethodButton
204
+ active={viewMethod === 'list'}
205
+ onClick={() => handleViewMethod('list')}
206
+ >
207
+ <BsViewList />
208
+ </ViewMethodButton>
209
+ </WrapperView>
210
+ </ViewContainer>
211
+ <ButtonGroup isSelect={businessIds?.length > 0}>
212
+ <BusinessTypeFilter
213
+ businessTypes={props.businessTypes}
214
+ defaultBusinessType={props.defaultBusinessType}
215
+ handleChangeBusinessType={handleChangeBusinessType}
216
+ setBusinessTypes={setBusinessTypes}
217
+ />
218
+ {businessIds?.length > 0 && (
219
+ <BusinessDelete
220
+ handleDeleteMultiBusinesses={handleDeleteMultiBusinesses}
221
+ />
222
+ )}
223
+ </ButtonGroup>
224
+ <BusinessesList
225
+ viewMethod={viewMethod}
226
+ businessList={businessList}
227
+ pagination={pagination}
228
+ detailsBusinessId={detailsBusinessId}
229
+ loadMoreBusinesses={loadMoreBusinesses}
230
+ getPageBusinesses={getPageBusinesses}
231
+ handleSucessRemoveBusiness={handleSucessRemoveBusiness}
232
+ handleSucessAddBusiness={handleSucessAddBusiness}
233
+ handleSucessUpdateBusiness={handleSucessUpdateBusiness}
234
+ handleOpenBusinessDetails={handleOpenBusinessDetails}
235
+ handleOpenAddBusiness={handleOpenAddBusiness}
236
+ isTutorialMode={isTutorialMode}
237
+ businessIds={businessIds}
238
+ setBusinessIds={setBusinessIds}
239
+ handleChangeBusinessIds={handleChangeBusinessIds}
240
+ handleEnableAllBusiness={handleEnableAllBusiness}
241
+ selectedBusinessActiveState={selectedBusinessActiveState}
242
+ handleGotToAdd={handleGotToAdd}
190
243
  />
191
- )}
192
- </ButtonGroup>
193
- <BusinessesList
194
- viewMethod={viewMethod}
195
- businessList={businessList}
196
- pagination={pagination}
197
- detailsBusinessId={detailsBusinessId}
198
- loadMoreBusinesses={loadMoreBusinesses}
199
- getPageBusinesses={getPageBusinesses}
200
- handleSucessRemoveBusiness={handleSucessRemoveBusiness}
201
- handleSucessAddBusiness={handleSucessAddBusiness}
202
- handleSucessUpdateBusiness={handleSucessUpdateBusiness}
203
- handleOpenBusinessDetails={handleOpenBusinessDetails}
204
- handleOpenAddBusiness={handleOpenAddBusiness}
205
- isTutorialMode={isTutorialMode}
206
- businessIds={businessIds}
207
- setBusinessIds={setBusinessIds}
208
- handleChangeBusinessIds={handleChangeBusinessIds}
209
- handleEnableAllBusiness={handleEnableAllBusiness}
210
- selectedBusinessActiveState={selectedBusinessActiveState}
211
- />
244
+ </>
245
+ )}
212
246
  </BusinessListingContainer>
213
247
  {openBusinessDetails && (
214
248
  <BusinessDetails
@@ -223,7 +257,7 @@ const BusinessesListingUI = (props) => {
223
257
  onClose={() => handleBackRedirect()}
224
258
  />
225
259
  )}
226
- {openAddBusiness && (
260
+ {/* {openAddBusiness && (
227
261
  <SideBar
228
262
  id='add_business_form'
229
263
  open={openAddBusiness}
@@ -234,7 +268,7 @@ const BusinessesListingUI = (props) => {
234
268
  handleSucessAddBusiness={onhandleSuccessAddBusiness}
235
269
  />
236
270
  </SideBar>
237
- )}
271
+ )} */}
238
272
 
239
273
  {openSync && (
240
274
  <SideBar
@@ -7,6 +7,11 @@ export const BusinessListingContainer = styled.div`
7
7
  transition: all 0.5s;
8
8
  overflow: hidden;
9
9
 
10
+ ${({ isAdd }) => isAdd && css`
11
+ max-height: 100vh;
12
+ overflow: auto;
13
+ `}
14
+
10
15
  @media print {
11
16
  display: none;
12
17
  }
@@ -84,3 +89,34 @@ export const ButtonGroup = styled.div`
84
89
  }
85
90
  }
86
91
  `
92
+
93
+ export const EmptyBusinessWrapper = styled.div`
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ flex-direction: column;
98
+ min-height: calc(100vh - 70px);
99
+
100
+ > img {
101
+ width: 90%;
102
+ max-width: 500px;
103
+ }
104
+ h2 {
105
+ font-weight: 400;
106
+ font-size: 14px;
107
+ line-height: 24px;
108
+ margin-bottom: 30px;
109
+ margin-top: 0px;
110
+ text-align: center;
111
+ max-width: 600px;
112
+ color: ${props => props.theme.colors.lightGray};
113
+ }
114
+ button {
115
+ height: 44px;
116
+ }
117
+ @media (min-width: 576px) {
118
+ > img {
119
+ width: 60%;
120
+ }
121
+ }
122
+ `
@@ -17,11 +17,13 @@ export const BusinessesListingHeader = (props) => {
17
17
  const {
18
18
  searchValue,
19
19
  onSearch,
20
- handleOpenAddBusiness,
20
+ // handleOpenAddBusiness,
21
21
  handleStartTutorial,
22
22
  handleOpenSync,
23
23
  handleRefreshBusinesses,
24
- loading
24
+ loading,
25
+ noBusinesses,
26
+ handleGotToAdd
25
27
  } = props
26
28
  const [, t] = useLanguage()
27
29
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
@@ -38,57 +40,62 @@ export const BusinessesListingHeader = (props) => {
38
40
  </IconButton>
39
41
  )}
40
42
  <h1>{t('STORES_LIST', 'Stores list')}</h1>
41
- <OverlayTrigger
42
- placement='bottom'
43
- overlay={
44
- <Tooltip>
45
- {t('START_TUTORIAL', 'Start tutorial')}
46
- </Tooltip>
47
- }
48
- >
49
- <IconButton
50
- color='dark'
51
- className='tour_btn'
52
- onClick={() => handleStartTutorial()}
43
+ {!noBusinesses && (
44
+ <OverlayTrigger
45
+ placement='bottom'
46
+ overlay={
47
+ <Tooltip>
48
+ {t('START_TUTORIAL', 'Start tutorial')}
49
+ </Tooltip>
50
+ }
53
51
  >
54
- <LifePreserver />
55
- </IconButton>
56
- </OverlayTrigger>
52
+ <IconButton
53
+ color='dark'
54
+ className='tour_btn'
55
+ onClick={() => handleStartTutorial()}
56
+ >
57
+ <LifePreserver />
58
+ </IconButton>
59
+ </OverlayTrigger>
60
+ )}
57
61
  </HeaderTitleContainer>
58
- <ActionsWrapper>
59
- <Button
60
- color='lightPrimary'
61
- borderRadius='8px'
62
- onClick={() => handleRefreshBusinesses()}
63
- className={loading ? 'loading' : ''}
64
- >
65
- {t('REFRESH', 'Refresh')}
66
- <ArrowRepeat size={16} style={{ marginLeft: 5 }} />
67
- </Button>
68
- <ImportersButton customClass='importerGroup' />
69
- <Button
70
- color='lightPrimary'
71
- borderRadius='8px'
72
- onClick={() => handleOpenAddBusiness()}
73
- >
74
- {t('ADD_NEW_STORE', 'Add new store')}
75
- </Button>
76
- <Button
77
- color='lightPrimary'
78
- borderRadius='8px'
79
- onClick={() => handleOpenSync()}
80
- >
81
- {t('SYNC', 'Sync')}
82
- </Button>
83
- <SearchBar
84
- isCustomLayout
85
- lazyLoad
86
- onSearch={onSearch}
87
- search={searchValue}
88
- placeholder={t('SEARCH', 'Search')}
89
- customClass='searchBar'
90
- />
91
- </ActionsWrapper>
62
+ {!noBusinesses && (
63
+ <ActionsWrapper>
64
+ <Button
65
+ color='lightPrimary'
66
+ borderRadius='8px'
67
+ onClick={() => handleRefreshBusinesses()}
68
+ className={loading ? 'loading' : ''}
69
+ >
70
+ {t('REFRESH', 'Refresh')}
71
+ <ArrowRepeat size={16} style={{ marginLeft: 5 }} />
72
+ </Button>
73
+ <ImportersButton customClass='importerGroup' />
74
+ <Button
75
+ color='lightPrimary'
76
+ borderRadius='8px'
77
+ onClick={() => handleGotToAdd()}
78
+ >
79
+ {t('ADD_NEW_STORE', 'Add new store')}
80
+ </Button>
81
+ <Button
82
+ color='lightPrimary'
83
+ borderRadius='8px'
84
+ onClick={() => handleOpenSync()}
85
+ >
86
+ {t('SYNC', 'Sync')}
87
+ </Button>
88
+ <SearchBar
89
+ isCustomLayout
90
+ lazyLoad
91
+ onSearch={onSearch}
92
+ search={searchValue}
93
+ placeholder={t('SEARCH', 'Search')}
94
+ customClass='searchBar'
95
+ />
96
+ </ActionsWrapper>
97
+ )}
98
+
92
99
  </HeaderContainer>
93
100
  )
94
101
  }
@@ -0,0 +1,60 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { FileMedical, ColumnsGap } from 'react-bootstrap-icons'
4
+ import Skeleton from 'react-loading-skeleton'
5
+ import {
6
+ Container,
7
+ GuideItemContainer,
8
+ InfoWrapper,
9
+ IconWrapper
10
+ } from './styles'
11
+
12
+ export const ProductStartGuide = (props) => {
13
+ const { onClose, setStep, countriesState } = props
14
+ const [, t] = useLanguage()
15
+
16
+ const guideList = [
17
+ { id: 1, title: t('START_WITH_AN_EMPTY_MENU', 'Start with an empty Menu'), description: t('START_WITH_AN_EMPTY_MENU_DESC', 'Start with an empty Menu and enter your menu items'), icon: <FileMedical />, enabled: true },
18
+ { id: 2, title: t('IMPORT_MENU_ONLY_USA_CANADA', 'Import Menu (Only if USA and Canada)'), description: t('IMPORT_MENU_ONLY_USA_CANADA_DESC', 'Import your menu from the Ordering Network that includes over 1M restaurants and stores from the US and Canada.'), icon: <ColumnsGap />, enabled: countriesState?.enabled }
19
+ ]
20
+
21
+ const handleChangeStep = (id) => {
22
+ if (id === 1) onClose()
23
+ else if (id === 2) setStep(2)
24
+ }
25
+
26
+ return (
27
+ <Container>
28
+ <h2>{t('HOW_DO_YOU_WANT_TO_START', 'How do you want to start?')}</h2>
29
+ {countriesState?.loading && [...Array(4).keys()].map(idx => (
30
+ <GuideItemContainer key={idx}>
31
+ <IconWrapper>
32
+ <Skeleton width={24} height={24} />
33
+ </IconWrapper>
34
+ <InfoWrapper>
35
+ <h3>
36
+ <Skeleton height={18} width={200} />
37
+ </h3>
38
+ <p>
39
+ <Skeleton height={10} />
40
+ </p>
41
+ <p>
42
+ <Skeleton height={10} />
43
+ </p>
44
+ </InfoWrapper>
45
+ </GuideItemContainer>
46
+ ))}
47
+ {!countriesState?.loading && guideList.map(guide => guide.enabled && (
48
+ <GuideItemContainer key={guide.id} onClick={() => handleChangeStep(guide.id)}>
49
+ <IconWrapper>
50
+ {guide.icon}
51
+ </IconWrapper>
52
+ <InfoWrapper>
53
+ <h3>{guide.title}</h3>
54
+ <p>{guide.description}</p>
55
+ </InfoWrapper>
56
+ </GuideItemContainer>
57
+ ))}
58
+ </Container>
59
+ )
60
+ }
@@ -0,0 +1,62 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ h2 {
5
+ font-weight: 600;
6
+ font-size: 24px;
7
+ line-height: 36px;
8
+ text-align: center;
9
+ margin: 0;
10
+ }
11
+ `
12
+
13
+ export const IconWrapper = styled.div`
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ margin-right: 20px;
18
+ ${props => props.theme.rtl && css`
19
+ margin-right: 0px;
20
+ margin-left: 20px;
21
+ `}
22
+ svg {
23
+ font-size: 24px;
24
+ }
25
+ `
26
+
27
+ export const GuideItemContainer = styled.div`
28
+ display: flex;
29
+ align-items: center;
30
+ padding: 10px 20px;
31
+ min-height: 78px;
32
+ margin-top: 30px;
33
+ border-radius: 7.6px;
34
+ cursor: pointer;
35
+ border: 1px solid ${props => props.theme.colors.borderColor};
36
+ transition: all 0.3s linear;
37
+
38
+ &:hover {
39
+ border: 1px solid ${props => props.theme.colors.primary};
40
+ background-color: ${props => props.theme.colors.lightPrimary};
41
+ }
42
+ `
43
+
44
+ export const InfoWrapper = styled.div`
45
+ flex: 1;
46
+ h3 {
47
+ font-weight: 600;
48
+ font-size: 14px;
49
+ line-height: 21px;
50
+ margin: 0%;
51
+ }
52
+ p {
53
+ margin: 0;
54
+ font-weight: 400;
55
+ font-size: 12px;
56
+ line-height: 18px;
57
+ > span {
58
+ display: flex;
59
+ margin-top: 5px;
60
+ }
61
+ }
62
+ `
@@ -0,0 +1,84 @@
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useEvent, ProductStep as ProductStepController } from 'ordering-components-admin-external'
3
+ import { ProductStartGuide } from '../ProductStartGuide'
4
+ import { RestaurantSelectGuide } from '../RestaurantSelectGuide'
5
+ import { useTheme } from 'styled-components'
6
+ import { Button } from '../../../styles'
7
+ import {
8
+ Container,
9
+ ImportMenuContainer,
10
+ ImageContent,
11
+ ButtonWrapper
12
+ } from './styles'
13
+
14
+ const ProductStepUI = (props) => {
15
+ const {
16
+ onClose,
17
+ businessList,
18
+ setBusiness,
19
+ actionState,
20
+ handleImport,
21
+ handleChangeAddress,
22
+ business,
23
+ isLoading,
24
+ orderingBusiness,
25
+ countriesState
26
+ } = props
27
+
28
+ const theme = useTheme()
29
+ const [, t] = useLanguage()
30
+ const [events] = useEvent()
31
+
32
+ const [step, setStep] = useState(1)
33
+
34
+ const handleCheckMenu = () => {
35
+ events.emit('go_to_page', { page: 'store', params: { store: business?._id } })
36
+ onClose()
37
+ }
38
+
39
+ return (
40
+ <Container>
41
+ {step === 1 && <ProductStartGuide onClose={onClose} setStep={setStep} countriesState={countriesState} />}
42
+ {step === 2 && (
43
+ <RestaurantSelectGuide
44
+ setBusiness={setBusiness}
45
+ setStep={setStep}
46
+ onClose={onClose}
47
+ businessList={businessList}
48
+ handleImport={handleImport}
49
+ handleChangeAddress={handleChangeAddress}
50
+ orderingBusiness={orderingBusiness}
51
+ business={business}
52
+ isLoading={isLoading}
53
+ />
54
+ )}
55
+ {step === 3 && actionState?.loading && (
56
+ <ImportMenuContainer>
57
+ <h2>{t('WE_ARE_IMPORTING_YOUR_MENU', 'We are importing your menu.')}</h2>
58
+ <ImageContent>
59
+ <img src={theme.images.general.importMenu} alt='' />
60
+ </ImageContent>
61
+ </ImportMenuContainer>
62
+ )}
63
+ {step === 3 && !actionState?.loading && (
64
+ <ImportMenuContainer>
65
+ <h2>{t('YOUR_MENU_HAS_BEEN_IMPORTED', 'Your menu has been imported')}</h2>
66
+ <ImageContent>
67
+ <img src={theme.images.general.importedMenu} alt='' />
68
+ </ImageContent>
69
+ <ButtonWrapper>
70
+ <Button color='primary' onClick={() => handleCheckMenu()}>{t('CHECK_MENU', 'Check menu')}</Button>
71
+ </ButtonWrapper>
72
+ </ImportMenuContainer>
73
+ )}
74
+ </Container>
75
+ )
76
+ }
77
+
78
+ export const ProductStep = (props) => {
79
+ const productStepProps = {
80
+ ...props,
81
+ UIComponent: ProductStepUI
82
+ }
83
+ return <ProductStepController {...productStepProps} />
84
+ }
@@ -0,0 +1,29 @@
1
+ import styled from 'styled-components'
2
+
3
+ export const Container = styled.div``
4
+
5
+ export const ImportMenuContainer = styled.div`
6
+ h2 {
7
+ font-weight: 600;
8
+ font-size: 24px;
9
+ line-height: 36px;
10
+ text-align: center;
11
+ margin: 0;
12
+ }
13
+ `
14
+
15
+ export const ButtonWrapper = styled.div`
16
+ display: flex;
17
+ justify-content: center;
18
+ button {
19
+ height: 44px;
20
+ width: 300px;
21
+ margin-top: 30px;
22
+ border-radius: 8px;
23
+ }
24
+ `
25
+
26
+ export const ImageContent = styled.div`
27
+ display: flex;
28
+ justify-content: center;
29
+ `