ordering-ui-react-native 0.16.46-release → 0.16.47-release
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/src/components/BusinessProductsListing/index.tsx +1 -0
- package/themes/original/src/components/Cart/index.tsx +31 -2
- package/themes/original/src/components/FloatingButton/index.tsx +13 -11
- package/themes/original/src/components/MultiCart/index.tsx +63 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +6 -7
- package/themes/original/src/components/MultiCheckout/index.tsx +4 -2
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +14 -0
- package/themes/original/src/components/OrdersOption/index.tsx +32 -2
- package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/SingleOrderCard/index.tsx +54 -19
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -1
- package/themes/original/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -528,6 +528,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
528
528
|
btnLeftValue={currentCart?.products.reduce((prev: number, product: any) => prev + product.quantity, 0)}
|
|
529
529
|
btnRightValue={parsePrice(currentCart?.total)}
|
|
530
530
|
disabled={subtotalWithTaxes < currentCart?.minimum || openUpselling}
|
|
531
|
+
hideButton={isCheckoutMultiBusinessEnabled}
|
|
531
532
|
handleClick={() => setOpenUpselling(true)}
|
|
532
533
|
/>
|
|
533
534
|
</View>
|
|
@@ -104,9 +104,38 @@ const CartUI = (props: any) => {
|
|
|
104
104
|
const handleUpsellingPage = () => {
|
|
105
105
|
setOpenUpselling(false)
|
|
106
106
|
setCanOpenUpselling(false)
|
|
107
|
-
|
|
107
|
+
const cartSelectedHasGroup = cart?.group?.uuid
|
|
108
|
+
const cartFilterValidation = (cart : any) => cart?.valid && cart?.status !== 2
|
|
109
|
+
const cartsGroupLength = cartSelectedHasGroup ? Object.values(orderState.carts).filter((_cart : any) => _cart?.group?.uuid === cartSelectedHasGroup && cartFilterValidation(_cart))?.length : 0
|
|
110
|
+
if (cartsGroupLength > 1 && isCheckoutMultiBusinessEnabled) {
|
|
108
111
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
109
|
-
screen: 'MultiCheckout'
|
|
112
|
+
screen: 'MultiCheckout',
|
|
113
|
+
cartUuid: cart?.group?.uuid
|
|
114
|
+
})
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
const cartGroupsCount : any = {}
|
|
118
|
+
Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach((_cart : any) => {
|
|
119
|
+
if (cartGroupsCount[_cart?.group?.uuid]) {
|
|
120
|
+
cartGroupsCount[_cart?.group?.uuid] += 1
|
|
121
|
+
} else {
|
|
122
|
+
cartGroupsCount[_cart?.group?.uuid] = 1
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
let groupForTheCart
|
|
126
|
+
const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
|
|
127
|
+
const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
|
|
128
|
+
const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
|
|
129
|
+
if (indexes?.length > 1) {
|
|
130
|
+
groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
|
|
131
|
+
} else {
|
|
132
|
+
groupForTheCart = indexes[0]
|
|
133
|
+
}
|
|
134
|
+
if (isCheckoutMultiBusinessEnabled && openCarts.length > 1 && groupForTheCart) {
|
|
135
|
+
props.onNavigationRedirect('CheckoutNavigator', {
|
|
136
|
+
screen: 'MultiCart',
|
|
137
|
+
cartUuid: cart.uuid,
|
|
138
|
+
cartGroup: groupForTheCart === 'undefined' ? 'create' : groupForTheCart
|
|
110
139
|
})
|
|
111
140
|
} else {
|
|
112
141
|
props.onNavigationRedirect('CheckoutNavigator', {
|
|
@@ -22,7 +22,8 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
22
22
|
disabled,
|
|
23
23
|
isSecondaryBtn,
|
|
24
24
|
handleEmpty,
|
|
25
|
-
iosBottom
|
|
25
|
+
iosBottom,
|
|
26
|
+
hideButton
|
|
26
27
|
} = props;
|
|
27
28
|
|
|
28
29
|
const [, t] = useLanguage();
|
|
@@ -77,16 +78,17 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
|
|
|
77
78
|
</View>
|
|
78
79
|
)}
|
|
79
80
|
</View>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
{!hideButton && (
|
|
82
|
+
<Button
|
|
83
|
+
style={[isSecondaryBtn ? styles.secondaryBtn : styles.primaryBtn]}
|
|
84
|
+
onPress={handleButtonClick}
|
|
85
|
+
disabled={disabled}
|
|
86
|
+
>
|
|
87
|
+
<OText color={isSecondaryBtn ? theme.colors.textSecondary : theme.colors.white} lineHeight={24} size={14} weight={'400'}>
|
|
88
|
+
{btnText}
|
|
89
|
+
</OText>
|
|
90
|
+
</Button>
|
|
91
|
+
)}
|
|
90
92
|
</Container>
|
|
91
93
|
);
|
|
92
94
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ChAddress, ChContainer, ChSection, ChUserDetails, DeliveryOptionsContainer } from '../Checkout/styles'
|
|
3
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
|
|
4
|
+
import { Container } from '../../layouts/Container';
|
|
5
|
+
import { View, StyleSheet } from 'react-native'
|
|
6
|
+
import { useTheme } from 'styled-components/native';
|
|
7
|
+
import { MultiCartCreate } from 'ordering-components/native'
|
|
8
|
+
|
|
9
|
+
export const MultiCartUI = () => {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
pagePadding: {
|
|
14
|
+
paddingHorizontal: 40
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Container noPadding>
|
|
21
|
+
<ChContainer style={styles.pagePadding}>
|
|
22
|
+
<ChSection>
|
|
23
|
+
<ChUserDetails>
|
|
24
|
+
<Placeholder Animation={Fade}>
|
|
25
|
+
<PlaceholderLine height={20} />
|
|
26
|
+
<PlaceholderLine height={12} />
|
|
27
|
+
<PlaceholderLine height={12} />
|
|
28
|
+
<PlaceholderLine height={12} style={{ marginBottom: 20 }} />
|
|
29
|
+
</Placeholder>
|
|
30
|
+
</ChUserDetails>
|
|
31
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
|
|
32
|
+
</ChSection>
|
|
33
|
+
<DeliveryOptionsContainer>
|
|
34
|
+
<View style={{ height: 110 }}>
|
|
35
|
+
<Placeholder Animation={Fade}>
|
|
36
|
+
<PlaceholderLine height={20} />
|
|
37
|
+
<PlaceholderLine height={40} />
|
|
38
|
+
</Placeholder>
|
|
39
|
+
</View>
|
|
40
|
+
</DeliveryOptionsContainer>
|
|
41
|
+
<ChSection>
|
|
42
|
+
<ChAddress>
|
|
43
|
+
<Placeholder Animation={Fade}>
|
|
44
|
+
<PlaceholderLine height={20} style={{ marginBottom: 50 }} />
|
|
45
|
+
<PlaceholderLine height={100} />
|
|
46
|
+
</Placeholder>
|
|
47
|
+
</ChAddress>
|
|
48
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
49
|
+
</ChSection>
|
|
50
|
+
</ChContainer>
|
|
51
|
+
</Container>
|
|
52
|
+
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const MultiCart = (props : any) => {
|
|
58
|
+
const mulcartProps = {
|
|
59
|
+
...props,
|
|
60
|
+
UIComponent: MultiCartUI
|
|
61
|
+
}
|
|
62
|
+
return <MultiCartCreate {...mulcartProps} />
|
|
63
|
+
}
|
|
@@ -25,7 +25,6 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
25
25
|
businessIds,
|
|
26
26
|
paymethodsAndWallets,
|
|
27
27
|
walletsState,
|
|
28
|
-
businessPaymethods,
|
|
29
28
|
paymethodSelected,
|
|
30
29
|
handleSelectPaymethod,
|
|
31
30
|
handleSelectWallet,
|
|
@@ -77,24 +76,24 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
77
76
|
const renderPaymethods = ({ item }: any) => {
|
|
78
77
|
return (
|
|
79
78
|
<TouchableOpacity
|
|
80
|
-
onPress={() => handleSelectPaymethod(item)}
|
|
79
|
+
onPress={() => handleSelectPaymethod({ ...item, paymethod: { gateway: item.gateway }, paymethod_id: item?.id })}
|
|
81
80
|
>
|
|
82
81
|
<PMItem
|
|
83
82
|
key={item.id}
|
|
84
|
-
isActive={paymethodSelected?.
|
|
83
|
+
isActive={paymethodSelected?.id === item.id}
|
|
85
84
|
>
|
|
86
85
|
<OIcon
|
|
87
86
|
src={getPayIcon(item.paymethod?.gateway)}
|
|
88
87
|
width={20}
|
|
89
88
|
height={20}
|
|
90
|
-
color={paymethodSelected?.
|
|
89
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
91
90
|
/>
|
|
92
91
|
<OText
|
|
93
92
|
size={10}
|
|
94
93
|
style={{ margin: 0, marginTop: 4 }}
|
|
95
|
-
color={paymethodSelected?.
|
|
94
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
96
95
|
>
|
|
97
|
-
{t(item?.
|
|
96
|
+
{t(item?.gateway.toUpperCase(), item?.name)}
|
|
98
97
|
</OText>
|
|
99
98
|
</PMItem>
|
|
100
99
|
</TouchableOpacity>
|
|
@@ -124,7 +123,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
|
|
|
124
123
|
<FlatList
|
|
125
124
|
horizontal
|
|
126
125
|
showsHorizontalScrollIndicator={false}
|
|
127
|
-
data={
|
|
126
|
+
data={paymethodsAndWallets.paymethods}
|
|
128
127
|
renderItem={renderPaymethods}
|
|
129
128
|
keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
|
|
130
129
|
/>
|
|
@@ -53,7 +53,8 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
53
53
|
paymethodSelected,
|
|
54
54
|
handleSelectPaymethod,
|
|
55
55
|
handleSelectWallet,
|
|
56
|
-
handlePaymethodDataChange
|
|
56
|
+
handlePaymethodDataChange,
|
|
57
|
+
cartUuid
|
|
57
58
|
} = props
|
|
58
59
|
|
|
59
60
|
const theme = useTheme();
|
|
@@ -78,7 +79,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
78
79
|
const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
|
|
79
80
|
const isPreOrder = configs?.preorder_status_enabled?.value === '1'
|
|
80
81
|
const maximumCarts = 5
|
|
81
|
-
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || openCarts.length > maximumCarts
|
|
82
|
+
const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || openCarts.length > maximumCarts || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
|
|
82
83
|
const walletCarts = (Object.values(carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && cart?.wallets) || null) || []
|
|
83
84
|
|
|
84
85
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
@@ -225,6 +226,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
225
226
|
handleSelectPaymethod={handleSelectPaymethod}
|
|
226
227
|
handleSelectWallet={handleSelectWallet}
|
|
227
228
|
handlePaymethodDataChange={handlePaymethodDataChange}
|
|
229
|
+
cartUuid={cartUuid}
|
|
228
230
|
/>
|
|
229
231
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
230
232
|
</ChSection>
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
OrdersSummary,
|
|
20
20
|
BorderLine
|
|
21
21
|
} from './styles'
|
|
22
|
+
import { NotFoundSource } from '../NotFoundSource'
|
|
22
23
|
|
|
23
24
|
export const MultiOrdersDetailsUI = (props: any) => {
|
|
24
25
|
const {
|
|
@@ -248,6 +249,19 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
248
249
|
))}
|
|
249
250
|
</>
|
|
250
251
|
)}
|
|
252
|
+
{!loading && (error || orders?.length === 0) && (
|
|
253
|
+
error?.includes('ERROR_ACCESS_EXPIRED') ? (
|
|
254
|
+
<NotFoundSource
|
|
255
|
+
content={t(error[0], 'Sorry, the order has expired.')}
|
|
256
|
+
/>
|
|
257
|
+
) : (
|
|
258
|
+
<NotFoundSource
|
|
259
|
+
content={t('NOT_FOUND_ORDER', theme?.defaultLanguages?.NOT_FOUND_ORDER || 'Sorry, we couldn\'t find the requested order.')}
|
|
260
|
+
btnTitle={t('ORDERS_REDIRECT', theme?.defaultLanguages?.ORDERS_REDIRECT || 'Go to Orders')}
|
|
261
|
+
onClickButton={navigation.navigate('BusinessList')}
|
|
262
|
+
/>
|
|
263
|
+
)
|
|
264
|
+
)}
|
|
251
265
|
<Divider />
|
|
252
266
|
</OrdersDetailsContainer>
|
|
253
267
|
)
|
|
@@ -60,12 +60,42 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
60
60
|
const [, { showToast }] = useToast()
|
|
61
61
|
const { loading, error, orders: values } = orderList
|
|
62
62
|
const [businessLoading, setBusinessLoading] = useState(true)
|
|
63
|
+
const [orders, setOrders] = useState([])
|
|
63
64
|
|
|
64
65
|
const imageFails = activeOrders
|
|
65
66
|
? theme.images.general.emptyActiveOrders
|
|
66
67
|
: theme.images.general.emptyPastOrders
|
|
67
68
|
|
|
68
|
-
const
|
|
69
|
+
const _orders = customArray || values || []
|
|
70
|
+
const uniqueOrders: any = []
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (loading || error) return
|
|
75
|
+
const orders = _orders.map((order: any) => order?.cart_group_id
|
|
76
|
+
? _orders
|
|
77
|
+
.filter((_order : any) => _order?.cart_group_id === order?.cart_group_id)
|
|
78
|
+
?.reduce((orderCompleted : any, currentOrder : any) => ({
|
|
79
|
+
...orderCompleted,
|
|
80
|
+
total: orderCompleted.summary?.total + currentOrder?.summary?.total,
|
|
81
|
+
business: [orderCompleted.business, currentOrder.business].flat(),
|
|
82
|
+
business_id: [orderCompleted.business_id, currentOrder.business_id].flat(),
|
|
83
|
+
id: [orderCompleted.id, currentOrder.id].flat(),
|
|
84
|
+
review: orderCompleted.review && currentOrder.review,
|
|
85
|
+
user_review: orderCompleted.user_review && currentOrder.user_review,
|
|
86
|
+
products: [orderCompleted.products, currentOrder.products].flat()
|
|
87
|
+
}))
|
|
88
|
+
: order)
|
|
89
|
+
.filter((order: any) => {
|
|
90
|
+
const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
|
|
91
|
+
if (!isDuplicate) {
|
|
92
|
+
uniqueOrders.push(order?.cart_group_id)
|
|
93
|
+
return true
|
|
94
|
+
}
|
|
95
|
+
return false
|
|
96
|
+
})
|
|
97
|
+
setOrders(orders)
|
|
98
|
+
}, [JSON.stringify(_orders)])
|
|
69
99
|
|
|
70
100
|
const getOrderStatus = (s: string) => {
|
|
71
101
|
const status = parseInt(s)
|
|
@@ -219,7 +249,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
219
249
|
)}
|
|
220
250
|
</>
|
|
221
251
|
)}
|
|
222
|
-
{isBusiness && !!businessesSearchList && businesses?.loading &&
|
|
252
|
+
{isBusiness && !!businessesSearchList && businesses?.loading && (
|
|
223
253
|
<ScrollView horizontal>
|
|
224
254
|
<BusinessControllerSkeletons paginationProps={businessPaginationProps} />
|
|
225
255
|
</ScrollView>
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
ActionContainer,
|
|
12
12
|
SkipButton,
|
|
13
13
|
RatingBarContainer,
|
|
14
|
-
RatingTextContainer
|
|
14
|
+
RatingTextContainer,
|
|
15
|
+
MultiLogosContainer
|
|
15
16
|
} from './styles'
|
|
16
17
|
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
17
18
|
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
@@ -215,14 +216,30 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
215
216
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
216
217
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
217
218
|
/>
|
|
218
|
-
<BusinessLogo>
|
|
219
|
-
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
<BusinessLogo isMulti={order?.business?.length > 1}>
|
|
220
|
+
{typeof order?.logo === 'string' || !order?.logo ? (
|
|
221
|
+
<View style={styles.logoWrapper}>
|
|
222
|
+
<OIcon
|
|
223
|
+
url={order?.logo}
|
|
224
|
+
width={80}
|
|
225
|
+
height={80}
|
|
226
|
+
/>
|
|
227
|
+
</View>
|
|
228
|
+
) : (
|
|
229
|
+
<MultiLogosContainer>
|
|
230
|
+
{order?.logo?.map((logo : string, i : number) => (
|
|
231
|
+
<React.Fragment key={logo}>
|
|
232
|
+
<View style={styles.logoWrapper}>
|
|
233
|
+
<OIcon
|
|
234
|
+
url={logo}
|
|
235
|
+
width={80}
|
|
236
|
+
height={80}
|
|
237
|
+
/>
|
|
238
|
+
</View>
|
|
239
|
+
</React.Fragment>
|
|
240
|
+
))}
|
|
241
|
+
</MultiLogosContainer>
|
|
242
|
+
)}
|
|
226
243
|
</BusinessLogo>
|
|
227
244
|
{order?.review ? (
|
|
228
245
|
<View style={styles.reviewedStyle}>
|
|
@@ -42,3 +42,10 @@ export const RatingTextContainer = styled.View`
|
|
|
42
42
|
justify-content: space-between;
|
|
43
43
|
margin-top: 10px;
|
|
44
44
|
`
|
|
45
|
+
|
|
46
|
+
export const MultiLogosContainer = styled.View`
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: space-around;
|
|
49
|
+
flex-direction: row;
|
|
50
|
+
width: 100%;
|
|
51
|
+
`
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
FormReviews,
|
|
9
9
|
ActionContainer,
|
|
10
10
|
RatingStarContainer,
|
|
11
|
-
PlacedDate
|
|
11
|
+
PlacedDate,
|
|
12
|
+
MultiLogosContainer
|
|
12
13
|
} from './styles'
|
|
13
14
|
import { OButton, OIcon, OText } from '../shared'
|
|
14
15
|
import { StyleSheet, View, I18nManager } from 'react-native';
|
|
@@ -79,13 +80,30 @@ export const ReviewTrigger = (props: any) => {
|
|
|
79
80
|
<>
|
|
80
81
|
<ReviewOrderContainer>
|
|
81
82
|
<BusinessLogo>
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
{typeof order?.logo === 'string' || !order?.logo ? (
|
|
84
|
+
<View style={styles.logoWrapper}>
|
|
85
|
+
<OIcon
|
|
86
|
+
url={order?.logo}
|
|
87
|
+
width={80}
|
|
88
|
+
height={80}
|
|
89
|
+
/>
|
|
90
|
+
</View>
|
|
91
|
+
) : (
|
|
92
|
+
<MultiLogosContainer>
|
|
93
|
+
{order?.logo?.map((logo : string, i : number) => (
|
|
94
|
+
<React.Fragment key={logo}>
|
|
95
|
+
<View style={styles.logoWrapper}>
|
|
96
|
+
<OIcon
|
|
97
|
+
url={logo}
|
|
98
|
+
width={80}
|
|
99
|
+
height={80}
|
|
100
|
+
/>
|
|
101
|
+
</View>
|
|
102
|
+
</React.Fragment>
|
|
103
|
+
))}
|
|
104
|
+
</MultiLogosContainer>
|
|
105
|
+
|
|
106
|
+
)}
|
|
89
107
|
</BusinessLogo>
|
|
90
108
|
{!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
|
|
91
109
|
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
|
|
@@ -115,4 +133,4 @@ export const ReviewTrigger = (props: any) => {
|
|
|
115
133
|
</FloatingBottomContainer>
|
|
116
134
|
</>
|
|
117
135
|
)
|
|
118
|
-
}
|
|
136
|
+
}
|
|
@@ -31,4 +31,11 @@ export const RatingStarContainer = styled.View`
|
|
|
31
31
|
`
|
|
32
32
|
export const PlacedDate = styled.View`
|
|
33
33
|
margin-top: 30px;
|
|
34
|
-
`
|
|
34
|
+
`
|
|
35
|
+
|
|
36
|
+
export const MultiLogosContainer = styled.View`
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: space-around;
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
width: 100%;
|
|
41
|
+
`
|
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
ButtonWrapper,
|
|
20
20
|
ContentFooter,
|
|
21
21
|
UnreadMessageCounter,
|
|
22
|
-
Price
|
|
22
|
+
Price,
|
|
23
|
+
MultiLogosContainer
|
|
23
24
|
} from './styles';
|
|
24
25
|
import { LottieAnimation } from '../LottieAnimation';
|
|
25
26
|
import { CardAnimation } from '../shared/CardAnimation';
|
|
@@ -61,6 +62,11 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
61
62
|
width: 64,
|
|
62
63
|
height: 64
|
|
63
64
|
},
|
|
65
|
+
minilogo: {
|
|
66
|
+
borderRadius: 8,
|
|
67
|
+
width: 40,
|
|
68
|
+
height: 40
|
|
69
|
+
},
|
|
64
70
|
logoWrapper: {
|
|
65
71
|
overflow: 'hidden',
|
|
66
72
|
backgroundColor: 'white',
|
|
@@ -141,11 +147,12 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
141
147
|
order: {
|
|
142
148
|
id: order?.id,
|
|
143
149
|
business_id: order?.business_id,
|
|
144
|
-
logo: order?.business?.logo,
|
|
150
|
+
logo: order?.business?.length > 1 ? order?.business?.map?.((business : any) => business?.logo): order?.business?.logo,
|
|
145
151
|
driver: order?.driver,
|
|
146
152
|
products: order?.products,
|
|
147
153
|
review: order?.review,
|
|
148
|
-
user_review: order?.user_review
|
|
154
|
+
user_review: order?.user_review,
|
|
155
|
+
business: order?.business
|
|
149
156
|
},
|
|
150
157
|
});
|
|
151
158
|
return
|
|
@@ -158,13 +165,16 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
158
165
|
onNavigationRedirect('OrderDetails', { orderId: order?.uuid });
|
|
159
166
|
};
|
|
160
167
|
|
|
161
|
-
const handleClickViewOrder = (
|
|
168
|
+
const handleClickViewOrder = (order: any) => {
|
|
162
169
|
if (isMessageView) {
|
|
163
170
|
handleClickOrder(order?.uuid)
|
|
164
171
|
return
|
|
165
172
|
}
|
|
166
|
-
|
|
167
|
-
onNavigationRedirect('
|
|
173
|
+
if (order?.cart_group_id){
|
|
174
|
+
onNavigationRedirect?.('MultiOrdersDetails', { orderId: order?.cart_group_id });
|
|
175
|
+
} else {
|
|
176
|
+
onNavigationRedirect?.('OrderDetails', { orderId: order?.uuid });
|
|
177
|
+
}
|
|
168
178
|
};
|
|
169
179
|
|
|
170
180
|
const handleChangeFavorite = () => {
|
|
@@ -180,24 +190,49 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
180
190
|
return (
|
|
181
191
|
<>
|
|
182
192
|
<CardAnimation
|
|
183
|
-
onClick={() => handleClickViewOrder(order
|
|
193
|
+
onClick={() => handleClickViewOrder(order)}
|
|
184
194
|
style={[styles.container]}
|
|
185
195
|
>
|
|
186
196
|
<InnerContainer>
|
|
187
197
|
{(!!order.business?.logo || theme?.images?.dummies?.businessLogo) && (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
<>
|
|
199
|
+
{order?.business?.length > 1 ? (
|
|
200
|
+
<MultiLogosContainer>
|
|
201
|
+
{order?.business?.map((business: any, i: number) => (
|
|
202
|
+
<View key={business?.id}>
|
|
203
|
+
{i > 1 ? (
|
|
204
|
+
<>
|
|
205
|
+
{console.log(order?.business?.length - 2)}
|
|
206
|
+
<OText mRight={3}> + {order?.business?.length - 2}</OText>
|
|
207
|
+
</>
|
|
208
|
+
) : (
|
|
209
|
+
<Logo style={styles.logoWrapper} isMulti>
|
|
210
|
+
<OIcon
|
|
211
|
+
url={optimizeImage(business?.logo, 'h_300,c_limit')}
|
|
212
|
+
src={optimizeImage(!business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
|
|
213
|
+
style={styles.minilogo}
|
|
214
|
+
/>
|
|
215
|
+
</Logo>
|
|
216
|
+
)}
|
|
217
|
+
</View>
|
|
218
|
+
))}
|
|
219
|
+
</MultiLogosContainer>
|
|
220
|
+
) : (
|
|
221
|
+
<Logo style={styles.logoWrapper}>
|
|
222
|
+
<OIcon
|
|
223
|
+
url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
|
|
224
|
+
src={optimizeImage(!order.business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
|
|
225
|
+
style={styles.logo}
|
|
226
|
+
/>
|
|
227
|
+
</Logo>
|
|
228
|
+
)}
|
|
229
|
+
</>
|
|
195
230
|
)}
|
|
196
231
|
<CardInfoWrapper>
|
|
197
232
|
<ContentHeader>
|
|
198
233
|
<View style={{ flex: 1 }}>
|
|
199
234
|
<OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
|
|
200
|
-
{order.business?.name}
|
|
235
|
+
{order?.business?.length > 1 ? `${t('GROUP_ORDER', 'Group Order')} ${t('No', 'No')}. ${order?.cart_group_id}` : order.business?.name}
|
|
201
236
|
</OText>
|
|
202
237
|
</View>
|
|
203
238
|
{!!!pastOrders && (
|
|
@@ -253,7 +288,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
253
288
|
<ContentFooter>
|
|
254
289
|
<View style={{ flex: 1 }}>
|
|
255
290
|
<View style={styles.infoText}>
|
|
256
|
-
{!!!pastOrders && (
|
|
291
|
+
{(!!!pastOrders || order?.business?.length > 1) && (
|
|
257
292
|
<>
|
|
258
293
|
<OText
|
|
259
294
|
size={10}
|
|
@@ -263,7 +298,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
263
298
|
lineHeight={15}
|
|
264
299
|
numberOfLines={1}
|
|
265
300
|
>
|
|
266
|
-
{t('ORDER_NO', 'Order No') + '.'}
|
|
301
|
+
{order?.business?.length > 1 ? order?.business?.length : (t('ORDER_NO', 'Order No') + '.')}
|
|
267
302
|
</OText>
|
|
268
303
|
<OText
|
|
269
304
|
size={10}
|
|
@@ -272,7 +307,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
272
307
|
lineHeight={15}
|
|
273
308
|
numberOfLines={1}
|
|
274
309
|
>
|
|
275
|
-
{order.id + ` \u2022 `}
|
|
310
|
+
{order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : order.id + ` \u2022 `}
|
|
276
311
|
</OText>
|
|
277
312
|
</>
|
|
278
313
|
)}
|
|
@@ -293,7 +328,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
293
328
|
{getOrderStatus(order.status)?.value}
|
|
294
329
|
</OText>
|
|
295
330
|
</View>
|
|
296
|
-
{!isMessageView && (
|
|
331
|
+
{!isMessageView && !order?.business?.length && (
|
|
297
332
|
<LottieAnimation
|
|
298
333
|
type='favorite'
|
|
299
334
|
onClick={handleChangeFavorite}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const InnerContainer = styled.View`
|
|
4
4
|
flex-direction: row;
|
|
@@ -8,6 +8,9 @@ export const InnerContainer = styled.View`
|
|
|
8
8
|
export const Logo = styled.View`
|
|
9
9
|
border-radius: 7.6px;
|
|
10
10
|
margin-right: 12px;
|
|
11
|
+
${({ isMulti } : any) => isMulti && css`
|
|
12
|
+
margin-right: 5px;
|
|
13
|
+
`}
|
|
11
14
|
`
|
|
12
15
|
|
|
13
16
|
export const CardInfoWrapper = styled.View`
|
|
@@ -45,3 +48,9 @@ export const Price = styled.View`
|
|
|
45
48
|
margin-left: 10px;
|
|
46
49
|
width: 30%;
|
|
47
50
|
`
|
|
51
|
+
|
|
52
|
+
export const MultiLogosContainer = styled.View`
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
`
|