ordering-ui-react-native 0.16.50 → 0.16.53
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/ReviewProducts/index.tsx +11 -0
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/themes/original/index.tsx +6 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +197 -142
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +34 -8
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +9 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +238 -94
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +98 -23
- package/themes/original/src/components/GoogleMap/index.tsx +10 -11
- package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +301 -0
- package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +39 -0
- package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +326 -0
- package/themes/original/src/components/Reviews/ReviewOrder/styles.tsx +53 -0
- package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +101 -0
- package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +17 -0
- package/themes/original/src/components/Reviews/index.tsx +9 -0
- package/themes/original/src/components/ServiceForm/index.tsx +15 -5
- package/themes/original/src/components/SignupForm/index.tsx +26 -24
- package/themes/original/src/components/SingleProductCard/index.tsx +113 -103
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/shared/OBottomPopup.tsx +26 -7
- package/themes/original/src/components/shared/OButton.tsx +2 -0
- package/themes/original/src/types/index.tsx +19 -15
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
3
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
4
|
+
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType, useUtils } from 'ordering-components/native'
|
|
5
|
+
import { useForm, Controller } from 'react-hook-form'
|
|
6
|
+
import LinearGradient from 'react-native-linear-gradient'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ReviewOrderContainer,
|
|
10
|
+
BusinessLogo,
|
|
11
|
+
FormReviews,
|
|
12
|
+
CommentsButtonGroup,
|
|
13
|
+
ActionContainer,
|
|
14
|
+
SkipButton,
|
|
15
|
+
RatingBarContainer,
|
|
16
|
+
RatingTextContainer,
|
|
17
|
+
RatingStarContainer,
|
|
18
|
+
PlacedDate
|
|
19
|
+
} from './styles'
|
|
20
|
+
import { OButton, OIcon, OInput, OText } from '../../shared'
|
|
21
|
+
import { FloatingBottomContainer } from '../../../layouts/FloatingBottomContainer'
|
|
22
|
+
import Spinner from 'react-native-loading-spinner-overlay'
|
|
23
|
+
|
|
24
|
+
import { ReviewOrderParams } from '../../../types'
|
|
25
|
+
import { useTheme } from 'styled-components/native'
|
|
26
|
+
|
|
27
|
+
import { reviewCommentList } from '../../../../../../src/utils'
|
|
28
|
+
|
|
29
|
+
export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
30
|
+
const {
|
|
31
|
+
order,
|
|
32
|
+
stars,
|
|
33
|
+
handleSendReview,
|
|
34
|
+
formState,
|
|
35
|
+
setStars,
|
|
36
|
+
setIsReviewed,
|
|
37
|
+
closeReviewOrder,
|
|
38
|
+
skipReview
|
|
39
|
+
} = props
|
|
40
|
+
|
|
41
|
+
const theme = useTheme()
|
|
42
|
+
|
|
43
|
+
const styles = StyleSheet.create({
|
|
44
|
+
logoWrapper: {
|
|
45
|
+
shadowColor: theme.colors.black,
|
|
46
|
+
shadowRadius: 3,
|
|
47
|
+
shadowOffset: { width: 1, height: 4 },
|
|
48
|
+
elevation: 3,
|
|
49
|
+
borderRadius: 8,
|
|
50
|
+
shadowOpacity: 0.1,
|
|
51
|
+
overflow: 'hidden'
|
|
52
|
+
},
|
|
53
|
+
inputTextArea: {
|
|
54
|
+
borderColor: theme.colors.lightGray,
|
|
55
|
+
borderRadius: 8,
|
|
56
|
+
marginTop: 10,
|
|
57
|
+
marginBottom: 40,
|
|
58
|
+
height: 100,
|
|
59
|
+
alignItems: 'flex-start'
|
|
60
|
+
},
|
|
61
|
+
statusBar: {
|
|
62
|
+
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
63
|
+
height: 10,
|
|
64
|
+
borderRadius: 5,
|
|
65
|
+
marginTop: 5
|
|
66
|
+
},
|
|
67
|
+
ratingItemContainer: {
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
top: -20
|
|
70
|
+
},
|
|
71
|
+
ratingItem: {
|
|
72
|
+
left: '-50%',
|
|
73
|
+
flexDirection: 'column',
|
|
74
|
+
alignItems: 'center'
|
|
75
|
+
},
|
|
76
|
+
ratingLineStyle: {
|
|
77
|
+
height: 10,
|
|
78
|
+
width: 1,
|
|
79
|
+
marginBottom: 10,
|
|
80
|
+
backgroundColor: theme.colors.dusk
|
|
81
|
+
},
|
|
82
|
+
reviewedStyle: {
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
marginVertical: 20
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const [, t] = useLanguage()
|
|
90
|
+
const [, { showToast }] = useToast()
|
|
91
|
+
const { handleSubmit, control, errors } = useForm()
|
|
92
|
+
const [{ parseDate }] = useUtils()
|
|
93
|
+
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
94
|
+
const [comments, setComments] = useState<Array<any>>([])
|
|
95
|
+
const [extraComment, setExtraComment] = useState('')
|
|
96
|
+
const placedOnDate = parseDate(order?.delivery_datetime, { outputFormat: 'dddd MMMM DD, YYYY' })
|
|
97
|
+
|
|
98
|
+
const onSubmit = () => {
|
|
99
|
+
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
100
|
+
setAlertState({
|
|
101
|
+
open: true,
|
|
102
|
+
content: stars.quality === 0 ? [`${t('REVIEW_QUALIFICATION_REQUIRED', 'Review qualification is required')}`] : []
|
|
103
|
+
})
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
setAlertState({ ...alertState, success: true })
|
|
107
|
+
handleSendReview()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const qualificationList = [
|
|
111
|
+
{ key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
|
|
112
|
+
{ key: 2, text: t('BAD', 'Bad'), percent: 0.25, parentStyle: { left: '25%' }, isInnerStyle: true, pointerColor: true },
|
|
113
|
+
{ key: 3, text: t('OKAY', 'Okay'), percent: 0.5, parentStyle: { left: '50%' }, isInnerStyle: true, pointerColor: true },
|
|
114
|
+
{ key: 4, text: t('GOOD', 'Good'), percent: 0.75, parentStyle: { left: '75%' }, isInnerStyle: true, pointerColor: true },
|
|
115
|
+
{ key: 5, text: t('GREAT', 'Great'), percent: 1, parentStyle: { right: '0%' }, isInnerStyle: false, pointerColor: false }
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
const commentsList = reviewCommentList('order')
|
|
119
|
+
|
|
120
|
+
const handleChangeStars = (index: number) => {
|
|
121
|
+
if (index) setStars({ ...stars, quality: index, punctiality: index, service: index, packaging: index, comments: '' })
|
|
122
|
+
setComments([])
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const handleChangeComment = (commentItem: any) => {
|
|
126
|
+
const found = comments.find((comment: any) => comment?.key === commentItem.key)
|
|
127
|
+
if (found) {
|
|
128
|
+
const _comments = comments.filter((comment: any) => comment?.key !== commentItem.key)
|
|
129
|
+
setComments(_comments)
|
|
130
|
+
} else {
|
|
131
|
+
setComments([...comments, commentItem])
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const isSelectedComment = (commentKey: number) => {
|
|
136
|
+
const found = comments.find((comment: any) => comment?.key === commentKey)
|
|
137
|
+
return found
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const handleContinueClick = () => {
|
|
141
|
+
!order?.review && onSubmit()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (formState.error && !formState?.loading) {
|
|
146
|
+
showToast(ToastType.Error, formState.result)
|
|
147
|
+
}
|
|
148
|
+
if (!formState.loading && !formState.error && alertState.success) {
|
|
149
|
+
showToast(ToastType.Success, t('ORDER_REVIEW_SUCCESS_CONTENT', 'Thank you, Order review successfully submitted!'))
|
|
150
|
+
setIsReviewed && setIsReviewed(true)
|
|
151
|
+
closeReviewOrder && closeReviewOrder()
|
|
152
|
+
}
|
|
153
|
+
}, [formState.result])
|
|
154
|
+
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (Object.keys(errors).length > 0) {
|
|
157
|
+
// Convert all errors in one string to show in toast provider
|
|
158
|
+
const list = Object.values(errors);
|
|
159
|
+
let stringError = '';
|
|
160
|
+
list.map((item: any, i: number) => {
|
|
161
|
+
stringError +=
|
|
162
|
+
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
163
|
+
});
|
|
164
|
+
showToast(ToastType.Error, stringError);
|
|
165
|
+
}
|
|
166
|
+
}, [errors])
|
|
167
|
+
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (alertState.open) {
|
|
170
|
+
alertState.content && showToast(
|
|
171
|
+
ToastType.Error,
|
|
172
|
+
alertState.content
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
}, [alertState.content])
|
|
176
|
+
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
let _comments = ''
|
|
179
|
+
if (comments.length > 0) {
|
|
180
|
+
comments.map(comment => _comments += comment.content + '. ')
|
|
181
|
+
}
|
|
182
|
+
let _comment
|
|
183
|
+
_comment = _comments + extraComment
|
|
184
|
+
setStars({ ...stars, comments: _comment })
|
|
185
|
+
}, [comments, extraComment])
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<>
|
|
189
|
+
<ReviewOrderContainer>
|
|
190
|
+
<BusinessLogo>
|
|
191
|
+
<View style={styles.logoWrapper}>
|
|
192
|
+
<OIcon
|
|
193
|
+
url={order?.logo}
|
|
194
|
+
width={80}
|
|
195
|
+
height={80}
|
|
196
|
+
/>
|
|
197
|
+
</View>
|
|
198
|
+
</BusinessLogo>
|
|
199
|
+
{!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
|
|
200
|
+
{order?.review ? (
|
|
201
|
+
<View style={styles.reviewedStyle}>
|
|
202
|
+
<OText color={theme.colors.primary}>{t('ORDER_REVIEWED', 'This order has been already reviewed')}</OText>
|
|
203
|
+
</View>
|
|
204
|
+
) : (
|
|
205
|
+
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
|
|
206
|
+
<FormReviews>
|
|
207
|
+
{/* <OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</OText> */}
|
|
208
|
+
{false && (
|
|
209
|
+
<RatingBarContainer>
|
|
210
|
+
<LinearGradient
|
|
211
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
212
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
|
|
213
|
+
locations={[.9999, .9999]}
|
|
214
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray200]}
|
|
215
|
+
style={styles.statusBar}
|
|
216
|
+
/>
|
|
217
|
+
<RatingTextContainer>
|
|
218
|
+
{qualificationList.map((qualification: any) => (
|
|
219
|
+
<View
|
|
220
|
+
key={qualification.key}
|
|
221
|
+
style={{ ...qualification.parentStyle, ...styles.ratingItemContainer }}
|
|
222
|
+
>
|
|
223
|
+
<TouchableOpacity
|
|
224
|
+
style={qualification.isInnerStyle && styles.ratingItem}
|
|
225
|
+
onPress={() => handleChangeStars(qualification.key)}
|
|
226
|
+
>
|
|
227
|
+
<View
|
|
228
|
+
style={{
|
|
229
|
+
...styles.ratingLineStyle,
|
|
230
|
+
backgroundColor: (qualification.pointerColor && !(stars.quality >= qualification.key)) ? theme.colors.dusk : 'transparent'
|
|
231
|
+
}}
|
|
232
|
+
/>
|
|
233
|
+
<OText size={12} color={stars.quality === qualification.key ? theme.colors.black : theme.colors.backgroundGray200}>{qualification.text}</OText>
|
|
234
|
+
</TouchableOpacity>
|
|
235
|
+
</View>
|
|
236
|
+
))}
|
|
237
|
+
</RatingTextContainer>
|
|
238
|
+
</RatingBarContainer>
|
|
239
|
+
)}
|
|
240
|
+
<RatingStarContainer>
|
|
241
|
+
{[...Array(5).keys()].map((index) => (<FontAwesome name={(index <= (stars?.quality - 1)) ? 'star' : 'star-o'} size={28} key={`star-symbol-${index}`} onPress={() => handleChangeStars(index + 1)} color={theme?.colors?.primary} />)
|
|
242
|
+
)}
|
|
243
|
+
</RatingStarContainer>
|
|
244
|
+
<PlacedDate>
|
|
245
|
+
<OText color={theme.colors.textNormal}>{t('DONOT_FORGET_RATE_YOUR_ORDER', 'Do not forget to rate your order placed on ')}</OText>
|
|
246
|
+
<OText color={theme.colors.textNormal} style={{ fontWeight: "bold" }}>{placedOnDate}</OText>
|
|
247
|
+
</PlacedDate>
|
|
248
|
+
{false && (
|
|
249
|
+
<>
|
|
250
|
+
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>
|
|
251
|
+
{commentsList[stars?.quality || 1]?.title}
|
|
252
|
+
</OText>
|
|
253
|
+
<CommentsButtonGroup>
|
|
254
|
+
{commentsList[stars?.quality || 1]?.list?.map((commentItem: any) => (
|
|
255
|
+
<OButton
|
|
256
|
+
key={commentItem.key}
|
|
257
|
+
text={commentItem.content}
|
|
258
|
+
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
259
|
+
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
260
|
+
textStyle={{
|
|
261
|
+
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
262
|
+
fontSize: 13,
|
|
263
|
+
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
264
|
+
}}
|
|
265
|
+
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
266
|
+
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
267
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
268
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
269
|
+
/>
|
|
270
|
+
))}
|
|
271
|
+
</CommentsButtonGroup>
|
|
272
|
+
</>
|
|
273
|
+
)}
|
|
274
|
+
{/* <OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText> */}
|
|
275
|
+
{false && (
|
|
276
|
+
<Controller
|
|
277
|
+
control={control}
|
|
278
|
+
defaultValue=''
|
|
279
|
+
name='comments'
|
|
280
|
+
render={({ onChange }: any) => (
|
|
281
|
+
<OInput
|
|
282
|
+
name='comments'
|
|
283
|
+
onChange={(val: any) => {
|
|
284
|
+
onChange(val)
|
|
285
|
+
setExtraComment(val.target.value)
|
|
286
|
+
}}
|
|
287
|
+
style={styles.inputTextArea}
|
|
288
|
+
multiline
|
|
289
|
+
/>
|
|
290
|
+
)}
|
|
291
|
+
/>
|
|
292
|
+
)}
|
|
293
|
+
</FormReviews>
|
|
294
|
+
</View>
|
|
295
|
+
)}
|
|
296
|
+
<Spinner visible={formState.loading} />
|
|
297
|
+
</ReviewOrderContainer>
|
|
298
|
+
<FloatingBottomContainer>
|
|
299
|
+
<ActionContainer>
|
|
300
|
+
<SkipButton
|
|
301
|
+
onPress={skipReview}
|
|
302
|
+
>
|
|
303
|
+
<OText weight={700} size={18} color={theme.colors.textNormal}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
|
|
304
|
+
</SkipButton>
|
|
305
|
+
<OButton
|
|
306
|
+
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
307
|
+
text={t('CONTINUE_REVIEW', 'Continue Review')}
|
|
308
|
+
style={{ borderRadius: 8 }}
|
|
309
|
+
imgRightSrc={theme.images.general.arrow_right}
|
|
310
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
311
|
+
onClick={handleSubmit(handleContinueClick)}
|
|
312
|
+
/>
|
|
313
|
+
</ActionContainer>
|
|
314
|
+
</FloatingBottomContainer>
|
|
315
|
+
</>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export const ReviewOrder = (props: ReviewOrderParams) => {
|
|
320
|
+
const reviewOrderProps = {
|
|
321
|
+
...props,
|
|
322
|
+
UIComponent: ReviewOrderUI,
|
|
323
|
+
defaultStar: 5
|
|
324
|
+
}
|
|
325
|
+
return <ReviewOrderController {...reviewOrderProps} />
|
|
326
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const ReviewOrderContainer = styled.ScrollView`
|
|
4
|
+
padding: 20px 40px;
|
|
5
|
+
margin-bottom: 100px;
|
|
6
|
+
`
|
|
7
|
+
|
|
8
|
+
export const BusinessLogo = styled.View`
|
|
9
|
+
margin-vertical: 5px;
|
|
10
|
+
align-items: center;
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const FormReviews = styled.View`
|
|
14
|
+
flex: 1;
|
|
15
|
+
height: 100%;
|
|
16
|
+
margin-top: 30px;
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
export const CommentsButtonGroup = styled.View`
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export const ActionContainer = styled.View`
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
padding: 3px 30px;
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
export const SkipButton = styled.TouchableOpacity`
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
export const RatingBarContainer = styled.View`
|
|
35
|
+
margin-top: 10px;
|
|
36
|
+
margin-bottom: 25px;
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
export const RatingTextContainer = styled.View`
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
margin-top: 10px;
|
|
44
|
+
`
|
|
45
|
+
export const RatingStarContainer = styled.View`
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
margin-top: 10px;
|
|
50
|
+
`
|
|
51
|
+
export const PlacedDate = styled.View`
|
|
52
|
+
margin-top: 30px;
|
|
53
|
+
`
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useLanguage, useToast, ToastType, ReviewProduct as ReviewProductController } from 'ordering-components/native'
|
|
3
|
+
import { OText, OButton } from '../../shared'
|
|
4
|
+
import { ReviewProductParams } from '../../../types'
|
|
5
|
+
import { FloatingBottomContainer } from '../../../layouts/FloatingBottomContainer'
|
|
6
|
+
import { useTheme } from 'styled-components/native'
|
|
7
|
+
import { SingleProductReview } from '../../SingleProductReview'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ReviewProductsContainer,
|
|
11
|
+
ActionContainer,
|
|
12
|
+
SkipButton
|
|
13
|
+
} from './styles'
|
|
14
|
+
|
|
15
|
+
const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
16
|
+
const {
|
|
17
|
+
navigation,
|
|
18
|
+
order,
|
|
19
|
+
formState,
|
|
20
|
+
handleChangeFormState,
|
|
21
|
+
handleSendProductReview,
|
|
22
|
+
closeReviewProduct
|
|
23
|
+
} = props
|
|
24
|
+
|
|
25
|
+
const [, t] = useLanguage()
|
|
26
|
+
const theme = useTheme()
|
|
27
|
+
const [, { showToast }] = useToast()
|
|
28
|
+
|
|
29
|
+
const [isProductReviewed, setIsProductReviewed] = useState(false)
|
|
30
|
+
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
31
|
+
|
|
32
|
+
const handleContinueClick = () => {
|
|
33
|
+
setAlertState({ ...alertState, success: true })
|
|
34
|
+
handleSendProductReview()
|
|
35
|
+
}
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (alertState.open) {
|
|
38
|
+
alertState.content && showToast(
|
|
39
|
+
ToastType.Error,
|
|
40
|
+
alertState.content
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}, [alertState.content])
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!formState.loading && formState.result?.error) {
|
|
47
|
+
setAlertState({
|
|
48
|
+
open: true,
|
|
49
|
+
success: false,
|
|
50
|
+
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
if (!formState.loading && !formState.result?.error && alertState.success) {
|
|
54
|
+
setIsProductReviewed && setIsProductReviewed(true)
|
|
55
|
+
closeReviewProduct && closeReviewProduct()
|
|
56
|
+
}
|
|
57
|
+
}, [formState])
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<ReviewProductsContainer>
|
|
62
|
+
{order?.products?.map((product: any) => (
|
|
63
|
+
<SingleProductReview
|
|
64
|
+
key={product.id}
|
|
65
|
+
product={product}
|
|
66
|
+
formState={formState}
|
|
67
|
+
handleChangeFormState={handleChangeFormState}
|
|
68
|
+
/>
|
|
69
|
+
))}
|
|
70
|
+
</ReviewProductsContainer>
|
|
71
|
+
|
|
72
|
+
<FloatingBottomContainer>
|
|
73
|
+
<ActionContainer>
|
|
74
|
+
<SkipButton
|
|
75
|
+
onPress={() => closeReviewProduct && closeReviewProduct()}
|
|
76
|
+
>
|
|
77
|
+
<OText weight={700} size={18} color={theme.colors.textNormal}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
|
|
78
|
+
</SkipButton>
|
|
79
|
+
<OButton
|
|
80
|
+
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
81
|
+
text={order?.driver && !order?.user_review ? t('CONTINUE', 'Continue') : t('SEND_REVIEW', 'Send Review')}
|
|
82
|
+
style={{ borderRadius: 8 }}
|
|
83
|
+
imgRightSrc={theme.images.general.arrow_right}
|
|
84
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
85
|
+
isDisabled={formState.loading || formState?.changes?.length === 0}
|
|
86
|
+
onClick={() => handleContinueClick()}
|
|
87
|
+
/>
|
|
88
|
+
</ActionContainer>
|
|
89
|
+
</FloatingBottomContainer>
|
|
90
|
+
</>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const ReviewProducts = (props: any) => {
|
|
95
|
+
const reviewProductProps = {
|
|
96
|
+
...props,
|
|
97
|
+
UIComponent: ReviewProductsUI,
|
|
98
|
+
isToast: true
|
|
99
|
+
}
|
|
100
|
+
return <ReviewProductController {...reviewProductProps} />
|
|
101
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const ReviewProductsContainer = styled.ScrollView`
|
|
4
|
+
padding: 20px 40px;
|
|
5
|
+
margin-bottom: 100px;
|
|
6
|
+
max-height: 400px;
|
|
7
|
+
`
|
|
8
|
+
|
|
9
|
+
export const ActionContainer = styled.View`
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
padding: 3px 30px;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
export const SkipButton = styled.TouchableOpacity`
|
|
17
|
+
`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReviewOrder as ReviewOrderModal } from './ReviewOrder';
|
|
2
|
+
import { ReviewProducts as ReviewProductsModal } from './ReviewProducts';
|
|
3
|
+
import { ReviewDriver as ReviewDriverModal } from './ReviewDriver';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
ReviewOrderModal,
|
|
7
|
+
ReviewProductsModal,
|
|
8
|
+
ReviewDriverModal
|
|
9
|
+
}
|
|
@@ -65,8 +65,8 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
65
65
|
|
|
66
66
|
const styles = StyleSheet.create({
|
|
67
67
|
photoStyle: {
|
|
68
|
-
width:
|
|
69
|
-
height:
|
|
68
|
+
width: 45,
|
|
69
|
+
height: 45,
|
|
70
70
|
borderRadius: 7.6
|
|
71
71
|
},
|
|
72
72
|
buttonStyle: {
|
|
@@ -313,12 +313,14 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
313
313
|
<OText
|
|
314
314
|
size={14}
|
|
315
315
|
weight={'400'}
|
|
316
|
+
lineHeight={22}
|
|
316
317
|
>
|
|
317
318
|
{currentProfessional?.name} {currentProfessional?.lastname}
|
|
318
319
|
</OText>
|
|
319
320
|
<OText
|
|
320
321
|
size={12}
|
|
321
322
|
weight={'400'}
|
|
323
|
+
lineHeight={17}
|
|
322
324
|
color={isBusyTime(currentProfessional) ? theme.colors.danger5 : theme.colors.success500}
|
|
323
325
|
>
|
|
324
326
|
{isBusyTime(currentProfessional)
|
|
@@ -459,9 +461,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
459
461
|
size={14}
|
|
460
462
|
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
461
463
|
>
|
|
462
|
-
{dateSelected
|
|
463
|
-
? moment(dateSelected).format('hh:mm A')
|
|
464
|
-
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
464
|
+
{dateSelected && moment(dateSelected).format('hh:mm A')}
|
|
465
465
|
</OText>
|
|
466
466
|
{((productCart &&
|
|
467
467
|
auth &&
|
|
@@ -517,6 +517,14 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
517
517
|
entireModal
|
|
518
518
|
>
|
|
519
519
|
<ScrollView contentContainerStyle={styles.professionalList}>
|
|
520
|
+
<View style={{ padding: 11 }}>
|
|
521
|
+
<OText
|
|
522
|
+
size={14}
|
|
523
|
+
weight={'400'}
|
|
524
|
+
>
|
|
525
|
+
{t('ANY_OROFESSIONAL_MEMBER', 'Any professional member')}
|
|
526
|
+
</OText>
|
|
527
|
+
</View>
|
|
520
528
|
{professionalList?.map((professional: any) => professional?.products?.includes(product?.id) && (
|
|
521
529
|
<TouchableOpacity
|
|
522
530
|
key={professional?.id}
|
|
@@ -536,12 +544,14 @@ const ServiceFormUI = (props: ServiceFormParams) => {
|
|
|
536
544
|
<OText
|
|
537
545
|
size={14}
|
|
538
546
|
weight={'400'}
|
|
547
|
+
lineHeight={22}
|
|
539
548
|
>
|
|
540
549
|
{professional?.name} {professional?.lastname}
|
|
541
550
|
</OText>
|
|
542
551
|
<OText
|
|
543
552
|
size={12}
|
|
544
553
|
weight={'400'}
|
|
554
|
+
lineHeight={17}
|
|
545
555
|
color={isBusyTime(professional) ? theme.colors.danger5 : theme.colors.success500}
|
|
546
556
|
>
|
|
547
557
|
{isBusyTime(professional)
|
|
@@ -443,36 +443,38 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
443
443
|
titleStyle={{ marginLeft: 0, marginRight: 0 }}
|
|
444
444
|
/>
|
|
445
445
|
<FormSide>
|
|
446
|
-
{(useSignUpFullDetails) && (
|
|
446
|
+
{((Number(useSignUpFullDetails) + Number(useSignUpOtpEmail) + Number(useSignUpOtpCellphone)) > 1) && (
|
|
447
447
|
<SignupWith>
|
|
448
448
|
<OTabs
|
|
449
449
|
horizontal
|
|
450
450
|
showsHorizontalScrollIndicator={false}
|
|
451
451
|
ref={tabsRef}
|
|
452
452
|
>
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
453
|
+
{useSignUpFullDetails && (
|
|
454
|
+
<TabBtn
|
|
455
|
+
onPress={() => handleSignUpTab('default')}
|
|
456
|
+
onLayout={(event: any) => handleOnLayout(event, 'default')}
|
|
457
|
+
>
|
|
458
|
+
<OTab
|
|
459
|
+
style={{
|
|
460
|
+
borderBottomColor:
|
|
461
|
+
signUpTab === 'default'
|
|
462
|
+
? theme.colors.textNormal
|
|
463
|
+
: theme.colors.border,
|
|
464
|
+
}}>
|
|
465
|
+
<OText
|
|
466
|
+
size={14}
|
|
467
|
+
color={
|
|
468
|
+
signUpTab === 'default'
|
|
469
|
+
? theme.colors.textNormal
|
|
470
|
+
: theme.colors.disabled
|
|
471
|
+
}
|
|
472
|
+
weight={signUpTab === 'default' ? 'bold' : 'normal'}>
|
|
473
|
+
{t('DEFAULT', 'Default')}
|
|
474
|
+
</OText>
|
|
475
|
+
</OTab>
|
|
476
|
+
</TabBtn>
|
|
477
|
+
)}
|
|
476
478
|
{useSignUpOtpEmail && (
|
|
477
479
|
<TabBtn
|
|
478
480
|
onPress={() => handleSignUpTab('otpEmail')}
|