react-native-timacare 3.0.10 → 3.0.12-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 (81) 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/assets/img/selfie.png +0 -0
  11. package/lib/commonjs/assets/img/selfie.webp +0 -0
  12. package/lib/commonjs/navigation/primary-navigator.js +1 -1
  13. package/lib/commonjs/navigation/primary-navigator.js.flow +9 -0
  14. package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
  15. package/lib/commonjs/screens/home/index.js +1 -1
  16. package/lib/commonjs/screens/home/index.js.flow +130 -66
  17. package/lib/commonjs/screens/home/index.js.map +1 -1
  18. package/lib/commonjs/screens/loan/PreviewSchedulePaymentTopup.js +2 -0
  19. package/lib/commonjs/screens/loan/PreviewSchedulePaymentTopup.js.flow +304 -0
  20. package/lib/commonjs/screens/loan/PreviewSchedulePaymentTopup.js.map +1 -0
  21. package/lib/commonjs/screens/loan/UpdateLoan.js +2 -0
  22. package/lib/commonjs/screens/loan/UpdateLoan.js.flow +791 -0
  23. package/lib/commonjs/screens/loan/UpdateLoan.js.map +1 -0
  24. package/lib/commonjs/screens/register/index.js +1 -1
  25. package/lib/commonjs/screens/register/index.js.flow +1 -1
  26. package/lib/commonjs/services/api/api-config.js +1 -1
  27. package/lib/commonjs/services/api/api-config.js.flow +2 -2
  28. package/lib/commonjs/services/api/api-config.js.map +1 -1
  29. package/lib/commonjs/services/api/api.js +1 -1
  30. package/lib/commonjs/services/api/api.js.flow +136 -0
  31. package/lib/commonjs/services/api/api.js.map +1 -1
  32. package/lib/module/AppStore.js +1 -1
  33. package/lib/module/AppStore.js.map +1 -1
  34. package/lib/module/assets/icons/add_info_disable.svg +3 -8
  35. package/lib/module/assets/icons/index.js +1 -1
  36. package/lib/module/assets/icons/index.js.map +1 -1
  37. package/lib/module/assets/icons/topup.svg +16 -0
  38. package/lib/module/assets/icons/topup_success.svg +16 -0
  39. package/lib/module/assets/img/selfie.png +0 -0
  40. package/lib/module/assets/img/selfie.webp +0 -0
  41. package/lib/module/navigation/primary-navigator.js +1 -1
  42. package/lib/module/navigation/primary-navigator.js.map +1 -1
  43. package/lib/module/screens/home/index.js +1 -1
  44. package/lib/module/screens/home/index.js.map +1 -1
  45. package/lib/module/screens/loan/PreviewSchedulePaymentTopup.js +2 -0
  46. package/lib/module/screens/loan/PreviewSchedulePaymentTopup.js.map +1 -0
  47. package/lib/module/screens/loan/UpdateLoan.js +2 -0
  48. package/lib/module/screens/loan/UpdateLoan.js.map +1 -0
  49. package/lib/module/screens/register/index.js +1 -1
  50. package/lib/module/services/api/api-config.js +1 -1
  51. package/lib/module/services/api/api-config.js.map +1 -1
  52. package/lib/module/services/api/api.js +1 -1
  53. package/lib/module/services/api/api.js.map +1 -1
  54. package/lib/typescript/AppStore.d.ts +8 -0
  55. package/lib/typescript/AppStore.d.ts.map +1 -1
  56. package/lib/typescript/assets/icons/index.d.ts +3 -1
  57. package/lib/typescript/assets/icons/index.d.ts.map +1 -1
  58. package/lib/typescript/navigation/primary-navigator.d.ts +1 -0
  59. package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
  60. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  61. package/lib/typescript/screens/loan/PreviewSchedulePaymentTopup.d.ts +2 -0
  62. package/lib/typescript/screens/loan/PreviewSchedulePaymentTopup.d.ts.map +1 -0
  63. package/lib/typescript/screens/loan/UpdateLoan.d.ts +2 -0
  64. package/lib/typescript/screens/loan/UpdateLoan.d.ts.map +1 -0
  65. package/lib/typescript/services/api/api.d.ts +128 -0
  66. package/lib/typescript/services/api/api.d.ts.map +1 -1
  67. package/package.json +1 -1
  68. package/src/AppStore.tsx +56 -0
  69. package/src/assets/icons/add_info_disable.svg +3 -8
  70. package/src/assets/icons/index.tsx +4 -0
  71. package/src/assets/icons/topup.svg +16 -0
  72. package/src/assets/icons/topup_success.svg +16 -0
  73. package/src/assets/img/selfie.png +0 -0
  74. package/src/assets/img/selfie.webp +0 -0
  75. package/src/navigation/primary-navigator.tsx +9 -0
  76. package/src/screens/home/index.tsx +130 -66
  77. package/src/screens/loan/PreviewSchedulePaymentTopup.tsx +304 -0
  78. package/src/screens/loan/UpdateLoan.tsx +791 -0
  79. package/src/screens/register/index.tsx +1 -1
  80. package/src/services/api/api-config.ts +2 -2
  81. package/src/services/api/api.ts +136 -0
