ordering-ui-react-native 0.12.18 → 0.12.19
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/config.json +2 -2
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
- package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
- package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
- package/themes/business/src/components 2/Chat/index.tsx +0 -1152
- package/themes/business/src/components 2/Chat/styles.tsx +0 -12
- package/themes/business/src/components 2/Contacts/index.tsx +0 -299
- package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
- package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
- package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
- package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
- package/themes/business/src/components 2/Home/index.tsx +0 -111
- package/themes/business/src/components 2/Home/styles.tsx +0 -27
- package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
- package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
- package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
- package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
- package/themes/business/src/components 2/MapView/index.tsx +0 -317
- package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
- package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
- package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
- package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
- package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
- package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
- package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
- package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
- package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
- package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
- package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
- package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
- package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
- package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
- package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
- package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
- package/themes/business/src/components 2/StoresList/index.tsx +0 -208
- package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
- package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
- package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
- package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
- package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
- package/themes/business/src/components 2/shared/OButton.tsx +0 -149
- package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
- package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
- package/themes/business/src/components 2/shared/OFab.tsx +0 -54
- package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
- package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
- package/themes/business/src/components 2/shared/OInput.tsx +0 -144
- package/themes/business/src/components 2/shared/OLink.tsx +0 -76
- package/themes/business/src/components 2/shared/OModal.tsx +0 -275
- package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
- package/themes/business/src/components 2/shared/OText.tsx +0 -55
- package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
- package/themes/business/src/components 2/shared/OToast.tsx +0 -92
- package/themes/business/src/components 2/shared/index.tsx +0 -27
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity, ScrollView } from 'react-native';
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
|
-
import { Card, Logo, Information, Header, Badge } from './styles';
|
|
6
|
-
import { OIcon, OText } from '../shared';
|
|
7
|
-
import { PreviousMessagesParams } from '../../types';
|
|
8
|
-
|
|
9
|
-
export const PreviousMessages = (props: PreviousMessagesParams) => {
|
|
10
|
-
const { orders, onNavigationRedirect, setOrders } = props;
|
|
11
|
-
|
|
12
|
-
const [, t] = useLanguage();
|
|
13
|
-
const theme = useTheme();
|
|
14
|
-
const [{ parseDate, optimizeImage }] = useUtils();
|
|
15
|
-
|
|
16
|
-
const handlePressOrder = (order: any) => {
|
|
17
|
-
const uuid = order?.id;
|
|
18
|
-
|
|
19
|
-
onNavigationRedirect &&
|
|
20
|
-
onNavigationRedirect('OrderMessage', { orderId: uuid, setOrders });
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const getOrderStatus = (s: string) => {
|
|
24
|
-
const status = parseInt(s);
|
|
25
|
-
const orderStatus = [
|
|
26
|
-
{
|
|
27
|
-
key: 0,
|
|
28
|
-
value: t('PENDING', 'Pending'),
|
|
29
|
-
slug: 'PENDING',
|
|
30
|
-
percentage: 0.25,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
key: 1,
|
|
34
|
-
value: t('COMPLETED', 'Completed'),
|
|
35
|
-
slug: 'COMPLETED',
|
|
36
|
-
percentage: 1,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: 2,
|
|
40
|
-
value: t('REJECTED', 'Rejected'),
|
|
41
|
-
slug: 'REJECTED',
|
|
42
|
-
percentage: 0,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
key: 3,
|
|
46
|
-
value: t('DRIVER_IN_BUSINESS', 'Driver in business'),
|
|
47
|
-
slug: 'DRIVER_IN_BUSINESS',
|
|
48
|
-
percentage: 0.6,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: 4,
|
|
52
|
-
value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
|
|
53
|
-
slug: 'PREPARATION_COMPLETED',
|
|
54
|
-
percentage: 0.7,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
key: 5,
|
|
58
|
-
value: t('REJECTED', 'Rejected'),
|
|
59
|
-
slug: 'REJECTED_BY_BUSINESS',
|
|
60
|
-
percentage: 0,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: 6,
|
|
64
|
-
value: t('REJECTED_BY_DRIVER', 'Rejected by Driver'),
|
|
65
|
-
slug: 'REJECTED_BY_DRIVER',
|
|
66
|
-
percentage: 0,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
key: 7,
|
|
70
|
-
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
71
|
-
slug: 'ACCEPTED_BY_BUSINESS',
|
|
72
|
-
percentage: 0.35,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: 8,
|
|
76
|
-
value: t('ACCEPTED_BY_DRIVER', 'Accepted by driver'),
|
|
77
|
-
slug: 'ACCEPTED_BY_DRIVER',
|
|
78
|
-
percentage: 0.45,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
key: 9,
|
|
82
|
-
value: t('PICK_UP_COMPLETED_BY_DRIVER', 'Pick up completed by driver'),
|
|
83
|
-
slug: 'PICK_UP_COMPLETED_BY_DRIVER',
|
|
84
|
-
percentage: 0.8,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
key: 10,
|
|
88
|
-
value: t('PICK_UP_FAILED_BY_DRIVER', 'Pick up Failed by driver'),
|
|
89
|
-
slug: 'PICK_UP_FAILED_BY_DRIVER',
|
|
90
|
-
percentage: 0,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
key: 11,
|
|
94
|
-
value: t(
|
|
95
|
-
'DELIVERY_COMPLETED_BY_DRIVER',
|
|
96
|
-
'Delivery completed by driver',
|
|
97
|
-
),
|
|
98
|
-
slug: 'DELIVERY_COMPLETED_BY_DRIVER',
|
|
99
|
-
percentage: 1,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
key: 12,
|
|
103
|
-
value: t('DELIVERY_FAILED_BY_DRIVER', 'Delivery Failed by driver'),
|
|
104
|
-
slug: 'DELIVERY_FAILED_BY_DRIVER',
|
|
105
|
-
percentage: 0,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
key: 13,
|
|
109
|
-
value: t('PREORDER', 'PreOrder'),
|
|
110
|
-
slug: 'PREORDER',
|
|
111
|
-
percentage: 0,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
key: 14,
|
|
115
|
-
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
116
|
-
slug: 'ORDER_NOT_READY',
|
|
117
|
-
percentage: 0,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
key: 15,
|
|
121
|
-
value: t(
|
|
122
|
-
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
123
|
-
'Order picked up completed by customer',
|
|
124
|
-
),
|
|
125
|
-
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
126
|
-
percentage: 100,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
key: 16,
|
|
130
|
-
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
131
|
-
slug: 'CANCELLED_BY_CUSTOMER',
|
|
132
|
-
percentage: 0,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
key: 17,
|
|
136
|
-
value: t(
|
|
137
|
-
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
138
|
-
'Order not picked up by customer',
|
|
139
|
-
),
|
|
140
|
-
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
141
|
-
percentage: 0,
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
key: 18,
|
|
145
|
-
value: t(
|
|
146
|
-
'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
147
|
-
'Driver almost arrived to business',
|
|
148
|
-
),
|
|
149
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS',
|
|
150
|
-
percentage: 0.15,
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
key: 19,
|
|
154
|
-
value: t(
|
|
155
|
-
'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
156
|
-
'Driver almost arrived to customer',
|
|
157
|
-
),
|
|
158
|
-
slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER',
|
|
159
|
-
percentage: 0.9,
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
key: 20,
|
|
163
|
-
value: t(
|
|
164
|
-
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
165
|
-
'Customer almost arrived to business',
|
|
166
|
-
),
|
|
167
|
-
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
168
|
-
percentage: 90,
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
key: 21,
|
|
172
|
-
value: t(
|
|
173
|
-
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
174
|
-
'Customer arrived to business',
|
|
175
|
-
),
|
|
176
|
-
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
177
|
-
percentage: 95,
|
|
178
|
-
},
|
|
179
|
-
];
|
|
180
|
-
|
|
181
|
-
const objectStatus = orderStatus.find(o => o.key === status);
|
|
182
|
-
|
|
183
|
-
return objectStatus && objectStatus;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const styles = StyleSheet.create({
|
|
187
|
-
cardButton: {
|
|
188
|
-
flex: 1,
|
|
189
|
-
minHeight: 64,
|
|
190
|
-
marginBottom: 30,
|
|
191
|
-
marginLeft: 3,
|
|
192
|
-
},
|
|
193
|
-
icon: {
|
|
194
|
-
borderRadius: 7.6,
|
|
195
|
-
width: 75,
|
|
196
|
-
height: 75,
|
|
197
|
-
},
|
|
198
|
-
logo: {
|
|
199
|
-
width: 78,
|
|
200
|
-
height: 78,
|
|
201
|
-
borderRadius: 25,
|
|
202
|
-
shadowColor: 'rgba(0.0, 0.0, 0.0, 0.5)',
|
|
203
|
-
shadowOffset: {
|
|
204
|
-
width: 0,
|
|
205
|
-
height: 1.5,
|
|
206
|
-
},
|
|
207
|
-
shadowOpacity: 0.21,
|
|
208
|
-
shadowRadius: 5,
|
|
209
|
-
elevation: 7,
|
|
210
|
-
justifyContent: 'center',
|
|
211
|
-
alignItems: 'center',
|
|
212
|
-
marginLeft: 3,
|
|
213
|
-
},
|
|
214
|
-
title: {
|
|
215
|
-
marginBottom: 6,
|
|
216
|
-
fontFamily: 'Poppins',
|
|
217
|
-
fontStyle: 'normal',
|
|
218
|
-
fontWeight: '600',
|
|
219
|
-
fontSize: 16,
|
|
220
|
-
color: theme.colors.textGray,
|
|
221
|
-
},
|
|
222
|
-
badge: {
|
|
223
|
-
marginBottom: 6,
|
|
224
|
-
fontFamily: 'Poppins',
|
|
225
|
-
fontStyle: 'normal',
|
|
226
|
-
fontWeight: 'normal',
|
|
227
|
-
fontSize: 14,
|
|
228
|
-
color: theme.colors.primary,
|
|
229
|
-
},
|
|
230
|
-
date: {
|
|
231
|
-
marginBottom: 6,
|
|
232
|
-
fontFamily: 'Poppins',
|
|
233
|
-
fontStyle: 'normal',
|
|
234
|
-
fontWeight: 'normal',
|
|
235
|
-
fontSize: 15,
|
|
236
|
-
color: theme.colors.unselectText,
|
|
237
|
-
},
|
|
238
|
-
orderType: {
|
|
239
|
-
fontFamily: 'Poppins',
|
|
240
|
-
fontStyle: 'normal',
|
|
241
|
-
fontWeight: 'normal',
|
|
242
|
-
color: theme.colors.orderTypeColor,
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
return (
|
|
247
|
-
<>
|
|
248
|
-
{orders?.length > 0 &&
|
|
249
|
-
orders?.map((order: any) => (
|
|
250
|
-
<TouchableOpacity
|
|
251
|
-
key={order?.id}
|
|
252
|
-
onPress={() => handlePressOrder(order)}
|
|
253
|
-
style={styles.cardButton}
|
|
254
|
-
activeOpacity={1}>
|
|
255
|
-
<Card key={order?.id}>
|
|
256
|
-
{!!order?.business?.logo && (
|
|
257
|
-
<Logo style={styles.logo}>
|
|
258
|
-
<OIcon
|
|
259
|
-
url={optimizeImage(order?.business?.logo, 'h_300,c_limit')}
|
|
260
|
-
style={styles.icon}
|
|
261
|
-
/>
|
|
262
|
-
</Logo>
|
|
263
|
-
)}
|
|
264
|
-
|
|
265
|
-
<Information>
|
|
266
|
-
<Header>
|
|
267
|
-
<OText numberOfLines={1} style={styles.title}>
|
|
268
|
-
{order?.business?.name}
|
|
269
|
-
</OText>
|
|
270
|
-
|
|
271
|
-
{order?.unread_count > 0 && (
|
|
272
|
-
<Badge>
|
|
273
|
-
<OText size={14} style={styles.badge}>
|
|
274
|
-
{order?.unread_count}
|
|
275
|
-
</OText>
|
|
276
|
-
</Badge>
|
|
277
|
-
)}
|
|
278
|
-
</Header>
|
|
279
|
-
|
|
280
|
-
<OText
|
|
281
|
-
style={styles.date}
|
|
282
|
-
numberOfLines={1}
|
|
283
|
-
adjustsFontSizeToFit
|
|
284
|
-
size={20}>
|
|
285
|
-
{t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
|
|
286
|
-
{order?.delivery_datetime_utc
|
|
287
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
288
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
289
|
-
</OText>
|
|
290
|
-
|
|
291
|
-
<OText
|
|
292
|
-
style={styles.orderType}
|
|
293
|
-
mRight={5}
|
|
294
|
-
numberOfLines={1}
|
|
295
|
-
adjustsFontSizeToFit>
|
|
296
|
-
{getOrderStatus(order?.status)?.value}
|
|
297
|
-
</OText>
|
|
298
|
-
</Information>
|
|
299
|
-
</Card>
|
|
300
|
-
</TouchableOpacity>
|
|
301
|
-
))}
|
|
302
|
-
</>
|
|
303
|
-
);
|
|
304
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const Card = styled.View`
|
|
4
|
-
flex: 1;
|
|
5
|
-
flex-direction: row;
|
|
6
|
-
`;
|
|
7
|
-
|
|
8
|
-
export const Logo = styled.View`
|
|
9
|
-
width: 75px;
|
|
10
|
-
height: 75px;
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
export const Information = styled.View`
|
|
14
|
-
justify-content: space-between;
|
|
15
|
-
align-items: flex-start;
|
|
16
|
-
margin-horizontal: 10px;
|
|
17
|
-
flex: 1;
|
|
18
|
-
min-height: 64px;
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const Header = styled.View`
|
|
22
|
-
flex-direction: row;
|
|
23
|
-
justify-content: space-between;
|
|
24
|
-
align-items: center;
|
|
25
|
-
width: 100%;
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
export const Badge = styled.View`
|
|
29
|
-
background-color: #e9f2fe;
|
|
30
|
-
border-radius: 4px;
|
|
31
|
-
padding: 1px 4px;
|
|
32
|
-
`;
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { useTheme } from 'styled-components/native';
|
|
4
|
-
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
|
-
import { OButton, OIcon, OText } from '../shared';
|
|
6
|
-
import { Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder } from './styles';
|
|
7
|
-
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
8
|
-
|
|
9
|
-
export const PreviousOrders = (props: any) => {
|
|
10
|
-
const { orders, onNavigationRedirect, getOrderStatus, handleClickOrder, isLogisticOrder } = props;
|
|
11
|
-
const [, t] = useLanguage();
|
|
12
|
-
const [{ parseDate, optimizeImage }] = useUtils();
|
|
13
|
-
const theme = useTheme();
|
|
14
|
-
|
|
15
|
-
const handlePressOrder = (order: any) => {
|
|
16
|
-
handleClickOrder && handleClickOrder(order)
|
|
17
|
-
onNavigationRedirect &&
|
|
18
|
-
onNavigationRedirect('OrderDetails', { order: order });
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const styles = StyleSheet.create({
|
|
22
|
-
cardButton: {
|
|
23
|
-
flex: 1,
|
|
24
|
-
minHeight: 64,
|
|
25
|
-
marginBottom: isLogisticOrder ? 0 : 30,
|
|
26
|
-
marginLeft: 3,
|
|
27
|
-
},
|
|
28
|
-
icon: {
|
|
29
|
-
borderRadius: 7.6,
|
|
30
|
-
width: 75,
|
|
31
|
-
height: 75,
|
|
32
|
-
},
|
|
33
|
-
logo: {
|
|
34
|
-
width: 78,
|
|
35
|
-
height: 78,
|
|
36
|
-
borderRadius: 25,
|
|
37
|
-
shadowColor: 'rgba(0.0, 0.0, 0.0, 0.5)',
|
|
38
|
-
shadowOffset: {
|
|
39
|
-
width: 0,
|
|
40
|
-
height: 1.5,
|
|
41
|
-
},
|
|
42
|
-
shadowOpacity: 0.21,
|
|
43
|
-
shadowRadius: 5,
|
|
44
|
-
elevation: 7,
|
|
45
|
-
justifyContent: 'center',
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
marginLeft: 3,
|
|
48
|
-
},
|
|
49
|
-
title: {
|
|
50
|
-
marginBottom: 6,
|
|
51
|
-
fontFamily: 'Poppins',
|
|
52
|
-
fontStyle: 'normal',
|
|
53
|
-
fontWeight: '600',
|
|
54
|
-
fontSize: 16,
|
|
55
|
-
color: theme.colors.textGray,
|
|
56
|
-
},
|
|
57
|
-
date: {
|
|
58
|
-
marginBottom: 6,
|
|
59
|
-
fontFamily: 'Poppins',
|
|
60
|
-
fontStyle: 'normal',
|
|
61
|
-
fontWeight: 'normal',
|
|
62
|
-
fontSize: 15,
|
|
63
|
-
color: theme.colors.unselectText,
|
|
64
|
-
},
|
|
65
|
-
orderType: {
|
|
66
|
-
fontSize: 15,
|
|
67
|
-
fontFamily: 'Poppins',
|
|
68
|
-
fontStyle: 'normal',
|
|
69
|
-
fontWeight: 'normal',
|
|
70
|
-
color: theme.colors.orderTypeColor,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
let hash: any = {};
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<>
|
|
78
|
-
{orders && orders?.length > 0 &&
|
|
79
|
-
orders
|
|
80
|
-
.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
|
|
81
|
-
.map((order: any) =>
|
|
82
|
-
(
|
|
83
|
-
<React.Fragment key={order.id}>
|
|
84
|
-
<TouchableOpacity
|
|
85
|
-
onPress={() => handlePressOrder(order)}
|
|
86
|
-
style={styles.cardButton}
|
|
87
|
-
activeOpacity={1}
|
|
88
|
-
>
|
|
89
|
-
<Card key={order.id}>
|
|
90
|
-
{!!order.business?.logo && (
|
|
91
|
-
<Logo style={styles.logo}>
|
|
92
|
-
<OIcon
|
|
93
|
-
url={optimizeImage(
|
|
94
|
-
order.business?.logo,
|
|
95
|
-
'h_300,c_limit',
|
|
96
|
-
)}
|
|
97
|
-
style={styles.icon}
|
|
98
|
-
/>
|
|
99
|
-
</Logo>
|
|
100
|
-
)}
|
|
101
|
-
<Information>
|
|
102
|
-
<OText numberOfLines={1} style={styles.title}>
|
|
103
|
-
{order.business?.name}
|
|
104
|
-
</OText>
|
|
105
|
-
{order?.showNotification && (
|
|
106
|
-
<NotificationIcon>
|
|
107
|
-
<EntypoIcon
|
|
108
|
-
name="dot-single"
|
|
109
|
-
size={32}
|
|
110
|
-
color={theme.colors.primary}
|
|
111
|
-
/>
|
|
112
|
-
</NotificationIcon>
|
|
113
|
-
)}
|
|
114
|
-
<OText
|
|
115
|
-
style={styles.date}
|
|
116
|
-
numberOfLines={1}
|
|
117
|
-
adjustsFontSizeToFit
|
|
118
|
-
size={20}>
|
|
119
|
-
{t('INVOICE_ORDER_NO', 'Order No.') + order.id + ' · '}
|
|
120
|
-
{order?.delivery_datetime_utc
|
|
121
|
-
? parseDate(order?.delivery_datetime_utc)
|
|
122
|
-
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
123
|
-
</OText>
|
|
124
|
-
{!isLogisticOrder && (
|
|
125
|
-
<MyOrderOptions>
|
|
126
|
-
<OText
|
|
127
|
-
style={styles.orderType}
|
|
128
|
-
mRight={5}
|
|
129
|
-
numberOfLines={1}
|
|
130
|
-
adjustsFontSizeToFit
|
|
131
|
-
>
|
|
132
|
-
{order.delivery_type === 1
|
|
133
|
-
? t('DELIVERY', 'Delivery')
|
|
134
|
-
: order.delivery_type === 2
|
|
135
|
-
? t('PICKUP', 'Pickup')
|
|
136
|
-
: order.delivery_type === 3
|
|
137
|
-
? t('EAT_IN', 'Eat in')
|
|
138
|
-
: order.delivery_type === 4
|
|
139
|
-
? t('CURBSIDE', 'Curbside')
|
|
140
|
-
: t('DRIVER_THRU', 'Driver thru')}
|
|
141
|
-
{` · ${getOrderStatus(order.status)}`}
|
|
142
|
-
</OText>
|
|
143
|
-
</MyOrderOptions>
|
|
144
|
-
)}
|
|
145
|
-
</Information>
|
|
146
|
-
</Card>
|
|
147
|
-
</TouchableOpacity>
|
|
148
|
-
{isLogisticOrder && (
|
|
149
|
-
<AcceptOrRejectOrder>
|
|
150
|
-
<OButton
|
|
151
|
-
text={t('REJECT', 'Reject')}
|
|
152
|
-
onClick={() => console.log('reject')}
|
|
153
|
-
bgColor={theme.colors.danger}
|
|
154
|
-
borderColor={theme.colors.danger}
|
|
155
|
-
imgRightSrc={null}
|
|
156
|
-
style={{ borderRadius: 7 }}
|
|
157
|
-
parentStyle={{width: '45%'}}
|
|
158
|
-
textStyle={{ color: theme.colors.dangerText }}
|
|
159
|
-
/>
|
|
160
|
-
<OButton
|
|
161
|
-
text={t('ACCEPT', 'Accept')}
|
|
162
|
-
onClick={() => console.log('Accept')}
|
|
163
|
-
bgColor={theme.colors.successOrder}
|
|
164
|
-
borderColor={theme.colors.successOrder}
|
|
165
|
-
imgRightSrc={null}
|
|
166
|
-
style={{ borderRadius: 7 }}
|
|
167
|
-
parentStyle={{width: '45%'}}
|
|
168
|
-
textStyle={{ color: theme.colors.successText }}
|
|
169
|
-
/>
|
|
170
|
-
</AcceptOrRejectOrder>
|
|
171
|
-
)}
|
|
172
|
-
</React.Fragment>
|
|
173
|
-
))}
|
|
174
|
-
</>
|
|
175
|
-
);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
PreviousOrders.defaultProps = {
|
|
179
|
-
orders: []
|
|
180
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const Card = styled.View`
|
|
4
|
-
flex: 1;
|
|
5
|
-
flex-direction: row;
|
|
6
|
-
align-items: flex-start;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
export const Logo = styled.View`
|
|
11
|
-
height: 75px;
|
|
12
|
-
width: 75px;
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export const Information = styled.View`
|
|
16
|
-
position: relative;
|
|
17
|
-
justify-content: flex-start;
|
|
18
|
-
margin-horizontal: 10px;
|
|
19
|
-
flex: 1;
|
|
20
|
-
max-height: 70px;
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
export const MyOrderOptions = styled.View`
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
export const NotificationIcon = styled.View`
|
|
29
|
-
position: absolute;
|
|
30
|
-
left: 90%;
|
|
31
|
-
`
|
|
32
|
-
|
|
33
|
-
export const AcceptOrRejectOrder = styled.View`
|
|
34
|
-
flex-direction: row;
|
|
35
|
-
justify-content: space-between;
|
|
36
|
-
flex: 1;
|
|
37
|
-
margin-bottom: 30px;
|
|
38
|
-
`
|