ordering-ui-react-native 0.17.76-release → 0.17.77-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.
- package/package.json +1 -1
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +9 -7
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/Checkout/index.tsx +13 -1
- package/themes/original/src/components/OrderDetails/index.tsx +116 -78
- package/themes/original/src/components/OrderProgress/index.tsx +5 -3
- package/themes/original/src/components/PaymentOptions/index.tsx +21 -2
- package/themes/original/src/components/ProductForm/index.tsx +2 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +31 -4
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
- package/themes/original/src/utils/index.tsx +113 -0
package/package.json
CHANGED
|
@@ -275,12 +275,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
275
275
|
{t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
|
|
276
276
|
</OText>
|
|
277
277
|
)}
|
|
278
|
-
|
|
279
|
-
<
|
|
278
|
+
<OText>
|
|
279
|
+
<OText size={13} weight='bold'>
|
|
280
|
+
{`${t('PAYMENT_METHODS', 'Payment methods')}: `}
|
|
281
|
+
</OText>
|
|
282
|
+
{order?.payment_events?.length > 0 ? (
|
|
280
283
|
<OText size={13}>
|
|
281
|
-
<OText size={13} weight='bold'>
|
|
282
|
-
{`${t('PAYMENT_METHODS', 'Payment methods')}: `}
|
|
283
|
-
</OText>
|
|
284
284
|
{order?.payment_events?.map((event: any, idx: number) => {
|
|
285
285
|
return event?.wallet_event
|
|
286
286
|
? idx < order?.payment_events?.length - 1
|
|
@@ -291,8 +291,10 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
291
291
|
: t(event?.paymethod?.name?.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)
|
|
292
292
|
})}
|
|
293
293
|
</OText>
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
) : (
|
|
295
|
+
<OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
|
|
296
|
+
)}
|
|
297
|
+
</OText>
|
|
296
298
|
</>
|
|
297
299
|
)}
|
|
298
300
|
</OrderHeader>
|
|
@@ -406,7 +406,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
406
406
|
style={{ marginRight: isChewLayout ? 0 : 10 }}
|
|
407
407
|
/>
|
|
408
408
|
<OText size={12} numberOfLines={1} style={{ flex: 1 }}>
|
|
409
|
-
{orderState?.options?.address?.address}
|
|
409
|
+
{orderState?.options?.address?.address || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
|
|
410
410
|
</OText>
|
|
411
411
|
{!isChewLayout && (
|
|
412
412
|
<OIcon
|
|
@@ -162,6 +162,7 @@ const CheckoutUI = (props: any) => {
|
|
|
162
162
|
const [allowedGuest, setAllowedGuest] = useState(false)
|
|
163
163
|
const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
|
|
164
164
|
const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
|
|
165
|
+
const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
|
|
165
166
|
const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
|
|
166
167
|
const cardsMethods = ['credomatic']
|
|
167
168
|
const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
|
|
@@ -732,6 +733,10 @@ const CheckoutUI = (props: any) => {
|
|
|
732
733
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
733
734
|
cardList={cardList}
|
|
734
735
|
setCardList={setCardList}
|
|
736
|
+
requiredFields={requiredFields}
|
|
737
|
+
openUserModal={setIsOpen}
|
|
738
|
+
paymethodClicked={paymethodClicked}
|
|
739
|
+
setPaymethodClicked={setPaymethodClicked}
|
|
735
740
|
/>
|
|
736
741
|
</ChPaymethods>
|
|
737
742
|
</ChSection>
|
|
@@ -916,7 +921,14 @@ const CheckoutUI = (props: any) => {
|
|
|
916
921
|
handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
|
|
917
922
|
onClose={() => {
|
|
918
923
|
setIsOpen(false)
|
|
919
|
-
|
|
924
|
+
if (paymethodClicked) {
|
|
925
|
+
setPaymethodClicked({
|
|
926
|
+
...paymethodClicked,
|
|
927
|
+
confirmed: true
|
|
928
|
+
})
|
|
929
|
+
} else {
|
|
930
|
+
handlePlaceOrder(null, true)
|
|
931
|
+
}
|
|
920
932
|
}}
|
|
921
933
|
setIsOpen={setIsOpen}
|
|
922
934
|
/>
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
OrderDetails as OrderDetailsConTableoller,
|
|
8
8
|
useUtils,
|
|
9
9
|
useOrder,
|
|
10
|
-
useConfig
|
|
10
|
+
useConfig,
|
|
11
|
+
useToast,
|
|
12
|
+
ToastType
|
|
11
13
|
} from 'ordering-components/native';
|
|
12
14
|
import { useTheme } from 'styled-components/native';
|
|
13
15
|
import { showLocation } from 'react-native-map-link';
|
|
@@ -40,7 +42,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
|
|
|
40
42
|
import { TouchableOpacity } from 'react-native-gesture-handler';
|
|
41
43
|
import { OrderDetailsParams } from '../../types';
|
|
42
44
|
import { GoogleMap } from '../GoogleMap';
|
|
43
|
-
import { verifyDecimals, getOrderStatus } from '../../utils';
|
|
45
|
+
import { verifyDecimals, getOrderStatus, getOrderStatuPickUp } from '../../utils';
|
|
44
46
|
import { OSRow } from '../OrderSummary/styles';
|
|
45
47
|
import AntIcon from 'react-native-vector-icons/AntDesign'
|
|
46
48
|
import { TaxInformation } from '../TaxInformation';
|
|
@@ -48,8 +50,8 @@ import { Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
|
48
50
|
import NavBar from '../NavBar'
|
|
49
51
|
import { OrderHistory } from './OrderHistory';
|
|
50
52
|
import { PlaceSpot } from '../PlaceSpot'
|
|
51
|
-
import { OrderEta } from './OrderEta'
|
|
52
53
|
import { SendGiftCard } from '../GiftCard/SendGiftCard'
|
|
54
|
+
import { OrderEta } from './OrderEta'
|
|
53
55
|
export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
54
56
|
const {
|
|
55
57
|
navigation,
|
|
@@ -65,7 +67,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
65
67
|
} = props;
|
|
66
68
|
|
|
67
69
|
const theme = useTheme();
|
|
68
|
-
|
|
70
|
+
const [, { showToast }] = useToast()
|
|
69
71
|
const styles = StyleSheet.create({
|
|
70
72
|
rowDirection: {
|
|
71
73
|
flexDirection: 'row',
|
|
@@ -124,9 +126,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
124
126
|
const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
|
|
125
127
|
const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
126
128
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
127
|
-
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
128
129
|
const isGiftCardOrder = !order?.business_id
|
|
129
|
-
|
|
130
|
+
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
131
|
+
const hideDeliveryProgress = theme?.confirmation?.components?.order?.components?.progress?.hidden
|
|
132
|
+
const hideBusinessPhone = theme?.confirmation?.components?.business?.components?.phone?.hidden
|
|
133
|
+
const hideBusinessMessages = theme?.confirmation?.components?.business?.components?.messages?.hidden
|
|
134
|
+
const hideBusinessEmail = theme?.confirmation?.components?.business?.components?.email?.hidden
|
|
135
|
+
const hideBusinessAddress = theme?.confirmation?.components?.business?.components?.address?.hidden
|
|
136
|
+
const hideDriverName = theme?.confirmation?.components?.driver?.components?.name?.hidden
|
|
137
|
+
const hideDriverPhone = theme?.confirmation?.components?.driver?.components?.phone?.hidden
|
|
138
|
+
const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
|
|
139
|
+
const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
|
|
140
|
+
const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
|
|
130
141
|
const walletName: any = {
|
|
131
142
|
cash: {
|
|
132
143
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
@@ -184,7 +195,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
184
195
|
order: {
|
|
185
196
|
id: order?.id,
|
|
186
197
|
business_id: order?.business_id,
|
|
187
|
-
logo: order.business?.logo,
|
|
198
|
+
logo: order.business?.logo || theme.images.dummies.businessLogo,
|
|
188
199
|
driver: order?.driver,
|
|
189
200
|
products: order?.products,
|
|
190
201
|
review: order?.review,
|
|
@@ -204,7 +215,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
204
215
|
) && !order.review && !isReviewed && handleClickOrderReview(order)
|
|
205
216
|
}
|
|
206
217
|
|
|
207
|
-
|
|
218
|
+
|
|
208
219
|
const resfreshOrder = () => {
|
|
209
220
|
getOrder()
|
|
210
221
|
}
|
|
@@ -328,8 +339,17 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
328
339
|
}
|
|
329
340
|
}, [driverLocation]);
|
|
330
341
|
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
if (props?.order?.error && !props?.order?.loading) {
|
|
344
|
+
showToast(ToastType.Error, props?.order?.error)
|
|
345
|
+
navigation.navigate('BusinessList')
|
|
346
|
+
}
|
|
347
|
+
}, [props?.order?.error, props?.order?.loading])
|
|
348
|
+
|
|
349
|
+
const progressBarObjt = order?.delivery_type && props.order?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
|
|
350
|
+
|
|
331
351
|
return (
|
|
332
|
-
<OrderDetailsContainer
|
|
352
|
+
<OrderDetailsContainer
|
|
333
353
|
keyboardShouldPersistTaps="handled"
|
|
334
354
|
refreshControl={
|
|
335
355
|
<RefreshControl
|
|
@@ -446,7 +466,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
446
466
|
activeOpacity={0.7}
|
|
447
467
|
style={{ marginTop: 6 }}
|
|
448
468
|
onPress={() => setIsOrderHistory(true)}
|
|
449
|
-
|
|
450
469
|
>
|
|
451
470
|
<OText
|
|
452
471
|
size={12}
|
|
@@ -458,26 +477,29 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
458
477
|
</OText>
|
|
459
478
|
</TouchableOpacity>
|
|
460
479
|
</View>
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
480
|
+
{!hideDeliveryProgress && (
|
|
481
|
+
<>
|
|
482
|
+
<StaturBar>
|
|
483
|
+
<LinearGradient
|
|
484
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
485
|
+
end={{
|
|
486
|
+
x: progressBarObjt(order?.status)?.percentage || 0,
|
|
487
|
+
y: 0,
|
|
488
|
+
}}
|
|
489
|
+
locations={[0.9999, 0.9999]}
|
|
490
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray100]}
|
|
491
|
+
style={styles.statusBar}
|
|
492
|
+
/>
|
|
493
|
+
</StaturBar>
|
|
494
|
+
<OText
|
|
495
|
+
size={16}
|
|
496
|
+
lineHeight={24}
|
|
497
|
+
weight={'600'}
|
|
498
|
+
color={theme.colors.textNormal}>
|
|
499
|
+
{progressBarObjt(order?.status)?.value}
|
|
500
|
+
</OText>
|
|
501
|
+
</>
|
|
502
|
+
)}
|
|
481
503
|
</OrderData>
|
|
482
504
|
<View
|
|
483
505
|
style={{
|
|
@@ -521,7 +543,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
521
543
|
{order?.business?.name}
|
|
522
544
|
</OText>
|
|
523
545
|
<Icons>
|
|
524
|
-
{!!order?.business?.cellphone && (
|
|
546
|
+
{!!order?.business?.cellphone && !hideBusinessPhone && (
|
|
525
547
|
<TouchableOpacity
|
|
526
548
|
onPress={() => order?.business?.cellphone &&
|
|
527
549
|
Linking.openURL(`tel:${order?.business?.cellphone}`)
|
|
@@ -535,25 +557,29 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
535
557
|
/>
|
|
536
558
|
</TouchableOpacity>
|
|
537
559
|
)}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
560
|
+
{!hideBusinessMessages && (
|
|
561
|
+
<TouchableOpacity
|
|
562
|
+
style={{ paddingStart: 5 }}
|
|
563
|
+
onPress={() => handleGoToMessages('business')}>
|
|
564
|
+
<OIcon
|
|
565
|
+
src={theme.images.general.chat}
|
|
566
|
+
width={16}
|
|
567
|
+
color={theme.colors.disabled}
|
|
568
|
+
/>
|
|
569
|
+
</TouchableOpacity>
|
|
570
|
+
)}
|
|
547
571
|
</Icons>
|
|
548
572
|
</View>
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
573
|
+
{!hideBusinessEmail && (
|
|
574
|
+
<OText
|
|
575
|
+
size={12}
|
|
576
|
+
lineHeight={18}
|
|
577
|
+
color={theme.colors.textNormal}
|
|
578
|
+
mBottom={2}>
|
|
579
|
+
{order?.business?.email}
|
|
580
|
+
</OText>
|
|
581
|
+
)}
|
|
582
|
+
{!!order?.business?.cellphone && !hideBusinessPhone && (
|
|
557
583
|
<OText
|
|
558
584
|
size={12}
|
|
559
585
|
lineHeight={18}
|
|
@@ -562,9 +588,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
562
588
|
{order?.business?.cellphone}
|
|
563
589
|
</OText>
|
|
564
590
|
)}
|
|
565
|
-
|
|
566
|
-
{
|
|
567
|
-
|
|
591
|
+
{!hideBusinessAddress && (
|
|
592
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
|
|
593
|
+
{order?.business?.address}
|
|
594
|
+
</OText>
|
|
595
|
+
)}
|
|
568
596
|
</View>
|
|
569
597
|
{directionTypes.includes(order?.delivery_type) && (
|
|
570
598
|
<OButton
|
|
@@ -588,7 +616,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
588
616
|
)}
|
|
589
617
|
</OrderBusiness>
|
|
590
618
|
)}
|
|
591
|
-
|
|
619
|
+
|
|
592
620
|
{!isGiftCardOrder && placeSpotTypes.includes(order?.delivery_type) && (
|
|
593
621
|
<PlaceSpotWrapper>
|
|
594
622
|
<PlaceSpot
|
|
@@ -626,14 +654,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
626
654
|
mBottom={2}>
|
|
627
655
|
{order?.customer?.name} {order?.customer?.lastname}
|
|
628
656
|
</OText>
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
657
|
+
{!hideCustomerAddress && (
|
|
658
|
+
<OText
|
|
659
|
+
size={12}
|
|
660
|
+
lineHeight={18}
|
|
661
|
+
color={theme.colors.textNormal}
|
|
662
|
+
mBottom={2}>
|
|
663
|
+
{order?.customer?.address}
|
|
664
|
+
</OText>
|
|
665
|
+
)}
|
|
666
|
+
{(!!order?.customer?.cellphone && !hideCustomerPhone) && (
|
|
637
667
|
<OText
|
|
638
668
|
size={12}
|
|
639
669
|
lineHeight={18}
|
|
@@ -666,7 +696,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
666
696
|
<>
|
|
667
697
|
{order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
|
|
668
698
|
<Map>
|
|
669
|
-
|
|
699
|
+
<GoogleMap
|
|
670
700
|
location={typeof order?.driver?.location?.location === 'string'
|
|
671
701
|
? {
|
|
672
702
|
lat: parseFloat(driverLocationString[0]),
|
|
@@ -701,23 +731,29 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
701
731
|
alignItems: 'center',
|
|
702
732
|
justifyContent: 'space-between',
|
|
703
733
|
}}>
|
|
704
|
-
|
|
705
|
-
{
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
734
|
+
{!hideDriverName && (
|
|
735
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2} style={{ flexGrow: 1, flexBasis: '80%' }}>
|
|
736
|
+
{order?.driver?.name} {order?.driver?.lastname}
|
|
737
|
+
</OText>
|
|
738
|
+
)}
|
|
739
|
+
{!hideDriverMessages && (
|
|
740
|
+
<Icons>
|
|
741
|
+
<TouchableOpacity
|
|
742
|
+
onPress={() => handleGoToMessages('driver')}>
|
|
743
|
+
<OIcon
|
|
744
|
+
src={theme.images.general.chat}
|
|
745
|
+
width={16}
|
|
746
|
+
color={theme.colors.disabled}
|
|
747
|
+
/>
|
|
748
|
+
</TouchableOpacity>
|
|
749
|
+
</Icons>
|
|
750
|
+
)}
|
|
717
751
|
</View>
|
|
718
|
-
|
|
719
|
-
{
|
|
720
|
-
|
|
752
|
+
{!hideDriverPhone && (
|
|
753
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
|
|
754
|
+
{order?.driver?.cellphone}
|
|
755
|
+
</OText>
|
|
756
|
+
)}
|
|
721
757
|
</InfoBlock>
|
|
722
758
|
</Customer>
|
|
723
759
|
</OrderDriver>
|
|
@@ -986,7 +1022,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
986
1022
|
)} */}
|
|
987
1023
|
</View>
|
|
988
1024
|
<OText>
|
|
989
|
-
|
|
1025
|
+
{configs.currency_position?.value === 'left'
|
|
1026
|
+
? `${configs.format_number_currency?.value} -${parseNumber(event.amount, { isTruncable: true })}`
|
|
1027
|
+
: `-${parsePrice(event.amount, { isTruncable: true })}`}
|
|
990
1028
|
</OText>
|
|
991
1029
|
</View>
|
|
992
1030
|
))}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
OrderInfoWrapper,
|
|
23
23
|
OrderProgressWrapper
|
|
24
24
|
} from './styles'
|
|
25
|
-
import { getOrderStatus } from '../../utils'
|
|
25
|
+
import { getOrderStatuPickUp, getOrderStatus } from '../../utils'
|
|
26
26
|
|
|
27
27
|
const OrderProgressUI = (props: any) => {
|
|
28
28
|
const {
|
|
@@ -110,6 +110,8 @@ const OrderProgressUI = (props: any) => {
|
|
|
110
110
|
setInitialLoaded(true)
|
|
111
111
|
}, [orderList.loading, initialLoaded])
|
|
112
112
|
|
|
113
|
+
const progressBarObjt = lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp : getOrderStatus
|
|
114
|
+
|
|
113
115
|
return (
|
|
114
116
|
<>
|
|
115
117
|
{(orderList?.loading && !initialLoaded) && (
|
|
@@ -162,10 +164,10 @@ const OrderProgressUI = (props: any) => {
|
|
|
162
164
|
</OrderInfoWrapper>
|
|
163
165
|
<View style={{ flex: 1 }}>
|
|
164
166
|
<ProgressContentWrapper>
|
|
165
|
-
<ProgressBar style={{ width:
|
|
167
|
+
<ProgressBar style={{ width: progressBarObjt(lastOrder.status)?.percentage ? `${(progressBarObjt(lastOrder.status) as any).percentage * 100}%` : '0%' }} />
|
|
166
168
|
</ProgressContentWrapper>
|
|
167
169
|
<ProgressTextWrapper>
|
|
168
|
-
<OText size={12} style={{ width: '50%' }}>{
|
|
170
|
+
<OText size={12} style={{ width: '50%' }}>{progressBarObjt(lastOrder.status)?.value}</OText>
|
|
169
171
|
<TimeWrapper>
|
|
170
172
|
<OText size={11}>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}</OText>
|
|
171
173
|
<OText size={11}>
|
|
@@ -69,7 +69,11 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
69
69
|
methodPaySupported,
|
|
70
70
|
setPlaceByMethodPay,
|
|
71
71
|
setCardList,
|
|
72
|
-
onPaymentChange
|
|
72
|
+
onPaymentChange,
|
|
73
|
+
requiredFields,
|
|
74
|
+
openUserModal,
|
|
75
|
+
paymethodClicked,
|
|
76
|
+
setPaymethodClicked
|
|
73
77
|
} = props
|
|
74
78
|
|
|
75
79
|
const theme = useTheme();
|
|
@@ -115,6 +119,14 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
115
119
|
|
|
116
120
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
117
121
|
if (cart?.balance > 0) {
|
|
122
|
+
if (paymethod?.gateway === 'paypal' && requiredFields.length > 0) {
|
|
123
|
+
openUserModal && openUserModal(true)
|
|
124
|
+
setPaymethodClicked({
|
|
125
|
+
confirmed: false,
|
|
126
|
+
paymethod
|
|
127
|
+
})
|
|
128
|
+
return
|
|
129
|
+
}
|
|
118
130
|
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
119
131
|
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
120
132
|
handlePaymentMethodClickCustom(paymethod)
|
|
@@ -159,7 +171,14 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
159
171
|
handlePlaceOrder(confirmApplePayPayment)
|
|
160
172
|
}
|
|
161
173
|
}, [paymethodData, paymethodSelected])
|
|
162
|
-
|
|
174
|
+
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (paymethodClicked?.confirmed) {
|
|
177
|
+
handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
|
|
178
|
+
}
|
|
179
|
+
}, [paymethodClicked?.confirmed])
|
|
180
|
+
|
|
181
|
+
|
|
163
182
|
const renderPaymethods = ({ item }: any) => {
|
|
164
183
|
return (
|
|
165
184
|
<>
|
|
@@ -913,12 +913,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
913
913
|
}}>
|
|
914
914
|
{option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
915
915
|
(suboption: any) => {
|
|
916
|
-
const currentState =
|
|
917
|
-
productCart.options[
|
|
918
|
-
`id:${option.id}`
|
|
919
|
-
]?.suboptions[
|
|
920
|
-
`id:${suboption.id}`
|
|
921
|
-
] || {};
|
|
916
|
+
const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
|
|
922
917
|
const balance =
|
|
923
918
|
productCart.options[
|
|
924
919
|
`id:${option.id}`
|
|
@@ -933,6 +928,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
933
928
|
balance={balance}
|
|
934
929
|
option={option}
|
|
935
930
|
suboption={suboption}
|
|
931
|
+
image={suboption.image}
|
|
936
932
|
state={currentState}
|
|
937
933
|
disabled={
|
|
938
934
|
isSoldOut ||
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { useTheme } from 'styled-components/native';
|
|
8
8
|
import { StyleSheet, View } from 'react-native'
|
|
9
9
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
10
|
+
import FastImage from 'react-native-fast-image';
|
|
10
11
|
|
|
11
12
|
import {
|
|
12
13
|
Container,
|
|
@@ -14,7 +15,8 @@ import {
|
|
|
14
15
|
QuantityControl,
|
|
15
16
|
Checkbox,
|
|
16
17
|
PositionControl,
|
|
17
|
-
Circle
|
|
18
|
+
Circle,
|
|
19
|
+
Logo
|
|
18
20
|
} from './styles'
|
|
19
21
|
import { OIcon, OText } from '../shared'
|
|
20
22
|
|
|
@@ -29,7 +31,8 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
29
31
|
toggleSelect,
|
|
30
32
|
changePosition,
|
|
31
33
|
disabled,
|
|
32
|
-
setIsScrollAvailable
|
|
34
|
+
setIsScrollAvailable,
|
|
35
|
+
image
|
|
33
36
|
} = props
|
|
34
37
|
|
|
35
38
|
const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max || state.quantity === suboption?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
|
|
@@ -37,12 +40,24 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
37
40
|
|
|
38
41
|
const theme = useTheme();
|
|
39
42
|
const [, t] = useLanguage()
|
|
40
|
-
const [{ parsePrice }] = useUtils()
|
|
43
|
+
const [{ parsePrice, optimizeImage }] = useUtils()
|
|
41
44
|
const [showMessage, setShowMessage] = useState(false)
|
|
42
45
|
const [isDirty, setIsDirty] = useState(false)
|
|
43
46
|
|
|
44
47
|
const iconsSize = 20
|
|
45
48
|
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
icon: {
|
|
51
|
+
borderRadius: 7.6,
|
|
52
|
+
width: 60,
|
|
53
|
+
height: 60
|
|
54
|
+
},
|
|
55
|
+
logo: {
|
|
56
|
+
borderRadius: 10,
|
|
57
|
+
marginLeft: 3,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
46
61
|
const handleSuboptionClick = () => {
|
|
47
62
|
toggleSelect()
|
|
48
63
|
setIsDirty(true)
|
|
@@ -82,6 +97,18 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
82
97
|
<OIcon src={theme.images.general.radio_nor} color={theme.colors.disabled} width={16} />
|
|
83
98
|
)
|
|
84
99
|
)}
|
|
100
|
+
{image && (
|
|
101
|
+
<Logo style={styles.logo}>
|
|
102
|
+
<FastImage
|
|
103
|
+
style={styles.icon}
|
|
104
|
+
source={{
|
|
105
|
+
uri: optimizeImage(image, 'h_100,c_limit'),
|
|
106
|
+
priority: FastImage.priority.normal,
|
|
107
|
+
}}
|
|
108
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
109
|
+
/>
|
|
110
|
+
</Logo>
|
|
111
|
+
)}
|
|
85
112
|
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} mLeft={5} style={{ flex: 1 }}>
|
|
86
113
|
{suboption?.name}
|
|
87
114
|
</OText>
|
|
@@ -141,7 +168,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
|
|
|
141
168
|
</PositionControl>
|
|
142
169
|
)}
|
|
143
170
|
{price > 0 && (
|
|
144
|
-
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{width: 70, maxWidth: 70}}>
|
|
171
|
+
<OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ width: 70, maxWidth: 70 }}>
|
|
145
172
|
+ {parsePrice(price)}
|
|
146
173
|
</OText>
|
|
147
174
|
)}
|
|
@@ -10,7 +10,7 @@ export const Container = styled.TouchableOpacity`
|
|
|
10
10
|
export const IconControl = styled.TouchableOpacity`
|
|
11
11
|
flex-direction: row;
|
|
12
12
|
padding: 10px 0 10px 10px;
|
|
13
|
-
width:
|
|
13
|
+
width: 50%;
|
|
14
14
|
align-items: center;
|
|
15
15
|
`
|
|
16
16
|
|
|
@@ -32,3 +32,8 @@ export const Checkbox = styled.TouchableOpacity`
|
|
|
32
32
|
export const Circle = styled.TouchableOpacity`
|
|
33
33
|
margin: 0 1.5px;
|
|
34
34
|
`
|
|
35
|
+
|
|
36
|
+
export const Logo = styled.View`
|
|
37
|
+
height: 65px;
|
|
38
|
+
width: 65px;
|
|
39
|
+
`;
|
|
@@ -576,6 +576,119 @@ export const getOrderStatus = (s: string) => {
|
|
|
576
576
|
return objectStatus && objectStatus;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
+
export const getOrderStatuPickUp = (s: any) => {
|
|
580
|
+
const status = parseInt(s);
|
|
581
|
+
const orderStatus = [
|
|
582
|
+
{
|
|
583
|
+
key: 0,
|
|
584
|
+
value: t('PENDING', 'Pending'),
|
|
585
|
+
slug: 'PENDING',
|
|
586
|
+
percentage: 0.1,
|
|
587
|
+
image: theme.images.order.status0,
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
key: 1,
|
|
591
|
+
value: t('COMPLETED', 'Completed'),
|
|
592
|
+
slug: 'COMPLETED',
|
|
593
|
+
percentage: 1,
|
|
594
|
+
image: theme.images.order.status1,
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
key: 2,
|
|
598
|
+
value: t('REJECTED', 'Rejected'),
|
|
599
|
+
slug: 'REJECTED',
|
|
600
|
+
percentage: 0,
|
|
601
|
+
image: theme.images.order.status2,
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
key: 4,
|
|
605
|
+
value: t('PREPARATION_COMPLETED', 'Preparation Completed'),
|
|
606
|
+
slug: 'PREPARATION_COMPLETED',
|
|
607
|
+
percentage: 0.5,
|
|
608
|
+
image: theme.images.order.status4,
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
key: 5,
|
|
612
|
+
value: t('REJECTED_BY_BUSINESS', 'Rejected by business'),
|
|
613
|
+
slug: 'REJECTED_BY_BUSINESS',
|
|
614
|
+
percentage: 0,
|
|
615
|
+
image: theme.images.order.status5,
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
key: 7,
|
|
619
|
+
value: t('ACCEPTED_BY_BUSINESS', 'Accepted by business'),
|
|
620
|
+
slug: 'ACCEPTED_BY_BUSINESS',
|
|
621
|
+
percentage: 0.3,
|
|
622
|
+
image: theme.images.order.status7,
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
key: 13,
|
|
626
|
+
value: t('PREORDER', 'PreOrder'),
|
|
627
|
+
slug: 'PREORDER',
|
|
628
|
+
percentage: 0,
|
|
629
|
+
image: theme.images.order.status13,
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
key: 14,
|
|
633
|
+
value: t('ORDER_NOT_READY', 'Order not ready'),
|
|
634
|
+
slug: 'ORDER_NOT_READY',
|
|
635
|
+
percentage: 0.3,
|
|
636
|
+
image: theme.images.order.status13,
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
key: 15,
|
|
640
|
+
value: t(
|
|
641
|
+
'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
642
|
+
'Order picked up completed by customer',
|
|
643
|
+
),
|
|
644
|
+
slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
|
|
645
|
+
percentage: 1,
|
|
646
|
+
image: theme.images.order.status1,
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
key: 16,
|
|
650
|
+
value: t('CANCELLED_BY_CUSTOMER', 'Cancelled by customer'),
|
|
651
|
+
slug: 'CANCELLED_BY_CUSTOMER',
|
|
652
|
+
percentage: 0,
|
|
653
|
+
image: theme.images.order.status2,
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
key: 17,
|
|
657
|
+
value: t(
|
|
658
|
+
'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
659
|
+
'Order not picked up by customer',
|
|
660
|
+
),
|
|
661
|
+
slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
|
|
662
|
+
percentage: 0,
|
|
663
|
+
image: theme.images.order.status2,
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
key: 20,
|
|
667
|
+
value: t(
|
|
668
|
+
'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
669
|
+
'Customer almost arrived to business',
|
|
670
|
+
),
|
|
671
|
+
slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
672
|
+
percentage: 0.7,
|
|
673
|
+
image: theme.images.order.status7,
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
key: 21,
|
|
677
|
+
value: t(
|
|
678
|
+
'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
679
|
+
'Customer arrived to business',
|
|
680
|
+
),
|
|
681
|
+
slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
682
|
+
percentage: 0.9,
|
|
683
|
+
image: theme.images.order.status7,
|
|
684
|
+
}
|
|
685
|
+
];
|
|
686
|
+
|
|
687
|
+
const objectStatus = orderStatus.find((o) => o.key === status);
|
|
688
|
+
|
|
689
|
+
return objectStatus && objectStatus;
|
|
690
|
+
}
|
|
691
|
+
|
|
579
692
|
/**
|
|
580
693
|
* Function to get brightness of color.
|
|
581
694
|
*/
|