react-native-timacare 0.0.24 → 0.0.26

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.
@@ -76,11 +76,16 @@ export const Home = observer(function Home() {
76
76
  const navigation = useNavigation();
77
77
  const [showModal, setShowModal] = useState(false);
78
78
  const [showModal2, setShowModal2] = useState(false);
79
+ const [loan, setLoan] = useState(null);
80
+ const [checkEKYC, setCheckEKYC] = useState(null);
79
81
 
80
82
  const onRefresh = () => {
81
83
  homeStore.getListLoan();
82
84
  homeStore.getListLoanPending(async (loan) => {
83
- homeStore.getCheckEKYC({ loanBriefId: loan.id });
85
+ setLoan(loan);
86
+ homeStore.getCheckEKYC({ loanBriefId: loan.id }, (data) => {
87
+ setCheckEKYC(!data);
88
+ });
84
89
  if (
85
90
  loan.messageErrorCIMB !== '' &&
86
91
  loan?.messageErrorCIMB &&
@@ -96,6 +101,7 @@ export const Home = observer(function Home() {
96
101
  }
97
102
  });
98
103
  };
104
+
99
105
  useEffect(() => {
100
106
  onRefresh();
101
107
  }, []);
@@ -314,7 +320,7 @@ export const Home = observer(function Home() {
314
320
  >
315
321
  Danh sách đơn mới
316
322
  </MText>
317
- {homeStore.listLoanPending === null ? (
323
+ {loan === null ? (
318
324
  <View style={{ alignItems: 'center', marginTop: 20 }}>
319
325
  <MText style={[commonStyles.textNormal]}>
320
326
  Không có đơn vay
@@ -322,10 +328,9 @@ export const Home = observer(function Home() {
322
328
  </View>
323
329
  ) : (
324
330
  <>
325
- {homeStore.listLoanPending &&
326
- homeStore.listLoanPending?.isPipelineCIMB ? (
331
+ {loan && loan?.isPipelineCIMB ? (
327
332
  <View>
328
- {homeStore.listLoanPending?.typeLoan === 4 ? (
333
+ {loan?.typeLoan === 4 ? (
329
334
  <View
330
335
  style={{
331
336
  backgroundColor: '#FFFFFF',
@@ -345,15 +350,12 @@ export const Home = observer(function Home() {
345
350
  <Contract />
346
351
  <View style={{ flex: 1, paddingLeft: 8 }}>
347
352
  <MText style={commonStyles.textNormalBold}>
348
- Mã Đơn vay-{homeStore.listLoanPending?.id}
353
+ Mã Đơn vay-{loan?.id}
349
354
  </MText>
350
355
  <MText style={commonStyles.textNormal}>
351
356
  Số tiền vay (VND):{' '}
352
- {homeStore.listLoanPending?.loanAmountOffer
353
- ? formatMoney(
354
- homeStore.listLoanPending
355
- ?.loanAmountOffer
356
- )
357
+ {loan?.loanAmountOffer
358
+ ? formatMoney(loan?.loanAmountOffer)
357
359
  : 'Chưa xác định'}
358
360
  </MText>
359
361
  </View>
@@ -380,7 +382,7 @@ export const Home = observer(function Home() {
380
382
  { color: '#F05123' },
381
383
  ]}
382
384
  >
383
- {homeStore?.listLoanPending?.loanStatus}
385
+ {loan?.loanStatus}
384
386
  </MText>
385
387
  </View>
386
388
  <View
@@ -391,14 +393,14 @@ export const Home = observer(function Home() {
391
393
  }}
392
394
  />
393
395
  <View style={{ flexDirection: 'row' }}>
394
- {homeStore.listLoanPending?.loanStatus === null ||
395
- homeStore.listLoanPending?.loanStatus === '' ? (
396
+ {loan?.loanStatus === null ||
397
+ loan?.loanStatus === '' ? (
396
398
  <TouchableOpacity
397
399
  style={{ alignItems: 'center' }}
398
400
  onPress={() => {
399
401
  navigation.dispatch(
400
402
  StackActions.push(ScreenNames.CIMBxTima, {
401
- loan: homeStore.listLoanPending,
403
+ loan: loan,
402
404
  })
403
405
  );
404
406
  }}
@@ -420,21 +422,17 @@ export const Home = observer(function Home() {
420
422
  </TouchableOpacity>
421
423
  ) : (
422
424
  <View>
423
- {homeStore?.listLoanPending?.isUpdateLoan ||
424
- homeStore?.listLoanPending
425
- ?.isUpdateInformation ? (
425
+ {loan?.isUpdateLoan ||
426
+ loan?.isUpdateInformation ? (
426
427
  <TouchableOpacity
427
428
  style={{ alignItems: 'center' }}
428
429
  onPress={() => {
429
- if (
430
- homeStore.listLoanPending
431
- ?.isUpdateLoan
432
- ) {
430
+ if (loan?.isUpdateLoan) {
433
431
  navigation.dispatch(
434
432
  StackActions.push(
435
433
  ScreenNames.CimbSelfie,
436
434
  {
437
- loan: homeStore.listLoanPending,
435
+ loan: loan,
438
436
  }
439
437
  )
440
438
  );
@@ -443,7 +441,7 @@ export const Home = observer(function Home() {
443
441
  StackActions.push(
444
442
  ScreenNames.QuickSubmit,
445
443
  {
446
- loan: homeStore.listLoanPending,
444
+ loan: loan,
447
445
  }
448
446
  )
449
447
  );
@@ -486,22 +484,19 @@ export const Home = observer(function Home() {
486
484
  </View>
487
485
  )}
488
486
 
489
- {homeStore.listLoanPending?.isSignContract && (
487
+ {loan?.isSignContract && (
490
488
  <TouchableOpacity
491
489
  style={{
492
490
  alignItems: 'center',
493
491
  marginLeft: 20,
494
492
  }}
495
493
  onPress={() => {
496
- if (
497
- homeStore.listLoanPending?.urlSignContract
498
- ) {
494
+ if (loan?.urlSignContract) {
499
495
  navigation.dispatch(
500
496
  StackActions.push(
501
497
  ScreenNames.CIMBSign,
502
498
  {
503
- url: homeStore.listLoanPending
504
- ?.urlSignContract,
499
+ url: loan?.urlSignContract,
505
500
  }
506
501
  )
507
502
  );
@@ -528,8 +523,7 @@ export const Home = observer(function Home() {
528
523
  </MText>
529
524
  </TouchableOpacity>
530
525
  )}
531
- {homeStore.listLoanPending
532
- ?.isSignContractTima && (
526
+ {loan?.isSignContractTima && (
533
527
  <TouchableOpacity
534
528
  style={{
535
529
  alignItems: 'center',
@@ -540,7 +534,7 @@ export const Home = observer(function Home() {
540
534
  StackActions.push(
541
535
  ScreenNames.ViewContract,
542
536
  {
543
- loan: homeStore.listLoanPending,
537
+ loan: loan,
544
538
  }
545
539
  )
546
540
  );
@@ -562,8 +556,7 @@ export const Home = observer(function Home() {
562
556
  </MText>
563
557
  </TouchableOpacity>
564
558
  )}
565
- {homeStore.listLoanPending
566
- ?.paymentEvidenceUrl && (
559
+ {loan?.paymentEvidenceUrl && (
567
560
  <TouchableOpacity
568
561
  style={{
569
562
  alignItems: 'center',
@@ -574,8 +567,7 @@ export const Home = observer(function Home() {
574
567
  StackActions.push(
575
568
  ScreenNames.PaymentEvidence,
576
569
  {
577
- url: homeStore.listLoanPending
578
- ?.paymentEvidenceUrl,
570
+ url: loan?.paymentEvidenceUrl,
579
571
  }
580
572
  )
581
573
  );
@@ -597,7 +589,7 @@ export const Home = observer(function Home() {
597
589
  </MText>
598
590
  </TouchableOpacity>
599
591
  )}
600
- {homeStore.listLoanPending?.showPaymentPlan && (
592
+ {loan?.showPaymentPlan && (
601
593
  <TouchableOpacity
602
594
  style={{
603
595
  alignItems: 'center',
@@ -608,7 +600,7 @@ export const Home = observer(function Home() {
608
600
  StackActions.push(
609
601
  ScreenNames.SchedulePayment,
610
602
  {
611
- loan: homeStore.listLoanPending,
603
+ loan: loan,
612
604
  }
613
605
  )
614
606
  );
@@ -655,16 +647,16 @@ export const Home = observer(function Home() {
655
647
  },
656
648
  ]}
657
649
  >
658
- {homeStore.listLoanPending?.suggestion
659
- ? homeStore.listLoanPending?.suggestion
650
+ {loan?.suggestion
651
+ ? loan?.suggestion
660
652
  : 'Thực hiện đầy đủ các bước để giải ngân nhanh nhất'}
661
653
  </MText>
662
654
  </View>
663
655
  </View>
664
656
  ) : (
665
657
  <View>
666
- {homeStore.listLoanPending?.loanStatus !== null &&
667
- homeStore.listLoanPending?.loanStatus !== '' ? (
658
+ {loan?.loanStatus !== null &&
659
+ loan?.loanStatus !== '' ? (
668
660
  <View
669
661
  style={{
670
662
  backgroundColor: '#FFFFFF',
@@ -684,16 +676,12 @@ export const Home = observer(function Home() {
684
676
  <Contract />
685
677
  <View style={{ flex: 1, paddingLeft: 8 }}>
686
678
  <MText style={commonStyles.textNormalBold}>
687
- Mã Đơn vay-{homeStore.listLoanPending?.id}
679
+ Mã Đơn vay-{loan?.id}
688
680
  </MText>
689
681
  <MText style={commonStyles.textNormal}>
690
682
  Số tiền vay (VND):{' '}
691
- {homeStore.listLoanPending
692
- ?.loanAmountOffer
693
- ? formatMoney(
694
- homeStore.listLoanPending
695
- ?.loanAmountOffer
696
- )
683
+ {loan?.loanAmountOffer
684
+ ? formatMoney(loan?.loanAmountOffer)
697
685
  : 'Chưa xác định'}
698
686
  </MText>
699
687
  </View>
@@ -720,7 +708,7 @@ export const Home = observer(function Home() {
720
708
  { color: '#F05123' },
721
709
  ]}
722
710
  >
723
- {homeStore?.listLoanPending?.loanStatus}
711
+ {loan?.loanStatus}
724
712
  </MText>
725
713
  </View>
726
714
  <View
@@ -731,21 +719,17 @@ export const Home = observer(function Home() {
731
719
  }}
732
720
  />
733
721
  <View style={{ flexDirection: 'row' }}>
734
- {homeStore?.listLoanPending?.isUpdateLoan ||
735
- homeStore?.listLoanPending
736
- ?.isUpdateInformation ? (
722
+ {loan?.isUpdateLoan ||
723
+ loan?.isUpdateInformation ? (
737
724
  <TouchableOpacity
738
725
  style={{ alignItems: 'center' }}
739
726
  onPress={() => {
740
- if (
741
- homeStore.listLoanPending
742
- ?.isUpdateLoan
743
- ) {
727
+ if (loan?.isUpdateLoan) {
744
728
  navigation.dispatch(
745
729
  StackActions.push(
746
730
  ScreenNames.CimbSelfie,
747
731
  {
748
- loan: homeStore.listLoanPending,
732
+ loan: loan,
749
733
  }
750
734
  )
751
735
  );
@@ -754,7 +738,7 @@ export const Home = observer(function Home() {
754
738
  StackActions.push(
755
739
  ScreenNames.QuickSubmit,
756
740
  {
757
- loan: homeStore.listLoanPending,
741
+ loan: loan,
758
742
  }
759
743
  )
760
744
  );
@@ -794,24 +778,19 @@ export const Home = observer(function Home() {
794
778
  </MText>
795
779
  </View>
796
780
  )}
797
- {homeStore.listLoanPending
798
- ?.isSignContract && (
781
+ {loan?.isSignContract && (
799
782
  <TouchableOpacity
800
783
  style={{
801
784
  alignItems: 'center',
802
785
  marginLeft: 20,
803
786
  }}
804
787
  onPress={() => {
805
- if (
806
- homeStore.listLoanPending
807
- ?.urlSignContract
808
- ) {
788
+ if (loan?.urlSignContract) {
809
789
  navigation.dispatch(
810
790
  StackActions.push(
811
791
  ScreenNames.CIMBSign,
812
792
  {
813
- url: homeStore.listLoanPending
814
- ?.urlSignContract,
793
+ url: loan?.urlSignContract,
815
794
  }
816
795
  )
817
796
  );
@@ -838,8 +817,7 @@ export const Home = observer(function Home() {
838
817
  </MText>
839
818
  </TouchableOpacity>
840
819
  )}
841
- {homeStore.listLoanPending
842
- ?.isSignContractTima && (
820
+ {loan?.isSignContractTima && (
843
821
  <TouchableOpacity
844
822
  style={{
845
823
  alignItems: 'center',
@@ -850,7 +828,7 @@ export const Home = observer(function Home() {
850
828
  StackActions.push(
851
829
  ScreenNames.ViewContract,
852
830
  {
853
- loan: homeStore.listLoanPending,
831
+ loan: loan,
854
832
  }
855
833
  )
856
834
  );
@@ -872,8 +850,7 @@ export const Home = observer(function Home() {
872
850
  </MText>
873
851
  </TouchableOpacity>
874
852
  )}
875
- {homeStore.listLoanPending
876
- ?.paymentEvidenceUrl && (
853
+ {loan?.paymentEvidenceUrl && (
877
854
  <TouchableOpacity
878
855
  style={{
879
856
  alignItems: 'center',
@@ -884,8 +861,7 @@ export const Home = observer(function Home() {
884
861
  StackActions.push(
885
862
  ScreenNames.PaymentEvidence,
886
863
  {
887
- url: homeStore.listLoanPending
888
- ?.paymentEvidenceUrl,
864
+ url: loan?.paymentEvidenceUrl,
889
865
  }
890
866
  )
891
867
  );
@@ -907,8 +883,7 @@ export const Home = observer(function Home() {
907
883
  </MText>
908
884
  </TouchableOpacity>
909
885
  )}
910
- {homeStore.listLoanPending
911
- ?.showPaymentPlan && (
886
+ {loan?.showPaymentPlan && (
912
887
  <TouchableOpacity
913
888
  style={{
914
889
  alignItems: 'center',
@@ -919,7 +894,7 @@ export const Home = observer(function Home() {
919
894
  StackActions.push(
920
895
  ScreenNames.SchedulePayment,
921
896
  {
922
- loan: homeStore.listLoanPending,
897
+ loan: loan,
923
898
  }
924
899
  )
925
900
  );
@@ -966,8 +941,8 @@ export const Home = observer(function Home() {
966
941
  },
967
942
  ]}
968
943
  >
969
- {homeStore.listLoanPending?.suggestion
970
- ? homeStore.listLoanPending?.suggestion
944
+ {loan?.suggestion
945
+ ? loan?.suggestion
971
946
  : 'Thực hiện đầy đủ các bước để giải ngân nhanh nhất'}
972
947
  </MText>
973
948
  </View>
@@ -1000,16 +975,13 @@ export const Home = observer(function Home() {
1000
975
  color: '#EF4123',
1001
976
  }}
1002
977
  >
1003
- {formatMoney(
1004
- homeStore.listLoanPending?.loanAmount
1005
- )}{' '}
1006
- VND
978
+ {formatMoney(loan?.loanAmount)} VND
1007
979
  </MText>
1008
980
  <TouchableOpacity
1009
981
  onPress={() => {
1010
982
  navigation.dispatch(
1011
983
  StackActions.push(ScreenNames.CIMBxTima, {
1012
- loan: homeStore.listLoanPending,
984
+ loan: loan,
1013
985
  })
1014
986
  );
1015
987
  }}
@@ -1085,14 +1057,12 @@ export const Home = observer(function Home() {
1085
1057
  <Contract />
1086
1058
  <View style={{ flex: 1, paddingLeft: 8 }}>
1087
1059
  <MText style={commonStyles.textNormalBold}>
1088
- Đơn vay {homeStore.listLoanPending?.id}
1060
+ Đơn vay {loan?.id}
1089
1061
  </MText>
1090
1062
  <MText style={commonStyles.textNormal}>
1091
1063
  Số tiền vay (VND):{' '}
1092
- {homeStore.listLoanPending?.loanAmount
1093
- ? formatMoney(
1094
- homeStore.listLoanPending?.loanAmount
1095
- )
1064
+ {loan?.loanAmount
1065
+ ? formatMoney(loan?.loanAmount)
1096
1066
  : 'Chưa xác định'}
1097
1067
  </MText>
1098
1068
  </View>
@@ -1119,7 +1089,7 @@ export const Home = observer(function Home() {
1119
1089
  { color: '#F05123' },
1120
1090
  ]}
1121
1091
  >
1122
- {homeStore?.listLoanPending?.loanStatus}
1092
+ {loan?.loanStatus}
1123
1093
  </MText>
1124
1094
  </View>
1125
1095
  <View
@@ -1130,9 +1100,7 @@ export const Home = observer(function Home() {
1130
1100
  }}
1131
1101
  />
1132
1102
  <View style={{ flexDirection: 'row' }}>
1133
- {!homeStore.checkEKYC[
1134
- homeStore.listLoanPending?.id
1135
- ] ? (
1103
+ {!checkEKYC ? (
1136
1104
  <TouchableOpacity
1137
1105
  style={{ alignItems: 'center' }}
1138
1106
  onPress={() => {
@@ -1140,7 +1108,7 @@ export const Home = observer(function Home() {
1140
1108
  StackActions.push(
1141
1109
  ScreenNames.NationalID,
1142
1110
  {
1143
- loan: homeStore.listLoanPending,
1111
+ loan: loan,
1144
1112
  reLoan: true,
1145
1113
  }
1146
1114
  )
@@ -1187,7 +1155,7 @@ export const Home = observer(function Home() {
1187
1155
  onPress={() => {
1188
1156
  navigation.dispatch(
1189
1157
  StackActions.push(ScreenNames.Video, {
1190
- loan: homeStore.listLoanPending,
1158
+ loan: loan,
1191
1159
  })
1192
1160
  );
1193
1161
  }}
@@ -1207,16 +1175,14 @@ export const Home = observer(function Home() {
1207
1175
  </MText>
1208
1176
  </TouchableOpacity>
1209
1177
 
1210
- {homeStore.checkEKYC[
1211
- homeStore.listLoanPending?.id
1212
- ] ? (
1178
+ {checkEKYC ? (
1213
1179
  <TouchableOpacity
1214
1180
  style={{
1215
1181
  alignItems: 'center',
1216
1182
  marginLeft: 20,
1217
1183
  }}
1218
1184
  onPress={() => {
1219
- signLoan(homeStore.listLoanPending);
1185
+ signLoan(loan);
1220
1186
  }}
1221
1187
  >
1222
1188
  <IconSign2 />
@@ -1473,7 +1439,7 @@ export const Home = observer(function Home() {
1473
1439
  </LinearGradient>
1474
1440
  <View style={{ padding: 24 }}>
1475
1441
  <MText style={[commonStyles.textNormal, { textAlign: 'center' }]}>
1476
- {homeStore?.listLoanPending?.messageErrorCIMB}
1442
+ {loan?.messageErrorCIMB}
1477
1443
  </MText>
1478
1444
  </View>
1479
1445
  </View>
@@ -1484,7 +1450,7 @@ export const Home = observer(function Home() {
1484
1450
  <View>
1485
1451
  <Image
1486
1452
  source={
1487
- homeStore?.listLoanPending?.isCimbApproveFull === true
1453
+ loan?.isCimbApproveFull === true
1488
1454
  ? require('./accept.png')
1489
1455
  : require('./reject.png')
1490
1456
  }
@@ -1494,7 +1460,7 @@ export const Home = observer(function Home() {
1494
1460
  height: (Dimensions.get('window').height / 2) * 0.8,
1495
1461
  }}
1496
1462
  />
1497
- {homeStore?.listLoanPending?.isCimbApproveFull === true ? (
1463
+ {loan?.isCimbApproveFull === true ? (
1498
1464
  <View style={{ padding: 24 }}>
1499
1465
  <MText
1500
1466
  style={{
@@ -1512,7 +1478,7 @@ export const Home = observer(function Home() {
1512
1478
  ]}
1513
1479
  >
1514
1480
  Bạn đã được phê duyệt khoản vay từ CIMB với số tiền là{' '}
1515
- {formatMoney(homeStore?.listLoanPending?.loanAmount)} VNĐ!
1481
+ {formatMoney(loan?.loanAmount)} VNĐ!
1516
1482
  </MText>
1517
1483
  <View
1518
1484
  style={{
@@ -1532,7 +1498,7 @@ export const Home = observer(function Home() {
1532
1498
  onPress={() => {
1533
1499
  setShowModal2(false);
1534
1500
  navigation.push(ScreenNames.AcceptPolicy, {
1535
- loan: homeStore?.listLoanPending,
1501
+ loan: loan,
1536
1502
  isCimb: true,
1537
1503
  });
1538
1504
  }}
@@ -1548,12 +1514,12 @@ export const Home = observer(function Home() {
1548
1514
  }}
1549
1515
  onPress={async () => {
1550
1516
  const response = await Api.getInstance().customerCancel({
1551
- LoanBriefId: homeStore?.listLoanPending?.id,
1517
+ LoanBriefId: loan?.id,
1552
1518
  });
1553
1519
  if (response.kind === 'ok') {
1554
1520
  if (response.data.meta.errorCode === 200) {
1555
1521
  setShowModal2(false);
1556
- const key = `SHOW_${homeStore.listLoanPending.id}`;
1522
+ const key = `SHOW_${loan.id}`;
1557
1523
  save(key, true);
1558
1524
  Alert.alert('Thông báo', 'Huỷ đơn thành công');
1559
1525
  onRefresh();
@@ -1606,7 +1572,7 @@ export const Home = observer(function Home() {
1606
1572
  onPress={() => {
1607
1573
  setShowModal2(false);
1608
1574
  navigation.push(ScreenNames.AcceptPolicy, {
1609
- loan: homeStore?.listLoanPending,
1575
+ loan: loan,
1610
1576
  isCimb: false,
1611
1577
  });
1612
1578
  }}