ordering-ui-react-native 0.21.86-release → 0.21.87-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.
Files changed (26) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/Chat/index.tsx +3 -2
  3. package/themes/business/src/components/DriverMap/index.tsx +5 -0
  4. package/themes/business/src/components/NewOrderNotification/index.tsx +5 -15
  5. package/themes/business/src/components/OrderDetails/Business.tsx +10 -3
  6. package/themes/business/src/components/OrderDetails/Delivery.tsx +101 -36
  7. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +3 -2
  8. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +5 -0
  9. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  10. package/themes/business/src/components/OrdersListManager/index.tsx +5 -1
  11. package/themes/business/src/components/OrdersOption/index.tsx +6 -2
  12. package/themes/business/src/components/PreviousMessages/index.tsx +6 -0
  13. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +15 -4
  14. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  15. package/themes/business/src/utils/index.tsx +6 -0
  16. package/themes/original/src/components/Checkout/index.tsx +1 -0
  17. package/themes/original/src/components/MessageListing/index.tsx +1 -1
  18. package/themes/original/src/components/Messages/index.tsx +5 -2
  19. package/themes/original/src/components/OrderDetails/OrderEta.tsx +3 -2
  20. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +4 -1
  21. package/themes/original/src/components/OrderDetails/index.tsx +10 -6
  22. package/themes/original/src/components/OrderProgress/index.tsx +4 -3
  23. package/themes/original/src/components/OrdersOption/index.tsx +2 -2
  24. package/themes/original/src/components/UserFormDetails/index.tsx +1 -1
  25. package/themes/original/src/components/shared/OModal.tsx +7 -2
  26. package/themes/original/src/utils/index.tsx +18 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.21.86-release",
3
+ "version": "0.21.87-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -69,7 +69,7 @@ const ChatUI = (props: MessagesParams) => {
69
69
  const [, { showToast }] = useToast();
70
70
  const theme = useTheme();
71
71
  const [messageList, setMessageList] = useState<any>([])
72
- const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
72
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
73
73
  const chatDisabled = previousStatus.includes(order?.status)
74
74
 
