react-native-timacare 3.1.46 → 3.1.47

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