ordering-ui-admin-external 1.0.0 → 1.1.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.
- package/_bundles/{ordering-ui-admin.2c8f8ba23ef8c37422f3.js → ordering-ui-admin.2a3c1a73c2eac0c338db.js} +2 -2
- package/_bundles/{ordering-ui-admin.2c8f8ba23ef8c37422f3.js.LICENSE.txt → ordering-ui-admin.2a3c1a73c2eac0c338db.js.LICENSE.txt} +0 -0
- package/_modules/components/Delivery/UserDetails/index.js +40 -11
- package/_modules/components/Delivery/UserDetails/styles.js +15 -3
- package/_modules/components/Delivery/UserDetailsMenu/index.js +3 -0
- package/_modules/components/Downloads/FreeProductsList/index.js +10 -10
- package/_modules/components/Downloads/PurchasedProductsList/index.js +10 -10
- package/_modules/components/LanguageSelector/index.js +1 -1
- package/_modules/components/Orders/DriversList/styles.js +1 -1
- package/_modules/components/Orders/OrdersTable/index.js +11 -11
- package/_modules/components/Settings/LanguageSetting/index.js +4 -4
- package/_modules/components/Settings/Settings/index.js +40 -9
- package/_modules/components/Settings/SettingsList/index.js +0 -4
- package/_modules/components/Settings/SiteSettingDetails/index.js +85 -0
- package/_modules/components/Settings/SiteSettingDetails/styles.js +46 -0
- package/_modules/components/Settings/SitesAuthSettings/index.js +154 -0
- package/_modules/components/Settings/SitesAuthSettings/styles.js +49 -0
- package/_modules/components/SidebarMenu/index.js +15 -7
- package/_modules/components/Stores/BusinessSelectHeader/index.js +18 -67
- package/_modules/components/Stores/BusinessSelectHeader/styles.js +5 -5
- package/package.json +2 -2
- package/src/components/Delivery/UserDetails/index.js +40 -7
- package/src/components/Delivery/UserDetails/styles.js +11 -0
- package/src/components/Delivery/UserDetailsMenu/index.js +2 -1
- package/src/components/Downloads/FreeProductsList/index.js +10 -10
- package/src/components/Downloads/PurchasedProductsList/index.js +10 -10
- package/src/components/LanguageSelector/index.js +1 -1
- package/src/components/Orders/DriversList/styles.js +1 -0
- package/src/components/Orders/OrdersTable/index.js +7 -12
- package/src/components/Settings/LanguageSetting/index.js +2 -2
- package/src/components/Settings/PlaceListing/index.js +1 -0
- package/src/components/Settings/Settings/index.js +35 -3
- package/src/components/Settings/SettingsList/index.js +0 -3
- package/src/components/Settings/SiteSettingDetails/index.js +86 -0
- package/src/components/Settings/SiteSettingDetails/styles.js +58 -0
- package/src/components/Settings/SitesAuthSettings/index.js +107 -0
- package/src/components/Settings/SitesAuthSettings/styles.js +52 -0
- package/src/components/SidebarMenu/index.js +2 -2
- package/src/components/Stores/BusinessSelectHeader/index.js +25 -56
- package/src/components/Stores/BusinessSelectHeader/styles.js +17 -12
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useLanguage, SitesAuthSettings as SitesAuthSettingsController } from 'ordering-components-admin-external'
|
|
3
|
+
import Skeleton from 'react-loading-skeleton'
|
|
4
|
+
import BsChevronRight from '@meronex/icons/bs/BsChevronRight'
|
|
5
|
+
import { Alert, SideBar } from '../../Shared'
|
|
6
|
+
import { SiteSettingDetails } from '../SiteSettingDetails'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
SitesListContainer,
|
|
10
|
+
SitesWrapper,
|
|
11
|
+
SiteItem
|
|
12
|
+
} from './styles'
|
|
13
|
+
|
|
14
|
+
const SitesAuthSettingsUI = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
sitesState,
|
|
17
|
+
actionState,
|
|
18
|
+
setMoveDistance,
|
|
19
|
+
siteConfigsState,
|
|
20
|
+
handleGetSiteConfigs,
|
|
21
|
+
handleChangeConfig
|
|
22
|
+
} = props
|
|
23
|
+
|
|
24
|
+
const [, t] = useLanguage()
|
|
25
|
+
const [selectedSiteId, setSelectedSiteId] = useState(null)
|
|
26
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
27
|
+
|
|
28
|
+
const handleOpenSiteSettingDetails = (siteId) => {
|
|
29
|
+
handleGetSiteConfigs(siteId)
|
|
30
|
+
setSelectedSiteId(siteId)
|
|
31
|
+
setMoveDistance(500)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const handleCloseDetails = () => {
|
|
35
|
+
setSelectedSiteId(null)
|
|
36
|
+
setMoveDistance(0)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (actionState.error) {
|
|
41
|
+
setAlertState({
|
|
42
|
+
open: true,
|
|
43
|
+
content: actionState.error
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
}, [actionState.error])
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<SitesListContainer>
|
|
51
|
+
<h1>{t('SITES_LOGIN_SIGNUP_SETTINGS', 'Sites Login/Signup Settings')}</h1>
|
|
52
|
+
{sitesState.loading ? (
|
|
53
|
+
<SitesWrapper>
|
|
54
|
+
{[...Array(5).keys()].map(i => (
|
|
55
|
+
<SiteItem key={i}>
|
|
56
|
+
<Skeleton width={100} height={14} />
|
|
57
|
+
</SiteItem>
|
|
58
|
+
))}
|
|
59
|
+
</SitesWrapper>
|
|
60
|
+
) : (
|
|
61
|
+
<SitesWrapper>
|
|
62
|
+
{sitesState.sites.map(site => (
|
|
63
|
+
<SiteItem
|
|
64
|
+
key={site.id}
|
|
65
|
+
active={site.id === selectedSiteId}
|
|
66
|
+
onClick={() => handleOpenSiteSettingDetails(site.id)}
|
|
67
|
+
>
|
|
68
|
+
<span>{site.name}</span>
|
|
69
|
+
<BsChevronRight />
|
|
70
|
+
</SiteItem>
|
|
71
|
+
))}
|
|
72
|
+
</SitesWrapper>
|
|
73
|
+
)}
|
|
74
|
+
</SitesListContainer>
|
|
75
|
+
{selectedSiteId && (
|
|
76
|
+
<SideBar
|
|
77
|
+
isBorderShow
|
|
78
|
+
open={selectedSiteId}
|
|
79
|
+
onClose={() => handleCloseDetails()}
|
|
80
|
+
>
|
|
81
|
+
<SiteSettingDetails
|
|
82
|
+
selectedSiteId={selectedSiteId}
|
|
83
|
+
siteConfigsState={siteConfigsState}
|
|
84
|
+
handleChangeConfig={handleChangeConfig}
|
|
85
|
+
/>
|
|
86
|
+
</SideBar>
|
|
87
|
+
)}
|
|
88
|
+
<Alert
|
|
89
|
+
title={t('SETTINGS', 'Settings')}
|
|
90
|
+
content={alertState.content}
|
|
91
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
92
|
+
open={alertState.open}
|
|
93
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
94
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
95
|
+
closeOnBackdrop={false}
|
|
96
|
+
/>
|
|
97
|
+
</>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const SitesAuthSettings = (props) => {
|
|
102
|
+
const sitesAuthSettinsProps = {
|
|
103
|
+
...props,
|
|
104
|
+
UIComponent: SitesAuthSettingsUI
|
|
105
|
+
}
|
|
106
|
+
return <SitesAuthSettingsController {...sitesAuthSettinsProps} />
|
|
107
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const SitesListContainer = styled.div`
|
|
4
|
+
padding: 26px 20px;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
|
|
9
|
+
h1 {
|
|
10
|
+
font-weight: 700;
|
|
11
|
+
font-size: 20px;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
`
|
|
15
|
+
export const SitesWrapper = styled.div`
|
|
16
|
+
margin-top: 35px;
|
|
17
|
+
border: 1px solid ${props => props.theme.colors.borderColor};
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
> div:first-child {
|
|
21
|
+
border-top: none !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
> div:last-child {
|
|
25
|
+
border-bottom: none !important;
|
|
26
|
+
}
|
|
27
|
+
`
|
|
28
|
+
export const SiteItem = styled.div`
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
padding: 12px 15px;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
color: ${props => props.theme.colors.lightGray};
|
|
35
|
+
border-bottom: 1px solid ${props => props.theme.colors.borderColor};
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
background-color: ${props => props.theme.colors.lightPrimary};
|
|
39
|
+
}
|
|
40
|
+
span {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
}
|
|
43
|
+
svg {
|
|
44
|
+
font-size: 20px;
|
|
45
|
+
}
|
|
46
|
+
${({ active }) => active && css`
|
|
47
|
+
color: ${props => props.theme.colors.headingColor};
|
|
48
|
+
border-top: 1px solid ${props => props.theme.colors.primary};
|
|
49
|
+
border-bottom: 1px solid ${props => props.theme.colors.primary} !important;
|
|
50
|
+
background-color: ${props => props.theme.colors.lightPrimary};
|
|
51
|
+
`}
|
|
52
|
+
`
|
|
@@ -631,7 +631,7 @@ export const SidebarMenu = (props) => {
|
|
|
631
631
|
</MenuContainer>
|
|
632
632
|
</Accordion>
|
|
633
633
|
)}
|
|
634
|
-
{
|
|
634
|
+
{sessionState?.user?.level !== 5 && (
|
|
635
635
|
<Button
|
|
636
636
|
className='d-flex align-items-center'
|
|
637
637
|
variant={location.pathname === '/ordering-products' && 'primary'}
|
|
@@ -640,7 +640,7 @@ export const SidebarMenu = (props) => {
|
|
|
640
640
|
<WindowDock />
|
|
641
641
|
<span>{t('ORDERING_PRODUCTS', 'Ordering products')}</span>
|
|
642
642
|
</Button>
|
|
643
|
-
)}
|
|
643
|
+
)}
|
|
644
644
|
{sessionState?.user?.level === 0 && (
|
|
645
645
|
<Button
|
|
646
646
|
className='d-flex align-items-center'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
|
2
2
|
import Skeleton from 'react-loading-skeleton'
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
@@ -24,38 +24,19 @@ const BusinessessListingUI = (props) => {
|
|
|
24
24
|
getPageBusinesses,
|
|
25
25
|
isOpen,
|
|
26
26
|
close,
|
|
27
|
-
changeBusinessState
|
|
28
|
-
defaultPageSize
|
|
27
|
+
changeBusinessState
|
|
29
28
|
} = props
|
|
30
29
|
const [, t] = useLanguage()
|
|
31
30
|
const [{ optimizeImage }] = useUtils()
|
|
32
31
|
const dropdownReference = useRef()
|
|
33
|
-
const [businessesPerPage, setBusinessesPerPage] = useState(defaultPageSize ?? 6)
|
|
34
|
-
const [currentPage, setCurrentPage] = useState(1)
|
|
35
|
-
const [currentBusinessess, setCurrentBusinessess] = useState([])
|
|
36
|
-
const [totalPages, setTotalPages] = useState(null)
|
|
37
32
|
|
|
38
33
|
const handleChangePage = (page) => {
|
|
39
|
-
|
|
40
|
-
(pagination.from <= page * businessesPerPage && page * businessesPerPage > pagination.total)
|
|
41
|
-
) {
|
|
42
|
-
setCurrentPage(page)
|
|
43
|
-
} else {
|
|
44
|
-
getPageBusinesses(businessesPerPage, page)
|
|
45
|
-
}
|
|
34
|
+
getPageBusinesses(pagination.pageSize, page)
|
|
46
35
|
}
|
|
47
36
|
|
|
48
37
|
const handleChangePageSize = (pageSize) => {
|
|
49
|
-
setBusinessesPerPage(pageSize)
|
|
50
38
|
const expectedPage = Math.ceil(pagination.from / pageSize)
|
|
51
|
-
|
|
52
|
-
(pagination.from <= expectedPage * pageSize && expectedPage * pageSize > pagination.total)
|
|
53
|
-
) {
|
|
54
|
-
setCurrentPage(expectedPage)
|
|
55
|
-
} else {
|
|
56
|
-
setCurrentPage(expectedPage)
|
|
57
|
-
getPageBusinesses(pageSize, expectedPage)
|
|
58
|
-
}
|
|
39
|
+
getPageBusinesses(pageSize, expectedPage)
|
|
59
40
|
}
|
|
60
41
|
|
|
61
42
|
const closeSelect = (e) => {
|
|
@@ -67,25 +48,10 @@ const BusinessessListingUI = (props) => {
|
|
|
67
48
|
}
|
|
68
49
|
}
|
|
69
50
|
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (businessList.loading) return
|
|
72
|
-
let _totalPages
|
|
73
|
-
if (pagination?.total) {
|
|
74
|
-
_totalPages = Math.ceil(pagination?.total / businessesPerPage)
|
|
75
|
-
} else if (businessList.businesses.length > 0) {
|
|
76
|
-
_totalPages = Math.ceil(businessList.businesses.length / businessesPerPage)
|
|
77
|
-
}
|
|
78
|
-
const indexOfLastPost = currentPage * businessesPerPage
|
|
79
|
-
const indexOfFirstPost = indexOfLastPost - businessesPerPage
|
|
80
|
-
const _currentBusinessess = businessList.businesses.slice(indexOfFirstPost, indexOfLastPost)
|
|
81
|
-
setTotalPages(_totalPages)
|
|
82
|
-
setCurrentBusinessess(_currentBusinessess)
|
|
83
|
-
}, [businessList, currentPage, pagination, businessesPerPage])
|
|
84
|
-
|
|
85
51
|
useEffect(() => {
|
|
86
52
|
if (!isOpen) return
|
|
87
|
-
document.addEventListener('
|
|
88
|
-
return () => document.removeEventListener('
|
|
53
|
+
document.addEventListener('mouseup', closeSelect)
|
|
54
|
+
return () => document.removeEventListener('mouseup', closeSelect)
|
|
89
55
|
}, [isOpen])
|
|
90
56
|
|
|
91
57
|
return (
|
|
@@ -102,36 +68,37 @@ const BusinessessListingUI = (props) => {
|
|
|
102
68
|
</BusinessSearch>
|
|
103
69
|
<BusinessList>
|
|
104
70
|
{businessList.loading ? (
|
|
105
|
-
[...Array(
|
|
71
|
+
[...Array(pagination.pageSize).keys()].map(i => (
|
|
106
72
|
<OptionItem key={i}>
|
|
107
73
|
<Skeleton width={38} height={38} style={{ borderRadius: '7.6px' }} />
|
|
108
74
|
<div style={{ marginLeft: '8px', marginRight: '8px' }}>
|
|
109
|
-
<Skeleton height={15} width={
|
|
75
|
+
<Skeleton height={15} width={140} />
|
|
110
76
|
<Skeleton height={12} width={80} style={{ marginTop: '7px' }} />
|
|
111
77
|
</div>
|
|
112
78
|
</OptionItem>
|
|
113
79
|
))
|
|
114
80
|
) : (
|
|
115
81
|
<>
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
82
|
+
{businessList.businesses.map(business => (
|
|
83
|
+
<OptionItem key={business.id} onClick={() => changeBusinessState(business)}>
|
|
84
|
+
<img src={optimizeImage(business?.logo, 'h_50,c_limit')} alt='' />
|
|
85
|
+
<div>
|
|
86
|
+
<b>{business?.name}</b>
|
|
87
|
+
<p>{business?.city?.name}</p>
|
|
88
|
+
</div>
|
|
89
|
+
</OptionItem>
|
|
90
|
+
))}
|
|
124
91
|
</>
|
|
125
92
|
)}
|
|
126
93
|
</BusinessList>
|
|
127
94
|
{pagination && (
|
|
128
95
|
<WrapperPagination className='pagination-container'>
|
|
129
|
-
{
|
|
96
|
+
{pagination?.total && (
|
|
130
97
|
<Pagination
|
|
131
|
-
currentPage={currentPage}
|
|
132
|
-
totalPages={
|
|
98
|
+
currentPage={pagination.currentPage}
|
|
99
|
+
totalPages={Math.ceil(pagination?.total / pagination.pageSize)}
|
|
133
100
|
handleChangePage={handleChangePage}
|
|
134
|
-
defaultPageSize={
|
|
101
|
+
defaultPageSize={pagination.pageSize}
|
|
135
102
|
handleChangePageSize={handleChangePageSize}
|
|
136
103
|
isHidePagecontrol
|
|
137
104
|
/>
|
|
@@ -148,8 +115,10 @@ export const BusinessSelectHeader = (props) => {
|
|
|
148
115
|
...props,
|
|
149
116
|
UIComponent: BusinessessListingUI,
|
|
150
117
|
asDashboard: true,
|
|
151
|
-
|
|
152
|
-
|
|
118
|
+
loadMorePageSize: props.defaultPageSize ?? 6,
|
|
119
|
+
paginationSettings: {
|
|
120
|
+
pageSize: props.defaultPageSize ?? 6
|
|
121
|
+
},
|
|
153
122
|
isSearchByBusinessName: true,
|
|
154
123
|
isSearchByBusinessEmail: true,
|
|
155
124
|
isSearchByBusinessPhone: true,
|
|
@@ -4,7 +4,7 @@ export const PopMenuContatiner = styled.div`
|
|
|
4
4
|
position: absolute;
|
|
5
5
|
left:0px;
|
|
6
6
|
background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
|
|
7
|
-
width:
|
|
7
|
+
width: 280px;
|
|
8
8
|
border: 1px solid #E9ECEF;
|
|
9
9
|
box-sizing: border-box;
|
|
10
10
|
box-shadow: 0px 4px 10px rgb(0 0 0 / 12%);
|
|
@@ -53,34 +53,39 @@ export const OptionItem = styled.div`
|
|
|
53
53
|
margin-left: 8px;
|
|
54
54
|
`}
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
> div {
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: column;
|
|
59
|
-
|
|
60
|
-
max-width: 170px;
|
|
61
|
-
text-overflow: ellipsis;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
color: ${props => props.theme.colors.textGray};
|
|
59
|
+
max-width: 210px;
|
|
65
60
|
b {
|
|
66
61
|
font-size: 14px;
|
|
67
62
|
line-height: 20px;
|
|
68
63
|
font-weight: 400;
|
|
69
64
|
color: ${props => props.theme.colors.textBlack};
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
}
|
|
69
|
+
p {
|
|
70
|
+
margin: 0;
|
|
71
|
+
font-size: 12px;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
color: ${props => props.theme.colors.textGray};
|
|
70
76
|
}
|
|
71
77
|
}
|
|
78
|
+
span {
|
|
79
|
+
display: flex;
|
|
80
|
+
}
|
|
72
81
|
`
|
|
73
82
|
export const BusinessList = styled.div`
|
|
74
83
|
`
|
|
75
84
|
export const WrapperPagination = styled.div`
|
|
76
|
-
display: flex;
|
|
77
|
-
justify-content: flex-end;
|
|
78
85
|
margin-top: 10px;
|
|
79
86
|
>div>div{
|
|
80
87
|
margin: 0;
|
|
81
88
|
button {
|
|
82
|
-
width: 20px;
|
|
83
|
-
height: 20px;
|
|
84
89
|
font-size: 12px;
|
|
85
90
|
}
|
|
86
91
|
}
|