ordering-ui-react-native 0.9.2 → 0.9.6
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/DeliveryApp.tsx +2 -1
- package/src/components/OrdersOption/test.tsx +410 -0
- package/src/components/PreviousOrders/index.tsx +14 -1
- package/src/components/ReviewDriver/index.tsx +313 -0
- package/src/components/ReviewDriver/styles.tsx +38 -0
- package/src/components/ReviewOrder/index.tsx +231 -103
- package/src/components/ReviewOrder/styles.tsx +24 -11
- package/src/components/ReviewProducts/index.tsx +113 -0
- package/src/components/ReviewProducts/styles.tsx +16 -0
- package/src/components/SingleProductReview/index.tsx +166 -0
- package/src/components/SingleProductReview/styles.tsx +26 -0
- package/src/components/shared/OButton.tsx +0 -1
- package/src/index.tsx +9 -0
- package/src/layouts/FloatingBottomContainer.tsx +26 -0
- package/src/navigators/HomeNavigator.tsx +12 -0
- package/src/pages/ReviewDriver.tsx +30 -0
- package/src/pages/ReviewOrder.tsx +5 -4
- package/src/pages/ReviewProducts.tsx +30 -0
- package/src/theme.json +2 -1
- package/src/types/index.tsx +27 -2
- package/themes/business/src/components/Chat/index.tsx +1 -0
- package/themes/business/src/components/DriverMap/index.tsx +31 -6
- package/themes/business/src/components/OrderDetails/index.tsx +39 -13
- package/themes/business/src/components/OrderDetailsDelivery/index.tsx +17 -4
- package/themes/business/src/components/OrdersOption/index.tsx +24 -12
- package/themes/business/src/components/PreviousOrders/index.tsx +54 -53
- package/themes/business/src/components/StoresList/index.tsx +3 -6
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -4
- package/themes/business/src/components/UserProfileForm/index.tsx +9 -8
- package/themes/business/src/hooks/useLocation.tsx +1 -1
- package/themes/business/src/types/index.tsx +6 -0
- package/themes/doordash/src/components/PreviousOrders/index.tsx +14 -1
- package/themes/instacart/src/components/PreviousOrders/index.tsx +14 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
- package/themes/uber-eats/src/components/AddressForm/index.tsx +2 -0
- package/themes/uber-eats/src/components/PreviousOrders/index.tsx +14 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useLanguage } from 'ordering-components/native'
|
|
3
|
+
import { OText, OButton, OInput } from '../shared'
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
|
+
import AntDesignIcons from 'react-native-vector-icons/AntDesign'
|
|
6
|
+
import { useTheme } from 'styled-components/native'
|
|
7
|
+
import { SingleProductReviewParams } from '../../types'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ProductContainer,
|
|
11
|
+
ProductHeader,
|
|
12
|
+
LikeHandsActionContainer,
|
|
13
|
+
LikeHandsButton,
|
|
14
|
+
CommentsButtonGroup,
|
|
15
|
+
} from './styles'
|
|
16
|
+
|
|
17
|
+
export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
18
|
+
const {
|
|
19
|
+
product,
|
|
20
|
+
formState,
|
|
21
|
+
handleChangeFormState,
|
|
22
|
+
} = props
|
|
23
|
+
|
|
24
|
+
const [, t] = useLanguage()
|
|
25
|
+
const theme = useTheme()
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
inputTextArea: {
|
|
29
|
+
borderColor: theme.colors.lightGray,
|
|
30
|
+
borderRadius: 8,
|
|
31
|
+
marginTop: 10,
|
|
32
|
+
marginBottom: 40,
|
|
33
|
+
height: 100,
|
|
34
|
+
alignItems: 'flex-start'
|
|
35
|
+
},
|
|
36
|
+
additionalCommentButton: {
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
marginVertical: 10,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const [comments, setComments] = useState<Array<any>>([])
|
|
44
|
+
const [extraComment, setExtraComment] = useState('')
|
|
45
|
+
const [isShowTextArea, setIsShowTextArea] = useState(false)
|
|
46
|
+
const [qualification, setQualification] = useState(5)
|
|
47
|
+
|
|
48
|
+
const commentsList = [
|
|
49
|
+
{ key: 0, content: t('IT_WASNT_TASTY', "It wasn't tasty") },
|
|
50
|
+
{ key: 1, content: t('SMALL_PORTION', 'Small portion') },
|
|
51
|
+
{ key: 2, content: t('WET_OR_LEAKY', 'Wet or leaky') },
|
|
52
|
+
{ key: 3, content: t('SLOPPY_PRESENTATION', 'Sloppy presentation') },
|
|
53
|
+
{ key: 4, content: t('COLD_OR_MELTED', 'Cold or melted') }
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
const isSelectedComment = (commentKey: number) => {
|
|
57
|
+
const found = comments.find((comment: any) => comment?.key === commentKey)
|
|
58
|
+
return found
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleChangeComment = (commentItem: any) => {
|
|
62
|
+
const found = comments.find((comment: any) => comment?.key === commentItem.key)
|
|
63
|
+
if (found) {
|
|
64
|
+
const _comments = comments.filter((comment: any) => comment?.key !== commentItem.key)
|
|
65
|
+
setComments(_comments)
|
|
66
|
+
} else {
|
|
67
|
+
setComments([...comments, commentItem])
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (comments?.length === 0 && !extraComment && formState.changes?.length === 0 && qualification === 5) return
|
|
73
|
+
let _comments = ''
|
|
74
|
+
if (comments.length > 0) {
|
|
75
|
+
comments.map(comment => (_comments += comment.content + '. '))
|
|
76
|
+
}
|
|
77
|
+
const _comment = _comments + extraComment
|
|
78
|
+
let found = false
|
|
79
|
+
const _changes = formState.changes.map((item: any) => {
|
|
80
|
+
if (item?.product_id === product?.product_id) {
|
|
81
|
+
found = true
|
|
82
|
+
return {
|
|
83
|
+
product_id: product?.product_id,
|
|
84
|
+
comment: _comment,
|
|
85
|
+
qualification: qualification
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return item
|
|
89
|
+
})
|
|
90
|
+
if (!found) {
|
|
91
|
+
_changes.push({
|
|
92
|
+
product_id: product?.product_id,
|
|
93
|
+
comment: _comment,
|
|
94
|
+
qualification: qualification
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
handleChangeFormState && handleChangeFormState(_changes)
|
|
98
|
+
}, [comments, extraComment, qualification])
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<ProductContainer>
|
|
103
|
+
<ProductHeader>
|
|
104
|
+
<OText numberOfLines={1} style={{ flex: 1 }}>{product?.name}</OText>
|
|
105
|
+
<LikeHandsActionContainer>
|
|
106
|
+
<LikeHandsButton
|
|
107
|
+
isLike
|
|
108
|
+
onPress={() => setQualification(5)}
|
|
109
|
+
>
|
|
110
|
+
<AntDesignIcons name='like2' size={20} color={qualification === 5 ? theme.colors.primary : theme.colors.lightGray} />
|
|
111
|
+
</LikeHandsButton>
|
|
112
|
+
<LikeHandsButton onPress={() => setQualification(1)}>
|
|
113
|
+
<AntDesignIcons name='dislike2' size={20} color={qualification === 1 ? theme.colors.primary : theme.colors.lightGray} />
|
|
114
|
+
</LikeHandsButton>
|
|
115
|
+
</LikeHandsActionContainer>
|
|
116
|
+
</ProductHeader>
|
|
117
|
+
<CommentsButtonGroup>
|
|
118
|
+
{commentsList.map(commentItem => (
|
|
119
|
+
<OButton
|
|
120
|
+
key={commentItem.key}
|
|
121
|
+
text={commentItem.content}
|
|
122
|
+
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.lightGray}
|
|
123
|
+
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.lightGray}
|
|
124
|
+
textStyle={{
|
|
125
|
+
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
126
|
+
fontSize: 13,
|
|
127
|
+
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
128
|
+
}}
|
|
129
|
+
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
130
|
+
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
131
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
132
|
+
onClick={() => handleChangeComment(commentItem) }
|
|
133
|
+
/>
|
|
134
|
+
))}
|
|
135
|
+
</CommentsButtonGroup>
|
|
136
|
+
<TouchableOpacity
|
|
137
|
+
style={styles.additionalCommentButton}
|
|
138
|
+
onPress={() => setIsShowTextArea(!isShowTextArea)}
|
|
139
|
+
>
|
|
140
|
+
<OText
|
|
141
|
+
color={isShowTextArea ? theme.colors.primary : theme.colors.lightGray}
|
|
142
|
+
style={{
|
|
143
|
+
borderBottomColor: isShowTextArea ? theme.colors.primary : theme.colors.lightGray,
|
|
144
|
+
borderBottomWidth: 1
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
{t('ADDITIONAL_COMMENTS', 'Additional comments')}
|
|
148
|
+
</OText>
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
{isShowTextArea && (
|
|
151
|
+
<View>
|
|
152
|
+
<OText style={{ marginTop: 10 }}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText>
|
|
153
|
+
<OInput
|
|
154
|
+
name='comments'
|
|
155
|
+
onChange={(val: any) => {
|
|
156
|
+
setExtraComment(val.target.value)
|
|
157
|
+
}}
|
|
158
|
+
style={styles.inputTextArea}
|
|
159
|
+
multiline
|
|
160
|
+
/>
|
|
161
|
+
</View>
|
|
162
|
+
)}
|
|
163
|
+
</ProductContainer>
|
|
164
|
+
</>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const ProductContainer = styled.View`
|
|
4
|
+
margin-bottom: 15px;
|
|
5
|
+
`
|
|
6
|
+
|
|
7
|
+
export const ProductHeader = styled.View`
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const LikeHandsActionContainer = styled.View`
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
export const LikeHandsButton = styled.TouchableOpacity`
|
|
18
|
+
${(props: any) => props.isLike && css`
|
|
19
|
+
margin-horizontal: 15px;
|
|
20
|
+
`}
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
export const CommentsButtonGroup = styled.View`
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
`
|
package/src/index.tsx
CHANGED
|
@@ -49,7 +49,9 @@ import { ProductIngredient } from './components/ProductIngredient';
|
|
|
49
49
|
import { ProductItemAccordion } from './components/ProductItemAccordion';
|
|
50
50
|
import { ProductOption } from './components/ProductOption';
|
|
51
51
|
import { ProductOptionSubOption } from './components/ProductOptionSubOption';
|
|
52
|
+
import { ReviewDriver } from './components/ReviewDriver';
|
|
52
53
|
import { ReviewOrder } from './components/ReviewOrder';
|
|
54
|
+
import { ReviewProducts } from './components/ReviewProducts';
|
|
53
55
|
import { SearchBar } from './components/SearchBar';
|
|
54
56
|
import { SignupForm } from './components/SignupForm';
|
|
55
57
|
import { SingleProductCard } from './components/SingleProductCard';
|
|
@@ -62,6 +64,7 @@ import { UserDetails } from './components/UserDetails';
|
|
|
62
64
|
import { UserFormDetailsUI } from './components/UserFormDetails';
|
|
63
65
|
import { UserProfileForm } from './components/UserProfileForm';
|
|
64
66
|
import { VerifyPhone } from './components/VerifyPhone';
|
|
67
|
+
import { HelpParams } from './types';
|
|
65
68
|
import {
|
|
66
69
|
OAlert,
|
|
67
70
|
OBottomPopup,
|
|
@@ -77,6 +80,7 @@ import {
|
|
|
77
80
|
|
|
78
81
|
// layouts
|
|
79
82
|
import { Container } from './layouts/Container';
|
|
83
|
+
import { FloatingBottomContainer } from './layouts/FloatingBottomContainer';
|
|
80
84
|
import { SafeAreaContainer } from './layouts/SafeAreaContainer';
|
|
81
85
|
|
|
82
86
|
// providers
|
|
@@ -141,7 +145,9 @@ export {
|
|
|
141
145
|
ProductItemAccordion,
|
|
142
146
|
ProductOption,
|
|
143
147
|
ProductOptionSubOption,
|
|
148
|
+
ReviewDriver,
|
|
144
149
|
ReviewOrder,
|
|
150
|
+
ReviewProducts,
|
|
145
151
|
SearchBar,
|
|
146
152
|
SignupForm,
|
|
147
153
|
SingleProductCard,
|
|
@@ -166,6 +172,7 @@ export {
|
|
|
166
172
|
OToast,
|
|
167
173
|
// layouts
|
|
168
174
|
Container,
|
|
175
|
+
FloatingBottomContainer,
|
|
169
176
|
SafeAreaContainer,
|
|
170
177
|
// providers
|
|
171
178
|
Alert,
|
|
@@ -175,4 +182,6 @@ export {
|
|
|
175
182
|
useTheme,
|
|
176
183
|
// hooks
|
|
177
184
|
DeviceOrientationMethods,
|
|
185
|
+
//types
|
|
186
|
+
HelpParams,
|
|
178
187
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styled from 'styled-components/native'
|
|
3
|
+
import { Platform, Dimensions } from 'react-native'
|
|
4
|
+
const windowWidth = Dimensions.get('window').width
|
|
5
|
+
|
|
6
|
+
export const Container = styled.View`
|
|
7
|
+
position: absolute;
|
|
8
|
+
flex: 1;
|
|
9
|
+
bottom: 0px;
|
|
10
|
+
left: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
padding: 10px;
|
|
13
|
+
border-top-width: 1px;
|
|
14
|
+
border-color: ${(props: any) => props.theme.colors.lightGray};
|
|
15
|
+
z-index: 1000;
|
|
16
|
+
background-color: ${(props: any) => props.bgColor ? props.bgColor : '#FFF'};
|
|
17
|
+
padding-bottom: ${Platform.OS === 'ios' ? '20px' : '10px'};
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
export const FloatingBottomContainer = (props: any) => {
|
|
21
|
+
return (
|
|
22
|
+
<Container style={{ width: windowWidth }}>
|
|
23
|
+
{props.children}
|
|
24
|
+
</Container>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -12,6 +12,8 @@ import AddressForm from '../pages/AddressForm';
|
|
|
12
12
|
import OrderDetails from '../pages/OrderDetails';
|
|
13
13
|
import BusinessProductsList from '../pages/BusinessProductsList';
|
|
14
14
|
import ReviewOrder from '../pages/ReviewOrder'
|
|
15
|
+
import ReviewProducts from '../pages/ReviewProducts';
|
|
16
|
+
import ReviewDriver from '../pages/ReviewDriver'
|
|
15
17
|
import MomentOption from '../pages/MomentOption'
|
|
16
18
|
import Account from '../pages/Account'
|
|
17
19
|
import Help from '../pages/Help'
|
|
@@ -105,6 +107,16 @@ const HomeNavigator = (e : any) => {
|
|
|
105
107
|
component={ReviewOrder}
|
|
106
108
|
options={{ headerShown: false }}
|
|
107
109
|
/>
|
|
110
|
+
<Stack.Screen
|
|
111
|
+
name="ReviewProducts"
|
|
112
|
+
component={ReviewProducts}
|
|
113
|
+
options={{ headerShown: false }}
|
|
114
|
+
/>
|
|
115
|
+
<Stack.Screen
|
|
116
|
+
name="ReviewDriver"
|
|
117
|
+
component={ReviewDriver}
|
|
118
|
+
options={{ headerShown: false }}
|
|
119
|
+
/>
|
|
108
120
|
<Stack.Screen
|
|
109
121
|
name='MomentOption'
|
|
110
122
|
component={MomentOption}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import styled from 'styled-components/native';
|
|
4
|
+
import {ReviewDriver as ReviewDriverController} from '../components/ReviewDriver'
|
|
5
|
+
import { SafeAreaContainer } from '../layouts/SafeAreaContainer';
|
|
6
|
+
|
|
7
|
+
const KeyboardView = styled.KeyboardAvoidingView`
|
|
8
|
+
flex: 1;
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const ReviewDriver = ({navigation, route} : any) => {
|
|
12
|
+
const reviewDriverProps = {
|
|
13
|
+
navigation,
|
|
14
|
+
order: route?.params?.order,
|
|
15
|
+
onNavigationRedirect: (route: string, params: any) => navigation.navigate(route, params)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<KeyboardView
|
|
20
|
+
enabled
|
|
21
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
22
|
+
>
|
|
23
|
+
<SafeAreaContainer>
|
|
24
|
+
<ReviewDriverController {...reviewDriverProps} />
|
|
25
|
+
</SafeAreaContainer>
|
|
26
|
+
</KeyboardView>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default ReviewDriver
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import styled from 'styled-components/native';
|
|
4
4
|
import {ReviewOrder as ReviewOrderController} from '../components/ReviewOrder'
|
|
5
|
-
import {
|
|
5
|
+
import { SafeAreaContainer } from '../layouts/SafeAreaContainer';
|
|
6
6
|
|
|
7
7
|
const KeyboardView = styled.KeyboardAvoidingView`
|
|
8
8
|
flex: 1;
|
|
@@ -12,7 +12,8 @@ const ReviewOrder = ({navigation, route} : any) => {
|
|
|
12
12
|
const reviewOrderProps = {
|
|
13
13
|
navigation,
|
|
14
14
|
order: route?.params?.order,
|
|
15
|
-
setIsReviewed: route?.params?.setIsReviewed
|
|
15
|
+
setIsReviewed: route?.params?.setIsReviewed,
|
|
16
|
+
onNavigationRedirect: (route: string, params: any) => navigation.navigate(route, params)
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
return (
|
|
@@ -20,9 +21,9 @@ const ReviewOrder = ({navigation, route} : any) => {
|
|
|
20
21
|
enabled
|
|
21
22
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
22
23
|
>
|
|
23
|
-
<
|
|
24
|
+
<SafeAreaContainer>
|
|
24
25
|
<ReviewOrderController {...reviewOrderProps} />
|
|
25
|
-
</
|
|
26
|
+
</SafeAreaContainer>
|
|
26
27
|
</KeyboardView>
|
|
27
28
|
)
|
|
28
29
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import styled from 'styled-components/native';
|
|
4
|
+
import {ReviewProducts as ReviewProductsController} from '../components/ReviewProducts'
|
|
5
|
+
import { SafeAreaContainer } from '../layouts/SafeAreaContainer';
|
|
6
|
+
|
|
7
|
+
const KeyboardView = styled.KeyboardAvoidingView`
|
|
8
|
+
flex: 1;
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const ReviewProducts = ({navigation, route} : any) => {
|
|
12
|
+
const reviewProductProps = {
|
|
13
|
+
navigation,
|
|
14
|
+
order: route?.params?.order,
|
|
15
|
+
onNavigationRedirect: (route: string, params: any) => navigation.navigate(route, params)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<KeyboardView
|
|
20
|
+
enabled
|
|
21
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
22
|
+
>
|
|
23
|
+
<SafeAreaContainer>
|
|
24
|
+
<ReviewProductsController {...reviewProductProps} />
|
|
25
|
+
</SafeAreaContainer>
|
|
26
|
+
</KeyboardView>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default ReviewProducts
|
package/src/theme.json
CHANGED
package/src/types/index.tsx
CHANGED
|
@@ -299,14 +299,39 @@ export interface ProductItemAccordionParams {
|
|
|
299
299
|
isFromCheckout?: any
|
|
300
300
|
}
|
|
301
301
|
export interface ReviewOrderParams {
|
|
302
|
-
order?: { orderId: number, businessId: number, logo: string },
|
|
302
|
+
order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
|
|
303
303
|
stars?: any,
|
|
304
304
|
handleChangeInput?: any,
|
|
305
305
|
handleChangeRating?: any,
|
|
306
306
|
handleSendReview?: any,
|
|
307
307
|
formState?: any,
|
|
308
308
|
navigation?: any,
|
|
309
|
-
setIsReviewed?: (isReviewed: boolean) => {}
|
|
309
|
+
setIsReviewed?: (isReviewed: boolean) => {},
|
|
310
|
+
setStars?: any,
|
|
311
|
+
onNavigationRedirect?: any
|
|
312
|
+
}
|
|
313
|
+
export interface ReviewProductParams {
|
|
314
|
+
navigation?: any,
|
|
315
|
+
onNavigationRedirect?: any,
|
|
316
|
+
order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
|
|
317
|
+
formState?: any,
|
|
318
|
+
handleChangeFormState?: any,
|
|
319
|
+
handleSendProductReview?: any
|
|
320
|
+
}
|
|
321
|
+
export interface ReviewDriverParams {
|
|
322
|
+
navigation?: any,
|
|
323
|
+
onNavigationRedirect?: any,
|
|
324
|
+
order?: { orderId: number, businessId: number, logo: string, driver: any, products: Array<any>, review: any, user_review: any },
|
|
325
|
+
formState?: any,
|
|
326
|
+
setIsDriverReviewed?: (isReviewed: boolean) => {},
|
|
327
|
+
dirverReviews?: any,
|
|
328
|
+
setDriverReviews?: any,
|
|
329
|
+
handleSendDriverReview?: any
|
|
330
|
+
}
|
|
331
|
+
export interface SingleProductReviewParams {
|
|
332
|
+
product: any,
|
|
333
|
+
formState?: any,
|
|
334
|
+
handleChangeFormState?: any,
|
|
310
335
|
}
|
|
311
336
|
export interface MessagesParams {
|
|
312
337
|
type?: string,
|
|
@@ -458,6 +458,7 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
458
458
|
messages?.messages.map((message: any) => {
|
|
459
459
|
let newMessage;
|
|
460
460
|
if (
|
|
461
|
+
parseInt(message.order_id) === order?.id &&
|
|
461
462
|
message.type !== 0 &&
|
|
462
463
|
(messagesToShow?.messages?.length ||
|
|
463
464
|
message?.can_see?.includes('2') ||
|
|
@@ -33,6 +33,9 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
33
33
|
isBusinessMarker,
|
|
34
34
|
isToFollow,
|
|
35
35
|
handleViewActionOrder,
|
|
36
|
+
updateDriverPosition,
|
|
37
|
+
driverUpdateLocation,
|
|
38
|
+
setDriverUpdateLocation,
|
|
36
39
|
} = props;
|
|
37
40
|
|
|
38
41
|
const theme = useTheme();
|
|
@@ -73,7 +76,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
73
76
|
longitude: initialPosition.longitude,
|
|
74
77
|
};
|
|
75
78
|
const destination = { latitude: location.lat, longitude: location.lng };
|
|
76
|
-
|
|
77
79
|
const { top } = useSafeAreaInsets();
|
|
78
80
|
|
|
79
81
|
useEffect(() => {
|
|
@@ -189,6 +191,23 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
189
191
|
};
|
|
190
192
|
|
|
191
193
|
useEffect(() => {
|
|
194
|
+
if (driverUpdateLocation.error) {
|
|
195
|
+
stopFollowUserLocation();
|
|
196
|
+
setAlertState({
|
|
197
|
+
open: true,
|
|
198
|
+
content: [
|
|
199
|
+
`${driverUpdateLocation.error[0] || driverUpdateLocation.error}. ${t(
|
|
200
|
+
'TRY_AGAIN',
|
|
201
|
+
'Try Again',
|
|
202
|
+
)}`,
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}, [driverUpdateLocation.error]);
|
|
207
|
+
|
|
208
|
+
useEffect(() => {
|
|
209
|
+
if (driverUpdateLocation.error) return;
|
|
210
|
+
|
|
192
211
|
calculateDistance(
|
|
193
212
|
{ lat: userLocation.latitude, lng: userLocation.longitude },
|
|
194
213
|
destination,
|
|
@@ -203,9 +222,19 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
203
222
|
mapRef.current?.animateCamera({
|
|
204
223
|
center: { latitude, longitude },
|
|
205
224
|
});
|
|
225
|
+
|
|
226
|
+
if (userLocation.latitude && userLocation.longitude)
|
|
227
|
+
updateDriverPosition({
|
|
228
|
+
location: { lat: userLocation.latitude, lng: userLocation.longitude },
|
|
229
|
+
});
|
|
206
230
|
}, [userLocation]);
|
|
207
231
|
|
|
208
232
|
const handleArrowBack: any = () => {
|
|
233
|
+
setDriverUpdateLocation({
|
|
234
|
+
...driverUpdateLocation,
|
|
235
|
+
error: null,
|
|
236
|
+
newLocation: null,
|
|
237
|
+
});
|
|
209
238
|
handleOpenMapView && handleOpenMapView();
|
|
210
239
|
};
|
|
211
240
|
|
|
@@ -307,7 +336,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
307
336
|
},
|
|
308
337
|
facOrderStatus: {
|
|
309
338
|
flexDirection: 'row',
|
|
310
|
-
paddingTop: top +
|
|
339
|
+
paddingTop: top + 13,
|
|
311
340
|
borderBottomWidth: 11,
|
|
312
341
|
borderBottomColor: theme.colors.inputChat,
|
|
313
342
|
},
|
|
@@ -321,10 +350,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
321
350
|
},
|
|
322
351
|
});
|
|
323
352
|
|
|
324
|
-
const handleChangeRegion = (coordinates: Region) => {
|
|
325
|
-
validateResult(coordinates);
|
|
326
|
-
};
|
|
327
|
-
|
|
328
353
|
return (
|
|
329
354
|
<>
|
|
330
355
|
<View style={{ flex: 1 }}>
|
|
@@ -43,6 +43,7 @@ import { OrderDetailsParams } from '../../types';
|
|
|
43
43
|
import { verifyDecimals } from '../../utils';
|
|
44
44
|
import { USER_TYPE } from '../../config/constants';
|
|
45
45
|
import CountryPicker from 'react-native-country-picker-modal';
|
|
46
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
46
47
|
|
|
47
48
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
48
49
|
const {
|
|
@@ -71,7 +72,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
71
72
|
business: false,
|
|
72
73
|
driver: false,
|
|
73
74
|
});
|
|
74
|
-
const { order, businessData, loading } = props.order;
|
|
75
|
+
const { order, businessData, loading, error } = props.order;
|
|
75
76
|
const { drivers, loadingDriver } = props.drivers;
|
|
76
77
|
const itemsDrivers: any = [];
|
|
77
78
|
const [actionOrder, setActionOrder] = useState('');
|
|
@@ -129,6 +130,34 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
const colors: any = {
|
|
134
|
+
//BLUE
|
|
135
|
+
0: theme.colors.statusOrderBlue,
|
|
136
|
+
3: theme.colors.statusOrderBlue,
|
|
137
|
+
4: theme.colors.statusOrderBlue,
|
|
138
|
+
7: theme.colors.statusOrderBlue,
|
|
139
|
+
8: theme.colors.statusOrderBlue,
|
|
140
|
+
9: theme.colors.statusOrderBlue,
|
|
141
|
+
13: theme.colors.statusOrderBlue,
|
|
142
|
+
14: theme.colors.statusOrderBlue,
|
|
143
|
+
18: theme.colors.statusOrderBlue,
|
|
144
|
+
19: theme.colors.statusOrderBlue,
|
|
145
|
+
20: theme.colors.statusOrderBlue,
|
|
146
|
+
21: theme.colors.statusOrderBlue,
|
|
147
|
+
//GREEN
|
|
148
|
+
1: theme.colors.statusOrderGreen,
|
|
149
|
+
11: theme.colors.statusOrderGreen,
|
|
150
|
+
15: theme.colors.statusOrderGreen,
|
|
151
|
+
//RED
|
|
152
|
+
2: theme.colors.statusOrderRed,
|
|
153
|
+
5: theme.colors.statusOrderRed,
|
|
154
|
+
6: theme.colors.statusOrderRed,
|
|
155
|
+
10: theme.colors.statusOrderRed,
|
|
156
|
+
12: theme.colors.statusOrderRed,
|
|
157
|
+
16: theme.colors.statusOrderRed,
|
|
158
|
+
17: theme.colors.statusOrderRed,
|
|
159
|
+
};
|
|
160
|
+
|
|
132
161
|
const handleCopyClipboard = () => {
|
|
133
162
|
const name = `${t('NAME', 'Name')}: ${order?.customer?.name || null}`;
|
|
134
163
|
const customerPhone = `${t('PHONE', 'Phone')}: ${
|
|
@@ -377,14 +406,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
377
406
|
setOpenModalForMapView(!openModalForMapView);
|
|
378
407
|
};
|
|
379
408
|
|
|
380
|
-
const colors: any = {
|
|
381
|
-
0: theme.colors.statusOrderBlue,
|
|
382
|
-
1: theme.colors.statusOrderGreen,
|
|
383
|
-
5: theme.colors.statusOrderRed,
|
|
384
|
-
7: theme.colors.statusOrderBlue,
|
|
385
|
-
8: theme.colors.statusOrderBlue,
|
|
386
|
-
};
|
|
387
|
-
|
|
388
409
|
const handleArrowBack: any = () => {
|
|
389
410
|
navigation?.canGoBack() && navigation.goBack();
|
|
390
411
|
};
|
|
@@ -487,7 +508,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
487
508
|
|
|
488
509
|
return (
|
|
489
510
|
<>
|
|
490
|
-
{(!order || Object.keys(order).length === 0) && (
|
|
511
|
+
{(!order || Object.keys(order).length === 0) && !error && (
|
|
491
512
|
<View
|
|
492
513
|
style={{
|
|
493
514
|
padding: 20,
|
|
@@ -507,8 +528,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
507
528
|
))}
|
|
508
529
|
</View>
|
|
509
530
|
)}
|
|
510
|
-
|
|
511
|
-
|
|
531
|
+
{error?.length > 0 && (
|
|
532
|
+
<NotFoundSource
|
|
533
|
+
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
534
|
+
content={props.order.error[0]}
|
|
535
|
+
onClickButton={() => navigation.navigate('Orders')}
|
|
536
|
+
/>
|
|
537
|
+
)}
|
|
538
|
+
{order && Object.keys(order).length > 0 && !error && (
|
|
512
539
|
<>
|
|
513
540
|
<Header>
|
|
514
541
|
<OIconButton
|
|
@@ -958,7 +985,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
958
985
|
export const OrderDetails = (props: OrderDetailsParams) => {
|
|
959
986
|
const orderDetailsProps = {
|
|
960
987
|
...props,
|
|
961
|
-
driverAndBusinessId: true,
|
|
962
988
|
UIComponent: OrderDetailsUI,
|
|
963
989
|
};
|
|
964
990
|
return <OrderDetailsController {...orderDetailsProps} />;
|