react-native-timacare 3.1.46 → 3.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/lib/commonjs/components/MSelect.js +1 -1
  2. package/lib/commonjs/components/MSelect.js.flow +1 -1
  3. package/lib/commonjs/navigation/primary-navigator.js +1 -1
  4. package/lib/commonjs/navigation/primary-navigator.js.flow +6 -3
  5. package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
  6. package/lib/commonjs/screens/home/index.js +1 -1
  7. package/lib/commonjs/screens/home/index.js.flow +26 -26
  8. package/lib/commonjs/screens/home/index.js.map +1 -1
  9. package/lib/commonjs/screens/liveness-v2/index.js +1 -1
  10. package/lib/commonjs/screens/liveness-v2/index.js.flow +36 -4
  11. package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
  12. package/lib/commonjs/screens/register/index.js +1 -1
  13. package/lib/commonjs/screens/register/index.js.flow +1 -1
  14. package/lib/commonjs/screens/splash/index.js +1 -1
  15. package/lib/commonjs/screens/splash/index.js.flow +2 -1
  16. package/lib/commonjs/screens/splash/index.js.map +1 -1
  17. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js +1 -1
  18. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.flow +18 -1
  19. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  20. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  21. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.flow +29 -3
  22. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  23. package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js +1 -1
  24. package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.flow +4 -2
  25. package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
  26. package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
  27. package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.flow +18 -1
  28. package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
  29. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js +1 -1
  30. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js.flow +17 -0
  31. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js.map +1 -1
  32. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js +1 -1
  33. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.flow +31 -5
  34. package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
  35. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js +1 -1
  36. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.flow +17 -1
  37. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
  38. package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js +2 -0
  39. package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.flow +888 -0
  40. package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -0
  41. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js +1 -1
  42. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.flow +32 -1
  43. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
  44. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
  45. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.flow +18 -1
  46. package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
  47. package/lib/commonjs/services/api/api.js +1 -1
  48. package/lib/commonjs/services/api/api.js.flow +32 -0
  49. package/lib/commonjs/services/api/api.js.map +1 -1
  50. package/lib/module/components/MSelect.js +1 -1
  51. package/lib/module/navigation/primary-navigator.js +1 -1
  52. package/lib/module/navigation/primary-navigator.js.map +1 -1
  53. package/lib/module/screens/home/index.js +1 -1
  54. package/lib/module/screens/home/index.js.map +1 -1
  55. package/lib/module/screens/liveness-v2/index.js +1 -1
  56. package/lib/module/screens/liveness-v2/index.js.map +1 -1
  57. package/lib/module/screens/register/index.js +1 -1
  58. package/lib/module/screens/splash/index.js +1 -1
  59. package/lib/module/screens/splash/index.js.map +1 -1
  60. package/lib/module/screens/toan-trinh-so/ReviewInformation.js +1 -1
  61. package/lib/module/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  62. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  63. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  64. package/lib/module/screens/toan-trinh-so/ReviewLoan.js +1 -1
  65. package/lib/module/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
  66. package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
  67. package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
  68. package/lib/module/screens/toan-trinh-so/TTSOTP.js +1 -1
  69. package/lib/module/screens/toan-trinh-so/TTSOTP.js.map +1 -1
  70. package/lib/module/screens/toan-trinh-so/TTSSelfie.js +1 -1
  71. package/lib/module/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
  72. package/lib/module/screens/toan-trinh-so/TTSSignLoan.js +1 -1
  73. package/lib/module/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
  74. package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js +2 -0
  75. package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -0
  76. package/lib/module/screens/toan-trinh-so/VehicleRegistration.js +1 -1
  77. package/lib/module/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
  78. package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
  79. package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
  80. package/lib/module/services/api/api.js +1 -1
  81. package/lib/module/services/api/api.js.map +1 -1
  82. package/lib/typescript/navigation/primary-navigator.d.ts +1 -0
  83. package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
  84. package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
  85. package/lib/typescript/screens/splash/index.d.ts.map +1 -1
  86. package/lib/typescript/screens/toan-trinh-so/ReviewInformation.d.ts.map +1 -1
  87. package/lib/typescript/screens/toan-trinh-so/ReviewInformationOther.d.ts.map +1 -1
  88. package/lib/typescript/screens/toan-trinh-so/ReviewLoan.d.ts.map +1 -1
  89. package/lib/typescript/screens/toan-trinh-so/TTSNationalIDFront.d.ts.map +1 -1
  90. package/lib/typescript/screens/toan-trinh-so/TTSOTP.d.ts.map +1 -1
  91. package/lib/typescript/screens/toan-trinh-so/TTSSelfie.d.ts.map +1 -1
  92. package/lib/typescript/screens/toan-trinh-so/TTSSignLoan.d.ts.map +1 -1
  93. package/lib/typescript/screens/toan-trinh-so/TopupLoanInfo.d.ts +2 -0
  94. package/lib/typescript/screens/toan-trinh-so/TopupLoanInfo.d.ts.map +1 -0
  95. package/lib/typescript/screens/toan-trinh-so/VehicleRegistration.d.ts.map +1 -1
  96. package/lib/typescript/screens/toan-trinh-so/VehicleRegistrationFront.d.ts.map +1 -1
  97. package/lib/typescript/services/api/api.d.ts +32 -0
  98. package/lib/typescript/services/api/api.d.ts.map +1 -1
  99. package/package.json +1 -1
  100. package/src/components/MSelect.tsx +1 -1
  101. package/src/navigation/primary-navigator.tsx +6 -3
  102. package/src/screens/home/index.tsx +26 -26
  103. package/src/screens/liveness-v2/index.tsx +36 -4
  104. package/src/screens/register/index.tsx +1 -1
  105. package/src/screens/splash/index.tsx +2 -1
  106. package/src/screens/toan-trinh-so/ReviewInformation.tsx +18 -1
  107. package/src/screens/toan-trinh-so/ReviewInformationOther.tsx +29 -3
  108. package/src/screens/toan-trinh-so/ReviewLoan.tsx +4 -2
  109. package/src/screens/toan-trinh-so/TTSNationalIDFront.tsx +18 -1
  110. package/src/screens/toan-trinh-so/TTSOTP.tsx +17 -0
  111. package/src/screens/toan-trinh-so/TTSSelfie.tsx +31 -5
  112. package/src/screens/toan-trinh-so/TTSSignLoan.tsx +17 -1
  113. package/src/screens/toan-trinh-so/TopupLoanInfo.tsx +888 -0
  114. package/src/screens/toan-trinh-so/VehicleRegistration.tsx +32 -1
  115. package/src/screens/toan-trinh-so/VehicleRegistrationFront.tsx +18 -1
  116. package/src/services/api/api.ts +32 -0
