ordering-ui-react-native 0.14.57 → 0.14.60
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/Checkout/index.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +55 -23
- package/themes/business/src/components/PreviousOrders/styles.tsx +13 -1
- package/themes/original/src/components/MomentOption/index.tsx +4 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
package/package.json
CHANGED
|
@@ -205,7 +205,7 @@ const CheckoutUI = (props: any) => {
|
|
|
205
205
|
const onMessage = (e: any) => {
|
|
206
206
|
if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
|
|
207
207
|
let payment = JSON.parse(e.nativeEvent.data);
|
|
208
|
-
|
|
208
|
+
setOpenOrderCreating(true)
|
|
209
209
|
if (payment === 'api error') {
|
|
210
210
|
setShowGateway({ closedByUser: true, open: false })
|
|
211
211
|
setProg(true);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import moment from 'moment'
|
|
4
5
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
6
|
import { OButton, OIcon, OText } from '../shared';
|
|
6
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
|
|
9
|
+
} from './styles';
|
|
7
10
|
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
8
11
|
|
|
9
12
|
export const PreviousOrders = (props: any) => {
|
|
@@ -18,6 +21,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
18
21
|
const [, t] = useLanguage();
|
|
19
22
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
20
23
|
const theme = useTheme();
|
|
24
|
+
const [currentTime, setCurrentTime] = useState()
|
|
21
25
|
|
|
22
26
|
const handlePressOrder = (order: any) => {
|
|
23
27
|
if (order?.locked && isLogisticOrder) return
|
|
@@ -39,17 +43,15 @@ export const PreviousOrders = (props: any) => {
|
|
|
39
43
|
height: 75,
|
|
40
44
|
},
|
|
41
45
|
logo: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
borderRadius: 25,
|
|
45
|
-
shadowColor: 'rgba(0.0, 0.0, 0.0, 0.5)',
|
|
46
|
+
borderRadius: 10,
|
|
47
|
+
shadowColor: "#000",
|
|
46
48
|
shadowOffset: {
|
|
47
49
|
width: 0,
|
|
48
|
-
height: 1
|
|
50
|
+
height: 1,
|
|
49
51
|
},
|
|
50
|
-
shadowOpacity: 0.
|
|
51
|
-
shadowRadius:
|
|
52
|
-
elevation:
|
|
52
|
+
shadowOpacity: 0.20,
|
|
53
|
+
shadowRadius: 1.41,
|
|
54
|
+
elevation: 2,
|
|
53
55
|
justifyContent: 'center',
|
|
54
56
|
alignItems: 'center',
|
|
55
57
|
marginLeft: 3,
|
|
@@ -67,11 +69,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
67
69
|
fontFamily: 'Poppins',
|
|
68
70
|
fontStyle: 'normal',
|
|
69
71
|
fontWeight: 'normal',
|
|
70
|
-
fontSize:
|
|
71
|
-
color: theme.colors.unselectText,
|
|
72
|
+
fontSize: 12,
|
|
72
73
|
},
|
|
73
74
|
orderType: {
|
|
74
|
-
fontSize:
|
|
75
|
+
fontSize: 12,
|
|
75
76
|
fontFamily: 'Poppins',
|
|
76
77
|
fontStyle: 'normal',
|
|
77
78
|
fontWeight: 'normal',
|
|
@@ -79,6 +80,32 @@ export const PreviousOrders = (props: any) => {
|
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
82
|
|
|
83
|
+
const getDelayTime = (order: any) => {
|
|
84
|
+
// targetMin = delivery_datetime + eta_time - now()
|
|
85
|
+
const _delivery = order?.delivery_datetime_utc
|
|
86
|
+
const _eta = order?.eta_time
|
|
87
|
+
const tagetedMin = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
|
|
88
|
+
let day = Math.floor(tagetedMin / 1440)
|
|
89
|
+
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
90
|
+
let restHours: any = Math.floor(restMinOfTargetedMin / 60)
|
|
91
|
+
let restMins: any = restMinOfTargetedMin - 60 * restHours
|
|
92
|
+
|
|
93
|
+
if (order?.time_status === 'in_time' || order?.time_status === 'at_risk') day = Math.abs(day)
|
|
94
|
+
if (restHours < 10) restHours = ('0' + restHours)
|
|
95
|
+
if (restMins < 10) restMins = ('0' + restMins)
|
|
96
|
+
const finalTaget = day + 'day ' + restHours + ':' + restMins
|
|
97
|
+
return finalTaget
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const interval = setInterval(() => {
|
|
102
|
+
const date:any = Date.now()
|
|
103
|
+
setCurrentTime(date)
|
|
104
|
+
}, 60000)
|
|
105
|
+
|
|
106
|
+
return () => clearInterval(interval)
|
|
107
|
+
}, [])
|
|
108
|
+
|
|
82
109
|
let hash: any = {};
|
|
83
110
|
|
|
84
111
|
return (
|
|
@@ -103,6 +130,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
103
130
|
activeOpacity={1}
|
|
104
131
|
>
|
|
105
132
|
<Card key={order.id}>
|
|
133
|
+
<Timestatus style={{backgroundColor: order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' }}/>
|
|
106
134
|
{
|
|
107
135
|
order.business?.logo && (
|
|
108
136
|
<Logo style={styles.logo}>
|
|
@@ -135,16 +163,20 @@ export const PreviousOrders = (props: any) => {
|
|
|
135
163
|
/>
|
|
136
164
|
</NotificationIcon>
|
|
137
165
|
)}
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
?
|
|
146
|
-
|
|
147
|
-
|
|
166
|
+
<View style={{flexDirection: 'row'}}>
|
|
167
|
+
<OText
|
|
168
|
+
style={styles.date}
|
|
169
|
+
color={theme.colors.unselectText}
|
|
170
|
+
numberOfLines={1}
|
|
171
|
+
adjustsFontSizeToFit
|
|
172
|
+
>
|
|
173
|
+
{(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('NO', 'Order No.') + order.id)) + ' · '}
|
|
174
|
+
{order?.delivery_datetime_utc
|
|
175
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
176
|
+
: parseDate(order?.delivery_datetime, { utc: false })}{' · '}
|
|
177
|
+
</OText>
|
|
178
|
+
<OText style={styles.date} color={order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' } >{getDelayTime(order)}</OText>
|
|
179
|
+
</View>
|
|
148
180
|
{!isLogisticOrder && (
|
|
149
181
|
<MyOrderOptions>
|
|
150
182
|
<OText
|
|
@@ -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 Card = styled.View`
|
|
4
4
|
flex: 1;
|
|
@@ -35,4 +35,16 @@ export const AcceptOrRejectOrder = styled.View`
|
|
|
35
35
|
justify-content: space-between;
|
|
36
36
|
flex: 1;
|
|
37
37
|
margin: 10px;
|
|
38
|
+
`
|
|
39
|
+
export const Timestatus = styled.View`
|
|
40
|
+
position: relative;;
|
|
41
|
+
width: 4px;
|
|
42
|
+
height: 65px;
|
|
43
|
+
border-radius: 20px;
|
|
44
|
+
top: 5px;
|
|
45
|
+
margin-right: 5px;
|
|
46
|
+
${(props: any) => props.theme?.rtl && css`
|
|
47
|
+
left: unset;
|
|
48
|
+
right: -5px;
|
|
49
|
+
`}
|
|
38
50
|
`
|
|
@@ -350,7 +350,11 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
350
350
|
</OrderTimeWrapper>
|
|
351
351
|
)}
|
|
352
352
|
</View>
|
|
353
|
+
<Spinner visible={momentState.isLoading === 1} />
|
|
353
354
|
</Container>
|
|
355
|
+
<View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%' }}>
|
|
356
|
+
<OButton onClick={handleChangeMoment} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0 }} textStyle={{ color: 'white', fontSize: 14 }} showNextIcon />
|
|
357
|
+
</View>
|
|
354
358
|
</>
|
|
355
359
|
);
|
|
356
360
|
};
|
|
@@ -159,12 +159,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
159
159
|
</TopActions>
|
|
160
160
|
</TopBar>
|
|
161
161
|
<ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
162
|
-
{productsList.length > 0 &&
|
|
163
|
-
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
164
|
-
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
165
|
-
<UpsellingLayout />
|
|
166
|
-
</View>
|
|
167
|
-
}
|
|
168
162
|
<View style={{ paddingHorizontal: 40 }}>
|
|
169
163
|
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
170
164
|
<OrderSummary
|
|
@@ -173,6 +167,12 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
173
167
|
onNavigationRedirect={onNavigationRedirect}
|
|
174
168
|
/>
|
|
175
169
|
</View>
|
|
170
|
+
{productsList.length > 0 &&
|
|
171
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
172
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
173
|
+
<UpsellingLayout />
|
|
174
|
+
</View>
|
|
175
|
+
}
|
|
176
176
|
</ScrollView>
|
|
177
177
|
<View
|
|
178
178
|
style={{
|