ordering-ui-react-native 0.14.58 → 0.14.61
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/PreviousOrders/index.tsx +55 -23
- package/themes/business/src/components/PreviousOrders/styles.tsx +13 -1
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +12 -10
- package/themes/kiosk/src/components/ProductForm/index.tsx +3 -2
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +4 -4
- package/themes/original/src/components/MomentOption/index.tsx +4 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +9 -2
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserProfile/index.tsx +1 -1
- package/themes/original/src/components/Wallets/index.tsx +11 -5
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
|
+
import moment from 'moment'
|
|
4
5
|
import { useLanguage, useUtils } from 'ordering-components/native';
|
|
5
6
|
import { OButton, OIcon, OText } from '../shared';
|
|
6
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
|
|
9
|
+
} from './styles';
|
|
7
10
|
import EntypoIcon from 'react-native-vector-icons/Entypo'
|
|
8
11
|
|
|
9
12
|
export const PreviousOrders = (props: any) => {
|
|
@@ -18,6 +21,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
18
21
|
const [, t] = useLanguage();
|
|
19
22
|
const [{ parseDate, optimizeImage }] = useUtils();
|
|
20
23
|
const theme = useTheme();
|
|
24
|
+
const [currentTime, setCurrentTime] = useState()
|
|
21
25
|
|
|
22
26
|
const handlePressOrder = (order: any) => {
|
|
23
27
|
if (order?.locked && isLogisticOrder) return
|
|
@@ -39,17 +43,15 @@ export const PreviousOrders = (props: any) => {
|
|
|
39
43
|
height: 75,
|
|
40
44
|
},
|
|
41
45
|
logo: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
borderRadius: 25,
|
|
45
|
-
shadowColor: 'rgba(0.0, 0.0, 0.0, 0.5)',
|
|
46
|
+
borderRadius: 10,
|
|
47
|
+
shadowColor: "#000",
|
|
46
48
|
shadowOffset: {
|
|
47
49
|
width: 0,
|
|
48
|
-
height: 1
|
|
50
|
+
height: 1,
|
|
49
51
|
},
|
|
50
|
-
shadowOpacity: 0.
|
|
51
|
-
shadowRadius:
|
|
52
|
-
elevation:
|
|
52
|
+
shadowOpacity: 0.20,
|
|
53
|
+
shadowRadius: 1.41,
|
|
54
|
+
elevation: 2,
|
|
53
55
|
justifyContent: 'center',
|
|
54
56
|
alignItems: 'center',
|
|
55
57
|
marginLeft: 3,
|
|
@@ -67,11 +69,10 @@ export const PreviousOrders = (props: any) => {
|
|
|
67
69
|
fontFamily: 'Poppins',
|
|
68
70
|
fontStyle: 'normal',
|
|
69
71
|
fontWeight: 'normal',
|
|
70
|
-
fontSize:
|
|
71
|
-
color: theme.colors.unselectText,
|
|
72
|
+
fontSize: 12,
|
|
72
73
|
},
|
|
73
74
|
orderType: {
|
|
74
|
-
fontSize:
|
|
75
|
+
fontSize: 12,
|
|
75
76
|
fontFamily: 'Poppins',
|
|
76
77
|
fontStyle: 'normal',
|
|
77
78
|
fontWeight: 'normal',
|
|
@@ -79,6 +80,32 @@ export const PreviousOrders = (props: any) => {
|
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
82
|
|
|
83
|
+
const getDelayTime = (order: any) => {
|
|
84
|
+
// targetMin = delivery_datetime + eta_time - now()
|
|
85
|
+
const _delivery = order?.delivery_datetime_utc
|
|
86
|
+
const _eta = order?.eta_time
|
|
87
|
+
const tagetedMin = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
|
|
88
|
+
let day = Math.floor(tagetedMin / 1440)
|
|
89
|
+
const restMinOfTargetedMin = tagetedMin - 1440 * day
|
|
90
|
+
let restHours: any = Math.floor(restMinOfTargetedMin / 60)
|
|
91
|
+
let restMins: any = restMinOfTargetedMin - 60 * restHours
|
|
92
|
+
|
|
93
|
+
if (order?.time_status === 'in_time' || order?.time_status === 'at_risk') day = Math.abs(day)
|
|
94
|
+
if (restHours < 10) restHours = ('0' + restHours)
|
|
95
|
+
if (restMins < 10) restMins = ('0' + restMins)
|
|
96
|
+
const finalTaget = day + 'day ' + restHours + ':' + restMins
|
|
97
|
+
return finalTaget
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const interval = setInterval(() => {
|
|
102
|
+
const date:any = Date.now()
|
|
103
|
+
setCurrentTime(date)
|
|
104
|
+
}, 60000)
|
|
105
|
+
|
|
106
|
+
return () => clearInterval(interval)
|
|
107
|
+
}, [])
|
|
108
|
+
|
|
82
109
|
let hash: any = {};
|
|
83
110
|
|
|
84
111
|
return (
|
|
@@ -103,6 +130,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
103
130
|
activeOpacity={1}
|
|
104
131
|
>
|
|
105
132
|
<Card key={order.id}>
|
|
133
|
+
<Timestatus style={{backgroundColor: order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' }}/>
|
|
106
134
|
{
|
|
107
135
|
order.business?.logo && (
|
|
108
136
|
<Logo style={styles.logo}>
|
|
@@ -135,16 +163,20 @@ export const PreviousOrders = (props: any) => {
|
|
|
135
163
|
/>
|
|
136
164
|
</NotificationIcon>
|
|
137
165
|
)}
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
?
|
|
146
|
-
|
|
147
|
-
|
|
166
|
+
<View style={{flexDirection: 'row'}}>
|
|
167
|
+
<OText
|
|
168
|
+
style={styles.date}
|
|
169
|
+
color={theme.colors.unselectText}
|
|
170
|
+
numberOfLines={1}
|
|
171
|
+
adjustsFontSizeToFit
|
|
172
|
+
>
|
|
173
|
+
{(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('NO', 'Order No.') + order.id)) + ' · '}
|
|
174
|
+
{order?.delivery_datetime_utc
|
|
175
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
|
|
176
|
+
: parseDate(order?.delivery_datetime, { utc: false })}{' · '}
|
|
177
|
+
</OText>
|
|
178
|
+
<OText style={styles.date} color={order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' } >{getDelayTime(order)}</OText>
|
|
179
|
+
</View>
|
|
148
180
|
{!isLogisticOrder && (
|
|
149
181
|
<MyOrderOptions>
|
|
150
182
|
<OText
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const Card = styled.View`
|
|
4
4
|
flex: 1;
|
|
@@ -35,4 +35,16 @@ export const AcceptOrRejectOrder = styled.View`
|
|
|
35
35
|
justify-content: space-between;
|
|
36
36
|
flex: 1;
|
|
37
37
|
margin: 10px;
|
|
38
|
+
`
|
|
39
|
+
export const Timestatus = styled.View`
|
|
40
|
+
position: relative;;
|
|
41
|
+
width: 4px;
|
|
42
|
+
height: 65px;
|
|
43
|
+
border-radius: 20px;
|
|
44
|
+
top: 5px;
|
|
45
|
+
margin-right: 5px;
|
|
46
|
+
${(props: any) => props.theme?.rtl && css`
|
|
47
|
+
left: unset;
|
|
48
|
+
right: -5px;
|
|
49
|
+
`}
|
|
38
50
|
`
|
|
@@ -15,6 +15,8 @@ import { Container } from '../../layouts/Container'
|
|
|
15
15
|
import NavBar from '../NavBar'
|
|
16
16
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
|
|
17
17
|
import GridContainer from '../../layouts/GridContainer'
|
|
18
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
19
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
18
20
|
|
|
19
21
|
const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
20
22
|
const {
|
|
@@ -27,7 +29,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
27
29
|
callback
|
|
28
30
|
} = props
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
const theme = useTheme();
|
|
31
33
|
const [, t] = useLanguage();
|
|
32
34
|
const [orientationState] = useDeviceOrientation();
|
|
33
35
|
const [orderState] = useOrder()
|
|
@@ -45,7 +47,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
useEffect(() => {
|
|
48
|
-
if(isCardCliked){
|
|
50
|
+
if (isCardCliked) {
|
|
49
51
|
callback?.()
|
|
50
52
|
setIsCardClicked(false)
|
|
51
53
|
setIsLoadingCard(null)
|
|
@@ -57,8 +59,8 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
57
59
|
<Container>
|
|
58
60
|
<NavBar
|
|
59
61
|
title={t('ORDER_TYPE_X_ID', 'Order type')}
|
|
60
|
-
{...(goBack && { onActionLeft: goBack }
|
|
61
|
-
btnStyle={{paddingLeft: 0}}
|
|
62
|
+
{...(goBack && { onActionLeft: goBack })}
|
|
63
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
62
64
|
/>
|
|
63
65
|
|
|
64
66
|
<View style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
|
|
@@ -83,13 +85,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
83
85
|
style={cardStyle}
|
|
84
86
|
isDisabled={isCardCliked}
|
|
85
87
|
isLoading={isLoadingCard === 'Eat In'}
|
|
86
|
-
title={t('EAT_IN','Eat In')}
|
|
88
|
+
title={t('EAT_IN', 'Eat In')}
|
|
87
89
|
description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
|
|
88
90
|
bgImage={theme.images.general.eatIn}
|
|
89
|
-
|
|
91
|
+
VectorIcon={() => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />}
|
|
90
92
|
callToActionText={t('START_MY_ORDER', 'Start my order')}
|
|
91
93
|
onClick={() => {
|
|
92
|
-
if(_eatIn?.value !== orderState?.options?.type){
|
|
94
|
+
if (_eatIn?.value !== orderState?.options?.type) {
|
|
93
95
|
handleChangeOrderType(_eatIn?.value);
|
|
94
96
|
setIsCardClicked(true)
|
|
95
97
|
setIsLoadingCard('Eat In')
|
|
@@ -106,15 +108,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
|
|
|
106
108
|
|
|
107
109
|
<OptionCard
|
|
108
110
|
style={cardStyle}
|
|
109
|
-
title={t('TAKE_OUT','Take out')}
|
|
111
|
+
title={t('TAKE_OUT', 'Take out')}
|
|
110
112
|
isDisabled={isCardCliked}
|
|
111
113
|
isLoading={isLoadingCard === 'Take out'}
|
|
112
114
|
description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
|
|
113
115
|
bgImage={theme.images.general.takeOut}
|
|
114
|
-
|
|
116
|
+
VectorIcon={() => <AntDesignIcon name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />}
|
|
115
117
|
callToActionText={t('START_MY_ORDER', 'Start my order')}
|
|
116
118
|
onClick={() => {
|
|
117
|
-
if(_takeOut?.value !== orderState?.options?.type){
|
|
119
|
+
if (_takeOut?.value !== orderState?.options?.type) {
|
|
118
120
|
handleChangeOrderType(_takeOut?.value);
|
|
119
121
|
setIsCardClicked(true)
|
|
120
122
|
setIsLoadingCard('Take out')
|
|
@@ -246,8 +246,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
246
246
|
{...navBarProps}
|
|
247
247
|
titleColor={theme.colors.white}
|
|
248
248
|
btnStyle={{
|
|
249
|
-
width:
|
|
250
|
-
height:
|
|
249
|
+
width: 55,
|
|
250
|
+
height: 55,
|
|
251
|
+
overflow: 'scroll',
|
|
251
252
|
backgroundColor: 'black',
|
|
252
253
|
borderRadius: 100,
|
|
253
254
|
color: 'white',
|
|
@@ -125,7 +125,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
125
125
|
{product.name}
|
|
126
126
|
</OText>
|
|
127
127
|
|
|
128
|
-
{product?.price && (
|
|
128
|
+
{!!product?.price && (
|
|
129
129
|
<OText>
|
|
130
130
|
<OText
|
|
131
131
|
color={theme.colors.primary}
|
|
@@ -200,7 +200,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
200
200
|
{product.name}
|
|
201
201
|
</OText>
|
|
202
202
|
|
|
203
|
-
{product?.price && (
|
|
203
|
+
{!!product?.price && (
|
|
204
204
|
<OText>
|
|
205
205
|
<OText
|
|
206
206
|
color={theme.colors.primary}
|
|
@@ -127,7 +127,7 @@ const CheckoutUI = (props: any) => {
|
|
|
127
127
|
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
128
128
|
const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
|
|
129
129
|
|
|
130
|
-
const isWalletEnabled = configs?.wallet_enabled?.value === '1'
|
|
130
|
+
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
131
131
|
|
|
132
132
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
133
133
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -569,7 +569,7 @@ const CheckoutUI = (props: any) => {
|
|
|
569
569
|
</OText>
|
|
570
570
|
)}
|
|
571
571
|
|
|
572
|
-
{!paymethodSelected && cart?.status !== 2 && cart?.valid && (
|
|
572
|
+
{(!paymethodSelected && cart?.balance > 0) && cart?.status !== 2 && cart?.valid && (
|
|
573
573
|
<OText
|
|
574
574
|
color={theme.colors.error}
|
|
575
575
|
size={12}
|
|
@@ -605,8 +605,8 @@ const CheckoutUI = (props: any) => {
|
|
|
605
605
|
{!cartState.loading && cart && cart?.status !== 2 && (
|
|
606
606
|
<FloatingButton
|
|
607
607
|
handleClick={() => handlePlaceOrder()}
|
|
608
|
-
isSecondaryBtn={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal < cart?.minimum}
|
|
609
|
-
disabled={loading || !cart?.valid || !paymethodSelected || placing || errorCash || cart?.subtotal < cart?.minimum}
|
|
608
|
+
isSecondaryBtn={loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum}
|
|
609
|
+
disabled={loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum}
|
|
610
610
|
btnText={cart?.subtotal >= cart?.minimum
|
|
611
611
|
? (
|
|
612
612
|
placing
|
|
@@ -350,7 +350,11 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
350
350
|
</OrderTimeWrapper>
|
|
351
351
|
)}
|
|
352
352
|
</View>
|
|
353
|
+
<Spinner visible={momentState.isLoading === 1} />
|
|
353
354
|
</Container>
|
|
355
|
+
<View style={{ position: 'absolute', bottom: bottom, paddingBottom: 20, paddingHorizontal: 40, backgroundColor: 'white', width: '100%' }}>
|
|
356
|
+
<OButton onClick={handleChangeMoment} isDisabled={!selectedTime} text={t('CONTINUE', 'Continue')} style={{ borderRadius: 7.6, height: 44, shadowOpacity: 0 }} textStyle={{ color: 'white', fontSize: 14 }} showNextIcon />
|
|
357
|
+
</View>
|
|
354
358
|
</>
|
|
355
359
|
);
|
|
356
360
|
};
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
PaymentOptionWallet as PaymentOptionWalletController,
|
|
8
8
|
useLanguage,
|
|
9
9
|
useUtils,
|
|
10
|
-
useOrder
|
|
10
|
+
useOrder,
|
|
11
|
+
useConfig
|
|
11
12
|
} from 'ordering-components/native'
|
|
12
13
|
|
|
13
14
|
import {
|
|
@@ -27,11 +28,15 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
27
28
|
|
|
28
29
|
const theme = useTheme()
|
|
29
30
|
const [, t] = useLanguage()
|
|
31
|
+
const [{ configs }] = useConfig()
|
|
30
32
|
const [{ carts }] = useOrder()
|
|
31
33
|
const [{ parsePrice }] = useUtils()
|
|
32
34
|
|
|
33
35
|
const cart = carts?.[`businessId:${businessId}`] ?? {}
|
|
34
36
|
|
|
37
|
+
const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
|
|
38
|
+
const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
|
|
39
|
+
|
|
35
40
|
const styles = StyleSheet.create({
|
|
36
41
|
checkBoxStyle: {
|
|
37
42
|
width: 25,
|
|
@@ -48,9 +53,11 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
48
53
|
const walletName: any = {
|
|
49
54
|
cash: {
|
|
50
55
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
|
|
56
|
+
isActive: isWalletCashEnabled
|
|
51
57
|
},
|
|
52
58
|
credit_point: {
|
|
53
59
|
name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
|
|
60
|
+
isActive: isWalletPointsEnabled
|
|
54
61
|
}
|
|
55
62
|
}
|
|
56
63
|
|
|
@@ -85,7 +92,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
85
92
|
walletsState.result?.length > 0 &&
|
|
86
93
|
(
|
|
87
94
|
<>
|
|
88
|
-
{walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && (
|
|
95
|
+
{walletsState.result?.map((wallet: any, idx: any) => wallet.valid && wallet.balance >= 0 && walletName[wallet.type]?.isActive && (
|
|
89
96
|
<Container
|
|
90
97
|
key={wallet.id}
|
|
91
98
|
isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
|
|
@@ -159,12 +159,6 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
159
159
|
</TopActions>
|
|
160
160
|
</TopBar>
|
|
161
161
|
<ScrollView style={{ marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
|
|
162
|
-
{productsList.length > 0 &&
|
|
163
|
-
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
164
|
-
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
165
|
-
<UpsellingLayout />
|
|
166
|
-
</View>
|
|
167
|
-
}
|
|
168
162
|
<View style={{ paddingHorizontal: 40 }}>
|
|
169
163
|
<OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
|
|
170
164
|
<OrderSummary
|
|
@@ -173,6 +167,12 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
|
|
|
173
167
|
onNavigationRedirect={onNavigationRedirect}
|
|
174
168
|
/>
|
|
175
169
|
</View>
|
|
170
|
+
{productsList.length > 0 &&
|
|
171
|
+
<View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
|
|
172
|
+
<OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
|
|
173
|
+
<UpsellingLayout />
|
|
174
|
+
</View>
|
|
175
|
+
}
|
|
176
176
|
</ScrollView>
|
|
177
177
|
<View
|
|
178
178
|
style={{
|
|
@@ -99,7 +99,7 @@ const ProfileListUI = (props: ProfileParams) => {
|
|
|
99
99
|
const { height } = useWindowDimensions();
|
|
100
100
|
const { top, bottom } = useSafeAreaInsets();
|
|
101
101
|
|
|
102
|
-
const isWalletEnabled = configs?.wallet_enabled?.value === '1'
|
|
102
|
+
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
|
|
103
103
|
|
|
104
104
|
const onRedirect = (route: string, params?: any) => {
|
|
105
105
|
navigation.navigate(route, params)
|
|
@@ -35,19 +35,25 @@ const WalletsUI = (props: any) => {
|
|
|
35
35
|
const theme = useTheme()
|
|
36
36
|
const [{ parsePrice, parseDate }] = useUtils()
|
|
37
37
|
const [{ configs }] = useConfig()
|
|
38
|
+
const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
|
|
39
|
+
const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
|
|
38
40
|
|
|
39
|
-
const [tabSelected, setTabSelected] = useState('cash')
|
|
41
|
+
const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
|
|
42
|
+
|
|
43
|
+
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
|
|
40
44
|
|
|
41
45
|
const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
|
|
42
46
|
|
|
43
47
|
const walletName: any = {
|
|
44
48
|
cash: {
|
|
45
49
|
name: t('CASH_WALLET', 'Cash Wallet'),
|
|
46
|
-
value: 0
|
|
50
|
+
value: 0,
|
|
51
|
+
isActive: isWalletCashEnabled
|
|
47
52
|
},
|
|
48
53
|
credit_point: {
|
|
49
54
|
name: t('CREDITS_POINTS_WALLET', 'Credit Points Wallet'),
|
|
50
|
-
value: 1
|
|
55
|
+
value: 1,
|
|
56
|
+
isActive: isWalletPointsEnabled
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
|
|
@@ -61,7 +67,7 @@ const WalletsUI = (props: any) => {
|
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
useEffect(() => {
|
|
64
|
-
if (
|
|
70
|
+
if (!isWalletEnabled) {
|
|
65
71
|
navigation.navigate('BottomTab', {
|
|
66
72
|
screen: 'Profile'
|
|
67
73
|
})
|
|
@@ -85,7 +91,7 @@ const WalletsUI = (props: any) => {
|
|
|
85
91
|
(
|
|
86
92
|
<>
|
|
87
93
|
<OTabs>
|
|
88
|
-
{walletList.wallets?.map((wallet: any) =>(
|
|
94
|
+
{walletList.wallets?.map((wallet: any) => walletName[wallet.type]?.isActive && (
|
|
89
95
|
<Pressable
|
|
90
96
|
key={wallet.id}
|
|
91
97
|
onPress={() => handleChangeTab(wallet)}
|