@@ -0,0 +1,791 @@
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
+ .nullable(),
263
+ loanAmount: yup
264
+ .number()
265
+ .required('Vui lòng nhập số tiền')
266
+ .min(1, 'Số tiền không hợp lệ')
267
+ .nullable(),
268
+ })}
269
+ >
270
+ {({ values, handleChange, setFieldValue, errors }) => {
271
+ return (
272
+ <View style={{ padding: 16 }}>
273
+ <MText style={[commonStyles.textNormal]}>Chọn số tiền</MText>
274
+ <TextInput
275
+ style={[styles.input, { color: color.primary }]}
276
+ value={formatMoney(values.loanAmount)}
277
+ onChangeText={(text) => {
278
+ setFieldValue(
279
+ 'loanAmount',
280
+ Number(text.replace(/\D/g, ''))
281
+ );
282
+ debounceCall(text);
283
+ }}
284
+ keyboardType="numeric"
285
+ />
286
+ {errors && errors.loanAmount && (
287
+ <MText
288
+ style={{
289
+ fontSize: 12,
290
+ color: 'red',
291
+ fontStyle: 'italic',
292
+ marginTop: 5,
293
+ }}
294
+ >
295
+ {errors.loanAmount}
296
+ </MText>
297
+ )}
298
+ <View
299
+ style={{
300
+ backgroundColor: '#FFEBEB',
301
+ marginTop: 8,
302
+ padding: 8,
303
+ borderRadius: 4,
304
+ flexDirection: 'row',
305
+ alignItems: 'center',
306
+ gap: 8,
307
+ }}
308
+ >
309
+ <WarningIcon />
310
+ <MText
311
+ style={{
312
+ color: '#333333',
313
+ fontSize: 12,
314
+ }}
315
+ >
316
+ Số tiền vay tối đa {formatMoney(maximumAmount)}đ
317
+ </MText>
318
+ </View>
319
+
320
+ <MText style={[commonStyles.textNormal, { marginTop: 16 }]}>
321
+ Hình thức thanh toán
322
+ </MText>
323
+ <TouchableOpacity
324
+ onPress={() => {
325
+ navigation.dispatch(
326
+ StackActions.push(ScreenNames.CommonSelect, {
327
+ title: 'Chọn hình thức thanh toán',
328
+ data: appStore.listRateType,
329
+ callback: (value) => {
330
+ setFieldValue('rateTypeId', value);
331
+ getInfoInsurence(
332
+ values.loanAmount,
333
+ values.loanTime?.id,
334
+ value?.id,
335
+ values.timeInsurenceCustomer?.id,
336
+ values.timeInsuranceProperty?.id
337
+ );
338
+ },
339
+ })
340
+ );
341
+ }}
342
+ style={[
343
+ styles.input,
344
+ {
345
+ justifyContent: 'space-between',
346
+ flexDirection: 'row',
347
+ alignItems: 'center',
348
+ },
349
+ ]}
350
+ >
351
+ <MText
352
+ style={[commonStyles.textNormalBold]}
353
+ numberOfLines={1}
354
+ >
355
+ {values?.rateTypeId?.name}
356
+ </MText>
357
+ <DropDown2 />
358
+ </TouchableOpacity>
359
+
360
+ <MText style={[commonStyles.textNormal, { marginTop: 16 }]}>
361
+ Thời gian vay
362
+ </MText>
363
+ <TouchableOpacity
364
+ onPress={() => {
365
+ navigation.dispatch(
366
+ StackActions.push(ScreenNames.CommonSelect, {
367
+ title: 'Chọn thời gian vay',
368
+ data: appStore.listLoanTime,
369
+ callback: (value) => {
370
+ setFieldValue('loanTime', value);
371
+ getInfoInsurence(
372
+ values.loanAmount,
373
+ value?.id,
374
+ values?.rateTypeId?.id,
375
+ values.timeInsurenceCustomer?.id,
376
+ values.timeInsuranceProperty?.id
377
+ );
378
+ },
379
+ })
380
+ );
381
+ }}
382
+ style={[
383
+ styles.input,
384
+ {
385
+ justifyContent: 'space-between',
386
+ flexDirection: 'row',
387
+ alignItems: 'center',
388
+ },
389
+ ]}
390
+ >
391
+ <MText
392
+ style={[commonStyles.textNormalBold]}
393
+ numberOfLines={1}
394
+ >
395
+ {values?.loanTime?.name}
396
+ </MText>
397
+ <DropDown2 />
398
+ </TouchableOpacity>
399
+
400
+ <View
401
+ style={{
402
+ backgroundColor: '#FFF8F2',
403
+ marginTop: 16,
404
+ borderRadius: 8,
405
+ padding: 16,
406
+ borderLeftWidth: 1,
407
+ borderLeftColor: '#EF592E',
408
+ }}
409
+ >
410
+ <MText
411
+ style={{
412
+ color: '#EF592E',
413
+ fontWeight: 'bold',
414
+ }}
415
+ >
416
+ Phí khác
417
+ </MText>
418
+ <View
419
+ style={{
420
+ flexDirection: 'row',
421
+ alignItems: 'center',
422
+ gap: 10,
423
+ marginTop: 10,
424
+ }}
425
+ >
426
+ <TouchableOpacity
427
+ onPress={() => {
428
+ setFieldValue(
429
+ 'buyInsurenceCustomer',
430
+ !values.buyInsurenceCustomer
431
+ );
432
+ }}
433
+ >
434
+ {values.buyInsurenceCustomer ? (
435
+ <CheckBoxActive />
436
+ ) : (
437
+ <CheckBox />
438
+ )}
439
+ </TouchableOpacity>
440
+ <View style={{ flex: 1 }}>
441
+ <MText
442
+ style={{
443
+ color: '#333333',
444
+ fontSize: 12,
445
+ fontWeight: 'bold',
446
+ }}
447
+ >
448
+ BH sức khoẻ người vay
449
+ </MText>
450
+ <MText
451
+ style={{
452
+ color: '#828282',
453
+ fontSize: 12,
454
+ marginTop: 5,
455
+ }}
456
+ >
457
+ Số tiền{' '}
458
+ <MText
459
+ style={{
460
+ fontSize: 12,
461
+ color: '#333333',
462
+ }}
463
+ >
464
+ {formatMoney(values.moneyInsurenceCustomer)}đ
465
+ </MText>
466
+ </MText>
467
+ </View>
468
+ <TouchableOpacity
469
+ onPress={() => {
470
+ navigation.dispatch(
471
+ StackActions.push(ScreenNames.CommonSelect, {
472
+ title: 'Chọn thời gian',
473
+ data: appStore.listInsurenceTimeAll,
474
+ callback: (value) => {
475
+ setFieldValue('timeInsurenceCustomer', value);
476
+ getInfoInsurence(
477
+ values.loanAmount,
478
+ values.loanTime?.id,
479
+ values?.rateTypeId?.id,
480
+ value?.id,
481
+ values.timeInsuranceProperty?.id
482
+ );
483
+ },
484
+ })
485
+ );
486
+ }}
487
+ style={{
488
+ backgroundColor: '#FFFFFF',
489
+ height: 40,
490
+ borderRadius: 6,
491
+ alignItems: 'center',
492
+ justifyContent: 'space-between',
493
+ flexDirection: 'row',
494
+ paddingHorizontal: 10,
495
+ borderWidth: 1,
496
+ borderColor: '#F5F5F5',
497
+ width: Dimensions.get('window').width / 3,
498
+ }}
499
+ >
500
+ <MText style={{ fontSize: 12, color: '#333333' }}>
501
+ {values.timeInsurenceCustomer?.name}
502
+ </MText>
503
+ <DropDown2 />
504
+ </TouchableOpacity>
505
+ </View>
506
+ <View
507
+ style={{
508
+ height: 1,
509
+ backgroundColor: '#EFEFEF',
510
+ marginVertical: 8,
511
+ }}
512
+ />
513
+ <View
514
+ style={{
515
+ flexDirection: 'row',
516
+ alignItems: 'center',
517
+ gap: 10,
518
+ }}
519
+ >
520
+ <TouchableOpacity
521
+ onPress={() => {
522
+ setFieldValue(
523
+ 'buyInsuranceProperty',
524
+ !values.buyInsuranceProperty
525
+ );
526
+ }}
527
+ >
528
+ {values.buyInsuranceProperty ? (
529
+ <CheckBoxActive />
530
+ ) : (
531
+ <CheckBox />
532
+ )}
533
+ </TouchableOpacity>
534
+ <View style={{ flex: 1 }}>
535
+ <MText
536
+ style={{
537
+ color: '#333333',
538
+ fontSize: 12,
539
+ fontWeight: 'bold',
540
+ }}
541
+ >
542
+ Bảo hiểm vật chất
543
+ </MText>
544
+ <MText
545
+ style={{
546
+ color: '#828282',
547
+ fontSize: 12,
548
+ marginTop: 5,
549
+ }}
550
+ >
551
+ Số tiền{' '}
552
+ <MText
553
+ style={{
554
+ fontSize: 12,
555
+ color: '#333333',
556
+ }}
557
+ >
558
+ {formatMoney(values.moneyInsuranceProperty)}đ
559
+ </MText>
560
+ </MText>
561
+ </View>
562
+ <TouchableOpacity
563
+ onPress={() => {
564
+ navigation.dispatch(
565
+ StackActions.push(ScreenNames.CommonSelect, {
566
+ title: 'Chọn thời gian',
567
+ data: appStore.listInsurenceTimeAll,
568
+ callback: (value) => {
569
+ setFieldValue('timeInsuranceProperty', value);
570
+ getInfoInsurence(
571
+ values.loanAmount,
572
+ values.loanTime?.id,
573
+ values?.rateTypeId?.id,
574
+ values?.timeInsurenceCustomer?.id,
575
+ value?.id
576
+ );
577
+ },
578
+ })
579
+ );
580
+ }}
581
+ style={{
582
+ backgroundColor: '#FFFFFF',
583
+ height: 40,
584
+ borderRadius: 6,
585
+ alignItems: 'center',
586
+ justifyContent: 'space-between',
587
+ flexDirection: 'row',
588
+ paddingHorizontal: 10,
589
+ borderWidth: 1,
590
+ borderColor: '#F5F5F5',
591
+ width: Dimensions.get('window').width / 3,
592
+ }}
593
+ >
594
+ <MText style={{ fontSize: 12, color: '#333333' }}>
595
+ {values.timeInsuranceProperty?.name}
596
+ </MText>
597
+ <DropDown2 />
598
+ </TouchableOpacity>
599
+ </View>
600
+ <View
601
+ style={{
602
+ height: 1,
603
+ backgroundColor: '#EFEFEF',
604
+ marginVertical: 8,
605
+ }}
606
+ />
607
+ <View
608
+ style={{
609
+ flexDirection: 'row',
610
+ alignItems: 'center',
611
+ gap: 10,
612
+ }}
613
+ >
614
+ <TouchableOpacity
615
+ onPress={() => {
616
+ setFieldValue(
617
+ 'buyInsurranceHospitalization',
618
+ !values.buyInsurranceHospitalization
619
+ );
620
+ }}
621
+ >
622
+ {values.buyInsurranceHospitalization ? (
623
+ <CheckBoxActive />
624
+ ) : (
625
+ <CheckBox />
626
+ )}
627
+ </TouchableOpacity>
628
+ <View>
629
+ <MText
630
+ style={{
631
+ color: '#333333',
632
+ fontSize: 12,
633
+ fontWeight: 'bold',
634
+ }}
635
+ >
636
+ BH trợ cấp nằm viện
637
+ </MText>
638
+ <MText
639
+ style={{
640
+ color: '#828282',
641
+ fontSize: 12,
642
+ marginTop: 5,
643
+ }}
644
+ >
645
+ Số tiền{' '}
646
+ <MText
647
+ style={{
648
+ fontSize: 12,
649
+ color: '#333333',
650
+ }}
651
+ >
652
+ {formatMoney(values.moneyInsurranceHospitalization)}
653
+ đ
654
+ </MText>
655
+ </MText>
656
+ </View>
657
+ </View>
658
+ <View
659
+ style={{
660
+ height: 1,
661
+ backgroundColor: '#BDBDBD',
662
+ marginVertical: 8,
663
+ }}
664
+ />
665
+ <View style={{ flexDirection: 'row', gap: 5 }}>
666
+ <Tick2 />
667
+ <MText
668
+ style={{
669
+ fontSize: 10,
670
+ color: '#828282',
671
+ }}
672
+ >
673
+ Quyền lợi bảo hiểm sức khoẻ lên tới 100% từ Bảo Minh
674
+ {'\n'}
675
+ (Tai nạn, thương tật,...)
676
+ </MText>
677
+ </View>
678
+ <View
679
+ style={{ marginTop: 8, flexDirection: 'row', gap: 5 }}
680
+ >
681
+ <Tick2 />
682
+ <MText
683
+ style={{
684
+ fontSize: 10,
685
+ color: '#828282',
686
+ }}
687
+ >
688
+ Quyền lợi bảo hiểm vật chất 100% từ Bảo Minh
689
+ </MText>
690
+ </View>
691
+ </View>
692
+
693
+ <MText style={[commonStyles.textNormal, { marginTop: 16 }]}>
694
+ Chọn lịch thanh toán
695
+ </MText>
696
+ <TouchableOpacity
697
+ onPress={() => {
698
+ navigation.dispatch(
699
+ StackActions.push(ScreenNames.CommonSelect, {
700
+ title: 'Chọn ngày thanh toán',
701
+ data: appStore.listFirstDayPayment.map(
702
+ (x, index) => ({
703
+ id: index + 1,
704
+ name: x,
705
+ })
706
+ ),
707
+ callback: (value) => {
708
+ setFieldValue('firstPaymentDate', value.name);
709
+ },
710
+ })
711
+ );
712
+ }}
713
+ style={[
714
+ styles.input,
715
+ {
716
+ justifyContent: 'space-between',
717
+ flexDirection: 'row',
718
+ alignItems: 'center',
719
+ },
720
+ ]}
721
+ >
722
+ <MText
723
+ style={[commonStyles.textNormalBold]}
724
+ numberOfLines={1}
725
+ >
726
+ {values?.firstPaymentDate}
727
+ </MText>
728
+ <DropDown2 />
729
+ </TouchableOpacity>
730
+ {errors && errors.firstPaymentDate && (
731
+ <MText
732
+ style={{
733
+ fontSize: 12,
734
+ color: 'red',
735
+ fontStyle: 'italic',
736
+ marginTop: 5,
737
+ }}
738
+ >
739
+ {errors.firstPaymentDate}
740
+ </MText>
741
+ )}
742
+ </View>
743
+ );
744
+ }}
745
+ </Formik>
746
+ </ScrollView>
747
+ <TouchableOpacity
748
+ onPress={formRef.current?.handleSubmit}
749
+ style={{
750
+ marginHorizontal: 16,
751
+ marginVertical: 16,
752
+ }}
753
+ >
754
+ <LinearGradient
755
+ colors={['#FF7A00', '#EF4123']}
756
+ style={{
757
+ alignItems: 'center',
758
+ borderRadius: 30,
759
+ height: 40,
760
+ justifyContent: 'center',
761
+ }}
762
+ >
763
+ <MText
764
+ style={{
765
+ color: 'white',
766
+ fontSize: 16,
767
+ }}
768
+ >
769
+ Cập nhật
770
+ </MText>
771
+ </LinearGradient>
772
+ </TouchableOpacity>
773
+ </SafeAreaView>
774
+ <Loading isLoading={isLoading} />
775
+ </View>
776
+ );
777
+ });
778
+ const styles = StyleSheet.create({
779
+ input: {
780
+ height: 40,
781
+ marginVertical: 0,
782
+ borderWidth: 0.5,
783
+ borderColor: '#E0E0E0',
784
+ borderRadius: 4,
785
+ marginTop: 8,
786
+ paddingHorizontal: 10,
787
+ fontFamily: 'Roboto',
788
+ color: '#333333',
789
+ fontWeight: 'bold',
790
+ },
791
+ });