ordering-ui-admin-external 1.40.5 → 1.40.7
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.79529368a9955be3ce9e.js → ordering-ui-admin.dfe73eabfdf7ae04cad1.js} +2 -2
- package/_modules/components/Orders/OrderBill/index.js +2 -1
- package/_modules/components/Orders/ProductItemAccordion/index.js +5 -3
- package/_modules/components/Settings/AddressFieldsSetting/index.js +119 -12
- package/_modules/components/Settings/AddressFieldsSetting/styles.js +31 -6
- package/_modules/components/Settings/CardFieldsSetting/index.js +120 -12
- package/_modules/components/Settings/CardFieldsSetting/styles.js +31 -6
- package/_modules/components/Settings/CheckoutFieldsSetting/index.js +117 -11
- package/_modules/components/Settings/CheckoutFieldsSetting/styles.js +32 -7
- package/_modules/components/Settings/GuestCheckoutFieldsSetting/index.js +19 -1
- package/_modules/components/Settings/GuestCheckoutFieldsSetting/styles.js +1 -1
- package/_modules/components/Settings/Settings/index.js +97 -10
- package/package.json +2 -2
- package/src/components/Orders/OrderBill/index.js +2 -1
- package/src/components/Orders/ProductItemAccordion/index.js +3 -3
- package/src/components/Settings/AddressFieldsSetting/index.js +159 -45
- package/src/components/Settings/AddressFieldsSetting/styles.js +60 -0
- package/src/components/Settings/CardFieldsSetting/index.js +161 -46
- package/src/components/Settings/CardFieldsSetting/styles.js +60 -0
- package/src/components/Settings/CheckoutFieldsSetting/index.js +157 -44
- package/src/components/Settings/CheckoutFieldsSetting/styles.js +64 -0
- package/src/components/Settings/GuestCheckoutFieldsSetting/index.js +10 -0
- package/src/components/Settings/GuestCheckoutFieldsSetting/styles.js +7 -0
- package/src/components/Settings/Settings/index.js +90 -15
- /package/_bundles/{ordering-ui-admin.79529368a9955be3ce9e.js.LICENSE.txt → ordering-ui-admin.dfe73eabfdf7ae04cad1.js.LICENSE.txt} +0 -0
|
@@ -1,72 +1,186 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
2
|
import { useLanguage, AddressFieldsSetting as AddressFieldsSettingController } from 'ordering-components-admin-external'
|
|
3
|
-
import {
|
|
3
|
+
import { useHistory, useLocation } from 'react-router-dom'
|
|
4
|
+
import { Switch, IconButton } from '../../../styles'
|
|
4
5
|
import Skeleton from 'react-loading-skeleton'
|
|
6
|
+
import { SideBar, Alert } from '../../Shared'
|
|
7
|
+
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
8
|
+
import BsChevronRight from '@meronex/icons/bs/BsChevronRight'
|
|
9
|
+
import { ArrowsAngleContract, ArrowsAngleExpand } from 'react-bootstrap-icons'
|
|
5
10
|
|
|
6
11
|
import {
|
|
7
12
|
AddressFieldsDetailsContainer,
|
|
8
|
-
FieldContainer
|
|
13
|
+
FieldContainer,
|
|
14
|
+
SitesListContainer,
|
|
15
|
+
Header,
|
|
16
|
+
SitesWrapper,
|
|
17
|
+
SiteItem
|
|
9
18
|
} from './styles'
|
|
10
19
|
|
|
11
20
|
const AddressFieldsSettingUI = (props) => {
|
|
12
21
|
const {
|
|
13
|
-
|
|
14
|
-
handleChangeFieldSetting
|
|
22
|
+
validationFieldState,
|
|
23
|
+
handleChangeFieldSetting,
|
|
24
|
+
sitesState,
|
|
25
|
+
setMoveDistance,
|
|
26
|
+
selectedSiteId,
|
|
27
|
+
setSelectedSiteId,
|
|
28
|
+
actionState
|
|
15
29
|
} = props
|
|
16
30
|
|
|
17
31
|
const [, t] = useLanguage()
|
|
32
|
+
const { width } = useWindowSize()
|
|
33
|
+
const history = useHistory()
|
|
34
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
35
|
+
const query = new URLSearchParams(useLocation().search)
|
|
36
|
+
|
|
37
|
+
const [isExpand, setIsExpand] = useState(false)
|
|
38
|
+
|
|
39
|
+
const orderValidationFields = ['address', 'address_note', 'internal_number', 'zipcode']
|
|
40
|
+
|
|
41
|
+
const handleOpenSiteSettingDetails = (siteId, isInitialRender) => {
|
|
42
|
+
// handleGetSiteConfigs(siteId)
|
|
43
|
+
setSelectedSiteId(siteId)
|
|
44
|
+
setMoveDistance(500)
|
|
45
|
+
if (!isInitialRender) {
|
|
46
|
+
const category = query.get('category')
|
|
47
|
+
history.replace(`${location.pathname}?category=${category}&site=${siteId}`)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const expandSideBar = () => {
|
|
52
|
+
const element = document.getElementById('sideSlider')
|
|
53
|
+
if (isExpand) element.style.width = '500px'
|
|
54
|
+
else element.style.width = '100vw'
|
|
55
|
+
setIsExpand(prev => !prev)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const handleCloseDetails = () => {
|
|
59
|
+
setSelectedSiteId(null)
|
|
60
|
+
setMoveDistance(0)
|
|
61
|
+
const category = query.get('category')
|
|
62
|
+
history.replace(`${location.pathname}?category=${category}`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!actionState?.error) return
|
|
67
|
+
setAlertState({
|
|
68
|
+
open: true,
|
|
69
|
+
content: actionState?.error
|
|
70
|
+
})
|
|
71
|
+
}, [actionState?.error])
|
|
18
72
|
|
|
19
73
|
return (
|
|
20
74
|
<>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
<SitesListContainer>
|
|
76
|
+
<Header>
|
|
77
|
+
<h1>{t('ADDRESS_FIELDS', 'Address fields')}</h1>
|
|
78
|
+
{width > 576 && !selectedSiteId && (
|
|
79
|
+
<IconButton
|
|
80
|
+
color='black'
|
|
81
|
+
onClick={expandSideBar}
|
|
82
|
+
>
|
|
83
|
+
{isExpand ? <ArrowsAngleContract /> : <ArrowsAngleExpand />}
|
|
84
|
+
</IconButton>
|
|
85
|
+
)}
|
|
86
|
+
</Header>
|
|
87
|
+
{sitesState.loading ? (
|
|
88
|
+
<SitesWrapper>
|
|
89
|
+
{[...Array(5).keys()].map(i => (
|
|
90
|
+
<SiteItem key={i}>
|
|
91
|
+
<Skeleton width={100} height={14} />
|
|
92
|
+
</SiteItem>
|
|
93
|
+
))}
|
|
94
|
+
</SitesWrapper>
|
|
40
95
|
) : (
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</div>
|
|
52
|
-
<div className='status'>
|
|
53
|
-
<Switch
|
|
54
|
-
defaultChecked={field.enabled}
|
|
55
|
-
disabled={field.code === 'email'}
|
|
56
|
-
onChange={(val) => handleChangeFieldSetting(field.id, { enabled: val })}
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
</FieldContainer>
|
|
96
|
+
<SitesWrapper>
|
|
97
|
+
{sitesState.sites.map(site => (
|
|
98
|
+
<SiteItem
|
|
99
|
+
key={site.id}
|
|
100
|
+
active={site.id === selectedSiteId}
|
|
101
|
+
onClick={() => handleOpenSiteSettingDetails(site.id)}
|
|
102
|
+
>
|
|
103
|
+
<span>{site.name}</span>
|
|
104
|
+
<BsChevronRight />
|
|
105
|
+
</SiteItem>
|
|
60
106
|
))}
|
|
61
|
-
|
|
107
|
+
</SitesWrapper>
|
|
62
108
|
)}
|
|
63
|
-
</
|
|
109
|
+
</SitesListContainer>
|
|
110
|
+
{selectedSiteId && (
|
|
111
|
+
<SideBar
|
|
112
|
+
isBorderShow
|
|
113
|
+
open={selectedSiteId}
|
|
114
|
+
onClose={() => handleCloseDetails()}
|
|
115
|
+
>
|
|
116
|
+
<AddressFieldsDetailsContainer>
|
|
117
|
+
<h1>{t('SETTINGS', 'Settings')}</h1>
|
|
118
|
+
<FieldContainer isHeader>
|
|
119
|
+
<div className='name'>{t('FIELD', 'Field')}</div>
|
|
120
|
+
<div className='required'>{t('REQUIRED', 'Required')}</div>
|
|
121
|
+
<div className='status'>{t('STATE', 'Status')}</div>
|
|
122
|
+
</FieldContainer>
|
|
123
|
+
{(actionState?.loading && actionState?.isPost) ? (
|
|
124
|
+
[...Array(10).keys()].map(i => (
|
|
125
|
+
<FieldContainer key={i}>
|
|
126
|
+
<div className='name'><Skeleton width={120} /></div>
|
|
127
|
+
<div className='required'>
|
|
128
|
+
<Skeleton width={30} style={{ borderRadius: 20 }} />
|
|
129
|
+
</div>
|
|
130
|
+
<div className='status'>
|
|
131
|
+
<Skeleton width={30} style={{ borderRadius: 20 }} />
|
|
132
|
+
</div>
|
|
133
|
+
</FieldContainer>
|
|
134
|
+
))
|
|
135
|
+
) : (
|
|
136
|
+
<>
|
|
137
|
+
{validationFieldState.fields
|
|
138
|
+
.filter(item => item?.site_id === parseInt(selectedSiteId))
|
|
139
|
+
.sort((a, b) => {
|
|
140
|
+
const indexA = orderValidationFields.indexOf(a?.validation_field.code)
|
|
141
|
+
const indexB = orderValidationFields.indexOf(b?.validation_field.code)
|
|
142
|
+
return indexA - indexB
|
|
143
|
+
})
|
|
144
|
+
.map(field => (
|
|
145
|
+
<FieldContainer key={field.id}>
|
|
146
|
+
<div className='name'>{t(field?.validation_field?.code.toUpperCase())}</div>
|
|
147
|
+
<div className='required'>
|
|
148
|
+
<Switch
|
|
149
|
+
defaultChecked={field.required}
|
|
150
|
+
disabled={field?.validation_field?.code === 'email'}
|
|
151
|
+
onChange={(val) => handleChangeFieldSetting(field.validation_field_id, selectedSiteId, { required: val })}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
<div className='status'>
|
|
155
|
+
<Switch
|
|
156
|
+
defaultChecked={field.enabled}
|
|
157
|
+
disabled={field?.validation_field?.code === 'email'}
|
|
158
|
+
onChange={(val) => handleChangeFieldSetting(field.validation_field_id, selectedSiteId, { enabled: val })}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</FieldContainer>
|
|
162
|
+
))}
|
|
163
|
+
</>
|
|
164
|
+
)}
|
|
165
|
+
</AddressFieldsDetailsContainer>
|
|
166
|
+
</SideBar>
|
|
167
|
+
)}
|
|
168
|
+
<Alert
|
|
169
|
+
title={t('WEB_APPNAME', 'Ordering')}
|
|
170
|
+
content={alertState.content}
|
|
171
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
172
|
+
open={alertState.open}
|
|
173
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
174
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
175
|
+
closeOnBackdrop={false}
|
|
176
|
+
/>
|
|
64
177
|
</>
|
|
65
178
|
)
|
|
66
179
|
}
|
|
67
180
|
export const AddressFieldsSetting = (props) => {
|
|
68
181
|
const addressFieldsProps = {
|
|
69
182
|
...props,
|
|
183
|
+
code: 'address',
|
|
70
184
|
UIComponent: AddressFieldsSettingUI
|
|
71
185
|
}
|
|
72
186
|
return <AddressFieldsSettingController {...addressFieldsProps} />
|
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components'
|
|
2
2
|
|
|
3
|
+
export const SitesListContainer = styled.div`
|
|
4
|
+
padding: 20px;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
`
|
|
9
|
+
|
|
10
|
+
export const Header = styled.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
h1 {
|
|
15
|
+
font-weight: 700;
|
|
16
|
+
font-size: 20px;
|
|
17
|
+
margin: 0;
|
|
18
|
+
}
|
|
19
|
+
margin-right: 35px;
|
|
20
|
+
${props => props.theme.rtl && css`
|
|
21
|
+
margin-left: 35px;
|
|
22
|
+
margin-right: 0;
|
|
23
|
+
`}
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
export const SitesWrapper = styled.div`
|
|
27
|
+
margin-top: 35px;
|
|
28
|
+
border: 1px solid ${props => props.theme.colors.borderColor};
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
> div:first-child {
|
|
32
|
+
border-top: none !important;
|
|
33
|
+
}
|
|
34
|
+
> div:last-child {
|
|
35
|
+
border-bottom: none !important;
|
|
36
|
+
}
|
|
37
|
+
`
|
|
38
|
+
export const SiteItem = styled.div`
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
padding: 12px 15px;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
color: ${props => props.theme.colors.lightGray};
|
|
45
|
+
border-bottom: 1px solid ${props => props.theme.colors.borderColor};
|
|
46
|
+
&:hover {
|
|
47
|
+
background-color: ${props => props.theme.colors.lightPrimary};
|
|
48
|
+
}
|
|
49
|
+
span {
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
}
|
|
52
|
+
svg {
|
|
53
|
+
font-size: 20px;
|
|
54
|
+
}
|
|
55
|
+
${({ active }) => active && css`
|
|
56
|
+
color: ${props => props.theme.colors.headingColor};
|
|
57
|
+
border-top: 1px solid ${props => props.theme.colors.primary};
|
|
58
|
+
border-bottom: 1px solid ${props => props.theme.colors.primary} !important;
|
|
59
|
+
background-color: ${props => props.theme.colors.lightPrimary};
|
|
60
|
+
`}
|
|
61
|
+
`
|
|
62
|
+
|
|
3
63
|
export const AddressFieldsDetailsContainer = styled.div`
|
|
4
64
|
padding: 26px 40px;
|
|
5
65
|
box-sizing: border-box;
|
|
@@ -1,72 +1,187 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useLanguage,
|
|
3
|
-
import {
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useLanguage, AddressFieldsSetting as AddressFieldsSettingController } from 'ordering-components-admin-external'
|
|
3
|
+
import { useHistory, useLocation } from 'react-router-dom'
|
|
4
|
+
import { Switch, IconButton } from '../../../styles'
|
|
4
5
|
import Skeleton from 'react-loading-skeleton'
|
|
6
|
+
import { SideBar, Alert } from '../../Shared'
|
|
7
|
+
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
8
|
+
import BsChevronRight from '@meronex/icons/bs/BsChevronRight'
|
|
9
|
+
import { ArrowsAngleContract, ArrowsAngleExpand } from 'react-bootstrap-icons'
|
|
5
10
|
|
|
6
11
|
import {
|
|
7
12
|
CardFieldsDetailsContainer,
|
|
8
|
-
FieldContainer
|
|
13
|
+
FieldContainer,
|
|
14
|
+
SitesListContainer,
|
|
15
|
+
Header,
|
|
16
|
+
SitesWrapper,
|
|
17
|
+
SiteItem
|
|
9
18
|
} from './styles'
|
|
10
19
|
|
|
11
20
|
const CardFieldsSettingUI = (props) => {
|
|
12
21
|
const {
|
|
13
|
-
|
|
14
|
-
handleChangeFieldSetting
|
|
22
|
+
validationFieldState,
|
|
23
|
+
handleChangeFieldSetting,
|
|
24
|
+
sitesState,
|
|
25
|
+
setMoveDistance,
|
|
26
|
+
selectedSiteId,
|
|
27
|
+
setSelectedSiteId,
|
|
28
|
+
actionState
|
|
15
29
|
} = props
|
|
16
30
|
|
|
17
31
|
const [, t] = useLanguage()
|
|
32
|
+
const { width } = useWindowSize()
|
|
33
|
+
const history = useHistory()
|
|
34
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
35
|
+
const query = new URLSearchParams(useLocation().search)
|
|
36
|
+
|
|
37
|
+
const [isExpand, setIsExpand] = useState(false)
|
|
38
|
+
|
|
39
|
+
const orderValidationFields = ['address', 'address_note', 'internal_number', 'zipcode']
|
|
40
|
+
|
|
41
|
+
const handleOpenSiteSettingDetails = (siteId, isInitialRender) => {
|
|
42
|
+
// handleGetSiteConfigs(siteId)
|
|
43
|
+
setSelectedSiteId(siteId)
|
|
44
|
+
setMoveDistance(500)
|
|
45
|
+
if (!isInitialRender) {
|
|
46
|
+
const category = query.get('category')
|
|
47
|
+
history.replace(`${location.pathname}?category=${category}&site=${siteId}`)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const expandSideBar = () => {
|
|
52
|
+
const element = document.getElementById('sideSlider')
|
|
53
|
+
if (isExpand) element.style.width = '500px'
|
|
54
|
+
else element.style.width = '100vw'
|
|
55
|
+
setIsExpand(prev => !prev)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const handleCloseDetails = () => {
|
|
59
|
+
setSelectedSiteId(null)
|
|
60
|
+
setMoveDistance(0)
|
|
61
|
+
const category = query.get('category')
|
|
62
|
+
history.replace(`${location.pathname}?category=${category}`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!actionState?.error) return
|
|
67
|
+
setAlertState({
|
|
68
|
+
open: true,
|
|
69
|
+
content: actionState?.error
|
|
70
|
+
})
|
|
71
|
+
}, [actionState?.error])
|
|
18
72
|
|
|
19
73
|
return (
|
|
20
74
|
<>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
<SitesListContainer>
|
|
76
|
+
<Header>
|
|
77
|
+
<h1>{t('CARD_FIELDS', 'Card fields')}</h1>
|
|
78
|
+
{width > 576 && !selectedSiteId && (
|
|
79
|
+
<IconButton
|
|
80
|
+
color='black'
|
|
81
|
+
onClick={expandSideBar}
|
|
82
|
+
>
|
|
83
|
+
{isExpand ? <ArrowsAngleContract /> : <ArrowsAngleExpand />}
|
|
84
|
+
</IconButton>
|
|
85
|
+
)}
|
|
86
|
+
</Header>
|
|
87
|
+
{sitesState.loading ? (
|
|
88
|
+
<SitesWrapper>
|
|
89
|
+
{[...Array(5).keys()].map(i => (
|
|
90
|
+
<SiteItem key={i}>
|
|
91
|
+
<Skeleton width={100} height={14} />
|
|
92
|
+
</SiteItem>
|
|
93
|
+
))}
|
|
94
|
+
</SitesWrapper>
|
|
40
95
|
) : (
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<div className='status'>
|
|
52
|
-
<Switch
|
|
53
|
-
defaultChecked={field.enabled}
|
|
54
|
-
disabled={field.code === 'email'}
|
|
55
|
-
onChange={(val) => handleChangeFieldSetting(field.id, { enabled: val })}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
</FieldContainer>
|
|
96
|
+
<SitesWrapper>
|
|
97
|
+
{sitesState.sites.map(site => (
|
|
98
|
+
<SiteItem
|
|
99
|
+
key={site.id}
|
|
100
|
+
active={site.id === selectedSiteId}
|
|
101
|
+
onClick={() => handleOpenSiteSettingDetails(site.id)}
|
|
102
|
+
>
|
|
103
|
+
<span>{site.name}</span>
|
|
104
|
+
<BsChevronRight />
|
|
105
|
+
</SiteItem>
|
|
59
106
|
))}
|
|
60
|
-
|
|
107
|
+
</SitesWrapper>
|
|
61
108
|
)}
|
|
62
|
-
</
|
|
109
|
+
</SitesListContainer>
|
|
110
|
+
{selectedSiteId && (
|
|
111
|
+
<SideBar
|
|
112
|
+
isBorderShow
|
|
113
|
+
open={selectedSiteId}
|
|
114
|
+
onClose={() => handleCloseDetails()}
|
|
115
|
+
>
|
|
116
|
+
<CardFieldsDetailsContainer>
|
|
117
|
+
<h1>{t('SETTINGS', 'Settings')}</h1>
|
|
118
|
+
<FieldContainer isHeader>
|
|
119
|
+
<div className='name'>{t('FIELD', 'Field')}</div>
|
|
120
|
+
<div className='required'>{t('REQUIRED', 'Required')}</div>
|
|
121
|
+
<div className='status'>{t('STATE', 'Status')}</div>
|
|
122
|
+
</FieldContainer>
|
|
123
|
+
{(actionState?.loading && actionState?.isPost) ? (
|
|
124
|
+
[...Array(10).keys()].map(i => (
|
|
125
|
+
<FieldContainer key={i}>
|
|
126
|
+
<div className='name'><Skeleton width={120} /></div>
|
|
127
|
+
<div className='required'>
|
|
128
|
+
<Skeleton width={30} style={{ borderRadius: 20 }} />
|
|
129
|
+
</div>
|
|
130
|
+
<div className='status'>
|
|
131
|
+
<Skeleton width={30} style={{ borderRadius: 20 }} />
|
|
132
|
+
</div>
|
|
133
|
+
</FieldContainer>
|
|
134
|
+
))
|
|
135
|
+
) : (
|
|
136
|
+
<>
|
|
137
|
+
{validationFieldState.fields
|
|
138
|
+
.filter(item => item?.site_id === parseInt(selectedSiteId))
|
|
139
|
+
.sort((a, b) => {
|
|
140
|
+
const indexA = orderValidationFields.indexOf(a?.validation_field.code)
|
|
141
|
+
const indexB = orderValidationFields.indexOf(b?.validation_field.code)
|
|
142
|
+
return indexA - indexB
|
|
143
|
+
})
|
|
144
|
+
.map(field => (
|
|
145
|
+
<FieldContainer key={field.id}>
|
|
146
|
+
<div className='name'>{t(field?.validation_field?.code.toUpperCase())}</div>
|
|
147
|
+
<div className='required'>
|
|
148
|
+
<Switch
|
|
149
|
+
defaultChecked={field.required}
|
|
150
|
+
disabled={field?.validation_field?.code === 'email'}
|
|
151
|
+
onChange={(val) => handleChangeFieldSetting(field.validation_field_id, selectedSiteId, { required: val })}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
<div className='status'>
|
|
155
|
+
<Switch
|
|
156
|
+
defaultChecked={field.enabled}
|
|
157
|
+
disabled={field?.validation_field?.code === 'email'}
|
|
158
|
+
onChange={(val) => handleChangeFieldSetting(field.validation_field_id, selectedSiteId, { enabled: val })}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</FieldContainer>
|
|
162
|
+
))}
|
|
163
|
+
</>
|
|
164
|
+
)}
|
|
165
|
+
</CardFieldsDetailsContainer>
|
|
166
|
+
</SideBar>
|
|
167
|
+
)}
|
|
168
|
+
<Alert
|
|
169
|
+
title={t('WEB_APPNAME', 'Ordering')}
|
|
170
|
+
content={alertState.content}
|
|
171
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
172
|
+
open={alertState.open}
|
|
173
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
174
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
175
|
+
closeOnBackdrop={false}
|
|
176
|
+
/>
|
|
63
177
|
</>
|
|
64
178
|
)
|
|
65
179
|
}
|
|
66
180
|
export const CardFieldsSetting = (props) => {
|
|
67
181
|
const cardFieldsProps = {
|
|
68
182
|
...props,
|
|
183
|
+
code: 'card',
|
|
69
184
|
UIComponent: CardFieldsSettingUI
|
|
70
185
|
}
|
|
71
|
-
return <
|
|
186
|
+
return <AddressFieldsSettingController {...cardFieldsProps} />
|
|
72
187
|
}
|
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components'
|
|
2
2
|
|
|
3
|
+
export const SitesListContainer = styled.div`
|
|
4
|
+
padding: 20px;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
`
|
|
9
|
+
|
|
10
|
+
export const Header = styled.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
h1 {
|
|
15
|
+
font-weight: 700;
|
|
16
|
+
font-size: 20px;
|
|
17
|
+
margin: 0;
|
|
18
|
+
}
|
|
19
|
+
margin-right: 35px;
|
|
20
|
+
${props => props.theme.rtl && css`
|
|
21
|
+
margin-left: 35px;
|
|
22
|
+
margin-right: 0;
|
|
23
|
+
`}
|
|
24
|
+
`
|
|
25
|
+
|
|
26
|
+
export const SitesWrapper = styled.div`
|
|
27
|
+
margin-top: 35px;
|
|
28
|
+
border: 1px solid ${props => props.theme.colors.borderColor};
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
> div:first-child {
|
|
32
|
+
border-top: none !important;
|
|
33
|
+
}
|
|
34
|
+
> div:last-child {
|
|
35
|
+
border-bottom: none !important;
|
|
36
|
+
}
|
|
37
|
+
`
|
|
38
|
+
export const SiteItem = styled.div`
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
padding: 12px 15px;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
color: ${props => props.theme.colors.lightGray};
|
|
45
|
+
border-bottom: 1px solid ${props => props.theme.colors.borderColor};
|
|
46
|
+
&:hover {
|
|
47
|
+
background-color: ${props => props.theme.colors.lightPrimary};
|
|
48
|
+
}
|
|
49
|
+
span {
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
}
|
|
52
|
+
svg {
|
|
53
|
+
font-size: 20px;
|
|
54
|
+
}
|
|
55
|
+
${({ active }) => active && css`
|
|
56
|
+
color: ${props => props.theme.colors.headingColor};
|
|
57
|
+
border-top: 1px solid ${props => props.theme.colors.primary};
|
|
58
|
+
border-bottom: 1px solid ${props => props.theme.colors.primary} !important;
|
|
59
|
+
background-color: ${props => props.theme.colors.lightPrimary};
|
|
60
|
+
`}
|
|
61
|
+
`
|
|
62
|
+
|
|
3
63
|
export const CardFieldsDetailsContainer = styled.div`
|
|
4
64
|
padding: 26px 40px;
|
|
5
65
|
box-sizing: border-box;
|