ordering-ui-react-native 0.12.76 → 0.12.80

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 (31) hide show
  1. package/package.json +1 -1
  2. package/src/components/BusinessesListing/index.tsx +35 -3
  3. package/src/components/BusinessesListing/styles.tsx +10 -0
  4. package/src/components/Checkout/index.tsx +77 -8
  5. package/src/components/Messages/index.tsx +3 -3
  6. package/src/components/PaymentOptions/index.tsx +2 -2
  7. package/src/theme.json +3 -1
  8. package/src/utils/index.tsx +27 -0
  9. package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -131
  10. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +1 -1
  11. package/themes/doordash/src/components/BusinessesListing/index.tsx +33 -1
  12. package/themes/doordash/src/components/BusinessesListing/styles.tsx +11 -1
  13. package/themes/doordash/src/utils/index.tsx +27 -0
  14. package/themes/instacart/src/components/BusinessesListing/index.tsx +35 -3
  15. package/themes/instacart/src/components/BusinessesListing/styles.tsx +11 -1
  16. package/themes/instacart/src/utils/index.tsx +27 -0
  17. package/themes/original/index.tsx +2 -0
  18. package/themes/original/src/components/ActiveOrders/index.tsx +36 -16
  19. package/themes/original/src/components/ActiveOrders/styles.tsx +10 -0
  20. package/themes/original/src/components/MessageListing/index.tsx +298 -0
  21. package/themes/original/src/components/MessageListing/styles.tsx +16 -0
  22. package/themes/original/src/components/Messages/index.tsx +123 -81
  23. package/themes/original/src/components/Messages/styles.tsx +8 -0
  24. package/themes/original/src/components/UserProfile/index.tsx +10 -0
  25. package/themes/original/src/utils/index.tsx +18 -0
  26. package/themes/single-business/src/components/BusinessesListing/index.tsx +33 -0
  27. package/themes/single-business/src/components/BusinessesListing/styles.tsx +9 -0
  28. package/themes/single-business/src/utils/index.tsx +27 -0
  29. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +36 -3
  30. package/themes/uber-eats/src/components/BusinessesListing/styles.tsx +8 -0
  31. package/themes/uber-eats/src/utils/index.tsx +27 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.76",
3
+ "version": "0.12.80",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,6 +1,7 @@
1
- import React, {useEffect} from 'react'
1
+ import React, { useEffect, useState} from 'react'
2
2
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
3
3
  import { View, StyleSheet, ScrollView, Platform, PanResponder, I18nManager } from 'react-native'
4
+ import Geolocation from '@react-native-community/geolocation'
4
5
  import MaterialComIcon from 'react-native-vector-icons/MaterialCommunityIcons'
5
6
  import {
6
7
  BusinessList as BusinessesListingController,
@@ -13,7 +14,7 @@ import {
13
14
  useToast
14
15
  } from 'ordering-components/native'
15
16
 
16
- import { WelcomeTitle, Search, OrderControlContainer, AddressInput, WrapMomentOption } from './styles'
17
+ import { WelcomeTitle, Search, OrderControlContainer, AddressInput, WrapMomentOption, FarAwayMessage } from './styles'
17
18
 
18
19
  import NavBar from '../NavBar'
19
20
  import { SearchBar } from '../SearchBar'
@@ -24,6 +25,8 @@ import { BusinessTypeFilter } from '../BusinessTypeFilter'
24
25
  import { BusinessController } from '../BusinessController'
25
26
  import { OrderTypeSelector } from '../OrderTypeSelector'
26
27
  import { useTheme } from 'styled-components/native'
28
+ import { getDistance } from '../../utils'
29
+ import Ionicons from 'react-native-vector-icons/Ionicons'
27
30
 
28
31
  const PIXELS_TO_SCROLL = 1200
29
32
 
@@ -68,7 +71,16 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
68
71
  borderColor: theme.colors.backgroundGray,
69
72
  borderWidth: 1,
70
73
  borderRadius: 10,
71
- }
74
+ },
75
+ iconStyle: {
76
+ fontSize: 18,
77
+ color: theme.colors.warning5,
78
+ marginRight: 8
79
+ },
80
+ farAwayMsg: {
81
+ paddingVertical: 6,
82
+ paddingHorizontal: 20
83
+ }
72
84
  })
73
85
 
74
86
  const [, t] = useLanguage()
@@ -79,6 +91,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
79
91
  const [, {showToast}] = useToast()
