react-native-timacare 3.1.14-beta → 3.1.15-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.
@@ -92,6 +92,7 @@ import {
92
92
  IconExpandUp,
93
93
  IconSignSuccess,
94
94
  IconMoney2,
95
+ IconEditDisable,
95
96
  } from '../../assets/svgs';
96
97
  import { o } from 'ramda';
97
98
 
@@ -124,15 +125,16 @@ export const Home = observer(function Home() {
124
125
  setExpandedId((prev) => (prev === id ? null : id));
125
126
  };
126
127
 
127
- const onRefresh = () => {
128
+ const onRefresh = async () => {
128
129
  setIsLoading(true);
129
- homeStore.getListLoan();
130
- homeStore.getListLoanPending(
131
- async (res) => {
132
- setListLoan(res);
133
- if (res) {
130
+ try {
131
+ const response = await Api.getInstance().listLoanPending();
132
+ setIsLoading(false);
133
+ if (response.kind === 'ok') {
134
+ if (response.data?.meta?.errorCode === 200) {
135
+ setListLoan(response.data?.data);
134
136
  Promise.all(
135
- res?.map(async (item) => {
137
+ response.data?.data?.map(async (item) => {
136
138
  homeStore.getCheckEKYC(
137
139
  { loanBriefId: item.id },
138
140
  (response) => {}
@@ -165,13 +167,62 @@ export const Home = observer(function Home() {
165
167
  }
166
168
  })
167
169
  );
170
+ } else {
171
+ Alert.alert('Thông báo', response?.data?.meta?.errorMessage);
168
172
  }
169
- setIsLoading(false);
170
- },
171
- () => {
172
- setIsLoading(false);
173
+ } else {
174
+ Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau');
173
175
  }
174
- );
176
+ } catch (error) {
177
+ console.log(error);
178
+ setIsLoading(false);
179
+ }
180
+
181
+ // homeStore.getListLoanPending(
182
+ // async (res) => {
183
+ // setListLoan(res);
184
+ // if (res) {
185
+ // Promise.all(
186
+ // res?.map(async (item) => {
187
+ // homeStore.getCheckEKYC(
188
+ // { loanBriefId: item.id },
189
+ // (response) => {}
190
+ // );
191
+ // if (item?.productId !== 8) {
192
+ // if (item?.messageErrorCIMB && item.messageErrorCIMB !== '') {
193
+ // setLoanCimb(item);
194
+ // setTimeout(() => {
195
+ // setShowModal(true);
196
+ // }, 200);
197
+ // }
198
+ // if (
199
+ // (item?.typeLoan === 4 || item?.typeLoan === 2) &&
200
+ // item?.isCimbApproveFull !== null
201
+ // ) {
202
+ // const checkShow = await load(`SHOW_${item?.id}`);
203
+ // if (!checkShow || checkShow !== true) {
204
+ // setLoanCimb(item);
205
+ // setTimeout(() => {
206
+ // setShowModal2(true);
207
+ // }, 200);
208
+ // }
209
+ // }
210
+ // }
211
+ // if (item?.typeLoan === 5 && item.step === 5) {
212
+ // setLoan(item);
213
+ // setTimeout(() => {
214
+ // setShowModal3(true);
215
+ // }, 300);
216
+ // }
217
+ // })
218
+ // );
219
+ // }
220
+ // setIsLoading(false);
221
+ // },
222
+ // () => {
223
+ // setIsLoading(false);
224
+ // }
225
+ // );
175
226
  };
176
227
 
177
228
  useEffect(() => {
@@ -181,11 +232,12 @@ export const Home = observer(function Home() {
181
232
  useEffect(() => {
182
233
  navigation.addListener('focus', () => {
183
234
  onRefresh();
235
+ homeStore.getListLoan();
184
236
  getLocation();
185
237
  });
186
238
  }, [navigation]);
187
239
 
188
- useEffect(async () => {
240
+ useEffect(() => {
189
241
  setTimeout(() => {
190
242
  FullSubmitStore.getTypeMerried();
191
243
  FullSubmitStore.getListBank();
@@ -622,6 +674,7 @@ export const Home = observer(function Home() {
622
674
  item?.listLoanAllAutoDE.length > 0
623
675
  ? 16
624
676
  : 32,
677
+ paddingHorizontal: 24,
625
678
  }}
626
679
  >
627
680
  <TouchableOpacity
@@ -680,8 +733,10 @@ export const Home = observer(function Home() {
680
733
  >
681
734
  {item.step > 3 ? (
682
735
  <IconEditSuccess />
683
- ) : (
736
+ ) : item.step === 3 ? (
684
737
  <IconEdit />
738
+ ) : (
739
+ <IconEditDisable />
685
740
  )}
686
741
  <MText
687
742
  style={{
@@ -734,7 +789,7 @@ export const Home = observer(function Home() {
734
789
  });
735
790
  }}
736
791
  >
737
- {item?.step < 6 ? (
792
+ {item?.step <= 6 ? (
738
793
  <IconSignDisable />
739
794
  ) : item?.step === 8 ? (
740
795
  <IconSignSuccess />
@@ -775,25 +830,172 @@ export const Home = observer(function Home() {
775
830
  marginTop: 16,
776
831
  backgroundColor: '#FFF2F2',
777
832
  paddingHorizontal: 10,
778
- paddingVertical: 6,
833
+ paddingVertical: 10,
779
834
  borderRadius: 4,
835
+ justifyContent: 'space-between',
780
836
  }}
781
837
  >
782
- <Info />
783
- <MText
838
+ <View
784
839
  style={{
785
- color: '#E40010',
786
- fontSize: 10,
840
+ flexDirection: 'row',
841
+ alignItems: 'center',
842
+ gap: 8,
787
843
  }}
788
844
  >
789
- {item?.step < 3
790
- ? 'OCR chứng từ để được giải ngân nhanh nhất'
791
- : item?.step === 3
792
- ? 'Tiếp tục Cập nhật thông tin để giải ngân nhanh nhất'
793
- : item?.step === 6 || item?.step === 7
794
- ? 'Tiếp tục eKYC và Ký hợp đồng để giải ngân nhanh nhất'
795
- : 'Đơn vay đang trong quá trình xử lý'}
796
- </MText>
845
+ <Info />
846
+ <MText
847
+ style={{
848
+ color: '#E40010',
849
+ fontSize: 10,
850
+ }}
851
+ >
852
+ {item?.step < 3
853
+ ? 'OCR chứng từ để được giải ngân'
854
+ : item?.step === 3
855
+ ? `Tiếp tục Cập nhật thông tin để${'\n'}giải ngân nhanh nhất`
856
+ : item?.step === 6 || item?.step === 7
857
+ ? `Tiếp tục eKYC và Ký hợp đồng để${'\n'}giải ngân nhanh nhất`
858
+ : 'Đơn vay đang trong quá trình xử lý'}
859
+ </MText>
860
+ </View>
861
+ {item?.step < 3 ? (
862
+ <TouchableOpacity
863
+ onPress={() => {
864
+ if (item?.step === 0) {
865
+ navigation.push(ScreenNames.OCR, {
866
+ loan: item,
867
+ front: true,
868
+ });
869
+ } else if (item?.step === 1) {
870
+ navigation.push(
871
+ ScreenNames.VehicleCamera,
872
+ {
873
+ loan: item,
874
+ front: true,
875
+ }
876
+ );
877
+ } else if (item?.step === 2) {
878
+ navigation.push(
879
+ ScreenNames.RegisterCamera,
880
+ {
881
+ loan: item,
882
+ }
883
+ );
884
+ }
885
+ }}
886
+ >
887
+ <LinearGradient
888
+ colors={['#FF8E4F', '#EF592E']}
889
+ style={{
890
+ height: 24,
891
+ alignItems: 'center',
892
+ justifyContent: 'center',
893
+ borderRadius: 24,
894
+ paddingHorizontal: 10,
895
+ }}
896
+ >
897
+ <MText
898
+ style={{
899
+ color: 'white',
900
+ fontSize: 10,
901
+ }}
902
+ >
903
+ Đi tới OCR
904
+ </MText>
905
+ </LinearGradient>
906
+ </TouchableOpacity>
907
+ ) : item?.step === 3 ? (
908
+ <TouchableOpacity
909
+ onPress={() => {
910
+ if (item?.step === 3) {
911
+ navigation.push(
912
+ ScreenNames.ReviewInformation,
913
+ {
914
+ loan: item,
915
+ }
916
+ );
917
+ }
918
+ }}
919
+ >
920
+ <LinearGradient
921
+ colors={['#FF8E4F', '#EF592E']}
922
+ style={{
923
+ height: 24,
924
+ alignItems: 'center',
925
+ justifyContent: 'center',
926
+ borderRadius: 24,
927
+ paddingHorizontal: 10,
928
+ }}
929
+ >
930
+ <MText
931
+ style={{
932
+ color: 'white',
933
+ fontSize: 10,
934
+ }}
935
+ >
936
+ Cập nhật thông tin
937
+ </MText>
938
+ </LinearGradient>
939
+ </TouchableOpacity>
940
+ ) : item?.step === 6 ? (
941
+ <TouchableOpacity
942
+ onPress={() => {
943
+ navigation.push(ScreenNames.LivenessV2, {
944
+ loan: item,
945
+ });
946
+ }}
947
+ >
948
+ <LinearGradient
949
+ colors={['#FF8E4F', '#EF592E']}
950
+ style={{
951
+ height: 24,
952
+ alignItems: 'center',
953
+ justifyContent: 'center',
954
+ borderRadius: 24,
955
+ paddingHorizontal: 10,
956
+ }}
957
+ >
958
+ <MText
959
+ style={{
960
+ color: 'white',
961
+ fontSize: 10,
962
+ }}
963
+ >
964
+ Đi tới EKYC
965
+ </MText>
966
+ </LinearGradient>
967
+ </TouchableOpacity>
968
+ ) : item?.step === 7 ? (
969
+ <TouchableOpacity
970
+ onPress={() => {
971
+ navigation.push(ScreenNames.TTSSignLoan, {
972
+ loan: item,
973
+ });
974
+ }}
975
+ >
976
+ <LinearGradient
977
+ colors={['#FF8E4F', '#EF592E']}
978
+ style={{
979
+ height: 24,
980
+ alignItems: 'center',
981
+ justifyContent: 'center',
982
+ borderRadius: 24,
983
+ paddingHorizontal: 10,
984
+ }}
985
+ >
986
+ <MText
987
+ style={{
988
+ color: 'white',
989
+ fontSize: 10,
990
+ }}
991
+ >
992
+ Ký hợp đồng
993
+ </MText>
994
+ </LinearGradient>
995
+ </TouchableOpacity>
996
+ ) : (
997
+ <></>
998
+ )}
797
999
  </View>
798
1000
  )}
799
1001
  <View