ordering-ui-react-native 0.17.99-release → 0.18.0-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 (75) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +7 -6
  3. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  4. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  5. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  6. package/themes/original/src/components/BusinessBasicInformation/index.tsx +2 -2
  7. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  8. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  9. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -3
  10. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -5
  11. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  12. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  13. package/themes/original/src/components/BusinessProductsListing/index.tsx +31 -12
  14. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  15. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  16. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  17. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  18. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
  19. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
  20. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  21. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  22. package/themes/original/src/components/Checkout/index.tsx +1 -1
  23. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  24. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  25. package/themes/original/src/components/Favorite/index.tsx +3 -4
  26. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  27. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  28. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  29. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  30. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  31. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  32. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  33. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  34. package/themes/original/src/components/Home/index.tsx +1 -1
  35. package/themes/original/src/components/Messages/styles.tsx +1 -1
  36. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  37. package/themes/original/src/components/MultiCheckout/index.tsx +4 -4
  38. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  39. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  40. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  41. package/themes/original/src/components/Notifications/index.tsx +2 -4
  42. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  43. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  44. package/themes/original/src/components/OrderDetails/index.tsx +702 -663
  45. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  46. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  47. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  48. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  49. package/themes/original/src/components/OrdersOption/index.tsx +1 -1
  50. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  51. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  52. package/themes/original/src/components/ProductForm/index.tsx +51 -146
  53. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  54. package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
  55. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  56. package/themes/original/src/components/Promotions/index.tsx +4 -4
  57. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  58. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  59. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  60. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  61. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  62. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  63. package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
  64. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  65. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  66. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  67. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  68. package/themes/original/src/components/UserFormDetails/index.tsx +16 -3
  69. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  70. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  71. package/themes/original/src/components/Wallets/index.tsx +1 -3
  72. package/themes/original/src/components/Wallets/styles.tsx +1 -0
  73. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  74. package/themes/original/src/components/shared/OModal.tsx +12 -14
  75. package/themes/original/src/layouts/Container.tsx +1 -1
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect, useMemo } from 'react';
2
- import { View, StyleSheet, BackHandler, Platform, Linking, RefreshControl } from 'react-native';
2
+ import { View, StyleSheet, BackHandler, Platform, Linking, RefreshControl, SafeAreaView } from 'react-native';
3
3
  import LinearGradient from 'react-native-linear-gradient';
4
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
4
5
  import { _setStoreData } from '../../providers/StoreUtil';
5
6
  import {
6
7
  useLanguage,
@@ -35,7 +36,9 @@ import {
35
36
  Divider,
36
37
  OrderAction,
37
38
  PlaceSpotWrapper,
38
- ProfessionalPhoto
39
+ ProfessionalPhoto,
40
+ TopHeader,
41
+ TopActions
39
42
  } from './styles';
40
43
  import { OButton, OIcon, OModal, OText } from '../shared';
41
44
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -106,6 +109,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
106
109
  borderBottomWidth: 1,
107
110
  marginVertical: 10,
108
111
  paddingVertical: 5
112
+ },
113
+ wrapperNavbar: {
114
+ paddingHorizontal: 20,
115
+ paddingTop: 0,
109
116
  }
110
117
  });
111
118
 
@@ -119,6 +126,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
119
126
  const [isOrderHistory, setIsOrderHistory] = useState(false)
120
127
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
121
128
  const [refreshing] = useState(false);
129
+ const [showTitle, setShowTitle] = useState(false)
130
+
122
131
  const { order, businessData } = props.order;
123
132
  const mapValidStatuses = [9, 19, 23]
124
133
  const placeSpotTypes = [3, 4, 5]
@@ -222,6 +231,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
222
231
  getOrder()
223
232
  }
224
233
 
