ordering-ui-react-native 0.16.52 → 0.16.55
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/DriverSchedule/index.tsx +36 -19
- package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
- package/themes/original/index.tsx +0 -6
- package/themes/original/src/components/AddressForm/index.tsx +6 -5
- 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/BusinessController/index.tsx +116 -78
- package/themes/original/src/components/BusinessListingSearch/index.tsx +9 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +42 -13
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +26 -28
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +241 -95
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +35 -62
- package/themes/original/src/components/GoogleMap/index.tsx +10 -11
- package/themes/original/src/components/OrderDetails/index.tsx +32 -34
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +79 -99
- package/themes/original/src/components/ReviewOrder/styles.tsx +0 -9
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/{Reviews/ReviewOrder → ReviewTrigger}/styles.tsx +2 -21
- package/themes/original/src/components/SingleProductCard/index.tsx +122 -90
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/shared/OBottomPopup.tsx +5 -2
- package/themes/original/src/components/shared/OButton.tsx +2 -0
- package/themes/original/src/types/index.tsx +2 -5
- package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +0 -301
- package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +0 -39
- package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +0 -326
- package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +0 -101
- package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +0 -17
- package/themes/original/src/components/Reviews/index.tsx +0 -9
|
@@ -6,84 +6,68 @@ import { useTheme } from 'styled-components/native'
|
|
|
6
6
|
import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
|
|
7
7
|
import { BusinessesListing as AppointmentBusinessListing } from './Layout/Appointment'
|
|
8
8
|
import { OBottomPopup } from '../shared';
|
|
9
|
-
import {
|
|
9
|
+
import { ReviewTrigger } from '../ReviewTrigger';
|
|
10
10
|
|
|
11
11
|
export const BusinessesListing = (props: any) => {
|
|
12
12
|
const theme = useTheme()
|
|
13
|
+
const layout = theme?.layouts?.business_listing_view?.components?.layout?.type || 'original'
|
|
13
14
|
const [, t] = useLanguage();
|
|
14
|
-
const layout = theme?.layout?.businessListing?.layout?.type || 'original'
|
|
15
15
|
const [{ auth }] = useSession()
|
|
16
16
|
const [, { getLastOrderHasNoReview }] = useOrder();
|
|
17
17
|
|
|
18
|
+
const [, setIsReviewed] = useState()
|
|
19
|
+
const defaultOrder = {
|
|
20
|
+
id: 0,
|
|
21
|
+
business_id: 0,
|
|
22
|
+
business_name: '',
|
|
23
|
+
logo: '',
|
|
24
|
+
driver: {},
|
|
25
|
+
products: [],
|
|
26
|
+
review: {},
|
|
27
|
+
user_review: {},
|
|
28
|
+
delivery_datetime: ''
|
|
29
|
+
}
|
|
18
30
|
const [lastOrderReview, setLastOrderReview] = useState({
|
|
19
31
|
isReviewOpen: false,
|
|
20
|
-
order:
|
|
21
|
-
|
|
22
|
-
business_id: 0,
|
|
23
|
-
business_name: '',
|
|
24
|
-
delivery_datetime: '',
|
|
25
|
-
logo: '',
|
|
26
|
-
driver: null,
|
|
27
|
-
products: [],
|
|
28
|
-
review: null,
|
|
29
|
-
user_review: null
|
|
30
|
-
},
|
|
31
|
-
reviewStatus: { order: false, product: false, driver: false },
|
|
32
|
-
reviewed: { isOrderReviewed: false, isProductReviewed: false, isDriverReviewed: false }
|
|
32
|
+
order: defaultOrder,
|
|
33
|
+
defaultStar: 5,
|
|
33
34
|
})
|
|
34
35
|
|
|
35
36
|
const _getLastOrderHasNoReview = async () => {
|
|
36
37
|
const lastOrderHasNoReview = await getLastOrderHasNoReview()
|
|
37
|
-
lastOrderHasNoReview &&
|
|
38
|
+
lastOrderHasNoReview && OrderReviewRequired(lastOrderHasNoReview)
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
+
const OrderReviewRequired = (order: any) => {
|
|
41
42
|
setLastOrderReview({
|
|
42
43
|
isReviewOpen: true,
|
|
43
44
|
order: {
|
|
44
45
|
id: order?.id,
|
|
45
46
|
business_id: order?.business_id,
|
|
46
47
|
business_name: order?.business?.name,
|
|
47
|
-
delivery_datetime: order?.delivery_datetime,
|
|
48
48
|
logo: order.business?.logo,
|
|
49
49
|
driver: order?.driver,
|
|
50
50
|
products: order?.products,
|
|
51
51
|
review: order?.review,
|
|
52
|
-
user_review: order?.user_review
|
|
52
|
+
user_review: order?.user_review,
|
|
53
|
+
delivery_datetime: order?.delivery_datetime_utc
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
-
reviewed: { isOrderReviewed: false, isProductReviewed: false, isDriverReviewed: false }
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const handleCloseReivew = () => {
|
|
60
|
-
setLastOrderReview({
|
|
61
|
-
...lastOrderReview,
|
|
62
|
-
isReviewOpen: false,
|
|
63
|
-
reviewStatus: { order: false, product: false, driver: false }
|
|
55
|
+
defaultStar: 5
|
|
64
56
|
})
|
|
65
57
|
}
|
|
66
58
|
|
|
67
|
-
const
|
|
68
|
-
const _reviewStatus = { ...lastOrderReview?.reviewed }
|
|
59
|
+
const handleOpenOrderReview = (star: number) => {
|
|
69
60
|
setLastOrderReview({
|
|
70
|
-
...lastOrderReview,
|
|
71
|
-
reviewed: { ..._reviewStatus, [reviewType]: true }
|
|
61
|
+
...lastOrderReview, isReviewOpen: false, order: defaultOrder
|
|
72
62
|
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const closeReviewProduct = () => {
|
|
82
|
-
if (lastOrderReview?.order?.driver && !lastOrderReview?.order?.user_review && !lastOrderReview?.reviewed?.isDriverReviewed) setLastOrderReview({ ...lastOrderReview, reviewStatus: { order: false, product: false, driver: true } })
|
|
83
|
-
else {
|
|
84
|
-
setIsReviewed('isDriverReviewed')
|
|
85
|
-
handleCloseReivew()
|
|
86
|
-
}
|
|
63
|
+
props?.navigation && props.navigation.navigate(
|
|
64
|
+
'ReviewOrder',
|
|
65
|
+
{
|
|
66
|
+
order: lastOrderReview.order,
|
|
67
|
+
defaultStar: star || 5,
|
|
68
|
+
setIsReviewed
|
|
69
|
+
}
|
|
70
|
+
)
|
|
87
71
|
}
|
|
88
72
|
|
|
89
73
|
useEffect(() => {
|
|
@@ -98,25 +82,14 @@ export const BusinessesListing = (props: any) => {
|
|
|
98
82
|
{lastOrderReview?.isReviewOpen && (
|
|
99
83
|
<OBottomPopup
|
|
100
84
|
open={lastOrderReview?.isReviewOpen}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
? t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')
|
|
105
|
-
: (lastOrderReview?.reviewStatus?.product
|
|
106
|
-
? t('REVIEW_PRODUCT', 'Review Product')
|
|
107
|
-
: t('REVIEW_DRIVER', 'Review Driver')))
|
|
108
|
-
: t('LOADING', 'Loading...')}
|
|
85
|
+
transparent={true}
|
|
86
|
+
onClose={() => setLastOrderReview({ ...lastOrderReview, isReviewOpen: false, order: defaultOrder })}
|
|
87
|
+
title={t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')}
|
|
109
88
|
bottomContainerStyle={{ height: 'auto' }}
|
|
110
89
|
titleStyle={{ textAlign: 'center' }}
|
|
111
90
|
closeIcon={theme.images.general.close}
|
|
112
91
|
>
|
|
113
|
-
{
|
|
114
|
-
lastOrderReview?.reviewStatus?.order
|
|
115
|
-
? <ReviewOrderModal order={lastOrderReview?.order} closeReviewOrder={closeReviewOrder} skipReview={handleCloseReivew} setIsReviewed={() => setIsReviewed('isOrderReviewed')} />
|
|
116
|
-
: (lastOrderReview?.reviewStatus?.product
|
|
117
|
-
? <ReviewProductsModal order={lastOrderReview?.order} closeReviewProduct={closeReviewProduct} setIsProductReviewed={() => setIsReviewed('isProductReviewed')} />
|
|
118
|
-
: <ReviewDriverModal order={lastOrderReview?.order} closeReviewDriver={handleCloseReivew} setIsDriverReviewed={() => setIsReviewed('isDriverReviewed')} />)
|
|
119
|
-
}
|
|
92
|
+
{lastOrderReview?.order && <ReviewTrigger order={lastOrderReview?.order} handleOpenOrderReview={handleOpenOrderReview} />}
|
|
120
93
|
|
|
121
94
|
</OBottomPopup>
|
|
122
95
|
)}
|
|
@@ -32,6 +32,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
32
32
|
latitudeDelta: 0.0010,
|
|
33
33
|
longitudeDelta: 0.0010 * ASPECT_RATIO
|
|
34
34
|
})
|
|
35
|
+
const [MARKERS, SETMARKERS] = useState(locations)
|
|
35
36
|
let mapRef = useRef<any>(null)
|
|
36
37
|
const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
|
|
37
38
|
|
|
@@ -41,12 +42,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
41
42
|
ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
|
|
42
43
|
ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
latitude: location.lat,
|
|
47
|
-
longitude: location.lng
|
|
48
|
-
}
|
|
49
|
-
})
|
|
45
|
+
|
|
50
46
|
const geocodePosition = (pos: { latitude: number, longitude: number }) => {
|
|
51
47
|
Geocoder.from({
|
|
52
48
|
latitude: pos.latitude,
|
|
@@ -147,7 +143,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
147
143
|
}
|
|
148
144
|
|
|
149
145
|
const fitAllMarkers = () => {
|
|
150
|
-
mapRef.current.fitToCoordinates(MARKERS, {
|
|
146
|
+
mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
|
|
151
147
|
edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
|
|
152
148
|
animated: true,
|
|
153
149
|
});
|
|
@@ -170,6 +166,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
170
166
|
fitAllMarkers()
|
|
171
167
|
}
|
|
172
168
|
}, 1000)
|
|
169
|
+
if (locations) {
|
|
170
|
+
SETMARKERS(locations)
|
|
171
|
+
}
|
|
173
172
|
return () => clearInterval(interval)
|
|
174
173
|
}, [locations])
|
|
175
174
|
|
|
@@ -189,16 +188,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
189
188
|
>
|
|
190
189
|
{locations ? (
|
|
191
190
|
<>
|
|
192
|
-
{MARKERS && MARKERS.map((location: {
|
|
191
|
+
{MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
|
|
193
192
|
<React.Fragment key={i}>
|
|
194
193
|
{
|
|
195
194
|
<Marker
|
|
196
195
|
zIndex={i}
|
|
197
|
-
coordinate={location}
|
|
198
|
-
title={
|
|
196
|
+
coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
|
|
197
|
+
title={MARKERS[i]?.title}
|
|
199
198
|
>
|
|
200
199
|
<View>
|
|
201
|
-
<OIcon url={
|
|
200
|
+
<OIcon url={MARKERS[i].icon} width={50} height={50} />
|
|
202
201
|
</View>
|
|
203
202
|
</Marker>
|
|
204
203
|
}
|
|
@@ -361,8 +361,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
361
361
|
id: order?.id,
|
|
362
362
|
business_id: order?.business_id,
|
|
363
363
|
logo: order.business?.logo,
|
|
364
|
-
business_name: order?.business?.name,
|
|
365
|
-
delivery_datetime: order?.delivery_datetime,
|
|
366
364
|
driver: order?.driver,
|
|
367
365
|
products: order?.products,
|
|
368
366
|
review: order?.review,
|
|
@@ -524,41 +522,41 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
524
522
|
<OrderData>
|
|
525
523
|
<View style={styles.linkWrapper}>
|
|
526
524
|
{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
>
|
|
537
|
-
<OText
|
|
538
|
-
size={10}
|
|
539
|
-
lineHeight={15}
|
|
540
|
-
color={theme.colors.primary}
|
|
541
|
-
style={{ textDecorationLine: 'underline' }}
|
|
525
|
+
(
|
|
526
|
+
parseInt(order?.status) === 1 ||
|
|
527
|
+
parseInt(order?.status) === 11 ||
|
|
528
|
+
parseInt(order?.status) === 15
|
|
529
|
+
) && !order.review && !isReviewed && (
|
|
530
|
+
<TouchableOpacity
|
|
531
|
+
activeOpacity={0.7}
|
|
532
|
+
style={{ marginTop: 6, marginRight: 10 }}
|
|
533
|
+
onPress={() => handleClickOrderReview(order)}
|
|
542
534
|
>
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
535
|
+
<OText
|
|
536
|
+
size={10}
|
|
537
|
+
lineHeight={15}
|
|
538
|
+
color={theme.colors.primary}
|
|
539
|
+
style={{ textDecorationLine: 'underline' }}
|
|
540
|
+
>
|
|
541
|
+
{t('REVIEW_YOUR_ORDER', 'Review your order')}
|
|
542
|
+
</OText>
|
|
543
|
+
</TouchableOpacity>
|
|
544
|
+
)}
|
|
545
|
+
<TouchableOpacity
|
|
546
|
+
activeOpacity={0.7}
|
|
547
|
+
style={{ marginTop: 6 }}
|
|
548
|
+
onPress={() => setIsOrderHistory(true)}
|
|
551
549
|
|
|
550
|
+
>
|
|
551
|
+
<OText
|
|
552
|
+
size={10}
|
|
553
|
+
lineHeight={15}
|
|
554
|
+
color={theme.colors.primary}
|
|
555
|
+
style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
|
|
552
556
|
>
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
color={theme.colors.primary}
|
|
557
|
-
style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
|
|
558
|
-
>
|
|
559
|
-
{t('VIEW_DETAILS', 'View Details')}
|
|
560
|
-
</OText>
|
|
561
|
-
</TouchableOpacity>
|
|
557
|
+
{t('VIEW_DETAILS', 'View Details')}
|
|
558
|
+
</OText>
|
|
559
|
+
</TouchableOpacity>
|
|
562
560
|
</View>
|
|
563
561
|
|
|
564
562
|
<StaturBar>
|
|
@@ -598,7 +598,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
598
598
|
horizontal
|
|
599
599
|
showsHorizontalScrollIndicator={false}
|
|
600
600
|
style={{ marginBottom: 20 }}
|
|
601
|
-
contentContainerStyle={{
|
|
601
|
+
contentContainerStyle={{ paddingHorizontal: 33, backgroundColor: theme.colors.white }}
|
|
602
602
|
>
|
|
603
603
|
<TouchableOpacity
|
|
604
604
|
key={`eopt_all_0`}
|
|
@@ -84,7 +84,7 @@ export const ProductActions = styled.View`
|
|
|
84
84
|
border-top-color: ${(props: any) => props.theme.colors.border};
|
|
85
85
|
`
|
|
86
86
|
export const ExtraOptionWrap = styled.ScrollView`
|
|
87
|
-
margin-horizontal:
|
|
87
|
+
margin-horizontal: 30px;
|
|
88
88
|
`;
|
|
89
89
|
|
|
90
90
|
export const WeightUnitSwitch = styled.View`
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType, useUtils } from 'ordering-components/native'
|
|
2
|
+
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType } from 'ordering-components/native'
|
|
4
3
|
import { useForm, Controller } from 'react-hook-form'
|
|
5
4
|
import LinearGradient from 'react-native-linear-gradient'
|
|
6
5
|
|
|
@@ -12,9 +11,7 @@ import {
|
|
|
12
11
|
ActionContainer,
|
|
13
12
|
SkipButton,
|
|
14
13
|
RatingBarContainer,
|
|
15
|
-
RatingTextContainer
|
|
16
|
-
RatingStarContainer,
|
|
17
|
-
PlacedDate
|
|
14
|
+
RatingTextContainer
|
|
18
15
|
} from './styles'
|
|
19
16
|
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
20
17
|
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
@@ -91,11 +88,10 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
91
88
|
const [, t] = useLanguage()
|
|
92
89
|
const [, { showToast }] = useToast()
|
|
93
90
|
const { handleSubmit, control, errors } = useForm()
|
|
94
|
-
|
|
91
|
+
|
|
95
92
|
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
96
93
|
const [comments, setComments] = useState<Array<any>>([])
|
|
97
94
|
const [extraComment, setExtraComment] = useState('')
|
|
98
|
-
const placedOnDate = parseDate(order?.delivery_datetime, { outputFormat: 'dddd MMMM DD, YYYY' })
|
|
99
95
|
|
|
100
96
|
const onSubmit = () => {
|
|
101
97
|
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
@@ -195,15 +191,14 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
195
191
|
<>
|
|
196
192
|
<ReviewOrderContainer>
|
|
197
193
|
<NavBar
|
|
198
|
-
title={t('
|
|
194
|
+
title={t('REVIEW_ORDER', 'Review your Order')}
|
|
199
195
|
titleAlign={'center'}
|
|
200
|
-
leftImg={theme.images.general.close}
|
|
201
196
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
202
197
|
showCall={false}
|
|
203
198
|
btnStyle={{ paddingLeft: 0 }}
|
|
204
|
-
style={{ flexDirection: 'column', alignItems: 'flex-start'
|
|
205
|
-
titleWrapStyle={{ paddingHorizontal: 0
|
|
206
|
-
titleStyle={{
|
|
199
|
+
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
200
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
201
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
207
202
|
/>
|
|
208
203
|
<BusinessLogo>
|
|
209
204
|
<View style={styles.logoWrapper}>
|
|
@@ -214,7 +209,6 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
214
209
|
/>
|
|
215
210
|
</View>
|
|
216
211
|
</BusinessLogo>
|
|
217
|
-
{!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
|
|
218
212
|
{order?.review ? (
|
|
219
213
|
<View style={styles.reviewedStyle}>
|
|
220
214
|
<OText color={theme.colors.primary}>{t('ORDER_REVIEWED', 'This order has been already reviewed')}</OText>
|
|
@@ -222,92 +216,78 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
222
216
|
) : (
|
|
223
217
|
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
|
|
224
218
|
<FormReviews>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
219
|
+
<OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</OText>
|
|
220
|
+
<RatingBarContainer>
|
|
221
|
+
<LinearGradient
|
|
222
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
223
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
|
|
224
|
+
locations={[.9999, .9999]}
|
|
225
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray200]}
|
|
226
|
+
style={styles.statusBar}
|
|
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)}
|
|
240
237
|
>
|
|
241
|
-
<
|
|
242
|
-
style={
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
|
288
|
+
/>
|
|
260
289
|
)}
|
|
261
|
-
|
|
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
|
-
)}
|
|
290
|
+
/>
|
|
311
291
|
</FormReviews>
|
|
312
292
|
</View>
|
|
313
293
|
)}
|
|
@@ -322,7 +302,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
322
302
|
</SkipButton>
|
|
323
303
|
<OButton
|
|
324
304
|
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
325
|
-
text={t('
|
|
305
|
+
text={t('CONTINUE', 'Continue')}
|
|
326
306
|
style={{ borderRadius: 8 }}
|
|
327
307
|
imgRightSrc={theme.images.general.arrow_right}
|
|
328
308
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
@@ -338,7 +318,7 @@ export const ReviewOrder = (props: ReviewOrderParams) => {
|
|
|
338
318
|
const reviewOrderProps = {
|
|
339
319
|
...props,
|
|
340
320
|
UIComponent: ReviewOrderUI,
|
|
341
|
-
defaultStar: 5
|
|
321
|
+
defaultStar: props?.defaultStar || 5
|
|
342
322
|
}
|
|
343
323
|
return <ReviewOrderController {...reviewOrderProps} />
|
|
344
324
|
}
|
|
@@ -42,12 +42,3 @@ 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
|
-
`
|