ordering-ui-react-native 0.16.43 → 0.16.46
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/pages/BusinessesListing.tsx +7 -6
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +40 -39
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +2 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +38 -5
- package/themes/original/src/components/NavBar/index.tsx +4 -4
- package/themes/original/src/components/OrderDetails/index.tsx +2 -0
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalProfile/index.tsx +7 -6
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +98 -78
- package/themes/original/src/components/ReviewOrder/styles.tsx +9 -0
- package/themes/original/src/components/SearchBar/index.tsx +5 -3
- package/themes/original/src/components/ServiceForm/index.tsx +337 -253
- package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/types/index.tsx +3 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import
|
|
2
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
3
|
+
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType, useUtils } from 'ordering-components/native'
|
|
3
4
|
import { useForm, Controller } from 'react-hook-form'
|
|
4
5
|
import LinearGradient from 'react-native-linear-gradient'
|
|
5
6
|
|
|
@@ -11,7 +12,9 @@ import {
|
|
|
11
12
|
ActionContainer,
|
|
12
13
|
SkipButton,
|
|
13
14
|
RatingBarContainer,
|
|
14
|
-
RatingTextContainer
|
|
15
|
+
RatingTextContainer,
|
|
16
|
+
RatingStarContainer,
|
|
17
|
+
PlacedDate
|
|
15
18
|
} from './styles'
|
|
16
19
|
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
17
20
|
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
@@ -88,10 +91,11 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
88
91
|
const [, t] = useLanguage()
|
|
89
92
|
const [, { showToast }] = useToast()
|
|
90
93
|
const { handleSubmit, control, errors } = useForm()
|
|
91
|
-
|
|
94
|
+
const [{ parseDate }] = useUtils()
|
|
92
95
|
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
93
96
|
const [comments, setComments] = useState<Array<any>>([])
|
|
94
97
|
const [extraComment, setExtraComment] = useState('')
|
|
98
|
+
const placedOnDate = parseDate(order?.delivery_datetime, { outputFormat: 'dddd MMMM DD, YYYY' })
|
|
95
99
|
|
|
96
100
|
const onSubmit = () => {
|
|
97
101
|
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
@@ -191,14 +195,15 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
191
195
|
<>
|
|
192
196
|
<ReviewOrderContainer>
|
|
193
197
|
<NavBar
|
|
194
|
-
title={t('
|
|
198
|
+
title={t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')}
|
|
195
199
|
titleAlign={'center'}
|
|
200
|
+
leftImg={theme.images.general.close}
|
|
196
201
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
197
202
|
showCall={false}
|
|
198
203
|
btnStyle={{ paddingLeft: 0 }}
|
|
199
|
-
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
200
|
-
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
201
|
-
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
204
|
+
style={{ flexDirection: 'column', alignItems: 'flex-start', justifyContent: 'center' }}
|
|
205
|
+
titleWrapStyle={{ paddingHorizontal: 0, width: '100%', justifyContent: 'center' }}
|
|
206
|
+
titleStyle={{ textAlign: 'center', marginRight: 0, marginLeft: 0 }}
|
|
202
207
|
/>
|
|
203
208
|
<BusinessLogo>
|
|
204
209
|
<View style={styles.logoWrapper}>
|
|
@@ -209,6 +214,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
209
214
|
/>
|
|
210
215
|
</View>
|
|
211
216
|
</BusinessLogo>
|
|
217
|
+
{!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
|
|
212
218
|
{order?.review ? (
|
|
213
219
|
<View style={styles.reviewedStyle}>
|
|
214
220
|
<OText color={theme.colors.primary}>{t('ORDER_REVIEWED', 'This order has been already reviewed')}</OText>
|
|
@@ -216,78 +222,92 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
216
222
|
) : (
|
|
217
223
|
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
|
|
218
224
|
<FormReviews>
|
|
219
|
-
<OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</OText>
|
|
220
|
-
|
|
221
|
-
<
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
<RatingTextContainer>
|
|
229
|
-
{qualificationList.map((qualification: any) => (
|
|
230
|
-
<View
|
|
231
|
-
key={qualification.key}
|
|
232
|
-
style={{ ...qualification.parentStyle, ...styles.ratingItemContainer }}
|
|
233
|
-
>
|
|
234
|
-
<TouchableOpacity
|
|
235
|
-
style={qualification.isInnerStyle && styles.ratingItem}
|
|
236
|
-
onPress={() => handleChangeStars(qualification.key)}
|
|
237
|
-
>
|
|
238
|
-
<View
|
|
239
|
-
style={{
|
|
240
|
-
...styles.ratingLineStyle,
|
|
241
|
-
backgroundColor: (qualification.pointerColor && !(stars.quality >= qualification.key)) ? theme.colors.dusk : 'transparent'
|
|
242
|
-
}}
|
|
243
|
-
/>
|
|
244
|
-
<OText size={12} color={stars.quality === qualification.key ? theme.colors.black : theme.colors.backgroundGray200}>{qualification.text}</OText>
|
|
245
|
-
</TouchableOpacity>
|
|
246
|
-
</View>
|
|
247
|
-
))}
|
|
248
|
-
</RatingTextContainer>
|
|
249
|
-
</RatingBarContainer>
|
|
250
|
-
|
|
251
|
-
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>
|
|
252
|
-
{commentsList[stars?.quality || 1]?.title}
|
|
253
|
-
</OText>
|
|
254
|
-
<CommentsButtonGroup>
|
|
255
|
-
{commentsList[stars?.quality || 1]?.list?.map(commentItem => (
|
|
256
|
-
<OButton
|
|
257
|
-
key={commentItem.key}
|
|
258
|
-
text={commentItem.content}
|
|
259
|
-
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
260
|
-
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
261
|
-
textStyle={{
|
|
262
|
-
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
263
|
-
fontSize: 13,
|
|
264
|
-
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
265
|
-
}}
|
|
266
|
-
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
267
|
-
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
268
|
-
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
269
|
-
onClick={() => handleChangeComment(commentItem)}
|
|
270
|
-
/>
|
|
271
|
-
))}
|
|
272
|
-
</CommentsButtonGroup>
|
|
273
|
-
|
|
274
|
-
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText>
|
|
275
|
-
<Controller
|
|
276
|
-
control={control}
|
|
277
|
-
defaultValue=''
|
|
278
|
-
name='comments'
|
|
279
|
-
render={({ onChange }: any) => (
|
|
280
|
-
<OInput
|
|
281
|
-
name='comments'
|
|
282
|
-
onChange={(val: any) => {
|
|
283
|
-
onChange(val)
|
|
284
|
-
setExtraComment(val.target.value)
|
|
285
|
-
}}
|
|
286
|
-
style={styles.inputTextArea}
|
|
287
|
-
multiline
|
|
225
|
+
{/* <OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</OText> */}
|
|
226
|
+
{false && (
|
|
227
|
+
<RatingBarContainer>
|
|
228
|
+
<LinearGradient
|
|
229
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
230
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
|
|
231
|
+
locations={[.9999, .9999]}
|
|
232
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray200]}
|
|
233
|
+
style={styles.statusBar}
|
|
288
234
|
/>
|
|
235
|
+
<RatingTextContainer>
|
|
236
|
+
{qualificationList.map((qualification: any) => (
|
|
237
|
+
<View
|
|
238
|
+
key={qualification.key}
|
|
239
|
+
style={{ ...qualification.parentStyle, ...styles.ratingItemContainer }}
|
|
240
|
+
>
|
|
241
|
+
<TouchableOpacity
|
|
242
|
+
style={qualification.isInnerStyle && styles.ratingItem}
|
|
243
|
+
onPress={() => handleChangeStars(qualification.key)}
|
|
244
|
+
>
|
|
245
|
+
<View
|
|
246
|
+
style={{
|
|
247
|
+
...styles.ratingLineStyle,
|
|
248
|
+
backgroundColor: (qualification.pointerColor && !(stars.quality >= qualification.key)) ? theme.colors.dusk : 'transparent'
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
<OText size={12} color={stars.quality === qualification.key ? theme.colors.black : theme.colors.backgroundGray200}>{qualification.text}</OText>
|
|
252
|
+
</TouchableOpacity>
|
|
253
|
+
</View>
|
|
254
|
+
))}
|
|
255
|
+
</RatingTextContainer>
|
|
256
|
+
</RatingBarContainer>
|
|
257
|
+
)}
|
|
258
|
+
<RatingStarContainer>
|
|
259
|
+
{[...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} />)
|
|
289
260
|
)}
|
|
290
|
-
|
|
261
|
+
</RatingStarContainer>
|
|
262
|
+
<PlacedDate>
|
|
263
|
+
<OText color={theme.colors.textNormal}>{t('DONOT_FORGET_RATE_YOUR_ORDER', 'Do not forget to rate your order placed on ')}</OText>
|
|
264
|
+
<OText color={theme.colors.textNormal} style={{ fontWeight: "bold" }}>{placedOnDate}</OText>
|
|
265
|
+
</PlacedDate>
|
|
266
|
+
{false && (
|
|
267
|
+
<>
|
|
268
|
+
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>
|
|
269
|
+
{commentsList[stars?.quality || 1]?.title}
|
|
270
|
+
</OText>
|
|
271
|
+
<CommentsButtonGroup>
|
|
272
|
+
{commentsList[stars?.quality || 1]?.list?.map((commentItem: any) => (
|
|
273
|
+
<OButton
|
|
274
|
+
key={commentItem.key}
|
|
275
|
+
text={commentItem.content}
|
|
276
|
+
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
277
|
+
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
278
|
+
textStyle={{
|
|
279
|
+
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
280
|
+
fontSize: 13,
|
|
281
|
+
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
282
|
+
}}
|
|
283
|
+
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
284
|
+
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
285
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
286
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
287
|
+
/>
|
|
288
|
+
))}
|
|
289
|
+
</CommentsButtonGroup>
|
|
290
|
+
</>
|
|
291
|
+
)}
|
|
292
|
+
{/* <OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText> */}
|
|
293
|
+
{false && (
|
|
294
|
+
<Controller
|
|
295
|
+
control={control}
|
|
296
|
+
defaultValue=''
|
|
297
|
+
name='comments'
|
|
298
|
+
render={({ onChange }: any) => (
|
|
299
|
+
<OInput
|
|
300
|
+
name='comments'
|
|
301
|
+
onChange={(val: any) => {
|
|
302
|
+
onChange(val)
|
|
303
|
+
setExtraComment(val.target.value)
|
|
304
|
+
}}
|
|
305
|
+
style={styles.inputTextArea}
|
|
306
|
+
multiline
|
|
307
|
+
/>
|
|
308
|
+
)}
|
|
309
|
+
/>
|
|
310
|
+
)}
|
|
291
311
|
</FormReviews>
|
|
292
312
|
</View>
|
|
293
313
|
)}
|
|
@@ -302,7 +322,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
302
322
|
</SkipButton>
|
|
303
323
|
<OButton
|
|
304
324
|
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
305
|
-
text={t('
|
|
325
|
+
text={t('GOTO_REVIEW', 'Go to review')}
|
|
306
326
|
style={{ borderRadius: 8 }}
|
|
307
327
|
imgRightSrc={theme.images.general.arrow_right}
|
|
308
328
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
@@ -42,3 +42,12 @@ export const RatingTextContainer = styled.View`
|
|
|
42
42
|
justify-content: space-between;
|
|
43
43
|
margin-top: 10px;
|
|
44
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
|
+
`
|
|
@@ -25,7 +25,8 @@ export const SearchBar = (props: any) => {
|
|
|
25
25
|
blurOnSubmit,
|
|
26
26
|
inputContainerStyles,
|
|
27
27
|
containerStyles,
|
|
28
|
-
hideIcon
|
|
28
|
+
hideIcon,
|
|
29
|
+
autoFocus
|
|
29
30
|
} = props
|
|
30
31
|
|
|
31
32
|
const theme = useTheme();
|
|
@@ -82,15 +83,16 @@ export const SearchBar = (props: any) => {
|
|
|
82
83
|
return (
|
|
83
84
|
<Pressable style={[styles.container, containerStyles, { height: height }]}>
|
|
84
85
|
<OInput
|
|
86
|
+
autoFocus={autoFocus}
|
|
85
87
|
value={searchValue}
|
|
86
88
|
onChange={onChangeSearch}
|
|
87
|
-
style={{...styles.inputStyle, ...inputContainerStyles}}
|
|
89
|
+
style={{ ...styles.inputStyle, ...inputContainerStyles }}
|
|
88
90
|
placeholder={placeholder}
|
|
89
91
|
icon={!hideIcon && theme.images.general.search}
|
|
90
92
|
isDisabled={isDisabled}
|
|
91
93
|
iconStyle={{ width: 12 }}
|
|
92
94
|
returnKeyType='done'
|
|
93
|
-
inputStyle={{padding: 0, paddingTop: Platform.OS == 'android' ? 2 : 0, ...inputStyle}}
|
|
95
|
+
inputStyle={{ padding: 0, paddingTop: Platform.OS == 'android' ? 2 : 0, ...inputStyle }}
|
|
94
96
|
onPress={() => onPress && onPress()}
|
|
95
97
|
iconCustomRight={iconCustomRight}
|
|
96
98
|
onSubmitEditing={() => onSubmitEditing && onSubmitEditing()}
|