ordering-ui-react-native 0.21.94 → 0.21.96
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/themes/business/src/components/NewOrderNotification/index.tsx +9 -2
- package/themes/business/src/components/OrdersOption/index.tsx +8 -0
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +3 -4
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/original/src/components/BusinessController/index.tsx +9 -4
- package/themes/original/src/components/Home/index.tsx +4 -4
- package/themes/original/src/components/MultiCheckout/index.tsx +77 -61
- package/themes/original/src/components/MyOrders/index.tsx +12 -25
- package/themes/original/src/components/OrderProgress/index.tsx +4 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +7 -8
- package/themes/original/src/components/shared/OButton.tsx +2 -2
package/package.json
CHANGED
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
useEvent,
|
|
21
21
|
useLanguage,
|
|
22
22
|
useSession,
|
|
23
|
-
useConfig
|
|
23
|
+
useConfig,
|
|
24
|
+
useToast,
|
|
25
|
+
ToastType
|
|
24
26
|
} from 'ordering-components/native'
|
|
25
27
|
|
|
26
28
|
import { OIcon, OText } from '../shared'
|
|
@@ -108,11 +110,12 @@ const SoundPlayerComponent = (props: any) => {
|
|
|
108
110
|
|
|
109
111
|
const NewOrderNotificationUI = (props: any) => {
|
|
110
112
|
const { isBusinessApp, evtList } = props
|
|
111
|
-
|
|
113
|
+
const [, t] = useLanguage()
|
|
112
114
|
const [events] = useEvent()
|
|
113
115
|
const [{ user, token }] = useSession()
|
|
114
116
|
const [ordering] = useApi()
|
|
115
117
|
const [{ configs }] = useConfig()
|
|
118
|
+
const [, { showToast }] = useToast()
|
|
116
119
|
const { getCurrentLocation } = useLocation()
|
|
117
120
|
const [currentEvent, setCurrentEvent] = useState<any>(null)
|
|
118
121
|
|
|
@@ -124,6 +127,10 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
124
127
|
if (value?.driver) {
|
|
125
128
|
try {
|
|
126
129
|
const location = await getCurrentLocation()
|
|
130
|
+
if (!location?.latitude || !location?.longitude) {
|
|
131
|
+
showToast(t('ERROR_UPDATING_COORDS', 'Error updating coords'), ToastType.Error)
|
|
132
|
+
return
|
|
133
|
+
}
|
|
127
134
|
await fetch(`${ordering.root}/users/${user.id}/locations`, {
|
|
128
135
|
method: 'POST',
|
|
129
136
|
body: JSON.stringify({
|
|
@@ -50,6 +50,7 @@ const { useDeviceOrientation, PORTRAIT } = DeviceOrientationMethods
|
|
|
50
50
|
|
|
51
51
|
const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
52
52
|
const {
|
|
53
|
+
navigation,
|
|
53
54
|
setCurrentFilters,
|
|
54
55
|
tabs,
|
|
55
56
|
currentTabSelected,
|
|
@@ -385,6 +386,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
385
386
|
setTags({ values: [] })
|
|
386
387
|
}, [currentTabSelected])
|
|
387
388
|
|
|
389
|
+
useEffect(() => {
|
|
390
|
+
const unsubcribe = navigation.addListener('focus', () => {
|
|
391
|
+
currentTabSelected === 'logisticOrders' ? loadLogisticOrders() : loadOrders && loadOrders({ newFetch: true })
|
|
392
|
+
})
|
|
393
|
+
return unsubcribe
|
|
394
|
+
}, [navigation, loadOrders, loadLogisticOrders])
|
|
395
|
+
|
|
388
396
|
return (
|
|
389
397
|
<>
|
|
390
398
|
<View style={styles.header}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Platform, PlatformIOSStatic,
|
|
2
|
+
import { Platform, PlatformIOSStatic, Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
import DeviceInfo from 'react-native-device-info';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
|
|
@@ -138,8 +138,7 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
138
138
|
}, [configState.loading])
|
|
139
139
|
|
|
140
140
|
return (
|
|
141
|
-
<
|
|
142
|
-
activeOpacity={1}
|
|
141
|
+
<Pressable
|
|
143
142
|
disabled={order?.locked && isLogisticOrder}
|
|
144
143
|
style={styles.cardButton}
|
|
145
144
|
onPress={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
|
|
@@ -237,6 +236,6 @@ export const OrderItem = React.memo((props: any) => {
|
|
|
237
236
|
)}
|
|
238
237
|
</Information>
|
|
239
238
|
</Card>
|
|
240
|
-
</
|
|
239
|
+
</Pressable>
|
|
241
240
|
)
|
|
242
241
|
}, OrderItemPropsAreEqual)
|
|
@@ -48,8 +48,8 @@ export const useLocation = () => {
|
|
|
48
48
|
GeoLocation.getCurrentPosition(
|
|
49
49
|
({ coords }) => {
|
|
50
50
|
resolve({
|
|
51
|
-
latitude: coords.latitude,
|
|
52
|
-
longitude: coords.longitude,
|
|
51
|
+
latitude: typeof coords.latitude !== 'number' && !Number.isNaN(coords.latitude) ? coords.latitude : 0,
|
|
52
|
+
longitude: typeof coords.longitude !== 'number' && !Number.isNaN(coords.longitude) ? coords.longitude : 0,
|
|
53
53
|
speed: coords.speed,
|
|
54
54
|
});
|
|
55
55
|
},
|
|
@@ -63,9 +63,10 @@ export const useLocation = () => {
|
|
|
63
63
|
watchId.current = GeoLocation.watchPosition(
|
|
64
64
|
({ coords }) => {
|
|
65
65
|
if (!isMounted.current) return;
|
|
66
|
+
if (typeof coords.latitude !== 'number' || typeof coords.longitude !== 'number') return
|
|
66
67
|
const location: Location = {
|
|
67
|
-
latitude: coords.latitude,
|
|
68
|
-
longitude: coords.longitude,
|
|
68
|
+
latitude: coords.latitude || 0,
|
|
69
|
+
longitude: coords.longitude || 0,
|
|
69
70
|
speed: coords.speed,
|
|
70
71
|
};
|
|
71
72
|
setUserLocation(location);
|
|
@@ -35,7 +35,12 @@ import FastImage from 'react-native-fast-image'
|
|
|
35
35
|
import { LottieAnimation } from '../LottieAnimation';
|
|
36
36
|
import { CardAnimation } from '../shared/CardAnimation';
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function BusinessControllerPropsAreEqual (prevProps: any, nextProps: any) {
|
|
39
|
+
return JSON.stringify(prevProps.business) === JSON.stringify(nextProps.business) &&
|
|
40
|
+
prevProps.isBusinessOpen === nextProps.isBusinessOpen
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const BusinessControllerUI = React.memo((props: BusinessControllerParams) => {
|
|
39
44
|
const {
|
|
40
45
|
business,
|
|
41
46
|
handleClick,
|
|
@@ -184,7 +189,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
184
189
|
}
|
|
185
190
|
|
|
186
191
|
return (
|
|
187
|
-
<
|
|
192
|
+
<View style={{ minHeight: 200 }}>
|
|
188
193
|
{isIntersectionObserver ? (
|
|
189
194
|
<CardAnimation
|
|
190
195
|
style={[style, styles.container]}
|
|
@@ -376,9 +381,9 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
376
381
|
</View>
|
|
377
382
|
</Placeholder>
|
|
378
383
|
)}
|
|
379
|
-
</
|
|
384
|
+
</View>
|
|
380
385
|
);
|
|
381
|
-
};
|
|
386
|
+
}, BusinessControllerPropsAreEqual);
|
|
382
387
|
|
|
383
388
|
export const BusinessController = (props: BusinessControllerParams) => {
|
|
384
389
|
const BusinessControllerProps = {
|
|
@@ -27,7 +27,7 @@ export const Home = (props: any) => {
|
|
|
27
27
|
return (
|
|
28
28
|
<View style={styles.container}>
|
|
29
29
|
<View>
|
|
30
|
-
<View style={{paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
|
|
30
|
+
<View style={{ paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
|
|
31
31
|
<LanguageSelector />
|
|
32
32
|
</View>
|
|
33
33
|
<OIcon
|
|
@@ -49,11 +49,11 @@ export const Home = (props: any) => {
|
|
|
49
49
|
</OText>
|
|
50
50
|
<OButton
|
|
51
51
|
text={t('LOGIN_NOW', 'Login now')}
|
|
52
|
-
bgColor={theme.colors.primary}
|
|
53
|
-
borderColor={theme.colors.primary}
|
|
52
|
+
bgColor={theme.general.components.buttons.color ?? theme.colors.primary}
|
|
53
|
+
borderColor={theme.general.components.buttons.color ?? theme.colors.primary}
|
|
54
54
|
style={styles.buttons}
|
|
55
55
|
isCircle={false}
|
|
56
|
-
textStyle={{ color: 'white' }}
|
|
56
|
+
textStyle={{ color: `${theme.general.components.buttons.buttonTextColor ?? 'white'}` }}
|
|
57
57
|
onClick={() => onNavigationRedirect('Login')}
|
|
58
58
|
imgRightSrc={null}
|
|
59
59
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
useLanguage,
|
|
4
4
|
useConfig,
|
|
@@ -82,12 +82,12 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
82
82
|
wrapperNavbar: {
|
|
83
83
|
paddingHorizontal: 20,
|
|
84
84
|
backgroundColor: theme?.colors?.white,
|
|
85
|
-
|
|
85
|
+
borderWidth: 0
|
|
86
86
|
},
|
|
87
87
|
detailWrapper: {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
paddingHorizontal: 20,
|
|
89
|
+
width: '100%'
|
|
90
|
+
},
|
|
91
91
|
})
|
|
92
92
|
|
|
93
93
|
const [, { showToast }] = useToast();
|
|
@@ -143,16 +143,17 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
143
143
|
?.reduce((sum: any, cart: any) => sum + clearAmount((cart?.subtotal + getIncludedTaxes(cart)) * accumulationRateBusiness(cart?.business_id)), 0)
|
|
144
144
|
?.toFixed(configs.format_number_decimal_length?.value ?? 2)
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
147
147
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
148
148
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
149
149
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
150
|
+
const [cartsOpened, setCartsOpened] = useState([])
|
|
150
151
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
153
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
154
|
+
const [requiredFields, setRequiredFields] = useState<any>([])
|
|
155
|
+
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
156
|
+
const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
|
|
156
157
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
157
158
|
const methodsPay = ['global_google_pay', 'global_apple_pay']
|
|
158
159
|
const isDisablePlaceOrderButton = cartGroup?.loading || placing || (!(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) && cartGroup?.result?.balance > 0) ||
|
|
@@ -170,7 +171,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
170
171
|
setUserErrors([])
|
|
171
172
|
const errors = []
|
|
172
173
|
const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
|
|
173
|
-
|
|
174
|
+
const _requiredFields: any = []
|
|
174
175
|
|
|
175
176
|
Object.values(validationFields?.fields?.checkout).map((field: any) => {
|
|
176
177
|
if (field?.required && !notFields.includes(field.code)) {
|
|
@@ -188,7 +189,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
188
189
|
) {
|
|
189
190
|
_requiredFields.push('cellphone')
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
+
setRequiredFields(_requiredFields)
|
|
192
193
|
|
|
193
194
|
if (phoneUpdate) {
|
|
194
195
|
errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
|
|
@@ -203,18 +204,18 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
203
204
|
|
|
204
205
|
const handlePlaceOrder = (confirmPayment?: any) => {
|
|
205
206
|
if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
setOpenModal({ ...openModal, signup: true, isGuest: true })
|
|
208
|
+
return
|
|
209
|
+
}
|
|
209
210
|
|
|
210
211
|
if (!userErrors.length && (!requiredFields?.length || allowedGuest)) {
|
|
211
212
|
handleGroupPlaceOrder && handleGroupPlaceOrder(confirmPayment)
|
|
212
213
|
return
|
|
213
214
|
}
|
|
214
215
|
if (requiredFields?.length) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
setIsOpen(true)
|
|
217
|
+
return
|
|
218
|
+
}
|
|
218
219
|
let stringError = ''
|
|
219
220
|
Object.values(userErrors).map((item: any, i: number) => {
|
|
220
221
|
stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
|
|
@@ -224,26 +225,26 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
const handlePlaceOrderAsGuest = () => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
setIsOpen(false)
|
|
229
|
+
handleGroupPlaceOrder && handleGroupPlaceOrder()
|
|
230
|
+
}
|
|
230
231
|
|
|
231
232
|
const handleSuccessSignup = (user: any) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
233
|
+
login({
|
|
234
|
+
user,
|
|
235
|
+
token: user?.session?.access_token
|
|
236
|
+
})
|
|
237
|
+
openModal?.isGuest && handlePlaceOrderAsGuest()
|
|
238
|
+
setOpenModal({ ...openModal, signup: false, isGuest: false })
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const handleSuccessLogin = (user: any) => {
|
|
242
|
+
if (user) setOpenModal({ ...openModal, login: false })
|
|
243
|
+
}
|
|
243
244
|
|
|
244
245
|
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
setShowTitle(contentOffset.y > 30)
|
|
247
|
+
}
|
|
247
248
|
|
|
248
249
|
const handleGoBack = () => {
|
|
249
250
|
if (navigation?.canGoBack()) {
|
|
@@ -291,6 +292,18 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
291
292
|
}
|
|
292
293
|
}, [paymethodSelected])
|
|
293
294
|
|
|
295
|
+
const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
|
|
296
|
+
const isActive = cartsOpened?.includes?.(uuid)
|
|
297
|
+
if (isActive || !isClosed) {
|
|
298
|
+
setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
|
|
299
|
+
} else {
|
|
300
|
+
setCartsOpened([
|
|
301
|
+
...cartsOpened,
|
|
302
|
+
uuid
|
|
303
|
+
])
|
|
304
|
+
}
|
|
305
|
+
}, [cartsOpened])
|
|
306
|
+
|
|
294
307
|
return (
|
|
295
308
|
<>
|
|
296
309
|
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
@@ -329,8 +342,8 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
329
342
|
paddingTop={Platform.OS === 'ios' ? 0 : 4}
|
|
330
343
|
btnStyle={{ paddingLeft: 0 }}
|
|
331
344
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
332
|
-
|
|
333
|
-
|
|
345
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
346
|
+
style={{ marginTop: 20 }}
|
|
334
347
|
/>
|
|
335
348
|
</View>
|
|
336
349
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -522,6 +535,9 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
522
535
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
523
536
|
onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
|
|
524
537
|
businessConfigs={cart?.business?.configs}
|
|
538
|
+
cartsOpened={cartsOpened}
|
|
539
|
+
changeActiveState={changeActiveState}
|
|
540
|
+
isActive={cartsOpened?.includes?.(cart?.uuid)}
|
|
525
541
|
/>
|
|
526
542
|
{openCarts.length > 1 && (
|
|
527
543
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
@@ -631,30 +647,30 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
631
647
|
</ScrollView>
|
|
632
648
|
</OModal>
|
|
633
649
|
<OModal
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
650
|
+
open={isOpen}
|
|
651
|
+
onClose={() => setIsOpen(false)}
|
|
652
|
+
>
|
|
653
|
+
<View style={styles.detailWrapper}>
|
|
654
|
+
<UserDetails
|
|
655
|
+
isUserDetailsEdit
|
|
656
|
+
useValidationFields
|
|
657
|
+
useDefualtSessionManager
|
|
658
|
+
useSessionUser
|
|
659
|
+
isCheckout
|
|
660
|
+
isEdit
|
|
661
|
+
phoneUpdate={phoneUpdate}
|
|
662
|
+
togglePhoneUpdate={togglePhoneUpdate}
|
|
663
|
+
requiredFields={requiredFields}
|
|
664
|
+
hideUpdateButton
|
|
665
|
+
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
666
|
+
onClose={() => {
|
|
667
|
+
setIsOpen(false)
|
|
668
|
+
handlePlaceOrder()
|
|
669
|
+
}}
|
|
670
|
+
setIsOpen={setIsOpen}
|
|
671
|
+
/>
|
|
672
|
+
</View>
|
|
673
|
+
</OModal>
|
|
658
674
|
</Container>
|
|
659
675
|
|
|
660
676
|
<FloatingButton
|
|
@@ -9,6 +9,7 @@ import { ScrollView } from 'react-native-gesture-handler';
|
|
|
9
9
|
import { Tab } from './styles'
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
11
|
import { Container } from '../../layouts/Container';
|
|
12
|
+
import NavBar from '../NavBar'
|
|
12
13
|
|
|
13
14
|
export const MyOrders = (props: any) => {
|
|
14
15
|
const {
|
|
@@ -93,29 +94,15 @@ export const MyOrders = (props: any) => {
|
|
|
93
94
|
...props.titleStyle
|
|
94
95
|
}}>
|
|
95
96
|
{!props.hideBackBtn && (!isChewLayout || (isChewLayout && hideOrdersTheme)) && (
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
backgroundColor: '#FFF',
|
|
104
|
-
borderColor: '#FFF',
|
|
105
|
-
shadowColor: '#FFF',
|
|
106
|
-
paddingLeft: 0,
|
|
107
|
-
paddingRight: 0,
|
|
108
|
-
marginTop: 30,
|
|
109
|
-
}}
|
|
110
|
-
onClick={goToBack}
|
|
111
|
-
icon={AntDesignIcon}
|
|
112
|
-
iconProps={{
|
|
113
|
-
name: 'arrowleft',
|
|
114
|
-
size: 26
|
|
115
|
-
}}
|
|
97
|
+
<NavBar
|
|
98
|
+
title={t('MY_ORDERS', 'My Orders')}
|
|
99
|
+
titleAlign={'center'}
|
|
100
|
+
onActionLeft={goToBack}
|
|
101
|
+
showCall={false}
|
|
102
|
+
paddingTop={30}
|
|
103
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
116
104
|
/>
|
|
117
105
|
)}
|
|
118
|
-
<HeaderTitle ph={10} text={t('MY_ORDERS', 'My Orders')} />
|
|
119
106
|
</View>
|
|
120
107
|
)}
|
|
121
108
|
{!hideOrders && !isChewLayout && !showNavbar && (
|
|
@@ -125,7 +112,7 @@ export const MyOrders = (props: any) => {
|
|
|
125
112
|
<ScrollView
|
|
126
113
|
horizontal
|
|
127
114
|
style={{ ...styles.container, borderBottomWidth: 1 }}
|
|
128
|
-
contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : 20
|
|
115
|
+
contentContainerStyle={{ paddingHorizontal: !!businessesSearchList ? 0 : 20 }}
|
|
129
116
|
showsHorizontalScrollIndicator={false}
|
|
130
117
|
scrollEventThrottle={16}
|
|
131
118
|
>
|
|
@@ -149,7 +136,7 @@ export const MyOrders = (props: any) => {
|
|
|
149
136
|
)}
|
|
150
137
|
{selectedOption === 'orders' && (
|
|
151
138
|
<>
|
|
152
|
-
<View style={{ paddingHorizontal: 20
|
|
139
|
+
<View style={{ paddingHorizontal: 20 }}>
|
|
153
140
|
<OrdersOption
|
|
154
141
|
{...props}
|
|
155
142
|
preOrders
|
|
@@ -216,9 +203,9 @@ export const MyOrders = (props: any) => {
|
|
|
216
203
|
setOrdersLength={setOrdersLength}
|
|
217
204
|
/>
|
|
218
205
|
)}
|
|
219
|
-
|
|
206
|
+
|
|
220
207
|
{selectedOption === 'giftCards' && (
|
|
221
|
-
<View style={{ paddingHorizontal: 20
|
|
208
|
+
<View style={{ paddingHorizontal: 20 }}>
|
|
222
209
|
<GiftCardOrdersList
|
|
223
210
|
onNavigationRedirect={props?.onNavigationRedirect}
|
|
224
211
|
/>
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
OrderProgressWrapper
|
|
24
24
|
} from './styles'
|
|
25
25
|
import { getOrderStatuPickUp, getOrderStatus } from '../../utils'
|
|
26
|
+
import DeviceInfo from 'react-native-device-info'
|
|
26
27
|
|
|
27
28
|
const OrderProgressUI = (props: any) => {
|
|
28
29
|
const {
|
|
@@ -56,7 +57,9 @@ const OrderProgressUI = (props: any) => {
|
|
|
56
57
|
shadowColor: '#000',
|
|
57
58
|
shadowOpacity: 0.2,
|
|
58
59
|
shadowRadius: 2,
|
|
59
|
-
elevation: 3
|
|
60
|
+
elevation: 3,
|
|
61
|
+
borderWidth: Platform.OS === 'android' && Number(DeviceInfo?.getSystemVersion?.()) < 5 ? 1 : 0,
|
|
62
|
+
borderColor: 'rgba(0,0,0,0.2)'
|
|
60
63
|
},
|
|
61
64
|
logoWrapper: {
|
|
62
65
|
overflow: 'hidden',
|
|
@@ -40,7 +40,6 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
40
40
|
|
|
41
41
|
const theme = useTheme();
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
const pickerStyle = StyleSheet.create({
|
|
45
44
|
inputAndroid: {
|
|
46
45
|
width: 34,
|
|
@@ -75,9 +74,9 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
75
74
|
|
|
76
75
|
const [isActive, setActiveState] = useState(false)
|
|
77
76
|
const [isServiceOpen, setIsServiceOpen] = useState(false)
|
|
77
|
+
const [productQuantityState, setProductQuantityState] = useState(product.quantity.toString())
|
|
78
78
|
// const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
|
|
79
79
|
// const [setRotate, setRotateState] = useState({ angle: new Animated.Value(0) })
|
|
80
|
-
const [productQuantity, setProductQuantity] = useState(product.quantity.toString())
|
|
81
80
|
|
|
82
81
|
const productInfo = () => {
|
|
83
82
|
if (isCartProduct) {
|
|
@@ -121,7 +120,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
121
120
|
|
|
122
121
|
const handleChangeQuantity = (value: string) => {
|
|
123
122
|
if (!orderState.loading) {
|
|
124
|
-
|
|
123
|
+
setProductQuantityState(value)
|
|
125
124
|
if (parseInt(value) === 0) {
|
|
126
125
|
onDeleteProduct && onDeleteProduct(product)
|
|
127
126
|
} else {
|
|
@@ -211,7 +210,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
211
210
|
<RNPickerSelect
|
|
212
211
|
items={productOptions}
|
|
213
212
|
onValueChange={handleChangeQuantity}
|
|
214
|
-
value={
|
|
213
|
+
value={productQuantityState}
|
|
215
214
|
style={pickerStyle}
|
|
216
215
|
useNativeAndroidPickerStyle={false}
|
|
217
216
|
placeholder={{}}
|
|
@@ -287,15 +286,15 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
287
286
|
{productInfo().ingredients.length > 0 && productInfo().ingredients.some((ingredient: any) => !ingredient.selected) && (
|
|
288
287
|
<ProductOptionsList>
|
|
289
288
|
<OText size={10} color={theme.colors.textSecondary}>{t('INGREDIENTS', 'Ingredients')}</OText>
|
|
290
|
-
{productInfo().ingredients.map((ingredient: any) => !ingredient.selected && (
|
|
291
|
-
<OText size={10} color={theme.colors.textThird} key={ingredient.id} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
|
|
289
|
+
{productInfo().ingredients.map((ingredient: any, i) => !ingredient.selected && (
|
|
290
|
+
<OText size={10} color={theme.colors.textThird} key={ingredient.id + i} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
|
|
292
291
|
))}
|
|
293
292
|
</ProductOptionsList>
|
|
294
293
|
)}
|
|
295
294
|
{productInfo().options.length > 0 && (
|
|
296
295
|
<ProductOptionsList>
|
|
297
|
-
{productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any
|
|
298
|
-
<ProductOption key={option.id
|
|
296
|
+
{productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => (
|
|
297
|
+
<ProductOption key={option.id}>
|
|
299
298
|
<OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
|
|
300
299
|
{option.suboptions.map((suboption: any) => (
|
|
301
300
|
<ProductSubOption key={suboption.id}>
|
|
@@ -119,7 +119,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
119
119
|
style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
|
|
120
120
|
disabled={props.isDisabledWithSameStyles}
|
|
121
121
|
>
|
|
122
|
-
<StyledButton style={
|
|
122
|
+
<StyledButton style={{ ...props.style, backgroundColor: props.bgColor ?? theme?.general?.components?.buttons?.color, borderColor: props.borderColor, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius }}>
|
|
123
123
|
{props.icon ? (
|
|
124
124
|
<props.icon {...props.iconProps} />
|
|
125
125
|
) : null}
|
|
@@ -127,7 +127,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
127
127
|
<OIcon style={props.imgLeftStyle} src={props.imgLeftSrc} color={theme.colors.textNormal} />
|
|
128
128
|
) : null}
|
|
129
129
|
{props.text ? (
|
|
130
|
-
<StyledText style={props.textStyle}>{props.text}</StyledText>
|
|
130
|
+
<StyledText style={{ ...props.textStyle, color: props?.textStyle?.color ?? theme?.general?.components?.buttons?.buttonTextColor }}>{props.text}</StyledText>
|
|
131
131
|
) : null}
|
|
132
132
|
{props.imgRightSrc ? (
|
|
133
133
|
<EndImage style={props.imgRightStyle} source={props.imgRightSrc} />
|