react-native-timacare 3.0.9 → 3.0.11-beta

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 (88) hide show
  1. package/lib/commonjs/AppStore.js +1 -1
  2. package/lib/commonjs/AppStore.js.flow +56 -0
  3. package/lib/commonjs/AppStore.js.map +1 -1
  4. package/lib/commonjs/assets/icons/add_info_disable.svg +3 -8
  5. package/lib/commonjs/assets/icons/index.js +1 -1
  6. package/lib/commonjs/assets/icons/index.js.flow +4 -0
  7. package/lib/commonjs/assets/icons/index.js.map +1 -1
  8. package/lib/commonjs/assets/icons/topup.svg +16 -0
  9. package/lib/commonjs/assets/icons/topup_success.svg +16 -0
  10. package/lib/commonjs/navigation/primary-navigator.js +1 -1
  11. package/lib/commonjs/navigation/primary-navigator.js.flow +9 -0
  12. package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
  13. package/lib/commonjs/screens/home/index.js +1 -1
  14. package/lib/commonjs/screens/home/index.js.flow +65 -0
  15. package/lib/commonjs/screens/home/index.js.map +1 -1
  16. package/lib/commonjs/screens/liveness/index.js +1 -1
  17. package/lib/commonjs/screens/liveness/index.js.flow +8 -8
  18. package/lib/commonjs/screens/liveness/index.js.map +1 -1
  19. package/lib/commonjs/screens/liveness-v2/index.js +1 -1
  20. package/lib/commonjs/screens/liveness-v2/index.js.flow +3 -1
  21. package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
  22. package/lib/commonjs/screens/loan/PreviewSchedulePaymentTopup.js +2 -0
  23. package/lib/commonjs/screens/loan/PreviewSchedulePaymentTopup.js.flow +304 -0
  24. package/lib/commonjs/screens/loan/PreviewSchedulePaymentTopup.js.map +1 -0
  25. package/lib/commonjs/screens/loan/UpdateLoan.js +2 -0
  26. package/lib/commonjs/screens/loan/UpdateLoan.js.flow +773 -0
  27. package/lib/commonjs/screens/loan/UpdateLoan.js.map +1 -0
  28. package/lib/commonjs/screens/register/index.js +1 -1
  29. package/lib/commonjs/screens/register/index.js.flow +1 -1
  30. package/lib/commonjs/services/api/api-config.js +1 -1
  31. package/lib/commonjs/services/api/api-config.js.flow +2 -2
  32. package/lib/commonjs/services/api/api-config.js.map +1 -1
  33. package/lib/commonjs/services/api/api.js +1 -1
  34. package/lib/commonjs/services/api/api.js.flow +136 -0
  35. package/lib/commonjs/services/api/api.js.map +1 -1
  36. package/lib/module/AppStore.js +1 -1
  37. package/lib/module/AppStore.js.map +1 -1
  38. package/lib/module/assets/icons/add_info_disable.svg +3 -8
  39. package/lib/module/assets/icons/index.js +1 -1
  40. package/lib/module/assets/icons/index.js.map +1 -1
  41. package/lib/module/assets/icons/topup.svg +16 -0
  42. package/lib/module/assets/icons/topup_success.svg +16 -0
  43. package/lib/module/navigation/primary-navigator.js +1 -1
  44. package/lib/module/navigation/primary-navigator.js.map +1 -1
  45. package/lib/module/screens/home/index.js +1 -1
  46. package/lib/module/screens/home/index.js.map +1 -1
  47. package/lib/module/screens/liveness/index.js +1 -1
  48. package/lib/module/screens/liveness/index.js.map +1 -1
  49. package/lib/module/screens/liveness-v2/index.js +1 -1
  50. package/lib/module/screens/liveness-v2/index.js.map +1 -1
  51. package/lib/module/screens/loan/PreviewSchedulePaymentTopup.js +2 -0
  52. package/lib/module/screens/loan/PreviewSchedulePaymentTopup.js.map +1 -0
  53. package/lib/module/screens/loan/UpdateLoan.js +2 -0
  54. package/lib/module/screens/loan/UpdateLoan.js.map +1 -0
  55. package/lib/module/screens/register/index.js +1 -1
  56. package/lib/module/services/api/api-config.js +1 -1
  57. package/lib/module/services/api/api-config.js.map +1 -1
  58. package/lib/module/services/api/api.js +1 -1
  59. package/lib/module/services/api/api.js.map +1 -1
  60. package/lib/typescript/AppStore.d.ts +8 -0
  61. package/lib/typescript/AppStore.d.ts.map +1 -1
  62. package/lib/typescript/assets/icons/index.d.ts +3 -1
  63. package/lib/typescript/assets/icons/index.d.ts.map +1 -1
  64. package/lib/typescript/navigation/primary-navigator.d.ts +1 -0
  65. package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
  66. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  67. package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
  68. package/lib/typescript/screens/loan/PreviewSchedulePaymentTopup.d.ts +2 -0
  69. package/lib/typescript/screens/loan/PreviewSchedulePaymentTopup.d.ts.map +1 -0
  70. package/lib/typescript/screens/loan/UpdateLoan.d.ts +2 -0
  71. package/lib/typescript/screens/loan/UpdateLoan.d.ts.map +1 -0
  72. package/lib/typescript/services/api/api.d.ts +128 -0
  73. package/lib/typescript/services/api/api.d.ts.map +1 -1
  74. package/package.json +1 -1
  75. package/src/AppStore.tsx +56 -0
  76. package/src/assets/icons/add_info_disable.svg +3 -8
  77. package/src/assets/icons/index.tsx +4 -0
  78. package/src/assets/icons/topup.svg +16 -0
  79. package/src/assets/icons/topup_success.svg +16 -0
  80. package/src/navigation/primary-navigator.tsx +9 -0
  81. package/src/screens/home/index.tsx +65 -0
  82. package/src/screens/liveness/index.tsx +8 -8
  83. package/src/screens/liveness-v2/index.tsx +3 -1
  84. package/src/screens/loan/PreviewSchedulePaymentTopup.tsx +304 -0
  85. package/src/screens/loan/UpdateLoan.tsx +773 -0
  86. package/src/screens/register/index.tsx +1 -1
  87. package/src/services/api/api-config.ts +2 -2
  88. package/src/services/api/api.ts +136 -0
