ordering-ui-react-native 0.12.7 → 0.12.11
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 +2 -1
- package/src/assets/images/business_list_banner.jpg +0 -0
- package/themes/original/index.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +7 -0
- package/themes/original/src/components/BusinessesListing/styles.tsx +6 -1
- package/themes/original/src/components/OrderProgress/index.tsx +208 -0
- package/themes/original/src/components/OrderProgress/styles.tsx +30 -0
- package/themes/original/src/components/ProductForm/index.tsx +159 -56
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/single-business/src/components/ActiveOrders/index.tsx +20 -19
- package/themes/single-business/src/components/BusinessProductsListing/index.tsx +4 -4
- package/themes/single-business/src/components/Cart/index.tsx +39 -47
- package/themes/single-business/src/components/Cart/styles.tsx +1 -0
- package/themes/single-business/src/components/LoginForm/index.tsx +147 -89
- package/themes/single-business/src/components/LoginForm/styles.tsx +33 -28
- package/themes/single-business/src/components/OrderDetails/index.tsx +32 -12
- package/themes/single-business/src/components/OrdersOption/index.tsx +50 -50
- package/themes/single-business/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/single-business/src/components/PreviousOrders/index.tsx +97 -83
- package/themes/single-business/src/components/PromotionCard/index.tsx +10 -2
- package/themes/single-business/src/components/Promotions/index.tsx +10 -15
- package/themes/single-business/src/components/ReviewOrder/index.tsx +299 -274
- package/themes/single-business/src/components/ReviewOrder/styles.tsx +23 -26
- package/themes/single-business/src/components/UpsellingProducts/index.tsx +230 -189
- package/themes/single-business/src/components/UpsellingProducts/styles.tsx +24 -18
- package/themes/single-business/src/types/index.tsx +10 -2
|
@@ -1,306 +1,331 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import { OrderReview as ReviewOrderController, useLanguage,
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType } from 'ordering-components/native'
|
|
5
3
|
import { useForm, Controller } from 'react-hook-form'
|
|
4
|
+
import LinearGradient from 'react-native-linear-gradient'
|
|
6
5
|
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
ReviewOrderContainer,
|
|
8
|
+
BusinessLogo,
|
|
9
|
+
FormReviews,
|
|
10
|
+
CommentsButtonGroup,
|
|
11
|
+
ActionContainer,
|
|
12
|
+
SkipButton,
|
|
13
|
+
RatingBarContainer,
|
|
14
|
+
RatingTextContainer
|
|
15
15
|
} from './styles'
|
|
16
16
|
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
17
|
-
import { TouchableOpacity, StyleSheet, View } from 'react-native';
|
|
17
|
+
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
18
18
|
import NavBar from '../NavBar'
|
|
19
|
+
import { FloatingBottomContainer } from '../../../../../src/layouts/FloatingBottomContainer'
|
|
19
20
|
import Spinner from 'react-native-loading-spinner-overlay'
|
|
20
21
|
|
|
21
22
|
import { ReviewOrderParams } from '../../types'
|
|
22
|
-
import {
|
|
23
|
-
import { REVIEW_ORDER_COMMENTS } from '../../config/constants';
|
|
24
|
-
import TagSelector from '../TagSelector';
|
|
23
|
+
import { useTheme } from 'styled-components/native'
|
|
25
24
|
|
|
26
25
|
export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
const {
|
|
27
|
+
order,
|
|
28
|
+
stars,
|
|
29
|
+
handleSendReview,
|
|
30
|
+
formState,
|
|
31
|
+
navigation,
|
|
32
|
+
setStars,
|
|
33
|
+
onNavigationRedirect,
|
|
34
|
+
handleReviewState,
|
|
35
|
+
setIsReviewed
|
|
36
|
+
} = props
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const theme = useTheme()
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
logoWrapper: {
|
|
42
|
+
shadowColor: theme.colors.black,
|
|
43
|
+
shadowRadius: 3,
|
|
44
|
+
shadowOffset: {width: 1, height: 4},
|
|
45
|
+
elevation: 3,
|
|
46
|
+
borderRadius: 8,
|
|
47
|
+
shadowOpacity: 0.1,
|
|
48
|
+
overflow: 'hidden'
|
|
49
|
+
},
|
|
50
|
+
inputTextArea: {
|
|
51
|
+
borderColor: theme.colors.lightGray,
|
|
52
|
+
borderRadius: 8,
|
|
53
|
+
marginTop: 10,
|
|
54
|
+
marginBottom: 40,
|
|
55
|
+
height: 100,
|
|
56
|
+
alignItems: 'flex-start'
|
|
57
|
+
},
|
|
58
|
+
statusBar: {
|
|
59
|
+
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
60
|
+
height: 10,
|
|
61
|
+
borderRadius: 5,
|
|
62
|
+
marginTop: 5
|
|
63
|
+
},
|
|
64
|
+
ratingItemContainer: {
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
top: -20
|
|
67
|
+
},
|
|
68
|
+
ratingItem: {
|
|
69
|
+
left: '-50%',
|
|
70
|
+
flexDirection: 'column',
|
|
71
|
+
alignItems: 'center'
|
|
72
|
+
},
|
|
73
|
+
ratingLineStyle: {
|
|
74
|
+
height: 10,
|
|
75
|
+
width: 1,
|
|
76
|
+
marginBottom: 10,
|
|
77
|
+
backgroundColor: theme.colors.dusk
|
|
78
|
+
},
|
|
79
|
+
reviewedStyle: {
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
marginVertical: 20
|
|
83
|
+
}
|
|
84
|
+
})
|
|
61
85
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
86
|
+
const [, t] = useLanguage()
|
|
87
|
+
const [, { showToast }] = useToast()
|
|
88
|
+
const { handleSubmit, control, errors } = useForm()
|
|
67
89
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const [comment, setComment] = useState('');
|
|
90
|
+
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
91
|
+
const [comments, setComments] = useState<Array<any>>([])
|
|
92
|
+
const [extraComment, setExtraComment] = useState('')
|
|
72
93
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
94
|
+
const onSubmit = () => {
|
|
95
|
+
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
96
|
+
setAlertState({
|
|
97
|
+
open: true,
|
|
98
|
+
content: stars.quality === 0 ? [`${t('REVIEW_QUALIFICATION_REQUIRED', 'Review qualification is required')}`] : []
|
|
99
|
+
})
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
handleSendReview()
|
|
103
|
+
handleReviewState && handleReviewState(order?.id)
|
|
104
|
+
setIsReviewed && setIsReviewed(true)
|
|
105
|
+
setAlertState({ ...alertState, success: true })
|
|
106
|
+
}
|
|
79
107
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
val: 1.5,
|
|
88
|
-
color: theme.colors.strength_2,
|
|
89
|
-
text: t('REVIEW_BAD', 'Bad')
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
val: 2.5,
|
|
93
|
-
color: theme.colors.strength_3,
|
|
94
|
-
text: t('REVIEW_OKAY', 'Okay')
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
val: 3.7,
|
|
98
|
-
color: theme.colors.strength_4,
|
|
99
|
-
text: t('REVIEW_GOOD', 'Good')
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
val: 5,
|
|
103
|
-
color: theme.colors.strength_5,
|
|
104
|
-
text: t('REVIEW_GREAT', 'Great')
|
|
105
|
-
},
|
|
106
|
-
]
|
|
108
|
+
const qualificationList = [
|
|
109
|
+
{ key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
|
|
110
|
+
{ key: 2, text: t('BAD', 'Bad'), percent: 0.25, parentStyle: { left: '25%' }, isInnerStyle: true, pointerColor: true },
|
|
111
|
+
{ key: 3, text: t('OKAY', 'Okay'), percent: 0.5, parentStyle: { left: '50%' }, isInnerStyle: true, pointerColor: true },
|
|
112
|
+
{ key: 4, text: t('GOOD', 'Good'), percent: 0.75, parentStyle: { left: '75%' }, isInnerStyle: true, pointerColor: true },
|
|
113
|
+
{ key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
|
|
114
|
+
]
|
|
107
115
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
const commentsList = [
|
|
117
|
+
{ key: 0, content: t('IT_WASNT_TASTY', "It wasn't tasty") },
|
|
118
|
+
{ key: 1, content: t('IT_DOESNT_PACK_WELL', "It doesn't pack well") },
|
|
119
|
+
{ key: 2, content: t('IT_ISNT_WORTH_WHAT_IT_COSTS', "It isn't worth what it costs") },
|
|
120
|
+
{ key: 3, content: t('TOO_SLOW', 'Too slow') },
|
|
121
|
+
{ key: 4, content: t('SUSTAINABLE_PACKAGING_WASNT_USED', "Sustainable packaging wasn't used") },
|
|
122
|
+
{ key: 5, content: t('THEY_DID_NOT_FOLLOW_THE_ORDER_NOTES', 'They did not follow the order notes') }
|
|
123
|
+
]
|
|
111
124
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
const handleChangeStars = (index: number) => {
|
|
126
|
+
switch (index) {
|
|
127
|
+
case 1:
|
|
128
|
+
setStars({ ...stars, quality: 1, punctiality: 1, service: 1, packaging: 1 })
|
|
129
|
+
break
|
|
130
|
+
case 2:
|
|
131
|
+
setStars({ ...stars, quality: 2, punctiality: 2, service: 2, packaging: 2 })
|
|
132
|
+
break
|
|
133
|
+
case 3:
|
|
134
|
+
setStars({ ...stars, quality: 3, punctiality: 3, service: 3, packaging: 3 })
|
|
135
|
+
break
|
|
136
|
+
case 4:
|
|
137
|
+
setStars({ ...stars, quality: 4, punctiality: 4, service: 4, packaging: 4 })
|
|
138
|
+
break
|
|
139
|
+
case 5:
|
|
140
|
+
setStars({ ...stars, quality: 5, punctiality: 5, service: 5, packaging: 5 })
|
|
141
|
+
break
|
|
142
|
+
}
|
|
143
|
+
}
|
|
123
144
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return [1, 1, 1, 0, 0];
|
|
134
|
-
case 4:
|
|
135
|
-
return [1, 1, 1, 1, 0];
|
|
136
|
-
case 5:
|
|
137
|
-
return [1, 1, 1, 1, 1];
|
|
138
|
-
default:
|
|
139
|
-
return [0, 0, 0, 0, 0];
|
|
140
|
-
}
|
|
141
|
-
}
|
|
145
|
+
const handleChangeComment = (commentItem: any) => {
|
|
146
|
+
const found = comments.find((comment: any) => comment?.key === commentItem.key)
|
|
147
|
+
if (found) {
|
|
148
|
+
const _comments = comments.filter((comment: any) => comment?.key !== commentItem.key)
|
|
149
|
+
setComments(_comments)
|
|
150
|
+
} else {
|
|
151
|
+
setComments([...comments, commentItem])
|
|
152
|
+
}
|
|
153
|
+
}
|
|
142
154
|
|
|
143
|
-
|
|
155
|
+
const isSelectedComment = (commentKey: number) => {
|
|
156
|
+
const found = comments.find((comment: any) => comment?.key === commentKey)
|
|
157
|
+
return found
|
|
158
|
+
}
|
|
144
159
|
|
|
145
|
-
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (formState.error && !formState?.loading) {
|
|
162
|
+
showToast(ToastType.Error, formState.result)
|
|
163
|
+
}
|
|
164
|
+
if (!formState.loading && !formState.error && alertState.success) {
|
|
165
|
+
showToast(ToastType.Success, t('ORDER_REVIEW_SUCCESS_CONTENT', 'Thank you, Order review successfully submitted!'))
|
|
166
|
+
navigation?.canGoBack() && navigation.goBack()
|
|
167
|
+
}
|
|
168
|
+
}, [formState.result])
|
|
146
169
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (Object.keys(errors).length > 0) {
|
|
172
|
+
// Convert all errors in one string to show in toast provider
|
|
173
|
+
const list = Object.values(errors);
|
|
174
|
+
let stringError = '';
|
|
175
|
+
list.map((item: any, i: number) => {
|
|
176
|
+
stringError +=
|
|
177
|
+
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
178
|
+
});
|
|
179
|
+
showToast(ToastType.Error, stringError);
|
|
180
|
+
}
|
|
181
|
+
}, [errors])
|
|
156
182
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (alertState.open) {
|
|
185
|
+
alertState.content && showToast(
|
|
186
|
+
ToastType.Error,
|
|
187
|
+
alertState.content
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
}, [alertState.content])
|
|
160
191
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
let _comments = ''
|
|
194
|
+
if (comments.length > 0) {
|
|
195
|
+
comments.map(comment => _comments += comment.content + '. ')
|
|
196
|
+
}
|
|
197
|
+
let _comment
|
|
198
|
+
_comment = _comments + extraComment
|
|
199
|
+
setStars({ ...stars, comments: _comment })
|
|
200
|
+
}, [comments, extraComment])
|
|
170
201
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
return (
|
|
203
|
+
<>
|
|
204
|
+
<ReviewOrderContainer>
|
|
205
|
+
<NavBar
|
|
206
|
+
title={t('REVIEW_ORDER', 'Review Order')}
|
|
207
|
+
titleAlign={'center'}
|
|
208
|
+
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
209
|
+
showCall={false}
|
|
210
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
211
|
+
paddingTop={0}
|
|
212
|
+
/>
|
|
213
|
+
<BusinessLogo>
|
|
214
|
+
<View style={styles.logoWrapper}>
|
|
215
|
+
<OIcon
|
|
216
|
+
url={order?.logo}
|
|
217
|
+
width={80}
|
|
218
|
+
height={80}
|
|
219
|
+
/>
|
|
220
|
+
</View>
|
|
221
|
+
</BusinessLogo>
|
|
222
|
+
{order?.review ? (
|
|
223
|
+
<View style={styles.reviewedStyle}>
|
|
224
|
+
<OText color={theme.colors.primary}>{t('ORDER_REVIEWED', 'This order has been already reviewed')}</OText>
|
|
225
|
+
</View>
|
|
226
|
+
) : (
|
|
227
|
+
<View style={{flex: 1, justifyContent: 'flex-end'}}>
|
|
228
|
+
<FormReviews>
|
|
229
|
+
<OText mBottom={13}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</OText>
|
|
230
|
+
<RatingBarContainer>
|
|
231
|
+
<LinearGradient
|
|
232
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
233
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
|
|
234
|
+
locations={[.9999, .9999]}
|
|
235
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray200]}
|
|
236
|
+
style={styles.statusBar}
|
|
237
|
+
/>
|
|
238
|
+
<RatingTextContainer>
|
|
239
|
+
{qualificationList.map((qualification: any) => (
|
|
240
|
+
<View
|
|
241
|
+
key={qualification.key}
|
|
242
|
+
style={{ ...qualification.parentStyle, ...styles.ratingItemContainer }}
|
|
243
|
+
>
|
|
244
|
+
<TouchableOpacity
|
|
245
|
+
style={qualification.isInnerStyle && styles.ratingItem}
|
|
246
|
+
onPress={() => handleChangeStars(qualification.key)}
|
|
247
|
+
>
|
|
248
|
+
<View
|
|
249
|
+
style={{
|
|
250
|
+
...styles.ratingLineStyle,
|
|
251
|
+
backgroundColor: (qualification.pointerColor && !(stars.quality >= qualification.key)) ? theme.colors.dusk : 'transparent'
|
|
252
|
+
}}
|
|
253
|
+
/>
|
|
254
|
+
<OText size={12} color={stars.quality === qualification.key ? theme.colors.black : theme.colors.lightGray}>{qualification.text}</OText>
|
|
255
|
+
</TouchableOpacity>
|
|
256
|
+
</View>
|
|
257
|
+
))}
|
|
258
|
+
</RatingTextContainer>
|
|
259
|
+
</RatingBarContainer>
|
|
183
260
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
261
|
+
<OText style={{ marginTop: 30 }}>{t('COMMENTS', 'Comments')}</OText>
|
|
262
|
+
<CommentsButtonGroup>
|
|
263
|
+
{commentsList.map(commentItem => (
|
|
264
|
+
<OButton
|
|
265
|
+
key={commentItem.key}
|
|
266
|
+
text={commentItem.content}
|
|
267
|
+
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
268
|
+
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
269
|
+
textStyle={{
|
|
270
|
+
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
271
|
+
fontSize: 13,
|
|
272
|
+
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
273
|
+
}}
|
|
274
|
+
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
275
|
+
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
276
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
277
|
+
onClick={() => handleChangeComment(commentItem) }
|
|
278
|
+
/>
|
|
279
|
+
))}
|
|
280
|
+
</CommentsButtonGroup>
|
|
192
281
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
/>
|
|
235
|
-
<View style={styles.progressLabel}>
|
|
236
|
-
{scores.map(({ val, text, color }, idx) =>
|
|
237
|
-
<TouchableOpacity key={idx} onPress={() => setReviewVal(val)}>
|
|
238
|
-
<OText
|
|
239
|
-
size={10}
|
|
240
|
-
color={
|
|
241
|
-
curVal === val
|
|
242
|
-
? color
|
|
243
|
-
: theme.colors.backgroundGray400
|
|
244
|
-
}>
|
|
245
|
-
{text}
|
|
246
|
-
</OText>
|
|
247
|
-
</TouchableOpacity>
|
|
248
|
-
)}
|
|
249
|
-
</View>
|
|
250
|
-
</BlockWrap>
|
|
251
|
-
<BlockWrap>
|
|
252
|
-
<OText mBottom={16}>{t('COMMENTS', 'Comments')}</OText>
|
|
253
|
-
<View style={{flexShrink: 1}}>
|
|
254
|
-
<TagSelector items={curSuggest} activeColor={theme.colors.primary} normalColor={'#E9ECEF'} onUpdated={onSuggestUpdate} />
|
|
255
|
-
</View>
|
|
256
|
-
</BlockWrap>
|
|
257
|
-
<FormReviews>
|
|
258
|
-
{/* {Object.values(categories).map(category => (
|
|
259
|
-
<Category key={category.name}>
|
|
260
|
-
<OText>{category.show}</OText>
|
|
261
|
-
<Stars>
|
|
262
|
-
{getStarArr(stars[category?.name]).map((star, index) => getStar(star, index, category.name))}
|
|
263
|
-
</Stars>
|
|
264
|
-
</Category>
|
|
265
|
-
))} */}
|
|
266
|
-
<OText mBottom={10}>{t('DO_YOU_WANT_TO_ADD_SOMETHING', 'Do you want to add something?')}</OText>
|
|
267
|
-
<Controller
|
|
268
|
-
control={control}
|
|
269
|
-
defaultValue=''
|
|
270
|
-
name='comments'
|
|
271
|
-
render={({ onChange }: any) => (
|
|
272
|
-
<OInput
|
|
273
|
-
name='comments'
|
|
274
|
-
placeholder={t('COMMENTS', 'Comments')}
|
|
275
|
-
onChange={(val: string) => {
|
|
276
|
-
onChange(val)
|
|
277
|
-
handleChangeInput(val)
|
|
278
|
-
}}
|
|
279
|
-
style={styles.inputTextArea}
|
|
280
|
-
multiline
|
|
281
|
-
inputStyle={{fontSize: 12}}
|
|
282
|
-
/>
|
|
283
|
-
)}
|
|
284
|
-
/>
|
|
285
|
-
</FormReviews>
|
|
286
|
-
<OButton
|
|
287
|
-
textStyle={{ color: theme.colors.white }}
|
|
288
|
-
style={{ marginTop: 20 }}
|
|
289
|
-
text={t('SAVE', 'Save')}
|
|
290
|
-
imgRightSrc=''
|
|
291
|
-
onClick={handleSubmit(onSubmit)}
|
|
292
|
-
/>
|
|
293
|
-
</View>
|
|
294
|
-
<Spinner visible={formState.loading} />
|
|
295
|
-
</ReviewOrderContainer>
|
|
296
|
-
)
|
|
282
|
+
<OText style={{ marginTop: 30 }}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText>
|
|
283
|
+
<Controller
|
|
284
|
+
control={control}
|
|
285
|
+
defaultValue=''
|
|
286
|
+
name='comments'
|
|
287
|
+
render={({ onChange }: any) => (
|
|
288
|
+
<OInput
|
|
289
|
+
name='comments'
|
|
290
|
+
onChange={(val: any) => {
|
|
291
|
+
onChange(val)
|
|
292
|
+
setExtraComment(val.target.value)
|
|
293
|
+
}}
|
|
294
|
+
style={styles.inputTextArea}
|
|
295
|
+
multiline
|
|
296
|
+
/>
|
|
297
|
+
)}
|
|
298
|
+
/>
|
|
299
|
+
</FormReviews>
|
|
300
|
+
</View>
|
|
301
|
+
)}
|
|
302
|
+
<Spinner visible={formState.loading} />
|
|
303
|
+
</ReviewOrderContainer>
|
|
304
|
+
<FloatingBottomContainer>
|
|
305
|
+
<ActionContainer>
|
|
306
|
+
<SkipButton
|
|
307
|
+
// onPress={() => onNavigationRedirect('ReviewProducts', { order: order })}
|
|
308
|
+
onPress={() => navigation?.canGoBack() && navigation.goBack()}
|
|
309
|
+
>
|
|
310
|
+
<OText weight={700} size={18}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
|
|
311
|
+
</SkipButton>
|
|
312
|
+
<OButton
|
|
313
|
+
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
314
|
+
text={t('SEND_REVIEW', 'Send Review')}
|
|
315
|
+
style={{ borderRadius: 8 }}
|
|
316
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
317
|
+
onClick={handleSubmit(onSubmit)}
|
|
318
|
+
/>
|
|
319
|
+
</ActionContainer>
|
|
320
|
+
</FloatingBottomContainer>
|
|
321
|
+
</>
|
|
322
|
+
)
|
|
297
323
|
}
|
|
298
324
|
|
|
299
|
-
|
|
300
325
|
export const ReviewOrder = (props: ReviewOrderParams) => {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
326
|
+
const reviewOrderProps = {
|
|
327
|
+
...props,
|
|
328
|
+
UIComponent: ReviewOrderUI
|
|
329
|
+
}
|
|
330
|
+
return <ReviewOrderController {...reviewOrderProps} />
|
|
306
331
|
}
|