ordering-ui-react-native 0.12.57 → 0.12.58
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/single-business/src/components/Cart/index.tsx +91 -15
- package/themes/single-business/src/components/Cart/styles.tsx +39 -0
- package/themes/single-business/src/components/CartContent/index.tsx +56 -52
- package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
- package/themes/franchises/index.tsx +0 -111
- package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
- package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
- package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
- package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
- package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
- package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
- package/themes/franchises/src/components/AddressList/index.tsx +0 -338
- package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
- package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
- package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
- package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
- package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
- package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
- package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
- package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
- package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
- package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
- package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
- package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
- package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
- package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
- package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
- package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
- package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
- package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
- package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
- package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
- package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
- package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
- package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
- package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
- package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
- package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
- package/themes/franchises/src/components/Cart/index.tsx +0 -332
- package/themes/franchises/src/components/Cart/styles.tsx +0 -28
- package/themes/franchises/src/components/CartContent/index.tsx +0 -60
- package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
- package/themes/franchises/src/components/Checkout/index.tsx +0 -664
- package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
- package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
- package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
- package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
- package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
- package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
- package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
- package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
- package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
- package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
- package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
- package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
- package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
- package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
- package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
- package/themes/franchises/src/components/Help/index.tsx +0 -56
- package/themes/franchises/src/components/Help/styles.tsx +0 -11
- package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
- package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
- package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
- package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
- package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
- package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
- package/themes/franchises/src/components/Home/index.tsx +0 -102
- package/themes/franchises/src/components/Home/styles.tsx +0 -18
- package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
- package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
- package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
- package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
- package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
- package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
- package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
- package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
- package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
- package/themes/franchises/src/components/Messages/index.tsx +0 -359
- package/themes/franchises/src/components/Messages/styles.tsx +0 -20
- package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
- package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
- package/themes/franchises/src/components/NavBar/index.tsx +0 -129
- package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
- package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
- package/themes/franchises/src/components/Notifications/index.tsx +0 -120
- package/themes/franchises/src/components/Notifications/styles.ts +0 -21
- package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
- package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
- package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
- package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
- package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
- package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
- package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
- package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
- package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
- package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
- package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
- package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
- package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
- package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
- package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
- package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
- package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
- package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
- package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
- package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
- package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
- package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
- package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
- package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
- package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
- package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
- package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
- package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
- package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
- package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
- package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
- package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
- package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
- package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
- package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
- package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
- package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
- package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
- package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
- package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
- package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
- package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
- package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
- package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
- package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
- package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
- package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
- package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
- package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
- package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
- package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
- package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
- package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
- package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
- package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
- package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
- package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
- package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
- package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
- package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
- package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
- package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
- package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
- package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
- package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
- package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
- package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
- package/themes/franchises/src/components/shared/OButton.tsx +0 -132
- package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
- package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
- package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
- package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
- package/themes/franchises/src/components/shared/OInput.tsx +0 -113
- package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
- package/themes/franchises/src/components/shared/OModal.tsx +0 -172
- package/themes/franchises/src/components/shared/OText.tsx +0 -52
- package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
- package/themes/franchises/src/components/shared/OToast.tsx +0 -93
- package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
- package/themes/franchises/src/components/shared/index.tsx +0 -29
- package/themes/franchises/src/config/constants.tsx +0 -57
- package/themes/franchises/src/layouts/Container.tsx +0 -23
- package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
- package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
- package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
- package/themes/franchises/src/types/index.tsx +0 -445
- package/themes/franchises/src/utils/index.tsx +0 -222
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import { ReviewProduct as ReviewProductController, useLanguage, ToastType, useToast } from 'ordering-components/native'
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import { useForm, Controller } from 'react-hook-form'
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
ReviewOrderContainer,
|
|
8
|
-
BusinessLogo,
|
|
9
|
-
FormReviews,
|
|
10
|
-
Category,
|
|
11
|
-
Stars,
|
|
12
|
-
BlockWrap,
|
|
13
|
-
CommentItem,
|
|
14
|
-
IconBtn,
|
|
15
|
-
HWrapper
|
|
16
|
-
} from './styles'
|
|
17
|
-
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
18
|
-
import { TouchableOpacity, StyleSheet, View } from 'react-native';
|
|
19
|
-
import NavBar from '../NavBar'
|
|
20
|
-
import Spinner from 'react-native-loading-spinner-overlay'
|
|
21
|
-
|
|
22
|
-
import { ReviewProductParams } from '../../types'
|
|
23
|
-
import { REVIEW_PRODUCT_COMMENTS } from '../../config/constants';
|
|
24
|
-
import TagSelector from '../TagSelector';
|
|
25
|
-
import OBottomStickBar from '../shared/OBottomStickBar';
|
|
26
|
-
import { Container } from '../../..';
|
|
27
|
-
|
|
28
|
-
const SingleProduct = (props: any) => {
|
|
29
|
-
const {
|
|
30
|
-
handleChangeFormState,
|
|
31
|
-
formState,
|
|
32
|
-
product
|
|
33
|
-
} = props;
|
|
34
|
-
const {id, name} = product;
|
|
35
|
-
|
|
36
|
-
const theme = useTheme();
|
|
37
|
-
const [, t] = useLanguage();
|
|
38
|
-
const { control, errors } = useForm()
|
|
39
|
-
|
|
40
|
-
const [suggests] = useState(REVIEW_PRODUCT_COMMENTS.map(({key, value}) => t(key, value)));
|
|
41
|
-
const [comments, setComments] = useState([])
|
|
42
|
-
const [extraComment, setExtraComment] = useState('')
|
|
43
|
-
const [isExtra, setShowExtra] = useState(false);
|
|
44
|
-
const [isLike, setLike] = useState(0);
|
|
45
|
-
|
|
46
|
-
const singleStyle = StyleSheet.create({
|
|
47
|
-
hWrapper: {
|
|
48
|
-
flexDirection: 'row',
|
|
49
|
-
alignItems: 'center'
|
|
50
|
-
},
|
|
51
|
-
inputTextArea: {
|
|
52
|
-
borderColor: theme.colors.border,
|
|
53
|
-
borderRadius: 7.6,
|
|
54
|
-
marginVertical: 10,
|
|
55
|
-
height: 100,
|
|
56
|
-
alignItems: 'flex-start',
|
|
57
|
-
paddingVertical: 12,
|
|
58
|
-
fontSize: 10,
|
|
59
|
-
marginBottom: 30
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const onSuggestUpdate = useCallback((items) => {
|
|
64
|
-
if (items.length > 0) {
|
|
65
|
-
let selected: Array<never> = [];
|
|
66
|
-
items.map(({label, checked}: never) => {
|
|
67
|
-
if (checked === true) {
|
|
68
|
-
selected.push(label);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
setComments(selected);
|
|
72
|
-
}
|
|
73
|
-
}, []);
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (comments?.length === 0 && !extraComment && formState.changes?.length === 0 && isLike) return
|
|
77
|
-
let _comments = ''
|
|
78
|
-
if (comments.length > 0) {
|
|
79
|
-
comments.map(comment => (_comments += comment + '. '))
|
|
80
|
-
}
|
|
81
|
-
const _comment = _comments + extraComment
|
|
82
|
-
let found = false
|
|
83
|
-
const _changes = formState.changes.map((item: any) => {
|
|
84
|
-
if (item?.id === product?.id) {
|
|
85
|
-
found = true
|
|
86
|
-
return {
|
|
87
|
-
id: product?.id,
|
|
88
|
-
comment: _comment,
|
|
89
|
-
qualification: isLike ? 5 : 1
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return item
|
|
93
|
-
})
|
|
94
|
-
if (!found) {
|
|
95
|
-
_changes.push({
|
|
96
|
-
product_id: product?.id,
|
|
97
|
-
comment: _comment,
|
|
98
|
-
qualification: isLike ? 5 : 1
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
handleChangeFormState && handleChangeFormState(_changes)
|
|
102
|
-
}, [comments, extraComment, isLike])
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<BlockWrap key={id}>
|
|
107
|
-
<HWrapper style={{justifyContent: 'space-between', marginBottom: 14}}>
|
|
108
|
-
<OText size={12} lineHeight={18}>{name}</OText>
|
|
109
|
-
<HWrapper>
|
|
110
|
-
<IconBtn onPress={() => setLike(5)}>
|
|
111
|
-
<OIcon src={theme.images.general.thumbs_up} width={16} color={isLike == 5 ? theme.colors.primary : theme.colors.textSecondary} />
|
|
112
|
-
</IconBtn>
|
|
113
|
-
<IconBtn onPress={() => setLike(1)}>
|
|
114
|
-
<OIcon src={theme.images.general.thumbs_up} width={16} color={isLike == 1 ? theme.colors.primary : theme.colors.textSecondary} style={{transform: [{rotate: '180deg'}]}} />
|
|
115
|
-
</IconBtn>
|
|
116
|
-
</HWrapper>
|
|
117
|
-
</HWrapper>
|
|
118
|
-
<View style={{flexShrink: 1}}>
|
|
119
|
-
<TagSelector
|
|
120
|
-
items={suggests}
|
|
121
|
-
activeColor={theme.colors.primary} normalColor={'#E9ECEF'}
|
|
122
|
-
onUpdated={onSuggestUpdate}
|
|
123
|
-
/>
|
|
124
|
-
</View>
|
|
125
|
-
<TouchableOpacity onPress={() => setShowExtra(!isExtra)} style={{marginBottom: 16}}>
|
|
126
|
-
<OText size={10} lineHeight={15}
|
|
127
|
-
style={{textDecorationLine: 'underline', alignSelf: 'center'}}
|
|
128
|
-
color={isExtra ? theme.colors.primary : theme.colors.textSecondary}
|
|
129
|
-
>
|
|
130
|
-
{t('ADDITIONAL_COMMENTS', 'Additional comments')}
|
|
131
|
-
</OText>
|
|
132
|
-
</TouchableOpacity>
|
|
133
|
-
{isExtra &&
|
|
134
|
-
<FormReviews>
|
|
135
|
-
<OText size={12} lineHeight={18}>{t('DO_YOU_WANT_TO_ADD_SOMETHING', 'Do you want to add something?')}</OText>
|
|
136
|
-
<Controller
|
|
137
|
-
control={control}
|
|
138
|
-
defaultValue=''
|
|
139
|
-
name='comments'
|
|
140
|
-
render={({ onChange }: any) => (
|
|
141
|
-
<OInput
|
|
142
|
-
name='comments'
|
|
143
|
-
placeholder={t('COMMENTS', 'Comments')}
|
|
144
|
-
onChange={(val: string) => {
|
|
145
|
-
onChange(val)
|
|
146
|
-
setExtraComment(val)
|
|
147
|
-
}}
|
|
148
|
-
style={singleStyle.inputTextArea}
|
|
149
|
-
multiline
|
|
150
|
-
inputStyle={{fontSize: 12}}
|
|
151
|
-
/>
|
|
152
|
-
)}
|
|
153
|
-
/>
|
|
154
|
-
</FormReviews>
|
|
155
|
-
}
|
|
156
|
-
</BlockWrap>
|
|
157
|
-
)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export const ReviewProductUI = (props: ReviewProductParams) => {
|
|
161
|
-
const {
|
|
162
|
-
order,
|
|
163
|
-
products,
|
|
164
|
-
formState,
|
|
165
|
-
closeReviewProduct,
|
|
166
|
-
handleSendProductReview,
|
|
167
|
-
setIsProductReviewed,
|
|
168
|
-
handleChangeFormState,
|
|
169
|
-
navigation
|
|
170
|
-
} = props
|
|
171
|
-
|
|
172
|
-
const sorted = products?.map((p: any) => {
|
|
173
|
-
return {
|
|
174
|
-
...p,
|
|
175
|
-
like: 0,
|
|
176
|
-
showExtra: false,
|
|
177
|
-
comments: ''
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
const theme = useTheme();
|
|
182
|
-
|
|
183
|
-
const [, t] = useLanguage()
|
|
184
|
-
const [, { showToast }] = useToast()
|
|
185
|
-
const { handleSubmit, control, errors } = useForm()
|
|
186
|
-
|
|
187
|
-
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
188
|
-
|
|
189
|
-
const [curVal, setReviewVal] = useState(-1);
|
|
190
|
-
|
|
191
|
-
const [allProducts, setAllProducts] = useState(sorted);
|
|
192
|
-
|
|
193
|
-
const onSubmit = () => {
|
|
194
|
-
// if (Object.values(stars).some(value => value === 0)) {
|
|
195
|
-
// setAlertState({
|
|
196
|
-
// open: true,
|
|
197
|
-
// content: Object.values(categories).map((category, i) => stars[category.name] === 0 ? `- ${t('CATEGORY_ATLEAST_ONE', `${category.show} must be at least one point`).replace('CATEGORY', category.name.toUpperCase())} ${i !== 3 && '\n'}` : ' ')
|
|
198
|
-
// })
|
|
199
|
-
// return
|
|
200
|
-
// }
|
|
201
|
-
handleSendProductReview()
|
|
202
|
-
setAlertState({ ...alertState, success: true })
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
useEffect(() => {
|
|
206
|
-
if (formState.error && !formState?.loading) {
|
|
207
|
-
showToast(ToastType.Error, formState.result)
|
|
208
|
-
}
|
|
209
|
-
if (!formState.loading && !formState.error && alertState.success) {
|
|
210
|
-
showToast(ToastType.Success, t('REVIEW_SUCCESS_CONTENT', 'Thank you, Review successfully submitted!'))
|
|
211
|
-
navigation?.navigate('ReviewDriver', { order: order });
|
|
212
|
-
}
|
|
213
|
-
}, [formState.result])
|
|
214
|
-
|
|
215
|
-
useEffect(() => {
|
|
216
|
-
if (Object.keys(errors).length > 0) {
|
|
217
|
-
// Convert all errors in one string to show in toast provider
|
|
218
|
-
const list = Object.values(errors);
|
|
219
|
-
let stringError = '';
|
|
220
|
-
list.map((item: any, i: number) => {
|
|
221
|
-
stringError +=
|
|
222
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
223
|
-
});
|
|
224
|
-
showToast(ToastType.Error, stringError);
|
|
225
|
-
}
|
|
226
|
-
}, [errors]);
|
|
227
|
-
|
|
228
|
-
useEffect(() => {
|
|
229
|
-
if (alertState.open) {
|
|
230
|
-
alertState.content && showToast(
|
|
231
|
-
ToastType.Error,
|
|
232
|
-
alertState.content
|
|
233
|
-
)
|
|
234
|
-
}
|
|
235
|
-
}, [alertState.content])
|
|
236
|
-
|
|
237
|
-
return (
|
|
238
|
-
<>
|
|
239
|
-
<Container>
|
|
240
|
-
<ReviewOrderContainer>
|
|
241
|
-
<NavBar
|
|
242
|
-
title={t('REVIEW_PRODUCT', 'Review product')}
|
|
243
|
-
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
244
|
-
showCall={false}
|
|
245
|
-
btnStyle={{ paddingLeft: 0 }}
|
|
246
|
-
paddingTop={0}
|
|
247
|
-
isVertical
|
|
248
|
-
leftImg={theme.images.general.close}
|
|
249
|
-
leftImageStyle={{width: 16}}
|
|
250
|
-
/>
|
|
251
|
-
<View style={{ paddingBottom: 30 }}>
|
|
252
|
-
{allProducts && allProducts.map((p: any) =>
|
|
253
|
-
<SingleProduct key={p.id} {...props} product={p} />
|
|
254
|
-
)}
|
|
255
|
-
</View>
|
|
256
|
-
<Spinner visible={formState.loading} />
|
|
257
|
-
</ReviewOrderContainer>
|
|
258
|
-
</Container>
|
|
259
|
-
<OBottomStickBar
|
|
260
|
-
rightBtnStyle={{borderRadius: 7.6, height: 44}}
|
|
261
|
-
rightAction={handleSubmit(onSubmit)}
|
|
262
|
-
leftAction={() => navigation?.navigate('ReviewDriver', { order: order })}
|
|
263
|
-
/>
|
|
264
|
-
</>
|
|
265
|
-
)
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
export const ReviewProduct = (props: ReviewProductParams) => {
|
|
270
|
-
const reviewProductProps = {
|
|
271
|
-
...props,
|
|
272
|
-
UIComponent: ReviewProductUI
|
|
273
|
-
}
|
|
274
|
-
return <ReviewProductController {...reviewProductProps} />
|
|
275
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
2
|
-
|
|
3
|
-
export const ReviewOrderContainer = styled.View`
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1;
|
|
6
|
-
`
|
|
7
|
-
export const ReviewOrderTitle = styled.View`
|
|
8
|
-
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
export const BusinessLogo = styled.View`
|
|
12
|
-
margin-vertical: 5px;
|
|
13
|
-
align-items: center;
|
|
14
|
-
box-shadow: 0 1px 2px #ddd;
|
|
15
|
-
border-radius: 7.6px;
|
|
16
|
-
margin-bottom: 20px;
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
export const FormReviews = styled.View`
|
|
20
|
-
flex: 1;
|
|
21
|
-
`
|
|
22
|
-
|
|
23
|
-
export const Category = styled.View`
|
|
24
|
-
padding: 10px;
|
|
25
|
-
border-width: 1px;
|
|
26
|
-
border-color: ${(props: any) => props.theme.colors.secundaryContrast};
|
|
27
|
-
flex-direction: row;
|
|
28
|
-
justify-content: space-between;
|
|
29
|
-
margin-vertical: 5px;
|
|
30
|
-
border-radius: 10px;
|
|
31
|
-
`
|
|
32
|
-
|
|
33
|
-
export const Stars = styled.View`
|
|
34
|
-
flex-direction: row;
|
|
35
|
-
`
|
|
36
|
-
export const HWrapper = styled.View`
|
|
37
|
-
flex-direction: row;
|
|
38
|
-
align-items: center;
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
export const BlockWrap = styled.View`
|
|
42
|
-
margin-vertical: 16px;
|
|
43
|
-
padding-bottom: 20px;
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
export const CommentItem = styled.TouchableOpacity`
|
|
47
|
-
padding: 3px 10px;
|
|
48
|
-
border-radius: 20px;
|
|
49
|
-
min-height: 24px;
|
|
50
|
-
`;
|
|
51
|
-
export const IconBtn = styled.TouchableOpacity`
|
|
52
|
-
padding-horizontal: 7px;
|
|
53
|
-
`;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { StyleSheet, View, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { OInput, OButton } from '../shared'
|
|
4
|
-
import { useLanguage } from 'ordering-components/native'
|
|
5
|
-
import { useTheme } from 'styled-components/native';
|
|
6
|
-
import Icon from 'react-native-vector-icons/Feather'
|
|
7
|
-
import { useEffect } from 'hoist-non-react-statics/node_modules/@types/react';
|
|
8
|
-
|
|
9
|
-
export const SearchBar = (props: any) => {
|
|
10
|
-
const {
|
|
11
|
-
placeholder,
|
|
12
|
-
onSearch,
|
|
13
|
-
onCancel,
|
|
14
|
-
onHandleFilter,
|
|
15
|
-
lazyLoad,
|
|
16
|
-
isCancelButtonShow,
|
|
17
|
-
isCancelXButtonShow,
|
|
18
|
-
noBorderShow,
|
|
19
|
-
borderStyle,
|
|
20
|
-
height,
|
|
21
|
-
inputStyle,
|
|
22
|
-
inputWrapStyle,
|
|
23
|
-
showFilter
|
|
24
|
-
} = props
|
|
25
|
-
|
|
26
|
-
const theme = useTheme();
|
|
27
|
-
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
container: {
|
|
30
|
-
flex: 1,
|
|
31
|
-
flexDirection: 'row',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
justifyContent: 'space-between',
|
|
34
|
-
padding: 1,
|
|
35
|
-
maxHeight: 47,
|
|
36
|
-
height: 47,
|
|
37
|
-
borderBottomColor: theme.colors.border,
|
|
38
|
-
borderBottomWidth: 1,
|
|
39
|
-
},
|
|
40
|
-
borderStyle: {
|
|
41
|
-
borderColor: theme.colors.primary,
|
|
42
|
-
borderWidth: 1,
|
|
43
|
-
borderRadius: 7.6,
|
|
44
|
-
},
|
|
45
|
-
inputStyle: {
|
|
46
|
-
backgroundColor: theme.colors.clear,
|
|
47
|
-
minHeight: 44,
|
|
48
|
-
paddingTop: 0,
|
|
49
|
-
borderRadius: 0,
|
|
50
|
-
},
|
|
51
|
-
buttonStyle: {
|
|
52
|
-
maxHeight: 40,
|
|
53
|
-
paddingRight: 5,
|
|
54
|
-
backgroundColor: 'red'
|
|
55
|
-
},
|
|
56
|
-
actionWrap: {
|
|
57
|
-
flexDirection: 'row',
|
|
58
|
-
position: 'absolute',
|
|
59
|
-
end: -14
|
|
60
|
-
},
|
|
61
|
-
iconBtn: {
|
|
62
|
-
minWidth: 30,
|
|
63
|
-
minHeight: 26
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const [, t] = useLanguage()
|
|
69
|
-
const [searchValue, setSearchValue] = useState('');
|
|
70
|
-
|
|
71
|
-
const handleClear = () => {
|
|
72
|
-
onSearch('')
|
|
73
|
-
setSearchValue('')
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
let timeout: null | any = null
|
|
77
|
-
const onChangeSearch = (e: any) => {
|
|
78
|
-
setSearchValue(e)
|
|
79
|
-
if (!lazyLoad) {
|
|
80
|
-
onSearch(e)
|
|
81
|
-
} else {
|
|
82
|
-
clearTimeout(timeout)
|
|
83
|
-
timeout = setTimeout(function () {
|
|
84
|
-
onSearch(e)
|
|
85
|
-
}, 750)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<View style={{...styles.container, height: height }}>
|
|
91
|
-
<OInput
|
|
92
|
-
value={searchValue}
|
|
93
|
-
onChange={onChangeSearch}
|
|
94
|
-
style={{...styles.inputStyle, ...inputWrapStyle}}
|
|
95
|
-
placeholder={placeholder}
|
|
96
|
-
icon={theme.images.general.search}
|
|
97
|
-
iconStyle={{ width: 17 }}
|
|
98
|
-
returnKeyType='done'
|
|
99
|
-
inputStyle={inputStyle}
|
|
100
|
-
/>
|
|
101
|
-
{isCancelButtonShow && (
|
|
102
|
-
<OButton
|
|
103
|
-
imgRightSrc=''
|
|
104
|
-
text={t('CANCEL', 'Cancel')}
|
|
105
|
-
bgColor='transparent'
|
|
106
|
-
borderColor={theme.colors.lightGray}
|
|
107
|
-
style={styles.buttonStyle}
|
|
108
|
-
onClick={onCancel || handleClear}
|
|
109
|
-
/>
|
|
110
|
-
)}
|
|
111
|
-
<View style={styles.actionWrap}>
|
|
112
|
-
{isCancelXButtonShow && searchValue.length > 0 && (
|
|
113
|
-
<TouchableOpacity
|
|
114
|
-
onPress={onCancel || handleClear}
|
|
115
|
-
style={styles.iconBtn}
|
|
116
|
-
>
|
|
117
|
-
<Icon
|
|
118
|
-
name='x-circle'
|
|
119
|
-
color={theme.colors.disabled}
|
|
120
|
-
size={16}
|
|
121
|
-
/>
|
|
122
|
-
</TouchableOpacity>
|
|
123
|
-
)}
|
|
124
|
-
{showFilter && onHandleFilter && (
|
|
125
|
-
<TouchableOpacity
|
|
126
|
-
onPress={onHandleFilter}
|
|
127
|
-
style={styles.iconBtn}
|
|
128
|
-
>
|
|
129
|
-
<Icon
|
|
130
|
-
name='filter'
|
|
131
|
-
color={theme.colors.disabled}
|
|
132
|
-
size={16}
|
|
133
|
-
/>
|
|
134
|
-
</TouchableOpacity>
|
|
135
|
-
)}
|
|
136
|
-
</View>
|
|
137
|
-
</View>
|
|
138
|
-
)
|
|
139
|
-
}
|