80
92
  const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
81
93
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
94
+ const [isFarAway, setIsFarAway] = useState(false)
82
95
 
83
96
  const handleScroll = ({ nativeEvent }: any) => {
84
97
  const y = nativeEvent.contentOffset.y
@@ -91,6 +104,19 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
91
104
  }
92
105
  }
93
106
 
107
+ useEffect(() => {
108
+ Geolocation.getCurrentPosition((pos) => {
109
+ const crd = pos.coords
110
+ const distance = getDistance(crd.latitude, crd.longitude, orderState?.options?.address?.location?.lat, orderState?.options?.address?.location?.lng)
111
+ if (distance > 20) setIsFarAway(true)
112
+ else setIsFarAway(false)
113
+ }, (err) => {
114
+ console.log(`ERROR(${err.code}): ${err.message}`)
115
+ }, {
116
+ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
117
+ })
118
+ }, [orderState?.options?.address?.location])
119
+
94
120
  return (
95
121
  <ScrollView style={styles.container} onScroll={(e: any) => handleScroll(e)}>
96
122
  {!auth && (
@@ -162,6 +188,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
162
188
  {orderState?.options?.address?.address}
163
189
  </OText>
164
190
  </AddressInput>
191
+ {isFarAway && (
192
+ <FarAwayMessage style={styles.farAwayMsg}>
193
+ <Ionicons name='md-warning-outline' style={styles.iconStyle} />
194
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
195
+ </FarAwayMessage>
196
+ )}
165
197
  </OrderControlContainer>
166
198
  <BusinessTypeFilter
167
199
  images={props.images}
@@ -48,3 +48,13 @@ export const WrapMomentOption = styled.TouchableOpacity`
48
48
  padding: 15px 20px;
49
49
  max-width: 240px;
50
50
  `
51
+
52
+ export const FarAwayMessage = styled.View`
53
+ flex-direction: row;
54
+ align-items: center;
55
+ background-color: ${(props: any) => props.theme.colors.warning1};
56
+ margin-top: 15px;
57
+ border-radius: 7.6px;
58
+ border: 1px solid ${(props: any) => props.theme.colors.warning5};
59
+ width: 100%;
60
+ `
@@ -116,13 +116,13 @@ const CheckoutUI = (props: any) => {
116
116
  const [validationFields] = useValidationFields();
117
117
  const [ordering] = useApi()
118
118
  const webviewRef = useRef<any>(null)
119
-
119
+ const webviewRefSquare = useRef<any>(null)
120
120
  const [errorCash, setErrorCash] = useState(false);
121
121
  const [userErrors, setUserErrors] = useState<any>([]);
122
122
  const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
123
123
  const [phoneUpdate, setPhoneUpdate] = useState(false);
124
124
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
125
- const [paypalMethod, setPaypalMethod] = useState<any>(null)
125
+ const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
126
126
  const [progClr, setProgClr] = useState('#424242');
127
127
  const [prog, setProg] = useState(true);
128
128
  const [openOrderCreating, setOpenOrderCreating] = useState(false)
@@ -183,7 +183,7 @@ const CheckoutUI = (props: any) => {
183
183
  }
184
184
 
185
185
  const onMessage = (e: any) => {
186
- if (e?.nativeEvent?.data) {
186
+ if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
187
187
  let payment = JSON.parse(e.nativeEvent.data);
188
188
 
189
189
  if (payment === 'api error') {
@@ -213,7 +213,7 @@ const CheckoutUI = (props: any) => {
213
213
 
214
214
  const handlePaymentMethodClick = (paymethod: any) => {
215
215
  setShowGateway({ closedByUser: false, open: true })
216
- setPaypalMethod(paymethod)
216
+ setWebviewPaymethod(paymethod)
217
217
  }
218
218
 
219
219
  const handleCloseWebview = () => {
@@ -570,7 +570,7 @@ const CheckoutUI = (props: any) => {
570
570
  </>
571
571
  </>
572
572
  )}
573
- {paypalMethod && showGateway.open && (
573
+ {webviewPaymethod?.gateway === 'paypal' && showGateway.open && (
574
574
  <View style={{ zIndex: 9999, height: '100%', width: '100%', position: 'absolute', backgroundColor: 'white' }}>
575
575
  <Icon
576
576
  name="x"
@@ -620,22 +620,91 @@ const CheckoutUI = (props: any) => {
620
620
  urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
621
621
  urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
622
622
  payData: {
623
- paymethod_id: paypalMethod?.id,
623
+ paymethod_id: webviewPaymethod?.id,
624
624
  amount: cart?.total,
625
625
  delivery_zone_id: cart?.delivery_zone_id,
626
626
  user_id: user?.id
627
627
  },
628
628
  currency: configs?.stripe_currency?.value || currency,
629
629
  userToken: token,
630
- clientId: paypalMethod?.credentials?.client_id
630
+ clientId: webviewPaymethod?.credentials?.client_id
631
631
  }
632
632
  }
633
633
  setProg(false);
634
- webviewRef.current.postMessage(JSON.stringify(message))
634
+ webviewRef?.current?.postMessage?.(JSON.stringify(message))
635
635
  }}
636
636
  />
637
637
  </View>
638
638
  )}
639
+ {webviewPaymethod?.gateway === 'square' && showGateway.open && (
640
+ <View style={{ zIndex: 9999, height: '100%', width: '100%', position: 'absolute', backgroundColor: 'white' }}>
641
+ <Icon
642
+ name="x"
643
+ size={35}
644
+ style={{ backgroundColor: 'white', paddingTop: 30, paddingLeft: 10 }}
645
+ onPress={handleCloseWebview}
646
+ />
647
+ <OText
648
+ style={{
649
+ textAlign: 'center',
650
+ fontSize: 16,
651
+ fontWeight: 'bold',
652
+ color: '#00457C',
653
+ marginBottom: 5,
654
+ marginTop: 10
655
+ }}>
656
+ {t('SQUARE_PAYMENT', 'Square payment')}
657
+ </OText>
658
+ <View style={{ padding: 20, opacity: prog ? 1 : 0, backgroundColor: 'white' }}>
659
+ <ActivityIndicator size={24} color={progClr} />
660
+ </View>
661
+ <WebView
662
+ source={{ uri: `https://test-square-f50f7.web.app` }}
663
+ onMessage={onMessage}
664
+ ref={webviewRefSquare}
665
+ javaScriptEnabled={true}
666
+ javaScriptEnabledAndroid={true}
667
+ cacheEnabled={false}
668
+ cacheMode='LOAD_NO_CACHE'
669
+ style={{ flex: 1 }}
670
+ onShouldStartLoadWithRequest={() => true}
671
+ onLoadStart={() => {
672
+ setProg(true);
673
+ setProgClr('#424242');
674
+ }}
675
+ onLoadProgress={() => {
676
+ setProg(true);
677
+ setProgClr('#00457C');
678
+ }}
679
+ onLoad={() => {
680
+ setProg(true);
681
+ setProgClr('#00457C');
682
+ }}
683
+ onLoadEnd={(e) => {
684
+ const message = {
685
+ action: 'init',
686
+ data: {
687
+ urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
688
+ urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
689
+ payData: {
690
+ paymethod_id: webviewPaymethod?.id,
691
+ amount: cart?.total,
692
+ delivery_zone_id: cart?.delivery_zone_id,
693
+ user_id: user?.id,
694
+ },
695
+ currency: configs?.stripe_currency?.value || currency,
696
+ userToken: token,
697
+ clientId: 'sandbox-sq0idb-rMLAce87hOfpGvokZCygEw',
698
+ locationId: 'L1NGAY5M6KJRX'
699
+ }
700
+ }
701
+ setProg(false);
702
+ webviewRefSquare?.current?.postMessage?.(JSON.stringify(message))
703
+ }}
704
+ />
705
+ </View>
706
+ )
707
+ }
639
708
  {openOrderCreating && (
640
709
  <View style={{ zIndex: 9999, height: '100%', width: '100%', position: 'absolute', backgroundColor: 'white' }}>
641
710
  <OrderCreating
@@ -209,11 +209,11 @@ const MessagesUI = (props: MessagesParams) => {
209
209
  <InputToolbar
210
210
  {...props}
211
211
  containerStyle={{
212
- padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
213
- flexDirection: 'column-reverse'
212
+ marginBottom: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
213
+ flexDirection: Platform.OS === 'ios' && isKeyboardShow ? 'column' : 'column-reverse'
214
214
  }}
215
215
  primaryStyle={{ alignItems: 'center', justifyContent: 'flex-start' }}
216
- renderAccessory={() => renderAccessory()}
216
+ renderAccessory={() => !isKeyboardShow && renderAccessory()}
217
217
  />
218
218
  )
219
219
 
@@ -90,9 +90,9 @@ const PaymentOptionsUI = (props: any) => {
90
90
  }
91
91
 
92
92
  const handlePaymentMethodClick = (paymethod: any) => {
93
- const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
93
+ const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square'].includes(paymethod?.gateway)
94
94
  handlePaymethodClick(paymethod, isPopupMethod)
95
- if(paymethod?.gateway === 'paypal') {
95
+ if(paymethod?.gateway === 'paypal' || paymethod?.gateway === 'square') {
96
96
  handlePaymentMethodClickCustom(paymethod)
97
97
  }
98
98
  setCardData(paymethodData)
package/src/theme.json CHANGED
@@ -42,7 +42,9 @@
42
42
  "colorTextTutorial": "#000000",
43
43
  "toastSuccess":"#90C68E",
44
44
  "toastError":"#D83520",
45
- "toastInfo":"#6BA4FF"
45
+ "toastInfo":"#6BA4FF",
46
+ "warning5": "#FFC700",
47
+ "warning1": "#FFF4CC"
46
48
  },
47
49
  "images": {
48
50
  "logos": {
@@ -164,3 +164,30 @@ export const transformCountryCode = (countryCode : number) => {
164
164
  return parser(value)
165
165
  }
166
166
  }
167
+
168
+ /**
169
+ * Function to transform degree to radian
170
+ * @param {number} value for transform
171
+ *
172
+ */
173
+ export const convertToRadian = (value: number) => {
174
+ return value * Math.PI / 180
175
+ }
176
+
177
+ /**
178
+ * Function to distance between two locations
179
+ * @param lat1 Lat for first location
180
+ * @param lon1 Lon for first location
181
+ * @param lat2 Lat for second location
182
+ * @param lon2 Lon for second location
183
+ */
184
+ export const getDistance = (lat1: any, lon1: any, lat2: any, lon2: any) => {
185
+ const R = 6371 // km
186
+ const dLat = convertToRadian(lat2 - lat1)
187
+ const dLon = convertToRadian(lon2 - lon1)
188
+ const curLat1 = convertToRadian(lat1)
189
+ const curLat2 = convertToRadian(lat2)
190
+ const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(curLat1) * Math.cos(curLat2)
191
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
192
+ return R * c
193
+ }
@@ -333,144 +333,147 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
333
333
  onClickButton={() => navigation.navigate('Orders')}
334
334
  />
335
335
  )}
336
- <View style={{ flex: 1 }}>
337
- <OrderHeaderComponent
338
- order={order}
339
- handleOpenMapView={handleOpenMapView}
340
- handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
341
- getOrderStatus={getOrderStatus}
342
- handleArrowBack={handleArrowBack}
343
- logisticOrderStatus={logisticOrderStatus}
344
- />
345
- {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
346
- <>
347
- <OrderDetailsContainer
348
- keyboardShouldPersistTaps="handled"
349
- showsVerticalScrollIndicator={false}
350
- >
351
- {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
352
- <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
353
- )) : (
354
- <OrderDetailsInformation order={order} />
355
- )}
356
- </OrderDetailsContainer>
357
- {showFloatButtonsPickUp[order?.status] && (
358
- <FloatingButton
359
- disabled={props.order?.loading}
360
- btnText={t('PICKUP_FAILED', 'Pickup failed')}
361
- isSecondaryBtn={false}
362
- secondButtonClick={() =>
363
- handleChangeOrderStatus && handleChangeOrderStatus(9)
364
- }
365
- firstButtonClick={() =>
366
- handleViewActionOrder && handleViewActionOrder('pickupFailed')
367
- }
368
- secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
369
- secondButton={true}
370
- firstColorCustom={theme.colors.red}
371
- secondColorCustom={theme.colors.green}
372
- widthButton={'45%'}
373
- />
374
- )}
375
- {(order?.status === 9 || order?.status === 19) && (
336
+ {!((!order || Object.keys(order).length === 0) &&
337
+ (props.order?.error?.length < 1 || !props.order?.error)) && (
338
+ <View style={{ flex: 1 }}>
339
+ <OrderHeaderComponent
340
+ order={order}
341
+ handleOpenMapView={handleOpenMapView}
342
+ handleOpenMessagesForBusiness={handleOpenMessagesForBusiness}
343
+ getOrderStatus={getOrderStatus}
344
+ handleArrowBack={handleArrowBack}
345
+ logisticOrderStatus={logisticOrderStatus}
346
+ />
347
+ {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
376
348
  <>
377
- <FloatingButton
378
- disabled={props.order?.loading}
379
- btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
380
- isSecondaryBtn={false}
381
- secondButtonClick={() =>
382
- handleChangeOrderStatus && handleChangeOrderStatus(11)
349
+ <OrderDetailsContainer
350
+ keyboardShouldPersistTaps="handled"
351
+ showsVerticalScrollIndicator={false}
352
+ >
353
+ {order?.order_group && order?.order_group_id && order?.isLogistic ? order?.order_group?.orders.map((order: any, i: number, hash: any) => (
354
+ <OrderDetailsInformation key={order?.id} order={order} isOrderGroup lastOrder={hash?.length === i + 1} />
355
+ )) : (
356
+ <OrderDetailsInformation order={order} />
357
+ )}
358
+ </OrderDetailsContainer>
359
+ {showFloatButtonsPickUp[order?.status] && (
360
+ <FloatingButton
361
+ disabled={props.order?.loading}
362
+ btnText={t('PICKUP_FAILED', 'Pickup failed')}
363
+ isSecondaryBtn={false}
364
+ secondButtonClick={() =>
365
+ handleChangeOrderStatus && handleChangeOrderStatus(9)
366
+ }
367
+ firstButtonClick={() =>
368
+ handleViewActionOrder && handleViewActionOrder('pickupFailed')
369
+ }
370
+ secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
371
+ secondButton={true}
372
+ firstColorCustom={theme.colors.red}
373
+ secondColorCustom={theme.colors.green}
374
+ widthButton={'45%'}
375
+ />
376
+ )}
377
+ {(order?.status === 9 || order?.status === 19) && (
378
+ <>
379
+ <FloatingButton
380
+ disabled={props.order?.loading}
381
+ btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
382
+ isSecondaryBtn={false}
383
+ secondButtonClick={() =>
384
+ handleChangeOrderStatus && handleChangeOrderStatus(11)
385
+ }
386
+ firstButtonClick={() =>
387
+ handleViewActionOrder && handleViewActionOrder('deliveryFailed')
388
+ }
389
+ secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
390
+ secondButton={true}
391
+ firstColorCustom={theme.colors.red}
392
+ secondColorCustom={theme.colors.green}
393
+ widthButton={'45%'}
394
+ />
395
+ </>
396
+ )}
397
+ {showFloatButtonsAcceptOrReject[order?.status] && (
398
+ <FloatingButton
399
+ btnText={t('REJECT', 'Reject')}
400
+ isSecondaryBtn={false}
401
+ secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
402
+ firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
403
+ secondBtnText={t('ACCEPT', 'Accept')}
404
+ secondButton={true}
405
+ firstColorCustom={theme.colors.red}
406
+ secondColorCustom={theme.colors.green}
407
+ widthButton={'45%'}
408
+ />
409
+ )}
410
+ </>
411
+ )}
412
+ {openModalForMapView && (
413
+ <OModal
414
+ open={openModalForMapView}
415
+ onClose={() => handleOpenMapView()}
416
+ entireModal
417
+ customClose>
418
+ <DriverMap
419
+ navigation={navigation}
420
+ order={order}
421
+ orderStatus={getOrderStatus(order?.status, t)?.value || ''}
422
+ location={locationMarker}
423
+ readOnly
424
+ updateDriverPosition={updateDriverPosition}
425
+ driverUpdateLocation={driverUpdateLocation}
426
+ setDriverUpdateLocation={setDriverUpdateLocation}
427
+ handleViewActionOrder={handleViewActionOrder}
428
+ isBusinessMarker={isBusinessMarker}
429
+ isToFollow={isToFollow}
430
+ showAcceptOrReject={
431
+ showFloatButtonsAcceptOrReject[order?.status]
383
432
  }
384
- firstButtonClick={() =>
385
- handleViewActionOrder && handleViewActionOrder('deliveryFailed')
433
+ handleOpenMapView={handleOpenMapView}
434
+ />
435
+ </OModal>
436
+ )}
437
+ {openModalForBusiness && (
438
+ <OModal
439
+ open={openModalForBusiness}
440
+ order={order}
441
+ title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
442
+ entireModal
443
+ onClose={() => handleCloseModal()}>
444
+ <Chat
445
+ type={
446
+ openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
386
447
  }
387
- secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
388
- secondButton={true}
389
- firstColorCustom={theme.colors.red}
390
- secondColorCustom={theme.colors.green}
391
- widthButton={'45%'}
448
+ orderId={order?.id}
449
+ messages={messages}
450
+ order={order}
451
+ setMessages={setMessages}
392
452
  />
393
- </>
453
+ </OModal>
394
454
  )}
395
- {showFloatButtonsAcceptOrReject[order?.status] && (
396
- <FloatingButton
397
- btnText={t('REJECT', 'Reject')}
398
- isSecondaryBtn={false}
399
- secondButtonClick={() => (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
400
- firstButtonClick={() => order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status)) ? handleRejectLogisticOrder() : handleViewActionOrder('reject')}
401
- secondBtnText={t('ACCEPT', 'Accept')}
402
- secondButton={true}
403
- firstColorCustom={theme.colors.red}
404
- secondColorCustom={theme.colors.green}
405
- widthButton={'45%'}
406
- />
455
+ {openModalForAccept && (
456
+ <OModal
457
+ open={openModalForAccept}
458
+ onClose={() => setOpenModalForAccept(false)}
459
+ entireModal
460
+ customClose>
461
+ <AcceptOrRejectOrder
462
+ handleUpdateOrder={handleChangeOrderStatus}
463
+ closeModal={setOpenModalForAccept}
464
+ customerCellphone={order?.customer?.cellphone}
465
+ loading={props.order?.loading}
466
+ action={actionOrder}
467
+ orderId={order?.id}
468
+ notShowCustomerPhone
469
+ actions={actions}
470
+ orderTitle={orderTitle}
471
+ appTitle={appTitle}
472
+ />
473
+ </OModal>
407
474
  )}
408
- </>
409
- )}
410
- {openModalForMapView && (
411
- <OModal
412
- open={openModalForMapView}
413
- onClose={() => handleOpenMapView()}
414
- entireModal
415
- customClose>
416
- <DriverMap
417
- navigation={navigation}
418
- order={order}
419
- orderStatus={getOrderStatus(order?.status, t)?.value || ''}
420
- location={locationMarker}
421
- readOnly
422
- updateDriverPosition={updateDriverPosition}
423
- driverUpdateLocation={driverUpdateLocation}
424
- setDriverUpdateLocation={setDriverUpdateLocation}
425
- handleViewActionOrder={handleViewActionOrder}
426
- isBusinessMarker={isBusinessMarker}
427
- isToFollow={isToFollow}
428
- showAcceptOrReject={
429
- showFloatButtonsAcceptOrReject[order?.status]
430
- }
431
- handleOpenMapView={handleOpenMapView}
432
- />
433
- </OModal>
434
- )}
435
- {openModalForBusiness && (
436
- <OModal
437
- open={openModalForBusiness}
438
- order={order}
439
- title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
440
- entireModal
441
- onClose={() => handleCloseModal()}>
442
- <Chat
443
- type={
444
- openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
445
- }
446
- orderId={order?.id}
447
- messages={messages}
448
- order={order}
449
- setMessages={setMessages}
450
- />
451
- </OModal>
452
- )}
453
- {openModalForAccept && (
454
- <OModal
455
- open={openModalForAccept}
456
- onClose={() => setOpenModalForAccept(false)}
457
- entireModal
458
- customClose>
459
- <AcceptOrRejectOrder
460
- handleUpdateOrder={handleChangeOrderStatus}
461
- closeModal={setOpenModalForAccept}
462
- customerCellphone={order?.customer?.cellphone}
463
- loading={props.order?.loading}
464
- action={actionOrder}
465
- orderId={order?.id}
466
- notShowCustomerPhone
467
- actions={actions}
468
- orderTitle={orderTitle}
469
- appTitle={appTitle}
470
- />
471
- </OModal>
475
+ </View>
472
476
  )}
473
- </View>
474
477
  {alertState?.open && (
475
478
  <Alert
476
479
  open={alertState.open}
@@ -175,7 +175,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
175
175
  )}
176
176
  </>
177
177
  </OText>
178
- {!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
178
+ {!order?.isLogistic && order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
179
179
  <OText size={13}>
180
180
  {`${order?.paymethod?.name} - ${order.delivery_type === 1
181
181
  ? t('DELIVERY', 'Delivery')