ordering-ui-react-native 0.18.10 → 0.18.12
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/src/components/AcceptOrRejectOrder/index.tsx +20 -17
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +2 -2
- package/themes/business/src/utils/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
- package/themes/original/src/components/BusinessController/index.tsx +5 -5
- package/themes/original/src/components/BusinessInformation/index.tsx +97 -70
- package/themes/original/src/components/Messages/index.tsx +1 -1
- package/themes/original/src/components/MultiCheckout/index.tsx +4 -2
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
- package/themes/original/src/components/OrderDetails/index.tsx +7 -8
- package/themes/original/src/components/OrderProgress/index.tsx +3 -11
- package/themes/original/src/components/SingleOrderCard/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/shared/OButton.tsx +2 -2
package/package.json
CHANGED
|
@@ -7,13 +7,14 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
KeyboardAvoidingView,
|
|
9
9
|
TextInput,
|
|
10
|
-
StyleSheet
|
|
10
|
+
StyleSheet,
|
|
11
|
+
TouchableOpacity
|
|
11
12
|
} from 'react-native';
|
|
12
13
|
import { useTheme } from 'styled-components/native';
|
|
13
14
|
import SelectDropdown from 'react-native-select-dropdown'
|
|
14
15
|
import { useLanguage } from 'ordering-components/native';
|
|
15
16
|
import { Content, Timer, TimeField, Header, Comments, CommentsButtonGroup, TopActions } from './styles';
|
|
16
|
-
import { OText, OButton, OTextarea,
|
|
17
|
+
import { OText, OButton, OTextarea, OIcon } from '../shared';
|
|
17
18
|
import { AcceptOrRejectOrderParams } from '../../types';
|
|
18
19
|
|
|
19
20
|
import { orderCommentList } from '../../../../../src/utils'
|
|
@@ -95,7 +96,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
95
96
|
upper: {
|
|
96
97
|
flex: 1,
|
|
97
98
|
zIndex: 1001,
|
|
98
|
-
paddingTop: isPage ? 30 :
|
|
99
|
+
paddingTop: isPage ? 30 : 40,
|
|
99
100
|
marginBottom: 10,
|
|
100
101
|
backgroundColor: theme.colors.backgroundPage
|
|
101
102
|
},
|
|
@@ -109,7 +110,18 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
109
110
|
bottom: {
|
|
110
111
|
textAlignVertical: "center",
|
|
111
112
|
textAlign: "center",
|
|
112
|
-
}
|
|
113
|
+
},
|
|
114
|
+
btnBackArrow: {
|
|
115
|
+
borderWidth: 0,
|
|
116
|
+
width: 32,
|
|
117
|
+
height: 32,
|
|
118
|
+
tintColor: theme.colors.textGray,
|
|
119
|
+
backgroundColor: theme.colors.clear,
|
|
120
|
+
borderColor: theme.colors.clear,
|
|
121
|
+
shadowColor: theme.colors.clear,
|
|
122
|
+
paddingLeft: 0,
|
|
123
|
+
paddingRight: 0
|
|
124
|
+
},
|
|
113
125
|
})
|
|
114
126
|
|
|
115
127
|
const handleFocus = () => {
|
|
@@ -299,18 +311,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
299
311
|
<View style={styles.parent}>
|
|
300
312
|
<View style={styles.upper}>
|
|
301
313
|
<TopActions>
|
|
302
|
-
<
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
iconStyle={{ width: 20, height: 20 }}
|
|
306
|
-
style={{
|
|
307
|
-
maxWidth: 40,
|
|
308
|
-
height: 35,
|
|
309
|
-
justifyContent: 'flex-end',
|
|
310
|
-
marginBottom: 10,
|
|
311
|
-
}}
|
|
312
|
-
onClick={() => handleArrowBack()}
|
|
313
|
-
/>
|
|
314
|
+
<TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
|
|
315
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
|
|
316
|
+
</TouchableOpacity>
|
|
314
317
|
<OText
|
|
315
318
|
size={20}
|
|
316
319
|
color={theme.colors.textGray}
|
|
@@ -518,7 +521,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
518
521
|
imgRightSrc={null}
|
|
519
522
|
style={{ borderRadius: 7, height: 45 }}
|
|
520
523
|
parentStyle={{ width: '100%' }}
|
|
521
|
-
textStyle={{color: '#FFF', fontSize: 18 }}
|
|
524
|
+
textStyle={{ color: '#FFF', fontSize: 18 }}
|
|
522
525
|
isDisabled={!rejectReason && showTextArea}
|
|
523
526
|
onClick={() => handleAcceptOrReject()}
|
|
524
527
|
/>
|
|
@@ -54,12 +54,12 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
const handleRejectLogisticOrder = (order: any) => {
|
|
57
|
-
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id)
|
|
57
|
+
handleClickLogisticOrder?.(2, orderAssingId || order?.logistic_order_id, order)
|
|
58
58
|
handleArrowBack()
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const handleAcceptLogisticOrder = (order: any) => {
|
|
62
|
-
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id)
|
|
62
|
+
handleClickLogisticOrder?.(1, orderAssingId || order?.logistic_order_id, order)
|
|
63
63
|
handleArrowBack()
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -346,7 +346,7 @@ export const getOrderStatus = (s: string, t: any) => {
|
|
|
346
346
|
return objectStatus && objectStatus;
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
-
export const transformDistance = (value
|
|
349
|
+
export const transformDistance = (value: number, distanceUnit?: string) => {
|
|
350
350
|
return distanceUnit === 'mi'
|
|
351
351
|
? (value / 1.609).toFixed(2)
|
|
352
352
|
: distanceUnit === 'ft'
|
|
@@ -354,7 +354,7 @@ export const transformDistance = (value : number, distanceUnit?: string) => {
|
|
|
354
354
|
: (value).toFixed(2)
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
export const formatSeconds = (seconds
|
|
357
|
+
export const formatSeconds = (seconds: number) => {
|
|
358
358
|
// Hours, minutes and seconds
|
|
359
359
|
const hrs = Math.floor(seconds / 3600)
|
|
360
360
|
const mins = Math.floor((seconds % 3600) / 60)
|
|
@@ -377,8 +377,8 @@ export const calculateDistance = (
|
|
|
377
377
|
const lat1 = pointA.lat;
|
|
378
378
|
const lon1 = pointA.lng;
|
|
379
379
|
|
|
380
|
-
const lat2 = pointB
|
|
381
|
-
const lon2 = pointB
|
|
380
|
+
const lat2 = pointB?.latitude;
|
|
381
|
+
const lon2 = pointB?.longitude;
|
|
382
382
|
|
|
383
383
|
const R = 6371e3;
|
|
384
384
|
const φ1 = lat1 * (Math.PI / 180);
|
|
@@ -285,8 +285,8 @@ export const BusinessBasicInformation = (
|
|
|
285
285
|
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
286
286
|
}
|
|
287
287
|
{...(!loading && {
|
|
288
|
-
source: (header || businessState?.business?.header) ? {
|
|
289
|
-
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header
|
|
288
|
+
source: (header || businessState?.business?.header || typeof theme?.images?.dummies?.businessHeader === 'string') ? {
|
|
289
|
+
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header || theme?.images?.dummies?.businessHeader
|
|
290
290
|
} : theme?.images?.dummies?.businessHeader
|
|
291
291
|
})}
|
|
292
292
|
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
@@ -317,11 +317,11 @@ export const BusinessBasicInformation = (
|
|
|
317
317
|
{!hideLogo && (
|
|
318
318
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
319
319
|
{!isBusinessInfoShow && (
|
|
320
|
-
logo || businessState?.business?.logo ?
|
|
320
|
+
logo || businessState?.business?.logo || typeof theme.images.dummies.businessLogo === 'string' ?
|
|
321
321
|
<FastImage
|
|
322
322
|
style={styles.logoStyle}
|
|
323
323
|
source={{
|
|
324
|
-
uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit'),
|
|
324
|
+
uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit') || theme.images.dummies.businessLogo,
|
|
325
325
|
priority: FastImage.priority.high,
|
|
326
326
|
cache: FastImage.cacheControl.web
|
|
327
327
|
}}
|
|
@@ -204,10 +204,10 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
204
204
|
{!hideBusinessHeader && (
|
|
205
205
|
<FastImage
|
|
206
206
|
style={{ height: isCustomLayout ? cardHeight * 0.66 : 120 }}
|
|
207
|
-
source={(businessHeader || business?.header) ? {
|
|
208
|
-
uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
|
|
207
|
+
source={(businessHeader || business?.header || typeof theme.images.dummies.businessHeader === 'string') ? {
|
|
208
|
+
uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
|
|
209
209
|
priority: FastImage.priority.normal,
|
|
210
|
-
} : theme.images.dummies.businessHeader}
|
|
210
|
+
} : theme.images.dummies.businessHeader}
|
|
211
211
|
resizeMode={FastImage.resizeMode.cover}
|
|
212
212
|
/>
|
|
213
213
|
)}
|
|
@@ -247,8 +247,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
247
247
|
<BusinessLogo style={styles.businessLogo}>
|
|
248
248
|
<FastImage
|
|
249
249
|
style={{ width: 56, height: 56 }}
|
|
250
|
-
source={(businessLogo || business?.logo) ? {
|
|
251
|
-
uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
|
|
250
|
+
source={(businessLogo || business?.logo || typeof theme.images.dummies.businessLogo === 'string') ? {
|
|
251
|
+
uri: optimizeImage(businessLogo || business?.logo || theme.images.dummies.businessLogo, 'h_150,c_limit'),
|
|
252
252
|
priority: FastImage.priority.normal,
|
|
253
253
|
} : theme.images.dummies.businessLogo}
|
|
254
254
|
resizeMode={FastImage.resizeMode.cover}
|
|
@@ -29,6 +29,12 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
29
29
|
const [, t] = useLanguage();
|
|
30
30
|
const [{ optimizeImage }] = useUtils();
|
|
31
31
|
|
|
32
|
+
const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
|
|
33
|
+
const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
|
|
34
|
+
const hideVideos = theme?.business_view?.components?.information?.components?.videos?.hidden
|
|
35
|
+
const hideImages = theme?.business_view?.components?.information?.components?.images?.hidden
|
|
36
|
+
const hideAddress = theme?.business_view?.components?.information?.components?.address?.hidden
|
|
37
|
+
|
|
32
38
|
const scheduleFormatted = ({
|
|
33
39
|
hour,
|
|
34
40
|
minute,
|
|
@@ -78,87 +84,108 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
78
84
|
<OText size={24} weight={'600'}>
|
|
79
85
|
{businessState?.business?.name}
|
|
80
86
|
</OText>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
{!hideLocation && (
|
|
88
|
+
<>
|
|
89
|
+
<GrayBackground>
|
|
90
|
+
<OText size={16} weight="500">
|
|
91
|
+
{t('BUSINESS_LOCATION', 'Business Location')}
|
|
92
|
+
</OText>
|
|
93
|
+
</GrayBackground>
|
|
94
|
+
{businessLocation.location && (
|
|
95
|
+
<WrapBusinessMap style={styles.wrapMapStyle}>
|
|
96
|
+
<GoogleMap
|
|
97
|
+
readOnly
|
|
98
|
+
location={businessLocation.location}
|
|
99
|
+
markerTitle={businessState?.business?.name}
|
|
100
|
+
/>
|
|
101
|
+
</WrapBusinessMap>
|
|
102
|
+
)}
|
|
103
|
+
</>
|
|
104
|
+
)}
|
|
105
|
+
{!hideAddress && (
|
|
106
|
+
<OText size={12} mBottom={20}>
|
|
107
|
+
{businessState?.business?.address}
|
|
84
108
|
</OText>
|
|
85
|
-
</GrayBackground>
|
|
86
|
-
{businessLocation.location && (
|
|
87
|
-
<WrapBusinessMap style={styles.wrapMapStyle}>
|
|
88
|
-
<GoogleMap
|
|
89
|
-
readOnly
|
|
90
|
-
location={businessLocation.location}
|
|
91
|
-
markerTitle={businessState?.business?.name}
|
|
92
|
-
/>
|
|
93
|
-
</WrapBusinessMap>
|
|
94
109
|
)}
|
|
95
|
-
<OText size={12} mBottom={20}>
|
|
96
|
-
{businessState?.business?.address}
|
|
97
|
-
</OText>
|
|
98
110
|
<DivideView />
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{businessSchedule
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
{!hideSchedule && (
|
|
112
|
+
<>
|
|
113
|
+
<GrayBackground>
|
|
114
|
+
<OText size={16} weight="500">
|
|
115
|
+
{t('OPENING_TIME', 'Opening Time')}
|
|
116
|
+
</OText>
|
|
117
|
+
</GrayBackground>
|
|
118
|
+
{businessSchedule && businessSchedule?.length > 0 && (
|
|
119
|
+
<WrapScheduleBlock>
|
|
120
|
+
{businessSchedule.map((schedule: any, i: number) => (
|
|
121
|
+
<ScheduleBlock key={i}>
|
|
122
|
+
<ScheduleAccordion
|
|
123
|
+
weekIndex={i}
|
|
124
|
+
scheduleFormatted={scheduleFormatted}
|
|
125
|
+
schedule={schedule}
|
|
126
|
+
/>
|
|
127
|
+
</ScheduleBlock>
|
|
128
|
+
))}
|
|
129
|
+
</WrapScheduleBlock>
|
|
130
|
+
)}
|
|
131
|
+
</>
|
|
116
132
|
)}
|
|
133
|
+
|
|
117
134
|
{/* {businessState?.business?.gallery?.length > 0 && ( */}
|
|
135
|
+
|
|
118
136
|
<>
|
|
119
|
-
{
|
|
137
|
+
{!hideVideos && (
|
|
120
138
|
<>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
{bVideos().length > 0 && (
|
|
140
|
+
<>
|
|
141
|
+
<DivideView />
|
|
142
|
+
<GrayBackground>
|
|
143
|
+
<OText size={16} weight="500">
|
|
144
|
+
{t('VIDEOS', 'Videos')}
|
|
145
|
+
</OText>
|
|
146
|
+
</GrayBackground>
|
|
147
|
+
<MediaWrapper horizontal>
|
|
148
|
+
{bVideos().map((v: any) => (
|
|
149
|
+
<WebView
|
|
150
|
+
key={`vid_id_${v.id}`}
|
|
151
|
+
style={{ width: 210, height: 127, borderRadius: 7.6 }}
|
|
152
|
+
javaScriptEnabled={true}
|
|
153
|
+
domStorageEnabled={true}
|
|
154
|
+
source={{
|
|
155
|
+
html: `
|
|
156
|
+
<iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
|
|
137
157
|
`,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
158
|
+
}}
|
|
159
|
+
mediaPlaybackRequiresUserAction={true}
|
|
160
|
+
/>
|
|
161
|
+
))}
|
|
162
|
+
</MediaWrapper>
|
|
163
|
+
</>
|
|
164
|
+
)}
|
|
143
165
|
</>
|
|
144
166
|
)}
|
|
145
|
-
|
|
167
|
+
|
|
168
|
+
{!hideImages && (
|
|
146
169
|
<>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
170
|
+
{bImages().length > 0 && (
|
|
171
|
+
<>
|
|
172
|
+
<DivideView />
|
|
173
|
+
<GrayBackground>
|
|
174
|
+
<OText size={16} weight="500">
|
|
175
|
+
{t('IMAGES', 'Images')}
|
|
176
|
+
</OText>
|
|
177
|
+
</GrayBackground>
|
|
178
|
+
<MediaWrapper horizontal>
|
|
179
|
+
{bImages().map((i: any) => (
|
|
180
|
+
i.file != null &&
|
|
181
|
+
<View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
|
|
182
|
+
<OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
|
|
183
|
+
{/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
|
|
184
|
+
</View>
|
|
185
|
+
))}
|
|
186
|
+
</MediaWrapper>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
162
189
|
</>
|
|
163
190
|
)}
|
|
164
191
|
</>
|
|
@@ -280,7 +280,9 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
280
280
|
hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
|
|
281
281
|
onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
|
|
282
282
|
/>
|
|
283
|
-
|
|
283
|
+
{openCarts.length > 1 && (
|
|
284
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
|
|
285
|
+
)}
|
|
284
286
|
</React.Fragment>
|
|
285
287
|
))}
|
|
286
288
|
{!cartGroup?.loading && openCarts.length === 0 && (
|
|
@@ -295,7 +297,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
295
297
|
{t('WARNING_PARTIAL_WALLET_CARTS', 'Important: One or more carts can`t be completed due a partial payment with cash/points wallet and requires to be paid individually')}
|
|
296
298
|
</OText>
|
|
297
299
|
)}
|
|
298
|
-
{openCarts.length >
|
|
300
|
+
{openCarts.length > 1 && (
|
|
299
301
|
<ChCartsTotal>
|
|
300
302
|
{totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
|
|
301
303
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useUtils } from 'ordering-components/native'
|
|
3
|
+
import moment from 'moment'
|
|
4
|
+
|
|
5
|
+
export const OrderEta = (props: any) => {
|
|
6
|
+
const {
|
|
7
|
+
order,
|
|
8
|
+
outputFormat
|
|
9
|
+
} = props
|
|
10
|
+
|
|
11
|
+
const [{ parseDate }] = useUtils()
|
|
12
|
+
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
|
+
|
|
14
|
+
const getEstimatedDeliveryTime = () => {
|
|
15
|
+
let _estimatedTime
|
|
16
|
+
let totalEta = 0
|
|
17
|
+
const _delivery = order?.delivery_datetime_utc
|
|
18
|
+
? order?.delivery_datetime_utc
|
|
19
|
+
: order?.delivery_datetime
|
|
20
|
+
if (order?.eta_current_status_time) {
|
|
21
|
+
const currentStatueEta = order?.eta_current_status_time
|
|
22
|
+
totalEta += currentStatueEta
|
|
23
|
+
let nextStatusTimes = 0
|
|
24
|
+
if (order?.eta_next_status_times) {
|
|
25
|
+
Object.keys(order.eta_next_status_times).map(key => {
|
|
26
|
+
if (!key.includes('status_penalty')) {
|
|
27
|
+
nextStatusTimes += order.eta_next_status_times[key]
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
totalEta += nextStatusTimes
|
|
33
|
+
|
|
34
|
+
const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
|
|
35
|
+
const diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60)
|
|
36
|
+
if (diffTimeAsMinutes <= 0) {
|
|
37
|
+
totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
|
|
38
|
+
}
|
|
39
|
+
_estimatedTime = parseDate(moment(_delivery).add(totalEta, 'minutes'))
|
|
40
|
+
} else {
|
|
41
|
+
_estimatedTime = parseDate(moment(_delivery).add(order?.eta_time, 'minutes'))
|
|
42
|
+
}
|
|
43
|
+
setEstimatedDeliveryTime(_estimatedTime)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
getEstimatedDeliveryTime()
|
|
48
|
+
const interval = setInterval(() => {
|
|
49
|
+
getEstimatedDeliveryTime()
|
|
50
|
+
}, 1000)
|
|
51
|
+
return () => clearInterval(interval)
|
|
52
|
+
}, [order])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
{!outputFormat ? estimatedDeliveryTime : moment(estimatedDeliveryTime).format(outputFormat)}
|
|
57
|
+
</>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -49,6 +49,7 @@ import NavBar from '../NavBar'
|
|
|
49
49
|
import { OrderHistory } from './OrderHistory';
|
|
50
50
|
import { PlaceSpot } from '../PlaceSpot'
|
|
51
51
|
import { SendGiftCard } from '../GiftCard/SendGiftCard'
|
|
52
|
+
import { OrderEta } from './OrderEta'
|
|
52
53
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
53
54
|
const {
|
|
54
55
|
navigation,
|
|
@@ -191,7 +192,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
191
192
|
order: {
|
|
192
193
|
id: order?.id,
|
|
193
194
|
business_id: order?.business_id,
|
|
194
|
-
logo: order.business?.logo,
|
|
195
|
+
logo: order.business?.logo || theme.images.dummies.businessLogo,
|
|
195
196
|
driver: order?.driver,
|
|
196
197
|
products: order?.products,
|
|
197
198
|
review: order?.review,
|
|
@@ -410,13 +411,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
410
411
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
411
412
|
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
412
413
|
subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
413
|
-
{
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
: parseDate(order?.delivery_datetime, { utc: false })
|
|
419
|
-
}
|
|
414
|
+
{activeStatus.includes(order?.status) ? (
|
|
415
|
+
<OrderEta order={order} />
|
|
416
|
+
) : (
|
|
417
|
+
parseDate(order?.reporting_data?.at[`status:${order.status}`])
|
|
418
|
+
)}
|
|
420
419
|
</OText>}
|
|
421
420
|
/>
|
|
422
421
|
{enabledPoweredByOrdering && (
|
|
@@ -12,6 +12,7 @@ import { NotFoundSource } from '../NotFoundSource'
|
|
|
12
12
|
import { View, StyleSheet, TouchableOpacity, Platform } from 'react-native'
|
|
13
13
|
import { Placeholder, Fade, PlaceholderLine } from "rn-placeholder";
|
|
14
14
|
import FastImage from 'react-native-fast-image'
|
|
15
|
+
import { OrderEta } from '../OrderDetails/OrderEta'
|
|
15
16
|
import {
|
|
16
17
|
ProgressContentWrapper,
|
|
17
18
|
ProgressBar,
|
|
@@ -33,7 +34,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
33
34
|
const theme = useTheme();
|
|
34
35
|
|
|
35
36
|
const [, t] = useLanguage()
|
|
36
|
-
const [{ optimizeImage,
|
|
37
|
+
const [{ optimizeImage, parseTime }] = useUtils()
|
|
37
38
|
const [lastOrder, setLastOrder] = useState<any>(null)
|
|
38
39
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
39
40
|
const [initialLoaded, setInitialLoaded] = useState(false)
|
|
@@ -76,15 +77,6 @@ const OrderProgressUI = (props: any) => {
|
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
const convertDiffToHours = (order: any) => {
|
|
80
|
-
const minute = order?.eta_time
|
|
81
|
-
const deliveryTime = order?.delivery_datetime_utc
|
|
82
|
-
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
83
|
-
: parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
84
|
-
const returnedDate = moment(deliveryTime).add(minute, 'minutes').format('hh:mm A')
|
|
85
|
-
return returnedDate
|
|
86
|
-
}
|
|
87
|
-
|
|
88
80
|
const handleGoToOrder = (index: string) => {
|
|
89
81
|
navigation && navigation.navigate(index)
|
|
90
82
|
}
|
|
@@ -171,7 +163,7 @@ const OrderProgressUI = (props: any) => {
|
|
|
171
163
|
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: 'hh:mm A' })
|
|
172
164
|
: parseTime(lastOrder?.delivery_datetime, { utc: false })}
|
|
173
165
|
-
|
|
174
|
-
{
|
|
166
|
+
<OrderEta order={lastOrder} outputFormat='hh:mm A' />
|
|
175
167
|
</OText>
|
|
176
168
|
</TimeWrapper>
|
|
177
169
|
</ProgressTextWrapper>
|
|
@@ -10,7 +10,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
10
10
|
import { OIcon, OText, OButton } from '../shared';
|
|
11
11
|
import { SingleOrderCardParams } from '../../types';
|
|
12
12
|
import { OAlert } from '../../../../../src/components/shared'
|
|
13
|
-
|
|
13
|
+
import { OrderEta } from '../OrderDetails/OrderEta'
|
|
14
14
|
import {
|
|
15
15
|
InnerContainer,
|
|
16
16
|
Logo,
|
|
@@ -333,7 +333,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
|
|
|
333
333
|
{
|
|
334
334
|
pastOrders
|
|
335
335
|
? order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })
|
|
336
|
-
: order
|
|
336
|
+
: <OrderEta order={order} />
|
|
337
337
|
}
|
|
338
338
|
</OText>
|
|
339
339
|
)}
|
|
@@ -283,8 +283,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
283
283
|
{!hideProductLogo && (
|
|
284
284
|
<FastImage
|
|
285
285
|
style={styles.productStyle}
|
|
286
|
-
source={product?.images ? {
|
|
287
|
-
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
286
|
+
source={product?.images || typeof theme?.images?.dummies?.product === 'string' ? {
|
|
287
|
+
uri: optimizeImage(product?.images || theme?.images?.dummies?.products, 'h_250,c_limit'),
|
|
288
288
|
priority: FastImage.priority.normal,
|
|
289
289
|
} : theme?.images?.dummies?.product}
|
|
290
290
|
resizeMode={FastImage.resizeMode.cover}
|
|
@@ -28,7 +28,7 @@ const StyledButton = styled.View<Props>`
|
|
|
28
28
|
padding-right: 20px;
|
|
29
29
|
position: relative;
|
|
30
30
|
${(props : any) => props?.theme?.general?.components?.buttons?.borderRadius && css`
|
|
31
|
-
border-radius: ${props?.theme?.general?.components?.buttons?.borderRadius};
|
|
31
|
+
border-radius: ${props?.theme?.general?.components?.buttons?.borderRadius}px;
|
|
32
32
|
`}
|
|
33
33
|
`
|
|
34
34
|
const StyledButtonDisabled = styled(StyledButton)`
|
|
@@ -119,7 +119,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
119
119
|
style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
|
|
120
120
|
disabled={props.isDisabledWithSameStyles}
|
|
121
121
|
>
|
|
122
|
-
<StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor } : props.style}>
|
|
122
|
+
<StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor, borderRadius: theme?.general?.components?.buttons?.borderRadius || props.style?.borderRadius} : {...props.style, borderRadius: theme?.general?.components?.buttons?.borderRadius || props.style?.borderRadius}}>
|
|
123
123
|
{props.icon ? (
|
|
124
124
|
<props.icon {...props.iconProps} />
|
|
125
125
|
) : null}
|