ordering-ui-react-native 0.15.90 → 0.15.93
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/package.json +1 -1
- package/src/components/Checkout/index.tsx +23 -2
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/NewOrderNotification/index.tsx +24 -13
- package/themes/business/src/components/OrderDetails/Delivery.tsx +11 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +1 -0
- package/themes/business/src/components/OrdersOption/index.tsx +5 -2
- package/themes/business/src/types/index.tsx +3 -0
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +23 -25
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
- package/themes/kiosk/src/components/Cart/index.tsx +10 -11
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +36 -30
- package/themes/kiosk/src/components/Checkout/index.tsx +22 -19
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +1 -1
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +54 -52
- package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
- package/themes/original/src/components/AppleLogin/index.tsx +2 -4
- package/themes/original/src/components/BusinessListingSearch/index.tsx +117 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -1
- package/themes/original/src/components/Checkout/index.tsx +36 -28
- package/themes/original/src/components/DriverTips/index.tsx +6 -6
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +42 -9
- package/themes/original/src/components/LoginForm/styles.tsx +1 -3
- package/themes/original/src/components/OrderDetails/index.tsx +18 -21
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
- package/themes/original/src/components/ProductForm/index.tsx +48 -40
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
- package/themes/original/src/components/Promotions/index.tsx +18 -2
- package/themes/original/src/types/index.tsx +3 -1
|
@@ -110,7 +110,6 @@ const CartUI = (props: any) => {
|
|
|
110
110
|
<NavBar
|
|
111
111
|
title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
|
|
112
112
|
onActionLeft={goToBack}
|
|
113
|
-
style={{ height: orientationState?.dimensions?.height * 0.08 }}
|
|
114
113
|
btnStyle={{ paddingLeft: 0 }}
|
|
115
114
|
rightComponent={(
|
|
116
115
|
<OButton
|
|
@@ -238,8 +237,8 @@ const CartUI = (props: any) => {
|
|
|
238
237
|
</OSTable>
|
|
239
238
|
)}
|
|
240
239
|
{
|
|
241
|
-
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
|
|
242
|
-
<OSTable key={offer
|
|
240
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
|
|
241
|
+
<OSTable key={`${offer?.id}_${i}`}>
|
|
243
242
|
<OSRow>
|
|
244
243
|
<OText>{offer.name}</OText>
|
|
245
244
|
{offer.rate_type === 1 && (
|
|
@@ -263,8 +262,8 @@ const CartUI = (props: any) => {
|
|
|
263
262
|
</OSTable>
|
|
264
263
|
)}
|
|
265
264
|
{
|
|
266
|
-
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
|
|
267
|
-
<OSTable key={tax
|
|
265
|
+
cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
|
|
266
|
+
<OSTable key={`${tax?.id}_${i}`}>
|
|
268
267
|
<OSRow>
|
|
269
268
|
<OText>
|
|
270
269
|
{tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
@@ -276,8 +275,8 @@ const CartUI = (props: any) => {
|
|
|
276
275
|
))
|
|
277
276
|
}
|
|
278
277
|
{
|
|
279
|
-
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
|
|
280
|
-
<OSTable key={fee?.id}>
|
|
278
|
+
cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
|
|
279
|
+
<OSTable key={`${fee?.id}_${i}`}>
|
|
281
280
|
<OSRow>
|
|
282
281
|
<OText>
|
|
283
282
|
{fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
|
|
@@ -289,8 +288,8 @@ const CartUI = (props: any) => {
|
|
|
289
288
|
))
|
|
290
289
|
}
|
|
291
290
|
{
|
|
292
|
-
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
|
|
293
|
-
<OSTable key={offer
|
|
291
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any, i: number) => (
|
|
292
|
+
<OSTable key={`${offer?.id}_${i}`}>
|
|
294
293
|
<OSRow>
|
|
295
294
|
<OText>{offer.name}</OText>
|
|
296
295
|
{offer.rate_type === 1 && (
|
|
@@ -310,8 +309,8 @@ const CartUI = (props: any) => {
|
|
|
310
309
|
</OSTable>
|
|
311
310
|
)}
|
|
312
311
|
{
|
|
313
|
-
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
|
|
314
|
-
<OSTable key={offer
|
|
312
|
+
cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
|
|
313
|
+
<OSTable key={`${offer?.id}_${i}`}>
|
|
315
314
|
<OSRow>
|
|
316
315
|
<OText>{offer.name}</OText>
|
|
317
316
|
{offer.rate_type === 1 && (
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
OText
|
|
13
13
|
} from '../../components/shared';
|
|
14
14
|
import { CartBottomSheet } from '../../components/CartBottomSheet';
|
|
15
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
15
16
|
import { Category } from '../../types';
|
|
16
17
|
import { CartContent } from '../../components/CartContent';
|
|
17
18
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
@@ -112,37 +113,36 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
112
113
|
}}
|
|
113
114
|
>
|
|
114
115
|
<Container nopadding nestedScrollEnabled>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
<NavBar
|
|
117
|
+
title={categories[curIndexCateg].name}
|
|
118
|
+
onActionLeft={goToBack}
|
|
119
|
+
rightComponent={cart && (
|
|
120
|
+
<TouchableOpacity
|
|
121
|
+
style={{ paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center' }}
|
|
122
|
+
onPress={onToggleCart}
|
|
123
|
+
>
|
|
124
|
+
<OText
|
|
125
|
+
color={theme.colors.mediumGray}
|
|
123
126
|
>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
onSelectItem={onChangeTabs}
|
|
144
|
-
/>
|
|
145
|
-
</View>
|
|
127
|
+
{`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
|
|
128
|
+
</OText>
|
|
129
|
+
|
|
130
|
+
<MaterialIcon
|
|
131
|
+
name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
|
|
132
|
+
color={theme.colors.primary}
|
|
133
|
+
size={30}
|
|
134
|
+
/>
|
|
135
|
+
</TouchableOpacity>
|
|
136
|
+
)}
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<OSegment
|
|
140
|
+
items={categories.map((category) => ({
|
|
141
|
+
text: category.name
|
|
142
|
+
}))}
|
|
143
|
+
selectedIdx={curIndexCateg}
|
|
144
|
+
onSelectItem={onChangeTabs}
|
|
145
|
+
/>
|
|
146
146
|
|
|
147
147
|
<GridContainer
|
|
148
148
|
style={{
|
|
@@ -182,6 +182,12 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
182
182
|
}}
|
|
183
183
|
/>
|
|
184
184
|
))}
|
|
185
|
+
|
|
186
|
+
{categories[curIndexCateg].products.length === 0 && (
|
|
187
|
+
<NotFoundSource
|
|
188
|
+
content={t('ERROR_NOT_FOUND_PRODUCTS_TIME', 'No products found at this time')}
|
|
189
|
+
/>
|
|
190
|
+
)}
|
|
185
191
|
</GridContainer>
|
|
186
192
|
</Container>
|
|
187
193
|
</View>
|
|
@@ -36,27 +36,30 @@ const CheckoutUI = (props: any) => {
|
|
|
36
36
|
|
|
37
37
|
const [errorCash, setErrorCash] = useState(false);
|
|
38
38
|
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
|
|
41
|
+
navigation?.canGoBack() && navigation.goBack()
|
|
42
|
+
}
|
|
43
|
+
}, [cart])
|
|
44
|
+
|
|
39
45
|
return (
|
|
40
46
|
<>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
setErrorCash={setErrorCash}
|
|
58
|
-
/>
|
|
59
|
-
)}
|
|
47
|
+
<PaymentOptions
|
|
48
|
+
navigation={navigation}
|
|
49
|
+
cart={cart}
|
|
50
|
+
errors={errors}
|
|
51
|
+
onPaymentChange={handlePaymethodChange}
|
|
52
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
53
|
+
paySelected={paymethodSelected}
|
|
54
|
+
handlerClickPlaceOrder={handlerClickPlaceOrder}
|
|
55
|
+
placing={placing}
|
|
56
|
+
errorCash={errorCash}
|
|
57
|
+
isDisabled={cart?.status === 2}
|
|
58
|
+
businessId={businessDetails?.business?.id}
|
|
59
|
+
isLoading={cartState.loading || businessDetails.loading}
|
|
60
|
+
paymethods={businessDetails?.business?.paymethods}
|
|
61
|
+
setErrorCash={setErrorCash}
|
|
62
|
+
/>
|
|
60
63
|
</>
|
|
61
64
|
)
|
|
62
65
|
}
|
|
@@ -192,64 +192,66 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
192
192
|
<Spinner visible={isLoading || placing || paymethodsList?.loading} />
|
|
193
193
|
|
|
194
194
|
<Container nestedScrollEnabled>
|
|
195
|
-
<NavBar
|
|
196
|
-
title={t('PAYMENT_METHODS', 'Payment methods')}
|
|
197
|
-
onActionLeft={goToBack}
|
|
198
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
199
|
-
/>
|
|
200
|
-
|
|
201
|
-
<View
|
|
202
|
-
style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
|
|
203
|
-
<OText size={orientationState?.dimensions?.width * 0.048}>
|
|
204
|
-
{t('HOW_WOULD_YOU', 'How would you')} {'\n'}
|
|
205
|
-
<OText
|
|
206
|
-
size={orientationState?.dimensions?.width * 0.048}
|
|
207
|
-
weight={'700'}>
|
|
208
|
-
{`${t('LIKE_TO_PAY', 'like to pay')}?`}
|
|
209
|
-
</OText>
|
|
210
|
-
</OText>
|
|
211
|
-
</View>
|
|
212
|
-
|
|
213
195
|
{supportedMethods?.length > 0 && (
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
196
|
+
<>
|
|
197
|
+
<NavBar
|
|
198
|
+
title={t('PAYMENT_METHODS', 'Payment methods')}
|
|
199
|
+
onActionLeft={goToBack}
|
|
200
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
201
|
+
/>
|
|
220
202
|
|
|
221
203
|
<View
|
|
222
|
-
style={{
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
/>
|
|
204
|
+
style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
|
|
205
|
+
<OText size={orientationState?.dimensions?.width * 0.048}>
|
|
206
|
+
{t('HOW_WOULD_YOU', 'How would you')} {'\n'}
|
|
207
|
+
<OText
|
|
208
|
+
size={orientationState?.dimensions?.width * 0.048}
|
|
209
|
+
weight={'700'}>
|
|
210
|
+
{`${t('LIKE_TO_PAY', 'like to pay')}?`}
|
|
211
|
+
</OText>
|
|
212
|
+
</OText>
|
|
213
|
+
</View>
|
|
233
214
|
|
|
234
|
-
{
|
|
215
|
+
<GridContainer style={{ justifyContent: 'space-between' }}>
|
|
216
|
+
{propsOfItems.CARD_ON_DELIVERY_ID && (
|
|
217
|
+
<View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
|
|
218
|
+
<OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke />
|
|
219
|
+
</View>
|
|
220
|
+
)}
|
|
235
221
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
222
|
+
<View
|
|
223
|
+
style={{
|
|
224
|
+
width:
|
|
225
|
+
orientationState?.orientation === LANDSCAPE
|
|
226
|
+
? orientationState?.dimensions?.width * 0.0016
|
|
227
|
+
: 1,
|
|
228
|
+
height:
|
|
229
|
+
orientationState?.orientation === PORTRAIT
|
|
230
|
+
? orientationState?.dimensions?.height * 0.018
|
|
231
|
+
: 1,
|
|
232
|
+
}}
|
|
233
|
+
/>
|
|
234
|
+
|
|
235
|
+
{propsOfItems?.CASH_ID && <OptionCard {...propsOfItems?.CASH_ID} />}
|
|
236
|
+
|
|
237
|
+
<View
|
|
238
|
+
style={{
|
|
239
|
+
width:
|
|
240
|
+
orientationState?.orientation === LANDSCAPE
|
|
241
|
+
? orientationState?.dimensions?.width * 0.0016
|
|
242
|
+
: 1,
|
|
243
|
+
height:
|
|
244
|
+
orientationState?.orientation === PORTRAIT
|
|
245
|
+
? orientationState?.dimensions?.height * 0.018
|
|
246
|
+
: 1,
|
|
247
|
+
}}
|
|
248
|
+
/>
|
|
248
249
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
{propsOfItems.STRIPE && (
|
|
251
|
+
<OptionCard {...propsOfItems?.STRIPE} />
|
|
252
|
+
)}
|
|
253
|
+
</GridContainer>
|
|
254
|
+
</>
|
|
253
255
|
)}
|
|
254
256
|
<View style={{ height: orientationState?.dimensions?.height * 0.05 }} />
|
|
255
257
|
<OModal
|
|
@@ -144,13 +144,15 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
144
144
|
</PositionControl>
|
|
145
145
|
)
|
|
146
146
|
}
|
|
147
|
+
{price > 0 && (
|
|
147
148
|
<OText
|
|
148
149
|
color="#909BA9"
|
|
149
150
|
size={16}
|
|
150
151
|
weight="bold"
|
|
151
152
|
>
|
|
152
|
-
|
|
153
|
+
+ {parsePrice(price)}
|
|
153
154
|
</OText>
|
|
155
|
+
)}
|
|
154
156
|
</RightSide>
|
|
155
157
|
</Container>
|
|
156
158
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Platform, Text, StyleSheet } from 'react-native';
|
|
3
|
-
import { useApi, useSession, useLanguage, useConfig
|
|
3
|
+
import { useApi, useSession, useLanguage, useConfig } from 'ordering-components/native';
|
|
4
4
|
import { appleAuthAndroid, appleAuth } from '@invertase/react-native-apple-authentication';
|
|
5
5
|
import uuid from 'react-native-uuid';
|
|
6
6
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
|
@@ -19,14 +19,13 @@ export const AppleLogin = (props: any) => {
|
|
|
19
19
|
const [{ auth }] = useSession();
|
|
20
20
|
const [, t] = useLanguage();
|
|
21
21
|
const [{ configs }] = useConfig();
|
|
22
|
-
const [, {showToast}] = useToast()
|
|
23
22
|
const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
|
|
24
23
|
|
|
25
24
|
let user : any= null
|
|
26
25
|
|
|
27
26
|
const buttonText = auth
|
|
28
27
|
? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
|
|
29
|
-
: t('
|
|
28
|
+
: t('CONTINUE_WITH_APPLE', 'Continue with Apple');
|
|
30
29
|
|
|
31
30
|
const performAppleLogin = async (code: string) => {
|
|
32
31
|
try {
|
|
@@ -88,7 +87,6 @@ export const AppleLogin = (props: any) => {
|
|
|
88
87
|
);
|
|
89
88
|
|
|
90
89
|
if (identityToken && authorizationCode) {
|
|
91
|
-
showToast(ToastType.Success, `Apple Authentication Completed, ${email}`)
|
|
92
90
|
performAppleLogin(authorizationCode)
|
|
93
91
|
} else {
|
|
94
92
|
handleErrors && handleErrors('UNABLE_LOGIN_TOKEN', 'Unable to login, no token found')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
|
|
3
|
-
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
|
|
3
|
+
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useTheme } from 'styled-components/native'
|
|
6
6
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
@@ -22,15 +22,18 @@ import {
|
|
|
22
22
|
ProgressContentWrapper,
|
|
23
23
|
ProgressBar,
|
|
24
24
|
TagsContainer,
|
|
25
|
-
SortContainer
|
|
25
|
+
SortContainer,
|
|
26
|
+
BrandContainer,
|
|
27
|
+
BrandItem,
|
|
28
|
+
PriceFilterWrapper
|
|
26
29
|
} from './styles'
|
|
27
30
|
import FastImage from 'react-native-fast-image'
|
|
28
31
|
import { convertHoursToMinutes } from '../../utils'
|
|
29
32
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
30
33
|
import { BusinessSearchParams } from '../../types'
|
|
31
34
|
|
|
32
|
-
export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
33
35
|
|
|
36
|
+
export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
34
37
|
const {
|
|
35
38
|
navigation,
|
|
36
39
|
businessesSearchList,
|
|
@@ -42,9 +45,11 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
42
45
|
handleChangeFilters,
|
|
43
46
|
filters,
|
|
44
47
|
businessTypes,
|
|
45
|
-
setFilters
|
|
48
|
+
setFilters,
|
|
49
|
+
brandList
|
|
46
50
|
} = props
|
|
47
|
-
|
|
51
|
+
|
|
52
|
+
const screenHeight = Dimensions.get('window').height;
|
|
48
53
|
const theme = useTheme()
|
|
49
54
|
const [orderState] = useOrder()
|
|
50
55
|
const { top } = useSafeAreaInsets();
|
|
@@ -63,11 +68,24 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
63
68
|
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
64
69
|
]
|
|
65
70
|
|
|
71
|
+
const priceList = [
|
|
72
|
+
{ level: '1', content: '$' },
|
|
73
|
+
{ level: '2', content: '$$' },
|
|
74
|
+
{ level: '3', content: '$$$' },
|
|
75
|
+
{ level: '4', content: '$$$$' },
|
|
76
|
+
{ level: '5', content: '$$$$$' }
|
|
77
|
+
]
|
|
78
|
+
|
|
66
79
|
const styles = StyleSheet.create({
|
|
67
80
|
container: {
|
|
68
81
|
paddingHorizontal: 40,
|
|
69
82
|
width: '100%'
|
|
70
83
|
},
|
|
84
|
+
filterContainer: {
|
|
85
|
+
maxHeight: screenHeight - 150,
|
|
86
|
+
paddingHorizontal: 40,
|
|
87
|
+
width: '100%'
|
|
88
|
+
},
|
|
71
89
|
searchInput: {
|
|
72
90
|
fontSize: 10,
|
|
73
91
|
},
|
|
@@ -84,6 +102,12 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
84
102
|
flexWrap: 'wrap',
|
|
85
103
|
justifyContent: 'center'
|
|
86
104
|
},
|
|
105
|
+
priceContainer: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
flexWrap: 'wrap',
|
|
109
|
+
justifyContent: 'space-between'
|
|
110
|
+
},
|
|
87
111
|
categoryStyle: {
|
|
88
112
|
marginRight: 10,
|
|
89
113
|
marginTop: 10,
|
|
@@ -95,6 +119,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
95
119
|
height: 28,
|
|
96
120
|
borderWidth: 0
|
|
97
121
|
},
|
|
122
|
+
priceItem: {
|
|
123
|
+
marginRight: 10,
|
|
124
|
+
marginTop: 10,
|
|
125
|
+
borderRadius: 50,
|
|
126
|
+
paddingVertical: 4,
|
|
127
|
+
paddingLeft: 5,
|
|
128
|
+
paddingRight: 5,
|
|
129
|
+
height: 27,
|
|
130
|
+
borderWidth: 0
|
|
131
|
+
},
|
|
98
132
|
applyButton: {
|
|
99
133
|
paddingHorizontal: 40,
|
|
100
134
|
width: '100%',
|
|
@@ -107,7 +141,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
107
141
|
}
|
|
108
142
|
|
|
109
143
|
const handleCloseFilters = () => {
|
|
110
|
-
setFilters({ business_types: [], orderBy: 'default' })
|
|
144
|
+
setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
|
|
111
145
|
setOpenFilters(false)
|
|
112
146
|
}
|
|
113
147
|
|
|
@@ -126,6 +160,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
126
160
|
}
|
|
127
161
|
}
|
|
128
162
|
|
|
163
|
+
const handleChangeBrandFilter = (brandId: number) => {
|
|
164
|
+
let franchiseIds = [...filters?.franchise_ids]
|
|
165
|
+
if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
|
|
166
|
+
else franchiseIds.push(brandId)
|
|
167
|
+
handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const handleChangePriceRange = (value: string) => {
|
|
171
|
+
if (value === filters?.price_level) handleChangeFilters('price_level', null)
|
|
172
|
+
else handleChangeFilters('price_level', value)
|
|
173
|
+
}
|
|
174
|
+
|
|
129
175
|
const handleApplyFilters = () => {
|
|
130
176
|
handleSearchbusinessAndProducts(true)
|
|
131
177
|
setOpenFilters(false)
|
|
@@ -388,7 +434,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
388
434
|
onCancel={() => handleCloseFilters()}
|
|
389
435
|
onClose={() => handleCloseFilters()}
|
|
390
436
|
>
|
|
391
|
-
<ScrollView style={styles.
|
|
437
|
+
<ScrollView style={styles.filterContainer}>
|
|
392
438
|
<OText
|
|
393
439
|
size={20}
|
|
394
440
|
mBottom={15}
|
|
@@ -415,6 +461,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
415
461
|
</TouchableOpacity>
|
|
416
462
|
))}
|
|
417
463
|
</SortContainer>
|
|
464
|
+
<BrandContainer>
|
|
465
|
+
<OText
|
|
466
|
+
size={16}
|
|
467
|
+
weight='bold'
|
|
468
|
+
lineHeight={24}
|
|
469
|
+
style={{ marginBottom: 10 }}
|
|
470
|
+
>
|
|
471
|
+
{t('BRANDS', 'Brands')}
|
|
472
|
+
</OText>
|
|
473
|
+
{!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
|
|
474
|
+
<ScrollView
|
|
475
|
+
style={{ maxHeight: 300, marginBottom: 10 }}
|
|
476
|
+
showsVerticalScrollIndicator={true}
|
|
477
|
+
nestedScrollEnabled={true}
|
|
478
|
+
>
|
|
479
|
+
{brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
|
|
480
|
+
<BrandItem
|
|
481
|
+
key={i}
|
|
482
|
+
onPress={() => handleChangeBrandFilter(brand?.id)}
|
|
483
|
+
>
|
|
484
|
+
<OText
|
|
485
|
+
size={14}
|
|
486
|
+
weight={'400'}
|
|
487
|
+
lineHeight={24}
|
|
488
|
+
>
|
|
489
|
+
{brand?.name}
|
|
490
|
+
</OText>
|
|
491
|
+
{filters?.franchise_ids?.includes(brand?.id) && (
|
|
492
|
+
<AntDesignIcon
|
|
493
|
+
name='check'
|
|
494
|
+
color={theme.colors.success500}
|
|
495
|
+
size={16}
|
|
496
|
+
/>
|
|
497
|
+
)}
|
|
498
|
+
</BrandItem>
|
|
499
|
+
))}
|
|
500
|
+
</ScrollView>
|
|
501
|
+
)}
|
|
502
|
+
{!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
|
|
503
|
+
<OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
|
|
504
|
+
)}
|
|
505
|
+
</BrandContainer>
|
|
506
|
+
<PriceFilterWrapper>
|
|
507
|
+
<OText
|
|
508
|
+
size={16}
|
|
509
|
+
weight='bold'
|
|
510
|
+
lineHeight={24}
|
|
511
|
+
style={{ marginBottom: 5 }}
|
|
512
|
+
>
|
|
513
|
+
{t('PRICE_RANGE', 'Price range')}
|
|
514
|
+
</OText>
|
|
515
|
+
<View style={styles.priceContainer}>
|
|
516
|
+
{priceList.map((price: any, i: number) => (
|
|
517
|
+
<OButton
|
|
518
|
+
key={i}
|
|
519
|
+
bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
520
|
+
onClick={() => handleChangePriceRange(price?.level)}
|
|
521
|
+
text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
|
|
522
|
+
style={styles.priceItem}
|
|
523
|
+
textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
|
|
524
|
+
/>
|
|
525
|
+
))}
|
|
526
|
+
</View>
|
|
527
|
+
</PriceFilterWrapper>
|
|
418
528
|
{orderState?.options?.type === 1 && (
|
|
419
529
|
<MaxSectionItem
|
|
420
530
|
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
@@ -68,9 +68,22 @@ export const ProgressContentWrapper = styled.View`
|
|
|
68
68
|
`
|
|
69
69
|
|
|
70
70
|
export const TagsContainer = styled.View`
|
|
71
|
-
|
|
71
|
+
padding-bottom: 10px;
|
|
72
72
|
`
|
|
73
73
|
|
|
74
74
|
export const SortContainer = styled.View`
|
|
75
75
|
margin-bottom: 10px;
|
|
76
76
|
`
|
|
77
|
+
|
|
78
|
+
export const BrandContainer = styled.View``
|
|
79
|
+
|
|
80
|
+
export const BrandItem = styled.TouchableOpacity`
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
margin-bottom: 4px;
|
|
84
|
+
align-items: center;
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
export const PriceFilterWrapper = styled.View`
|
|
88
|
+
margin-bottom: 20px;
|
|
89
|
+
`
|
|
@@ -59,7 +59,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
59
59
|
handleBusinessClick,
|
|
60
60
|
paginationProps,
|
|
61
61
|
handleChangeSearch,
|
|
62
|
-
businessId
|
|
62
|
+
businessId,
|
|
63
|
+
isGuestUser
|
|
63
64
|
} = props;
|
|
64
65
|
const theme = useTheme();
|
|
65
66
|
const isFocused = useIsFocused();
|
|
@@ -242,6 +243,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
242
243
|
: navigation.navigate('AddressForm', {
|
|
243
244
|
address: orderState.options?.address,
|
|
244
245
|
isFromBusinesses: true,
|
|
246
|
+
isGuestUser: isGuestUser
|
|
245
247
|
})
|
|
246
248
|
}>
|
|
247
249
|
<OIcon
|