@@ -0,0 +1,773 @@
1
+ //@ts-nocheck
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { observer } from 'mobx-react-lite';
4
+ import {
5
+ Alert,
6
+ Dimensions,
7
+ SafeAreaView,
8
+ ScrollView,
9
+ StyleSheet,
10
+ TextInput,
11
+ TouchableOpacity,
12
+ View,
13
+ } from 'react-native';
14
+ import MHeader from '../../components/MHeader';
15
+ import { useNavigation, StackActions } from '@react-navigation/native';
16
+ import LinearGradient from 'react-native-linear-gradient';
17
+ import { MText } from '../../components/MText';
18
+ import { Formik } from 'formik';
19
+ import { formatDDMMYYY, formatMoney } from '../../utils';
20
+ import { commonStyles } from '../CommonStyles';
21
+ import {
22
+ CheckBox,
23
+ CheckBoxActive,
24
+ DropDown2,
25
+ Tick2,
26
+ WarningIcon,
27
+ } from '../../assets/icons';
28
+ import { Api } from '../../services/api';
29
+ import Loading from '../../components/Loading';
30
+ import { color } from '../../theme';
31
+ import appStore from '../../AppStore';
32
+ import { ScreenNames } from '../../navigation';
33
+ import moment from 'moment';
34
+ import { debounce } from 'lodash';
35
+ import * as yup from 'yup';
36
+
37
+ export const UpdateLoan = observer(function UpdateLoan(props: any) {
38
+ const navigation = useNavigation();
39
+ const formRef = useRef(null);
40
+ const [isLoading, setIsLoading] = useState(false);
41
+ const [maximumAmount, setMaximumAmount] = useState(0);
42
+
43
+ const getData = async () => {
44
+ setIsLoading(true);
45
+ try {
46
+ const response = await Api.getInstance().getInfoUpdateTopup(
47
+ props.route.params.id
48
+ );
49
+ if (response.kind === 'ok') {
50
+ if (response.data?.meta?.errorCode === 200) {
51
+ setMaximumAmount(response.data.data?.loanAmount);
52
+ formRef.current?.setFieldValue(
53
+ 'loanAmount',
54
+ response.data.data?.loanAmount
55
+ );
56
+ formRef.current?.setFieldValue(
57
+ 'moneyInsurenceCustomer',
58
+ response.data.data?.moneyInsurenceCustomer
59
+ );
60
+ formRef.current?.setFieldValue(
61
+ 'moneyInsuranceProperty',
62
+ response.data.data?.moneyInsuranceProperty
63
+ );
64
+ formRef.current?.setFieldValue(
65
+ 'moneyInsurranceHospitalization',
66
+ response.data.data?.moneyInsurranceHospitalization
67
+ );
68
+ formRef.current?.setFieldValue(
69
+ 'buyInsurenceCustomer',
70
+ response.data.data?.buyInsurenceCustomer
71
+ );
72
+ formRef.current?.setFieldValue(
73
+ 'buyInsuranceProperty',
74
+ response.data.data?.buyInsuranceProperty
75
+ );
76
+ formRef.current?.setFieldValue(
77
+ 'buyInsurranceHospitalization',
78
+ response.data.data?.buyInsurranceHospitalization
79
+ );
80
+ const rateTypeId = appStore.listRateType.find(
81
+ (x) => x.id === response.data.data?.rateTypeId
82
+ );
83
+ formRef.current?.setFieldValue('rateTypeId', rateTypeId);
84
+ const loanTime = appStore.listLoanTime.find(
85
+ (x) => x.id === response.data.data?.loanTime
86
+ );
87
+ formRef.current?.setFieldValue('loanTime', loanTime);
88
+ const timeInsurenceCustomer = appStore.listInsurenceTimeAll.find(
89
+ (x) => x.id === response.data.data?.timeInsurenceCustomer
90
+ );
91
+ formRef.current?.setFieldValue(
92
+ 'timeInsurenceCustomer',
93
+ timeInsurenceCustomer
94
+ );
95
+ const timeInsuranceProperty = appStore.listInsurenceTimeAll.find(
96
+ (x) => x.id === response.data.data?.timeInsuranceProperty
97
+ );
98
+ formRef.current?.setFieldValue(
99
+ 'timeInsuranceProperty',
100
+ timeInsuranceProperty
101
+ );
102
+ formRef.current?.setFieldValue(
103
+ 'firstPaymentDate',
104
+ response.data.data?.firstPaymentDate
105
+ ? moment(response.data.data?.firstPaymentDate).format(
106
+ 'DD-MM-YYYY'
107
+ )
108
+ : null
109
+ );
110
+
111
+ appStore.getFirstDayPayment(response.data.data?.loanBriefId, 2);
112
+ } else {
113
+ Alert.alert('Thông báo', response.data?.meta?.errorMessage);
114
+ }
115
+ } else {
116
+ Alert.alert('Thông báo', 'Có lỗi xảy ra trong quá trình lấy dữ liệu');
117
+ }
118
+ } catch (error) {
119
+ console.error(error);
120
+ Alert.alert('Thông báo', 'Có lỗi xảy ra trong quá trình lấy dữ liệu');
121
+ } finally {
122
+ setIsLoading(false);
123
+ }
124
+ };
125
+
126
+ useEffect(() => {
127
+ if (props.route?.params) {
128
+ getData();
129
+ }
130
+ }, []);
131
+
132
+ const getInfoInsurence = async (
133
+ loanAmount,
134
+ loanTime,
135
+ rateTypeId,
136
+ timeInsurenceCustomer,
137
+ timeInsuranceProperty
138
+ ) => {
139
+ try {
140
+ const response = await Api.getInstance().getInfoInsurence(
141
+ props.route.params.id,
142
+ loanAmount,
143
+ loanTime,
144
+ rateTypeId,
145
+ timeInsurenceCustomer,
146
+ timeInsuranceProperty
147
+ );
148
+ if (response.kind === 'ok') {
149
+ if (response.data?.meta?.errorCode === 200) {
150
+ formRef.current?.setFieldValue(
151
+ 'moneyInsurenceCustomer',
152
+ response.data.data?.moneyInsurenceCustomer
153
+ );
154
+ formRef.current?.setFieldValue(
155
+ 'moneyInsuranceProperty',
156
+ response.data.data?.moneyInsuranceProperty
157
+ );
158
+ formRef.current?.setFieldValue(
159
+ 'moneyInsurranceHospitalization',
160
+ response.data.data?.moneyInsurranceHospitalization
161
+ );
162
+ } else {
163
+ Alert.alert('Thông báo', response.data?.meta?.errorMessage);
164
+ }
165
+ } else {
166
+ // Alert.alert('Thông báo', 'Có lỗi xảy ra trong quá trình lấy dữ liệu');
167
+ }
168
+ } catch (error) {}
169
+ };
170
+
171
+ const debounceCall = useCallback(
172
+ debounce((textParam) => {
173
+ getInfoInsurence(
174
+ Number(textParam.replace(/\D/g, '')),
175
+ formRef.current.values.loanTime?.id,
176
+ formRef.current.values?.rateTypeId?.id,
177
+ formRef.current.values.timeInsurenceCustomer?.id,
178
+ formRef.current.values.timeInsuranceProperty?.id
179
+ );
180
+ }, 500),
181
+ []
182
+ );
183
+
184
+ const onSubmit = async (values) => {
185
+ try {
186
+ const body = {
187
+ loanBriefId: props.route.params.id,
188
+ loanAmount: values?.loanAmount,
189
+ rateTypeId: values.rateTypeId?.id,
190
+ loanTime: values?.loanTime?.id,
191
+ firstPaymentDate: moment(values.firstPaymentDate, 'DD-MM-YYYY').format(
192
+ 'YYYY-MM-DD'
193
+ ),
194
+ buyInsurenceCustomer: values.buyInsurenceCustomer,
195
+ buyInsuranceProperty: values.buyInsuranceProperty,
196
+ buyInsurranceHospitalization: values.buyInsurranceHospitalization,
197
+ timeInsurenceCustomer: values.timeInsurenceCustomer?.id,
198
+ timeInsuranceProperty: values.timeInsuranceProperty?.id,
199
+ moneyInsurenceCustomer: values.moneyInsurenceCustomer,
200
+ moneyInsuranceProperty: values.moneyInsuranceProperty,
201
+ moneyInsurranceHospitalization: values.moneyInsurranceHospitalization,
202
+ };
203
+ const response = await Api.getInstance().updateInfoTopup(body);
204
+ if (response.kind === 'ok') {
205
+ if (response.data?.meta?.errorCode === 200) {
206
+ Alert.alert('Thông báo', 'Cập nhật thông tin thành công', [
207
+ {
208
+ text: 'Đồng ý',
209
+ onPress: () => {
210
+ navigation.dispatch(
211
+ StackActions.replace(
212
+ ScreenNames.PreviewSchedulePaymentTopup,
213
+ {
214
+ id: props.route.params.id,
215
+ isUpdate: true,
216
+ }
217
+ )
218
+ );
219
+ },
220
+ },
221
+ ]);
222
+ } else {
223
+ Alert.alert('Thông báo', response.data?.meta?.errorMessage);
224
+ }
225
+ } else {
226
+ Alert.alert('Thông báo', 'Có lỗi xảy ra trong quá trình cập nhật');
227
+ }
228
+ } catch (error) {
229
+ console.error(error);
230
+ Alert.alert('Thông báo', 'Có lỗi xảy ra trong quá trình cập nhật');
231
+ }
232
+ };
233
+ return (
234
+ <View style={{ flex: 1, backgroundColor: '#FDFDFD' }}>
235
+ <MHeader
236
+ title={`Cập nhật thông tin`}
237
+ onBack={() => navigation.goBack()}
238
+ />
239
+ <SafeAreaView style={{ flex: 1 }}>
240
+ <ScrollView>
241
+ <Formik
242
+ onSubmit={onSubmit}
243
+ innerRef={formRef}
244
+ initialValues={{
245
+ loanAmount: 0,
246
+ moneyInsurenceCustomer: 0,
247
+ moneyInsuranceProperty: 0,
248
+ moneyInsurranceHospitalization: 0,
249
+ buyInsurenceCustomer: false,
250
+ buyInsuranceProperty: false,
251
+ buyInsurranceHospitalization: false,
252
+ rateTypeId: null,
253
+ loanTime: null,
254
+ firstPaymentDate: null,
255
+ timeInsurenceCustomer: null,
256
+ timeInsuranceProperty: null,
257
+ }}
258
+ validationSchema={yup.object().shape({
259
+ firstPaymentDate: yup
260
+ .string()
261
+ .required('Vui lòng chọn ngày thanh toán'),
262
+ })}
263
+ >
264
+ {({ values, handleChange, setFieldValue, errors }) => {
265
+ return (
266
+ <View style={{ padding: 16 }}>
267
+ <MText style={[commonStyles.textNormal]}>Chọn số tiền</MText>
268
+ <TextInput
269
+ style={[styles.input, { color: color.primary }]}
270
+ value={formatMoney(values.loanAmount)}
271
+ onChangeText={(text) => {
272
+ setFieldValue(
273
+ 'loanAmount',
274
+ Number(text.replace(/\D/g, ''))
275
+ );
276
+ debounceCall(text);
277
+ }}
278
+ keyboardType="numeric"
279
+ />
280
+ <View
281
+ style={{
282
+ backgroundColor: '#FFEBEB',
283
+ marginTop: 8,
284
+ padding: 8,
285
+ borderRadius: 4,
286
+ flexDirection: 'row',
287
+ alignItems: 'center',
288
+ gap: 8,
289
+ }}
290
+ >
291
+ <WarningIcon />
292
+ <MText
293
+ style={{
294
+ color: '#333333',
295
+ fontSize: 12,
296
+ }}
297
+ >
298
+ Số tiền vay tối đa {formatMoney(maximumAmount)}đ
299
+ </MText>
300
+ </View>
301
+
302
+ <MText style={[commonStyles.textNormal, { marginTop: 16 }]}>
303
+ Hình thức thanh toán
304
+ </MText>
305
+ <TouchableOpacity
306
+ onPress={() => {
307
+ navigation.dispatch(
308
+ StackActions.push(ScreenNames.CommonSelect, {
309
+ title: 'Chọn hình thức thanh toán',
310
+ data: appStore.listRateType,
311
+ callback: (value) => {
312
+ setFieldValue('rateTypeId', value);
313
+ getInfoInsurence(
314
+ values.loanAmount,
315
+ values.loanTime?.id,
316
+ value?.id,
317
+ values.timeInsurenceCustomer?.id,
318
+ values.timeInsuranceProperty?.id
319
+ );
320
+ },
321
+ })
322
+ );
323
+ }}
324
+ style={[
325
+ styles.input,
326
+ {
327
+ justifyContent: 'space-between',
328
+ flexDirection: 'row',
329
+ alignItems: 'center',
330
+ },
331
+ ]}
332
+ >
333
+ <MText
334
+ style={[commonStyles.textNormalBold]}
335
+ numberOfLines={1}
336
+ >
337
+ {values?.rateTypeId?.name}
338
+ </MText>
339
+ <DropDown2 />
340
+ </TouchableOpacity>
341
+
342
+ <MText style={[commonStyles.textNormal, { marginTop: 16 }]}>
343
+ Thời gian vay
344
+ </MText>
345
+ <TouchableOpacity
346
+ onPress={() => {
347
+ navigation.dispatch(
348
+ StackActions.push(ScreenNames.CommonSelect, {
349
+ title: 'Chọn thời gian vay',
350
+ data: appStore.listLoanTime,
351
+ callback: (value) => {
352
+ setFieldValue('loanTime', value);
353
+ getInfoInsurence(
354
+ values.loanAmount,
355
+ value?.id,
356
+ values?.rateTypeId?.id,
357
+ values.timeInsurenceCustomer?.id,
358
+ values.timeInsuranceProperty?.id
359
+ );
360
+ },
361
+ })
362
+ );
363
+ }}
364
+ style={[
365
+ styles.input,
366
+ {
367
+ justifyContent: 'space-between',
368
+ flexDirection: 'row',
369
+ alignItems: 'center',
370
+ },
371
+ ]}
372
+ >
373
+ <MText
374
+ style={[commonStyles.textNormalBold]}
375
+ numberOfLines={1}
376
+ >
377
+ {values?.loanTime?.name}
378
+ </MText>
379
+ <DropDown2 />
380
+ </TouchableOpacity>
381
+
382
+ <View
383
+ style={{
384
+ backgroundColor: '#FFF8F2',
385
+ marginTop: 16,
386
+ borderRadius: 8,
387
+ padding: 16,
388
+ borderLeftWidth: 1,
389
+ borderLeftColor: '#EF592E',
390
+ }}
391
+ >
392
+ <MText
393
+ style={{
394
+ color: '#EF592E',
395
+ fontWeight: 'bold',
396
+ }}
397
+ >
398
+ Phí khác
399
+ </MText>
400
+ <View
401
+ style={{
402
+ flexDirection: 'row',
403
+ alignItems: 'center',
404
+ gap: 10,
405
+ marginTop: 10,
406
+ }}
407
+ >
408
+ <TouchableOpacity
409
+ onPress={() => {
410
+ setFieldValue(
411
+ 'buyInsurenceCustomer',
412
+ !values.buyInsurenceCustomer
413
+ );
414
+ }}
415
+ >
416
+ {values.buyInsurenceCustomer ? (
417
+ <CheckBoxActive />
418
+ ) : (
419
+ <CheckBox />
420
+ )}
421
+ </TouchableOpacity>
422
+ <View style={{ flex: 1 }}>
423
+ <MText
424
+ style={{
425
+ color: '#333333',
426
+ fontSize: 12,
427
+ fontWeight: 'bold',
428
+ }}
429
+ >
430
+ BH sức khoẻ người vay
431
+ </MText>
432
+ <MText
433
+ style={{
434
+ color: '#828282',
435
+ fontSize: 12,
436
+ marginTop: 5,
437
+ }}
438
+ >
439
+ Số tiền{' '}
440
+ <MText
441
+ style={{
442
+ fontSize: 12,
443
+ color: '#333333',
444
+ }}
445
+ >
446
+ {formatMoney(values.moneyInsurenceCustomer)}đ
447
+ </MText>
448
+ </MText>
449
+ </View>
450
+ <TouchableOpacity
451
+ onPress={() => {
452
+ navigation.dispatch(
453
+ StackActions.push(ScreenNames.CommonSelect, {
454
+ title: 'Chọn thời gian',
455
+ data: appStore.listInsurenceTimeAll,
456
+ callback: (value) => {
457
+ setFieldValue('timeInsurenceCustomer', value);
458
+ getInfoInsurence(
459
+ values.loanAmount,
460
+ values.loanTime?.id,
461
+ values?.rateTypeId?.id,
462
+ value?.id,
463
+ values.timeInsuranceProperty?.id
464
+ );
465
+ },
466
+ })
467
+ );
468
+ }}
469
+ style={{
470
+ backgroundColor: '#FFFFFF',
471
+ height: 40,
472
+ borderRadius: 6,
473
+ alignItems: 'center',
474
+ justifyContent: 'space-between',
475
+ flexDirection: 'row',
476
+ paddingHorizontal: 10,
477
+ borderWidth: 1,
478
+ borderColor: '#F5F5F5',
479
+ width: Dimensions.get('window').width / 3,
480
+ }}
481
+ >
482
+ <MText style={{ fontSize: 12, color: '#333333' }}>
483
+ {values.timeInsurenceCustomer?.name}
484
+ </MText>
485
+ <DropDown2 />
486
+ </TouchableOpacity>
487
+ </View>
488
+ <View
489
+ style={{
490
+ height: 1,
491
+ backgroundColor: '#EFEFEF',
492
+ marginVertical: 8,
493
+ }}
494
+ />
495
+ <View
496
+ style={{
497
+ flexDirection: 'row',
498
+ alignItems: 'center',
499
+ gap: 10,
500
+ }}
501
+ >
502
+ <TouchableOpacity
503
+ onPress={() => {
504
+ setFieldValue(
505
+ 'buyInsuranceProperty',
506
+ !values.buyInsuranceProperty
507
+ );
508
+ }}
509
+ >
510
+ {values.buyInsuranceProperty ? (
511
+ <CheckBoxActive />
512
+ ) : (
513
+ <CheckBox />
514
+ )}
515
+ </TouchableOpacity>
516
+ <View style={{ flex: 1 }}>
517
+ <MText
518
+ style={{
519
+ color: '#333333',
520
+ fontSize: 12,
521
+ fontWeight: 'bold',
522
+ }}
523
+ >
524
+ Bảo hiểm vật chất
525
+ </MText>
526
+ <MText
527
+ style={{
528
+ color: '#828282',
529
+ fontSize: 12,
530
+ marginTop: 5,
531
+ }}
532
+ >
533
+ Số tiền{' '}
534
+ <MText
535
+ style={{
536
+ fontSize: 12,
537
+ color: '#333333',
538
+ }}
539
+ >
540
+ {formatMoney(values.moneyInsuranceProperty)}đ
541
+ </MText>
542
+ </MText>
543
+ </View>
544
+ <TouchableOpacity
545
+ onPress={() => {
546
+ navigation.dispatch(
547
+ StackActions.push(ScreenNames.CommonSelect, {
548
+ title: 'Chọn thời gian',
549
+ data: appStore.listInsurenceTimeAll,
550
+ callback: (value) => {
551
+ setFieldValue('timeInsuranceProperty', value);
552
+ getInfoInsurence(
553
+ values.loanAmount,
554
+ values.loanTime?.id,
555
+ values?.rateTypeId?.id,
556
+ values?.timeInsurenceCustomer?.id,
557
+ value?.id
558
+ );
559
+ },
560
+ })
561
+ );
562
+ }}
563
+ style={{
564
+ backgroundColor: '#FFFFFF',
565
+ height: 40,
566
+ borderRadius: 6,
567
+ alignItems: 'center',
568
+ justifyContent: 'space-between',
569
+ flexDirection: 'row',
570
+ paddingHorizontal: 10,
571
+ borderWidth: 1,
572
+ borderColor: '#F5F5F5',
573
+ width: Dimensions.get('window').width / 3,
574
+ }}
575
+ >
576
+ <MText style={{ fontSize: 12, color: '#333333' }}>
577
+ {values.timeInsuranceProperty?.name}
578
+ </MText>
579
+ <DropDown2 />
580
+ </TouchableOpacity>
581
+ </View>
582
+ <View
583
+ style={{
584
+ height: 1,
585
+ backgroundColor: '#EFEFEF',
586
+ marginVertical: 8,
587
+ }}
588
+ />
589
+ <View
590
+ style={{
591
+ flexDirection: 'row',
592
+ alignItems: 'center',
593
+ gap: 10,
594
+ }}
595
+ >
596
+ <TouchableOpacity
597
+ onPress={() => {
598
+ setFieldValue(
599
+ 'buyInsurranceHospitalization',
600
+ !values.buyInsurranceHospitalization
601
+ );
602
+ }}
603
+ >
604
+ {values.buyInsurranceHospitalization ? (
605
+ <CheckBoxActive />
606
+ ) : (
607
+ <CheckBox />
608
+ )}
609
+ </TouchableOpacity>
610
+ <View>
611
+ <MText
612
+ style={{
613
+ color: '#333333',
614
+ fontSize: 12,
615
+ fontWeight: 'bold',
616
+ }}
617
+ >
618
+ BH trợ cấp nằm viện
619
+ </MText>
620
+ <MText
621
+ style={{
622
+ color: '#828282',
623
+ fontSize: 12,
624
+ marginTop: 5,
625
+ }}
626
+ >
627
+ Số tiền{' '}
628
+ <MText
629
+ style={{
630
+ fontSize: 12,
631
+ color: '#333333',
632
+ }}
633
+ >
634
+ {formatMoney(values.moneyInsurranceHospitalization)}
635
+ đ
636
+ </MText>
637
+ </MText>
638
+ </View>
639
+ </View>
640
+ <View
641
+ style={{
642
+ height: 1,
643
+ backgroundColor: '#BDBDBD',
644
+ marginVertical: 8,
645
+ }}
646
+ />
647
+ <View style={{ flexDirection: 'row', gap: 5 }}>
648
+ <Tick2 />
649
+ <MText
650
+ style={{
651
+ fontSize: 10,
652
+ color: '#828282',
653
+ }}
654
+ >
655
+ Quyền lợi bảo hiểm sức khoẻ lên tới 100% từ Bảo Minh
656
+ {'\n'}
657
+ (Tai nạn, thương tật,...)
658
+ </MText>
659
+ </View>
660
+ <View
661
+ style={{ marginTop: 8, flexDirection: 'row', gap: 5 }}
662
+ >
663
+ <Tick2 />
664
+ <MText
665
+ style={{
666
+ fontSize: 10,
667
+ color: '#828282',
668
+ }}
669
+ >
670
+ Quyền lợi bảo hiểm vật chất 100% từ Bảo Minh
671
+ </MText>
672
+ </View>
673
+ </View>
674
+
675
+ <MText style={[commonStyles.textNormal, { marginTop: 16 }]}>
676
+ Chọn lịch thanh toán
677
+ </MText>
678
+ <TouchableOpacity
679
+ onPress={() => {
680
+ navigation.dispatch(
681
+ StackActions.push(ScreenNames.CommonSelect, {
682
+ title: 'Chọn ngày thanh toán',
683
+ data: appStore.listFirstDayPayment.map(
684
+ (x, index) => ({
685
+ id: index + 1,
686
+ name: x,
687
+ })
688
+ ),
689
+ callback: (value) => {
690
+ setFieldValue('firstPaymentDate', value.name);
691
+ },
692
+ })
693
+ );
694
+ }}
695
+ style={[
696
+ styles.input,
697
+ {
698
+ justifyContent: 'space-between',
699
+ flexDirection: 'row',
700
+ alignItems: 'center',
701
+ },
702
+ ]}
703
+ >
704
+ <MText
705
+ style={[commonStyles.textNormalBold]}
706
+ numberOfLines={1}
707
+ >
708
+ {values?.firstPaymentDate}
709
+ </MText>
710
+ <DropDown2 />
711
+ </TouchableOpacity>
712
+ {errors && errors.firstPaymentDate && (
713
+ <MText
714
+ style={{
715
+ fontSize: 12,
716
+ color: 'red',
717
+ fontStyle: 'italic',
718
+ marginTop: 5,
719
+ }}
720
+ >
721
+ {errors.firstPaymentDate}
722
+ </MText>
723
+ )}
724
+ </View>
725
+ );
726
+ }}
727
+ </Formik>
728
+ </ScrollView>
729
+ <TouchableOpacity
730
+ onPress={formRef.current?.handleSubmit}
731
+ style={{
732
+ marginHorizontal: 16,
733
+ marginVertical: 16,
734
+ }}
735
+ >
736
+ <LinearGradient
737
+ colors={['#FF7A00', '#EF4123']}
738
+ style={{
739
+ alignItems: 'center',
740
+ borderRadius: 30,
741
+ height: 40,
742
+ justifyContent: 'center',
743
+ }}
744
+ >
745
+ <MText
746
+ style={{
747
+ color: 'white',
748
+ fontSize: 16,
749
+ }}
750
+ >
751
+ Cập nhật
752
+ </MText>
753
+ </LinearGradient>
754
+ </TouchableOpacity>
755
+ </SafeAreaView>
756
+ <Loading isLoading={isLoading} />
757
+ </View>
758
+ );
759
+ });
760
+ const styles = StyleSheet.create({
761
+ input: {
762
+ height: 40,
763
+ marginVertical: 0,
764
+ borderWidth: 0.5,
765
+ borderColor: '#E0E0E0',
766
+ borderRadius: 4,
767
+ marginTop: 8,
768
+ paddingHorizontal: 10,
769
+ fontFamily: 'Roboto',
770
+ color: '#333333',
771
+ fontWeight: 'bold',
772
+ },
773
+ });