react-native-timacare 3.3.64 → 3.3.66
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/lib/commonjs/components/AlertLoan.js +1 -1
- package/lib/commonjs/components/AlertLoan.js.flow +12 -2
- package/lib/commonjs/components/AlertLoan.js.map +1 -1
- package/lib/commonjs/components/ItemTimaOne.js +1 -1
- package/lib/commonjs/components/ItemTimaOne.js.flow +2 -0
- package/lib/commonjs/components/ItemTimaOne.js.map +1 -1
- package/lib/commonjs/navigation/primary-navigator.js +1 -1
- package/lib/commonjs/navigation/primary-navigator.js.flow +9 -0
- package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
- package/lib/commonjs/screens/full-submit/selfie.js +1 -1
- package/lib/commonjs/screens/full-submit/selfie.js.flow +257 -114
- package/lib/commonjs/screens/full-submit/selfie.js.map +1 -1
- package/lib/commonjs/screens/motobike/InfoLoanMotobike.js +1 -1
- package/lib/commonjs/screens/motobike/InfoLoanMotobike.js.flow +3 -2
- package/lib/commonjs/screens/motobike/InfoLoanMotobike.js.map +1 -1
- package/lib/commonjs/screens/motobike/ReviewLoanMotobike.js +1 -1
- package/lib/commonjs/screens/motobike/ReviewLoanMotobike.js.flow +1 -0
- package/lib/commonjs/screens/motobike/ReviewLoanMotobike.js.map +1 -1
- package/lib/commonjs/screens/selfie/SelfieCamera.js +2 -0
- package/lib/commonjs/screens/selfie/SelfieCamera.js.flow +302 -0
- package/lib/commonjs/screens/selfie/SelfieCamera.js.map +1 -0
- package/lib/commonjs/screens/selfie/index.js +1 -1
- package/lib/commonjs/screens/selfie/index.js.flow +295 -165
- package/lib/commonjs/screens/selfie/index.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.flow +1 -0
- package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.flow +1 -0
- package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.flow +1 -0
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.flow +8 -5
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
- package/lib/commonjs/screens/v3/AssetInformation.js +1 -1
- package/lib/commonjs/screens/v3/AssetInformation.js.flow +1 -0
- package/lib/commonjs/screens/v3/AssetInformation.js.map +1 -1
- package/lib/commonjs/screens/v3/ReviewInfoLoanBuyCar.js +2 -0
- package/lib/commonjs/screens/v3/ReviewInfoLoanBuyCar.js.flow +522 -0
- package/lib/commonjs/screens/v3/ReviewInfoLoanBuyCar.js.map +1 -0
- package/lib/commonjs/services/api/api.js +1 -1
- package/lib/commonjs/services/api/api.js.flow +41 -7
- package/lib/commonjs/services/api/api.js.map +1 -1
- package/lib/module/components/AlertLoan.js +1 -1
- package/lib/module/components/AlertLoan.js.map +1 -1
- package/lib/module/components/ItemTimaOne.js +1 -1
- package/lib/module/components/ItemTimaOne.js.map +1 -1
- package/lib/module/navigation/primary-navigator.js +1 -1
- package/lib/module/navigation/primary-navigator.js.map +1 -1
- package/lib/module/screens/full-submit/selfie.js +1 -1
- package/lib/module/screens/full-submit/selfie.js.map +1 -1
- package/lib/module/screens/motobike/InfoLoanMotobike.js +1 -1
- package/lib/module/screens/motobike/InfoLoanMotobike.js.map +1 -1
- package/lib/module/screens/motobike/ReviewLoanMotobike.js +1 -1
- package/lib/module/screens/motobike/ReviewLoanMotobike.js.map +1 -1
- package/lib/module/screens/selfie/SelfieCamera.js +2 -0
- package/lib/module/screens/selfie/SelfieCamera.js.map +1 -0
- package/lib/module/screens/selfie/index.js +1 -1
- package/lib/module/screens/selfie/index.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewInformation.js +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewLoan.js +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
- package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
- package/lib/module/screens/v3/AssetInformation.js +1 -1
- package/lib/module/screens/v3/AssetInformation.js.map +1 -1
- package/lib/module/screens/v3/ReviewInfoLoanBuyCar.js +2 -0
- package/lib/module/screens/v3/ReviewInfoLoanBuyCar.js.map +1 -0
- package/lib/module/services/api/api.js +1 -1
- package/lib/module/services/api/api.js.map +1 -1
- package/lib/typescript/components/AlertLoan.d.ts.map +1 -1
- package/lib/typescript/components/ItemTimaOne.d.ts.map +1 -1
- package/lib/typescript/navigation/primary-navigator.d.ts +2 -0
- package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
- package/lib/typescript/screens/full-submit/selfie.d.ts.map +1 -1
- package/lib/typescript/screens/selfie/SelfieCamera.d.ts +2 -0
- package/lib/typescript/screens/selfie/SelfieCamera.d.ts.map +1 -0
- package/lib/typescript/screens/selfie/index.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TopupLoanInfo.d.ts.map +1 -1
- package/lib/typescript/screens/v3/ReviewInfoLoanBuyCar.d.ts +2 -0
- package/lib/typescript/screens/v3/ReviewInfoLoanBuyCar.d.ts.map +1 -0
- package/lib/typescript/services/api/api.d.ts +32 -0
- package/lib/typescript/services/api/api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/AlertLoan.tsx +12 -2
- package/src/components/ItemTimaOne.tsx +2 -0
- package/src/navigation/primary-navigator.tsx +9 -0
- package/src/screens/full-submit/selfie.tsx +257 -114
- package/src/screens/motobike/InfoLoanMotobike.tsx +3 -2
- package/src/screens/motobike/ReviewLoanMotobike.tsx +1 -0
- package/src/screens/selfie/SelfieCamera.tsx +302 -0
- package/src/screens/selfie/index.tsx +295 -165
- package/src/screens/toan-trinh-so/ReviewInformation.tsx +1 -0
- package/src/screens/toan-trinh-so/ReviewInformationOther.tsx +1 -0
- package/src/screens/toan-trinh-so/ReviewLoan.tsx +1 -0
- package/src/screens/toan-trinh-so/TopupLoanInfo.tsx +8 -5
- package/src/screens/v3/AssetInformation.tsx +1 -0
- package/src/screens/v3/ReviewInfoLoanBuyCar.tsx +522 -0
- package/src/services/api/api.ts +41 -7
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
ScrollView,
|
|
5
|
+
TextInput,
|
|
6
|
+
TextStyle,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
ViewStyle,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import MHeader from '../../components/MHeader';
|
|
12
|
+
import { commonStyles } from '../CommonStyles';
|
|
13
|
+
import { useNavigation, CommonActions } from '@react-navigation/native';
|
|
14
|
+
import Loading from '../../components/Loading';
|
|
15
|
+
import { AlertGlobal } from '../../components/ModalNotification/AlertGlobal';
|
|
16
|
+
import { ScreenNames } from '../../navigation';
|
|
17
|
+
import { MText } from '../../components/MText';
|
|
18
|
+
import { IconBack } from '../../assets/svgs';
|
|
19
|
+
import { Formik } from 'formik';
|
|
20
|
+
import DatePicker from 'react-native-date-picker';
|
|
21
|
+
import { formatDDMMYYY, logEvent, logEventFb } from '../../utils';
|
|
22
|
+
import { DropDown2 } from '../../assets/icons';
|
|
23
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
24
|
+
import MButton from '../../components/MButton';
|
|
25
|
+
import { Api } from '../../services/api';
|
|
26
|
+
import KeyboardSpacer from '../../components/keyboardspace';
|
|
27
|
+
import * as yup from 'yup';
|
|
28
|
+
import moment from 'moment';
|
|
29
|
+
|
|
30
|
+
export default function ReviewInfoLoanBuyCar(props: any) {
|
|
31
|
+
const navigation = useNavigation();
|
|
32
|
+
const formRef = useRef(null);
|
|
33
|
+
const [showDate, setShowDate] = useState(false);
|
|
34
|
+
const [typeDate, setTypeDate] = useState(1);
|
|
35
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
36
|
+
|
|
37
|
+
const getData = async () => {
|
|
38
|
+
try {
|
|
39
|
+
setIsLoading(true);
|
|
40
|
+
const response = await Api.getInstance().getInfoCustomerLoanByCar(
|
|
41
|
+
props.route?.params?.loan?.id
|
|
42
|
+
);
|
|
43
|
+
console.log(response);
|
|
44
|
+
|
|
45
|
+
setIsLoading(false);
|
|
46
|
+
if (response.kind === 'ok') {
|
|
47
|
+
if (response.data?.meta.errorCode === 200) {
|
|
48
|
+
formRef.current.setFieldValue(
|
|
49
|
+
'fullName',
|
|
50
|
+
response?.data?.data?.fullName
|
|
51
|
+
);
|
|
52
|
+
formRef.current.setFieldValue(
|
|
53
|
+
'dob',
|
|
54
|
+
response?.data?.data?.dob
|
|
55
|
+
? formatDDMMYYY(response?.data?.data?.dob)
|
|
56
|
+
: ''
|
|
57
|
+
);
|
|
58
|
+
formRef.current.setFieldValue(
|
|
59
|
+
'gender',
|
|
60
|
+
response?.data?.data?.gender ?? null
|
|
61
|
+
);
|
|
62
|
+
formRef.current.setFieldValue(
|
|
63
|
+
'nationalCard',
|
|
64
|
+
response?.data?.data?.nationalCard
|
|
65
|
+
? response?.data?.data?.nationalCard
|
|
66
|
+
: ''
|
|
67
|
+
);
|
|
68
|
+
formRef.current.setFieldValue(
|
|
69
|
+
'dateNationalId',
|
|
70
|
+
response?.data?.data?.dateNationalId
|
|
71
|
+
? formatDDMMYYY(response?.data?.data?.dateNationalId)
|
|
72
|
+
: ''
|
|
73
|
+
);
|
|
74
|
+
formRef.current.setFieldValue(
|
|
75
|
+
'phone',
|
|
76
|
+
response?.data?.data?.phone ? response?.data?.data?.phone : ''
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
setIsLoading(false);
|
|
83
|
+
console.log(error);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
getData();
|
|
89
|
+
const trackEvent = async () => {
|
|
90
|
+
await logEvent('thongtinvay_started', {
|
|
91
|
+
event: 'thongtinvay_started',
|
|
92
|
+
createdAt: new Date(),
|
|
93
|
+
deviceId: appStore.deviceId,
|
|
94
|
+
loanId: String(props.route?.params?.loan?.id),
|
|
95
|
+
utmSource: props.route?.params?.loan?.utmSource,
|
|
96
|
+
});
|
|
97
|
+
logEventFb('thongtinvay_started');
|
|
98
|
+
};
|
|
99
|
+
trackEvent();
|
|
100
|
+
}, []);
|
|
101
|
+
|
|
102
|
+
const onSubmit = async (values) => {
|
|
103
|
+
const body = {
|
|
104
|
+
LoanBriefId: props?.route?.params?.loan?.id,
|
|
105
|
+
FullName: values.fullName,
|
|
106
|
+
Dob: moment(values.dob, 'DD/MM/YYYY').format('YYYY-MM-DD'),
|
|
107
|
+
Gender: values.gender,
|
|
108
|
+
NationalCard: values.nationalCard,
|
|
109
|
+
DateNationalId: moment(values.dateNationalId, 'DD/MM/YYYY').format(
|
|
110
|
+
'YYYY-MM-DD'
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
setIsLoading(true);
|
|
115
|
+
const response = await Api.getInstance().updateInfoCustomerLoanBuyCar(
|
|
116
|
+
body
|
|
117
|
+
);
|
|
118
|
+
setIsLoading(false);
|
|
119
|
+
if (response.kind === 'ok') {
|
|
120
|
+
if (response.data?.meta?.errorCode === 200) {
|
|
121
|
+
navigation.dispatch(
|
|
122
|
+
CommonActions.reset({
|
|
123
|
+
index: 1,
|
|
124
|
+
routes: [{ name: ScreenNames.Main }],
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
} else {
|
|
128
|
+
AlertGlobal.show({
|
|
129
|
+
type: 'warning',
|
|
130
|
+
title: 'Thông báo',
|
|
131
|
+
message: response.data?.meta?.errorMessage,
|
|
132
|
+
primaryText: 'Đóng',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
AlertGlobal.show({
|
|
137
|
+
type: 'warning',
|
|
138
|
+
title: 'Thông báo',
|
|
139
|
+
message: 'Có lỗi xảy ra. Vui lòng thử lại sau',
|
|
140
|
+
primaryText: 'Đóng',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
} catch (error) {
|
|
144
|
+
setIsLoading(false);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<View style={{ flex: 1 }}>
|
|
150
|
+
<MHeader title="Vay Online 24/7" />
|
|
151
|
+
<View style={commonStyles.fill}>
|
|
152
|
+
<View style={$h} />
|
|
153
|
+
<View style={$bg}>
|
|
154
|
+
<View
|
|
155
|
+
style={{
|
|
156
|
+
paddingVertical: 10,
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
paddingHorizontal: 16,
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
<TouchableOpacity
|
|
163
|
+
style={{
|
|
164
|
+
zIndex: 1000,
|
|
165
|
+
}}
|
|
166
|
+
onPress={() => {
|
|
167
|
+
AlertGlobal.show({
|
|
168
|
+
type: 'confirm',
|
|
169
|
+
title: 'Thoát cập nhật thông tin',
|
|
170
|
+
message:
|
|
171
|
+
'Bạn có chắc chắn muốn thoát cập nhật thông tin không?',
|
|
172
|
+
primaryText: 'Có',
|
|
173
|
+
onPrimaryPress: () => {
|
|
174
|
+
navigation.dispatch(
|
|
175
|
+
CommonActions.reset({
|
|
176
|
+
index: 1,
|
|
177
|
+
routes: [{ name: ScreenNames.Main }],
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
secondaryText: 'Không',
|
|
182
|
+
});
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
<IconBack />
|
|
186
|
+
</TouchableOpacity>
|
|
187
|
+
<MText style={$title}>Thông tin cá nhân</MText>
|
|
188
|
+
</View>
|
|
189
|
+
<Formik
|
|
190
|
+
innerRef={formRef}
|
|
191
|
+
onSubmit={onSubmit}
|
|
192
|
+
initialValues={{
|
|
193
|
+
fullName: '',
|
|
194
|
+
dob: '',
|
|
195
|
+
gender: null,
|
|
196
|
+
nationalCard: '',
|
|
197
|
+
dateNationalId: '',
|
|
198
|
+
phone: '',
|
|
199
|
+
}}
|
|
200
|
+
validationSchema={yup.object().shape({
|
|
201
|
+
fullName: yup.string().required('Vui lòng nhập họ tên'),
|
|
202
|
+
dob: yup.string().required('Vui lòng nhập ngày sinh').nullable(),
|
|
203
|
+
gender: yup
|
|
204
|
+
.number()
|
|
205
|
+
.required('Vui lòng chọn giới tính')
|
|
206
|
+
.nullable(),
|
|
207
|
+
nationalCard: yup.string().required('Vui lòng nhập CCCD/CMND'),
|
|
208
|
+
dateNationalId: yup
|
|
209
|
+
.string()
|
|
210
|
+
.required('Vui lòng nhập ngày cấp')
|
|
211
|
+
.nullable(),
|
|
212
|
+
phone: yup
|
|
213
|
+
.string()
|
|
214
|
+
.required('Vui lòng nhập số điện thoại')
|
|
215
|
+
.nullable(),
|
|
216
|
+
})}
|
|
217
|
+
>
|
|
218
|
+
{({
|
|
219
|
+
values,
|
|
220
|
+
errors,
|
|
221
|
+
handleChange,
|
|
222
|
+
handleSubmit,
|
|
223
|
+
setFieldValue,
|
|
224
|
+
}) => {
|
|
225
|
+
const renderView = useMemo(
|
|
226
|
+
() => (
|
|
227
|
+
<>
|
|
228
|
+
<ScrollView
|
|
229
|
+
style={[commonStyles.fill, { paddingHorizontal: 16 }]}
|
|
230
|
+
showsVerticalScrollIndicator={false}
|
|
231
|
+
>
|
|
232
|
+
<MText style={$title2}>1.1 Thông tin cá nhân</MText>
|
|
233
|
+
<MText style={$label}>Họ và tên</MText>
|
|
234
|
+
<TextInput
|
|
235
|
+
style={[
|
|
236
|
+
$textInput,
|
|
237
|
+
{
|
|
238
|
+
color: '#333333',
|
|
239
|
+
fontWeight: '500',
|
|
240
|
+
fontFamily: 'BeVietnamPro-Medium',
|
|
241
|
+
},
|
|
242
|
+
]}
|
|
243
|
+
value={values.fullName}
|
|
244
|
+
onChangeText={handleChange('fullName')}
|
|
245
|
+
/>
|
|
246
|
+
{errors && errors.fullName && (
|
|
247
|
+
<MText style={$error}>{errors.fullName}</MText>
|
|
248
|
+
)}
|
|
249
|
+
<View style={[$row, { marginTop: 16 }]}>
|
|
250
|
+
<View style={[commonStyles.fill]}>
|
|
251
|
+
<MText style={$label}>Sinh ngày</MText>
|
|
252
|
+
<TouchableOpacity
|
|
253
|
+
style={$select}
|
|
254
|
+
onPress={() => {
|
|
255
|
+
setTypeDate(1);
|
|
256
|
+
setShowDate(true);
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
<MText
|
|
260
|
+
style={{
|
|
261
|
+
color: '#333333',
|
|
262
|
+
fontWeight: '500',
|
|
263
|
+
fontFamily: 'BeVietnamPro-Medium',
|
|
264
|
+
}}
|
|
265
|
+
>
|
|
266
|
+
{values.dob}
|
|
267
|
+
</MText>
|
|
268
|
+
</TouchableOpacity>
|
|
269
|
+
{errors && errors.dob && (
|
|
270
|
+
<MText style={$error}>{errors.dob}</MText>
|
|
271
|
+
)}
|
|
272
|
+
</View>
|
|
273
|
+
<View style={[commonStyles.fill]}>
|
|
274
|
+
<MText style={$label}>Giới tính</MText>
|
|
275
|
+
<TouchableOpacity
|
|
276
|
+
style={$select}
|
|
277
|
+
onPress={() => {
|
|
278
|
+
navigation.push(ScreenNames.MSelect, {
|
|
279
|
+
title: 'Chọn giới tính',
|
|
280
|
+
data: EnumGender,
|
|
281
|
+
callback: (item) => {
|
|
282
|
+
setFieldValue('gender', item.id);
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
}}
|
|
286
|
+
>
|
|
287
|
+
<MText
|
|
288
|
+
style={{
|
|
289
|
+
color: '#333333',
|
|
290
|
+
fontSize: 16,
|
|
291
|
+
fontWeight: '500',
|
|
292
|
+
flex: 1,
|
|
293
|
+
}}
|
|
294
|
+
>
|
|
295
|
+
{values.gender === 0
|
|
296
|
+
? 'Nam'
|
|
297
|
+
: values.gender === 1
|
|
298
|
+
? 'Nữ'
|
|
299
|
+
: ''}
|
|
300
|
+
</MText>
|
|
301
|
+
<DropDown2 />
|
|
302
|
+
</TouchableOpacity>
|
|
303
|
+
{errors && errors.gender && (
|
|
304
|
+
<MText style={$error}>{errors.gender}</MText>
|
|
305
|
+
)}
|
|
306
|
+
</View>
|
|
307
|
+
</View>
|
|
308
|
+
<View style={[$row]}>
|
|
309
|
+
<View style={[commonStyles.fill]}>
|
|
310
|
+
<MText style={$label}>Số CCCD/CMND</MText>
|
|
311
|
+
<TextInput
|
|
312
|
+
keyboardType="number-pad"
|
|
313
|
+
style={[
|
|
314
|
+
$textInput,
|
|
315
|
+
{
|
|
316
|
+
color: '#333333',
|
|
317
|
+
fontWeight: '500',
|
|
318
|
+
fontFamily: 'BeVietnamPro-Medium',
|
|
319
|
+
},
|
|
320
|
+
]}
|
|
321
|
+
value={values.nationalCard}
|
|
322
|
+
onChangeText={handleChange('nationalCard')}
|
|
323
|
+
/>
|
|
324
|
+
{errors && errors.nationalCard && (
|
|
325
|
+
<MText style={$error}>{errors.nationalCard}</MText>
|
|
326
|
+
)}
|
|
327
|
+
</View>
|
|
328
|
+
<View style={[commonStyles.fill]}>
|
|
329
|
+
<MText style={$label}>Ngày cấp</MText>
|
|
330
|
+
<TouchableOpacity
|
|
331
|
+
style={$select}
|
|
332
|
+
onPress={() => {
|
|
333
|
+
setTypeDate(2);
|
|
334
|
+
setShowDate(true);
|
|
335
|
+
}}
|
|
336
|
+
>
|
|
337
|
+
<MText
|
|
338
|
+
numberOfLines={1}
|
|
339
|
+
style={{
|
|
340
|
+
color:
|
|
341
|
+
values.dateNationalId !== ''
|
|
342
|
+
? '#333333'
|
|
343
|
+
: '#BDBDBD',
|
|
344
|
+
fontWeight: '500',
|
|
345
|
+
flex: 1,
|
|
346
|
+
fontFamily: 'BeVietnamPro-Medium',
|
|
347
|
+
}}
|
|
348
|
+
>
|
|
349
|
+
{values.dateNationalId !== ''
|
|
350
|
+
? values.dateNationalId
|
|
351
|
+
: 'DD/MM/YYYY'}
|
|
352
|
+
</MText>
|
|
353
|
+
</TouchableOpacity>
|
|
354
|
+
{errors && errors.dateNationalId && (
|
|
355
|
+
<MText style={$error}>
|
|
356
|
+
{errors.dateNationalId}
|
|
357
|
+
</MText>
|
|
358
|
+
)}
|
|
359
|
+
</View>
|
|
360
|
+
</View>
|
|
361
|
+
<MText style={$label}>Số điện thoại</MText>
|
|
362
|
+
<TextInput
|
|
363
|
+
editable={false}
|
|
364
|
+
keyboardType="number-pad"
|
|
365
|
+
style={[
|
|
366
|
+
$textInput,
|
|
367
|
+
{
|
|
368
|
+
color: '#333333',
|
|
369
|
+
fontWeight: '500',
|
|
370
|
+
fontFamily: 'BeVietnamPro-Medium',
|
|
371
|
+
backgroundColor: '#E0E0E0',
|
|
372
|
+
},
|
|
373
|
+
]}
|
|
374
|
+
value={values.phone}
|
|
375
|
+
onChangeText={handleChange('phone')}
|
|
376
|
+
/>
|
|
377
|
+
{errors && errors.phone && (
|
|
378
|
+
<MText style={$error}>{errors.phone}</MText>
|
|
379
|
+
)}
|
|
380
|
+
</ScrollView>
|
|
381
|
+
<MButton
|
|
382
|
+
onPress={() => {
|
|
383
|
+
handleSubmit();
|
|
384
|
+
}}
|
|
385
|
+
style={{
|
|
386
|
+
marginVertical: 24,
|
|
387
|
+
marginHorizontal: 16,
|
|
388
|
+
}}
|
|
389
|
+
>
|
|
390
|
+
<LinearGradient
|
|
391
|
+
start={{ x: 1, y: 0 }}
|
|
392
|
+
end={{ x: 0, y: 1 }}
|
|
393
|
+
style={{
|
|
394
|
+
height: 40,
|
|
395
|
+
marginVertical: 16,
|
|
396
|
+
borderRadius: 30,
|
|
397
|
+
alignItems: 'center',
|
|
398
|
+
justifyContent: 'center',
|
|
399
|
+
}}
|
|
400
|
+
colors={['#FF7A00', '#EF4123']}
|
|
401
|
+
>
|
|
402
|
+
<MText
|
|
403
|
+
style={{
|
|
404
|
+
color: 'white',
|
|
405
|
+
fontSize: 16,
|
|
406
|
+
}}
|
|
407
|
+
>
|
|
408
|
+
Tiếp tục
|
|
409
|
+
</MText>
|
|
410
|
+
</LinearGradient>
|
|
411
|
+
</MButton>
|
|
412
|
+
</>
|
|
413
|
+
),
|
|
414
|
+
[values, errors]
|
|
415
|
+
);
|
|
416
|
+
return (
|
|
417
|
+
<>
|
|
418
|
+
{renderView}
|
|
419
|
+
|
|
420
|
+
<DatePicker
|
|
421
|
+
mode="date"
|
|
422
|
+
open={showDate}
|
|
423
|
+
modal
|
|
424
|
+
title="Chọn thời gian"
|
|
425
|
+
locale="vi"
|
|
426
|
+
date={new Date()}
|
|
427
|
+
onCancel={() => {
|
|
428
|
+
setShowDate(false);
|
|
429
|
+
}}
|
|
430
|
+
onConfirm={(date) => {
|
|
431
|
+
setShowDate(false);
|
|
432
|
+
if (typeDate === 1) {
|
|
433
|
+
setFieldValue('dob', formatDDMMYYY(date));
|
|
434
|
+
}
|
|
435
|
+
if (typeDate === 2) {
|
|
436
|
+
setFieldValue('dateNationalId', formatDDMMYYY(date));
|
|
437
|
+
}
|
|
438
|
+
}}
|
|
439
|
+
/>
|
|
440
|
+
</>
|
|
441
|
+
);
|
|
442
|
+
}}
|
|
443
|
+
</Formik>
|
|
444
|
+
<KeyboardSpacer />
|
|
445
|
+
</View>
|
|
446
|
+
</View>
|
|
447
|
+
<Loading isLoading={isLoading} />
|
|
448
|
+
</View>
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
const $row: ViewStyle = {
|
|
452
|
+
flexDirection: 'row',
|
|
453
|
+
// alignItems: 'center',
|
|
454
|
+
marginBottom: 16,
|
|
455
|
+
gap: 16,
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const $textInput: ViewStyle = {
|
|
459
|
+
borderWidth: 1,
|
|
460
|
+
borderRadius: 4,
|
|
461
|
+
borderColor: '#E0E0E0',
|
|
462
|
+
height: 40,
|
|
463
|
+
paddingHorizontal: 8,
|
|
464
|
+
fontFamily: 'BeVietnamPro-Medium',
|
|
465
|
+
fontSize: 14,
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
const $label: TextStyle = {
|
|
469
|
+
fontSize: 14,
|
|
470
|
+
color: '#333333',
|
|
471
|
+
paddingBottom: 5,
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
const $title2: TextStyle = {
|
|
475
|
+
fontSize: 16,
|
|
476
|
+
fontWeight: 'bold',
|
|
477
|
+
color: '#333333',
|
|
478
|
+
paddingBottom: 10,
|
|
479
|
+
marginTop: 6,
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
const $title: TextStyle = {
|
|
483
|
+
fontSize: 16,
|
|
484
|
+
fontWeight: 'bold',
|
|
485
|
+
color: '#333333',
|
|
486
|
+
position: 'absolute',
|
|
487
|
+
left: 0,
|
|
488
|
+
right: 0,
|
|
489
|
+
textAlign: 'center',
|
|
490
|
+
};
|
|
491
|
+
const $h: ViewStyle = {
|
|
492
|
+
backgroundColor: '#EF592E',
|
|
493
|
+
position: 'absolute',
|
|
494
|
+
height: 30,
|
|
495
|
+
width: '100%',
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const $bg: ViewStyle = {
|
|
499
|
+
borderTopLeftRadius: 30,
|
|
500
|
+
borderTopRightRadius: 30,
|
|
501
|
+
backgroundColor: 'white',
|
|
502
|
+
flex: 1,
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
const $select: ViewStyle = {
|
|
506
|
+
flexDirection: 'row',
|
|
507
|
+
height: 40,
|
|
508
|
+
alignItems: 'center',
|
|
509
|
+
paddingHorizontal: 8,
|
|
510
|
+
borderWidth: 1,
|
|
511
|
+
borderRadius: 4,
|
|
512
|
+
borderColor: '#E0E0E0',
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
const $error: TextStyle = {
|
|
516
|
+
color: '#EB5757',
|
|
517
|
+
fontSize: 14,
|
|
518
|
+
fontStyle: 'italic',
|
|
519
|
+
fontFamily: 'BeVietnamPro-Thin',
|
|
520
|
+
fontWeight: '300',
|
|
521
|
+
marginTop: 5,
|
|
522
|
+
};
|
package/src/services/api/api.ts
CHANGED
|
@@ -123,15 +123,10 @@ export class Api {
|
|
|
123
123
|
primaryText: 'Đồng ý',
|
|
124
124
|
onPrimaryPress: () => {
|
|
125
125
|
try {
|
|
126
|
-
if (
|
|
127
|
-
this.config.logout &&
|
|
128
|
-
typeof this.config.logout === 'function'
|
|
129
|
-
) {
|
|
126
|
+
if (this.config.logout && typeof this.config.logout === 'function') {
|
|
130
127
|
this.config.logout();
|
|
131
128
|
} else {
|
|
132
|
-
myLog(
|
|
133
|
-
'[API] Warning: logout function not configured in SDKConfig'
|
|
134
|
-
);
|
|
129
|
+
myLog('[API] Warning: logout function not configured in SDKConfig');
|
|
135
130
|
}
|
|
136
131
|
} catch (error) {
|
|
137
132
|
myLog('[API] Error during logout:', error);
|
|
@@ -4204,4 +4199,43 @@ export class Api {
|
|
|
4204
4199
|
return { kind: 'bad-data' };
|
|
4205
4200
|
}
|
|
4206
4201
|
}
|
|
4202
|
+
|
|
4203
|
+
// Lấy thông tin khách hàng luồng vay mua xe
|
|
4204
|
+
async getInfoCustomerLoanByCar(id) {
|
|
4205
|
+
// make the api call
|
|
4206
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
4207
|
+
`api/v2.0/autodev2/get_info_customer_vaymuaxe?loanBriefId=${id}`
|
|
4208
|
+
);
|
|
4209
|
+
// the typical ways to die when calling an api
|
|
4210
|
+
if (!response.ok) {
|
|
4211
|
+
const problem = getGeneralApiProblem(response);
|
|
4212
|
+
if (problem) return problem;
|
|
4213
|
+
}
|
|
4214
|
+
// transform the data into the format we are expecting
|
|
4215
|
+
try {
|
|
4216
|
+
return { kind: 'ok', data: response.data };
|
|
4217
|
+
} catch {
|
|
4218
|
+
return { kind: 'bad-data' };
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4222
|
+
// cập nhật thông tin khách hàng luồng vay mua xe
|
|
4223
|
+
async updateInfoCustomerLoanBuyCar(body) {
|
|
4224
|
+
// make the api call
|
|
4225
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
4226
|
+
`api/v2.0/autodev2/update_info_customer_vaymuaxe`,
|
|
4227
|
+
body
|
|
4228
|
+
);
|
|
4229
|
+
// the typical ways to die when calling an api
|
|
4230
|
+
if (!response.ok) {
|
|
4231
|
+
const problem = getGeneralApiProblem(response);
|
|
4232
|
+
if (problem) return problem;
|
|
4233
|
+
}
|
|
4234
|
+
// transform the data into the format we are expecting
|
|
4235
|
+
try {
|
|
4236
|
+
return { kind: 'ok', data: response.data };
|
|
4237
|
+
} catch {
|
|
4238
|
+
return { kind: 'bad-data' };
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4207
4241
|
}
|