ordering-ui-react-native 0.22.9 → 0.22.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.22.09",
3
+ "version": "0.22.10",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,482 +1,167 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { View } from 'react-native';
3
- import { useTheme } from 'styled-components/native';
4
- import { useLanguage, useConfig } from 'ordering-components/native';
5
-
6
- import { AcceptOrRejectOrder as AcceptOrRejectOrderStyle } from './styles';
7
-
8
- import { OButton, OModal } from '../shared';
9
- import { OrdersGroupedItem } from './OrdersGroupedItem'
10
- import { OrdersList } from './OrderList';
11
- import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
12
- import { ReviewCustomer } from '../ReviewCustomer';
13
- import { GoogleMap } from '../GoogleMap';
14
-
15
- export const PreviousOrders = (props: any) => {
1
+ import React, { useState } from 'react'
2
+ import { useLanguage, useUtils } from 'ordering-components/native'
3
+ import { StyleSheet, TouchableOpacity, ScrollView } from 'react-native'
4
+ import { OButton, OIcon, OText } from '../shared'
5
+ import { Card, Logo, Information, MyOrderOptions, Status, WrappButton } from './styles'
6
+ import { PreviousOrdersParams } from '../../types'
7
+ import { useTheme } from 'styled-components/native'
8
+
9
+ export const PreviousOrders = (props: PreviousOrdersParams) => {
16
10
  const {
17
11
  orders,
12
+ pagination,
18
13
  onNavigationRedirect,
14
+ loadMoreOrders,
19
15
  getOrderStatus,
20
- handleClickOrder,
21
- isLogisticOrder,
22
- handleClickLogisticOrder,
23
- slaSettingTime,
24
- currentTabSelected,
25
- currentOrdenSelected,
26
- handleChangeOrderStatus,
27
- handleSendCustomerReview,
28
- isBusinessApp
29
- } = props;
16
+ handleReorder,
17
+ reorderLoading
18
+ } = props
30
19
 
31
- let hash: any = {};
32
- const [, t] = useLanguage();
33
20
  const theme = useTheme();
34
- const [{ configs }] = useConfig();
35
-
36
-
37
- // const [, setCurrentTime] = useState()
38
- const [openModal, setOpenModal] = useState(false)
39
- const [openReviewModal, setOpenReviewModal] = useState({ order: null, ids: [], customerId: null })
40
- const [openMapViewModal, setOpenMapViewModal] = useState<any>({ open: false, customerLocation: null, locations: [] })
41
- const [orderUpdateStatus, setOrderUpdateStatus] = useState<any>({ action: '', ids: [], body: {}, order: {} })
42
21
 
43
- const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
44
- const viewMapStatus = [9, 18, 19, 23]
45
- const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
46
- const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
47
- const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
48
- const isEnabledOrderNotReady = configs?.order_not_ready_enabled?.value === '1'
49
- const isEnabledFailedPickupDriver = configs?.failed_pickup_by_driver_enabled?.value === '1'
50
-
51
- const handlePressOrder = (order: any) => {
52
- if (order?.locked && isLogisticOrder) return
53
- handleClickOrder && handleClickOrder(order)
54
- if (props.handleClickEvent) {
55
- props.handleClickEvent({ ...order, isLogistic: isLogisticOrder })
56
- } else {
57
- if (isLogisticOrder) {
58
- onNavigationRedirect &&
59
- onNavigationRedirect('OrderDetailsLogistic', { order: { ...order, isLogistic: isLogisticOrder }, handleClickLogisticOrder });
60
- } else {
61
- onNavigationRedirect &&
62
- onNavigationRedirect('OrderDetails', { order });
63
- }
22
+ const styles = StyleSheet.create({
23
+ logo: {
24
+ borderRadius: 10,
25
+ width: 75,
26
+ height: 75
27
+ },
28
+ reorderbutton: {
29
+ width: 80,
30
+ height: 40,
31
+ paddingLeft: 0,
32
+ paddingRight: 0,
33
+ borderRadius: 10,
34
+ flex: 1
35
+ },
36
+ reorderLoading: {
37
+ width: 80,
38
+ height: 40,
39
+ borderRadius: 10,
40
+ },
41
+ buttonText: {
42
+ color: theme.colors.white,
43
+ fontSize: 12,
44
+ marginLeft: 2,
45
+ marginRight: 2
64
46
  }
65
- };
47
+ })
66
48
 
67
- const ordersGroupAction = (param1 = '', param2 = '', { order, action, body, ids }: any = {}) => {
68
- setOrderUpdateStatus({ ...orderUpdateStatus, action, ids, body, order })
69
- if (!param1) setOpenModal(true)
70
- if (param1) {
71
- setOpenModal(false)
72
- handleChangeOrderStatus &&
73
- handleChangeOrderStatus(param1, orderUpdateStatus.ids, param2)
74
- }
49
+ const [, t] = useLanguage()
50
+ const [reorderSelected,setReorderSelected] = useState<number | null>(null)
51
+ const [{ parseDate, optimizeImage }] = useUtils()
52
+ const allowedOrderStatus = [1, 11, 15]
53
+ const [isReviewedOrders, setIsReviewedOrders] = useState<Array<any>>([])
54
+
55
+ const handleReviewState = (orderId: any) => {
56
+ if (!orderId || isReviewedOrders.includes(orderId)) return
57
+ setIsReviewedOrders([ ...isReviewedOrders, orderId ])
75
58
  }
76
59
 
77
- const handleOpenMapView = ({ orders }: any) => {
78
- const locations: any = []
60
+ const handleClickViewOrder = (uuid: string) => {
61
+ onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: uuid })
62
+ }
79
63
 
80
- orders.map((_order: any) => {
81
- if (_order?.driver?.location) {
82
- locations.push({
83
- ..._order?.driver?.location,
84
- title: _order?.driver?.name ?? t('DRIVER', 'Driver'),
85
- icon:
86
- _order?.driver?.photo ||
87
- 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png',
88
- level: 4,
89
- })
90
- }
91
- if (_order?.business?.location) {
92
- locations.push({
93
- ..._order?.business?.location,
94
- title: _order?.business?.name,
95
- address: {
96
- addressName: _order?.business?.address,
97
- zipcode: _order?.business?.zipcode
98
- },
99
- icon:
100
- _order?.business?.logo ||
101
- 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://res.cloudinary.com/ordering2/image/upload/v1654619525/hzegwosnplvrbtjkpfi6.png',
102
- level: 2,
103
- })
104
- }
105
- if (_order?.customer?.location) {
106
- locations.push({
107
- ..._order?.customer?.location,
108
- title: _order?.customer?.name ?? t('CUSTOMER', 'Customer'),
109
- address: {
110
- addressName: _order?.customer?.address,
111
- zipcode: _order?.customer?.zipcode
112
- },
113
- icon:
114
- _order?.customer?.photo ||
115
- 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
116
- level: 3,
117
- })
64
+ const handleClickOrderReview = (order: any) => {
65
+ onNavigationRedirect && onNavigationRedirect(
66
+ 'ReviewOrder',
67
+ {
68
+ order: {
69
+ id: order?.id,
70
+ business_id: order?.business_id,
71
+ logo: order.business?.logo,
72
+ driver: order?.driver,
73
+ products: order?.products,
74
+ review: order?.review,
75
+ user_review: order?.user_review
76
+ },
77
+ handleReviewState: handleReviewState
118
78
  }
119
- })
120
-
121
- setOpenMapViewModal({
122
- ...openMapViewModal,
123
- open: true,
124
- locations,
125
- customerLocation: orders[0]?.customer?.location
126
- })
79
+ )
127
80
  }
128
81
 
129
- // useEffect(() => {
130
- // const interval = setInterval(() => {
131
- // const date: any = Date.now()
132
- // setCurrentTime(date)
133
- // }, slaSettingTime ?? 6000)
134
-
135
- // return () => clearInterval(interval)
136
- // }, [])
137
-
82
+ const handleReorderClick = (id : number) => {
83
+ setReorderSelected(id)
84
+ handleReorder(id)
85
+ }
138
86
 
139
87
  return (
140
- <>
141
- {orders && orders?.length > 0 && orders.map((_order: any) => {
142
- const order = !Array.isArray(_order) && (_order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order)
143
- const _ordersGrouped = Array.isArray(_order) && Object.fromEntries(_order)
144
- return (
145
- _ordersGrouped ? (
146
- <View key={_order[0]} style={{ marginBottom: 10 }}>
147
- {Object.keys(_ordersGrouped).map((k, idx) => (
148
- <OrdersGroupedItem
149
- key={`${k}_${idx}`}
150
- groupId={k}
151
- orders={_ordersGrouped[k]}
152
- >
153
- {_ordersGrouped[k]?.length > 0 &&
154
- _ordersGrouped[k]
155
- ?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
156
- ?.map((_order: any) => {
157
- const order_ = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
158
- return (
159
- <OrdersList
160
- key={order_.id}
161
- order={order_}
162
- _order={_order}
163
- hideBtns
164
- currentOrdenSelected={currentOrdenSelected}
165
- isLogisticOrder={isLogisticOrder}
166
- handlePressOrder={handlePressOrder}
167
- currentTabSelected={currentTabSelected}
168
- getOrderStatus={getOrderStatus}
169
- handleClickLogisticOrder={handleClickLogisticOrder}
170
- />
171
- )
172
- }
173
- )
174
- }
175
- {_ordersGrouped[k][0]?.status === 0 && (
176
- <AcceptOrRejectOrderStyle>
177
- {!isHideRejectButtons && (
178
- <OButton
179
- text={t('REJECT_ALL', 'Reject all')}
180
- bgColor={theme.colors.danger100}
181
- borderColor={theme.colors.danger100}
182
- imgRightSrc={null}
183
- style={{ borderRadius: 7, height: 40 }}
184
- parentStyle={{ width: '45%' }}
185
- textStyle={{ color: theme.colors.danger500, fontSize: 12 }}
186
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
187
- action: 'reject',
188
- order: _ordersGrouped[k][0],
189
- ids: _ordersGrouped[k].map((o: any) => o.id),
190
- handleChangeOrderStatus
191
- })}
192
- />
193
- )}
194
- <OButton
195
- text={t('ACCEPT_ALL', 'Accept all')}
196
- bgColor={theme.colors.success100}
197
- borderColor={theme.colors.success100}
198
- imgRightSrc={null}
199
- style={{ borderRadius: 7, height: 40 }}
200
- parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
201
- textStyle={{ color: theme.colors.success500, fontSize: 12 }}
202
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
203
- action: 'accept',
204
- order: _ordersGrouped[k][0],
205
- ids: _ordersGrouped[k].map((o: any) => o.id),
206
- handleChangeOrderStatus
207
- })}
208
- />
209
- </AcceptOrRejectOrderStyle>
210
- )}
211
- {_ordersGrouped[k][0]?.status === 7 && (
212
- <View>
213
- <OButton
214
- text={t('READY_FOR_PICKUP', 'Ready for pickup')}
215
- bgColor={theme.colors.primaryLight}
216
- borderColor={theme.colors.primaryLight}
217
- imgRightSrc={null}
218
- style={{ borderRadius: 7, height: 40 }}
219
- parentStyle={{ width: '100%' }}
220
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
221
- onClick={() => handleChangeOrderStatus(
222
- 4,
223
- _ordersGrouped[k].map((o: any) => o.id),
224
- )}
225
- />
226
- </View>
227
- )}
228
- {(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
229
- _ordersGrouped[k][0]?.delivery_type === 1 &&
230
- (
231
- <AcceptOrRejectOrderStyle>
232
- <OButton
233
- text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
234
- bgColor={theme.colors.btnBGWhite}
235
- borderColor={theme.colors.btnBGWhite}
236
- imgRightSrc={null}
237
- style={{ borderRadius: 7, height: 40 }}
238
- parentStyle={{ width: '100%' }}
239
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
240
- onClick={() => handleChangeOrderStatus(
241
- 3,
242
- _ordersGrouped[k].map((o: any) => o.id),
243
- )}
244
- />
245
- </AcceptOrRejectOrderStyle>
246
- )}
247
- {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady &&
248
- (
249
- <AcceptOrRejectOrderStyle>
250
- <OButton
251
- text={t('ORDER_NOT_READY', 'Order not ready')}
252
- bgColor={theme.colors.red}
253
- borderColor={theme.colors.red}
254
- imgRightSrc={null}
255
- style={{ borderRadius: 7, height: 40 }}
256
- parentStyle={{ width: '100%' }}
257
- textStyle={{ color: theme.colors.white, fontSize: 12 }}
258
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
259
- action: 'notReady',
260
- order: _ordersGrouped[k][0],
261
- ids: _ordersGrouped[k].map((o: any) => o.id),
262
- handleChangeOrderStatus
263
- })}
264
- />
265
- </AcceptOrRejectOrderStyle>
266
- )}
267
- {viewMapStatus.includes(_ordersGrouped[k][0]?.status) &&
268
- props.appTitle?.text?.includes('Business') &&
269
- (
270
- <View>
271
- <OButton
272
- text={t('TRACK_REAL_TIME_POSITION', 'Track real time position')}
273
- bgColor={theme.colors.primaryLight}
274
- borderColor={theme.colors.primaryLight}
275
- imgRightSrc={null}
276
- style={{ borderRadius: 7, height: 40 }}
277
- parentStyle={{ width: '100%' }}
278
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
279
- onClick={() => handleOpenMapView({ orders: _ordersGrouped[k] })}
280
- />
281
- </View>
282
- )}
283
- {_ordersGrouped[k][0]?.status === 4 &&
284
- ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
285
- (
286
- <AcceptOrRejectOrderStyle>
287
- {!isHideRejectButtons && (
288
- <OButton
289
- text={t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', 'Order not picked up by customer')}
290
- bgColor={theme.colors.danger100}
291
- borderColor={theme.colors.danger100}
292
- imgRightSrc={null}
293
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
294
- parentStyle={{ width: '45%' }}
295
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
296
- onClick={() => handleChangeOrderStatus(
297
- 17,
298
- _ordersGrouped[k].map((o: any) => o.id),
299
- )}
300
- />
301
- )}
302
- <OButton
303
- text={t('PICKUP_COMPLETED_BY_CUSTOMER', 'Pickup completed by customer')}
304
- bgColor={theme.colors.success100}
305
- borderColor={theme.colors.success100}
306
- imgRightSrc={null}
307
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
308
- parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
309
- textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
310
- onClick={() => handleChangeOrderStatus(
311
- 15,
312
- _ordersGrouped[k].map((o: any) => o.id),
313
- )}
314
- />
315
- </AcceptOrRejectOrderStyle>
316
- )}
317
- {!_ordersGrouped[k][0]?.user_review &&
318
- pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
319
- (
320
- <OButton
321
- text={t('REVIEW_CUSTOMER', 'Review customer')}
322
- bgColor={theme.colors.primary}
323
- borderColor={theme.colors.primary}
324
- imgRightSrc={null}
325
- style={{ borderRadius: 8, height: 40 }}
326
- parentStyle={{ width: '100%' }}
327
- textStyle={{ color: theme.colors.white }}
328
- onClick={() => setOpenReviewModal({
329
- order: _ordersGrouped[k][0],
330
- customerId: _ordersGrouped[k][0]?.customer_id,
331
- ids: _ordersGrouped[k].map((o: any) => o.id)
332
- })}
333
- />
334
- )}
335
- {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && (
336
- <AcceptOrRejectOrderStyle>
337
- {!isHideRejectButtons && isEnabledOrderNotReady && (
338
- <OButton
339
- text={t('PICKUP_FAILED', 'Pickup failed')}
340
- bgColor={theme.colors.danger100}
341
- borderColor={theme.colors.danger100}
342
- imgRightSrc={null}
343
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
344
- parentStyle={{ width: '45%' }}
345
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
346
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
347
- action: 'pickupFailed',
348
- order: _ordersGrouped[k][0],
349
- ids: _ordersGrouped[k].map((o: any) => o.id),
350
- handleChangeOrderStatus
351
- })}
352
- />
353
- )}
354
- <OButton
355
- text={t('PICKUP_COMPLETE', 'Pickup complete')}
356
- bgColor={theme.colors.success100}
357
- borderColor={theme.colors.success100}
358
- imgRightSrc={null}
359
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
360
- parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
361
- textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
362
- onClick={() => handleChangeOrderStatus(
363
- 9,
364
- _ordersGrouped[k].map((o: any) => o.id),
365
- )}
366
- />
367
- </AcceptOrRejectOrderStyle>
368
- )}
369
- {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
370
- <AcceptOrRejectOrderStyle>
371
- {!isHideRejectButtons && (
372
- <OButton
373
- text={t('DELIVERY_FAILED', 'Delivery Failed')}
374
- bgColor={theme.colors.danger100}
375
- borderColor={theme.colors.danger100}
376
- imgRightSrc={null}
377
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
378
- parentStyle={{ width: '45%' }}
379
- textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
380
- onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
381
- action: 'deliveryFailed',
382
- order: _ordersGrouped[k][0],
383
- ids: _ordersGrouped[k].map((o: any) => o.id),
384
- handleChangeOrderStatus
385
- })}
386
- />
387
- )}
388
- <OButton
389
- text={t('DELIVERY_COMPLETE', 'Delivery complete')}
390
- bgColor={theme.colors.success100}
391
- borderColor={theme.colors.success100}
392
- imgRightSrc={null}
393
- style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
394
- parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
395
- textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
396
- onClick={() => handleChangeOrderStatus(
397
- 11,
398
- _ordersGrouped[k].map((o: any) => o.id),
399
- )}
400
- />
401
- </AcceptOrRejectOrderStyle>
402
- )}
403
- </OrdersGroupedItem>
404
- ))}
405
- </View>
406
- ) : (
407
- <View key={order.id}>
408
- <OrdersList
409
- order={order}
410
- _order={_order}
411
- currentOrdenSelected={currentOrdenSelected}
412
- isLogisticOrder={isLogisticOrder}
413
- handlePressOrder={handlePressOrder}
414
- currentTabSelected={currentTabSelected}
415
- getOrderStatus={getOrderStatus}
416
- handleClickLogisticOrder={handleClickLogisticOrder}
88
+ <ScrollView
89
+ style={{ height: '60%', marginBottom: 30 }}
90
+ >
91
+ {orders.map((order: any) => (
92
+ <Card
93
+ key={order.id}
94
+ >
95
+ {!!order.business?.logo && (
96
+ <Logo>
97
+ <OIcon
98
+ url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
99
+ style={styles.logo}
417
100
  />
418
- </View>
419
- )
420
- )
421
- })}
422
-
423
- <OModal
424
- open={openModal}
425
- onClose={() => setOpenModal(false)}
426
- entireModal
427
- customClose
428
- >
429
- <AcceptOrRejectOrder
430
- notShowCustomerPhone={false}
431
- appTitle={props.appTitle}
432
- customerCellphone={orderUpdateStatus.order?.customer?.cellphone}
433
- action={orderUpdateStatus.action}
434
- orderId={orderUpdateStatus.ids?.[0]}
435
- actions={props.actions}
436
- orderTitle={props.orderTitle}
437
- handleUpdateOrder={ordersGroupAction}
438
- closeModal={() => setOpenModal(false)}
439
- />
440
- </OModal>
441
- <OModal
442
- open={!!openReviewModal?.order}
443
- onClose={() => setOpenReviewModal({ order: null, ids: [], customerId: null })}
444
- entireModal
445
- customClose
446
- >
447
- <ReviewCustomer
448
- order={openReviewModal?.order}
449
- closeModal={() => setOpenReviewModal({ order: null, ids: [], customerId: null })}
450
- onClose={() => setOpenReviewModal({ order: null, ids: [], customerId: null })}
451
- handleCustomCustomerReview={(body: any) => handleSendCustomerReview({
452
- onClose: setOpenReviewModal({ order: null, ids: [], customerId: null }),
453
- customerId: openReviewModal?.customerId,
454
- orderIds: openReviewModal?.ids,
455
- body
456
- })}
457
- />
458
- </OModal>
459
- <OModal
460
- open={openMapViewModal.open}
461
- onClose={() => setOpenMapViewModal({ ...openMapViewModal, open: false })}
462
- entireModal
463
- customClose
464
- >
465
- <GoogleMap
466
- readOnly
467
- navigation={props.navigation}
468
- location={openMapViewModal.customerLocation}
469
- locations={openMapViewModal.locations}
470
- handleOpenMapView={() => setOpenMapViewModal({
471
- ...openMapViewModal,
472
- open: !openMapViewModal
473
- })}
474
- />
475
- </OModal>
476
- </>
477
- );
478
- };
479
-
480
- PreviousOrders.defaultProps = {
481
- orders: []
101
+ </Logo>
102
+ )}
103
+ <Information>
104
+ <ScrollView
105
+ showsVerticalScrollIndicator={false}
106
+ showsHorizontalScrollIndicator={false}
107
+ horizontal
108
+ >
109
+ <OText size={17} >
110
+ {order.business?.name}
111
+ </OText>
112
+ </ScrollView>
113
+ <OText size={15} color={theme.colors.textSecondary} numberOfLines={1}>
114
+ {order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })}
115
+ </OText>
116
+ <MyOrderOptions>
117
+ <TouchableOpacity onPress={() => handleClickViewOrder(order?.uuid)}>
118
+ <OText size={16} color={theme.colors.primary} mRight={5} numberOfLines={1}>{t('MOBILE_FRONT_BUTTON_VIEW_ORDER', 'View order')}</OText>
119
+ </TouchableOpacity>
120
+ {
121
+ allowedOrderStatus.includes(parseInt(order?.status)) && !order.review && !isReviewedOrders.includes(order?.id) && (
122
+ <TouchableOpacity onPress={() => handleClickOrderReview(order)}>
123
+ <OText size={16} color={theme.colors.primary} numberOfLines={1}>{t('REVIEW_ORDER', 'Review Order')}</OText>
124
+ </TouchableOpacity>
125
+ )}
126
+ </MyOrderOptions>
127
+ </Information>
128
+ <Status>
129
+ <ScrollView
130
+ showsVerticalScrollIndicator={false}
131
+ showsHorizontalScrollIndicator={false}
132
+ horizontal
133
+ >
134
+ <OText
135
+ color={theme.colors.primary}
136
+ size={16}
137
+ numberOfLines={1}
138
+ >
139
+ {getOrderStatus(order.status)?.value}
140
+ </OText>
141
+ </ScrollView>
142
+ <OButton
143
+ text={t('REORDER', 'Reorder')}
144
+ imgRightSrc={''}
145
+ textStyle={styles.buttonText}
146
+ style={reorderLoading && order.id === reorderSelected ? styles.reorderLoading : styles.reorderbutton}
147
+ onClick={() => handleReorderClick(order.id)}
148
+ isLoading={reorderLoading && order.id === reorderSelected}
149
+ />
150
+ </Status>
151
+
152
+ </Card>
153
+ ))}
154
+ {pagination.totalPages && pagination.currentPage < pagination.totalPages && (
155
+ <WrappButton>
156
+ <OButton
157
+ onClick={loadMoreOrders}
158
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
159
+ imgRightSrc={null}
160
+ textStyle={{color: theme.colors.white}}
161
+ />
162
+ </WrappButton>
163
+ )}
164
+ </ScrollView>
165
+
166
+ )
482
167
  }
@@ -168,7 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
168
168
  setFeaturedBusinesses(ary);
169
169
  }
170
170
  resetInactivityTimeout()
171
- }, [businessesList.loading])
171
+ }, [businessesList.loading, businessesList?.businesses])
172
172
 
173
173
  const handleOnRefresh = () => {
174
174
  if (!businessesList.loading) {