ordering-ui-react-native 0.16.7 → 0.16.10
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/original/index.tsx +6 -0
- package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
- package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
- package/themes/original/src/components/BusinessController/index.tsx +29 -11
- package/themes/original/src/components/BusinessController/styles.tsx +5 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +7 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +3 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +25 -3
- package/themes/original/src/components/Favorite/index.tsx +91 -0
- package/themes/original/src/components/Favorite/styles.tsx +21 -0
- package/themes/original/src/components/FavoriteList/index.tsx +268 -0
- package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
- package/themes/original/src/components/LoginForm/index.tsx +6 -2
- package/themes/original/src/components/OrdersOption/index.tsx +5 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
- package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
- package/themes/original/src/components/SignupForm/index.tsx +6 -2
- package/themes/original/src/components/SingleOrderCard/index.tsx +280 -0
- package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +43 -11
- package/themes/original/src/components/UserProfile/index.tsx +4 -0
- package/themes/original/src/types/index.tsx +47 -6
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
4
|
+
import { FavoriteParams } from '../../types';
|
|
5
|
+
import { SingleOrderCard } from '../SingleOrderCard';
|
|
6
|
+
import {
|
|
7
|
+
FavoriteList as FavoriteListController,
|
|
8
|
+
useOrder,
|
|
9
|
+
useLanguage
|
|
10
|
+
} from 'ordering-components/native';
|
|
11
|
+
import { useTheme } from 'styled-components/native';
|
|
12
|
+
import { _setStoreData } from '../../providers/StoreUtil';
|
|
13
|
+
import { Container, WrappButton } from './styles'
|
|
14
|
+
import { OButton } from '../shared';
|
|
15
|
+
import { BusinessController } from '../BusinessController';
|
|
16
|
+
import { SingleProductCard } from '../SingleProductCard';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const FavoriteListUI = (props: FavoriteParams) => {
|
|
20
|
+
const {
|
|
21
|
+
favoriteList,
|
|
22
|
+
handleUpdateFavoriteList,
|
|
23
|
+
pagination,
|
|
24
|
+
getFavoriteList,
|
|
25
|
+
navigation,
|
|
26
|
+
onNavigationRedirect,
|
|
27
|
+
reorderState,
|
|
28
|
+
handleReorder,
|
|
29
|
+
isBusiness,
|
|
30
|
+
isOrder,
|
|
31
|
+
isProduct
|
|
32
|
+
} = props
|
|
33
|
+
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const [, t] = useLanguage()
|
|
36
|
+
const [orderState] = useOrder();
|
|
37
|
+
const [{ carts }] = useOrder()
|
|
38
|
+
|
|
39
|
+
const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
40
|
+
|
|
41
|
+
const getOrderStatus = (s: any) => {
|
|
42
|
+
const status = parseInt(s)
|
|
43
|
+
const orderStatus = [
|
|
44
|
+
{ key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending') },
|
|
45
|
+
{ key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed') },
|
|
46
|
+
{ key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected') },
|
|
47
|
+
{ key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business') },
|
|
48
|
+
{ key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed') },
|
|
49
|
+
{ key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business') },
|
|
50
|
+
{ key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver') },
|
|
51
|
+
{ key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business') },
|
|
52
|
+
{ key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver') },
|
|
53
|
+
{ key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver') },
|
|
54
|
+
{ key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver') },
|
|
55
|
+
{ key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver') },
|
|
56
|
+
{ key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver') },
|
|
57
|
+
{ key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder') },
|
|
58
|
+
{ key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready') },
|
|
59
|
+
{ key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer') },
|
|
60
|
+
{ key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer') },
|
|
61
|
+
{ key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer') },
|
|
62
|
+
{ key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business') },
|
|
63
|
+
{ key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer') },
|
|
64
|
+
{ key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business') },
|
|
65
|
+
{ key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business') },
|
|
66
|
+
{ key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver') },
|
|
67
|
+
{ key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way') }
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
const objectStatus = orderStatus.find((o) => o.key === status)
|
|
71
|
+
|
|
72
|
+
return objectStatus && objectStatus
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
77
|
+
if (reorderState?.error) {
|
|
78
|
+
if (reorderState?.result?.business_id) {
|
|
79
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
80
|
+
onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
|
|
84
|
+
const cartProducts = carts?.[_businessId]?.products
|
|
85
|
+
const available = cartProducts.every((product: any) => product.valid === true)
|
|
86
|
+
const orderProducts = favoriteList?.favorites.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
|
|
87
|
+
|
|
88
|
+
if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
|
|
89
|
+
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
90
|
+
} else {
|
|
91
|
+
_setStoreData('adjust-cart-products', JSON.stringify(_businessId))
|
|
92
|
+
cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
|
|
93
|
+
onNavigationRedirect && onNavigationRedirect('Business', { store: reorderState?.result?.business?.slug })
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [reorderState])
|
|
97
|
+
|
|
98
|
+
const handleBusinessClick = (business: any) => {
|
|
99
|
+
onNavigationRedirect && onNavigationRedirect('Business', {
|
|
100
|
+
store: business.slug,
|
|
101
|
+
header: business.header,
|
|
102
|
+
logo: business.logo,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Container>
|
|
108
|
+
{isBusiness && (
|
|
109
|
+
<>
|
|
110
|
+
{favoriteList?.loading && (
|
|
111
|
+
[...Array(5).keys()].map(i => (
|
|
112
|
+
<Placeholder
|
|
113
|
+
Animation={Fade}
|
|
114
|
+
key={i}
|
|
115
|
+
style={{ marginBottom: 20 }}>
|
|
116
|
+
<View style={{ width: '100%' }}>
|
|
117
|
+
<PlaceholderLine
|
|
118
|
+
height={200}
|
|
119
|
+
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
120
|
+
/>
|
|
121
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
122
|
+
<View
|
|
123
|
+
style={{
|
|
124
|
+
flexDirection: 'row',
|
|
125
|
+
justifyContent: 'space-between',
|
|
126
|
+
}}>
|
|
127
|
+
<PlaceholderLine
|
|
128
|
+
height={25}
|
|
129
|
+
width={40}
|
|
130
|
+
style={{ marginBottom: 10 }}
|
|
131
|
+
/>
|
|
132
|
+
<PlaceholderLine
|
|
133
|
+
height={25}
|
|
134
|
+
width={20}
|
|
135
|
+
style={{ marginBottom: 10 }}
|
|
136
|
+
/>
|
|
137
|
+
</View>
|
|
138
|
+
<PlaceholderLine
|
|
139
|
+
height={20}
|
|
140
|
+
width={30}
|
|
141
|
+
style={{ marginBottom: 10 }}
|
|
142
|
+
/>
|
|
143
|
+
<PlaceholderLine
|
|
144
|
+
height={20}
|
|
145
|
+
width={80}
|
|
146
|
+
style={{ marginBottom: 10 }}
|
|
147
|
+
/>
|
|
148
|
+
</View>
|
|
149
|
+
</View>
|
|
150
|
+
</Placeholder>
|
|
151
|
+
))
|
|
152
|
+
)}
|
|
153
|
+
{!favoriteList?.loading && favoriteList?.favorites?.length > 0 && (
|
|
154
|
+
favoriteList.favorites.map((business: any, i:number) => (
|
|
155
|
+
<BusinessController
|
|
156
|
+
key={`${business.id}_` + i}
|
|
157
|
+
business={business}
|
|
158
|
+
isBusinessOpen={business.open}
|
|
159
|
+
handleCustomClick={handleBusinessClick}
|
|
160
|
+
orderType={orderState?.options?.type}
|
|
161
|
+
navigation={navigation}
|
|
162
|
+
businessHeader={business?.header}
|
|
163
|
+
businessFeatured={business?.featured}
|
|
164
|
+
businessLogo={business?.logo}
|
|
165
|
+
businessReviews={business?.reviews}
|
|
166
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
167
|
+
businessDeliveryTime={business?.delivery_time}
|
|
168
|
+
businessPickupTime={business?.pickup_time}
|
|
169
|
+
businessDistance={business?.distance}
|
|
170
|
+
handleUpdateBusinessList={handleUpdateFavoriteList}
|
|
171
|
+
/>
|
|
172
|
+
))
|
|
173
|
+
)}
|
|
174
|
+
</>
|
|
175
|
+
)}
|
|
176
|
+
|
|
177
|
+
{isOrder && (
|
|
178
|
+
<>
|
|
179
|
+
{favoriteList?.loading && (
|
|
180
|
+
[...Array(5).keys()].map(i => (
|
|
181
|
+
<Placeholder key={i} style={{ padding: 5 }} Animation={Fade}>
|
|
182
|
+
<View style={{ flexDirection: 'row' }}>
|
|
183
|
+
<PlaceholderLine
|
|
184
|
+
width={24}
|
|
185
|
+
height={70}
|
|
186
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
187
|
+
/>
|
|
188
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
189
|
+
<PlaceholderLine width={60} style={{ marginBottom: 25 }} />
|
|
190
|
+
<PlaceholderLine width={20} />
|
|
191
|
+
</Placeholder>
|
|
192
|
+
</View>
|
|
193
|
+
</Placeholder>
|
|
194
|
+
))
|
|
195
|
+
)}
|
|
196
|
+
{!favoriteList?.loading && favoriteList?.favorites?.length > 0 && (
|
|
197
|
+
favoriteList.favorites.map((order: any) => (
|
|
198
|
+
<SingleOrderCard
|
|
199
|
+
key={order?.id}
|
|
200
|
+
order={order}
|
|
201
|
+
getOrderStatus={getOrderStatus}
|
|
202
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
203
|
+
pastOrders={pastOrders.includes(order?.status)}
|
|
204
|
+
handleUpdateOrderList={handleUpdateFavoriteList}
|
|
205
|
+
handleUpdateFavoriteList={handleUpdateFavoriteList}
|
|
206
|
+
handleReorder={handleReorder}
|
|
207
|
+
reorderLoading={reorderState?.loading}
|
|
208
|
+
/>
|
|
209
|
+
))
|
|
210
|
+
)}
|
|
211
|
+
</>
|
|
212
|
+
)}
|
|
213
|
+
|
|
214
|
+
{isProduct && (
|
|
215
|
+
<>
|
|
216
|
+
{favoriteList?.loading && (
|
|
217
|
+
[...Array(5).keys()].map(i => (
|
|
218
|
+
<Placeholder key={i} style={{ padding: 5 }} Animation={Fade}>
|
|
219
|
+
<View style={{ flexDirection: 'row' }}>
|
|
220
|
+
<PlaceholderLine
|
|
221
|
+
width={24}
|
|
222
|
+
height={70}
|
|
223
|
+
style={{ marginRight: 10, marginBottom: 10 }}
|
|
224
|
+
/>
|
|
225
|
+
<Placeholder style={{ paddingVertical: 10 }}>
|
|
226
|
+
<PlaceholderLine width={60} style={{ marginBottom: 25 }} />
|
|
227
|
+
<PlaceholderLine width={20} />
|
|
228
|
+
</Placeholder>
|
|
229
|
+
</View>
|
|
230
|
+
</Placeholder>
|
|
231
|
+
))
|
|
232
|
+
)}
|
|
233
|
+
{!favoriteList?.loading && favoriteList?.favorites?.length > 0 && (
|
|
234
|
+
favoriteList.favorites.map((product: any) => (
|
|
235
|
+
<SingleProductCard
|
|
236
|
+
key={product?.id}
|
|
237
|
+
isSoldOut={product.inventoried && !product.quantity}
|
|
238
|
+
product={product}
|
|
239
|
+
onProductClick={() => {}}
|
|
240
|
+
handleUpdateProducts={handleUpdateFavoriteList}
|
|
241
|
+
/>
|
|
242
|
+
))
|
|
243
|
+
)}
|
|
244
|
+
</>
|
|
245
|
+
)}
|
|
246
|
+
|
|
247
|
+
{!favoriteList?.loading && pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
248
|
+
<WrappButton>
|
|
249
|
+
<OButton
|
|
250
|
+
onClick={() => getFavoriteList(pagination?.currentPage + 1)}
|
|
251
|
+
text={t('LOAD_MORE_ITEMS', 'Load more items')}
|
|
252
|
+
imgRightSrc={null}
|
|
253
|
+
textStyle={{ color: theme.colors.white }}
|
|
254
|
+
style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
|
|
255
|
+
/>
|
|
256
|
+
</WrappButton>
|
|
257
|
+
)}
|
|
258
|
+
</Container>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export const FavoriteList = (props: any) => {
|
|
263
|
+
const favoriteBusinessesProps = {
|
|
264
|
+
...props,
|
|
265
|
+
UIComponent: FavoriteListUI
|
|
266
|
+
}
|
|
267
|
+
return <FavoriteListController {...favoriteBusinessesProps} />
|
|
268
|
+
}
|
|
@@ -20,7 +20,10 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
20
20
|
onBusinessClick,
|
|
21
21
|
navigation,
|
|
22
22
|
isLoading,
|
|
23
|
-
getBusinesses
|
|
23
|
+
getBusinesses,
|
|
24
|
+
favoriteIds,
|
|
25
|
+
setFavoriteIds,
|
|
26
|
+
handleUpdateBusinessList
|
|
24
27
|
} = props;
|
|
25
28
|
|
|
26
29
|
const [, t] = useLanguage()
|
|
@@ -33,6 +36,17 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
33
36
|
getBusinesses(true)
|
|
34
37
|
}, [isLoading])
|
|
35
38
|
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!businessesList?.businesses?.length) return
|
|
41
|
+
const ids = [...favoriteIds]
|
|
42
|
+
businessesList.businesses.forEach(business => {
|
|
43
|
+
if (business?.favorite) {
|
|
44
|
+
ids.push(business.id)
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
setFavoriteIds([...new Set(ids)])
|
|
48
|
+
}, [businessesList?.businesses?.length])
|
|
49
|
+
|
|
36
50
|
return (
|
|
37
51
|
<>
|
|
38
52
|
|
|
@@ -123,6 +137,9 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
123
137
|
handleCustomClick={onBusinessClick}
|
|
124
138
|
orderType={orderState?.options?.type}
|
|
125
139
|
navigation={navigation}
|
|
140
|
+
favoriteIds={favoriteIds}
|
|
141
|
+
setFavoriteIds={setFavoriteIds}
|
|
142
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
126
143
|
/>
|
|
127
144
|
</View>
|
|
128
145
|
)
|
|
@@ -99,7 +99,10 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
99
99
|
const theme = useTheme();
|
|
100
100
|
const isOtpEmail = loginTab === 'otp' && otpType === 'email'
|
|
101
101
|
const isOtpCellphone = loginTab === 'otp' && otpType === 'cellphone'
|
|
102
|
+
|
|
102
103
|
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
104
|
+
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
|
|
105
|
+
const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
|
|
103
106
|
|
|
104
107
|
const loginStyle = StyleSheet.create({
|
|
105
108
|
btnOutline: {
|
|
@@ -704,7 +707,8 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
704
707
|
<ButtonsWrapper>
|
|
705
708
|
<SocialButtons>
|
|
706
709
|
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
707
|
-
configs?.facebook_id?.value &&
|
|
710
|
+
configs?.facebook_id?.value &&
|
|
711
|
+
facebookLoginEnabled && (
|
|
708
712
|
<FacebookLogin
|
|
709
713
|
notificationState={notificationState}
|
|
710
714
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -721,7 +725,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
721
725
|
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
722
726
|
/>
|
|
723
727
|
)}
|
|
724
|
-
{(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
|
|
728
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && appleLoginEnabled && (
|
|
725
729
|
<AppleLogin
|
|
726
730
|
notificationState={notificationState}
|
|
727
731
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -37,7 +37,8 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
37
37
|
refreshOrders,
|
|
38
38
|
setRefreshOrders,
|
|
39
39
|
reorderState,
|
|
40
|
-
handleReorder
|
|
40
|
+
handleReorder,
|
|
41
|
+
handleUpdateOrderList
|
|
41
42
|
} = props
|
|
42
43
|
|
|
43
44
|
const theme = useTheme();
|
|
@@ -222,6 +223,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
222
223
|
customArray={customArray}
|
|
223
224
|
getOrderStatus={getOrderStatus}
|
|
224
225
|
onNavigationRedirect={onNavigationRedirect}
|
|
226
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
225
227
|
/>
|
|
226
228
|
) : activeOrders ? (
|
|
227
229
|
<ActiveOrders
|
|
@@ -231,6 +233,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
231
233
|
customArray={customArray}
|
|
232
234
|
getOrderStatus={getOrderStatus}
|
|
233
235
|
onNavigationRedirect={onNavigationRedirect}
|
|
236
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
234
237
|
/>
|
|
235
238
|
) : (
|
|
236
239
|
<PreviousOrders
|
|
@@ -241,6 +244,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
241
244
|
getOrderStatus={getOrderStatus}
|
|
242
245
|
onNavigationRedirect={onNavigationRedirect}
|
|
243
246
|
handleReorder={handleReorder}
|
|
247
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
244
248
|
/>
|
|
245
249
|
)
|
|
246
250
|
)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { View } from 'react-native'
|
|
3
3
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
4
4
|
import { useTheme } from 'styled-components/native'
|
|
5
|
-
import
|
|
5
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
6
6
|
import {
|
|
7
7
|
PaymentOptionWallet as PaymentOptionWalletController,
|
|
8
8
|
useLanguage,
|
|
@@ -41,13 +41,6 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
41
41
|
const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
42
42
|
const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
43
43
|
|
|
44
|
-
const styles = StyleSheet.create({
|
|
45
|
-
checkBoxStyle: {
|
|
46
|
-
width: 25,
|
|
47
|
-
height: 25,
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
44
|
const [checkedState, setCheckedState] = useState(
|
|
52
45
|
new Array(walletsState.result?.length).fill(false)
|
|
53
46
|
);
|
|
@@ -104,20 +97,19 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
104
97
|
disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
|
|
105
98
|
>
|
|
106
99
|
<SectionLeft>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/>
|
|
100
|
+
{checkedState[idx] ? (
|
|
101
|
+
<MaterialCommunityIcons
|
|
102
|
+
name="checkbox-marked"
|
|
103
|
+
size={25}
|
|
104
|
+
color={theme.colors.primary}
|
|
105
|
+
/>
|
|
106
|
+
) : (
|
|
107
|
+
<MaterialCommunityIcons
|
|
108
|
+
name="checkbox-blank-outline"
|
|
109
|
+
size={25}
|
|
110
|
+
color={theme.colors.disabled}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
121
113
|
<View style={{ alignItems: 'baseline', marginLeft: 5 }}>
|
|
122
114
|
<View>
|
|
123
115
|
<OText
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { useLanguage
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLanguage } from 'ordering-components/native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import {
|
|
5
|
-
import { OButton
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { OButton } from '../shared';
|
|
6
6
|
import {
|
|
7
|
-
Card,
|
|
8
|
-
Logo,
|
|
9
|
-
Information,
|
|
10
|
-
MyOrderOptions,
|
|
11
|
-
Status,
|
|
12
7
|
WrappButton,
|
|
13
8
|
} from './styles';
|
|
14
9
|
import { PreviousOrdersParams } from '../../types';
|
|
15
|
-
import
|
|
10
|
+
import { SingleOrderCard } from '../SingleOrderCard';
|
|
16
11
|
|
|
17
12
|
export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
18
13
|
const {
|
|
@@ -24,152 +19,28 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
|
|
|
24
19
|
handleReorder,
|
|
25
20
|
reorderLoading,
|
|
26
21
|
orderID,
|
|
22
|
+
handleUpdateOrderList
|
|
27
23
|
} = props;
|
|
28
24
|
|
|
29
25
|
const theme = useTheme();
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
const styles = StyleSheet.create({
|
|
33
|
-
logo: {
|
|
34
|
-
borderRadius: 10,
|
|
35
|
-
width: 64,
|
|
36
|
-
height: 64,
|
|
37
|
-
},
|
|
38
|
-
reorderbutton: {
|
|
39
|
-
height: 23,
|
|
40
|
-
paddingLeft: 10,
|
|
41
|
-
paddingRight: 10,
|
|
42
|
-
borderRadius: 23,
|
|
43
|
-
shadowOpacity: 0,
|
|
44
|
-
backgroundColor: theme.colors.primaryContrast,
|
|
45
|
-
borderWidth: 0,
|
|
46
|
-
},
|
|
47
|
-
reorderLoading: {
|
|
48
|
-
width: 80,
|
|
49
|
-
height: 40,
|
|
50
|
-
borderRadius: 10,
|
|
51
|
-
},
|
|
52
|
-
reviewButton: {
|
|
53
|
-
height: 23,
|
|
54
|
-
maxHeight: 23,
|
|
55
|
-
backgroundColor: theme.colors.white,
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
justifyContent: 'center',
|
|
58
|
-
paddingHorizontal: 10,
|
|
59
|
-
borderRadius: 23,
|
|
60
|
-
borderWidth: 1,
|
|
61
|
-
borderColor: theme.colors.primaryContrast,
|
|
62
|
-
},
|
|
63
|
-
buttonText: {
|
|
64
|
-
color: theme.colors.primary,
|
|
65
|
-
fontSize: 10,
|
|
66
|
-
marginLeft: 2,
|
|
67
|
-
marginRight: 2,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
27
|
const [, t] = useLanguage();
|
|
73
|
-
const [reorderSelected, setReorderSelected] = useState<number | null>(null);
|
|
74
|
-
const [{ parseDate, optimizeImage }] = useUtils();
|
|
75
|
-
const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
|
|
76
|
-
|
|
77
|
-
const handleClickViewOrder = (uuid: string) => {
|
|
78
|
-
onNavigationRedirect &&
|
|
79
|
-
onNavigationRedirect('OrderDetails', { orderId: uuid });
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const handleClickOrderReview = (order: any) => {
|
|
83
|
-
onNavigationRedirect &&
|
|
84
|
-
onNavigationRedirect('ReviewOrder', {
|
|
85
|
-
order: {
|
|
86
|
-
id: order?.id,
|
|
87
|
-
business_id: order?.business_id,
|
|
88
|
-
logo: order?.business?.logo,
|
|
89
|
-
driver: order?.driver,
|
|
90
|
-
products: order?.products,
|
|
91
|
-
review: order?.review,
|
|
92
|
-
user_review: order?.user_review
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const formatDate = (date: string, option?: any) => {
|
|
98
|
-
return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a');
|
|
99
|
-
};
|
|
100
28
|
|
|
101
|
-
|
|
102
|
-
setReorderSelected(id);
|
|
103
|
-
handleReorder && handleReorder(id);
|
|
104
|
-
};
|
|
29
|
+
const pastOrders = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
105
30
|
|
|
106
31
|
return (
|
|
107
32
|
<View style={{ marginBottom: 30 }}>
|
|
108
|
-
{orders.map((order: any) => (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
style={styles.logo}
|
|
120
|
-
/>
|
|
121
|
-
</Logo>
|
|
122
|
-
)}
|
|
123
|
-
<Information>
|
|
124
|
-
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
125
|
-
{order.business?.name}
|
|
126
|
-
</OText>
|
|
127
|
-
<OText
|
|
128
|
-
size={10}
|
|
129
|
-
lineHeight={15}
|
|
130
|
-
color={theme.colors.textSecondary}
|
|
131
|
-
style={{ marginVertical: 3 }}
|
|
132
|
-
numberOfLines={1}>
|
|
133
|
-
{order?.delivery_datetime_utc
|
|
134
|
-
? formatDate(order?.delivery_datetime_utc)
|
|
135
|
-
: formatDate(order?.delivery_datetime, { utc: false })}
|
|
136
|
-
</OText>
|
|
137
|
-
<OText
|
|
138
|
-
color={theme.colors.primary}
|
|
139
|
-
size={10}
|
|
140
|
-
lineHeight={15}
|
|
141
|
-
numberOfLines={1}>
|
|
142
|
-
{getOrderStatus(order.status)?.value}
|
|
143
|
-
</OText>
|
|
144
|
-
</Information>
|
|
145
|
-
<Status>
|
|
146
|
-
{order.cart && (
|
|
147
|
-
<OButton
|
|
148
|
-
text={t('REORDER', 'Reorder')}
|
|
149
|
-
imgRightSrc={''}
|
|
150
|
-
textStyle={styles.buttonText}
|
|
151
|
-
style={
|
|
152
|
-
reorderLoading && order.id === reorderSelected
|
|
153
|
-
? styles.reorderLoading
|
|
154
|
-
: styles.reorderbutton
|
|
155
|
-
}
|
|
156
|
-
onClick={() => handleReorderClick(order.id)}
|
|
157
|
-
isLoading={reorderLoading && order.id === reorderSelected}
|
|
158
|
-
/>
|
|
159
|
-
)}
|
|
160
|
-
{allowedOrderStatus.includes(parseInt(order?.status)) &&
|
|
161
|
-
!order.review && (
|
|
162
|
-
<TouchableOpacity
|
|
163
|
-
onPress={() => handleClickOrderReview(order)}
|
|
164
|
-
style={styles.reviewButton}>
|
|
165
|
-
<OText size={10} color={theme.colors.primary} numberOfLines={1}>
|
|
166
|
-
{t('REVIEW', 'Review')}
|
|
167
|
-
</OText>
|
|
168
|
-
</TouchableOpacity>
|
|
169
|
-
)}
|
|
170
|
-
</Status>
|
|
171
|
-
</Card>
|
|
172
|
-
</TouchableOpacity>
|
|
33
|
+
{orders.map((order: any, i: number) => (
|
|
34
|
+
<SingleOrderCard
|
|
35
|
+
key={i}
|
|
36
|
+
order={order}
|
|
37
|
+
reorderLoading={reorderLoading}
|
|
38
|
+
handleReorder={handleReorder}
|
|
39
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
40
|
+
getOrderStatus={getOrderStatus}
|
|
41
|
+
pastOrders={pastOrders.includes(order?.status)}
|
|
42
|
+
handleUpdateOrderList={handleUpdateOrderList}
|
|
43
|
+
/>
|
|
173
44
|
))}
|
|
174
45
|
{pagination.totalPages && pagination.currentPage < pagination.totalPages && (
|
|
175
46
|
<WrappButton>
|
|
@@ -136,6 +136,8 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
136
136
|
|
|
137
137
|
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
138
138
|
const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
|
|
139
|
+
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
|
|
140
|
+
const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
|
|
139
141
|
|
|
140
142
|
const handleRefs = (ref: any, code: string) => {
|
|
141
143
|
switch (code) {
|
|
@@ -780,7 +782,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
780
782
|
<ButtonsWrapper>
|
|
781
783
|
<SocialButtons>
|
|
782
784
|
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
783
|
-
configs?.facebook_id?.value &&
|
|
785
|
+
configs?.facebook_id?.value &&
|
|
786
|
+
facebookLoginEnabled &&
|
|
787
|
+
(
|
|
784
788
|
<FacebookLogin
|
|
785
789
|
notificationState={notificationState}
|
|
786
790
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|
|
@@ -797,7 +801,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
797
801
|
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
798
802
|
/>
|
|
799
803
|
)}
|
|
800
|
-
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
|
|
804
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
|
|
801
805
|
<AppleLogin
|
|
802
806
|
notificationState={notificationState}
|
|
803
807
|
handleErrors={(err: any) => showToast(ToastType.Error, err)}
|