75
75
  const ORDER_STATUS: any = {
@@ -98,7 +98,8 @@ const ChatUI = (props: MessagesParams) => {
98
98
  22: t('ORDER_LOOKING_FOR_DRIVER', 'Order looking for driver'),
99
99
  23: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
100
100
  24: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
101
- 25: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
101
+ 25: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
102
+ 26: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
102
103
  }
103
104
 
104
105
  const getLogisticTag = (status: any) => {
@@ -236,6 +236,11 @@ export const DriverMap = (props: GoogleMapsParams) => {
236
236
  19: theme.colors.statusOrderBlue,
237
237
  20: theme.colors.statusOrderBlue,
238
238
  21: theme.colors.statusOrderBlue,
239
+ 22: theme.colors.statusOrderBlue,
240
+ 23: theme.colors.statusOrderBlue,
241
+ 24: theme.colors.statusOrderBlue,
242
+ 25: theme.colors.statusOrderBlue,
243
+ 26: theme.colors.statusOrderBlue,
239
244
  //GREEN
240
245
  1: theme.colors.statusOrderGreen,
241
246
  11: theme.colors.statusOrderGreen,
@@ -178,21 +178,11 @@ const NewOrderNotificationUI = (props: any) => {
178
178
  handleEventNotification(3, o, orderStatus)
179
179
  }
180
180
 
181
- if (!events?._events?.message_added_notification || events?._events?.message_added_notification?.length < 2) {
182
- events.on('message_added_notification', handleEventTypeOne)
183
- }
184
- if (!events?._events?.order_added_notification || events?._events?.order_added_notification?.length < 2) {
185
- events.on('order_added_notification', handleEventTypeTwo)
186
- }
187
- if (!events?._events?.order_updated_notification || events?._events?.order_updated_notification?.length < 2) {
188
- events.on('order_updated_notification', handleEventTypeThree)
189
- }
190
- if (!events?._events?.request_register_notification || events?._events?.request_register_notification?.length < 2) {
191
- events.on('request_register_notification', handleEventTypeTwo)
192
- }
193
- if (!events?._events?.request_update_notification || events?._events?.request_update_notification?.length < 2) {
194
- events.on('request_update_notification', handleEventTypeThree)
195
- }
181
+ events.on('message_added_notification', handleEventTypeOne)
182
+ events.on('order_added_notification', handleEventTypeTwo)
183
+ events.on('order_updated_notification', handleEventTypeThree)
184
+ events.on('request_register_notification', handleEventTypeTwo)
185
+ events.on('request_update_notification', handleEventTypeThree)
196
186
 
197
187
  return () => {
198
188
  events.off('message_added_notification', handleEventTypeOne)
@@ -81,6 +81,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
81
81
 
82
82
  const orderToComplete = [4, 20, 21]
83
83
  const orderToReady = [7, 14]
84
+ const deliveryTypes = [1, 7]
84
85
 
85
86
  if (order?.status === 7 || order?.status === 4) {
86
87
  if (drivers?.length > 0 && drivers) {
@@ -211,7 +212,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
211
212
  ? t('EAT_IN', 'Eat in')
212
213
  : order.delivery_type === 4
213
214
  ? t('CURBSIDE', 'Curbside')
214
- : t('DRIVER_THRU', 'Driver thru')
215
+ : order.delivery_type === 5
216
+ ? t('DRIVER_THRU', 'Driver thru')
217
+ : order.delivery_type === 7
218
+ ? t('CATERING_DELIVERY', 'Catering delivery')
219
+ : order.delivery_type === 8
220
+ ? t('CATERING_PICKUP', 'Catering pickup')
221
+ : t('DELIVERY', 'Delivery')
215
222
  }\n`
216
223
  : '';
217
224
 
@@ -497,7 +504,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
497
504
  <>
498
505
  <OrderContentComponent order={order} />
499
506
  {(order?.status === 7 || order?.status === 4) &&
500
- order?.delivery_type === 1 && configs?.assign_driver_enabled?.value === '1' && (
507
+ deliveryTypes.includes(order?.delivery_type) && configs?.assign_driver_enabled?.value === '1' && (
501
508
  <AssignDriver>
502
509
  <OText style={{ marginBottom: 5 }} size={16} weight="600">
503
510
  {t('ASSIGN_DRIVER', 'Assign driver')}
@@ -665,7 +672,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
665
672
  disabled={loading}
666
673
  />
667
674
  )}
668
- {orderToComplete.includes(order?.status) && ![1].includes(order?.delivery_type) && (
675
+ {orderToComplete.includes(order?.status) && !deliveryTypes.includes(order?.delivery_type) && (
669
676
  <FloatingButton
670
677
  btnText={t(
671
678
  'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
@@ -1,12 +1,10 @@
1
- //React & React Native
2
1
  import React, { useState, useEffect } from 'react';
3
2
  import { StyleSheet, View } from 'react-native';
4
3
 
5
- // Thirds
6
4
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
5
  import Clipboard from '@react-native-clipboard/clipboard';
6
+ import MCIcon from 'react-native-vector-icons/MaterialCommunityIcons';
8
7
 
9
- //OrderingComponent
10
8
  import {
11
9
  useLanguage,
12
10
  OrderDetails as OrderDetailsConTableoller,
@@ -17,13 +15,12 @@ import {
17
15
  useConfig
18
16
  } from 'ordering-components/native';
19
17
 
20
- //Components
21
18
  import Alert from '../../providers/AlertProvider';
22
19
  import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
23
20
  import { Chat } from '../Chat';
24
21
  import { FloatingButton } from '../FloatingButton';
25
22
  import { DriverMap } from '../DriverMap';
26
- import { OButton } from '../shared';
23
+ import { OButton, OText } from '../shared';
27
24
  import { OModal } from '../shared';
28
25
  import { OrderDetailsParams } from '../../types';
29
26
  import { USER_TYPE } from '../../config/constants';
@@ -32,8 +29,8 @@ import { NotFoundSource } from '../NotFoundSource';
32
29
  import { verifyDecimals, getProductPrice, getOrderStatus } from '../../utils';
33
30
  import { OrderHeaderComponent } from './OrderHeaderComponent';
34
31
  import { OrderContentComponent } from './OrderContentComponent';
35
- //Styles
36
32
  import { OrderDetailsContainer, Pickup } from './styles';
33
+ import { useOfflineActions } from '../../../../../src/context/OfflineActions';
37
34
 
38
35
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
39
36
  const {
@@ -42,7 +39,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
42
39
  setMessages,
43
40
  readMessages,
44
41
  messagesReadList,
45
- handleChangeOrderStatus,
46
42
  permissions,
47
43
  askLocationPermission,
48
44
  driverLocation,
@@ -56,8 +52,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
56
52
  forceUpdate,
57
53
  getPermissions,
58
54
  orderAssingId,
59
- isGrantedPermissions,
55
+ isGrantedPermissions
60
56
  } = props;
57
+
61
58
  const [, { showToast }] = useToast();
62
59
  const [{ parsePrice, parseNumber }] = useUtils();
63
60
  const [{ configs }] = useConfig();
@@ -72,6 +69,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
72
69
  const theme = useTheme();
73
70
  const [, t] = useLanguage();
74
71
  const [session] = useSession();
72
+ const [{ isNetConnected, canSaveChangesOffline }, { applyOffAction, registerOffOrder }] = useOfflineActions()
73
+
75
74
  const [actionOrder, setActionOrder] = useState('');
76
75
  const [unreadAlert, setUnreadAlert] = useState({
77
76
  business: false,
@@ -86,12 +85,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
86
85
  key?: string | null;
87
86
  }>({ open: false, content: [], key: null });
88
87
 
89
- const validStatusComplete = [9, 19, 23]
88
+ const disabledActionsByInternet = !isNetConnected && canSaveChangesOffline === false
89
+
90
+ const validStatusComplete = [9, 19, 23, 26]
90
91
 
91
92
  const pendingOrderStatus = [1, 4, 7, 13]
92
93
 
93
94
  const logisticOrderStatus = [4, 6, 7]
94
95
 
96
+ const deliveryTypes = [1, 7]
97
+
95
98
  const showFloatButtonsPickUp: any = {
96
99
  8: !isHideRejectButtons,
97
100
  3: true,
@@ -105,13 +108,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
105
108
  14: true
106
109
  };
107
110
 
108
- const marginContainer: any = {
109
- 0: true,
110
- 3: true,
111
- 7: true,
112
- 8: true,
113
- 9: true,
114
- };
111
+ const handleChangeOrderStatus = async (status: number) => {
112
+ if (!isNetConnected && canSaveChangesOffline !== false) {
113
+ const result = applyOffAction({
114
+ event: 'evt_off_change_order_status',
115
+ data: { orderId: order?.id, body: { status } }
116
+ })
117
+ }
118
+
119
+ const dataToSave: any = !isNetConnected && canSaveChangesOffline !== false
120
+ ? { dataToSave: { status, unsync: true } }
121
+ : null
122
+ const orderUpdated = await props.handleChangeOrderStatus(status, {}, dataToSave)
123
+
124
+ if (!isNetConnected && canSaveChangesOffline !== false) {
125
+ await registerOffOrder(orderUpdated)
126
+ }
127
+ }
115
128
 
116
129
  const handleOpenMessagesForBusiness = () => {
117
130
  setOpenModalForBusiness(true);
@@ -222,7 +235,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
222
235
  ? t('EAT_IN', 'Eat in')
223
236
  : order.delivery_type === 4
224
237
  ? t('CURBSIDE', 'Curbside')
225
- : t('DRIVER_THRU', 'Driver thru')
238
+ : order.delivery_type === 5
239
+ ? t('DRIVER_THRU', 'Driver thru')
240
+ : order.delivery_type === 7
241
+ ? t('CATERING_DELIVERY', 'Catering delivery')
242
+ : order.delivery_type === 8
243
+ ? t('CATERING_PICKUP', 'Catering pickup')
244
+ : t('DELIVERY', 'Delivery')
226
245
  }\n`
227
246
  : '';
228
247
 
@@ -449,8 +468,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
449
468
  let locationMarker: any;
450
469
  let isToFollow = false;
451
470
  let isBusinessMarker = false;
452
-
453
- if (order?.status === 7 || order?.status === 8 || order?.status === 18) {
471
+ const customerStatusses = [3, 9, 19, 23, 26]
472
+ const businessStatusses = [7, 8, 18]
473
+ if (businessStatusses?.includes(order?.status)) {
454
474
  const markerBusiness = 'Business';
455
475
  isBusinessMarker = true;
456
476
  locationMarker = locations.find(
@@ -460,7 +480,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
460
480
  if (order?.status === 8 || order?.status === 18) {
461
481
  isToFollow = true;
462
482
  }
463
- } else if (order?.status === 3 || order?.status === 9 || order?.status === 19 || order?.status === 23) {
483
+ } else if (customerStatusses?.includes(order?.status)) {
464
484
  const markerCustomer = 'Customer';
465
485
  isToFollow = true;
466
486
  isBusinessMarker = false;
@@ -488,20 +508,36 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
488
508
  isOrderGroup={isOrderGroup}
489
509
  lastOrder={lastOrder}
490
510
  />
491
- {(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && !props.order?.loading && (
511
+ {(order?.status === 8 || order?.status === 18) && deliveryTypes?.includes(order?.delivery_type) && !props.order?.loading && (
492
512
  <Pickup>
493
513
  <OButton
494
514
  style={styles.btnPickUp}
495
515
  textStyle={{ color: theme.colors.primary }}
496
516
  text={t('ARRIVED_TO_BUSINESS', 'Arrived to bussiness')}
517
+ isDisabled={disabledActionsByInternet}
497
518
  onClick={() =>
498
- handleChangeOrderStatus && isGrantedPermissions ? handleChangeOrderStatus(3) : goToPermissionPage()
519
+ isGrantedPermissions ? handleChangeOrderStatus(3) : goToPermissionPage()
499
520
  }
500
521
  imgLeftStyle={{ tintColor: theme.colors.backArrow }}
501
522
  />
502
523
  </Pickup>
503
524
  )}
504
- {order?.status === 3 && order?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady && !props.order?.loading && (
525
+
526
+ {(order?.status === 9 || order?.status === 19) && deliveryTypes?.includes(order?.delivery_type) && !props.order?.loading && (
527
+ <View style={{ paddingVertical: 20, marginBottom: 20 }}>
528
+ <OButton
529
+ style={styles.btnPickUp}
530
+ textStyle={{ color: theme.colors.primary }}
531
+ text={t('ARRIVED_TO_CUSTOMER', 'Arrived to customer')}
532
+ isDisabled={disabledActionsByInternet}
533
+ onClick={() =>
534
+ isGrantedPermissions ? handleChangeOrderStatus(26) : goToPermissionPage()
535
+ }
536
+ imgLeftStyle={{ tintColor: theme.colors.backArrow }}
537
+ />
538
+ </View>
539
+ )}
540
+ {order?.status === 3 && deliveryTypes?.includes(order?.delivery_type) && !isHideRejectButtons && isEnabledOrderNotReady && !props.order?.loading && (
505
541
  <View style={{ paddingVertical: 20, marginBottom: 20 }}>
506
542
  <OButton
507
543
  style={styles.btnPickUp}
@@ -518,7 +554,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
518
554
  <View
519
555
  style={{
520
556
  height:
521
- order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
557
+ order?.status === 8 && deliveryTypes?.includes(order?.delivery_type) ? 50 : 35,
522
558
  }}
523
559
  />
524
560
 
@@ -548,6 +584,28 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
548
584
  {!((!order || Object.keys(order).length === 0) &&
549
585
  (props.order?.error?.length < 1 || !props.order?.error)) && order?.id && (
550
586
  <View style={{ flex: 1 }}>
587
+ {order?.unsync && (
588
+ <View
589
+ style={{
590
+ flexDirection: 'row',
591
+ justifyContent: 'flex-start',
592
+ alignItems: 'center'
593
+ }}
594
+ >
595
+ <MCIcon
596
+ name={'cloud-sync'}
597
+ color={'#444'}
598
+ size={16}
599
+ />
600
+ <OText
601
+ size={14}
602
+ color={theme.colors.textGray}
603
+ style={{ marginLeft: 5 }}
604
+ >
605
+ {t('PENDING_SYNC_CHANGES', 'Pending sync changes')}
606
+ </OText>
607
+ </View>
608
+ )}
551
609
  <OrderHeaderComponent
552
610
  order={order}
553
611
  handleOpenMapView={handleOpenMapView}
@@ -571,11 +629,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
571
629
  </OrderDetailsContainer>
572
630
  {showFloatButtonsPickUp[order?.status] && (
573
631
  <FloatingButton
574
- disabled={props.order?.loading}
632
+ disabled={props.order?.loading || disabledActionsByInternet}
575
633
  btnText={t('PICKUP_FAILED', 'Pickup failed')}
576
634
  isSecondaryBtn={false}
577
635
  secondButtonClick={() =>
578
- handleChangeOrderStatus && isGrantedPermissions ? handleChangeOrderStatus(9) : goToPermissionPage()
636
+ isGrantedPermissions ? handleChangeOrderStatus(9) : goToPermissionPage()
579
637
  }
580
638
  firstButtonClick={() =>
581
639
  handleViewActionOrder && handleViewActionOrder('pickupFailed')
@@ -591,11 +649,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
591
649
  {(validStatusComplete.includes(order?.status)) && (
592
650
  <>
593
651
  <FloatingButton
594
- disabled={props.order?.loading}
652
+ disabled={props.order?.loading || disabledActionsByInternet}
595
653
  btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
596
654
  isSecondaryBtn={false}
597
655
  secondButtonClick={() =>
598
- handleChangeOrderStatus && isGrantedPermissions ? handleChangeOrderStatus(11) : goToPermissionPage()
656
+ isGrantedPermissions ? handleChangeOrderStatus(11) : goToPermissionPage()
599
657
  }
600
658
  firstButtonClick={() =>
601
659
  handleViewActionOrder && handleViewActionOrder('deliveryFailed')
@@ -611,17 +669,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
611
669
  )}
612
670
  {showFloatButtonsAcceptOrReject[order?.status] && (
613
671
  <FloatingButton
614
- disabled={props.order?.loading}
672
+ disabled={props.order?.loading || disabledActionsByInternet}
673
+ widthButton={isHideRejectButtons ? '100%' : '45%'}
674
+ isHideRejectButtons={isHideRejectButtons}
615
675
  btnText={t('REJECT', 'Reject')}
676
+ firstColorCustom={theme.colors.red}
677
+ firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))
678
+ ? handleRejectLogisticOrder()
679
+ : handleViewActionOrder('reject')
680
+ }
616
681
  isSecondaryBtn={false}
617
- secondButtonClick={() => hideTimer ? handleChangeOrderStatus && handleChangeOrderStatus(8) : (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
618
- firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
619
- secondBtnText={t('ACCEPT', 'Accept')}
620
682
  secondButton={true}
621
- firstColorCustom={theme.colors.red}
683
+ secondBtnText={t('ACCEPT', 'Accept')}
684
+ secondButtonClick={() => hideTimer
685
+ ? handleChangeOrderStatus(8)
686
+ : (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)))
687
+ ? handleAcceptLogisticOrder(order)
688
+ : handleViewActionOrder('accept')}
622
689
  secondColorCustom={theme.colors.green}
623
- widthButton={isHideRejectButtons ? '100%' : '45%'}
624
- isHideRejectButtons={isHideRejectButtons}
625
690
  />
626
691
  )}
627
692
  </>
@@ -676,7 +741,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
676
741
  entireModal
677
742
  customClose>
678
743
  <AcceptOrRejectOrder
679
- handleUpdateOrder={handleChangeOrderStatus}
744
+ handleUpdateOrder={props.handleChangeOrderStatus}
680
745
  closeModal={setOpenModalForAccept}
681
746
  customerCellphone={order?.customer?.cellphone}
682
747
  loading={props.order?.loading}
@@ -68,6 +68,7 @@ export const OrderContentComponent = (props: OrderContent) => {
68
68
  })
69
69
 
70
70
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
71
+ const deliveryTypes = [1, 7]
71
72
 
72
73
  const walletName: any = {
73
74
  cash: {
@@ -412,9 +413,9 @@ export const OrderContentComponent = (props: OrderContent) => {
412
413
  {t('ON_BEHALF_OF', 'On behalf of')}{': '} {order?.on_behalf_of}
413
414
  </OText>
414
415
  )}
415
- {(order?.delivery_option !== undefined && order?.delivery_type === 1) && (
416
+ {(order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type)) && (
416
417
  <View style={{ marginTop: 10 }}>
417
- {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
418
+ {order?.delivery_option !== undefined && deliveryTypes.includes(order?.delivery_type) && (
418
419
  <OText>
419
420
  {t(order?.delivery_option?.name?.toUpperCase?.()?.replace(/ /g, '_'), order?.delivery_option?.name)}
420
421
  </OText>
@@ -102,6 +102,11 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
102
102
  19: theme.colors.statusOrderBlue,
103
103
  20: theme.colors.statusOrderBlue,
104
104
  21: theme.colors.statusOrderBlue,
105
+ 22: theme.colors.statusOrderBlue,
106
+ 23: theme.colors.statusOrderBlue,
107
+ 24: theme.colors.statusOrderBlue,
108
+ 25: theme.colors.statusOrderBlue,
109
+ 26: theme.colors.statusOrderBlue,
105
110
  //GREEN
106
111
  1: theme.colors.statusOrderGreen,
107
112
  11: theme.colors.statusOrderGreen,
@@ -44,6 +44,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
44
44
  }>({ open: false, content: [], key: null });
45
45
 
46
46
  const logisticOrderStatus = [4, 6, 7]
47
+ const deliveryTypes = [1, 7]
47
48
  const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1'
48
49
 
49
50
  const showFloatButtonsAcceptOrReject: any = {
@@ -99,7 +100,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
99
100
  <View
100
101
  style={{
101
102
  height:
102
- order?.status === 8 && order?.delivery_type === 1 ? 50 : 35,
103
+ order?.status === 8 && deliveryTypes?.includes(order?.delivery_type) ? 50 : 35,
103
104
  }}
104
105
  />
105
106
 
@@ -170,7 +171,7 @@ export const OrderDetailsLogisticUI = (props: OrderDetailsLogisticParams) => {
170
171
  secondButton={true}
171
172
  firstColorCustom={theme.colors.red}
172
173
  secondColorCustom={theme.colors.green}
173
- widthButton={isHideRejectButtons ? '100%': '45%'}
174
+ widthButton={isHideRejectButtons ? '100%' : '45%'}
174
175
  isHideRejectButtons={isHideRejectButtons}
175
176
  />
176
177
  )}
@@ -854,6 +854,10 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
854
854
  {
855
855
  key: 25,
856
856
  text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
857
+ },
858
+ {
859
+ key: 26,
860
+ text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
857
861
  }
858
862
  ],
859
863
  tabs: [
@@ -866,7 +870,7 @@ export const OrdersListManager = (props: OrdersOptionParams) => {
866
870
  {
867
871
  key: 1,
868
872
  text: t('IN_PROGRESS', 'In Progress'),
869
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25],
873
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
870
874
  title: 'inProgress',
871
875
  },
872
876
  {
@@ -1123,13 +1123,17 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1123
1123
  {
1124
1124
  key: 25,
1125
1125
  text: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company')
1126
+ },
1127
+ {
1128
+ key: 26,
1129
+ text: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer')
1126
1130
  }
1127
1131
  ],
1128
1132
  tabs: combineTabs ? [
1129
1133
  {
1130
1134
  key: 0,
1131
1135
  text: t('ACTIVE', 'Active'),
1132
- tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25],
1136
+ tags: props?.orderGroupStatusCustom?.active ?? [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
1133
1137
  title: 'active',
1134
1138
  },
1135
1139
  {
@@ -1155,7 +1159,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
1155
1159
  {
1156
1160
  key: 1,
1157
1161
  text: t('IN_PROGRESS', 'In Progress'),
1158
- tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25],
1162
+ tags: props?.orderGroupStatusCustom?.inProgress ?? [3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
1159
1163
  title: 'inProgress',
1160
1164
  },
1161
1165
  {
@@ -214,6 +214,12 @@ export const PreviousMessages = (props: PreviousMessagesParams) => {
214
214
  value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
215
215
  slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
216
216
  percentage: 25
217
+ },
218
+ {
219
+ key: 26,
220
+ value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
221
+ slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
222
+ percentage: 80
217
223
  }
218
224
  ];
219
225
 
@@ -58,9 +58,14 @@ export const OrderItem = React.memo((props: any) => {
58
58
  const styles = StyleSheet.create({
59
59
  cardButton: {
60
60
  flex: 1,
61
- paddingVertical: (isIpad || isTablet) ? 20 : 0,
62
- marginBottom: IS_PORTRAIT ? 25 : 0,
61
+ paddingVertical: (isIpad || isTablet) ? 20 : 15,
62
+ marginBottom: IS_PORTRAIT ? 15 : 0,
63
63
  marginLeft: 3,
64
+ backgroundColor: order?.time_status === 'delayed'
65
+ ? theme.colors.danger100
66
+ : order?.time_status === 'at_risk'
67
+ ? theme.colors.warning100
68
+ : theme.colors.primaryContrast
64
69
  },
65
70
  icon: {
66
71
  borderRadius: 7.6,
@@ -207,7 +212,7 @@ export const OrderItem = React.memo((props: any) => {
207
212
  : parseDate(order?.delivery_datetime, { utc: false })}`)}
208
213
  </OText>
209
214
  )}
210
- {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
215
+ {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress' || currentTabSelected === 'active') && allowColumns?.timer) && (
211
216
  <>
212
217
  <OText
213
218
  style={styles.date}
@@ -241,7 +246,13 @@ export const OrderItem = React.memo((props: any) => {
241
246
  ? t('EAT_IN', 'Eat in')
242
247
  : order.delivery_type === 4
243
248
  ? t('CURBSIDE', 'Curbside')
244
- : t('DRIVER_THRU', 'Driver thru')}
249
+ : order.delivery_type === 5
250
+ ? t('DRIVER_THRU', 'Driver thru')
251
+ : order.delivery_type === 7
252
+ ? t('CATERING_DELIVERY', 'Catering delivery')
253
+ : order.delivery_type === 8
254
+ ? t('CATERING_PICKUP', 'Catering pickup')
255
+ : t('DELIVERY', 'Delivery')}
245
256
  {` · ${getOrderStatus(order.status)}`}
246
257
  </OText>
247
258
  </MyOrderOptions>
@@ -11,6 +11,7 @@ import { OrdersList } from './OrderList';
11
11
  import { AcceptOrRejectOrder } from '../AcceptOrRejectOrder';
12
12
  import { ReviewCustomer } from '../ReviewCustomer';
13
13
  import { GoogleMap } from '../GoogleMap';
14
+ import { useOfflineActions } from '../../../../../src/context/OfflineActions';
14
15
 
15
16
  export const PreviousOrders = (props: any) => {
16
17
  const {
@@ -32,7 +33,7 @@ export const PreviousOrders = (props: any) => {
32
33
  const [, t] = useLanguage();
33
34
  const theme = useTheme();
34
35
  const [{ configs }] = useConfig();
35
-
36
+ const [{ isNetConnected, canSaveChangesOffline }] = useOfflineActions()
36
37
 
37
38
  // const [, setCurrentTime] = useState()
38
39
  const [openModal, setOpenModal] = useState(false)
@@ -41,12 +42,14 @@ export const PreviousOrders = (props: any) => {
41
42
  const [orderUpdateStatus, setOrderUpdateStatus] = useState<any>({ action: '', ids: [], body: {}, order: {} })
42
43
 
43
44
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
44
- const viewMapStatus = [9, 18, 19, 23]
45
+ const viewMapStatus = [9, 18, 19, 23, 26]
46
+ const deliveryTypes = [1, 7]
45
47
  const deliveryPickupBtn = props.appTitle?.text?.includes('Delivery') && [3, 8, 18]
46
- const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23]
48
+ const deliveryStatusCompleteBtn = props.appTitle?.text?.includes('Delivery') && [9, 19, 23, 26]
47
49
  const isHideRejectButtons = configs?.reject_orders_enabled && configs?.reject_orders_enabled?.value !== '1' && !isBusinessApp
48
50
  const isEnabledOrderNotReady = configs?.order_not_ready_enabled?.value === '1'
49
51
  const isEnabledFailedPickupDriver = configs?.failed_pickup_by_driver_enabled?.value === '1'
52
+ const disabledActionsByInternet = !isNetConnected && canSaveChangesOffline === false
50
53
 
51
54
  const handlePressOrder = (order: any) => {
52
55
  if (order?.locked && isLogisticOrder) return
@@ -172,7 +175,7 @@ export const PreviousOrders = (props: any) => {
172
175
  }
173
176
  )
174
177
  }
175
- {_ordersGrouped[k][0]?.status === 0 && (
178
+ {_ordersGrouped[k][0]?.status === 0 && !disabledActionsByInternet && (
176
179
  <AcceptOrRejectOrderStyle>
177
180
  {!isHideRejectButtons && (
178
181
  <OButton
@@ -208,7 +211,7 @@ export const PreviousOrders = (props: any) => {
208
211
  />
209
212
  </AcceptOrRejectOrderStyle>
210
213
  )}
211
- {_ordersGrouped[k][0]?.status === 7 && (
214
+ {_ordersGrouped[k][0]?.status === 7 && !disabledActionsByInternet && (
212
215
  <View>
213
216
  <OButton
214
217
  text={t('READY_FOR_PICKUP', 'Ready for pickup')}
@@ -226,7 +229,7 @@ export const PreviousOrders = (props: any) => {
226
229
  </View>
227
230
  )}
228
231
  {(_ordersGrouped[k][0]?.status === 8 || _ordersGrouped[k][0]?.status === 18) &&
229
- _ordersGrouped[k][0]?.delivery_type === 1 &&
232
+ deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !disabledActionsByInternet &&
230
233
  (
231
234
  <AcceptOrRejectOrderStyle>
232
235
  <OButton
@@ -244,7 +247,8 @@ export const PreviousOrders = (props: any) => {
244
247
  />
245
248
  </AcceptOrRejectOrderStyle>
246
249
  )}
247
- {_ordersGrouped[k][0]?.status === 3 && _ordersGrouped[k][0]?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady &&
250
+ {_ordersGrouped[k][0]?.status === 3 && deliveryTypes?.includes(_ordersGrouped[k][0]?.delivery_type) && !isHideRejectButtons && isEnabledOrderNotReady &&
251
+ !disabledActionsByInternet &&
248
252
  (
249
253
  <AcceptOrRejectOrderStyle>
250
254
  <OButton
@@ -282,6 +286,7 @@ export const PreviousOrders = (props: any) => {
282
286
  )}
283
287
  {_ordersGrouped[k][0]?.status === 4 &&
284
288
  ![1].includes(_ordersGrouped[k][0]?.delivery_type) &&
289
+ !disabledActionsByInternet &&
285
290
  (
286
291
  <AcceptOrRejectOrderStyle>
287
292
  {!isHideRejectButtons && (
@@ -316,6 +321,7 @@ export const PreviousOrders = (props: any) => {
316
321
  )}
317
322
  {!_ordersGrouped[k][0]?.user_review &&
318
323
  pastOrderStatuses.includes(_ordersGrouped[k][0]?.status) &&
324
+ !disabledActionsByInternet &&
319
325
  (
320
326
  <OButton
321
327
  text={t('REVIEW_CUSTOMER', 'Review customer')}
@@ -332,74 +338,76 @@ export const PreviousOrders = (props: any) => {
332
338
  })}
333
339
  />
334
340
  )}
335
- {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver && (
336
- <AcceptOrRejectOrderStyle>
337
- {!isHideRejectButtons && isEnabledOrderNotReady && (
341
+ {!!deliveryPickupBtn && deliveryPickupBtn?.includes(_ordersGrouped[k][0]?.status) && isEnabledFailedPickupDriver &&
342
+ !disabledActionsByInternet && (
343
+ <AcceptOrRejectOrderStyle>
344
+ {!isHideRejectButtons && isEnabledOrderNotReady && (
345
+ <OButton
346
+ text={t('PICKUP_FAILED', 'Pickup failed')}
347
+ bgColor={theme.colors.danger100}
348
+ borderColor={theme.colors.danger100}
349
+ imgRightSrc={null}
350
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
351
+ parentStyle={{ width: '45%' }}
352
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
353
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
354
+ action: 'pickupFailed',
355
+ order: _ordersGrouped[k][0],
356
+ ids: _ordersGrouped[k].map((o: any) => o.id),
357
+ handleChangeOrderStatus
358
+ })}
359
+ />
360
+ )}
338
361
  <OButton
339
- text={t('PICKUP_FAILED', 'Pickup failed')}
340
- bgColor={theme.colors.danger100}
341
- borderColor={theme.colors.danger100}
362
+ text={t('PICKUP_COMPLETE', 'Pickup complete')}
363
+ bgColor={theme.colors.success100}
364
+ borderColor={theme.colors.success100}
342
365
  imgRightSrc={null}
343
366
  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
- })}
367
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
368
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
369
+ onClick={() => handleChangeOrderStatus(
370
+ 9,
371
+ _ordersGrouped[k].map((o: any) => o.id),
372
+ )}
352
373
  />
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),
374
+ </AcceptOrRejectOrderStyle>
375
+ )}
376
+ {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) &&
377
+ !disabledActionsByInternet && (
378
+ <AcceptOrRejectOrderStyle>
379
+ {!isHideRejectButtons && (
380
+ <OButton
381
+ text={t('DELIVERY_FAILED', 'Delivery Failed')}
382
+ bgColor={theme.colors.danger100}
383
+ borderColor={theme.colors.danger100}
384
+ imgRightSrc={null}
385
+ style={{ borderRadius: 7, height: 40, paddingLeft: 10, paddingRight: 10 }}
386
+ parentStyle={{ width: '45%' }}
387
+ textStyle={{ color: theme.colors.danger500, fontSize: 12, textAlign: 'center' }}
388
+ onClick={() => onNavigationRedirect('AcceptOrRejectOrder', {
389
+ action: 'deliveryFailed',
390
+ order: _ordersGrouped[k][0],
391
+ ids: _ordersGrouped[k].map((o: any) => o.id),
392
+ handleChangeOrderStatus
393
+ })}
394
+ />
365
395
  )}
366
- />
367
- </AcceptOrRejectOrderStyle>
368
- )}
369
- {!!deliveryStatusCompleteBtn && deliveryStatusCompleteBtn.includes(_ordersGrouped[k][0]?.status) && (
370
- <AcceptOrRejectOrderStyle>
371
- {!isHideRejectButtons && (
372
396
  <OButton
373
- text={t('DELIVERY_FAILED', 'Delivery Failed')}
374
- bgColor={theme.colors.danger100}
375
- borderColor={theme.colors.danger100}
397
+ text={t('DELIVERY_COMPLETE', 'Delivery complete')}
398
+ bgColor={theme.colors.success100}
399
+ borderColor={theme.colors.success100}
376
400
  imgRightSrc={null}
377
401
  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
- })}
402
+ parentStyle={{ width: isHideRejectButtons ? '100%' : '45%' }}
403
+ textStyle={{ color: theme.colors.success500, fontSize: 12, textAlign: 'center' }}
404
+ onClick={() => handleChangeOrderStatus(
405
+ 11,
406
+ _ordersGrouped[k].map((o: any) => o.id),
407
+ )}
386
408
  />
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
- )}
409
+ </AcceptOrRejectOrderStyle>
410
+ )}
403
411
  </OrdersGroupedItem>
404
412
  ))}
405
413
  </View>
@@ -356,6 +356,12 @@ export const getOrderStatus = (s: string, t: any) => {
356
356
  value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
357
357
  slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
358
358
  percentage: 25
359
+ },
360
+ {
361
+ key: 26,
362
+ value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
363
+ slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
364
+ percentage: 80
359
365
  }
360
366
  ];
361
367
 
@@ -1047,6 +1047,7 @@ const CheckoutUI = (props: any) => {
1047
1047
  <OModal
1048
1048
  open={isOpen}
1049
1049
  onClose={() => setIsOpen(false)}
1050
+ showToastInsideModal
1050
1051
  >
1051
1052
  <View style={styles.detailWrapper}>
1052
1053
  <UserDetails
@@ -200,7 +200,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
200
200
  const OrderListingProps = {
201
201
  ...props,
202
202
  UIComponent: OrdersOptionUI,
203
- orderStatus: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
203
+ orderStatus: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],
204
204
  useDefualtSessionManager: true,
205
205
  paginationSettings: {
206
206
  initialPage: 1,
@@ -39,7 +39,10 @@ const ORDER_STATUS: any = {
39
39
  20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
40
40
  21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
41
41
  22: 'ORDER_LOOKING_FOR_DRIVER',
42
- 23: 'ORDER_DRIVER_ON_WAY'
42
+ 23: 'ORDER_DRIVER_ON_WAY',
43
+ 24: 'ORDER_DRIVER_WAITING_FOR_ORDER',
44
+ 25: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
45
+ 26: 'ORDER_DRIVER_ARRIVED_CUSTOMER'
43
46
  }
44
47
 
45
48
  const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
@@ -73,7 +76,7 @@ const MessagesUI = (props: MessagesParams) => {
73
76
 
74
77
  const [formattedMessages, setFormattedMessages] = useState<Array<any>>([])
75
78
  const [isKeyboardShow, setIsKeyboardShow] = useState(false)
76
- const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
79
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
77
80
  const chatDisabled = previousStatus.includes(order?.status)
78
81
  const { height } = useWindowDimensions();
79
82
  const { top, bottom } = useSafeAreaInsets();
@@ -10,13 +10,14 @@ export const OrderEta = (props: any) => {
10
10
 
11
11
  const [{ parseDate }] = useUtils()
12
12
  const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
13
-
13
+ const deliveryTypes = [1, 7]
14
+
14
15
  const getEstimatedDeliveryTime = () => {
15
16
  let estimatedUtcTime = null
16
17
  let totalEta = 0
17
18
  if (order?.delivered_in) totalEta += order?.delivered_in
18
19
  if (order?.prepared_in) totalEta += order?.prepared_in
19
- if (order?.delivery_type === 1 && order?.eta_drive_time) {
20
+ if (deliveryTypes?.includes?.(order?.delivery_type) && order?.eta_drive_time) {
20
21
  totalEta += order?.eta_drive_time
21
22
  }
22
23
 
@@ -64,7 +64,10 @@ export const OrderHistory = (props: any) => {
64
64
  20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
65
65
  21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
66
66
  22: 'ORDER_LOOKING_FOR_DRIVER',
67
- 23: 'ORDER_DRIVER_ON_WAY'
67
+ 23: 'ORDER_DRIVER_ON_WAY',
68
+ 24: 'ORDER_DRIVER_WAITING_FOR_ORDER',
69
+ 25: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
70
+ 26: 'ORDER_DRIVER_ARRIVED_CUSTOMER'
68
71
  }
69
72
 
70
73
  const getLogisticTagStatus = (status: any) => {
@@ -129,11 +129,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
129
129
  const [showTitle, setShowTitle] = useState(false)
130
130
 
131
131
  const { order, businessData } = props.order;
132
- const mapValidStatuses = [9, 19, 23]
132
+ const mapValidStatuses = [9, 19, 23, 26]
133
133
  const placeSpotTypes = [3, 4, 5]
134
134
  const directionTypes = [2, 3, 4, 5]
135
- const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
135
+ const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
136
136
  const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
137
+ const cateringTypes = [7, 8]
138
+ const deliveryTypes = [1, 7]
137
139
  const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
138
140
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
139
141
  const isGiftCardOrder = !order?.business_id
@@ -363,7 +365,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
363
365
  }
364
366
  }, [props?.order?.error, props?.order?.loading])
365
367
 
366
-
367
368
  useEffect(() => {
368
369
  if (!order?.delivery_type) return
369
370
  setIsPickup(order?.delivery_type === 2)
@@ -468,10 +469,13 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
468
469
  btnStyle={{ paddingLeft: 0 }}
469
470
  style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
470
471
  titleWrapStyle={{ paddingHorizontal: 0 }}
471
- titleStyle={{ marginRight: 0, marginLeft: 0 }}
472
+ titleStyle={{ marginRight: 0, marginLeft: 0, paddingHorizontal: 0 }}
472
473
  subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
473
474
  {activeStatus.includes(order?.status) ? (
474
- <OrderEta order={order} />
475
+ <>
476
+ {cateringTypes.includes(order?.delivery_type) ? `${t('CREATED_AT', 'Created at')}: ${parseDate(order?.created_at)}\n` : ''}
477
+ {cateringTypes.includes(order?.delivery_type) ? `${t('PLACED_TO', 'Placed to')}:` : ''} <OrderEta order={order} />
478
+ </>
475
479
  ) : (
476
480
  parseDate(order?.reporting_data?.at[`status:${order.status}`])
477
481
  )}
@@ -720,7 +724,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
720
724
  )}
721
725
  </InfoBlock>
722
726
  </Customer>
723
- {!isGiftCardOrder && order?.delivery_option !== undefined && order?.delivery_type === 1 && (
727
+ {!isGiftCardOrder && order?.delivery_option !== undefined && deliveryTypes?.includes?.(order?.delivery_type) && (
724
728
  <View style={{ marginTop: 15 }}>
725
729
  <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
726
730
  {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
@@ -41,7 +41,8 @@ const OrderProgressUI = (props: any) => {
41
41
  const [lastOrder, setLastOrder] = useState<any>(null)
42
42
  const imageFails = theme.images.general.emptyActiveOrders
43
43
  const [initialLoaded, setInitialLoaded] = useState(false)
44
- const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
44
+ const statusToShow = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
45
+ const deliveryTypes = [1, 7]
45
46
 
46
47
  const styles = StyleSheet.create({
47
48
  main: {
@@ -172,7 +173,7 @@ const OrderProgressUI = (props: any) => {
172
173
  <ProgressTextWrapper>
173
174
  <OText size={12} style={{ width: '50%' }}>{progressBarObjt(lastOrder.status)?.value}</OText>
174
175
  <TimeWrapper>
175
- <OText size={11}>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
176
+ <OText size={11}>{deliveryTypes?.includes?.(lastOrder?.delivery_type) ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
176
177
  <OText size={11}>
177
178
  {lastOrder?.delivery_datetime_utc
178
179
  ? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: configs?.general_hour_format?.value || 'HH:mm' })
@@ -205,7 +206,7 @@ export const OrderProgress = (props: any) => {
205
206
  const orderProgressProps = {
206
207
  ...props,
207
208
  UIComponent: OrderProgressUI,
208
- orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
209
+ orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26],
209
210
  useDefualtSessionManager: true,
210
211
  paginationSettings: {
211
212
  initialPage: 1,
@@ -352,9 +352,9 @@ export const OrdersOption = (props: OrdersOptionParams) => {
352
352
  UIComponent: OrdersOptionUI,
353
353
  noGiftCardOrders: true,
354
354
  orderStatus: getAllOrders
355
- ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
355
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
356
356
  : props.preOrders ? [13] : props.activeOrders
357
- ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
357
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23, 24, 25, 26]
358
358
  : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
359
359
  useDefualtSessionManager: true,
360
360
  paginationSettings: {
@@ -123,7 +123,7 @@ export const UserFormDetailsUI = (props: any) => {
123
123
  };
124
124
  if (field.code && field.code === 'email') {
125
125
  rules.pattern = {
126
- value: /[&,()%";:ç?<>{}\\[\]\s]/g,
126
+ value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
127
127
  message: t('INVALID_ERROR_EMAIL', 'Invalid email address').replace(
128
128
  '_attribute_',
129
129
  t('EMAIL', 'Email'),
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { Modal, StyleSheet, Text, SafeAreaView, View, TouchableOpacity, Platform } from "react-native";
3
3
  import styled from 'styled-components/native';
4
4
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
-
5
+ import { Toast } from '../../../../../src/components/shared/OToast'
6
6
  interface Props {
7
7
  open?: boolean;
8
8
  title?: string;
@@ -22,6 +22,7 @@ interface Props {
22
22
  styleCloseButton?: any,
23
23
  isAvoidKeyBoardView?: boolean;
24
24
  styleContainerCloseButton?: any;
25
+ showToastInsideModal?: boolean;
25
26
  }
26
27
  const KeyboardView = styled.KeyboardAvoidingView`
27
28
  flex-grow: 1;
@@ -47,7 +48,8 @@ const OModal = (props: Props): React.ReactElement => {
47
48
  style,
48
49
  styleCloseButton,
49
50
  styleContainerCloseButton,
50
- isAvoidKeyBoardView
51
+ isAvoidKeyBoardView,
52
+ showToastInsideModal
51
53
  } = props
52
54
 
53
55
  const renderSafeAreaView = () => (
@@ -94,6 +96,9 @@ const OModal = (props: Props): React.ReactElement => {
94
96
  onRequestClose={() => onClose && onClose()}
95
97
  style={{ height: '100%', flex: 1, position: 'absolute', ...style, zIndex: 9999 }}
96
98
  >
99
+ {showToastInsideModal && (
100
+ <Toast />
101
+ )}
97
102
  {isAvoidKeyBoardView ? (
98
103
  <KeyboardView
99
104
  enabled
@@ -568,6 +568,24 @@ export const getOrderStatus = (s: string) => {
568
568
  slug: 'ORDER_DRIVER_ON_WAY',
569
569
  percentage: 0.8,
570
570
  image: theme.images.order.status8
571
+ },
572
+ {
573
+ key: 24,
574
+ value: t('ORDER_DRIVER_WAITING_FOR_ORDER', 'Driver waiting for order'),
575
+ slug: 'ORDER_DRIVER_WAITING_FOR_ORDER',
576
+ percentage: 0.25
577
+ },
578
+ {
579
+ key: 25,
580
+ value: t('ORDER_ACCEPTED_BY_DRIVER_COMPANY', 'Accepted by driver company'),
581
+ slug: 'ORDER_ACCEPTED_BY_DRIVER_COMPANY',
582
+ percentage: 0.25
583
+ },
584
+ {
585
+ key: 26,
586
+ value: t('ORDER_DRIVER_ARRIVED_CUSTOMER', 'Driver arrived to customer'),
587
+ slug: 'ORDER_DRIVER_ARRIVED_CUSTOMER',
588
+ percentage: 0.8
571
589
  }
572
590
  ];
573
591