ordering-ui-admin-external 1.2.0 → 1.3.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.
- package/_bundles/main.css +2 -2
- package/_bundles/{ordering-ui-admin.509785f9d6ed069b4b5d.js → ordering-ui-admin.977451ddd1e3c8d3a2d7.js} +2 -2
- package/_bundles/{ordering-ui-admin.509785f9d6ed069b4b5d.js.LICENSE.txt → ordering-ui-admin.977451ddd1e3c8d3a2d7.js.LICENSE.txt} +10 -4
- package/_modules/components/BusinessIntelligence/Reports/index.js +27 -3
- package/_modules/components/BusinessIntelligence/Reports/styles.js +9 -2
- package/_modules/components/BusinessIntelligence/ReviewsListing/index.js +9 -1
- package/_modules/components/DisabledFeatureAlert/index.js +63 -0
- package/_modules/components/DisabledFeatureAlert/styles.js +42 -0
- package/_modules/components/Loyalty/RewardsPrograms/index.js +38 -12
- package/_modules/components/Loyalty/RewardsPrograms/styles.js +13 -6
- package/_modules/components/Marketing/CampaignHeader/index.js +5 -2
- package/_modules/components/Marketing/CampaignHeader/styles.js +7 -4
- package/_modules/components/Marketing/CampaignList/index.js +8 -4
- package/_modules/components/Marketing/CampaignList/styles.js +30 -22
- package/_modules/components/Marketing/CampaignListing/index.js +29 -3
- package/_modules/components/Marketing/EnterprisePromotionListing/index.js +46 -22
- package/_modules/components/Marketing/EnterprisePromotionListing/styles.js +1 -1
- package/_modules/components/OrderingProducts/OrderingProductDetails/index.js +24 -426
- package/_modules/components/OrderingProducts/OrderingProductDetails/styles.js +35 -114
- package/_modules/components/OrderingProducts/OrderingProductGeneralDetails/index.js +480 -0
- package/_modules/components/OrderingProducts/OrderingProductGeneralDetails/styles.js +127 -0
- package/_modules/components/OrderingProducts/OrderingProductsListing/index.js +3 -1
- package/_modules/components/OrderingProducts/OrderingProductsListing/styles.js +23 -3
- package/_modules/components/OrderingProducts/SiteTheme/ThemeComponent.js +119 -0
- package/_modules/components/OrderingProducts/SiteTheme/ThemeImage.js +267 -0
- package/_modules/components/OrderingProducts/SiteTheme/ThemeOption.js +135 -0
- package/_modules/components/OrderingProducts/SiteTheme/index.js +266 -0
- package/_modules/components/OrderingProducts/SiteTheme/styles.js +114 -0
- package/_modules/components/Orders/CountryFilter/index.js +114 -0
- package/_modules/components/Orders/CountryFilter/styles.js +34 -0
- package/_modules/components/Orders/CurrencyFilter/index.js +114 -0
- package/_modules/components/Orders/CurrencyFilter/styles.js +34 -0
- package/_modules/components/Orders/DeliveriesLocation/index.js +22 -12
- package/_modules/components/Orders/DriversLocation/index.js +13 -7
- package/_modules/components/Orders/OrdersFilterGroup/index.js +13 -1
- package/_modules/components/Orders/OrdersListing/index.js +8 -2
- package/_modules/components/Orders/OrdersTable/index.js +296 -174
- package/_modules/components/Orders/OrdersTable/styles.js +30 -4
- package/_modules/components/Orders/index.js +9 -1
- package/_modules/components/Settings/SettingItemUI/index.js +3 -1
- package/_modules/components/Settings/SettingItemUI/styles.js +18 -11
- package/_modules/components/Settings/Settings/index.js +1 -11
- package/_modules/components/Settings/SettingsDetail/index.js +40 -3
- package/_modules/components/Settings/SettingsDetail/styles.js +27 -8
- package/_modules/components/Settings/SettingsList/index.js +43 -6
- package/_modules/components/Shared/ColorPicker/styles.js +3 -1
- package/_modules/components/Shared/ColumnAllowSettingPopover/index.js +4 -2
- package/_modules/components/Shared/SearchBar/index.js +4 -2
- package/_modules/components/SidebarMenu/index.js +25 -14
- package/_modules/components/SidebarMenu/styles.js +19 -9
- package/_modules/components/Stores/BusinessMenu/index.js +36 -5
- package/_modules/components/Stores/BusinessMenu/styles.js +27 -16
- package/_modules/components/Stores/BusinessMenuOptions/styles.js +9 -4
- package/_modules/components/Stores/BusinessPaymentMethods/index.js +53 -16
- package/_modules/components/Stores/BusinessProductList/index.js +7 -10
- package/_modules/components/Stores/BusinessProductsCategories/index.js +2 -2
- package/_modules/components/Stores/BusinessProductsListing/index.js +44 -21
- package/_modules/components/Stores/BusinessProductsListing/styles.js +20 -16
- package/_modules/components/Stores/BusinessesListing/index.js +4 -1
- package/_modules/components/Stores/BusinessesListingHeader/index.js +20 -3
- package/_modules/components/Stores/BusinessesListingHeader/styles.js +6 -2
- package/_modules/components/Stores/ImportersList/index.js +5 -2
- package/_modules/components/Stores/ImportersList/styles.js +18 -15
- package/_modules/components/Stores/ImportersListing/index.js +31 -4
- package/_modules/components/Stores/PaymentOption/index.js +12 -7
- package/_modules/components/Stores/PaymentOption/styles.js +9 -4
- package/_modules/components/Stores/PaymentOptionMethods/index.js +9 -4
- package/_modules/components/Stores/PaymentOptionMethods/styles.js +10 -5
- package/_modules/components/Stores/PaymentOptionPaypal/index.js +9 -4
- package/_modules/components/Stores/PaymentOptionSquare/index.js +10 -5
- package/_modules/components/Stores/PaymentOptionStripeDirect/index.js +10 -5
- package/_modules/components/Stores/PaymentOptionStripeDirect/styles.js +10 -5
- package/_modules/components/Stores/PaymethodOptionPaypalExpress/index.js +9 -4
- package/_modules/components/Stores/PaymethodOptionStripeConnect/index.js +9 -4
- package/_modules/components/Stores/PaymethodOptionStripeRedirect/index.js +9 -4
- package/_modules/components/Users/UsersList/index.js +8 -2
- package/_modules/components/Users/UsersList/styles.js +15 -12
- package/package.json +2 -2
- package/src/components/BusinessIntelligence/Reports/index.js +18 -4
- package/src/components/BusinessIntelligence/Reports/styles.js +11 -0
- package/src/components/BusinessIntelligence/ReviewsListing/index.js +12 -0
- package/src/components/DisabledFeatureAlert/index.js +37 -0
- package/src/components/DisabledFeatureAlert/styles.js +32 -0
- package/src/components/Loyalty/RewardsPrograms/index.js +18 -5
- package/src/components/Loyalty/RewardsPrograms/styles.js +10 -0
- package/src/components/Marketing/CampaignHeader/index.js +3 -2
- package/src/components/Marketing/CampaignHeader/styles.js +8 -0
- package/src/components/Marketing/CampaignList/index.js +5 -3
- package/src/components/Marketing/CampaignList/styles.js +16 -0
- package/src/components/Marketing/CampaignListing/index.js +18 -2
- package/src/components/Marketing/EnterprisePromotionListing/index.js +17 -4
- package/src/components/Marketing/EnterprisePromotionListing/styles.js +5 -1
- package/src/components/OrderingProducts/OrderingProductDetails/index.js +34 -497
- package/src/components/OrderingProducts/OrderingProductDetails/styles.js +38 -288
- package/src/components/OrderingProducts/OrderingProductGeneralDetails/index.js +514 -0
- package/src/components/OrderingProducts/OrderingProductGeneralDetails/styles.js +279 -0
- package/src/components/OrderingProducts/OrderingProductsListing/index.js +14 -2
- package/src/components/OrderingProducts/OrderingProductsListing/styles.js +62 -0
- package/src/components/OrderingProducts/SiteTheme/ThemeComponent.js +104 -0
- package/src/components/OrderingProducts/SiteTheme/ThemeImage.js +151 -0
- package/src/components/OrderingProducts/SiteTheme/ThemeOption.js +118 -0
- package/src/components/OrderingProducts/SiteTheme/index.js +221 -0
- package/src/components/OrderingProducts/SiteTheme/styles.js +160 -0
- package/src/components/Orders/CountryFilter/index.js +68 -0
- package/src/components/Orders/CountryFilter/styles.js +29 -0
- package/src/components/Orders/CurrencyFilter/index.js +68 -0
- package/src/components/Orders/CurrencyFilter/styles.js +29 -0
- package/src/components/Orders/DeliveriesLocation/index.js +60 -8
- package/src/components/Orders/DriversLocation/index.js +32 -4
- package/src/components/Orders/OrdersFilterGroup/index.js +15 -1
- package/src/components/Orders/OrdersListing/index.js +8 -1
- package/src/components/Orders/OrdersTable/index.js +297 -252
- package/src/components/Orders/OrdersTable/styles.js +33 -0
- package/src/components/Orders/index.js +3 -1
- package/src/components/Settings/SettingItemUI/index.js +2 -1
- package/src/components/Settings/SettingItemUI/styles.js +5 -0
- package/src/components/Settings/Settings/index.js +0 -11
- package/src/components/Settings/SettingsDetail/index.js +23 -4
- package/src/components/Settings/SettingsDetail/styles.js +9 -2
- package/src/components/Settings/SettingsList/index.js +30 -3
- package/src/components/Shared/ColorPicker/styles.js +1 -0
- package/src/components/Shared/ColumnAllowSettingPopover/index.js +2 -2
- package/src/components/Shared/SearchBar/index.js +3 -2
- package/src/components/SidebarMenu/index.js +22 -7
- package/src/components/SidebarMenu/styles.js +13 -0
- package/src/components/Stores/BusinessMenu/index.js +21 -3
- package/src/components/Stores/BusinessMenu/styles.js +19 -0
- package/src/components/Stores/BusinessMenuOptions/styles.js +6 -0
- package/src/components/Stores/BusinessPaymentMethods/index.js +62 -32
- package/src/components/Stores/BusinessProductList/index.js +2 -1
- package/src/components/Stores/BusinessProductsCategories/index.js +2 -2
- package/src/components/Stores/BusinessProductsListing/index.js +18 -4
- package/src/components/Stores/BusinessProductsListing/styles.js +40 -10
- package/src/components/Stores/BusinessesListing/index.js +3 -0
- package/src/components/Stores/BusinessesListingHeader/index.js +15 -3
- package/src/components/Stores/BusinessesListingHeader/styles.js +38 -0
- package/src/components/Stores/ImportersList/index.js +3 -2
- package/src/components/Stores/ImportersList/styles.js +8 -1
- package/src/components/Stores/ImportersListing/index.js +25 -1
- package/src/components/Stores/PaymentOption/index.js +9 -5
- package/src/components/Stores/PaymentOption/styles.js +8 -0
- package/src/components/Stores/PaymentOptionMethods/index.js +8 -3
- package/src/components/Stores/PaymentOptionMethods/styles.js +8 -0
- package/src/components/Stores/PaymentOptionPaypal/index.js +8 -3
- package/src/components/Stores/PaymentOptionSquare/index.js +183 -176
- package/src/components/Stores/PaymentOptionStripeDirect/index.js +8 -3
- package/src/components/Stores/PaymentOptionStripeDirect/styles.js +8 -0
- package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +8 -3
- package/src/components/Stores/PaymethodOptionStripeConnect/index.js +8 -3
- package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +8 -3
- package/src/components/Users/UsersList/index.js +10 -1
- package/src/components/Users/UsersList/styles.js +9 -0
- package/template/app.js +8 -8
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
import { useForm } from 'react-hook-form'
|
|
3
|
+
import { bytesConverter } from '../../../utils'
|
|
4
|
+
import BsCardImage from '@meronex/icons/bs/BsCardImage'
|
|
5
|
+
import Skeleton from 'react-loading-skeleton'
|
|
6
|
+
import { Alert } from '../../Shared'
|
|
7
|
+
import { Input, TextArea, Button } from '../../../styles'
|
|
8
|
+
import { InfoCircle } from 'react-bootstrap-icons'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
useLanguage,
|
|
12
|
+
DragAndDrop,
|
|
13
|
+
ExamineClick
|
|
14
|
+
} from 'ordering-components-admin-external'
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
DetailContainer,
|
|
18
|
+
ContactUsContainer,
|
|
19
|
+
FormContainer,
|
|
20
|
+
BusinessImg,
|
|
21
|
+
SkeletonWrapper,
|
|
22
|
+
UploadImageIconContainer,
|
|
23
|
+
UploadImageIcon,
|
|
24
|
+
LogoImage,
|
|
25
|
+
FormControl,
|
|
26
|
+
LabelHeader,
|
|
27
|
+
Label,
|
|
28
|
+
FormGroup,
|
|
29
|
+
SaveBtnWrapper,
|
|
30
|
+
SocialShareImage,
|
|
31
|
+
InfoWrapper,
|
|
32
|
+
InfoContent,
|
|
33
|
+
InfoTitle,
|
|
34
|
+
Info
|
|
35
|
+
} from './styles'
|
|
36
|
+
|
|
37
|
+
export const OrderingProductGeneralDetails = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
siteState,
|
|
40
|
+
formState,
|
|
41
|
+
isAddMode,
|
|
42
|
+
handleChangeInput,
|
|
43
|
+
handlechangeImage,
|
|
44
|
+
handleUpdateSite,
|
|
45
|
+
handleAddSite
|
|
46
|
+
} = props
|
|
47
|
+
|
|
48
|
+
const [, t] = useLanguage()
|
|
49
|
+
const { handleSubmit, register, errors, watch } = useForm()
|
|
50
|
+
const businessUrlTemplate = watch('business_url_template', '')
|
|
51
|
+
|
|
52
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
53
|
+
|
|
54
|
+
const headerImageInputRef = useRef(null)
|
|
55
|
+
const logoImageInputRef = useRef(null)
|
|
56
|
+
const socialShareInputRef = useRef(null)
|
|
57
|
+
|
|
58
|
+
const availableBusinessUrls = [
|
|
59
|
+
{ key: 0, value: '/:business_slug' },
|
|
60
|
+
{ key: 1, value: '/store/:business_slug' },
|
|
61
|
+
{ key: 2, value: '/store?<any>=:business_slug' }
|
|
62
|
+
]
|
|
63
|
+
const availableProductUrls = [
|
|
64
|
+
{ key: 0, value: '/store/:business_slug/:category_slug/:product_slug' },
|
|
65
|
+
{ key: 1, value: '/store/:category_slug/:product_slug?<any>=:business_slug' },
|
|
66
|
+
{ key: 2, value: '/store/:business_slug?<any>=:category_id&<any>=:product_id' },
|
|
67
|
+
{ key: 3, value: '/:business_slug/:category_slug/:product_slug' },
|
|
68
|
+
{ key: 4, value: '/:business_slug?<any>=:category_id&<any>=:product_id' }
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const handleClickImage = (type) => {
|
|
72
|
+
if (type === 'header') {
|
|
73
|
+
headerImageInputRef.current.click()
|
|
74
|
+
}
|
|
75
|
+
if (type === 'logo') {
|
|
76
|
+
logoImageInputRef.current.click()
|
|
77
|
+
}
|
|
78
|
+
if (type === 'social_share') {
|
|
79
|
+
socialShareInputRef.current.click()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const handleFiles = (files, name) => {
|
|
84
|
+
if (files.length === 1) {
|
|
85
|
+
const type = files[0].type.split('/')[0]
|
|
86
|
+
if (type !== 'image') {
|
|
87
|
+
setAlertState({
|
|
88
|
+
open: true,
|
|
89
|
+
content: [t('ERROR_ONLY_IMAGES', 'Only images can be accepted')]
|
|
90
|
+
})
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (bytesConverter(files[0]?.size) > 2048) {
|
|
95
|
+
setAlertState({
|
|
96
|
+
open: true,
|
|
97
|
+
content: [t('IMAGE_MAXIMUM_SIZE', 'The maximum image size is 2 megabytes')]
|
|
98
|
+
})
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
handlechangeImage(files[0], name)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const onSubmit = () => {
|
|
106
|
+
if (isAddMode) {
|
|
107
|
+
handleAddSite && handleAddSite()
|
|
108
|
+
} else {
|
|
109
|
+
handleUpdateSite && handleUpdateSite()
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const closeAlert = () => {
|
|
114
|
+
setAlertState({
|
|
115
|
+
open: false,
|
|
116
|
+
content: []
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const handleValidateProductUrl = (value) => {
|
|
121
|
+
if (businessUrlTemplate.includes('?')) {
|
|
122
|
+
const urls = businessUrlTemplate.split('?')
|
|
123
|
+
if (value.indexOf(urls[0]) === 0 && value.includes(urls[1])) {
|
|
124
|
+
return true
|
|
125
|
+
} else {
|
|
126
|
+
return t('VALIDATE_PRODUCT_TEMPLATE_URL', 'The product url template do not match with business url template')
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
if (value.indexOf(businessUrlTemplate) === 0) {
|
|
130
|
+
return true
|
|
131
|
+
} else {
|
|
132
|
+
return t('VALIDATE_PRODUCT_TEMPLATE_URL', 'The product url template do not match with business url template')
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!formState.error) return
|
|
139
|
+
setAlertState({
|
|
140
|
+
open: true,
|
|
141
|
+
content: formState.error
|
|
142
|
+
})
|
|
143
|
+
}, [formState.error])
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (Object.keys(errors).length > 0) {
|
|
147
|
+
setAlertState({
|
|
148
|
+
open: true,
|
|
149
|
+
content: Object.values(errors).map((error) => error.message)
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
}, [errors])
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<DetailContainer>
|
|
156
|
+
{!isAddMode && (
|
|
157
|
+
<ContactUsContainer>
|
|
158
|
+
<p>
|
|
159
|
+
{t('NEED_HELP_WITH_SET_UP', 'Do you need help with the setup?')}
|
|
160
|
+
</p>
|
|
161
|
+
<Button
|
|
162
|
+
outline
|
|
163
|
+
borderRadius='8px'
|
|
164
|
+
color='primary'
|
|
165
|
+
onClick={() => window.open('https://www.ordering.co/ordering-sales', '_blank')}
|
|
166
|
+
>
|
|
167
|
+
{t('CONTACT_US', 'Contact us')}
|
|
168
|
+
</Button>
|
|
169
|
+
</ContactUsContainer>
|
|
170
|
+
)}
|
|
171
|
+
<FormContainer onSubmit={handleSubmit(onSubmit)}>
|
|
172
|
+
<BusinessImg
|
|
173
|
+
onClick={() => handleClickImage('header')}
|
|
174
|
+
>
|
|
175
|
+
<ExamineClick
|
|
176
|
+
onFiles={files => handleFiles(files, 'header')}
|
|
177
|
+
childRef={(e) => { headerImageInputRef.current = e }}
|
|
178
|
+
accept='image/png, image/jpeg, image/jpg'
|
|
179
|
+
disabled={formState.loading}
|
|
180
|
+
>
|
|
181
|
+
<DragAndDrop
|
|
182
|
+
onDrop={dataTransfer => handleFiles(dataTransfer.files, 'header')}
|
|
183
|
+
accept='image/png, image/jpeg, image/jpg'
|
|
184
|
+
disabled={formState.loading}
|
|
185
|
+
>
|
|
186
|
+
{formState.loading
|
|
187
|
+
? (<SkeletonWrapper><Skeleton /></SkeletonWrapper>)
|
|
188
|
+
: ((!formState.changes?.header || formState.error)
|
|
189
|
+
? siteState.site?.header &&
|
|
190
|
+
(<img src={siteState.site?.header} alt='header image' loading='lazy' />)
|
|
191
|
+
: formState?.changes?.header &&
|
|
192
|
+
<img src={formState?.changes?.header} alt='header image' loading='lazy' />
|
|
193
|
+
)}
|
|
194
|
+
<UploadImageIconContainer>
|
|
195
|
+
<UploadImageIcon>
|
|
196
|
+
<BsCardImage />
|
|
197
|
+
<span>{t('DRAG_AND_DROP', 'Drag and drop')}</span>
|
|
198
|
+
</UploadImageIcon>
|
|
199
|
+
</UploadImageIconContainer>
|
|
200
|
+
</DragAndDrop>
|
|
201
|
+
</ExamineClick>
|
|
202
|
+
</BusinessImg>
|
|
203
|
+
<LogoImage
|
|
204
|
+
onClick={() => handleClickImage('logo')}
|
|
205
|
+
>
|
|
206
|
+
<ExamineClick
|
|
207
|
+
onFiles={files => handleFiles(files, 'logo')}
|
|
208
|
+
childRef={(e) => { logoImageInputRef.current = e }}
|
|
209
|
+
accept='image/png, image/jpeg, image/jpg'
|
|
210
|
+
disabled={formState.loading}
|
|
211
|
+
>
|
|
212
|
+
<DragAndDrop
|
|
213
|
+
onDrop={dataTransfer => handleFiles(dataTransfer.files, 'logo')}
|
|
214
|
+
accept='image/png, image/jpeg, image/jpg'
|
|
215
|
+
disabled={formState.loading}
|
|
216
|
+
>
|
|
217
|
+
{formState.loading
|
|
218
|
+
? (<SkeletonWrapper><Skeleton /></SkeletonWrapper>)
|
|
219
|
+
: ((!formState.changes?.logo || formState.error)
|
|
220
|
+
? siteState.site?.logo &&
|
|
221
|
+
(<img src={siteState.site?.logo} alt='logo image' loading='lazy' />)
|
|
222
|
+
: formState?.changes?.logo &&
|
|
223
|
+
<img src={formState?.changes?.logo} alt='logo image' loading='lazy' />
|
|
224
|
+
)}
|
|
225
|
+
<UploadImageIconContainer small>
|
|
226
|
+
<UploadImageIcon small>
|
|
227
|
+
<BsCardImage />
|
|
228
|
+
<span>{t('DRAG_AND_DROP', 'Drag and drop')}</span>
|
|
229
|
+
</UploadImageIcon>
|
|
230
|
+
</UploadImageIconContainer>
|
|
231
|
+
</DragAndDrop>
|
|
232
|
+
</ExamineClick>
|
|
233
|
+
</LogoImage>
|
|
234
|
+
<FormGroup className='row'>
|
|
235
|
+
<FormControl className='col-md-12'>
|
|
236
|
+
<Label>{t('NAME', 'Name')}</Label>
|
|
237
|
+
<Input
|
|
238
|
+
type='text'
|
|
239
|
+
name='name'
|
|
240
|
+
placeholder={t('NAME', 'Name')}
|
|
241
|
+
value={
|
|
242
|
+
formState?.changes?.name ?? siteState.site?.name ?? ''
|
|
243
|
+
}
|
|
244
|
+
onChange={(e) => handleChangeInput(e)}
|
|
245
|
+
ref={register({
|
|
246
|
+
required: t('VALIDATION_ERROR_REQUIRED', 'The name field is required.').replace('_attribute_', t('NAME', 'Name'))
|
|
247
|
+
})}
|
|
248
|
+
/>
|
|
249
|
+
</FormControl>
|
|
250
|
+
<FormControl className='col-md-12'>
|
|
251
|
+
<Label>{t('CODE', 'Code')}</Label>
|
|
252
|
+
<Input
|
|
253
|
+
type='text'
|
|
254
|
+
name='code'
|
|
255
|
+
placeholder={t('CODE', 'Code')}
|
|
256
|
+
value={
|
|
257
|
+
formState?.changes?.code ?? siteState.site?.code ?? ''
|
|
258
|
+
}
|
|
259
|
+
onChange={(e) => handleChangeInput(e)}
|
|
260
|
+
ref={register({
|
|
261
|
+
required: t('VALIDATION_ERROR_REQUIRED', 'The name code is required.').replace('_attribute_', t('CODE', 'Code'))
|
|
262
|
+
})}
|
|
263
|
+
/>
|
|
264
|
+
</FormControl>
|
|
265
|
+
<FormControl className='col-md-12'>
|
|
266
|
+
<Label>{t('URL', 'URL')}</Label>
|
|
267
|
+
<Input
|
|
268
|
+
type='text'
|
|
269
|
+
name='url'
|
|
270
|
+
placeholder={t('URL', 'Url')}
|
|
271
|
+
value={
|
|
272
|
+
formState?.changes?.url ?? siteState.site?.url ?? ''
|
|
273
|
+
}
|
|
274
|
+
onChange={(e) => handleChangeInput(e)}
|
|
275
|
+
ref={register({
|
|
276
|
+
pattern: {
|
|
277
|
+
value: /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g,
|
|
278
|
+
message: t(
|
|
279
|
+
'VALIDATION_ERROR_ACTIVE_URL',
|
|
280
|
+
'The _attribute_ is not a valid URL.'
|
|
281
|
+
).replace('_attribute_', t('URL', 'Url'))
|
|
282
|
+
}
|
|
283
|
+
})}
|
|
284
|
+
/>
|
|
285
|
+
</FormControl>
|
|
286
|
+
<FormControl className='col-md-12'>
|
|
287
|
+
<Label>{t('SOCIAL_SHARE', 'Social share')}</Label>
|
|
288
|
+
<SocialShareImage
|
|
289
|
+
onClick={() => handleClickImage('social_share')}
|
|
290
|
+
>
|
|
291
|
+
<ExamineClick
|
|
292
|
+
onFiles={files => handleFiles(files, 'social_share')}
|
|
293
|
+
childRef={(e) => { socialShareInputRef.current = e }}
|
|
294
|
+
accept='image/png, image/jpeg, image/jpg'
|
|
295
|
+
disabled={formState.loading}
|
|
296
|
+
>
|
|
297
|
+
<DragAndDrop
|
|
298
|
+
onDrop={dataTransfer => handleFiles(dataTransfer.files, 'social_share')}
|
|
299
|
+
accept='image/png, image/jpeg, image/jpg'
|
|
300
|
+
disabled={formState.loading}
|
|
301
|
+
>
|
|
302
|
+
{formState.loading
|
|
303
|
+
? (<SkeletonWrapper><Skeleton /></SkeletonWrapper>)
|
|
304
|
+
: ((!formState.changes?.social_share || formState.error)
|
|
305
|
+
? siteState.site?.social_share &&
|
|
306
|
+
(<img src={siteState.site?.social_share} alt='social share image' loading='lazy' />)
|
|
307
|
+
: formState?.changes?.social_share &&
|
|
308
|
+
<img src={formState?.changes?.social_share} alt='social share image' loading='lazy' />
|
|
309
|
+
)}
|
|
310
|
+
<UploadImageIconContainer small>
|
|
311
|
+
<UploadImageIcon small>
|
|
312
|
+
<BsCardImage />
|
|
313
|
+
<span>{t('DRAG_AND_DROP', 'Drag and drop')}</span>
|
|
314
|
+
</UploadImageIcon>
|
|
315
|
+
</UploadImageIconContainer>
|
|
316
|
+
</DragAndDrop>
|
|
317
|
+
</ExamineClick>
|
|
318
|
+
</SocialShareImage>
|
|
319
|
+
</FormControl>
|
|
320
|
+
<FormControl className='col-md-12'>
|
|
321
|
+
<Label>{t('RESET_PASSWORD_URL_TEMPLATE', 'Reset password url template')}</Label>
|
|
322
|
+
<Input
|
|
323
|
+
type='text'
|
|
324
|
+
name='reset_password_url_template'
|
|
325
|
+
placeholder={t('URL', 'Url')}
|
|
326
|
+
defaultValue={
|
|
327
|
+
formState?.changes?.reset_password_url_template ?? siteState.site?.reset_password_url_template ?? ''
|
|
328
|
+
}
|
|
329
|
+
onChange={(e) => handleChangeInput(e)}
|
|
330
|
+
/>
|
|
331
|
+
</FormControl>
|
|
332
|
+
<FormControl className='col-md-12'>
|
|
333
|
+
<Label>{t('TRACK_ORDER_URL_TEMPLATE', 'Track order url template')}</Label>
|
|
334
|
+
<Input
|
|
335
|
+
type='text'
|
|
336
|
+
placeholder={t('URL', 'Url')}
|
|
337
|
+
name='track_order_url_template'
|
|
338
|
+
defaultValue={
|
|
339
|
+
formState?.changes?.track_order_url_template ?? siteState.site?.track_order_url_template ?? ''
|
|
340
|
+
}
|
|
341
|
+
onChange={(e) => handleChangeInput(e)}
|
|
342
|
+
/>
|
|
343
|
+
</FormControl>
|
|
344
|
+
<FormControl className='col-md-12'>
|
|
345
|
+
<Label>{t('DESCRIPTION', 'Description')}</Label>
|
|
346
|
+
<TextArea
|
|
347
|
+
name='description'
|
|
348
|
+
rows={5}
|
|
349
|
+
placeholder={t('SHORT_PROMOTION_ABOUT', 'Write a little description')}
|
|
350
|
+
defaultValue={
|
|
351
|
+
formState?.changes?.description ?? siteState.site?.description ?? ''
|
|
352
|
+
}
|
|
353
|
+
onChange={(e) => handleChangeInput(e)}
|
|
354
|
+
/>
|
|
355
|
+
</FormControl>
|
|
356
|
+
<FormControl className='col-md-12'>
|
|
357
|
+
<Label>{t('CHECKOUT_URL_TEMPLATE', 'Checkout url template')}</Label>
|
|
358
|
+
<Input
|
|
359
|
+
type='text'
|
|
360
|
+
placeholder={t('URL', 'Url')}
|
|
361
|
+
name='checkout_url_template'
|
|
362
|
+
defaultValue={
|
|
363
|
+
formState?.changes?.checkout_url_template ?? siteState.site?.checkout_url_template ?? ''
|
|
364
|
+
}
|
|
365
|
+
onChange={(e) => handleChangeInput(e)}
|
|
366
|
+
/>
|
|
367
|
+
</FormControl>
|
|
368
|
+
<FormControl className='col-md-12'>
|
|
369
|
+
<Label>{t('CART_URL_TEMPLATE', 'Cart url template')}</Label>
|
|
370
|
+
<Input
|
|
371
|
+
type='text'
|
|
372
|
+
placeholder={t('URL', 'Url')}
|
|
373
|
+
name='cart_url_template'
|
|
374
|
+
defaultValue={
|
|
375
|
+
formState?.changes?.cart_url_template ?? siteState.site?.cart_url_template ?? ''
|
|
376
|
+
}
|
|
377
|
+
onChange={(e) => handleChangeInput(e)}
|
|
378
|
+
/>
|
|
379
|
+
</FormControl>
|
|
380
|
+
<FormControl className='col-md-12'>
|
|
381
|
+
<LabelHeader>
|
|
382
|
+
<Label>{t('BUSINESS_URL_TEMPLATE', 'Business url template')}</Label>
|
|
383
|
+
<InfoWrapper>
|
|
384
|
+
<InfoCircle />
|
|
385
|
+
<InfoContent>
|
|
386
|
+
<InfoTitle>{t('AVAILABLE_FORMATS', 'Available Formats')}</InfoTitle>
|
|
387
|
+
{availableBusinessUrls.map(url => (
|
|
388
|
+
<Info key={url.key}>{url.value}</Info>
|
|
389
|
+
))}
|
|
390
|
+
</InfoContent>
|
|
391
|
+
</InfoWrapper>
|
|
392
|
+
</LabelHeader>
|
|
393
|
+
<Input
|
|
394
|
+
type='text'
|
|
395
|
+
placeholder={t('URL', 'Url')}
|
|
396
|
+
name='business_url_template'
|
|
397
|
+
defaultValue={
|
|
398
|
+
formState?.changes?.business_url_template ?? siteState.site?.business_url_template ?? ''
|
|
399
|
+
}
|
|
400
|
+
onChange={(e) => handleChangeInput(e)}
|
|
401
|
+
ref={register({
|
|
402
|
+
pattern: {
|
|
403
|
+
value: /(^\/)(store)?((\/?:business_slug$)|(\/?\?[a-zA-Z]+=:business_slug$))$/g,
|
|
404
|
+
message: t(
|
|
405
|
+
'VALIDATION_ERROR_ACTIVE_URL',
|
|
406
|
+
'The _attribute_ is not a valid URL.'
|
|
407
|
+
).replace('_attribute_', t('BUSINESS_URL_TEMPLATE', 'Business url template'))
|
|
408
|
+
}
|
|
409
|
+
})}
|
|
410
|
+
/>
|
|
411
|
+
</FormControl>
|
|
412
|
+
<FormControl className='col-md-12'>
|
|
413
|
+
<LabelHeader>
|
|
414
|
+
<Label>{t('CATEGORY_URL_TEMPLATE', 'Category url template')}</Label>
|
|
415
|
+
<InfoWrapper>
|
|
416
|
+
<InfoCircle />
|
|
417
|
+
<InfoContent>
|
|
418
|
+
<InfoTitle>{t('AVAILABLE_FORMATS', 'Available Formats')}</InfoTitle>
|
|
419
|
+
<Info>store/:business_slug/:category_slug</Info>
|
|
420
|
+
<Info>store/:category_slug?{'<any>'}=:business_slug</Info>
|
|
421
|
+
<Info>:business_slug/:category_slug</Info>
|
|
422
|
+
<Info>:category_slug?{'<any>'}=:business_slug</Info>
|
|
423
|
+
</InfoContent>
|
|
424
|
+
</InfoWrapper>
|
|
425
|
+
</LabelHeader>
|
|
426
|
+
<Input
|
|
427
|
+
type='text'
|
|
428
|
+
placeholder={t('URL', 'Url')}
|
|
429
|
+
name='category_url_template'
|
|
430
|
+
defaultValue={
|
|
431
|
+
formState?.changes?.category_url_template ?? siteState.site?.category_url_template ?? ''
|
|
432
|
+
}
|
|
433
|
+
onChange={(e) => handleChangeInput(e)}
|
|
434
|
+
ref={register({
|
|
435
|
+
pattern: {
|
|
436
|
+
value: /(store\/)?((:business_slug\/:category_slug$)|(:category_slug\?[a-zA-Z]+=:business_slug$))$/g,
|
|
437
|
+
message: t(
|
|
438
|
+
'VALIDATION_ERROR_ACTIVE_URL',
|
|
439
|
+
'The _attribute_ is not a valid URL.'
|
|
440
|
+
).replace('_attribute_', t('CATEGORY_URL_TEMPLATE', 'Category url template'))
|
|
441
|
+
}
|
|
442
|
+
})}
|
|
443
|
+
/>
|
|
444
|
+
</FormControl>
|
|
445
|
+
<FormControl className='col-md-12'>
|
|
446
|
+
<LabelHeader>
|
|
447
|
+
<Label>{t('PRODUCT_URL_TEMPLATE', 'Product url template')}</Label>
|
|
448
|
+
<InfoWrapper>
|
|
449
|
+
<InfoCircle />
|
|
450
|
+
<InfoContent>
|
|
451
|
+
<InfoTitle>{t('AVAILABLE_FORMATS', 'Available Formats')}</InfoTitle>
|
|
452
|
+
{availableProductUrls.map(url => (
|
|
453
|
+
<Info key={url.key}>{url.value}</Info>
|
|
454
|
+
))}
|
|
455
|
+
</InfoContent>
|
|
456
|
+
</InfoWrapper>
|
|
457
|
+
</LabelHeader>
|
|
458
|
+
<Input
|
|
459
|
+
type='text'
|
|
460
|
+
placeholder={t('URL', 'Url')}
|
|
461
|
+
name='product_url_template'
|
|
462
|
+
defaultValue={
|
|
463
|
+
formState?.changes?.product_url_template ?? siteState.site?.product_url_template ?? ''
|
|
464
|
+
}
|
|
465
|
+
onChange={(e) => handleChangeInput(e)}
|
|
466
|
+
ref={register({
|
|
467
|
+
pattern: {
|
|
468
|
+
value: /(^\/)(store\/)?((:business_slug\/:category_slug\/:product_slug$)|(:category_slug\/:product_slug\?[a-zA-Z]+=:business_slug$)|(:business_slug\?[a-zA-Z]+=:category_id&[a-zA-Z]+=:product_id$))$/g,
|
|
469
|
+
message: t(
|
|
470
|
+
'VALIDATION_ERROR_ACTIVE_URL',
|
|
471
|
+
'The _attribute_ is not a valid URL.'
|
|
472
|
+
).replace('_attribute_', t('PRODUCT_URL_TEMPLATE', 'Product url template'))
|
|
473
|
+
},
|
|
474
|
+
validate: handleValidateProductUrl
|
|
475
|
+
})}
|
|
476
|
+
/>
|
|
477
|
+
</FormControl>
|
|
478
|
+
<FormControl className='col-md-12'>
|
|
479
|
+
<Label>{t('PROFILE_URL_TEMPLATE', 'Profile url template')}</Label>
|
|
480
|
+
<Input
|
|
481
|
+
type='text'
|
|
482
|
+
placeholder={t('URL', 'Url')}
|
|
483
|
+
name='profile_url_template'
|
|
484
|
+
value={
|
|
485
|
+
formState?.changes?.profile_url_template ?? siteState.site?.profile_url_template ?? ''
|
|
486
|
+
}
|
|
487
|
+
onChange={(e) => handleChangeInput(e)}
|
|
488
|
+
/>
|
|
489
|
+
</FormControl>
|
|
490
|
+
</FormGroup>
|
|
491
|
+
<SaveBtnWrapper>
|
|
492
|
+
<Button
|
|
493
|
+
borderRadius='7.6px'
|
|
494
|
+
color='primary'
|
|
495
|
+
type='submit'
|
|
496
|
+
disabled={formState.loading || Object.keys(formState.changes).length === 0}
|
|
497
|
+
>
|
|
498
|
+
{t('SAVE', 'Save')}
|
|
499
|
+
</Button>
|
|
500
|
+
</SaveBtnWrapper>
|
|
501
|
+
</FormContainer>
|
|
502
|
+
|
|
503
|
+
<Alert
|
|
504
|
+
title={t('ORDERING_PRODUCTS', 'Ordering products')}
|
|
505
|
+
content={alertState.content}
|
|
506
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
507
|
+
open={alertState.open}
|
|
508
|
+
onClose={() => closeAlert()}
|
|
509
|
+
onAccept={() => closeAlert()}
|
|
510
|
+
closeOnBackdrop={false}
|
|
511
|
+
/>
|
|
512
|
+
</DetailContainer>
|
|
513
|
+
)
|
|
514
|
+
}
|