234
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
235
+ setShowTitle(contentOffset.y > 30)
236
+ }
237
+
225
238
  useEffect(() => {
226
239
  const _businessId = 'businessId:' + businessData?.id
227
240
  if (reorderState?.error) {
@@ -355,157 +368,52 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
355
368
  }, [order?.delivery_type])
356
369
 
357
370
  return (
358
- <OrderDetailsContainer
359
- keyboardShouldPersistTaps="handled"
360
- refreshControl={
361
- <RefreshControl
362
- refreshing={refreshing}
363
- onRefresh={() => resfreshOrder()}
364
- />
365
- }
366
- >
367
- {(!order || Object.keys(order).length === 0) && (
368
- <Placeholder style={{ marginTop: 30 }}>
369
- <Header>
370
- <OrderInfo>
371
- <OrderData>
372
- <PlaceholderLine width={60} height={15} />
373
- <PlaceholderLine width={60} height={10} />
374
- <StaturBar>
375
- <PlaceholderLine height={15} />
376
- <PlaceholderLine width={40} height={20} />
377
- </StaturBar>
378
- </OrderData>
379
- <View
380
- style={{
381
- height: 8,
382
- backgroundColor: theme.colors.backgroundGray100,
383
- marginTop: 18,
384
- marginHorizontal: -40,
385
- }}
371
+ <SafeAreaView>
372
+ <View style={styles.wrapperNavbar}>
373
+ <TopHeader>
374
+ <>
375
+ <TopActions onPress={() => handleArrowBack()}>
376
+ <IconAntDesign
377
+ name='arrowleft'
378
+ size={26}
386
379
  />
387
- </OrderInfo>
388
- </Header>
389
- <OrderContent>
390
- <OrderBusiness>
391
- <PlaceholderLine width={30} height={20} />
392
- <PlaceholderLine width={60} height={15} />
393
- <PlaceholderLine width={75} height={10} />
394
- <PlaceholderLine width={40} height={10} />
395
- <PlaceholderLine width={95} height={10} />
396
- </OrderBusiness>
397
- </OrderContent>
398
- <View
399
- style={{
400
- height: 8,
401
- backgroundColor: theme.colors.backgroundGray100,
402
- marginTop: 18,
403
- marginHorizontal: -40,
404
- }}
405
- />
406
- <OrderCustomer>
407
- <PlaceholderLine width={20} height={20} />
408
- <PlaceholderLine width={70} height={15} />
409
- <PlaceholderLine width={65} height={10} />
410
- <PlaceholderLine width={80} height={10} />
411
- <PlaceholderLine width={70} height={10} />
412
- <View style={{ marginTop: 10 }}>
413
- <PlaceholderLine width={60} height={20} />
414
- <PlaceholderLine width={40} height={10} />
415
- </View>
416
- </OrderCustomer>
417
- </Placeholder>
418
- )}
419
- {order && Object.keys(order).length > 0 && (
420
- <>
421
- <Header>
422
- <NavBar
423
- title={`${t('ORDER', 'Order')} #${order?.id}`}
424
- titleAlign={'center'}
425
- onActionLeft={handleArrowBack}
426
- showCall={false}
427
- btnStyle={{ paddingLeft: 0 }}
428
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
429
- titleWrapStyle={{ paddingHorizontal: 0 }}
430
- titleStyle={{ marginRight: 0, marginLeft: 0 }}
431
- subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
432
- {activeStatus.includes(order?.status) ? (
433
- <OrderEta order={order} />
434
- ) : (
435
- parseDate(order?.reporting_data?.at[`status:${order.status}`])
436
- )}
437
- </OText>}
438
- />
439
- {enabledPoweredByOrdering && (
440
- <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
441
- <OText>
442
- Powered By Ordering.co
443
- </OText>
444
- </View>
380
+ </TopActions>
381
+ {showTitle && (
382
+ <OText
383
+ size={16}
384
+ style={{ flex: 1, textAlign: 'center', right: 15 }}
385
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
386
+ numberOfLines={2}
387
+ ellipsizeMode='tail'
388
+ >
389
+ {`${t('ORDER', 'Order')} #${order?.id}`}
390
+ </OText>
445
391
  )}
446
- {!isGiftCardOrder && (
392
+ </>
393
+ </TopHeader>
394
+ </View>
395
+ <OrderDetailsContainer
396
+ keyboardShouldPersistTaps="handled"
397
+ refreshControl={
398
+ <RefreshControl
399
+ refreshing={refreshing}
400
+ onRefresh={() => resfreshOrder()}
401
+ />
402
+ }
403
+ onScroll={handleScroll}
404
+ >
405
+
406
+ {(!order || Object.keys(order).length === 0) && (
407
+ <Placeholder style={{ marginTop: 30 }}>
408
+ <Header>
447
409
  <OrderInfo>
448
410
  <OrderData>
449
- <View style={styles.linkWrapper}>
450
- {
451
- (
452
- parseInt(order?.status) === 1 ||
453
- parseInt(order?.status) === 11 ||
454
- parseInt(order?.status) === 15
455
- ) && !order.review && !isReviewed && (
456
- <TouchableOpacity
457
- activeOpacity={0.7}
458
- style={{ marginTop: 6, marginRight: 10 }}
459
- onPress={() => handleClickOrderReview(order)}
460
- >
461
- <OText
462
- size={12}
463
- lineHeight={15}
464
- color={theme.colors.primary}
465
- style={{ textDecorationLine: 'underline' }}
466
- >
467
- {t('REVIEW_YOUR_ORDER', 'Review your order')}
468
- </OText>
469
- </TouchableOpacity>
470
- )}
471
- <TouchableOpacity
472
- activeOpacity={0.7}
473
- style={{ marginTop: 6 }}
474
- onPress={() => setIsOrderHistory(true)}
475
- >
476
- <OText
477
- size={12}
478
- lineHeight={15}
479
- color={theme.colors.primary}
480
- style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
481
- >
482
- {t('VIEW_DETAILS', 'View Details')}
483
- </OText>
484
- </TouchableOpacity>
485
- </View>
486
- {!hideDeliveryProgress && (
487
- <>
488
- <StaturBar>
489
- <LinearGradient
490
- start={{ x: 0.0, y: 0.0 }}
491
- end={{
492
- x: progressBarObjt(order?.status)?.percentage || 0,
493
- y: 0,
494
- }}
495
- locations={[0.9999, 0.9999]}
496
- colors={[theme.colors.primary, theme.colors.backgroundGray100]}
497
- style={styles.statusBar}
498
- />
499
- </StaturBar>
500
- <OText
501
- size={16}
502
- lineHeight={24}
503
- weight={'600'}
504
- color={theme.colors.textNormal}>
505
- {progressBarObjt(order?.status)?.value}
506
- </OText>
507
- </>
508
- )}
411
+ <PlaceholderLine width={60} height={15} />
412
+ <PlaceholderLine width={60} height={10} />
413
+ <StaturBar>
414
+ <PlaceholderLine height={15} />
415
+ <PlaceholderLine width={40} height={20} />
416
+ </StaturBar>
509
417
  </OrderData>
510
418
  <View
511
419
  style={{
@@ -516,124 +424,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
516
424
  }}
517
425
  />
518
426
  </OrderInfo>
519
- )}
520
- </Header>
521
- <OrderContent>
522
- {!isGiftCardOrder && (
427
+ </Header>
428
+ <OrderContent>
523
429
  <OrderBusiness>
524
- <OText
525
- size={16}
526
- lineHeight={24}
527
- weight={'500'}
528
- color={theme.colors.textNormal}
529
- mBottom={12}>
530
- {t('FROM', 'From')}
531
- </OText>
532
- <View
533
- style={{
534
- display: 'flex',
535
- flexDirection: 'column',
536
- alignItems: 'flex-start',
537
- }}>
538
- <View
539
- style={{
540
- flexDirection: 'row',
541
- alignItems: 'center',
542
- justifyContent: 'space-between',
543
- }}>
544
- <OText
545
- size={13}
546
- lineHeight={20}
547
- color={theme.colors.textNormal}
548
- style={{ flexGrow: 1, flexBasis: '80%' }}>
549
- {order?.business?.name}
550
- </OText>
551
- <Icons>
552
- {!!order?.business?.cellphone && !hideBusinessPhone && (
553
- <TouchableOpacity
554
- onPress={() => order?.business?.cellphone &&
555
- Linking.openURL(`tel:${order?.business?.cellphone}`)
556
- }
557
- style={{ paddingEnd: 5 }}
558
- >
559
- <OIcon
560
- src={theme.images.general.phone}
561
- width={16}
562
- color={theme.colors.disabled}
563
- />
564
- </TouchableOpacity>
565
- )}
566
- {!hideBusinessMessages && (
567
- <TouchableOpacity
568
- style={{ paddingStart: 5 }}
569
- onPress={() => handleGoToMessages('business')}>
570
- <OIcon
571
- src={theme.images.general.chat}
572
- width={16}
573
- color={theme.colors.disabled}
574
- />
575
- </TouchableOpacity>
576
- )}
577
- </Icons>
578
- </View>
579
- {!hideBusinessEmail && (
580
- <OText
581
- size={12}
582
- lineHeight={18}
583
- color={theme.colors.textNormal}
584
- mBottom={2}>
585
- {order?.business?.email}
586
- </OText>
587
- )}
588
- {!!order?.business?.cellphone && !hideBusinessPhone && (
589
- <OText
590
- size={12}
591
- lineHeight={18}
592
- color={theme.colors.textNormal}
593
- mBottom={2}>
594
- {order?.business?.cellphone}
595
- </OText>
596
- )}
597
- {!hideBusinessAddress && (
598
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
599
- {order?.business?.address}
600
- </OText>
601
- )}
602
- </View>
603
- {directionTypes.includes(order?.delivery_type) && (
604
- <OButton
605
- text={t('GET_DIRECTIONS', 'Get Directions')}
606
- imgRightSrc=''
607
- textStyle={{ color: theme.colors.white }}
608
- style={{
609
- alignSelf: 'center',
610
- borderRadius: 10,
611
- marginTop: 30
612
- }}
613
- onClick={() => showLocation({
614
- latitude: order?.business?.location?.lat,
615
- longitude: order?.business?.location?.lng,
616
- naverCallerName: 'com.reactnativeappstemplate5',
617
- dialogTitle: t('GET_DIRECTIONS', 'Get Directions'),
618
- dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
619
- cancelText: t('CANCEL', 'Cancel'),
620
- })}
621
- />
622
- )}
430
+ <PlaceholderLine width={30} height={20} />
431
+ <PlaceholderLine width={60} height={15} />
432
+ <PlaceholderLine width={75} height={10} />
433
+ <PlaceholderLine width={40} height={10} />
434
+ <PlaceholderLine width={95} height={10} />
623
435
  </OrderBusiness>
624
- )}
625
-
626
- {!isGiftCardOrder && placeSpotTypes.includes(order?.delivery_type) && (
627
- <PlaceSpotWrapper>
628
- <PlaceSpot
629
- isInputMode
630
- cart={order}
631
- spotNumberDefault={order?.spot_number}
632
- vehicleDefault={order?.vehicle}
633
- />
634
- </PlaceSpotWrapper>
635
- )}
636
-
436
+ </OrderContent>
637
437
  <View
638
438
  style={{
639
439
  height: 8,
@@ -643,451 +443,690 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
643
443
  }}
644
444
  />
645
445
  <OrderCustomer>
646
- <OText
647
- size={16}
648
- lineHeight={24}
649
- weight={'500'}
650
- color={theme.colors.textNormal}
651
- mBottom={12}>
652
- {isGiftCardOrder ? t('CUSTOMER', 'Customer') : t('TO', 'To')}
653
- </OText>
654
- <Customer>
655
- <InfoBlock>
446
+ <PlaceholderLine width={20} height={20} />
447
+ <PlaceholderLine width={70} height={15} />
448
+ <PlaceholderLine width={65} height={10} />
449
+ <PlaceholderLine width={80} height={10} />
450
+ <PlaceholderLine width={70} height={10} />
451
+ <View style={{ marginTop: 10 }}>
452
+ <PlaceholderLine width={60} height={20} />
453
+ <PlaceholderLine width={40} height={10} />
454
+ </View>
455
+ </OrderCustomer>
456
+ </Placeholder>
457
+ )}
458
+ {order && Object.keys(order).length > 0 && (
459
+ <>
460
+ <Header>
461
+ <NavBar
462
+ hideArrowLeft
463
+ title={`${t('ORDER', 'Order')} #${order?.id}`}
464
+ titleAlign={'center'}
465
+ showCall={false}
466
+ btnStyle={{ paddingLeft: 0 }}
467
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
468
+ titleWrapStyle={{ paddingHorizontal: 0 }}
469
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
470
+ subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
471
+ {activeStatus.includes(order?.status) ? (
472
+ <OrderEta order={order} />
473
+ ) : (
474
+ parseDate(order?.reporting_data?.at[`status:${order.status}`])
475
+ )}
476
+ </OText>}
477
+ />
478
+ {enabledPoweredByOrdering && (
479
+ <View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
480
+ <OText>
481
+ Powered By Ordering.co
482
+ </OText>
483
+ </View>
484
+ )}
485
+ {!isGiftCardOrder && (
486
+ <OrderInfo>
487
+ <OrderData>
488
+ <View style={styles.linkWrapper}>
489
+ {
490
+ (
491
+ parseInt(order?.status) === 1 ||
492
+ parseInt(order?.status) === 11 ||
493
+ parseInt(order?.status) === 15
494
+ ) && !order.review && !isReviewed && (
495
+ <TouchableOpacity
496
+ activeOpacity={0.7}
497
+ style={{ marginTop: 6, marginRight: 10 }}
498
+ onPress={() => handleClickOrderReview(order)}
499
+ >
500
+ <OText
501
+ size={12}
502
+ lineHeight={15}
503
+ color={theme.colors.primary}
504
+ style={{ textDecorationLine: 'underline' }}
505
+ >
506
+ {t('REVIEW_YOUR_ORDER', 'Review your order')}
507
+ </OText>
508
+ </TouchableOpacity>
509
+ )}
510
+ <TouchableOpacity
511
+ activeOpacity={0.7}
512
+ style={{ marginTop: 6 }}
513
+ onPress={() => setIsOrderHistory(true)}
514
+ >
515
+ <OText
516
+ size={12}
517
+ lineHeight={15}
518
+ color={theme.colors.primary}
519
+ style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
520
+ >
521
+ {t('VIEW_DETAILS', 'View Details')}
522
+ </OText>
523
+ </TouchableOpacity>
524
+ </View>
525
+ {!hideDeliveryProgress && (
526
+ <>
527
+ <StaturBar>
528
+ <LinearGradient
529
+ start={{ x: 0.0, y: 0.0 }}
530
+ end={{
531
+ x: progressBarObjt(order?.status)?.percentage || 0,
532
+ y: 0,
533
+ }}
534
+ locations={[0.9999, 0.9999]}
535
+ colors={[theme.colors.primary, theme.colors.backgroundGray100]}
536
+ style={styles.statusBar}
537
+ />
538
+ </StaturBar>
539
+ <OText
540
+ size={16}
541
+ lineHeight={24}
542
+ weight={'600'}
543
+ color={theme.colors.textNormal}>
544
+ {progressBarObjt(order?.status)?.value}
545
+ </OText>
546
+ </>
547
+ )}
548
+ </OrderData>
549
+ <View
550
+ style={{
551
+ height: 8,
552
+ backgroundColor: theme.colors.backgroundGray100,
553
+ marginTop: 18,
554
+ marginHorizontal: -40,
555
+ }}
556
+ />
557
+ </OrderInfo>
558
+ )}
559
+ </Header>
560
+ <OrderContent>
561
+ {!isGiftCardOrder && (
562
+ <OrderBusiness>
656
563
  <OText
657
- size={12}
658
- lineHeight={18}
564
+ size={16}
565
+ lineHeight={24}
566
+ weight={'500'}
659
567
  color={theme.colors.textNormal}
660
- mBottom={2}>
661
- {order?.customer?.name} {order?.customer?.lastname}
568
+ mBottom={12}>
569
+ {t('FROM', 'From')}
662
570
  </OText>
663
- {!hideCustomerAddress && (
664
- <OText
665
- size={12}
666
- lineHeight={18}
667
- color={theme.colors.textNormal}
668
- mBottom={2}>
669
- {order?.customer?.address}
670
- </OText>
571
+ <View
572
+ style={{
573
+ display: 'flex',
574
+ flexDirection: 'column',
575
+ alignItems: 'flex-start',
576
+ }}>
577
+ <View
578
+ style={{
579
+ flexDirection: 'row',
580
+ alignItems: 'center',
581
+ justifyContent: 'space-between',
582
+ }}>
583
+ <OText
584
+ size={13}
585
+ lineHeight={20}
586
+ color={theme.colors.textNormal}
587
+ style={{ flexGrow: 1, flexBasis: '80%' }}>
588
+ {order?.business?.name}
589
+ </OText>
590
+ <Icons>
591
+ {!!order?.business?.cellphone && !hideBusinessPhone && (
592
+ <TouchableOpacity
593
+ onPress={() => order?.business?.cellphone &&
594
+ Linking.openURL(`tel:${order?.business?.cellphone}`)
595
+ }
596
+ style={{ paddingEnd: 5 }}
597
+ >
598
+ <OIcon
599
+ src={theme.images.general.phone}
600
+ width={16}
601
+ color={theme.colors.disabled}
602
+ />
603
+ </TouchableOpacity>
604
+ )}
605
+ {!hideBusinessMessages && (
606
+ <TouchableOpacity
607
+ style={{ paddingStart: 5 }}
608
+ onPress={() => handleGoToMessages('business')}>
609
+ <OIcon
610
+ src={theme.images.general.chat}
611
+ width={16}
612
+ color={theme.colors.disabled}
613
+ />
614
+ </TouchableOpacity>
615
+ )}
616
+ </Icons>
617
+ </View>
618
+ {!hideBusinessEmail && (
619
+ <OText
620
+ size={12}
621
+ lineHeight={18}
622
+ color={theme.colors.textNormal}
623
+ mBottom={2}>
624
+ {order?.business?.email}
625
+ </OText>
626
+ )}
627
+ {!!order?.business?.cellphone && !hideBusinessPhone && (
628
+ <OText
629
+ size={12}
630
+ lineHeight={18}
631
+ color={theme.colors.textNormal}
632
+ mBottom={2}>
633
+ {order?.business?.cellphone}
634
+ </OText>
635
+ )}
636
+ {!hideBusinessAddress && (
637
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
638
+ {order?.business?.address}
639
+ </OText>
640
+ )}
641
+ </View>
642
+ {directionTypes.includes(order?.delivery_type) && (
643
+ <OButton
644
+ text={t('GET_DIRECTIONS', 'Get Directions')}
645
+ imgRightSrc=''
646
+ textStyle={{ color: theme.colors.white }}
647
+ style={{
648
+ alignSelf: 'center',
649
+ borderRadius: 10,
650
+ marginTop: 30
651
+ }}
652
+ onClick={() => showLocation({
653
+ latitude: order?.business?.location?.lat,
654
+ longitude: order?.business?.location?.lng,
655
+ naverCallerName: 'com.reactnativeappstemplate5',
656
+ dialogTitle: t('GET_DIRECTIONS', 'Get Directions'),
657
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
658
+ cancelText: t('CANCEL', 'Cancel'),
659
+ })}
660
+ />
671
661
  )}
672
- {(!!order?.customer?.cellphone && !hideCustomerPhone) && (
662
+ </OrderBusiness>
663
+ )}
664
+
665
+ {!isGiftCardOrder && placeSpotTypes.includes(order?.delivery_type) && (
666
+ <PlaceSpotWrapper>
667
+ <PlaceSpot
668
+ isInputMode
669
+ cart={order}
670
+ spotNumberDefault={order?.spot_number}
671
+ vehicleDefault={order?.vehicle}
672
+ />
673
+ </PlaceSpotWrapper>
674
+ )}
675
+
676
+ <View
677
+ style={{
678
+ height: 8,
679
+ backgroundColor: theme.colors.backgroundGray100,
680
+ marginTop: 18,
681
+ marginHorizontal: -40,
682
+ }}
683
+ />
684
+ <OrderCustomer>
685
+ <OText
686
+ size={16}
687
+ lineHeight={24}
688
+ weight={'500'}
689
+ color={theme.colors.textNormal}
690
+ mBottom={12}>
691
+ {isGiftCardOrder ? t('CUSTOMER', 'Customer') : t('TO', 'To')}
692
+ </OText>
693
+ <Customer>
694
+ <InfoBlock>
673
695
  <OText
674
696
  size={12}
675
697
  lineHeight={18}
676
698
  color={theme.colors.textNormal}
677
699
  mBottom={2}>
678
- {`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
700
+ {order?.customer?.name} {order?.customer?.lastname}
679
701
  </OText>
680
- )}
681
- </InfoBlock>
682
- </Customer>
683
- {!isGiftCardOrder && order?.delivery_option !== undefined && order?.delivery_type === 1 && (
684
- <View style={{ marginTop: 15 }}>
685
- <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
686
- {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
687
- </OText>
688
- <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
689
- {order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
690
- </OText>
691
- </View>
692
- )}
693
- {!!order?.comment && (
694
- <View style={{ marginTop: 15 }}>
695
- <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
696
- {t('COMMENT', 'Comment')}
697
- </OText>
698
- <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.comment}</OText>
699
- </View>
700
- )}
702
+ {!hideCustomerAddress && (
703
+ <OText
704
+ size={12}
705
+ lineHeight={18}
706
+ color={theme.colors.textNormal}
707
+ mBottom={2}>
708
+ {order?.customer?.address}
709
+ </OText>
710
+ )}
711
+ {(!!order?.customer?.cellphone && !hideCustomerPhone) && (
712
+ <OText
713
+ size={12}
714
+ lineHeight={18}
715
+ color={theme.colors.textNormal}
716
+ mBottom={2}>
717
+ {`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
718
+ </OText>
719
+ )}
720
+ </InfoBlock>
721
+ </Customer>
722
+ {!isGiftCardOrder && order?.delivery_option !== undefined && order?.delivery_type === 1 && (
723
+ <View style={{ marginTop: 15 }}>
724
+ <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
725
+ {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
726
+ </OText>
727
+ <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
728
+ {order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
729
+ </OText>
730
+ </View>
731
+ )}
732
+ {!!order?.comment && (
733
+ <View style={{ marginTop: 15 }}>
734
+ <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
735
+ {t('COMMENT', 'Comment')}
736
+ </OText>
737
+ <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.comment}</OText>
738
+ </View>
739
+ )}
740
+ {order?.driver && (
741
+ <>
742
+ {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
743
+ <Map>
744
+ <GoogleMap
745
+ location={typeof order?.driver?.location?.location === 'string'
746
+ ? {
747
+ lat: parseFloat(driverLocationString[0]),
748
+ lng: parseFloat(driverLocationString[1]),
749
+ } : driverLocation ?? order?.driver?.location
750
+ }
751
+ locations={parsedLocations}
752
+ readOnly
753
+ />
754
+ </Map>
755
+ )}
756
+ </>
757
+ )}
758
+ </OrderCustomer>
701
759
  {order?.driver && (
702
760
  <>
703
- {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
704
- <Map>
705
- <GoogleMap
706
- location={typeof order?.driver?.location?.location === 'string'
707
- ? {
708
- lat: parseFloat(driverLocationString[0]),
709
- lng: parseFloat(driverLocationString[1]),
710
- } : driverLocation ?? order?.driver?.location
711
- }
712
- locations={parsedLocations}
713
- readOnly
714
- />
715
- </Map>
716
- )}
717
- </>
718
- )}
719
- </OrderCustomer>
720
- {order?.driver && (
721
- <>
722
- <View
723
- style={{
724
- height: 8,
725
- backgroundColor: theme.colors.backgroundGray100,
726
- marginTop: 18,
727
- marginHorizontal: -40,
728
- }}
729
- />
730
- <OrderDriver>
731
- <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
732
- <Customer>
733
- <InfoBlock>
734
- <View
735
- style={{
736
- flexDirection: 'row',
737
- alignItems: 'center',
738
- justifyContent: 'space-between',
739
- }}>
740
- {!hideDriverName && (
741
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
742
- {order?.driver?.name} {order?.driver?.lastname}
761
+ <View
762
+ style={{
763
+ height: 8,
764
+ backgroundColor: theme.colors.backgroundGray100,
765
+ marginTop: 18,
766
+ marginHorizontal: -40,
767
+ }}
768
+ />
769
+ <OrderDriver>
770
+ <OText size={16} lineHeight={24} weight={'500'} style={{ marginBottom: 10 }}>{t('YOUR_DRIVER', 'Your Driver')}</OText>
771
+ <Customer>
772
+ <InfoBlock>
773
+ <View
774
+ style={{
775
+ flexDirection: 'row',
776
+ alignItems: 'center',
777
+ justifyContent: 'space-between',
778
+ }}>
779
+ {!hideDriverName && (
780
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
781
+ {order?.driver?.name} {order?.driver?.lastname}
782
+ </OText>
783
+ )}
784
+ {!hideDriverMessages && (
785
+ <Icons>
786
+ <TouchableOpacity
787
+ onPress={() => handleGoToMessages('driver')}>
788
+ <OIcon
789
+ src={theme.images.general.chat}
790
+ width={16}
791
+ color={theme.colors.disabled}
792
+ />
793
+ </TouchableOpacity>
794
+ </Icons>
795
+ )}
796
+ </View>
797
+ {!hideDriverPhone && (
798
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
799
+ {order?.driver?.cellphone}
743
800
  </OText>
744
801
  )}
745
- {!hideDriverMessages && (
746
- <Icons>
747
- <TouchableOpacity
748
- onPress={() => handleGoToMessages('driver')}>
749
- <OIcon
750
- src={theme.images.general.chat}
751
- width={16}
752
- color={theme.colors.disabled}
753
- />
754
- </TouchableOpacity>
755
- </Icons>
756
- )}
757
- </View>
758
- {!hideDriverPhone && (
759
- <OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
760
- {order?.driver?.cellphone}
761
- </OText>
762
- )}
763
- </InfoBlock>
764
- </Customer>
765
- </OrderDriver>
766
- </>
767
- )}
768
- <View
769
- style={{
770
- height: 8,
771
- backgroundColor: theme.colors.backgroundGray100,
772
- marginTop: 18,
773
- marginHorizontal: -40,
774
- }}
775
- />
776
- <HeaderInfo>
777
- <OText
778
- size={24}
779
- color={theme.colors.textNormal}
780
- style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold', marginBottom: 16 }}>
781
- {t(
782
- 'YOUR_ORDER_HAS_BEEN_RECEIVED',
783
- 'Your Order has been received',
784
- )}
785
- </OText>
786
- <OText color={theme.colors.textNormal} size={14} weight={'500'}>
787
- {t(
788
- 'ORDER_MESSAGE_HEADER_TEXT',
789
- 'Once business accepts your order, we will send you an email, thank you!',
790
- )}
791
- </OText>
792
- <OrderAction>
793
- <OButton
794
- text={t('YOUR_ORDERS', 'Your Orders')}
795
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
796
- imgRightSrc={null}
797
- borderColor={theme.colors.primary}
798
- bgColor={theme.colors.clear}
799
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
800
- parentStyle={{ marginTop: 29, marginEnd: 15 }}
801
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
802
- />
803
- {(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && !isGiftCardOrder && (
802
+ </InfoBlock>
803
+ </Customer>
804
+ </OrderDriver>
805
+ </>
806
+ )}
807
+ <View
808
+ style={{
809
+ height: 8,
810
+ backgroundColor: theme.colors.backgroundGray100,
811
+ marginTop: 18,
812
+ marginHorizontal: -40,
813
+ }}
814
+ />
815
+ <HeaderInfo>
816
+ <OText
817
+ size={24}
818
+ color={theme.colors.textNormal}
819
+ style={{ fontWeight: Platform.OS == 'ios' ? '600' : 'bold', marginBottom: 16 }}>
820
+ {t(
821
+ 'YOUR_ORDER_HAS_BEEN_RECEIVED',
822
+ 'Your Order has been received',
823
+ )}
824
+ </OText>
825
+ <OText color={theme.colors.textNormal} size={14} weight={'500'}>
826
+ {t(
827
+ 'ORDER_MESSAGE_HEADER_TEXT',
828
+ 'Once business accepts your order, we will send you an email, thank you!',
829
+ )}
830
+ </OText>
831
+ <OrderAction>
804
832
  <OButton
805
- text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
833
+ text={t('YOUR_ORDERS', 'Your Orders')}
806
834
  textStyle={{ fontSize: 14, color: theme.colors.primary }}
807
835
  imgRightSrc={null}
808
- borderColor='transparent'
809
- bgColor={theme.colors.primary + 10}
810
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
811
- onClick={() => handleReorder && handleReorder(order.id)}
836
+ borderColor={theme.colors.primary}
837
+ bgColor={theme.colors.clear}
838
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
839
+ parentStyle={{ marginTop: 29, marginEnd: 15 }}
840
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
812
841
  />
813
- )}
814
- </OrderAction>
815
- </HeaderInfo>
816
- <OrderProducts>
817
- {sortedProductList}
818
- </OrderProducts>
819
- <OrderBill>
820
- <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
821
- <Table>
822
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
823
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
824
- {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
825
- </OText>
826
- </Table>
827
- {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
828
- <Table>
829
- {order?.offer_type === 1 ? (
830
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
831
- {t('DISCOUNT', 'Discount')}
832
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
833
- order?.offer_rate,
834
- parsePrice,
835
- )}%)`}</OText>
836
- </OText>
837
- ) : (
838
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
842
+ {(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && !isGiftCardOrder && (
843
+ <OButton
844
+ text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
845
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
846
+ imgRightSrc={null}
847
+ borderColor='transparent'
848
+ bgColor={theme.colors.primary + 10}
849
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
850
+ onClick={() => handleReorder && handleReorder(order.id)}
851
+ />
839
852
  )}
853
+ </OrderAction>
854
+ </HeaderInfo>
855
+ <OrderProducts>
856
+ {sortedProductList}
857
+ </OrderProducts>
858
+ <OrderBill>
859
+ <View style={{ height: 1, backgroundColor: theme.colors.border, marginBottom: 17 }} />
860
+ <Table>
861
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL', 'Subtotal')}</OText>
840
862
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
841
- - {parsePrice(order?.summary?.discount || order?.discount)}
863
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
842
864
  </OText>
843
865
  </Table>
844
- )}
845
- {
846
- order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
847
- <Table key={offer.id}>
848
- <OSRow>
849
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
850
- {offer.name}
851
- {offer.rate_type === 1 && (
852
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
853
- )}
854
- </OText>
855
- <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
856
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
857
- </TouchableOpacity>
858
- </OSRow>
859
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
860
- </Table>
861
- ))
862
- }
863
- {!isGiftCardOrder && (
864
- <Divider />
865
- )}
866
- {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
867
- <Table>
868
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
869
- {order?.tax_type === 1 ? (
870
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
871
- ) : (
872
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
873
- )}
874
- </Table>
875
- )}
876
- {
877
- order?.taxes?.length === 0 && order?.tax_type === 2 && (
866
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
878
867
  <Table>
868
+ {order?.offer_type === 1 ? (
869
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
870
+ {t('DISCOUNT', 'Discount')}
871
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(
872
+ order?.offer_rate,
873
+ parsePrice,
874
+ )}%)`}</OText>
875
+ </OText>
876
+ ) : (
877
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DISCOUNT', 'Discount')}</OText>
878
+ )}
879
879
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
880
- {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
880
+ - {parsePrice(order?.summary?.discount || order?.discount)}
881
881
  </OText>
882
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.tax || 0)}</OText>
883
882
  </Table>
884
- )
885
- }
886
- {
887
- order?.fees?.length === 0 && (
883
+ )}
884
+ {
885
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
886
+ <Table key={offer.id}>
887
+ <OSRow>
888
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
889
+ {offer.name}
890
+ {offer.rate_type === 1 && (
891
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
892
+ )}
893
+ </OText>
894
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })}>
895
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
896
+ </TouchableOpacity>
897
+ </OSRow>
898
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
899
+ </Table>
900
+ ))
901
+ }
902
+ {!isGiftCardOrder && (
903
+ <Divider />
904
+ )}
905
+ {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
888
906
  <Table>
889
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
890
- {t('SERVICE_FEE', 'Service fee')}
891
- {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
892
- </OText>
893
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
907
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
908
+ {order?.tax_type === 1 ? (
909
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
910
+ ) : (
911
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
912
+ )}
894
913
  </Table>
895
- )
896
- }
897
- {
898
- order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
899
- <Table key={tax.id}>
900
- <OSRow>
901
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
902
- {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
903
- {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
914
+ )}
915
+ {
916
+ order?.taxes?.length === 0 && order?.tax_type === 2 && (
917
+ <Table>
918
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
919
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
904
920
  </OText>
905
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
906
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
907
- </TouchableOpacity>
908
- </OSRow>
909
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
910
- </Table>
911
- ))
912
- }
913
- {
914
- order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
915
- <Table key={fee.id}>
916
- <OSRow>
917
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
918
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
919
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
921
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.tax || 0)}</OText>
922
+ </Table>
923
+ )
924
+ }
925
+ {
926
+ order?.fees?.length === 0 && (
927
+ <Table>
928
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
929
+ {t('SERVICE_FEE', 'Service fee')}
930
+ {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
920
931
  </OText>
921
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
922
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
923
- </TouchableOpacity>
924
- </OSRow>
925
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
932
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.service_fee || 0)}</OText>
933
+ </Table>
934
+ )
935
+ }
936
+ {
937
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
938
+ <Table key={tax.id}>
939
+ <OSRow>
940
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
941
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
942
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
943
+ </OText>
944
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
945
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
946
+ </TouchableOpacity>
947
+ </OSRow>
948
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
949
+ </Table>
950
+ ))
951
+ }
952
+ {
953
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
954
+ <Table key={fee.id}>
955
+ <OSRow>
956
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
957
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
958
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
959
+ </OText>
960
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
961
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
962
+ </TouchableOpacity>
963
+ </OSRow>
964
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
965
+ </Table>
966
+ ))
967
+ }
968
+ {
969
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
970
+ <Table key={offer.id}>
971
+ <OSRow>
972
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
973
+ {offer.name}
974
+ {offer.rate_type === 1 && (
975
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
976
+ )}
977
+ </OText>
978
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
979
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
980
+ </TouchableOpacity>
981
+ </OSRow>
982
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
983
+ </Table>
984
+ ))
985
+ }
986
+ {typeof order?.summary?.delivery_price === 'number' && (
987
+ <Table>
988
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
989
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
926
990
  </Table>
927
- ))
928
- }
929
- {
930
- order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
931
- <Table key={offer.id}>
932
- <OSRow>
933
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
934
- {offer.name}
935
- {offer.rate_type === 1 && (
936
- <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
991
+ )}
992
+ {
993
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
994
+ <Table key={offer.id}>
995
+ <OSRow>
996
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
997
+ {offer.name}
998
+ {offer.rate_type === 1 && (
999
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
1000
+ )}
1001
+ </OText>
1002
+ <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
1003
+ <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
1004
+ </TouchableOpacity>
1005
+ </OSRow>
1006
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
1007
+ </Table>
1008
+ ))
1009
+ }
1010
+ {order?.summary?.driver_tip > 0 && (
1011
+ <Table>
1012
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
1013
+ {t('DRIVER_TIP', 'Driver tip')}
1014
+ {order?.summary?.driver_tip > 0 &&
1015
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
1016
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
1017
+ (
1018
+ `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
937
1019
  )}
938
- </OText>
939
- <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
940
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
941
- </TouchableOpacity>
942
- </OSRow>
943
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
1020
+ </OText>
1021
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
944
1022
  </Table>
945
- ))
946
- }
947
- {typeof order?.summary?.delivery_price === 'number' && (
948
- <Table>
949
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
950
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
951
- </Table>
952
- )}
953
- {
954
- order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
955
- <Table key={offer.id}>
956
- <OSRow>
957
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
958
- {offer.name}
959
- {offer.rate_type === 1 && (
960
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
961
- )}
962
- </OText>
963
- <TouchableOpacity style={{ marginLeft: 5 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })}>
964
- <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
965
- </TouchableOpacity>
966
- </OSRow>
967
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>- {parsePrice(offer?.summary?.discount)}</OText>
1023
+ )}
1024
+ <Total>
1025
+ <Table>
1026
+ <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
1027
+ <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>
1028
+ {parsePrice(order?.summary?.total ?? order?.total)}
1029
+ </OText>
968
1030
  </Table>
969
- ))
970
- }
971
- {order?.summary?.driver_tip > 0 && (
972
- <Table>
973
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
974
- {t('DRIVER_TIP', 'Driver tip')}
975
- {order?.summary?.driver_tip > 0 &&
976
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
977
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
978
- (
979
- `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
980
- )}
981
- </OText>
982
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
983
- </Table>
984
- )}
985
- <Total>
986
- <Table>
987
- <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>{t('TOTAL', 'Total')}</OText>
988
- <OText size={14} style={{ fontWeight: 'bold' }} color={theme.colors.textNormal}>
989
- {parsePrice(order?.summary?.total ?? order?.total)}
990
- </OText>
991
- </Table>
992
- </Total>
993
- {order?.payment_events?.length > 0 && (
994
- <View style={{ marginTop: 10 }}>
995
- <OText size={20} weight='bold' color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
996
- <View
997
- style={{
998
- width: '100%',
999
- marginTop: 10
1000
- }}
1001
- >
1002
- {order?.payment_events?.map((event: any) => event.amount > 0 && (
1003
- <View
1004
- key={event.id}
1005
- style={{
1006
- display: 'flex',
1007
- flexDirection: 'row',
1008
- justifyContent: 'space-between',
1009
- alignItems: 'center',
1010
- marginBottom: 10
1011
- }}
1012
- >
1031
+ </Total>
1032
+ {order?.payment_events?.length > 0 && (
1033
+ <View style={{ marginTop: 10 }}>
1034
+ <OText size={20} weight='bold' color={theme.colors.textNormal}>{t('PAYMENTS', 'Payments')}</OText>
1035
+ <View
1036
+ style={{
1037
+ width: '100%',
1038
+ marginTop: 10
1039
+ }}
1040
+ >
1041
+ {order?.payment_events?.map((event: any) => event.amount > 0 && (
1013
1042
  <View
1043
+ key={event.id}
1014
1044
  style={{
1015
1045
  display: 'flex',
1016
- flexDirection: 'column',
1046
+ flexDirection: 'row',
1047
+ justifyContent: 'space-between',
1048
+ alignItems: 'center',
1049
+ marginBottom: 10
1017
1050
  }}
1018
1051
  >
1019
- <OText>
1020
- {event?.wallet_event
1021
- ? walletName[event?.wallet_event?.wallet?.type]?.name
1022
- : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
1023
- </OText>
1024
- {/* {event?.data?.charge_id && (
1052
+ <View
1053
+ style={{
1054
+ display: 'flex',
1055
+ flexDirection: 'column',
1056
+ }}
1057
+ >
1058
+ <OText>
1059
+ {event?.wallet_event
1060
+ ? walletName[event?.wallet_event?.wallet?.type]?.name
1061
+ : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
1062
+ </OText>
1063
+ {/* {event?.data?.charge_id && (
1025
1064
  <OText>
1026
1065
  {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
1027
1066
  </OText>
1028
1067
  )} */}
1068
+ </View>
1069
+ <OText>
1070
+ -{parsePrice(event.amount, { isTruncable: true })}
1071
+ </OText>
1029
1072
  </View>
1030
- <OText>
1031
- {configs.currency_position?.value === 'left'
1032
- ? `${configs.format_number_currency?.value} -${parseNumber(event.amount, { isTruncable: true })}`
1033
- : `-${parsePrice(event.amount, { isTruncable: true })}`}
1034
- </OText>
1035
- </View>
1036
- ))}
1073
+ ))}
1074
+ </View>
1037
1075
  </View>
1038
- </View>
1076
+ )}
1077
+ </OrderBill>
1078
+ {isGiftCardOrder && order?.products[0]?.gift_card?.status === 'pending' && !isGiftCardSent && (
1079
+ <>
1080
+ <View
1081
+ style={{
1082
+ height: 8,
1083
+ backgroundColor: theme.colors.backgroundGray100,
1084
+ marginTop: 10,
1085
+ marginHorizontal: -40,
1086
+ marginBottom: 20
1087
+ }}
1088
+ />
1089
+ <SendGiftCard
1090
+ giftCardId={order?.products[0]?.gift_card?.id}
1091
+ setIsGiftCardSent={setIsGiftCardSent}
1092
+ />
1093
+ </>
1039
1094
  )}
1040
- </OrderBill>
1041
- {isGiftCardOrder && order?.products[0]?.gift_card?.status === 'pending' && !isGiftCardSent && (
1042
- <>
1043
- <View
1044
- style={{
1045
- height: 8,
1046
- backgroundColor: theme.colors.backgroundGray100,
1047
- marginTop: 10,
1048
- marginHorizontal: -40,
1049
- marginBottom: 20
1050
- }}
1051
- />
1052
- <SendGiftCard
1053
- giftCardId={order?.products[0]?.gift_card?.id}
1054
- setIsGiftCardSent={setIsGiftCardSent}
1055
- />
1056
- </>
1057
- )}
1058
- </OrderContent>
1059
- </>
1060
- )}
1061
- <OModal
1062
- open={openTaxModal.open}
1063
- onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1064
- entireModal
1065
- >
1066
- <TaxInformation
1067
- type={openTaxModal.type}
1068
- data={openTaxModal.data}
1069
- products={order?.products}
1070
- />
1071
- </OModal>
1072
- <OModal
1073
- open={isOrderHistory}
1074
- onClose={() => setIsOrderHistory(false)}
1075
- entireModal
1076
- >
1077
- <OrderHistory
1078
- order={order}
1079
- hideViaText={props.hideViaText}
1080
- messages={messages}
1081
- enableReview={(
1082
- parseInt(order?.status) === 1 ||
1083
- parseInt(order?.status) === 11 ||
1084
- parseInt(order?.status) === 15
1085
- ) && !order.review && !isReviewed}
1095
+ </OrderContent>
1096
+ </>
1097
+ )}
1098
+ <OModal
1099
+ open={openTaxModal.open}
1100
+ onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1101
+ entireModal
1102
+ >
1103
+ <TaxInformation
1104
+ type={openTaxModal.type}
1105
+ data={openTaxModal.data}
1106
+ products={order?.products}
1107
+ />
1108
+ </OModal>
1109
+ <OModal
1110
+ open={isOrderHistory}
1086
1111
  onClose={() => setIsOrderHistory(false)}
1087
- handleTriggerReview={handleTriggerReview}
1088
- />
1089
- </OModal>
1090
- </OrderDetailsContainer>
1112
+ entireModal
1113
+ >
1114
+ <OrderHistory
1115
+ order={order}
1116
+ hideViaText={props.hideViaText}
1117
+ messages={messages}
1118
+ enableReview={(
1119
+ parseInt(order?.status) === 1 ||
1120
+ parseInt(order?.status) === 11 ||
1121
+ parseInt(order?.status) === 15
1122
+ ) && !order.review && !isReviewed}
1123
+ onClose={() => setIsOrderHistory(false)}
1124
+ handleTriggerReview={handleTriggerReview}
1125
+ />
1126
+ </OModal>
1127
+ </OrderDetailsContainer>
1128
+ </SafeAreaView>
1129
+
1091
1130
  );
1092
1131
  };
1093
1132