ordering-ui-react-native 0.16.48 → 0.16.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -2
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +126 -110
- package/themes/original/src/components/BusinessListingSearch/index.tsx +26 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +47 -42
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -25
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +54 -5
- package/themes/original/src/components/OrdersOption/index.tsx +10 -3
- package/themes/original/src/components/ProductForm/index.tsx +481 -481
- package/themes/original/src/components/ProductForm/styles.tsx +5 -1
- package/themes/original/src/components/SignupForm/index.tsx +26 -24
- package/themes/original/src/components/SingleOrderCard/index.tsx +89 -96
- package/themes/original/src/components/SingleProductCard/index.tsx +104 -94
- package/themes/original/src/types/index.tsx +7 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
3
3
|
import Geolocation from '@react-native-community/geolocation'
|
|
4
|
+
import { IOScrollView } from 'react-native-intersection-observer'
|
|
4
5
|
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
5
6
|
import {
|
|
6
7
|
View,
|
|
@@ -162,7 +163,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
162
163
|
const hasMore = !(
|
|
163
164
|
paginationProps.totalPages === paginationProps.currentPage
|
|
164
165
|
);
|
|
165
|
-
|
|
166
166
|
if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
|
|
167
167
|
getBusinesses();
|
|
168
168
|
}
|
|
@@ -352,13 +352,14 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
352
352
|
onCancel={() => handleChangeSearch('')}
|
|
353
353
|
placeholder={t('SEARCH', 'Search')}
|
|
354
354
|
height={50}
|
|
355
|
-
isDisabled={!businessTypes}
|
|
355
|
+
isDisabled={!businessTypes || configs?.advanced_business_search_enabled?.value === '1'}
|
|
356
356
|
inputContainerStyles={styles.inputContainerStyles}
|
|
357
357
|
containerStyles={{
|
|
358
358
|
marginHorizontal: 40,
|
|
359
359
|
marginTop: 20
|
|
360
360
|
}}
|
|
361
361
|
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
|
|
362
|
+
onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
|
|
362
363
|
onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
|
|
363
364
|
/>
|
|
364
365
|
)}
|
|
@@ -429,29 +430,32 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
429
430
|
)}
|
|
430
431
|
/>
|
|
431
432
|
)}
|
|
432
|
-
|
|
433
|
-
(
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
433
|
+
<IOScrollView>
|
|
434
|
+
{businessesList.businesses?.map(
|
|
435
|
+
(business: any, i: number) => (
|
|
436
|
+
<BusinessController
|
|
437
|
+
key={`${business.id}_` + i}
|
|
438
|
+
enableIntersection
|
|
439
|
+
business={business}
|
|
440
|
+
isBusinessOpen={business.open}
|
|
441
|
+
handleCustomClick={handleBusinessClick}
|
|
442
|
+
orderType={orderState?.options?.type}
|
|
443
|
+
navigation={navigation}
|
|
444
|
+
businessHeader={business?.header}
|
|
445
|
+
businessFeatured={business?.featured}
|
|
446
|
+
businessLogo={business?.logo}
|
|
447
|
+
businessReviews={business?.reviews}
|
|
448
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
449
|
+
businessDeliveryTime={business?.delivery_time}
|
|
450
|
+
businessPickupTime={business?.pickup_time}
|
|
451
|
+
businessDistance={business?.distance}
|
|
452
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
453
|
+
favoriteIds={favoriteIds}
|
|
454
|
+
setFavoriteIds={setFavoriteIds}
|
|
455
|
+
/>
|
|
456
|
+
)
|
|
457
|
+
)}
|
|
458
|
+
</IOScrollView>
|
|
455
459
|
{businessesList.loading && (
|
|
456
460
|
<>
|
|
457
461
|
{[
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components/native'
|
|
3
|
+
import { ScrollView, StyleSheet, View } from 'react-native'
|
|
4
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
5
|
+
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
6
|
+
import { OText, OButton } from '../shared'
|
|
7
|
+
|
|
8
|
+
export const OrderHistory = (props: any) => {
|
|
9
|
+
const {
|
|
10
|
+
order,
|
|
11
|
+
messages,
|
|
12
|
+
enableReview,
|
|
13
|
+
onClose,
|
|
14
|
+
handleTriggerReview
|
|
15
|
+
} = props
|
|
16
|
+
|
|
17
|
+
const [, t] = useLanguage()
|
|
18
|
+
const [{ parseDate }] = useUtils()
|
|
19
|
+
const theme = useTheme()
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
historyItem: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
borderBottomWidth: 1,
|
|
27
|
+
borderColor: theme.colors.border
|
|
28
|
+
},
|
|
29
|
+
detailWrapper: {
|
|
30
|
+
marginLeft: 20,
|
|
31
|
+
paddingHorizontal: 13,
|
|
32
|
+
paddingVertical: 16
|
|
33
|
+
},
|
|
34
|
+
container: {
|
|
35
|
+
paddingHorizontal: 40,
|
|
36
|
+
paddingVertical: 15
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const ORDER_STATUS: any = {
|
|
41
|
+
0: 'ORDER_STATUS_PENDING',
|
|
42
|
+
1: 'ORDERS_COMPLETED',
|
|
43
|
+
2: 'ORDER_REJECTED',
|
|
44
|
+
3: 'ORDER_STATUS_IN_BUSINESS',
|
|
45
|
+
4: 'ORDER_READY',
|
|
46
|
+
5: 'ORDER_REJECTED_RESTAURANT',
|
|
47
|
+
6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
|
|
48
|
+
7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
|
|
49
|
+
8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
|
|
50
|
+
9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
|
|
51
|
+
10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
|
|
52
|
+
11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
|
|
53
|
+
12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
|
|
54
|
+
13: 'PREORDER',
|
|
55
|
+
14: 'ORDER_NOT_READY',
|
|
56
|
+
15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
57
|
+
16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
|
|
58
|
+
17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
59
|
+
18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
|
|
60
|
+
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
61
|
+
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
62
|
+
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
63
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
64
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const getLogisticTagStatus = (status: any) => {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case 0:
|
|
70
|
+
return t('PENDING', 'Pending')
|
|
71
|
+
case 1:
|
|
72
|
+
return t('IN_PROGRESS', 'In Progress')
|
|
73
|
+
case 2:
|
|
74
|
+
return t('IN_QUEUE', 'In Queue')
|
|
75
|
+
case 3:
|
|
76
|
+
return t('EXPIRED', 'Logistic expired')
|
|
77
|
+
case 4:
|
|
78
|
+
return t('RESOLVED', 'Resolved')
|
|
79
|
+
default:
|
|
80
|
+
return status
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const handleReview = () => {
|
|
85
|
+
if (enableReview) handleTriggerReview()
|
|
86
|
+
else onClose()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<ScrollView contentContainerStyle={styles.container}>
|
|
91
|
+
<OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
|
|
92
|
+
{t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', ` # ${order?.id}`)}
|
|
93
|
+
</OText>
|
|
94
|
+
{!messages?.loading && order && (
|
|
95
|
+
<View style={styles.historyItem}>
|
|
96
|
+
<MaterialCommunityIcons
|
|
97
|
+
name="checkbox-marked-circle"
|
|
98
|
+
size={20}
|
|
99
|
+
color={theme.colors.primary}
|
|
100
|
+
/>
|
|
101
|
+
<View style={styles.detailWrapper}>
|
|
102
|
+
<OText
|
|
103
|
+
size={14}
|
|
104
|
+
weight='bold'
|
|
105
|
+
numberOfLines={1}
|
|
106
|
+
ellipsizeMode='tail'
|
|
107
|
+
>
|
|
108
|
+
{t('ORDER_PLACED', 'Order placed')} {' '}
|
|
109
|
+
{t('VIA', 'Via')}{' '}
|
|
110
|
+
{order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
|
|
111
|
+
</OText>
|
|
112
|
+
<OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
)}
|
|
116
|
+
{messages && messages?.messages.map((message: any, i: number) => message.type === 1 && (
|
|
117
|
+
<View
|
|
118
|
+
style={styles.historyItem}
|
|
119
|
+
key={i}
|
|
120
|
+
>
|
|
121
|
+
<MaterialCommunityIcons
|
|
122
|
+
name="checkbox-marked-circle"
|
|
123
|
+
size={20}
|
|
124
|
+
color={theme.colors.primary}
|
|
125
|
+
/>
|
|
126
|
+
<View style={styles.detailWrapper}>
|
|
127
|
+
{message.change?.attribute !== 'driver_id' ? (
|
|
128
|
+
<OText
|
|
129
|
+
size={14}
|
|
130
|
+
weight='bold'
|
|
131
|
+
numberOfLines={1}
|
|
132
|
+
ellipsizeMode='tail'
|
|
133
|
+
>
|
|
134
|
+
{message.change?.attribute === 'logistic_status'
|
|
135
|
+
? getLogisticTagStatus(parseInt(message.change.new, 10))
|
|
136
|
+
: t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
137
|
+
}
|
|
138
|
+
</OText>
|
|
139
|
+
) : (
|
|
140
|
+
<OText
|
|
141
|
+
size={14}
|
|
142
|
+
weight='bold'
|
|
143
|
+
numberOfLines={1}
|
|
144
|
+
ellipsizeMode='tail'
|
|
145
|
+
>
|
|
146
|
+
{message.change.new
|
|
147
|
+
? (`${message.driver?.name} ${!!message.driver?.lastname ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')}`)
|
|
148
|
+
: t('DRIVER_UNASSIGNED', 'Driver unassigned')}
|
|
149
|
+
</OText>
|
|
150
|
+
)}
|
|
151
|
+
<OText size={12}>{parseDate(message?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
|
|
152
|
+
</View>
|
|
153
|
+
</View>
|
|
154
|
+
))}
|
|
155
|
+
<OButton
|
|
156
|
+
text={enableReview ? t('REVIEW_ORDER', 'Review order') : t('CONTINUE', 'Continue')}
|
|
157
|
+
textStyle={{ fontSize: 14, color: theme.colors.white }}
|
|
158
|
+
imgRightSrc={theme.images.general.arrow_right}
|
|
159
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
160
|
+
borderColor='transparent'
|
|
161
|
+
bgColor={theme.colors.primary}
|
|
162
|
+
style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginBottom: 30, marginTop: 20 }}
|
|
163
|
+
onClick={() => handleReview()}
|
|
164
|
+
/>
|
|
165
|
+
</ScrollView>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
@@ -43,6 +43,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
|
43
43
|
import { TaxInformation } from '../TaxInformation';
|
|
44
44
|
import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
45
45
|
import NavBar from '../NavBar'
|
|
46
|
+
import { OrderHistory } from './OrderHistory';
|
|
46
47
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
47
48
|
const {
|
|
48
49
|
navigation,
|
|
@@ -85,6 +86,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
85
86
|
width: 30,
|
|
86
87
|
marginTop: Platform.OS === 'ios' ? 0 : 30
|
|
87
88
|
},
|
|
89
|
+
linkWrapper: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
flexDirection: 'row'
|
|
93
|
+
}
|
|
88
94
|
});
|
|
89
95
|
|
|
90
96
|
const [, t] = useLanguage();
|
|
@@ -93,6 +99,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
93
99
|
const [{ carts }] = useOrder()
|
|
94
100
|
|
|
95
101
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
102
|
+
const [isOrderHistory, setIsOrderHistory] = useState(false)
|
|
96
103
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
97
104
|
const { order, businessData } = props.order;
|
|
98
105
|
const mapValidStatuses = [9, 19, 23]
|
|
@@ -366,6 +373,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
366
373
|
)
|
|
367
374
|
}
|
|
368
375
|
|
|
376
|
+
const handleTriggerReview = () => {
|
|
377
|
+
setIsOrderHistory(false);
|
|
378
|
+
(
|
|
379
|
+
parseInt(order?.status) === 1 ||
|
|
380
|
+
parseInt(order?.status) === 11 ||
|
|
381
|
+
parseInt(order?.status) === 15
|
|
382
|
+
) && !order.review && !isReviewed && handleClickOrderReview(order)
|
|
383
|
+
}
|
|
369
384
|
|
|
370
385
|
useEffect(() => {
|
|
371
386
|
const _businessId = 'businessId:' + businessData?.id
|
|
@@ -377,7 +392,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
377
392
|
}
|
|
378
393
|
if (!reorderState?.error && reorderState.loading === false && businessData?.id) {
|
|
379
394
|
const products = carts?.[_businessId]?.products
|
|
380
|
-
const available = products
|
|
395
|
+
const available = products?.every((product: any) => product.valid === true)
|
|
381
396
|
|
|
382
397
|
if (available && reorderState?.result?.uuid && (products?.length === order?.products.length)) {
|
|
383
398
|
onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
|
|
@@ -507,7 +522,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
507
522
|
/>
|
|
508
523
|
<OrderInfo>
|
|
509
524
|
<OrderData>
|
|
510
|
-
{
|
|
525
|
+
<View style={styles.linkWrapper}>
|
|
526
|
+
{
|
|
511
527
|
(
|
|
512
528
|
parseInt(order?.status) === 1 ||
|
|
513
529
|
parseInt(order?.status) === 11 ||
|
|
@@ -515,20 +531,36 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
515
531
|
) && !order.review && !isReviewed && (
|
|
516
532
|
<TouchableOpacity
|
|
517
533
|
activeOpacity={0.7}
|
|
518
|
-
style={{ marginTop: 6 }}
|
|
534
|
+
style={{ marginTop: 6, marginRight: 10 }}
|
|
519
535
|
onPress={() => handleClickOrderReview(order)}
|
|
520
|
-
|
|
521
536
|
>
|
|
522
537
|
<OText
|
|
523
538
|
size={10}
|
|
524
539
|
lineHeight={15}
|
|
525
|
-
color={theme.colors.
|
|
540
|
+
color={theme.colors.primary}
|
|
526
541
|
style={{ textDecorationLine: 'underline' }}
|
|
527
542
|
>
|
|
528
543
|
{t('REVIEW_YOUR_ORDER', 'Review your order')}
|
|
529
544
|
</OText>
|
|
530
545
|
</TouchableOpacity>
|
|
531
546
|
)}
|
|
547
|
+
<TouchableOpacity
|
|
548
|
+
activeOpacity={0.7}
|
|
549
|
+
style={{ marginTop: 6 }}
|
|
550
|
+
onPress={() => setIsOrderHistory(true)}
|
|
551
|
+
|
|
552
|
+
>
|
|
553
|
+
<OText
|
|
554
|
+
size={10}
|
|
555
|
+
lineHeight={15}
|
|
556
|
+
color={theme.colors.primary}
|
|
557
|
+
style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
|
|
558
|
+
>
|
|
559
|
+
{t('VIEW_DETAILS', 'View Details')}
|
|
560
|
+
</OText>
|
|
561
|
+
</TouchableOpacity>
|
|
562
|
+
</View>
|
|
563
|
+
|
|
532
564
|
<StaturBar>
|
|
533
565
|
<LinearGradient
|
|
534
566
|
start={{ x: 0.0, y: 0.0 }}
|
|
@@ -1056,6 +1088,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
1056
1088
|
products={order?.products}
|
|
1057
1089
|
/>
|
|
1058
1090
|
</OModal>
|
|
1091
|
+
<OModal
|
|
1092
|
+
open={isOrderHistory}
|
|
1093
|
+
onClose={() => setIsOrderHistory(false)}
|
|
1094
|
+
entireModal
|
|
1095
|
+
>
|
|
1096
|
+
<OrderHistory
|
|
1097
|
+
order={order}
|
|
1098
|
+
messages={messages}
|
|
1099
|
+
enableReview={(
|
|
1100
|
+
parseInt(order?.status) === 1 ||
|
|
1101
|
+
parseInt(order?.status) === 11 ||
|
|
1102
|
+
parseInt(order?.status) === 15
|
|
1103
|
+
) && !order.review && !isReviewed}
|
|
1104
|
+
onClose={() => setIsOrderHistory(false)}
|
|
1105
|
+
handleTriggerReview={handleTriggerReview}
|
|
1106
|
+
/>
|
|
1107
|
+
</OModal>
|
|
1059
1108
|
</OrderDetailsContainer>
|
|
1060
1109
|
);
|
|
1061
1110
|
};
|
|
@@ -98,11 +98,18 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
const onProductClick = (product: any) => {
|
|
101
|
-
if (product?.product_id && product?.category_id && product?.businessId
|
|
101
|
+
if (product?.product_id && product?.category_id && product?.businessId &&
|
|
102
|
+
product?.business.slug && product?.business.header && product?.business.logo) {
|
|
102
103
|
onNavigationRedirect('ProductDetails', {
|
|
103
|
-
|
|
104
|
-
categoryId: product?.category_id,
|
|
104
|
+
isRedirect: 'business',
|
|
105
105
|
businessId: product?.businessId,
|
|
106
|
+
categoryId: product?.category_id,
|
|
107
|
+
productId: product?.product_id,
|
|
108
|
+
business: {
|
|
109
|
+
store: product?.business.slug,
|
|
110
|
+
header: product?.business.header,
|
|
111
|
+
logo: product?.business.logo,
|
|
112
|
+
}
|
|
106
113
|
})
|
|
107
114
|
} else {
|
|
108
115
|
showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
|