ordering-ui-react-native 0.16.77-release → 0.16.78-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/business/index.tsx +2 -0
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +12 -4
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +14 -9
- package/themes/business/src/types/index.tsx +17 -10
- package/themes/business/src/utils/index.tsx +27 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +92 -71
- package/themes/original/src/components/DriverTips/index.tsx +6 -1
package/package.json
CHANGED
|
@@ -41,6 +41,7 @@ import { MapViewUI as MapView } from './src/components/MapView'
|
|
|
41
41
|
import { NewOrderNotification } from './src/components/NewOrderNotification';
|
|
42
42
|
import { DriverSchedule } from './src/components/DriverSchedule';
|
|
43
43
|
import { ScheduleBlocked } from './src/components/ScheduleBlocked';
|
|
44
|
+
import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
|
|
44
45
|
//OComponents
|
|
45
46
|
import {
|
|
46
47
|
OText,
|
|
@@ -110,6 +111,7 @@ export {
|
|
|
110
111
|
VerifyPhone,
|
|
111
112
|
DriverSchedule,
|
|
112
113
|
ScheduleBlocked,
|
|
114
|
+
OrderDetailsLogistic,
|
|
113
115
|
//OComponents
|
|
114
116
|
OAlert,
|
|
115
117
|
OButton,
|
|
@@ -52,7 +52,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
52
52
|
handleClickLogisticOrder,
|
|
53
53
|
forceUpdate,
|
|
54
54
|
getPermissions,
|
|
55
|
-
|
|
55
|
+
orderAssingId,
|
|
56
|
+
isGrantedPermissions,
|
|
56
57
|
} = props;
|
|
57
58
|
const [, { showToast }] = useToast();
|
|
58
59
|
const { order } = props.order
|
|
@@ -154,12 +155,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
const handleRejectLogisticOrder = () => {
|
|
157
|
-
handleClickLogisticOrder?.(2, order?.logistic_order_id)
|
|
158
|
+
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
|
|
158
159
|
handleArrowBack()
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
const handleAcceptLogisticOrder = (order: any) => {
|
|
162
|
-
handleClickLogisticOrder?.(1, order?.logistic_order_id)
|
|
163
|
+
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
|
|
163
164
|
if (order?.order_group) {
|
|
164
165
|
handleArrowBack()
|
|
165
166
|
}
|
|
@@ -16,12 +16,13 @@ import {
|
|
|
16
16
|
|
|
17
17
|
import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
18
18
|
|
|
19
|
-
import { verifyDecimals } from '../../utils';
|
|
19
|
+
import { verifyDecimals, calculateDistance, transformDistance } from '../../utils';
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
useLanguage,
|
|
23
23
|
useUtils,
|
|
24
24
|
useConfig,
|
|
25
|
+
useSession
|
|
25
26
|
} from 'ordering-components/native';
|
|
26
27
|
import { useTheme } from 'styled-components/native';
|
|
27
28
|
import { ReviewCustomer } from '../ReviewCustomer'
|
|
@@ -38,10 +39,13 @@ interface OrderContent {
|
|
|
38
39
|
export const OrderContentComponent = (props: OrderContent) => {
|
|
39
40
|
const [, t] = useLanguage();
|
|
40
41
|
const theme = useTheme()
|
|
41
|
-
|
|
42
|
+
const [{user}] = useSession()
|
|
43
|
+
console.log(user)
|
|
42
44
|
const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
|
|
43
45
|
const [{ parsePrice, parseNumber }] = useUtils();
|
|
44
46
|
const [{ configs }] = useConfig();
|
|
47
|
+
const distanceUnit = configs?.distance_unit?.value
|
|
48
|
+
|
|
45
49
|
const [openReviewModal, setOpenReviewModal] = useState(false)
|
|
46
50
|
|
|
47
51
|
const [isReadMore, setIsReadMore] = useState(false)
|
|
@@ -105,7 +109,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
105
109
|
return (
|
|
106
110
|
<OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
|
|
107
111
|
{isOrderGroup && (
|
|
108
|
-
<OText size={18}>{t('ORDER', 'Order')} #{
|
|
112
|
+
<OText size={18}>{t('ORDER', 'Order')} #{order?.id}</OText>
|
|
109
113
|
)}
|
|
110
114
|
|
|
111
115
|
{order?.metafields?.length > 0 && (
|
|
@@ -193,7 +197,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
193
197
|
/>
|
|
194
198
|
</View>
|
|
195
199
|
)}
|
|
196
|
-
|
|
200
|
+
{!!order?.business?.location && (
|
|
201
|
+
<OText>
|
|
202
|
+
{t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, user?.location), distanceUnit)} {t(distanceUnit.toUpperCase(), distanceUnit)}
|
|
203
|
+
</OText>
|
|
204
|
+
)}
|
|
197
205
|
{!!order?.business?.address_notes && (
|
|
198
206
|
<View style={styles.linkWithIcons}>
|
|
199
207
|
<OLink
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
//React & React Native
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// Thirds
|
|
6
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
7
|
+
|
|
8
|
+
//OrderingComponent
|
|
9
|
+
import {
|
|
10
|
+
useLanguage,
|
|
11
|
+
OrderDetails as OrderDetailsConTableoller,
|
|
12
|
+
useSession,
|
|
13
|
+
} from 'ordering-components/native';
|
|
14
|
+
|
|
15
|
+
//Components
|
|
16
|
+
import Alert from '../../providers/AlertProvider';
|
|
17
|
+
import { FloatingButton } from '../FloatingButton';
|
|
18
|
+
import { OrderDetailsLogisticParams } from '../../types';
|
|
19
|
+
import { useTheme } from 'styled-components/native';
|
|
20
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
21
|
+
import { getOrderStatus } from '../../utils';
|
|
22
|
+
import { OrderHeaderComponent } from '../OrderDetails/OrderHeaderComponent';
|
|
23
|
+
import { OrderContentComponent } from '../OrderDetails/OrderContentComponent';
|
|
24
|
+
//Styles
|
|
25
|
+
import { OrderDetailsContainer } from './styles';
|
|
26
|
+
|
|
27
|
+
export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
28
|
+
const {
|
|
29
|
+
navigation,
|
|
30
|
+
handleClickLogisticOrder,
|
|
31
|
+
orderAssingId,
|
|
32
|
+
} = props;
|
|
33
|
+
const { order } = props.order
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const [, t] = useLanguage();
|
|
36
|
+
const [session] = useSession();
|
|
37
|
+
const [alertState, setAlertState] = useState<{
|
|
38
|
+
open: boolean;
|
|
39
|
+
content: Array<string>;
|
|
40
|
+
key?: string | null;
|
|
41
|
+
}>({ open: false, content: [], key: null });
|
|
42
|
+
|
|
43
|
+
const logisticOrderStatus = [4, 6, 7]
|
|
44
|
+
|
|
45
|
+
const showFloatButtonsAcceptOrReject: any = {
|
|
46
|
+
0: true,
|
|
47
|
+
4: true,
|
|
48
|
+
7: true,
|
|
49
|
+
14: true
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleArrowBack: any = () => {
|
|
53
|
+
navigation?.canGoBack() && navigation.goBack();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleRejectLogisticOrder = (order: any) => {
|
|
57
|
+
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
|
|
58
|
+
handleArrowBack()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleAcceptLogisticOrder = (order: any) => {
|
|
62
|
+
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
|
|
63
|
+
handleArrowBack()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (order?.driver === null && session?.user?.level === 4) {
|
|
68
|
+
setAlertState({
|
|
69
|
+
open: true,
|
|
70
|
+
content: [
|
|
71
|
+
t(
|
|
72
|
+
'YOU_HAVE_BEEN_REMOVED_FROM_THE_ORDER',
|
|
73
|
+
'You have been removed from the order',
|
|
74
|
+
),
|
|
75
|
+
],
|
|
76
|
+
key: null,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, [order?.driver]);
|
|
80
|
+
|
|
81
|
+
const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
|
|
82
|
+
const {
|
|
83
|
+
order,
|
|
84
|
+
isOrderGroup,
|
|
85
|
+
lastOrder,
|
|
86
|
+
} = props
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<OrderContentComponent
|
|
90
|
+
order={order}
|
|
91
|
+
logisticOrderStatus={logisticOrderStatus}
|
|
92
|
+
isOrderGroup={isOrderGroup}
|
|
93
|
+
lastOrder={lastOrder}
|
|
94
|
+
/>
|
|
95
|
+
<View
|
|
96
|
+
style={{
|
|
97
|
+
height:
|
|
98
|
+
order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
</>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
{(!order || Object.keys(order).length === 0) &&
|
|
109
|
+
(props.order?.error?.length < 1 || !props.order?.error) && (
|
|
110
|
+
<View style={{ flex: 1 }}>
|
|
111
|
+
{[...Array(6)].map((item, i) => (
|
|
112
|
+
<Placeholder key={i} Animation={Fade}>
|
|
113
|
+
<View style={{ flexDirection: 'row', paddingVertical: 20 }}>
|
|
114
|
+
<Placeholder>
|
|
115
|
+
<PlaceholderLine width={100} />
|
|
116
|
+
<PlaceholderLine width={70} />
|
|
117
|
+
<PlaceholderLine width={30} />
|
|
118
|
+
<PlaceholderLine width={20} />
|
|
119
|
+
</Placeholder>
|
|
120
|
+
</View>
|
|
121
|
+
</Placeholder>
|
|
122
|
+
))}
|
|
123
|
+
</View>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
{(!!props.order?.error || props.order?.error) && (
|
|
127
|
+
<NotFoundSource
|
|
128
|
+
btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
|
|
129
|
+
content={
|
|
130
|
+
props.order.error[0] ||
|
|
131
|
+
props.order.error ||
|
|
132
|
+
t('NETWORK_ERROR', 'Network Error')
|
|
133
|
+
}
|
|
134
|
+
onClickButton={() => navigation.navigate('Orders')}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
{!((!order || Object.keys(order).length === 0) &&
|
|
138
|
+
(props.order?.error?.length < 1 || !props.order?.error)) && (
|
|
139
|
+
<View style={{ flex: 1 }}>
|
|
140
|
+
<OrderHeaderComponent
|
|
141
|
+
order={order}
|
|
142
|
+
getOrderStatus={getOrderStatus}
|
|
143
|
+
handleArrowBack={handleArrowBack}
|
|
144
|
+
logisticOrderStatus={logisticOrderStatus}
|
|
145
|
+
/>
|
|
146
|
+
{order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
|
|
147
|
+
<>
|
|
148
|
+
<OrderDetailsContainer
|
|
149
|
+
keyboardShouldPersistTaps="handled"
|
|
150
|
+
showsVerticalScrollIndicator={false}
|
|
151
|
+
>
|
|
152
|
+
{order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
|
|
153
|
+
<OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
|
|
154
|
+
)) : (
|
|
155
|
+
<OrderDetailsInformation order={order} />
|
|
156
|
+
)}
|
|
157
|
+
</OrderDetailsContainer>
|
|
158
|
+
|
|
159
|
+
{showFloatButtonsAcceptOrReject[order?.status] && (
|
|
160
|
+
<FloatingButton
|
|
161
|
+
btnText={t('REJECT', 'Reject')}
|
|
162
|
+
isSecondaryBtn={false}
|
|
163
|
+
secondButtonClick={() => handleAcceptLogisticOrder(order)}
|
|
164
|
+
firstButtonClick={() => handleRejectLogisticOrder(order)}
|
|
165
|
+
secondBtnText={t('ACCEPT', 'Accept')}
|
|
166
|
+
secondButton={true}
|
|
167
|
+
firstColorCustom={theme.colors.red}
|
|
168
|
+
secondColorCustom={theme.colors.green}
|
|
169
|
+
widthButton={'45%'}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</>
|
|
173
|
+
)}
|
|
174
|
+
</View>
|
|
175
|
+
)}
|
|
176
|
+
{alertState?.open && (
|
|
177
|
+
<Alert
|
|
178
|
+
open={alertState.open}
|
|
179
|
+
onAccept={handleArrowBack}
|
|
180
|
+
onClose={handleArrowBack}
|
|
181
|
+
content={alertState.content}
|
|
182
|
+
title={t('WARNING', 'Warning')}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const OrderDetailsLogistic = (props: OrderDetailsLogisticParams) => {
|
|
190
|
+
const orderDetailsProps = {
|
|
191
|
+
...props,
|
|
192
|
+
UIComponent: OrderDetailsLogisticUI,
|
|
193
|
+
};
|
|
194
|
+
return <OrderDetailsConTableoller {...orderDetailsProps} />;
|
|
195
|
+
};
|
|
@@ -48,8 +48,13 @@ export const PreviousOrders = (props: any) => {
|
|
|
48
48
|
if (props.handleClickEvent) {
|
|
49
49
|
props.handleClickEvent({ ...order, isLogistic: isLogisticOrder })
|
|
50
50
|
} else {
|
|
51
|
-
|
|
52
|
-
onNavigationRedirect
|
|
51
|
+
if (isLogisticOrder){
|
|
52
|
+
onNavigationRedirect &&
|
|
53
|
+
onNavigationRedirect('OrderDetailsLogistic', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
|
|
54
|
+
} else {
|
|
55
|
+
onNavigationRedirect &&
|
|
56
|
+
onNavigationRedirect('OrderDetails', { order });
|
|
57
|
+
}
|
|
53
58
|
}
|
|
54
59
|
};
|
|
55
60
|
|
|
@@ -81,29 +86,29 @@ export const PreviousOrders = (props: any) => {
|
|
|
81
86
|
imgRightSrc={null}
|
|
82
87
|
style={{ borderRadius: 7, height: 40 }}
|
|
83
88
|
parentStyle={{ width: '100%' }}
|
|
84
|
-
textStyle={{ color: theme
|
|
89
|
+
textStyle={{ color: theme?.colors?.white }}
|
|
85
90
|
/>
|
|
86
91
|
) : (
|
|
87
92
|
<>
|
|
88
93
|
<OButton
|
|
89
94
|
text={t('REJECT', 'Reject')}
|
|
90
95
|
onClick={() => handleClickLogisticOrder(2, _order?.id)}
|
|
91
|
-
bgColor={theme.colors.
|
|
92
|
-
borderColor={theme.colors.
|
|
96
|
+
bgColor={theme.colors.red}
|
|
97
|
+
borderColor={theme.colors.red}
|
|
93
98
|
imgRightSrc={null}
|
|
94
99
|
style={{ borderRadius: 7, height: 40 }}
|
|
95
100
|
parentStyle={{ width: '45%' }}
|
|
96
|
-
textStyle={{ color: theme.colors.
|
|
101
|
+
textStyle={{ color: theme.colors.white }}
|
|
97
102
|
/>
|
|
98
103
|
<OButton
|
|
99
104
|
text={t('ACCEPT', 'Accept')}
|
|
100
105
|
onClick={() => handleClickLogisticOrder(1, _order?.id)}
|
|
101
|
-
bgColor={theme.colors.
|
|
102
|
-
borderColor={theme.colors.
|
|
106
|
+
bgColor={theme.colors.green}
|
|
107
|
+
borderColor={theme.colors.green}
|
|
103
108
|
imgRightSrc={null}
|
|
104
109
|
style={{ borderRadius: 7, height: 40 }}
|
|
105
110
|
parentStyle={{ width: '45%' }}
|
|
106
|
-
textStyle={{ color: theme.colors.
|
|
111
|
+
textStyle={{ color: theme.colors.white }}
|
|
107
112
|
/>
|
|
108
113
|
</>
|
|
109
114
|
)}
|
|
@@ -25,18 +25,18 @@ export interface LoginParams {
|
|
|
25
25
|
enableReCaptcha?: any;
|
|
26
26
|
|
|
27
27
|
otpType?: string,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
setOtpType: (type: string) => void,
|
|
29
|
+
generateOtpCode: (values?: any) => void,
|
|
30
|
+
useLoginOtpEmail?: boolean,
|
|
31
|
+
useLoginOtpCellphone?: boolean,
|
|
32
|
+
useLoginOtp?: boolean
|
|
33
33
|
}
|
|
34
34
|
export interface otpParams {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
willVerifyOtpState: boolean,
|
|
36
|
+
setWillVerifyOtpState: (val: boolean) => void,
|
|
37
|
+
onSubmit: () => void,
|
|
38
|
+
handleLoginOtp: (code: string) => void,
|
|
39
|
+
setAlertState: any,
|
|
40
40
|
formState?: any
|
|
41
41
|
}
|
|
42
42
|
export interface ProfileParams {
|
|
@@ -612,3 +612,10 @@ export interface ReviewCustomerParams {
|
|
|
612
612
|
export interface NoNetworkParams {
|
|
613
613
|
image?: any;
|
|
614
614
|
}
|
|
615
|
+
|
|
616
|
+
export interface OrderDetailsLogisticParams {
|
|
617
|
+
navigation: any,
|
|
618
|
+
handleClickLogisticOrder: any,
|
|
619
|
+
orderAssingId: number,
|
|
620
|
+
order: any
|
|
621
|
+
}
|
|
@@ -369,3 +369,30 @@ export const formatSeconds = (seconds : number) => {
|
|
|
369
369
|
ret += '' + secs
|
|
370
370
|
return ret
|
|
371
371
|
}
|
|
372
|
+
|
|
373
|
+
export const calculateDistance = (
|
|
374
|
+
pointA: { lat: number; lng: number },
|
|
375
|
+
pointB: { latitude: number; longitude: number },
|
|
376
|
+
) => {
|
|
377
|
+
const lat1 = pointA.lat;
|
|
378
|
+
const lon1 = pointA.lng;
|
|
379
|
+
|
|
380
|
+
const lat2 = pointB.latitude;
|
|
381
|
+
const lon2 = pointB.longitude;
|
|
382
|
+
|
|
383
|
+
const R = 6371e3;
|
|
384
|
+
const φ1 = lat1 * (Math.PI / 180);
|
|
385
|
+
const φ2 = lat2 * (Math.PI / 180);
|
|
386
|
+
const Δφ = (lat2 - lat1) * (Math.PI / 180);
|
|
387
|
+
const Δλ = (lon2 - lon1) * (Math.PI / 180);
|
|
388
|
+
|
|
389
|
+
const a =
|
|
390
|
+
Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
|
|
391
|
+
Math.cos(φ1) * Math.cos(φ2) * (Math.sin(Δλ / 2) * Math.sin(Δλ / 2));
|
|
392
|
+
|
|
393
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
394
|
+
|
|
395
|
+
const distance = R * c;
|
|
396
|
+
const distanceInKm = distance / 1000;
|
|
397
|
+
return distanceInKm;
|
|
398
|
+
};
|
|
@@ -46,8 +46,16 @@ export const BusinessBasicInformation = (
|
|
|
46
46
|
const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
|
|
47
47
|
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
48
48
|
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
49
|
-
|
|
50
|
-
const
|
|
49
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
50
|
+
const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
51
|
+
const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
|
|
52
|
+
const hideTime = theme?.business_view?.components?.header?.components?.business?.components?.time?.hidden
|
|
53
|
+
const hideReviews = theme?.business_view?.components?.header?.components?.business?.components?.reviews?.hidden
|
|
54
|
+
const hideReviewsPopup = theme?.business_view?.components?.header?.components?.reviews?.hidden
|
|
55
|
+
const hideDistance = theme?.business_view?.components?.header?.components?.business?.components?.distance?.hidden
|
|
56
|
+
const hideInfoIcon = theme?.business_view?.components?.header?.components?.business?.components?.business_info?.hidden
|
|
57
|
+
const hideCity = theme?.business_view?.components?.header?.components?.business?.components?.city?.hidden
|
|
58
|
+
const hideHeader = theme?.business_view?.components?.header?.hidden
|
|
51
59
|
|
|
52
60
|
const styles = StyleSheet.create({
|
|
53
61
|
businesInfoheaderStyle: {
|
|
@@ -249,9 +257,9 @@ export const BusinessBasicInformation = (
|
|
|
249
257
|
iconTitle='snapchat'
|
|
250
258
|
/>
|
|
251
259
|
)}
|
|
252
|
-
{isChewLayout && (
|
|
260
|
+
{isChewLayout && !hideInfoIcon && (
|
|
253
261
|
<TouchableOpacity onPress={() => handleClickBusinessInformation()}>
|
|
254
|
-
<OText
|
|
262
|
+
<OText
|
|
255
263
|
color={theme.colors.primary}
|
|
256
264
|
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
257
265
|
size={12}
|
|
@@ -267,44 +275,46 @@ export const BusinessBasicInformation = (
|
|
|
267
275
|
}
|
|
268
276
|
|
|
269
277
|
return (
|
|
270
|
-
<BusinessContainer isChewLayout={isChewLayout &&
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
<
|
|
293
|
-
{
|
|
294
|
-
|
|
295
|
-
{business?.city?.name && (
|
|
296
|
-
<OText>
|
|
297
|
-
{business?.city?.name}
|
|
278
|
+
<BusinessContainer isChewLayout={isChewLayout && hideLogo}>
|
|
279
|
+
{!hideHeader && (
|
|
280
|
+
<BusinessHeader
|
|
281
|
+
isChewLayout={isChewLayout}
|
|
282
|
+
style={
|
|
283
|
+
isBusinessInfoShow
|
|
284
|
+
? styles.businesInfoheaderStyle
|
|
285
|
+
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
286
|
+
}
|
|
287
|
+
{...(!loading && {
|
|
288
|
+
source: (header || businessState?.business?.header) ? {
|
|
289
|
+
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header
|
|
290
|
+
} : theme?.images?.dummies?.businessHeader
|
|
291
|
+
})}
|
|
292
|
+
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
293
|
+
>
|
|
294
|
+
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
295
|
+
<WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
|
|
296
|
+
<OIcon src={theme.images.general.info} width={24} />
|
|
297
|
+
</WrapBusinessInfo>
|
|
298
|
+
)}
|
|
299
|
+
{isChewLayout && !loading && (
|
|
300
|
+
<View style={styles.headerChewStyle}>
|
|
301
|
+
<OText size={24} weight={'600'} mBottom={-5}>
|
|
302
|
+
{business?.name}
|
|
298
303
|
</OText>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
{business?.city?.name && !hideCity && (
|
|
305
|
+
<OText>
|
|
306
|
+
{business?.city?.name}
|
|
307
|
+
</OText>
|
|
308
|
+
)}
|
|
309
|
+
<View style={styles.socialIconsChewContainer}>
|
|
310
|
+
<SocialIcons />
|
|
311
|
+
</View>
|
|
302
312
|
</View>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
313
|
+
)}
|
|
314
|
+
</BusinessHeader>
|
|
315
|
+
)}
|
|
306
316
|
<BusinessInfo style={styles.businessInfo}>
|
|
307
|
-
{
|
|
317
|
+
{!hideLogo && (
|
|
308
318
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
309
319
|
{!isBusinessInfoShow && (
|
|
310
320
|
logo || businessState?.business?.logo ?
|
|
@@ -384,34 +394,43 @@ export const BusinessBasicInformation = (
|
|
|
384
394
|
</Placeholder>
|
|
385
395
|
)}
|
|
386
396
|
<View style={styles.bullet}>
|
|
387
|
-
|
|
388
|
-
{`${t('DELIVERY_FEE', 'Delivery fee')} ${business && parsePrice(business?.delivery_price || 0)} \u2022 `}
|
|
389
|
-
</OText>
|
|
390
|
-
{orderState?.options?.type === 1 ? (
|
|
397
|
+
{!hideDeliveryFee && (
|
|
391
398
|
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
392
|
-
{
|
|
399
|
+
{`${t('DELIVERY_FEE', 'Delivery fee')} ${business && parsePrice(business?.delivery_price || 0)} \u2022 `}
|
|
393
400
|
</OText>
|
|
394
|
-
)
|
|
401
|
+
)}
|
|
402
|
+
{!hideTime && (
|
|
403
|
+
<>
|
|
404
|
+
{orderState?.options?.type === 1 ? (
|
|
405
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
406
|
+
{convertHoursToMinutes(business?.delivery_time) + ` \u2022 `}
|
|
407
|
+
</OText>
|
|
408
|
+
) : (
|
|
409
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
410
|
+
{convertHoursToMinutes(business?.pickup_time) + ` \u2022 `}
|
|
411
|
+
</OText>
|
|
412
|
+
)}
|
|
413
|
+
</>
|
|
414
|
+
)}
|
|
415
|
+
{!hideDistance && (
|
|
395
416
|
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
396
|
-
{
|
|
417
|
+
{parseDistance(business?.distance || 0) + ` \u2022 `}
|
|
397
418
|
</OText>
|
|
398
419
|
)}
|
|
399
|
-
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
400
|
-
{parseDistance(business?.distance || 0) + ` \u2022 `}
|
|
401
|
-
</OText>
|
|
402
|
-
</View>
|
|
403
|
-
|
|
404
|
-
<View style={styles.reviewStyle}>
|
|
405
|
-
<OIcon
|
|
406
|
-
src={theme.images.general.star}
|
|
407
|
-
width={14}
|
|
408
|
-
color={theme.colors.textSecondary}
|
|
409
|
-
style={{ marginTop: -2, marginEnd: 2 }}
|
|
410
|
-
/>
|
|
411
|
-
<OText size={12} color={theme.colors.textSecondary}>
|
|
412
|
-
{business?.reviews?.total}
|
|
413
|
-
</OText>
|
|
414
420
|
</View>
|
|
421
|
+
{!hideReviews && (
|
|
422
|
+
<View style={styles.reviewStyle}>
|
|
423
|
+
<OIcon
|
|
424
|
+
src={theme.images.general.star}
|
|
425
|
+
width={14}
|
|
426
|
+
color={theme.colors.textSecondary}
|
|
427
|
+
style={{ marginTop: -2, marginEnd: 2 }}
|
|
428
|
+
/>
|
|
429
|
+
<OText size={12} color={theme.colors.textSecondary}>
|
|
430
|
+
{business?.reviews?.total}
|
|
431
|
+
</OText>
|
|
432
|
+
</View>
|
|
433
|
+
)}
|
|
415
434
|
</BusinessInfoItem>
|
|
416
435
|
</View>
|
|
417
436
|
<WrapReviews>
|
|
@@ -420,7 +439,7 @@ export const BusinessBasicInformation = (
|
|
|
420
439
|
{isPreOrder && (!business?.professionals || business?.professionals?.length === 0) && (
|
|
421
440
|
<>
|
|
422
441
|
<TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
|
|
423
|
-
<OText
|
|
442
|
+
<OText
|
|
424
443
|
color={theme.colors.primary}
|
|
425
444
|
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
426
445
|
size={12}
|
|
@@ -431,15 +450,17 @@ export const BusinessBasicInformation = (
|
|
|
431
450
|
<OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
432
451
|
</>
|
|
433
452
|
)}
|
|
434
|
-
|
|
435
|
-
<
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
453
|
+
{!hideReviewsPopup && (
|
|
454
|
+
<TouchableOpacity onPress={() => handleClickBusinessReviews()}>
|
|
455
|
+
<OText
|
|
456
|
+
color={theme.colors.primary}
|
|
457
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
458
|
+
size={12}
|
|
459
|
+
>
|
|
460
|
+
{t('REVIEWS', 'Reviews')}
|
|
461
|
+
</OText>
|
|
462
|
+
</TouchableOpacity>
|
|
463
|
+
)}
|
|
443
464
|
</>
|
|
444
465
|
)}
|
|
445
466
|
</WrapReviews>
|
|
@@ -24,6 +24,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
24
24
|
driverTipsOptions,
|
|
25
25
|
isMulti,
|
|
26
26
|
cart,
|
|
27
|
+
carts,
|
|
27
28
|
isDriverTipUseCustom,
|
|
28
29
|
handlerChangeOption,
|
|
29
30
|
isFixedPrice
|
|
@@ -64,6 +65,10 @@ const DriverTipsUI = (props: any) => {
|
|
|
64
65
|
setvalue(val)
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
const multiCartTipsAmmout = carts?.reduce((total: any, cart: any) => {
|
|
69
|
+
return total + parseFloat(cart?.driver_tip || 0)
|
|
70
|
+
}, 0)
|
|
71
|
+
|
|
67
72
|
return (
|
|
68
73
|
<DTContainer>
|
|
69
74
|
<DTLabel>
|
|
@@ -138,7 +143,7 @@ const DriverTipsUI = (props: any) => {
|
|
|
138
143
|
style={{ marginTop: 10, textAlign: 'center' }}
|
|
139
144
|
>
|
|
140
145
|
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
|
|
141
|
-
` (${driverTip}%)`}: {isFixedPrice ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
|
|
146
|
+
` (${driverTip}%)`}: {isFixedPrice ? parsePrice(multiCartTipsAmmout ?? driverTip) : parsePrice(multiCartTipsAmmout ?? cart?.driver_tip)}
|
|
142
147
|
</OText>
|
|
143
148
|
)}
|
|
144
149
|
</DTContainer>
|