@@ -0,0 +1,888 @@
1
+ //@ts-nocheck
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
+ import {
4
+ Alert,
5
+ Dimensions,
6
+ ScrollView,
7
+ TextInput,
8
+ TextStyle,
9
+ TouchableOpacity,
10
+ View,
11
+ ViewStyle,
12
+ } from 'react-native';
13
+ import MHeader from '../../components/MHeader';
14
+ import { commonStyles } from '../CommonStyles';
15
+ import { MText } from '../../components/MText';
16
+ import { ScreenNames } from '../../navigation';
17
+ import { CommonActions, useNavigation } from '@react-navigation/native';
18
+ import { IconBack } from '../../assets/svgs';
19
+ import { Formik } from 'formik';
20
+ import { CheckBox, CheckBoxActive, DropDown2, Tick2 } from '../../assets/icons';
21
+ import appStore from '../../AppStore';
22
+ import { formatDDMMYYY, formatMoney } from '../../utils';
23
+ import { Api } from '../../services/api';
24
+ import { debounce } from 'lodash';
25
+ import { color } from '../../theme';
26
+ import ttsStore from './store';
27
+ import Loading from '../../components/Loading';
28
+ import MButton from '../../components/MButton';
29
+ import LinearGradient from 'react-native-linear-gradient';
30
+ import moment from 'moment';
31
+ import * as yup from 'yup';
32
+ import analytics from '@react-native-firebase/analytics';
33
+ import { AppEventsLogger } from 'react-native-fbsdk-next';
34
+
35
+ export default function TopupLoanInfo(props) {
36
+ const navigation = useNavigation();
37
+ const formRef = useRef(null);
38
+ const [isLoading, setIsLoading] = useState(false);
39
+
40
+ const getData = async () => {
41
+ try {
42
+ setIsLoading(true);
43
+ const response = await Api.getInstance().getInfoLoanTopupTts(
44
+ props.route?.params?.loan?.id
45
+ );
46
+ setIsLoading(false);
47
+ if (response.kind === 'ok') {
48
+ if (response.data?.meta.errorCode === 200) {
49
+ formRef.current.setFieldValue(
50
+ 'bankAccountName',
51
+ response?.data?.data?.bankAccountName ?? ''
52
+ );
53
+ formRef.current.setFieldValue(
54
+ 'bankAccountNumber',
55
+ response?.data?.data?.bankAccountNumber ?? ''
56
+ );
57
+ formRef.current.setFieldValue(
58
+ 'bankId',
59
+ response?.data?.data?.bankId ?? null
60
+ );
61
+ formRef.current.setFieldValue(
62
+ 'bankName',
63
+ response?.data?.data?.bankName ?? ''
64
+ );
65
+ formRef.current.setFieldValue(
66
+ 'loanAmount',
67
+ response?.data?.data?.loanAmount ?? 0
68
+ );
69
+ formRef.current.setFieldValue(
70
+ 'firstPaymentDate',
71
+ formatDDMMYYY(response?.data?.data?.firstPaymentDate) ?? ''
72
+ );
73
+ formRef.current.setFieldValue(
74
+ 'rateTypeId',
75
+ response?.data?.data?.rateTypeId ?? null
76
+ );
77
+ formRef.current.setFieldValue(
78
+ 'loanTime',
79
+ response?.data?.data?.loanTime ?? null
80
+ );
81
+ formRef.current.setFieldValue(
82
+ 'moneyInsuranceProperty',
83
+ response?.data?.data?.moneyInsuranceProperty ?? null
84
+ );
85
+ formRef.current.setFieldValue(
86
+ 'moneyInsurenceCustomer',
87
+ response?.data?.data?.moneyInsurenceCustomer ?? null
88
+ );
89
+ formRef.current.setFieldValue(
90
+ 'buyInsuranceProperty',
91
+ response?.data?.data?.buyInsuranceProperty
92
+ ? response?.data?.data?.buyInsuranceProperty
93
+ : false
94
+ );
95
+ formRef.current.setFieldValue(
96
+ 'buyInsurenceCustomer',
97
+ response?.data?.data?.buyInsurenceCustomer
98
+ ? response?.data?.data?.buyInsurenceCustomer
99
+ : false
100
+ );
101
+
102
+ const timeInsurenceCustomer = appStore.listInsurenceTimeAll.find(
103
+ (x) => x.id === response.data.data?.timeInsurenceCustomer
104
+ );
105
+ formRef.current?.setFieldValue(
106
+ 'timeInsurenceCustomer',
107
+ timeInsurenceCustomer
108
+ );
109
+ const timeInsuranceProperty = appStore.listInsurenceTimeAll.find(
110
+ (x) => x.id === response.data.data?.timeInsuranceProperty
111
+ );
112
+ formRef.current?.setFieldValue(
113
+ 'timeInsuranceProperty',
114
+ timeInsuranceProperty
115
+ );
116
+
117
+ if (response.data?.data?.brand) {
118
+ ttsStore.getListYearCar(response.data?.data?.brand);
119
+ }
120
+ if (response.data?.data?.brand && response.data?.data?.yearCar) {
121
+ ttsStore.getListCar(
122
+ response.data?.data?.brand,
123
+ response.data?.data?.yearCar
124
+ );
125
+ }
126
+
127
+ formRef.current?.setFieldValue(
128
+ 'typeLoanBrief',
129
+ response.data.data?.typeLoanBrief ?? null
130
+ );
131
+ formRef.current?.setFieldValue(
132
+ 'carTypeId',
133
+ response.data.data?.carTypeId ?? null
134
+ );
135
+ } else {
136
+ }
137
+ }
138
+ } catch (error) {
139
+ setIsLoading(false);
140
+ console.log(error);
141
+ }
142
+ };
143
+ const getInfoInsurence = async (
144
+ loanAmount,
145
+ loanTime,
146
+ rateTypeId,
147
+ timeInsurenceCustomer,
148
+ timeInsuranceProperty
149
+ ) => {
150
+ try {
151
+ setIsLoading(true);
152
+ const response = await Api.getInstance().getInfoInsurence2(
153
+ props.route.params?.loan?.id,
154
+ loanAmount,
155
+ loanTime,
156
+ rateTypeId,
157
+ timeInsurenceCustomer,
158
+ timeInsuranceProperty
159
+ );
160
+ setIsLoading(false);
161
+ if (response.kind === 'ok') {
162
+ if (response.data?.meta?.errorCode === 200) {
163
+ formRef.current?.setFieldValue(
164
+ 'moneyInsurenceCustomer',
165
+ response.data.data?.moneyInsurenceCustomer
166
+ );
167
+ formRef.current?.setFieldValue(
168
+ 'moneyInsuranceProperty',
169
+ response.data.data?.moneyInsuranceProperty
170
+ );
171
+ formRef.current?.setFieldValue(
172
+ 'moneyInsurranceHospitalization',
173
+ response.data.data?.moneyInsurranceHospitalization
174
+ );
175
+ } else {
176
+ Alert.alert('Thông báo', response.data?.meta?.errorMessage);
177
+ }
178
+ } else {
179
+ }
180
+ } catch (error) {
181
+ setIsLoading(false);
182
+ }
183
+ };
184
+
185
+ const debounceCall = useCallback(
186
+ debounce((textParam) => {
187
+ getInfoInsurence(
188
+ Number(textParam.replace(/\D/g, '')),
189
+ formRef.current.values.loanTime,
190
+ formRef.current.values?.rateTypeId,
191
+ formRef.current.values.timeInsurenceCustomer?.id ?? 0,
192
+ formRef.current.values.timeInsuranceProperty?.id ?? 0
193
+ );
194
+ }, 2000),
195
+ []
196
+ );
197
+
198
+ useEffect(async () => {
199
+ getData();
200
+ ttsStore.getFirstPayment(props.route?.params?.loan?.id);
201
+ await analytics().logEvent('thongtinvay_started', {
202
+ event: 'thongtinvay_started',
203
+ createdAt: new Date(),
204
+ deviceId: appStore.deviceId,
205
+ loanId: props.route?.params?.loan?.id,
206
+ utmSource: props.route?.params?.loan?.utmSource,
207
+ });
208
+ await AppEventsLogger().logEvent('thongtinvay_started', {
209
+ event: 'thongtinvay_started',
210
+ createdAt: new Date(),
211
+ deviceId: appStore.deviceId,
212
+ loanId: props.route?.params?.loan?.id,
213
+ utmSource: props.route?.params?.loan?.utmSource,
214
+ });
215
+ }, []);
216
+
217
+ const onSubmit = async (values) => {
218
+ try {
219
+ setIsLoading(true);
220
+ const body = {
221
+ loanBriefId: props.route?.params?.loan?.id,
222
+ loanAmount: Number(values.loanAmount),
223
+ rateTypeId: values.rateTypeId,
224
+ loanTime: values.loanTime,
225
+ firstPaymentDate: moment(values.firstPaymentDate, 'DD/MM/YYYY').format(
226
+ 'YYYY-MM-DD'
227
+ ),
228
+ buyInsurenceCustomer: values?.buyInsurenceCustomer,
229
+ buyInsuranceProperty: values?.buyInsuranceProperty,
230
+ timeInsurenceCustomer: values?.timeInsurenceCustomer?.id ?? 0,
231
+ timeInsuranceProperty: values?.timeInsuranceProperty?.id ?? 0,
232
+ moneyInsurenceCustomer: values.moneyInsurenceCustomer,
233
+ moneyInsuranceProperty: values.moneyInsuranceProperty,
234
+ };
235
+ const response = await Api.getInstance().updateInfoLoanTopup(body);
236
+ setIsLoading(false);
237
+ if (response.kind === 'ok') {
238
+ if (response.data?.meta?.errorCode === 200) {
239
+ Alert.alert('Thông báo', 'Cập nhật thông tin thành công', [
240
+ {
241
+ text: 'Đồng ý',
242
+ onPress: async () => {
243
+ await analytics().logEvent('thongtinvay_completed', {
244
+ event: 'thongtinvay_completed',
245
+ createdAt: new Date(),
246
+ deviceId: appStore.deviceId,
247
+ loanId: props.route?.params?.loan?.id,
248
+ utmSource: props.route?.params?.loan?.utmSource,
249
+ });
250
+ await AppEventsLogger().logEvent('thongtinvay_completed', {
251
+ event: 'thongtinvay_completed',
252
+ createdAt: new Date(),
253
+ deviceId: appStore.deviceId,
254
+ loanId: props.route?.params?.loan?.id,
255
+ utmSource: props.route?.params?.loan?.utmSource,
256
+ });
257
+ navigation.dispatch(
258
+ CommonActions.reset({
259
+ index: 1,
260
+ routes: [{ name: ScreenNames.Main }],
261
+ })
262
+ );
263
+ },
264
+ },
265
+ ]);
266
+ } else {
267
+ Alert.alert('Thông báo', response.data?.meta?.errorMessage);
268
+ }
269
+ } else {
270
+ Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau');
271
+ }
272
+ } catch (error) {
273
+ setIsLoading(false);
274
+ console.log(error);
275
+ }
276
+ };
277
+
278
+ return (
279
+ <View style={{ flex: 1 }}>
280
+ <MHeader title="Vay nhanh 24/7" />
281
+ <View style={commonStyles.fill}>
282
+ <View style={$h} />
283
+ <View style={$bg}>
284
+ <View
285
+ style={{
286
+ paddingVertical: 10,
287
+ flexDirection: 'row',
288
+ alignItems: 'center',
289
+ paddingHorizontal: 16,
290
+ }}
291
+ >
292
+ <TouchableOpacity
293
+ style={{
294
+ zIndex: 1000,
295
+ }}
296
+ onPress={() => {
297
+ Alert.alert(
298
+ 'Thoát cập nhật thông tin',
299
+ 'Bạn có chắc chắn muốn thoát cập nhật thông tin không?',
300
+ [
301
+ {
302
+ text: 'Có',
303
+ onPress: () => {
304
+ navigation.dispatch(
305
+ CommonActions.reset({
306
+ index: 1,
307
+ routes: [{ name: ScreenNames.Main }],
308
+ })
309
+ );
310
+ },
311
+ },
312
+ {
313
+ text: 'Không',
314
+ },
315
+ ]
316
+ );
317
+ }}
318
+ >
319
+ <IconBack />
320
+ </TouchableOpacity>
321
+ <MText style={$title}>Thông tin chi tiết</MText>
322
+ </View>
323
+ <Formik
324
+ onSubmit={onSubmit}
325
+ innerRef={formRef}
326
+ initialValues={{
327
+ loanAmount: '',
328
+ rateTypeId: null,
329
+ loanTime: null,
330
+ firstPaymentDate: '',
331
+ buyInsurenceCustomer: false,
332
+ buyInsuranceProperty: false,
333
+ timeInsurenceCustomer: null,
334
+ timeInsuranceProperty: null,
335
+ moneyInsurenceCustomer: null,
336
+ moneyInsuranceProperty: null,
337
+ bankId: null,
338
+ bankName: '',
339
+ bankAccountName: '',
340
+ bankAccountNumber: '',
341
+ }}
342
+ validateOnBlur={false}
343
+ validateOnChange={false}
344
+ validationSchema={yup.object().shape({
345
+ loanAmount: yup.string().required('Số tiền là bắt buộc'),
346
+ rateTypeId: yup.number().required('HTTT là bắt buộc').nullable(),
347
+ loanTime: yup
348
+ .number()
349
+ .required('Thời gian vay là bắt buộc')
350
+ .nullable(),
351
+ firstPaymentDate: yup
352
+ .string()
353
+ .required('Ngày thanh toán đầu kỳ là bắt buộc'),
354
+ })}
355
+ >
356
+ {({ values, errors, setFieldValue, handleSubmit }) => (
357
+ <View style={{ flex: 1, paddingHorizontal: 16 }}>
358
+ <ScrollView
359
+ style={[commonStyles.fill]}
360
+ showsVerticalScrollIndicator={false}
361
+ >
362
+ <MText style={$title2}>1.1 Thông tin đề nghị khoản vay</MText>
363
+ <View style={$row}>
364
+ <View style={{ flex: 1 }}>
365
+ <MText style={$label}>Số tiền đề nghị vay</MText>
366
+ <TextInput
367
+ numberOfLines={1}
368
+ style={[
369
+ $textInput,
370
+ {
371
+ color: '#333333',
372
+ fontSize: 16,
373
+ fontWeight: '500',
374
+ },
375
+ ]}
376
+ value={formatMoney(values.loanAmount)}
377
+ onChangeText={(text) => {
378
+ setFieldValue('loanAmount', text.replaceAll(',', ''));
379
+ debounceCall(text);
380
+ }}
381
+ />
382
+ {errors && errors.loanAmount && (
383
+ <MText style={$error}>{errors.loanAmount}</MText>
384
+ )}
385
+ </View>
386
+ <View style={{ flex: 1 }}>
387
+ <MText style={$label}>Hình thức thanh toán</MText>
388
+ <TouchableOpacity
389
+ style={$select}
390
+ onPress={() => {
391
+ navigation.push(ScreenNames.MSelect, {
392
+ title: 'Chọn hình thức thanh toán',
393
+ data: appStore.listRateType,
394
+ callback: (value) => {
395
+ setFieldValue('rateTypeId', value?.id);
396
+ setFieldValue('loanTime', null);
397
+ },
398
+ });
399
+ }}
400
+ >
401
+ <MText
402
+ numberOfLines={1}
403
+ style={{
404
+ color: '#333333',
405
+ fontSize: 16,
406
+ fontWeight: '500',
407
+ flex: 1,
408
+ fontFamily: 'BeVietnamPro-Medium',
409
+ }}
410
+ >
411
+ {
412
+ appStore.listRateType?.find(
413
+ (x) => x?.id === values.rateTypeId
414
+ )?.name
415
+ }
416
+ </MText>
417
+ <DropDown2 />
418
+ </TouchableOpacity>
419
+ {errors && errors.rateTypeId && (
420
+ <MText style={$error}>{errors.rateTypeId}</MText>
421
+ )}
422
+ </View>
423
+ </View>
424
+ <MText style={$label}>Thời gian vay</MText>
425
+ <TouchableOpacity
426
+ style={$select}
427
+ onPress={() => {
428
+ navigation.push(ScreenNames.MSelect, {
429
+ title: 'Chọn thời gian vay',
430
+ data:
431
+ values.rateTypeId === 14
432
+ ? appStore.listLoanTime.filter((x) => x.id <= 12)
433
+ : appStore.listLoanTime,
434
+ callback: (value) => {
435
+ setFieldValue('loanTime', value?.id);
436
+ getInfoInsurence(
437
+ values.loanAmount,
438
+ value?.id,
439
+ values?.rateTypeId,
440
+ values.timeInsurenceCustomer?.id ?? 0,
441
+ values.timeInsuranceProperty?.id ?? 0
442
+ );
443
+ },
444
+ });
445
+ }}
446
+ >
447
+ <MText
448
+ numberOfLines={1}
449
+ style={{
450
+ color: '#333333',
451
+ fontSize: 16,
452
+ fontWeight: '500',
453
+ flex: 1,
454
+ fontFamily: 'BeVietnamPro-Medium',
455
+ }}
456
+ >
457
+ {values?.loanTime ? `${values?.loanTime} tháng` : ''}
458
+ </MText>
459
+ <DropDown2 />
460
+ </TouchableOpacity>
461
+ {errors && errors.loanTime && (
462
+ <MText style={$error}>{errors.loanTime}</MText>
463
+ )}
464
+ <MText style={[$label, { marginTop: 16 }]}>
465
+ Ngày thanh toán kỳ đầu
466
+ </MText>
467
+ <TouchableOpacity
468
+ style={$select}
469
+ onPress={() => {
470
+ navigation.push(ScreenNames.MSelect, {
471
+ title: 'Ngày thanh toán kỳ đầu',
472
+ data: ttsStore.listFirstPayment,
473
+ callback: (value) => {
474
+ setFieldValue('firstPaymentDate', value?.name);
475
+ },
476
+ });
477
+ }}
478
+ >
479
+ <MText
480
+ numberOfLines={1}
481
+ style={{
482
+ color: '#333333',
483
+ fontSize: 16,
484
+ fontWeight: '500',
485
+ flex: 1,
486
+ fontFamily: 'BeVietnamPro-Medium',
487
+ }}
488
+ >
489
+ {values?.firstPaymentDate}
490
+ </MText>
491
+ <DropDown2 />
492
+ </TouchableOpacity>
493
+ {errors && errors.firstPaymentDate && (
494
+ <MText style={$error}>{errors.firstPaymentDate}</MText>
495
+ )}
496
+
497
+ <View
498
+ style={{
499
+ backgroundColor: '#FFF8F2',
500
+ borderLeftWidth: 1,
501
+ borderRadius: 8,
502
+ padding: 16,
503
+ borderColor: color.primary,
504
+ marginTop: 10,
505
+ }}
506
+ >
507
+ <MText
508
+ style={{
509
+ color: color.primary,
510
+ fontWeight: 'bold',
511
+ }}
512
+ >
513
+ Bảo hiểm
514
+ </MText>
515
+ <View
516
+ style={{
517
+ flexDirection: 'row',
518
+ alignItems: 'center',
519
+ gap: 10,
520
+ marginTop: 10,
521
+ }}
522
+ >
523
+ <TouchableOpacity
524
+ onPress={() => {
525
+ setFieldValue(
526
+ 'buyInsurenceCustomer',
527
+ !values.buyInsurenceCustomer
528
+ );
529
+ }}
530
+ >
531
+ {values.buyInsurenceCustomer === true ? (
532
+ <CheckBoxActive />
533
+ ) : (
534
+ <CheckBox />
535
+ )}
536
+ </TouchableOpacity>
537
+ <View style={{ flex: 1 }}>
538
+ <MText
539
+ style={{
540
+ color: '#333333',
541
+ fontSize: 12,
542
+ fontWeight: 'bold',
543
+ }}
544
+ >
545
+ BH sức khoẻ người vay
546
+ </MText>
547
+ <MText
548
+ style={{
549
+ color: '#828282',
550
+ fontSize: 12,
551
+ marginTop: 5,
552
+ }}
553
+ >
554
+ Số tiền{' '}
555
+ <MText
556
+ style={{
557
+ fontSize: 12,
558
+ color: '#333333',
559
+ }}
560
+ >
561
+ {formatMoney(values.moneyInsurenceCustomer)} đ
562
+ </MText>
563
+ </MText>
564
+ </View>
565
+ <TouchableOpacity
566
+ onPress={() => {
567
+ navigation.push(ScreenNames.MSelect, {
568
+ title: 'Chọn thời gian',
569
+ data: appStore.listInsurenceTimeAll,
570
+ callback: (value) => {
571
+ setFieldValue('timeInsurenceCustomer', value);
572
+ getInfoInsurence(
573
+ values.loanAmount,
574
+ values.loanTime,
575
+ values?.rateTypeId,
576
+ value?.id,
577
+ values.timeInsuranceProperty?.id ?? 0
578
+ );
579
+ },
580
+ });
581
+ }}
582
+ style={{
583
+ backgroundColor: '#FFFFFF',
584
+ height: 40,
585
+ borderRadius: 6,
586
+ alignItems: 'center',
587
+ justifyContent: 'space-between',
588
+ flexDirection: 'row',
589
+ paddingHorizontal: 10,
590
+ borderWidth: 1,
591
+ borderColor: '#F5F5F5',
592
+ width: Dimensions.get('window').width / 3,
593
+ }}
594
+ >
595
+ <MText style={{ fontSize: 12, color: '#333333' }}>
596
+ {values.timeInsurenceCustomer?.name ??
597
+ 'Chọn thời gian'}
598
+ </MText>
599
+ <DropDown2 />
600
+ </TouchableOpacity>
601
+ </View>
602
+ <View
603
+ style={{
604
+ height: 1,
605
+ backgroundColor: '#EFEFEF',
606
+ marginVertical: 8,
607
+ }}
608
+ />
609
+ <View
610
+ style={{
611
+ flexDirection: 'row',
612
+ alignItems: 'center',
613
+ gap: 10,
614
+ marginTop: 10,
615
+ }}
616
+ >
617
+ <TouchableOpacity
618
+ onPress={() => {
619
+ setFieldValue(
620
+ 'buyInsuranceProperty',
621
+ !values.buyInsuranceProperty
622
+ );
623
+ }}
624
+ >
625
+ {values.buyInsuranceProperty === true ? (
626
+ <CheckBoxActive />
627
+ ) : (
628
+ <CheckBox />
629
+ )}
630
+ </TouchableOpacity>
631
+ <View style={{ flex: 1 }}>
632
+ <MText
633
+ style={{
634
+ color: '#333333',
635
+ fontSize: 12,
636
+ fontWeight: 'bold',
637
+ }}
638
+ >
639
+ BH vật chất
640
+ </MText>
641
+ <MText
642
+ style={{
643
+ color: '#828282',
644
+ fontSize: 12,
645
+ marginTop: 5,
646
+ }}
647
+ >
648
+ Số tiền{' '}
649
+ <MText
650
+ style={{
651
+ fontSize: 12,
652
+ color: '#333333',
653
+ }}
654
+ >
655
+ {formatMoney(values.moneyInsuranceProperty)} đ
656
+ </MText>
657
+ </MText>
658
+ </View>
659
+ <TouchableOpacity
660
+ onPress={() => {
661
+ navigation.push(ScreenNames.MSelect, {
662
+ title: 'Chọn thời gian',
663
+ data: appStore.listInsurenceTimeAll,
664
+ callback: (value) => {
665
+ setFieldValue('timeInsuranceProperty', value);
666
+ getInfoInsurence(
667
+ values.loanAmount,
668
+ values.loanTime,
669
+ values?.rateTypeId,
670
+ values?.timeInsurenceCustomer?.id ?? 0,
671
+ value?.id
672
+ );
673
+ },
674
+ });
675
+ }}
676
+ style={{
677
+ backgroundColor: '#FFFFFF',
678
+ height: 40,
679
+ borderRadius: 6,
680
+ alignItems: 'center',
681
+ justifyContent: 'space-between',
682
+ flexDirection: 'row',
683
+ paddingHorizontal: 10,
684
+ borderWidth: 1,
685
+ borderColor: '#F5F5F5',
686
+ width: Dimensions.get('window').width / 3,
687
+ }}
688
+ >
689
+ <MText style={{ fontSize: 12, color: '#333333' }}>
690
+ {values.timeInsuranceProperty?.name ??
691
+ 'Chọn thời gian'}
692
+ </MText>
693
+ <DropDown2 />
694
+ </TouchableOpacity>
695
+ </View>
696
+ <View
697
+ style={{
698
+ height: 1,
699
+ backgroundColor: '#BDBDBD',
700
+ marginVertical: 8,
701
+ }}
702
+ />
703
+ <View style={{ flexDirection: 'row', gap: 5 }}>
704
+ <Tick2 />
705
+ <MText
706
+ style={{
707
+ fontSize: 10,
708
+ color: '#828282',
709
+ }}
710
+ >
711
+ Quyền lợi bảo hiểm sức khoẻ lên tới 100% từ Bảo Minh
712
+ {'\n'}
713
+ (Tai nạn, thương tật,...)
714
+ </MText>
715
+ </View>
716
+ <View
717
+ style={{ marginTop: 8, flexDirection: 'row', gap: 5 }}
718
+ >
719
+ <Tick2 />
720
+ <MText
721
+ style={{
722
+ fontSize: 10,
723
+ color: '#828282',
724
+ }}
725
+ >
726
+ Quyền lợi bảo hiểm vật chất 100% từ Bảo Minh
727
+ </MText>
728
+ </View>
729
+ </View>
730
+
731
+ <MText style={[$title2, { marginTop: 10 }]}>
732
+ 1.2 Thông tin giải ngân
733
+ </MText>
734
+ <MText style={[$label, { color: 'rgba(125, 125, 125, 1)' }]}>
735
+ Ngân hàng
736
+ </MText>
737
+ <MText
738
+ style={{
739
+ color: 'rgba(51, 51, 51, 1)',
740
+ fontSize: 16,
741
+ fontWeight: '500',
742
+ flex: 1,
743
+ fontFamily: 'BeVietnamPro-Medium',
744
+ marginBottom: 16,
745
+ }}
746
+ >
747
+ {values?.bankName}
748
+ </MText>
749
+ <MText style={[$label, { color: 'rgba(125, 125, 125, 1)' }]}>
750
+ Tên chủ thẻ
751
+ </MText>
752
+ <MText
753
+ style={{
754
+ color: 'rgba(51, 51, 51, 1)',
755
+ fontSize: 16,
756
+ fontWeight: '500',
757
+ flex: 1,
758
+ fontFamily: 'BeVietnamPro-Medium',
759
+ marginBottom: 16,
760
+ }}
761
+ >
762
+ {values?.bankAccountName}
763
+ </MText>
764
+ <MText style={[$label, { color: 'rgba(125, 125, 125, 1)' }]}>
765
+ Số tài khoản
766
+ </MText>
767
+ <MText
768
+ style={{
769
+ color: 'rgba(51, 51, 51, 1)',
770
+ fontSize: 16,
771
+ fontWeight: '500',
772
+ flex: 1,
773
+ fontFamily: 'BeVietnamPro-Medium',
774
+ marginBottom: 16,
775
+ }}
776
+ >
777
+ {values?.bankAccountNumber}
778
+ </MText>
779
+ <MButton
780
+ onPress={() => {
781
+ handleSubmit();
782
+ }}
783
+ style={{
784
+ marginVertical: 24,
785
+ }}
786
+ >
787
+ <LinearGradient
788
+ start={{ x: 1, y: 0 }}
789
+ end={{ x: 0, y: 1 }}
790
+ style={{
791
+ height: 40,
792
+ borderRadius: 30,
793
+ alignItems: 'center',
794
+ justifyContent: 'center',
795
+ }}
796
+ colors={['#FF7A00', '#EF4123']}
797
+ >
798
+ <MText
799
+ style={{
800
+ color: 'white',
801
+ fontSize: 16,
802
+ }}
803
+ >
804
+ Xác nhận
805
+ </MText>
806
+ </LinearGradient>
807
+ </MButton>
808
+ </ScrollView>
809
+ </View>
810
+ )}
811
+ </Formik>
812
+ </View>
813
+ </View>
814
+ <Loading isLoading={isLoading} />
815
+ </View>
816
+ );
817
+ }
818
+
819
+ const $row: ViewStyle = {
820
+ flexDirection: 'row',
821
+ marginBottom: 16,
822
+ gap: 16,
823
+ };
824
+
825
+ const $textInput: ViewStyle = {
826
+ borderWidth: 1,
827
+ borderRadius: 4,
828
+ borderColor: '#E0E0E0',
829
+ height: 40,
830
+ paddingHorizontal: 8,
831
+ fontFamily: 'BeVietnamPro-Medium',
832
+ };
833
+
834
+ const $label: TextStyle = {
835
+ fontSize: 14,
836
+ color: '#333333',
837
+ paddingBottom: 5,
838
+ };
839
+
840
+ const $title2: TextStyle = {
841
+ fontSize: 16,
842
+ fontWeight: 'bold',
843
+ color: '#333333',
844
+ paddingBottom: 10,
845
+ marginTop: 6,
846
+ };
847
+
848
+ const $title: TextStyle = {
849
+ fontSize: 16,
850
+ fontWeight: 'bold',
851
+ color: '#333333',
852
+ position: 'absolute',
853
+ left: 0,
854
+ right: 0,
855
+ textAlign: 'center',
856
+ };
857
+ const $h: ViewStyle = {
858
+ backgroundColor: '#EF592E',
859
+ position: 'absolute',
860
+ height: 30,
861
+ width: '100%',
862
+ };
863
+
864
+ const $bg: ViewStyle = {
865
+ borderTopLeftRadius: 30,
866
+ borderTopRightRadius: 30,
867
+ backgroundColor: 'white',
868
+ flex: 1,
869
+ };
870
+
871
+ const $select: ViewStyle = {
872
+ flexDirection: 'row',
873
+ height: 40,
874
+ alignItems: 'center',
875
+ paddingHorizontal: 8,
876
+ borderWidth: 1,
877
+ borderRadius: 4,
878
+ borderColor: '#E0E0E0',
879
+ };
880
+
881
+ const $error: TextStyle = {
882
+ color: '#EB5757',
883
+ fontSize: 14,
884
+ fontStyle: 'italic',
885
+ fontFamily: 'BeVietnamPro-Thin',
886
+ fontWeight: '300',
887
+ marginTop: 5,
888
+ };