ordering-ui-external 14.1.49 → 14.1.52
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/{7.ordering-ui.697d19ddfcc29dfbeb52.js → 7.ordering-ui.746cebc54de638e8e528.js} +1 -1
- package/_bundles/ordering-ui.746cebc54de638e8e528.js +2 -0
- package/_modules/components/GoogleGpsButton/index.js +11 -3
- package/_modules/components/VerticalOrdersLayout/styles.js +1 -1
- package/_modules/themes/callcenterOriginal/index.js +7 -0
- package/_modules/themes/callcenterOriginal/src/components/AddressForm/index.js +22 -5
- package/_modules/themes/callcenterOriginal/src/components/AddressForm/styles.js +10 -7
- package/_modules/themes/callcenterOriginal/src/components/AddressList/index.js +59 -19
- package/_modules/themes/callcenterOriginal/src/components/AddressList/styles.js +10 -4
- package/_modules/themes/callcenterOriginal/src/components/ConfirmAddressForm/index.js +638 -0
- package/_modules/themes/callcenterOriginal/src/components/ConfirmAddressForm/styles.js +50 -0
- package/_modules/themes/callcenterOriginal/src/components/Header/index.js +33 -4
- package/_modules/themes/callcenterOriginal/src/components/InputPhoneNumber/index.js +17 -10
- package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +58 -106
- package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/styles.js +6 -29
- package/_modules/themes/callcenterOriginal/src/components/SearchBar/index.js +2 -2
- package/_modules/themes/callcenterOriginal/src/components/SignUpForm/index.js +21 -1
- package/_modules/themes/callcenterOriginal/src/components/UserDetails/index.js +49 -8
- package/_modules/themes/callcenterOriginal/src/components/UserDetails/styles.js +12 -9
- package/_modules/themes/callcenterOriginal/src/components/UserFormDetails/index.js +30 -12
- package/_modules/themes/callcenterOriginal/src/components/UserFormDetails/styles.js +11 -5
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
- package/_modules/themes/five/src/components/BusinessController/franchises/OloBusinessController/index.js +192 -0
- package/_modules/themes/five/src/components/BusinessController/franchises/OloBusinessController/styles.js +114 -0
- package/_modules/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/index.js +572 -0
- package/_modules/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/styles.js +89 -0
- package/_modules/themes/five/src/components/BusinessesListing/index.js +6 -2
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +31 -118
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
- package/_modules/themes/five/src/components/Checkout/OrderDetail.js +1 -3
- package/_modules/themes/five/src/components/Checkout/index.js +22 -4
- package/_modules/themes/five/src/components/DriverTips/styles.js +1 -1
- package/_modules/themes/five/src/components/Header/index.js +8 -7
- package/_modules/themes/five/src/components/Header/styles.js +28 -25
- package/_modules/themes/five/src/components/HighestRated/franchises/OloHighestRated/index.js +116 -0
- package/_modules/themes/five/src/components/HighestRated/franchises/OloHighestRated/styles.js +22 -0
- package/_modules/themes/five/src/components/HomeHero/franchises/OloHomeHero/index.js +136 -0
- package/_modules/themes/five/src/components/HomeHero/franchises/OloHomeHero/styles.js +46 -0
- package/_modules/themes/five/src/components/HomeHero/index.js +5 -2
- package/_modules/themes/five/src/components/InputPhoneNumber/index.js +19 -12
- package/_modules/themes/five/src/components/LogoutPopup/index.js +2 -1
- package/_modules/themes/five/src/components/Modal/index.js +6 -3
- package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +2 -2
- package/_modules/themes/five/src/components/OrderDetails/layouts/Kiosk/index.js +2 -1
- package/_modules/themes/five/src/components/OrderItAgain/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderTypesSquares/index.js +160 -0
- package/_modules/themes/five/src/components/OrderTypesSquares/styles.js +39 -0
- package/_modules/themes/five/src/components/ProductItemAccordion/index.js +4 -4
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
- package/_modules/themes/five/src/components/SearchBar/index.js +2 -2
- package/_modules/themes/five/src/components/SignUpForm/index.js +11 -8
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/_modules/themes/five/src/components/UserDetails/index.js +5 -2
- package/_modules/themes/five/src/styles/Buttons/index.js +1 -1
- package/index-template.js +9 -1
- package/package.json +2 -2
- package/src/components/GoogleGpsButton/index.js +10 -2
- package/src/components/VerticalOrdersLayout/styles.js +2 -2
- package/src/themes/callcenterOriginal/index.js +2 -0
- package/src/themes/callcenterOriginal/src/components/AddressForm/index.js +44 -23
- package/src/themes/callcenterOriginal/src/components/AddressForm/styles.js +8 -0
- package/src/themes/callcenterOriginal/src/components/AddressList/index.js +67 -22
- package/src/themes/callcenterOriginal/src/components/AddressList/styles.js +16 -1
- package/src/themes/callcenterOriginal/src/components/ConfirmAddressForm/index.js +579 -0
- package/src/themes/callcenterOriginal/src/components/ConfirmAddressForm/styles.js +275 -0
- package/src/themes/callcenterOriginal/src/components/Header/index.js +22 -0
- package/src/themes/callcenterOriginal/src/components/InputPhoneNumber/index.js +13 -8
- package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +34 -100
- package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/styles.js +0 -52
- package/src/themes/callcenterOriginal/src/components/SearchBar/index.js +2 -2
- package/src/themes/callcenterOriginal/src/components/SignUpForm/index.js +19 -1
- package/src/themes/callcenterOriginal/src/components/UserDetails/index.js +45 -11
- package/src/themes/callcenterOriginal/src/components/UserDetails/styles.js +3 -1
- package/src/themes/callcenterOriginal/src/components/UserFormDetails/index.js +40 -14
- package/src/themes/callcenterOriginal/src/components/UserFormDetails/styles.js +19 -1
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
- package/src/themes/five/src/components/BusinessController/franchises/OloBusinessController/index.js +237 -0
- package/src/themes/five/src/components/BusinessController/franchises/OloBusinessController/styles.js +367 -0
- package/src/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/index.js +582 -0
- package/src/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/styles.js +307 -0
- package/src/themes/five/src/components/BusinessesListing/index.js +19 -4
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +7 -104
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +2 -2
- package/src/themes/five/src/components/Checkout/OrderDetail.js +1 -5
- package/src/themes/five/src/components/Checkout/index.js +20 -2
- package/src/themes/five/src/components/DriverTips/styles.js +1 -0
- package/src/themes/five/src/components/Header/index.js +17 -12
- package/src/themes/five/src/components/Header/styles.js +51 -4
- package/src/themes/five/src/components/HighestRated/franchises/OloHighestRated/index.js +114 -0
- package/src/themes/five/src/components/HighestRated/franchises/OloHighestRated/styles.js +57 -0
- package/src/themes/five/src/components/HomeHero/franchises/OloHomeHero/index.js +122 -0
- package/src/themes/five/src/components/HomeHero/franchises/OloHomeHero/styles.js +125 -0
- package/src/themes/five/src/components/HomeHero/index.js +16 -3
- package/src/themes/five/src/components/InputPhoneNumber/index.js +14 -9
- package/src/themes/five/src/components/LogoutPopup/index.js +3 -1
- package/src/themes/five/src/components/Modal/index.js +6 -3
- package/src/themes/five/src/components/MultiOrdersDetails/styles.js +3 -3
- package/src/themes/five/src/components/OrderDetails/layouts/Kiosk/index.js +3 -1
- package/src/themes/five/src/components/OrderItAgain/styles.js +2 -0
- package/src/themes/five/src/components/OrderTypesSquares/index.js +157 -0
- package/src/themes/five/src/components/OrderTypesSquares/styles.js +62 -0
- package/src/themes/five/src/components/ProductItemAccordion/index.js +2 -2
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +2 -0
- package/src/themes/five/src/components/SearchBar/index.js +2 -2
- package/src/themes/five/src/components/SignUpForm/index.js +5 -3
- package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/src/themes/five/src/components/UserDetails/index.js +3 -1
- package/src/themes/five/src/styles/Buttons/index.js +2 -2
- package/template/app.js +14 -11
- package/template/assets/images/catering.svg +13 -0
- package/template/assets/images/curbside.svg +19 -0
- package/template/assets/images/drivethru.svg +19 -0
- package/template/assets/images/eatin.svg +17 -0
- package/template/components/SubdomainComponent/index.js +4 -8
- package/template/pages/BusinessesList/index.js +1 -1
- package/_bundles/ordering-ui.697d19ddfcc29dfbeb52.js +0 -2
- /package/_bundles/{0.ordering-ui.697d19ddfcc29dfbeb52.js → 0.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{1.ordering-ui.697d19ddfcc29dfbeb52.js → 1.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{2.ordering-ui.697d19ddfcc29dfbeb52.js → 2.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{4.ordering-ui.697d19ddfcc29dfbeb52.js → 4.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{5.ordering-ui.697d19ddfcc29dfbeb52.js → 5.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{6.ordering-ui.697d19ddfcc29dfbeb52.js → 6.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{7.ordering-ui.697d19ddfcc29dfbeb52.js.LICENSE.txt → 7.ordering-ui.746cebc54de638e8e528.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.697d19ddfcc29dfbeb52.js → 8.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{9.ordering-ui.697d19ddfcc29dfbeb52.js → 9.ordering-ui.746cebc54de638e8e528.js} +0 -0
- /package/_bundles/{ordering-ui.697d19ddfcc29dfbeb52.js.LICENSE.txt → ordering-ui.746cebc54de638e8e528.js.LICENSE.txt} +0 -0
|
@@ -17,11 +17,13 @@ import PhoneInput from 'react-phone-number-input'
|
|
|
17
17
|
import { parsePhoneNumber } from 'libphonenumber-js'
|
|
18
18
|
import {
|
|
19
19
|
UserFormDetails as UserFormController,
|
|
20
|
+
useConfig,
|
|
20
21
|
useLanguage,
|
|
21
22
|
useSession
|
|
22
23
|
} from 'ordering-components-external'
|
|
23
24
|
|
|
24
25
|
import { UserFormDetailsUI } from '../UserFormDetails'
|
|
26
|
+
import { Modal } from '../Modal'
|
|
25
27
|
|
|
26
28
|
const UserDetailsUI = (props) => {
|
|
27
29
|
const {
|
|
@@ -37,16 +39,30 @@ const UserDetailsUI = (props) => {
|
|
|
37
39
|
isModal,
|
|
38
40
|
setIsOpenUserData,
|
|
39
41
|
isAddressFormOpen,
|
|
40
|
-
onClose
|
|
42
|
+
onClose,
|
|
43
|
+
userConfirmPhone,
|
|
44
|
+
setUserConfirmPhone
|
|
41
45
|
} = props
|
|
42
46
|
|
|
43
47
|
const [, t] = useLanguage()
|
|
44
48
|
const [{ user }] = useSession()
|
|
49
|
+
const [{ configs }] = useConfig()
|
|
50
|
+
|
|
45
51
|
const userData = userState.result?.result || props.userData || formState.result?.result || user
|
|
46
52
|
|
|
47
53
|
const validationFieldsLength = Object.values(validationFields?.fields?.checkout)?.map(field => field.enabled)
|
|
48
54
|
const countryPhoneCode = userData?.country_phone_code ?? userData?.country_code
|
|
49
|
-
|
|
55
|
+
const inputsConfirmAddress = [{
|
|
56
|
+
id: 1,
|
|
57
|
+
name: 'Name',
|
|
58
|
+
type: 'text',
|
|
59
|
+
code: 'name'
|
|
60
|
+
}, {
|
|
61
|
+
id: 2,
|
|
62
|
+
name: 'Lastname',
|
|
63
|
+
type: 'text',
|
|
64
|
+
code: 'lastname'
|
|
65
|
+
}]
|
|
50
66
|
useEffect(() => {
|
|
51
67
|
if (isUserDetailsEdit) {
|
|
52
68
|
!isEdit && toggleIsEdit()
|
|
@@ -71,14 +87,17 @@ const UserDetailsUI = (props) => {
|
|
|
71
87
|
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
72
88
|
<BeforeComponent key={i} {...props} />))}
|
|
73
89
|
{(validationFields.loading || formState.loading || userState.loading) && (
|
|
74
|
-
<UserData>
|
|
75
|
-
{[...Array(
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
<UserData isModal={isModal}>
|
|
91
|
+
{isModal ? [...Array(4)].map((_, i) => (
|
|
92
|
+
<Skeleton key={i} width={150 + (i * 10)} height={15} />
|
|
93
|
+
))
|
|
94
|
+
: validationFieldsLength?.map((field, i) => (
|
|
95
|
+
<React.Fragment key={field?.id}>
|
|
96
|
+
<Skeleton width={250} height={50} />
|
|
97
|
+
<Skeleton width={180} height={25} />
|
|
98
|
+
<Skeleton width={210} height={50} />
|
|
99
|
+
</React.Fragment>
|
|
100
|
+
))}
|
|
82
101
|
</UserData>
|
|
83
102
|
)}
|
|
84
103
|
|
|
@@ -123,7 +142,7 @@ const UserDetailsUI = (props) => {
|
|
|
123
142
|
<CountryFlag>
|
|
124
143
|
{
|
|
125
144
|
countryPhoneCode && userData?.cellphone && (
|
|
126
|
-
<PhoneInput onChange={() => { }} defaultCountry={parsePhoneNumber(`+${(countryPhoneCode?.replace('+', ''))} ${userData?.cellphone?.replace(`+${countryPhoneCode}`, '')}`)?.country} />
|
|
145
|
+
<PhoneInput onChange={() => { }} defaultCountry={parsePhoneNumber(`+${(countryPhoneCode?.replace('+', ''))} ${userData?.cellphone?.replace(`+${countryPhoneCode}`, '')}`)?.country || configs?.default_country_code?.value} />
|
|
127
146
|
)
|
|
128
147
|
}
|
|
129
148
|
</CountryFlag>
|
|
@@ -144,6 +163,21 @@ const UserDetailsUI = (props) => {
|
|
|
144
163
|
)}
|
|
145
164
|
</Container>
|
|
146
165
|
)}
|
|
166
|
+
<Modal
|
|
167
|
+
title={t('CONFIRM_CELLPHONE_CLIENT', 'Confirm client\'s cellphone')}
|
|
168
|
+
open={userConfirmPhone?.open}
|
|
169
|
+
onClose={() => setUserConfirmPhone({ open: false, result: null })}
|
|
170
|
+
>
|
|
171
|
+
<UserFormDetailsUI
|
|
172
|
+
{...props}
|
|
173
|
+
confirmDataLayout
|
|
174
|
+
isEdit
|
|
175
|
+
dontToggleEditMode
|
|
176
|
+
inputsconfirmData={inputsConfirmAddress}
|
|
177
|
+
userData={userData}
|
|
178
|
+
isCustomerMode={isCustomerMode}
|
|
179
|
+
/>
|
|
180
|
+
</Modal>
|
|
147
181
|
{props.afterComponents?.map((AfterComponent, i) => (
|
|
148
182
|
<AfterComponent key={i} {...props} />))}
|
|
149
183
|
{props.afterElements?.map((AfterElement, i) => (
|
|
@@ -70,6 +70,9 @@ export const UserData = styled.div`
|
|
|
70
70
|
font-size: 14px;
|
|
71
71
|
color: ${props => props.theme?.colors.darkTextColor};
|
|
72
72
|
}
|
|
73
|
+
${({ isModal }) => isModal && css`
|
|
74
|
+
margin-top: 40px;
|
|
75
|
+
`}
|
|
73
76
|
`
|
|
74
77
|
|
|
75
78
|
export const UserName = styled.p`
|
|
@@ -120,7 +123,6 @@ export const PhoneContainer = styled.div`
|
|
|
120
123
|
display: flex;
|
|
121
124
|
align-items: center;
|
|
122
125
|
height: 30px;
|
|
123
|
-
|
|
124
126
|
p {
|
|
125
127
|
margin: 0;
|
|
126
128
|
}
|
|
@@ -38,7 +38,8 @@ export const UserFormDetailsUI = (props) => {
|
|
|
38
38
|
confirmDataLayout,
|
|
39
39
|
inputsconfirmData,
|
|
40
40
|
handleRequestCustomerAddress,
|
|
41
|
-
setCellphoneStartZero
|
|
41
|
+
setCellphoneStartZero,
|
|
42
|
+
dontToggleEditMode
|
|
42
43
|
} = props
|
|
43
44
|
|
|
44
45
|
const formMethods = useForm()
|
|
@@ -114,6 +115,9 @@ export const UserFormDetailsUI = (props) => {
|
|
|
114
115
|
})
|
|
115
116
|
return
|
|
116
117
|
}
|
|
118
|
+
if (Object.keys(formState.changes).length === 0 && isPhoneNumberValid && confirmDataLayout) {
|
|
119
|
+
handleRequestCustomerAddress()
|
|
120
|
+
}
|
|
117
121
|
if (Object.keys(formState.changes).length > 0 && isPhoneNumberValid) {
|
|
118
122
|
let changes = null
|
|
119
123
|
if (user?.cellphone && !userPhoneNumber) {
|
|
@@ -125,7 +129,10 @@ export const UserFormDetailsUI = (props) => {
|
|
|
125
129
|
if (isCustomerMode) {
|
|
126
130
|
setUserCustomer(formState.result.result, true)
|
|
127
131
|
}
|
|
128
|
-
handleButtonUpdateClick(
|
|
132
|
+
handleButtonUpdateClick({
|
|
133
|
+
...changes,
|
|
134
|
+
confirmDataLayout
|
|
135
|
+
}, null, null, { dontToggleEditMode })
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
|
|
@@ -206,7 +213,7 @@ export const UserFormDetailsUI = (props) => {
|
|
|
206
213
|
setUserCellPhone(true)
|
|
207
214
|
}
|
|
208
215
|
}
|
|
209
|
-
if (!isEdit) onCancel()
|
|
216
|
+
if (!isEdit) onCancel && onCancel()
|
|
210
217
|
}, [user, isEdit])
|
|
211
218
|
|
|
212
219
|
useEffect(() => {
|
|
@@ -237,7 +244,12 @@ export const UserFormDetailsUI = (props) => {
|
|
|
237
244
|
</React.Fragment>))}
|
|
238
245
|
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
239
246
|
<BeforeComponent key={i} {...props} />))}
|
|
240
|
-
<FormInput
|
|
247
|
+
<FormInput
|
|
248
|
+
onSubmit={formMethods.handleSubmit(onSubmit)}
|
|
249
|
+
isCheckout={isCheckout}
|
|
250
|
+
isEdit={isEdit}
|
|
251
|
+
confirmDataLayout={confirmDataLayout}
|
|
252
|
+
>
|
|
241
253
|
{!validationFields?.loading ? (
|
|
242
254
|
<>
|
|
243
255
|
{
|
|
@@ -250,13 +262,17 @@ export const UserFormDetailsUI = (props) => {
|
|
|
250
262
|
props.beforeMidComponents?.map((BeforeMidComponents, i) => (
|
|
251
263
|
<BeforeMidComponents key={i} {...props} />))
|
|
252
264
|
}
|
|
253
|
-
|
|
254
|
-
|
|
265
|
+
{!confirmDataLayout && (
|
|
266
|
+
<Divider />
|
|
267
|
+
)}
|
|
268
|
+
{sortInputFields({ values: inputsconfirmData || validationFields?.fields?.checkout }).map(field =>
|
|
255
269
|
showField && showField(field.code) && (
|
|
256
270
|
<React.Fragment key={field.id}>
|
|
257
271
|
{field.code === 'email' ? (
|
|
258
272
|
<InputGroup>
|
|
259
|
-
|
|
273
|
+
{!confirmDataLayout && (
|
|
274
|
+
<p>{t(field.code.toUpperCase(), field?.name)}</p>
|
|
275
|
+
)}
|
|
260
276
|
<Input
|
|
261
277
|
key={field.id}
|
|
262
278
|
type={field.type}
|
|
@@ -278,8 +294,10 @@ export const UserFormDetailsUI = (props) => {
|
|
|
278
294
|
/>
|
|
279
295
|
</InputGroup>
|
|
280
296
|
) : (
|
|
281
|
-
<InputGroup>
|
|
282
|
-
|
|
297
|
+
<InputGroup confirmDataLayout={confirmDataLayout}>
|
|
298
|
+
{!confirmDataLayout && (
|
|
299
|
+
<p>{t(field.code.toUpperCase(), field?.name)}</p>
|
|
300
|
+
)}
|
|
283
301
|
<Input
|
|
284
302
|
key={field.id}
|
|
285
303
|
type={field.type}
|
|
@@ -308,8 +326,10 @@ export const UserFormDetailsUI = (props) => {
|
|
|
308
326
|
)
|
|
309
327
|
)}
|
|
310
328
|
{!!showInputPhoneNumber && (
|
|
311
|
-
<InputPhoneNumberWrapper>
|
|
312
|
-
|
|
329
|
+
<InputPhoneNumberWrapper confirmDataLayout={confirmDataLayout}>
|
|
330
|
+
{!confirmDataLayout && (
|
|
331
|
+
<p>{t('PHONE', 'Phone')}</p>
|
|
332
|
+
)}
|
|
313
333
|
<InputPhoneNumber
|
|
314
334
|
user={user}
|
|
315
335
|
value={userPhoneNumber}
|
|
@@ -319,7 +339,9 @@ export const UserFormDetailsUI = (props) => {
|
|
|
319
339
|
/>
|
|
320
340
|
</InputPhoneNumberWrapper>
|
|
321
341
|
)}
|
|
322
|
-
|
|
342
|
+
{!confirmDataLayout && (
|
|
343
|
+
<Divider />
|
|
344
|
+
)}
|
|
323
345
|
{
|
|
324
346
|
props.afterMidElements?.map((MidElement, i) => (
|
|
325
347
|
<React.Fragment key={i}>
|
|
@@ -331,14 +353,18 @@ export const UserFormDetailsUI = (props) => {
|
|
|
331
353
|
<MidComponent key={i} {...props} />))
|
|
332
354
|
}
|
|
333
355
|
<ActionsForm>
|
|
334
|
-
{((formState && Object.keys(formState?.changes).length > 0 && isEdit) || formState?.loading) && (
|
|
356
|
+
{((formState && Object.keys(formState?.changes).length > 0 && isEdit) || formState?.loading || confirmDataLayout) && (
|
|
335
357
|
<Button
|
|
336
358
|
id='form-btn'
|
|
337
359
|
color='primary'
|
|
338
360
|
type='submit'
|
|
339
361
|
disabled={formState.loading}
|
|
340
362
|
>
|
|
341
|
-
{
|
|
363
|
+
{confirmDataLayout
|
|
364
|
+
? t('SEND_SMS', 'Send sms')
|
|
365
|
+
: formState.loading
|
|
366
|
+
? t('UPDATING', 'Updating...')
|
|
367
|
+
: t('UPDATE', 'Update')}
|
|
342
368
|
</Button>
|
|
343
369
|
)}
|
|
344
370
|
</ActionsForm>
|
|
@@ -96,7 +96,16 @@ export const SkeletonForm = styled.div`
|
|
|
96
96
|
|
|
97
97
|
export const InputGroup = styled.div`
|
|
98
98
|
width: 100%;
|
|
99
|
-
|
|
99
|
+
${({ confirmDataLayout }) => confirmDataLayout && css`
|
|
100
|
+
padding: 0 20px;
|
|
101
|
+
width: 50%;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
input {
|
|
104
|
+
border: 1px solid #DEE2E6;
|
|
105
|
+
border-radius: 7.6px;
|
|
106
|
+
padding: 10px 15px !important;
|
|
107
|
+
}
|
|
108
|
+
`}
|
|
100
109
|
p {
|
|
101
110
|
font-weight: 500;
|
|
102
111
|
font-size: 20px;
|
|
@@ -115,6 +124,7 @@ export const Divider = styled.div`
|
|
|
115
124
|
`
|
|
116
125
|
|
|
117
126
|
export const InputPhoneNumberWrapper = styled(InputGroup)`
|
|
127
|
+
width: 100%;
|
|
118
128
|
.PhoneInput {
|
|
119
129
|
border-bottom: 1px solid #E9ECEF;
|
|
120
130
|
input {
|
|
@@ -122,6 +132,14 @@ export const InputPhoneNumberWrapper = styled(InputGroup)`
|
|
|
122
132
|
border-radius: 0px;
|
|
123
133
|
padding: 5px;
|
|
124
134
|
}
|
|
135
|
+
${({ confirmDataLayout }) => confirmDataLayout && css`
|
|
136
|
+
border-bottom: 0px;
|
|
137
|
+
input {
|
|
138
|
+
border: 1px solid #DEE2E6;
|
|
139
|
+
border-radius: 7.6px;
|
|
140
|
+
padding: 10px 15px !important;
|
|
141
|
+
}
|
|
142
|
+
`}
|
|
125
143
|
}
|
|
126
144
|
`
|
|
127
145
|
|
|
@@ -188,7 +188,7 @@ export const BusinessBasicInformation = (props) => {
|
|
|
188
188
|
<SearchProducts
|
|
189
189
|
{...props}
|
|
190
190
|
onClose={() => {
|
|
191
|
-
handleChangeSearch('')
|
|
191
|
+
handleChangeSearch && handleChangeSearch('')
|
|
192
192
|
setOpenSearchProducts(false)
|
|
193
193
|
window.scroll({
|
|
194
194
|
top: window.scrollY - 1,
|
package/src/themes/five/src/components/BusinessController/franchises/OloBusinessController/index.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react'
|
|
2
|
+
import { BusinessController as BusinessSingleCard, useLanguage, useSession, useUtils } from 'ordering-components-external'
|
|
3
|
+
import Skeleton from 'react-loading-skeleton'
|
|
4
|
+
import { useTheme } from 'styled-components'
|
|
5
|
+
import { Alert } from '../../../Confirm'
|
|
6
|
+
import { convertHoursToMinutes } from '../../../../../../../utils'
|
|
7
|
+
import {
|
|
8
|
+
ContainerCard,
|
|
9
|
+
WrapperBusinessCard,
|
|
10
|
+
WrapperBusinessLogo,
|
|
11
|
+
BusinessContent,
|
|
12
|
+
BusinessLogo,
|
|
13
|
+
BusinessInfo,
|
|
14
|
+
BusinessInfoItem,
|
|
15
|
+
BusinessName,
|
|
16
|
+
Categories,
|
|
17
|
+
Medadata,
|
|
18
|
+
NameWrapper,
|
|
19
|
+
BusinessInfomation,
|
|
20
|
+
Address,
|
|
21
|
+
SelectStoreContainer,
|
|
22
|
+
FavoriteWrapper
|
|
23
|
+
} from './styles'
|
|
24
|
+
import BisStar from '@meronex/icons/bi/BisStar'
|
|
25
|
+
import GoPrimitiveDot from '@meronex/icons/go/GoPrimitiveDot'
|
|
26
|
+
import { Heart as DisLike, HeartFill as Like } from 'react-bootstrap-icons'
|
|
27
|
+
import dayjs from 'dayjs'
|
|
28
|
+
import { Button } from '../../../../styles/Buttons'
|
|
29
|
+
|
|
30
|
+
const BusinessControllerUI = (props) => {
|
|
31
|
+
const {
|
|
32
|
+
isSkeleton,
|
|
33
|
+
business,
|
|
34
|
+
orderState,
|
|
35
|
+
handleClick,
|
|
36
|
+
isCustomLayout,
|
|
37
|
+
isShowCallcenterInformation,
|
|
38
|
+
handleFavoriteBusiness,
|
|
39
|
+
businessDeliveryPrice,
|
|
40
|
+
businessDeliveryTime,
|
|
41
|
+
businessDistance,
|
|
42
|
+
businessPickupTime
|
|
43
|
+
} = props
|
|
44
|
+
const theme = useTheme()
|
|
45
|
+
const [, t] = useLanguage()
|
|
46
|
+
const [{ parsePrice, parseDistance, optimizeImage }] = useUtils()
|
|
47
|
+
const [{ auth }] = useSession()
|
|
48
|
+
const favoriteRef = useRef(null)
|
|
49
|
+
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
50
|
+
|
|
51
|
+
const layout = theme?.business_listing_view?.components?.layout?.type || 'starbucks'
|
|
52
|
+
const hideCategories = theme?.business_listing_view?.components?.business?.components?.categories?.hidden
|
|
53
|
+
const hideAddress = theme?.business_listing_view?.components?.business?.components?.address?.hidden ?? true
|
|
54
|
+
const hideBusinessFavorite = theme?.business_listing_view?.components?.business?.components?.favorite?.hidden
|
|
55
|
+
|
|
56
|
+
const handleShowAlert = () => {
|
|
57
|
+
setAlertState({ open: true, content: [t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The Business is closed at the moment')] })
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const handleChangeFavorite = () => {
|
|
61
|
+
if (auth) {
|
|
62
|
+
handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const scheduleFormatted = ({ hour, minute }) => {
|
|
67
|
+
const checkTime = (val) => val < 10 ? `0${val}` : val
|
|
68
|
+
return `${checkTime(hour)}:${checkTime(minute)}`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const getScheduleOpen = (business) => {
|
|
72
|
+
const currentDate = dayjs().tz(business?.timezone)
|
|
73
|
+
let lapse = null
|
|
74
|
+
if (business?.today?.enabled) {
|
|
75
|
+
lapse = business?.today?.lapses?.find(lapse => {
|
|
76
|
+
const from = currentDate.hour(lapse.open.hour).minute(lapse.open.minute)
|
|
77
|
+
const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
|
|
78
|
+
return currentDate.unix() >= from.unix() && currentDate.unix() <= to.unix()
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
return lapse ? `${scheduleFormatted(lapse.open)} - ${scheduleFormatted(lapse.close)}` : ''
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const handleClickBusiness = (e, business) => {
|
|
85
|
+
if (favoriteRef?.current?.contains(e.target)) return
|
|
86
|
+
handleClick(business)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
|
|
92
|
+
<ContainerCard isSkeleton={isSkeleton}>
|
|
93
|
+
<WrapperBusinessCard isSkeleton={isSkeleton}>
|
|
94
|
+
<BusinessContent>
|
|
95
|
+
<WrapperBusinessLogo isSkeleton={isSkeleton}>
|
|
96
|
+
{!isSkeleton && (business?.logo || theme.images?.dummies?.businessLogo) ? (
|
|
97
|
+
<BusinessLogo bgimage={optimizeImage(business?.logo || theme.images?.dummies?.businessLogo, 'h_200,c_limit')} />
|
|
98
|
+
) : (
|
|
99
|
+
<Skeleton height={70} width={70} />
|
|
100
|
+
)}
|
|
101
|
+
</WrapperBusinessLogo>
|
|
102
|
+
<BusinessInfo className='info'>
|
|
103
|
+
<BusinessInfoItem>
|
|
104
|
+
<NameWrapper>
|
|
105
|
+
{business?.name ? (
|
|
106
|
+
<BusinessName>{business?.name}</BusinessName>
|
|
107
|
+
) : (
|
|
108
|
+
<Skeleton width={100} />
|
|
109
|
+
)}
|
|
110
|
+
<BusinessInfomation>
|
|
111
|
+
{business?.reviews?.total > 0 ? (
|
|
112
|
+
<div className='reviews'>
|
|
113
|
+
<BisStar />
|
|
114
|
+
<span>{business?.reviews?.total}</span>
|
|
115
|
+
</div>
|
|
116
|
+
) : (
|
|
117
|
+
business?.reviews?.total !== 0 && <Skeleton width={50} />
|
|
118
|
+
)}
|
|
119
|
+
{!hideBusinessFavorite && (
|
|
120
|
+
<FavoriteWrapper ref={favoriteRef} onClick={handleChangeFavorite}>
|
|
121
|
+
{!isSkeleton ? (
|
|
122
|
+
<>
|
|
123
|
+
{(business?.favorite) ? <Like /> : <DisLike />}
|
|
124
|
+
</>
|
|
125
|
+
) : (
|
|
126
|
+
<Skeleton width={16} height={16} />
|
|
127
|
+
)}
|
|
128
|
+
</FavoriteWrapper>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
</BusinessInfomation>
|
|
132
|
+
</NameWrapper>
|
|
133
|
+
{!isShowCallcenterInformation && !hideCategories && (
|
|
134
|
+
<Categories>
|
|
135
|
+
{
|
|
136
|
+
Object.keys(business).length > 0 ? (
|
|
137
|
+
<>
|
|
138
|
+
{business?.address}
|
|
139
|
+
</>
|
|
140
|
+
) : (
|
|
141
|
+
<Skeleton width={100} />
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
</Categories>
|
|
145
|
+
)}
|
|
146
|
+
{!isShowCallcenterInformation && !hideAddress && (
|
|
147
|
+
<Address>
|
|
148
|
+
{
|
|
149
|
+
Object.keys(business).length > 0 ? (
|
|
150
|
+
business?.address
|
|
151
|
+
) : (
|
|
152
|
+
<Skeleton width={100} />
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
</Address>
|
|
156
|
+
)}
|
|
157
|
+
{layout !== 'mapview' && (
|
|
158
|
+
<Medadata isCustomerMode={isShowCallcenterInformation}>
|
|
159
|
+
{(businessDeliveryPrice || business?.delivery_price) >= 0 ? (
|
|
160
|
+
<p>
|
|
161
|
+
<span>{t('DELIVERY_FEE', 'Delivery fee')}</span>
|
|
162
|
+
{business && parsePrice((businessDeliveryPrice ?? business?.delivery_price))}
|
|
163
|
+
</p>
|
|
164
|
+
) : (
|
|
165
|
+
<Skeleton width={65} />
|
|
166
|
+
)}
|
|
167
|
+
<>
|
|
168
|
+
{Object.keys(business).length > 0 ? (
|
|
169
|
+
<p className='bullet'>
|
|
170
|
+
<GoPrimitiveDot />
|
|
171
|
+
{convertHoursToMinutes(orderState?.options?.type === 1 ? (businessDeliveryTime ?? business?.delivery_time) : (businessPickupTime ?? business?.pickup_time)) || <Skeleton width={100} />}
|
|
172
|
+
</p>
|
|
173
|
+
) : (
|
|
174
|
+
<Skeleton width={65} />
|
|
175
|
+
)}
|
|
176
|
+
</>
|
|
177
|
+
<>
|
|
178
|
+
{(businessDistance ?? business?.distance) >= 0 ? (
|
|
179
|
+
<p className='bullet'>
|
|
180
|
+
<GoPrimitiveDot />
|
|
181
|
+
{parseDistance((businessDistance ?? business?.distance))}
|
|
182
|
+
</p>
|
|
183
|
+
) : (
|
|
184
|
+
<Skeleton width={65} />
|
|
185
|
+
)}
|
|
186
|
+
</>
|
|
187
|
+
</Medadata>
|
|
188
|
+
)}
|
|
189
|
+
<Medadata final>
|
|
190
|
+
{!isSkeleton > 0 ? (
|
|
191
|
+
<>
|
|
192
|
+
<div className='schedule'>
|
|
193
|
+
{`${t('SCHEDULE', 'Schedule')}: ${getScheduleOpen(business)}`}
|
|
194
|
+
</div>
|
|
195
|
+
<SelectStoreContainer>
|
|
196
|
+
<Button
|
|
197
|
+
outline
|
|
198
|
+
onClick={(e) => !isSkeleton && handleClick && (!business?.open && isCustomLayout ? handleShowAlert() : handleClickBusiness(e, business))}
|
|
199
|
+
>
|
|
200
|
+
{t('START_ORDER', 'Start order')}
|
|
201
|
+
</Button>
|
|
202
|
+
</SelectStoreContainer>
|
|
203
|
+
</>
|
|
204
|
+
) : (
|
|
205
|
+
<>
|
|
206
|
+
<Skeleton width={70} />
|
|
207
|
+
<Skeleton width={120} height={20} />
|
|
208
|
+
</>
|
|
209
|
+
)}
|
|
210
|
+
</Medadata>
|
|
211
|
+
</BusinessInfoItem>
|
|
212
|
+
</BusinessInfo>
|
|
213
|
+
</BusinessContent>
|
|
214
|
+
</WrapperBusinessCard>
|
|
215
|
+
</ContainerCard>
|
|
216
|
+
<Alert
|
|
217
|
+
title={t('BUSINESS_CLOSED', 'Business Closed')}
|
|
218
|
+
content={alertState.content}
|
|
219
|
+
acceptText={t('ACCEPT', 'Accept')}
|
|
220
|
+
open={alertState.open}
|
|
221
|
+
onClose={() => setAlertState({ open: false, content: [] })}
|
|
222
|
+
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
223
|
+
closeOnBackdrop={false}
|
|
224
|
+
/>
|
|
225
|
+
</>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export const BusinessController = (props) => {
|
|
230
|
+
const businessControllerProps = {
|
|
231
|
+
...props,
|
|
232
|
+
UIComponent: BusinessControllerUI
|
|
233
|
+
}
|
|
234
|
+
return (
|
|
235
|
+
<BusinessSingleCard {...businessControllerProps} />
|
|
236
|
+
)
|
|
237
|
+
}
|