ordering-ui-react-native 0.12.51 → 0.12.55
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/GoogleMap/index.tsx +78 -4
- package/themes/business/src/components/OrderDetails/Business.tsx +11 -3
- package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -101
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +57 -48
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +7 -7
- package/themes/business/src/components/OrderDetails/styles.tsx +11 -2
- package/themes/business/src/components/OrdersOption/index.tsx +5 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +41 -26
- package/themes/single-business/src/components/Cart/index.tsx +1 -1
- package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
- package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
- package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
- package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
- package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
|
@@ -187,7 +187,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
187
187
|
};
|
|
188
188
|
|
|
189
189
|
const getOrderStatus = (key: number) => {
|
|
190
|
-
return orderStatus.find((status: any) => status
|
|
190
|
+
return orderStatus.find((status: any) => status?.key === key)?.text;
|
|
191
191
|
};
|
|
192
192
|
|
|
193
193
|
const applyFilters = () => {
|
|
@@ -454,7 +454,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
454
454
|
currentTabSelected !== 'logisticOrders' &&
|
|
455
455
|
(
|
|
456
456
|
<PreviousOrders
|
|
457
|
-
orders={currentOrdersGroup
|
|
457
|
+
orders={currentOrdersGroup?.orders}
|
|
458
458
|
onNavigationRedirect={onNavigationRedirect}
|
|
459
459
|
getOrderStatus={getOrderStatus}
|
|
460
460
|
handleClickOrder={handleClickOrder}
|
|
@@ -464,7 +464,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
464
464
|
logisticOrders?.orders?.length > 0 &&
|
|
465
465
|
currentTabSelected === 'logisticOrders' && (
|
|
466
466
|
<PreviousOrders
|
|
467
|
-
orders={logisticOrders
|
|
467
|
+
orders={logisticOrders?.orders?.filter((order: any) => !order?.expired).map((order: any) => ({ ...order, isLogistic: true }))}
|
|
468
468
|
onNavigationRedirect={onNavigationRedirect}
|
|
469
469
|
getOrderStatus={getOrderStatus}
|
|
470
470
|
handleClickLogisticOrder={handleClickLogisticOrder}
|
|
@@ -528,13 +528,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
528
528
|
(currentOrdersGroup?.error?.length ||
|
|
529
529
|
currentOrdersGroup?.orders?.length === 0)) ||
|
|
530
530
|
(currentTabSelected === 'logisticOrders' &&
|
|
531
|
-
(logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0))
|
|
531
|
+
(logisticOrders?.error?.length > 0 || logisticOrders?.orders?.length === 0 || !logisticOrders?.orders?.some(order => !order?.expired)))
|
|
532
532
|
) &&
|
|
533
533
|
(
|
|
534
534
|
<NotFoundSource
|
|
535
535
|
content={
|
|
536
536
|
((currentTabSelected !== 'logisticOrders' && !currentOrdersGroup?.error?.length) ||
|
|
537
|
-
(currentTabSelected === 'logisticOrders' && !logisticOrders?.error?.length))
|
|
537
|
+
(currentTabSelected === 'logisticOrders' && (!logisticOrders?.error?.length || (logisticOrders?.orders?.length > 0 && !logisticOrders?.orders?.some(order => !order?.expired)))))
|
|
538
538
|
? t('NO_RESULTS_FOUND', 'Sorry, no results found')
|
|
539
539
|
: currentOrdersGroup?.error?.[0]?.message ||
|
|
540
540
|
currentOrdersGroup?.error?.[0] ||
|
|
@@ -85,9 +85,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
85
85
|
<>
|
|
86
86
|
{orders && orders?.length > 0 &&
|
|
87
87
|
orders
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const order = _order?.isLogistic && !_order?.order_group ? _order?.order : _order
|
|
88
|
+
?.filter((order: any) => hash[order?.id] ? false : (hash[order?.id] = true))
|
|
89
|
+
?.map((_order: any) => {
|
|
90
|
+
const order = _order?.isLogistic && !_order?.order_group && isLogisticOrder ? _order?.order : _order
|
|
91
91
|
return (
|
|
92
92
|
<View
|
|
93
93
|
style={{
|
|
@@ -116,9 +116,9 @@ export const PreviousOrders = (props: any) => {
|
|
|
116
116
|
</Logo>
|
|
117
117
|
)}
|
|
118
118
|
<Information>
|
|
119
|
-
{order?.
|
|
119
|
+
{order?.order_group_id && (
|
|
120
120
|
<OText>
|
|
121
|
-
<OText>{
|
|
121
|
+
<OText>{(t('INVOICE_GROUP_NO', 'Group No.') + order?.order_group_id)}</OText>
|
|
122
122
|
</OText>
|
|
123
123
|
)}
|
|
124
124
|
{order.business?.name && (
|
|
@@ -140,7 +140,7 @@ export const PreviousOrders = (props: any) => {
|
|
|
140
140
|
numberOfLines={1}
|
|
141
141
|
adjustsFontSizeToFit
|
|
142
142
|
size={20}>
|
|
143
|
-
{(order?.
|
|
143
|
+
{(order?.order_group_id && order?.order_group && isLogisticOrder ? `${order?.order_group?.orders?.length} ${t('ORDERS', 'Orders')}` : (t('INVOICE_ORDER_NO', 'Order No.') + order.id)) + ' · '}
|
|
144
144
|
{order?.delivery_datetime_utc
|
|
145
145
|
? parseDate(order?.delivery_datetime_utc)
|
|
146
146
|
: parseDate(order?.delivery_datetime, { utc: false })}
|
|
@@ -171,26 +171,41 @@ export const PreviousOrders = (props: any) => {
|
|
|
171
171
|
</TouchableOpacity>
|
|
172
172
|
{isLogisticOrder && (
|
|
173
173
|
<AcceptOrRejectOrder>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
174
|
+
{order?.order_group_id && order?.order_group ? (
|
|
175
|
+
<OButton
|
|
176
|
+
text={t('VIEW_ORDER', 'View order')}
|
|
177
|
+
onClick={() => handlePressOrder({ ...order, logistic_order_id: _order?.id })}
|
|
178
|
+
bgColor={theme.colors.blueLight}
|
|
179
|
+
borderColor={theme.colors.blueLight}
|
|
180
|
+
imgRightSrc={null}
|
|
181
|
+
style={{ borderRadius: 7, height: 40 }}
|
|
182
|
+
parentStyle={{ width: '100%' }}
|
|
183
|
+
textStyle={{ color: theme.colors.primary }}
|
|
184
|
+
/>
|
|
185
|
+
) : (
|
|
186
|
+
<>
|
|
187
|
+
<OButton
|
|
188
|
+
text={t('REJECT', 'Reject')}
|
|
189
|
+
onClick={() => handleClickLogisticOrder(2, _order?.id)}
|
|
190
|
+
bgColor={theme.colors.danger}
|
|
191
|
+
borderColor={theme.colors.danger}
|
|
192
|
+
imgRightSrc={null}
|
|
193
|
+
style={{ borderRadius: 7, height: 40 }}
|
|
194
|
+
parentStyle={{ width: '45%' }}
|
|
195
|
+
textStyle={{ color: theme.colors.dangerText }}
|
|
196
|
+
/>
|
|
197
|
+
<OButton
|
|
198
|
+
text={t('ACCEPT', 'Accept')}
|
|
199
|
+
onClick={() => handleClickLogisticOrder(1, _order?.id)}
|
|
200
|
+
bgColor={theme.colors.successOrder}
|
|
201
|
+
borderColor={theme.colors.successOrder}
|
|
202
|
+
imgRightSrc={null}
|
|
203
|
+
style={{ borderRadius: 7, height: 40 }}
|
|
204
|
+
parentStyle={{ width: '45%' }}
|
|
205
|
+
textStyle={{ color: theme.colors.successText }}
|
|
206
|
+
/>
|
|
207
|
+
</>
|
|
208
|
+
)}
|
|
194
209
|
</AcceptOrRejectOrder>
|
|
195
210
|
)}
|
|
196
211
|
</View>
|
|
@@ -339,7 +339,7 @@ const CartUI = (props: any) => {
|
|
|
339
339
|
onClose={() => setOpenTaxModal({ open: false, data: null })}
|
|
340
340
|
entireModal
|
|
341
341
|
>
|
|
342
|
-
<TaxInformation data={openTaxModal.data} products={cart
|
|
342
|
+
<TaxInformation data={openTaxModal.data} products={cart?.products} />
|
|
343
343
|
</OModal>
|
|
344
344
|
</Container>
|
|
345
345
|
)
|
|
@@ -1,127 +1,118 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import PhoneInput from "react-native-phone-number-input";
|
|
3
|
-
import { StyleSheet
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
4
|
import { useLanguage, useConfig } from 'ordering-components/native';
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import { Wrapper } from './styles'
|
|
7
7
|
|
|
8
8
|
import { PhoneInputParams } from '../../types';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { OText } from '../shared';
|
|
10
|
+
import {transformCountryCode} from '../../utils'
|
|
11
|
+
import {I18nManager} from 'react-native'
|
|
12
|
+
import { useTheme } from 'styled-components/native';
|
|
11
13
|
|
|
12
14
|
export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
inputStyle,
|
|
22
|
-
textStyle,
|
|
23
|
-
flagStyle,
|
|
24
|
-
noDropIcon
|
|
25
|
-
} = props
|
|
26
|
-
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
|
|
15
|
+
const {
|
|
16
|
+
data,
|
|
17
|
+
handleData,
|
|
18
|
+
defaultValue,
|
|
19
|
+
defaultCode,
|
|
20
|
+
forwardRef,
|
|
21
|
+
textInputProps
|
|
22
|
+
} = props
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
input: {
|
|
32
|
-
backgroundColor: theme.colors.white,
|
|
33
|
-
borderRadius: 7.6,
|
|
34
|
-
borderWidth: 1,
|
|
35
|
-
borderColor: theme.colors.border,
|
|
36
|
-
paddingBottom: 0,
|
|
37
|
-
paddingTop: 0,
|
|
38
|
-
flexGrow: 1,
|
|
39
|
-
flex: 1,
|
|
40
|
-
height: 50,
|
|
41
|
-
},
|
|
42
|
-
countryBtn: {
|
|
43
|
-
borderWidth: 1,
|
|
44
|
-
borderColor: theme.colors.border,
|
|
45
|
-
borderRadius: 7.6,
|
|
46
|
-
marginEnd: 9,
|
|
47
|
-
}
|
|
48
|
-
})
|
|
24
|
+
const theme = useTheme();
|
|
49
25
|
|
|
26
|
+
const style = StyleSheet.create({
|
|
27
|
+
input: {
|
|
28
|
+
backgroundColor: theme.colors.white,
|
|
29
|
+
borderRadius: 8,
|
|
30
|
+
borderWidth: 1,
|
|
31
|
+
borderColor: theme.colors.border,
|
|
32
|
+
paddingVertical: 0,
|
|
33
|
+
flexGrow: 1,
|
|
34
|
+
flex: 1,
|
|
35
|
+
height: 50,
|
|
36
|
+
},
|
|
37
|
+
countryBtn: {
|
|
38
|
+
borderWidth: 1,
|
|
39
|
+
borderColor: theme.colors.border,
|
|
40
|
+
borderRadius: 8,
|
|
41
|
+
marginEnd: 9,
|
|
42
|
+
}
|
|
43
|
+
})
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
const [, t] = useLanguage()
|
|
46
|
+
const [{ configs }] = useConfig()
|
|
47
|
+
const phoneInput = useRef<PhoneInput>(null);
|
|
48
|
+
const [userphoneNumber, setUserphoneNumber] = useState('');
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
const handleChangeNumber = (number: any) => {
|
|
51
|
+
setUserphoneNumber(number)
|
|
52
|
+
}
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if((defaultValue && userphoneNumber) || !defaultValue){
|
|
56
|
+
if (userphoneNumber === '') return;
|
|
57
|
+
if (userphoneNumber) {
|
|
58
|
+
const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
|
|
59
|
+
const callingCode = phoneInput.current?.getCallingCode();
|
|
60
|
+
const formattedNumber = phoneInput.current?.getNumberAfterPossiblyEliminatingZero();
|
|
61
|
+
const regex = /^[0-9]*$/
|
|
62
|
+
const cellphone = userphoneNumber.slice(0, 0) + userphoneNumber.slice(1, userphoneNumber.length)
|
|
63
|
+
const validNumber = regex.test(cellphone)
|
|
64
|
+
if ((!checkValid && formattedNumber?.number) || !validNumber) {
|
|
65
|
+
handleData && handleData({
|
|
66
|
+
...data,
|
|
67
|
+
error: t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid')
|
|
68
|
+
})
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
handleData && handleData({
|
|
72
|
+
...data,
|
|
73
|
+
error: '',
|
|
74
|
+
phone: {
|
|
75
|
+
country_phone_code: callingCode,
|
|
76
|
+
cellphone: formattedNumber?.number
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
} else {
|
|
80
|
+
handleData && handleData({
|
|
81
|
+
...data,
|
|
82
|
+
error: '',
|
|
83
|
+
phone: {
|
|
84
|
+
country_phone_code: null,
|
|
85
|
+
cellphone: null
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, [userphoneNumber])
|
|
96
91
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
</OText>
|
|
124
|
-
)}
|
|
125
|
-
</Wrapper>
|
|
126
|
-
)
|
|
92
|
+
return (
|
|
93
|
+
<Wrapper>
|
|
94
|
+
<PhoneInput
|
|
95
|
+
ref={phoneInput}
|
|
96
|
+
defaultValue={userphoneNumber || defaultValue}
|
|
97
|
+
defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
|
|
98
|
+
onChangeFormattedText={(text : string) => handleChangeNumber(text)}
|
|
99
|
+
withDarkTheme
|
|
100
|
+
textInputStyle={{textAlign: I18nManager.isRTL ? 'right' : 'left'}}
|
|
101
|
+
countryPickerProps={{withAlphaFilter:true}}
|
|
102
|
+
textContainerStyle={style.input}
|
|
103
|
+
placeholder={t('PHONE_NUMBER', 'Phone Number')}
|
|
104
|
+
countryPickerButtonStyle={{ ...style.countryBtn }}
|
|
105
|
+
textInputProps={{autoCompleteType: 'tel', ref: forwardRef, ...textInputProps}}
|
|
106
|
+
/>
|
|
107
|
+
{!!data?.error && (
|
|
108
|
+
<OText
|
|
109
|
+
size={16}
|
|
110
|
+
color={theme.colors.error}
|
|
111
|
+
style={{ textAlign: 'center', marginTop: 5 }}
|
|
112
|
+
>
|
|
113
|
+
{data.error}
|
|
114
|
+
</OText>
|
|
115
|
+
)}
|
|
116
|
+
</Wrapper>
|
|
117
|
+
)
|
|
127
118
|
}
|
|
@@ -1,134 +1,130 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import { TouchableOpacity, View } from 'react-native';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
3
2
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
4
3
|
|
|
5
|
-
import { UDContainer, UDHeader,
|
|
4
|
+
import { UDContainer, UDHeader, UDInfo, } from './styles';
|
|
6
5
|
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
UserFormDetails as UserFormController,
|
|
8
|
+
useLanguage,
|
|
9
|
+
useSession
|
|
11
10
|
} from 'ordering-components/native';
|
|
12
|
-
|
|
13
|
-
import {
|
|
11
|
+
|
|
12
|
+
import { OText } from '../shared';
|
|
14
13
|
|
|
15
14
|
import { UserFormDetailsUI } from '../UserFormDetails';
|
|
16
15
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
16
|
+
import { useTheme } from 'styled-components/native';
|
|
17
17
|
|
|
18
18
|
const UserDetailsUI = (props: any) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const theme = useTheme();
|
|
19
|
+
const {
|
|
20
|
+
isEdit,
|
|
21
|
+
formState,
|
|
22
|
+
cleanFormState,
|
|
23
|
+
cartStatus,
|
|
24
|
+
toggleIsEdit,
|
|
25
|
+
validationFields,
|
|
26
|
+
isUserDetailsEdit,
|
|
27
|
+
phoneUpdate,
|
|
28
|
+
togglePhoneUpdate,
|
|
29
|
+
isCheckout
|
|
30
|
+
} = props
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
const [, t] = useLanguage()
|
|
34
|
+
const [{ user }] = useSession()
|
|
35
|
+
const userData = props.userData || (!formState.result.error && formState.result?.result) || user
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (isUserDetailsEdit) {
|
|
40
|
+
!isEdit && toggleIsEdit()
|
|
41
|
+
}
|
|
42
|
+
}, [isUserDetailsEdit])
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const toggleEditState = () => {
|
|
45
|
+
toggleIsEdit()
|
|
46
|
+
cleanFormState({ changes: {} })
|
|
47
|
+
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (user?.cellphone && !user?.country_phone_code) {
|
|
51
|
+
togglePhoneUpdate(true)
|
|
52
|
+
} else {
|
|
53
|
+
togglePhoneUpdate(false)
|
|
54
|
+
}
|
|
55
|
+
}, [user?.country_phone_code])
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
{(validationFields.loading || formState.loading) && (
|
|
60
|
+
<Placeholder Animation={Fade}>
|
|
61
|
+
<PlaceholderLine height={20} width={70} />
|
|
62
|
+
<PlaceholderLine height={15} width={60} />
|
|
63
|
+
<PlaceholderLine height={15} width={60} />
|
|
64
|
+
<PlaceholderLine height={15} width={80} style={{ marginBottom: 20 }} />
|
|
65
|
+
</Placeholder>
|
|
66
|
+
)}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</EditBtn>
|
|
95
|
-
)
|
|
96
|
-
)}
|
|
97
|
-
</UDHeader>
|
|
68
|
+
{!(validationFields.loading || formState.loading) && (
|
|
69
|
+
<UDContainer>
|
|
70
|
+
<UDHeader>
|
|
71
|
+
<OText size={16}>
|
|
72
|
+
{t('CUSTOMER_DETAILS', 'Customer Details')}
|
|
73
|
+
</OText>
|
|
74
|
+
{cartStatus !== 2 && (
|
|
75
|
+
!isEdit ? (
|
|
76
|
+
<MaterialIcon
|
|
77
|
+
name='pencil-outline'
|
|
78
|
+
size={22}
|
|
79
|
+
color={theme.colors.editColor}
|
|
80
|
+
style={{ marginBottom: 10, marginLeft: 5 }}
|
|
81
|
+
onPress={() => toggleIsEdit()}
|
|
82
|
+
/>
|
|
83
|
+
) : (
|
|
84
|
+
<MaterialIcon
|
|
85
|
+
name='cancel'
|
|
86
|
+
color={theme.colors.cancelColor}
|
|
87
|
+
size={20}
|
|
88
|
+
style={{ marginBottom: 5, marginLeft: 5 }}
|
|
89
|
+
onPress={() => toggleEditState()}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
)}
|
|
93
|
+
</UDHeader>
|
|
98
94
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
95
|
+
{!isEdit ? (
|
|
96
|
+
<UDInfo>
|
|
97
|
+
<OText size={12}>
|
|
98
|
+
{userData?.name} {userData?.middle_name} {userData?.lastname} {userData?.second_lastname}
|
|
99
|
+
</OText>
|
|
100
|
+
<OText size={12} numberOfLines={1}>
|
|
101
|
+
{userData?.email}
|
|
102
|
+
</OText>
|
|
103
|
+
{!!(userData?.cellphone || user?.cellphone) && (
|
|
104
|
+
<>
|
|
105
|
+
<OText size={12}>
|
|
106
|
+
{(userData?.country_phone_code) && `+${(userData?.country_phone_code)} `}{(userData?.cellphone)}
|
|
107
|
+
</OText>
|
|
108
|
+
{!!phoneUpdate && (
|
|
109
|
+
<OText color={theme.colors.error} style={{ textAlign: 'center', width: '100%'}}>{t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number')}</OText>
|
|
110
|
+
)}
|
|
111
|
+
</>
|
|
112
|
+
)}
|
|
113
|
+
</UDInfo>
|
|
114
|
+
) : (
|
|
115
|
+
<UserFormDetailsUI {...props} phoneUpdate={phoneUpdate} togglePhoneUpdate={togglePhoneUpdate} isCheckout={isCheckout} />
|
|
116
|
+
)}
|
|
117
|
+
</UDContainer>
|
|
118
|
+
)}
|
|
119
|
+
</>
|
|
120
|
+
)
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
export const UserDetails = (props: any) => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const userDetailsProps = {
|
|
125
|
+
...props,
|
|
126
|
+
UIComponent: UserDetailsUI
|
|
127
|
+
}
|
|
132
128
|
|
|
133
|
-
|
|
129
|
+
return <UserFormController {...userDetailsProps} />
|
|
134
130
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import styled
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const UDContainer = styled.View``
|
|
4
4
|
|
|
5
5
|
export const UDHeader = styled.View`
|
|
6
|
+
display: flex;
|
|
6
7
|
flex-direction: row;
|
|
7
8
|
align-items: center;
|
|
8
9
|
`
|
|
9
10
|
|
|
10
11
|
export const UDForm = styled.View`
|
|
11
12
|
width: 100%;
|
|
12
|
-
/* margin-top: 25px; */
|
|
13
13
|
`
|
|
14
14
|
|
|
15
15
|
export const UDInfo = styled.View`
|
|
@@ -17,10 +17,5 @@ export const UDInfo = styled.View`
|
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
width: 100%;
|
|
19
19
|
text-align: left;
|
|
20
|
+
align-items: flex-start;
|
|
20
21
|
`
|
|
21
|
-
export const EditBtn = styled.TouchableOpacity`
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
padding-top: 9px;
|
|
25
|
-
width: 40px;
|
|
26
|
-
`;
|