react-native-timacare 0.0.35 → 0.0.37
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.
- package/lib/commonjs/components/Loading.js +1 -1
- package/lib/commonjs/components/Loading.js.flow +12 -4
- package/lib/commonjs/components/Loading.js.map +1 -1
- package/lib/commonjs/screens/full-submit/accept_policy.js +1 -1
- package/lib/commonjs/screens/full-submit/accept_policy.js.flow +99 -38
- package/lib/commonjs/screens/full-submit/accept_policy.js.map +1 -1
- package/lib/commonjs/screens/full-submit/selfie.js +1 -1
- package/lib/commonjs/screens/full-submit/selfie.js.flow +7 -3
- package/lib/commonjs/screens/full-submit/selfie.js.map +1 -1
- package/lib/commonjs/screens/full-submit/store.js +1 -1
- package/lib/commonjs/screens/full-submit/store.js.flow +28 -2
- package/lib/commonjs/screens/full-submit/store.js.map +1 -1
- package/lib/commonjs/screens/full-submit/update-document.js +1 -1
- package/lib/commonjs/screens/full-submit/update-document.js.flow +20 -11
- package/lib/commonjs/screens/full-submit/update-document.js.map +1 -1
- package/lib/commonjs/screens/full-submit/update-info.js +1 -1
- package/lib/commonjs/screens/full-submit/update-info.js.flow +16 -6
- package/lib/commonjs/screens/full-submit/update-info.js.map +1 -1
- package/lib/commonjs/screens/home/Store.js +1 -1
- package/lib/commonjs/screens/home/Store.js.flow +3 -0
- package/lib/commonjs/screens/home/Store.js.map +1 -1
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +60 -34
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/screens/nationalID/Store.js +1 -1
- package/lib/commonjs/screens/nationalID/Store.js.flow +2 -0
- package/lib/commonjs/screens/nationalID/Store.js.map +1 -1
- package/lib/commonjs/screens/nationalID/index.js +1 -1
- package/lib/commonjs/screens/nationalID/index.js.flow +16 -7
- package/lib/commonjs/screens/nationalID/index.js.map +1 -1
- package/lib/commonjs/screens/nationalIDBack/Store.js +1 -1
- package/lib/commonjs/screens/nationalIDBack/Store.js.flow +3 -1
- package/lib/commonjs/screens/nationalIDBack/Store.js.map +1 -1
- package/lib/commonjs/screens/nationalIDBack/index.js +1 -1
- package/lib/commonjs/screens/nationalIDBack/index.js.flow +13 -22
- package/lib/commonjs/screens/nationalIDBack/index.js.map +1 -1
- package/lib/commonjs/screens/quick-submit/index.js +1 -1
- package/lib/commonjs/screens/quick-submit/index.js.flow +92 -80
- package/lib/commonjs/screens/quick-submit/index.js.map +1 -1
- package/lib/commonjs/screens/quick-submit/store.js +1 -1
- package/lib/commonjs/screens/quick-submit/store.js.flow +4 -1
- package/lib/commonjs/screens/quick-submit/store.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js.flow +1 -25
- package/lib/commonjs/screens/uploadVideo/index.js.map +1 -1
- package/lib/module/components/Loading.js +1 -1
- package/lib/module/components/Loading.js.map +1 -1
- package/lib/module/screens/full-submit/accept_policy.js +1 -1
- package/lib/module/screens/full-submit/accept_policy.js.map +1 -1
- package/lib/module/screens/full-submit/selfie.js +1 -1
- package/lib/module/screens/full-submit/selfie.js.map +1 -1
- package/lib/module/screens/full-submit/store.js +1 -1
- package/lib/module/screens/full-submit/store.js.map +1 -1
- package/lib/module/screens/full-submit/update-document.js +1 -1
- package/lib/module/screens/full-submit/update-document.js.map +1 -1
- package/lib/module/screens/full-submit/update-info.js +1 -1
- package/lib/module/screens/full-submit/update-info.js.map +1 -1
- package/lib/module/screens/home/Store.js +1 -1
- package/lib/module/screens/home/Store.js.map +1 -1
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/screens/nationalID/Store.js +1 -1
- package/lib/module/screens/nationalID/Store.js.map +1 -1
- package/lib/module/screens/nationalID/index.js +1 -1
- package/lib/module/screens/nationalID/index.js.map +1 -1
- package/lib/module/screens/nationalIDBack/Store.js +1 -1
- package/lib/module/screens/nationalIDBack/Store.js.map +1 -1
- package/lib/module/screens/nationalIDBack/index.js +1 -1
- package/lib/module/screens/nationalIDBack/index.js.map +1 -1
- package/lib/module/screens/quick-submit/index.js +1 -1
- package/lib/module/screens/quick-submit/index.js.map +1 -1
- package/lib/module/screens/quick-submit/store.js +1 -1
- package/lib/module/screens/quick-submit/store.js.map +1 -1
- package/lib/module/screens/uploadVideo/index.js +1 -1
- package/lib/module/screens/uploadVideo/index.js.map +1 -1
- package/lib/typescript/components/Loading.d.ts.map +1 -1
- package/lib/typescript/screens/full-submit/accept_policy.d.ts.map +1 -1
- package/lib/typescript/screens/full-submit/selfie.d.ts.map +1 -1
- package/lib/typescript/screens/full-submit/store.d.ts +3 -2
- package/lib/typescript/screens/full-submit/store.d.ts.map +1 -1
- package/lib/typescript/screens/full-submit/update-document.d.ts.map +1 -1
- package/lib/typescript/screens/full-submit/update-info.d.ts.map +1 -1
- package/lib/typescript/screens/home/Store.d.ts.map +1 -1
- package/lib/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/screens/nationalID/Store.d.ts.map +1 -1
- package/lib/typescript/screens/nationalID/index.d.ts.map +1 -1
- package/lib/typescript/screens/nationalIDBack/Store.d.ts +1 -1
- package/lib/typescript/screens/nationalIDBack/Store.d.ts.map +1 -1
- package/lib/typescript/screens/nationalIDBack/index.d.ts.map +1 -1
- package/lib/typescript/screens/quick-submit/index.d.ts.map +1 -1
- package/lib/typescript/screens/quick-submit/store.d.ts +1 -1
- package/lib/typescript/screens/quick-submit/store.d.ts.map +1 -1
- package/lib/typescript/screens/uploadVideo/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Loading.tsx +12 -4
- package/src/screens/full-submit/accept_policy.tsx +99 -38
- package/src/screens/full-submit/selfie.tsx +7 -3
- package/src/screens/full-submit/store.tsx +28 -2
- package/src/screens/full-submit/update-document.tsx +20 -11
- package/src/screens/full-submit/update-info.tsx +16 -6
- package/src/screens/home/Store.tsx +3 -0
- package/src/screens/home/index.tsx +60 -34
- package/src/screens/nationalID/Store.tsx +2 -0
- package/src/screens/nationalID/index.tsx +16 -7
- package/src/screens/nationalIDBack/Store.tsx +3 -1
- package/src/screens/nationalIDBack/index.tsx +13 -22
- package/src/screens/quick-submit/index.tsx +92 -80
- package/src/screens/quick-submit/store.tsx +4 -1
- package/src/screens/uploadVideo/index.tsx +1 -25
|
@@ -19,7 +19,7 @@ import { color } from '../../theme';
|
|
|
19
19
|
import LinearGradient from 'react-native-linear-gradient';
|
|
20
20
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
21
21
|
import { ScreenNames } from '../../navigation';
|
|
22
|
-
import
|
|
22
|
+
import Loading from '../../components/Loading';
|
|
23
23
|
|
|
24
24
|
interface IProps {
|
|
25
25
|
loan: any;
|
|
@@ -41,6 +41,7 @@ export const UpdateDocument = observer(function UpdateDocument({
|
|
|
41
41
|
{ uri: 'https://unsplash.it/400/400?image=1' },
|
|
42
42
|
]);
|
|
43
43
|
const [visible, setIsVisible] = useState(false);
|
|
44
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
44
45
|
const [data, setData] = useState<any[]>();
|
|
45
46
|
|
|
46
47
|
const takePhoto = async (typId) => {
|
|
@@ -65,15 +66,23 @@ export const UpdateDocument = observer(function UpdateDocument({
|
|
|
65
66
|
});
|
|
66
67
|
};
|
|
67
68
|
const handleSubmit = () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
setIsLoading(true);
|
|
70
|
+
FullSubmitStore.confirmData(
|
|
71
|
+
loan?.id,
|
|
72
|
+
() => {
|
|
73
|
+
setIsLoading(false);
|
|
74
|
+
FullSubmitStore.tab = 1;
|
|
75
|
+
navigation.dispatch(
|
|
76
|
+
CommonActions.reset({
|
|
77
|
+
index: 1,
|
|
78
|
+
routes: [{ name: ScreenNames.Main }],
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
() => {
|
|
83
|
+
setIsLoading(false);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
77
86
|
};
|
|
78
87
|
|
|
79
88
|
return (
|
|
@@ -348,7 +357,7 @@ export const UpdateDocument = observer(function UpdateDocument({
|
|
|
348
357
|
visible={visible}
|
|
349
358
|
onRequestClose={() => setIsVisible(false)}
|
|
350
359
|
/>
|
|
351
|
-
<
|
|
360
|
+
<Loading isLoading={isLoading} />
|
|
352
361
|
</View>
|
|
353
362
|
);
|
|
354
363
|
});
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import { commonStyles } from '../CommonStyles';
|
|
31
31
|
import * as yup from 'yup';
|
|
32
32
|
import FullSubmitStore from './store';
|
|
33
|
-
import
|
|
33
|
+
import Loading from '../../components/Loading';
|
|
34
34
|
import LinearGradient from 'react-native-linear-gradient';
|
|
35
35
|
import appStore from '../../AppStore';
|
|
36
36
|
|
|
@@ -46,6 +46,8 @@ export const UpdateInfo = observer(function UpdateInfo({
|
|
|
46
46
|
const navigation = useNavigation();
|
|
47
47
|
const ref = useRef(null);
|
|
48
48
|
const [data, setData] = useState(null);
|
|
49
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
50
|
+
|
|
49
51
|
useEffect(() => {
|
|
50
52
|
if (loan) {
|
|
51
53
|
FullSubmitStore.getDetailLoan(loan?.id, (res) => {
|
|
@@ -125,6 +127,7 @@ export const UpdateInfo = observer(function UpdateInfo({
|
|
|
125
127
|
}, [loan]);
|
|
126
128
|
|
|
127
129
|
const onSubmit = (values: any) => {
|
|
130
|
+
setIsLoading(true);
|
|
128
131
|
const body = {
|
|
129
132
|
Id: data?.id,
|
|
130
133
|
LoanAmount: data?.loanAmount,
|
|
@@ -152,10 +155,17 @@ export const UpdateInfo = observer(function UpdateInfo({
|
|
|
152
155
|
positionCIMBId: values.jobTitle.id,
|
|
153
156
|
};
|
|
154
157
|
|
|
155
|
-
FullSubmitStore.fullSubmit(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
FullSubmitStore.fullSubmit(
|
|
159
|
+
body,
|
|
160
|
+
() => {
|
|
161
|
+
setIsLoading(false);
|
|
162
|
+
FullSubmitStore.tab = 2;
|
|
163
|
+
callback(2);
|
|
164
|
+
},
|
|
165
|
+
() => {
|
|
166
|
+
setIsLoading(false);
|
|
167
|
+
}
|
|
168
|
+
);
|
|
159
169
|
};
|
|
160
170
|
|
|
161
171
|
return (
|
|
@@ -922,7 +932,7 @@ export const UpdateInfo = observer(function UpdateInfo({
|
|
|
922
932
|
</Formik>
|
|
923
933
|
</ScrollView>
|
|
924
934
|
)}
|
|
925
|
-
<
|
|
935
|
+
<Loading isLoading={isLoading} />
|
|
926
936
|
</View>
|
|
927
937
|
);
|
|
928
938
|
});
|
|
@@ -171,16 +171,19 @@ class Store {
|
|
|
171
171
|
Alert.alert('Thông báo', response.data.meta.errorMessage, [
|
|
172
172
|
{ text: 'Đồng ý' },
|
|
173
173
|
]);
|
|
174
|
+
if (onFailure) onFailure();
|
|
174
175
|
} else {
|
|
175
176
|
Alert.alert('Thông báo', response.data.meta.errorMessage, [
|
|
176
177
|
{ text: 'Đồng ý' },
|
|
177
178
|
]);
|
|
178
179
|
this.listLoanPending = null;
|
|
180
|
+
if (onFailure) onFailure();
|
|
179
181
|
}
|
|
180
182
|
} else {
|
|
181
183
|
this.isLoading = false;
|
|
182
184
|
Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau!');
|
|
183
185
|
this.listLoanPending = null;
|
|
186
|
+
if (onFailure) onFailure();
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
189
|
}
|
|
@@ -79,28 +79,42 @@ export const Home = observer(function Home() {
|
|
|
79
79
|
const [showModal2, setShowModal2] = useState(false);
|
|
80
80
|
const [loan, setLoan] = useState(null);
|
|
81
81
|
const [checkEKYC, setCheckEKYC] = useState(null);
|
|
82
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
82
83
|
|
|
83
84
|
const onRefresh = () => {
|
|
85
|
+
setIsLoading(true);
|
|
84
86
|
homeStore.getListLoan();
|
|
85
|
-
homeStore.getListLoanPending(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
homeStore.getListLoanPending(
|
|
88
|
+
async (loan) => {
|
|
89
|
+
setLoan(loan);
|
|
90
|
+
homeStore.getCheckEKYC(
|
|
91
|
+
{ loanBriefId: loan.id },
|
|
92
|
+
(data) => {
|
|
93
|
+
setCheckEKYC(!data);
|
|
94
|
+
setIsLoading(false);
|
|
95
|
+
},
|
|
96
|
+
() => {
|
|
97
|
+
setIsLoading(false);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
if (
|
|
101
|
+
loan.messageErrorCIMB !== '' &&
|
|
102
|
+
loan?.messageErrorCIMB &&
|
|
103
|
+
loan?.isCimbApproveFull === null
|
|
104
|
+
) {
|
|
105
|
+
setShowModal(true);
|
|
106
|
+
}
|
|
107
|
+
if (loan?.typeLoan === 4 && loan?.isCimbApproveFull !== null) {
|
|
108
|
+
const checkShow = await load(`SHOW_${loan?.id}`);
|
|
109
|
+
if (!checkShow || checkShow !== true) {
|
|
110
|
+
setShowModal2(true);
|
|
111
|
+
}
|
|
101
112
|
}
|
|
113
|
+
},
|
|
114
|
+
() => {
|
|
115
|
+
setIsLoading(false);
|
|
102
116
|
}
|
|
103
|
-
|
|
117
|
+
);
|
|
104
118
|
};
|
|
105
119
|
|
|
106
120
|
useEffect(() => {
|
|
@@ -303,10 +317,7 @@ export const Home = observer(function Home() {
|
|
|
303
317
|
</LinearGradient>
|
|
304
318
|
<ScrollView
|
|
305
319
|
refreshControl={
|
|
306
|
-
<RefreshControl
|
|
307
|
-
refreshing={homeStore.isLoading}
|
|
308
|
-
onRefresh={onRefresh}
|
|
309
|
-
/>
|
|
320
|
+
<RefreshControl refreshing={false} onRefresh={onRefresh} />
|
|
310
321
|
}
|
|
311
322
|
style={{ flex: 1, marginBottom: 16 }}
|
|
312
323
|
>
|
|
@@ -638,18 +649,30 @@ export const Home = observer(function Home() {
|
|
|
638
649
|
paddingHorizontal: 16,
|
|
639
650
|
}}
|
|
640
651
|
>
|
|
641
|
-
<View
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
652
|
+
<View
|
|
653
|
+
style={{
|
|
654
|
+
flexDirection: 'row',
|
|
655
|
+
justifyContent: 'space-between',
|
|
656
|
+
alignItems: 'center',
|
|
657
|
+
}}
|
|
658
|
+
>
|
|
659
|
+
<View
|
|
660
|
+
style={{
|
|
661
|
+
flex: 1,
|
|
662
|
+
flexDirection: 'row',
|
|
663
|
+
paddingRight: 20,
|
|
664
|
+
}}
|
|
665
|
+
>
|
|
666
|
+
<Image
|
|
667
|
+
source={require('./error.png')}
|
|
668
|
+
style={{ width: 16, height: 16 }}
|
|
669
|
+
/>
|
|
670
|
+
<MText style={{ marginLeft: 5 }}>
|
|
671
|
+
Đơn vay của bạn gặp gián đoạn, vui lòng
|
|
672
|
+
liên hệ tổng đài 1900633688
|
|
651
673
|
</MText>
|
|
652
|
-
</
|
|
674
|
+
</View>
|
|
675
|
+
|
|
653
676
|
<TouchableOpacity
|
|
654
677
|
onPress={() => {
|
|
655
678
|
Linking.openURL(`tel:1900633688`);
|
|
@@ -658,17 +681,20 @@ export const Home = observer(function Home() {
|
|
|
658
681
|
<LinearGradient
|
|
659
682
|
colors={['#FF8E4F', '#EF592E']}
|
|
660
683
|
style={{
|
|
661
|
-
paddingHorizontal:
|
|
684
|
+
paddingHorizontal: 10,
|
|
662
685
|
height: 30,
|
|
663
686
|
borderRadius: 30,
|
|
664
687
|
justifyContent: 'center',
|
|
665
688
|
alignItems: 'center',
|
|
689
|
+
flexDirection: 'row',
|
|
666
690
|
}}
|
|
667
691
|
>
|
|
692
|
+
<Call />
|
|
668
693
|
<MText
|
|
669
694
|
style={{
|
|
670
695
|
color: 'white',
|
|
671
696
|
fontSize: 12,
|
|
697
|
+
marginLeft: 5,
|
|
672
698
|
}}
|
|
673
699
|
>
|
|
674
700
|
Liên hệ
|
|
@@ -1718,7 +1744,7 @@ export const Home = observer(function Home() {
|
|
|
1718
1744
|
</View>
|
|
1719
1745
|
</SafeAreaView>
|
|
1720
1746
|
</Modal>
|
|
1721
|
-
<Observer>{() => <Loading isLoading={
|
|
1747
|
+
<Observer>{() => <Loading isLoading={isLoading} />}</Observer>
|
|
1722
1748
|
</View>
|
|
1723
1749
|
);
|
|
1724
1750
|
});
|
|
@@ -121,11 +121,13 @@ class Store {
|
|
|
121
121
|
Alert.alert('Thông báo', response.data.meta.errorMessage, [
|
|
122
122
|
{ text: 'Đồng ý' },
|
|
123
123
|
]);
|
|
124
|
+
if (onFailure) onFailure();
|
|
124
125
|
}
|
|
125
126
|
} else {
|
|
126
127
|
this.isLoading = false;
|
|
127
128
|
this.isError = false;
|
|
128
129
|
Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau!');
|
|
130
|
+
if (onFailure) onFailure();
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
}
|
|
@@ -55,11 +55,13 @@ const logoView: ImageStyle = {
|
|
|
55
55
|
|
|
56
56
|
export const NationalID = observer(function NationalID(props: any) {
|
|
57
57
|
const navigation = useNavigation();
|
|
58
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
58
59
|
const [photo, setPhoto] = useState(null);
|
|
59
60
|
const [base64, setBase64] = useState(null);
|
|
60
61
|
const loan = toJS(props.route.params?.loan);
|
|
61
62
|
|
|
62
63
|
const nextStep = () => {
|
|
64
|
+
setIsLoading(true);
|
|
63
65
|
const form = new FormData();
|
|
64
66
|
form.append('image', {
|
|
65
67
|
uri: photo,
|
|
@@ -72,12 +74,19 @@ export const NationalID = observer(function NationalID(props: any) {
|
|
|
72
74
|
form.append('UploadFrom', 3);
|
|
73
75
|
form.append('SubTypeId', 1);
|
|
74
76
|
|
|
75
|
-
nationalIDStore.uploadImage(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
nationalIDStore.uploadImage(
|
|
78
|
+
form,
|
|
79
|
+
() => {
|
|
80
|
+
setIsLoading(false);
|
|
81
|
+
nationalIDStore.photo = photo;
|
|
82
|
+
navigation.dispatch(
|
|
83
|
+
StackActions.push(ScreenNames.NationalIDBack, { loan })
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
() => {
|
|
87
|
+
setIsLoading(false);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
81
90
|
};
|
|
82
91
|
|
|
83
92
|
const takePhoto = () => {
|
|
@@ -292,7 +301,7 @@ export const NationalID = observer(function NationalID(props: any) {
|
|
|
292
301
|
)}
|
|
293
302
|
<KeyboardSpacer />
|
|
294
303
|
</SafeAreaView>
|
|
295
|
-
<Loading isLoading={
|
|
304
|
+
<Loading isLoading={isLoading} />
|
|
296
305
|
</View>
|
|
297
306
|
);
|
|
298
307
|
});
|
|
@@ -71,7 +71,7 @@ class Store {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
@action
|
|
74
|
-
async uploadImage(body, onSuccess?) {
|
|
74
|
+
async uploadImage(body, onSuccess?, onError?) {
|
|
75
75
|
this.isLoading = true;
|
|
76
76
|
const response = await Api.getInstance().uploadDocument(body);
|
|
77
77
|
this.isLoading = false;
|
|
@@ -84,6 +84,7 @@ class Store {
|
|
|
84
84
|
onSuccess(response.data.data);
|
|
85
85
|
}
|
|
86
86
|
} else {
|
|
87
|
+
if (onError) onError();
|
|
87
88
|
Alert.alert('Thông báo', response.data.meta.errorMessage, [
|
|
88
89
|
{ text: 'Đồng ý' },
|
|
89
90
|
]);
|
|
@@ -91,6 +92,7 @@ class Store {
|
|
|
91
92
|
} else {
|
|
92
93
|
this.isLoading = false;
|
|
93
94
|
this.isError = false;
|
|
95
|
+
if (onError) onError();
|
|
94
96
|
Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau', [
|
|
95
97
|
{ text: 'Đồng ý' },
|
|
96
98
|
]);
|
|
@@ -42,14 +42,10 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
|
|
|
42
42
|
const [photo, setPhoto] = useState(null);
|
|
43
43
|
const loan = props.route.params?.loan;
|
|
44
44
|
const [base64, setBase64] = useState(null);
|
|
45
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
45
46
|
|
|
46
47
|
const nextStep = (values) => {
|
|
47
|
-
|
|
48
|
-
// form.append("image", {
|
|
49
|
-
// uri: photo,
|
|
50
|
-
// type: "image/jpg",
|
|
51
|
-
// name: "image.jpg",
|
|
52
|
-
// })
|
|
48
|
+
setIsLoading(true);
|
|
53
49
|
const form2 = new FormData();
|
|
54
50
|
form2.append('image', {
|
|
55
51
|
uri: photo,
|
|
@@ -60,21 +56,16 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
|
|
|
60
56
|
form2.append('TypeDocumentId', 311);
|
|
61
57
|
form2.append('UploadFrom', 3);
|
|
62
58
|
form2.append('SubTypeId', 2);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// },
|
|
74
|
-
// )
|
|
75
|
-
nationalIDStore.uploadImage(form2, () => {
|
|
76
|
-
navigation.dispatch(StackActions.push(ScreenNames.Selfie, { loan }));
|
|
77
|
-
});
|
|
59
|
+
nationalIDStore.uploadImage(
|
|
60
|
+
form2,
|
|
61
|
+
() => {
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
navigation.dispatch(StackActions.push(ScreenNames.Selfie, { loan }));
|
|
64
|
+
},
|
|
65
|
+
() => {
|
|
66
|
+
setIsLoading(false);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
78
69
|
};
|
|
79
70
|
|
|
80
71
|
const takePhoto = () => {
|
|
@@ -291,7 +282,7 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
|
|
|
291
282
|
)}
|
|
292
283
|
<KeyboardSpacer />
|
|
293
284
|
</SafeAreaView>
|
|
294
|
-
<Loading isLoading={
|
|
285
|
+
<Loading isLoading={isLoading} />
|
|
295
286
|
</View>
|
|
296
287
|
);
|
|
297
288
|
});
|
|
@@ -40,93 +40,105 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
|
|
|
40
40
|
const [loan, setLoan] = useState(null);
|
|
41
41
|
const [showDatePicker, setShowDatePicker] = useState(false);
|
|
42
42
|
const [typePicker, setTypePicker] = useState(0);
|
|
43
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
43
44
|
|
|
44
45
|
useEffect(() => {
|
|
46
|
+
setIsLoading(true);
|
|
45
47
|
QuickSubmitStore.getBrandProduct();
|
|
46
48
|
QuickSubmitStore.getProvinces();
|
|
47
|
-
QuickSubmitStore.getDetailLoan(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
data?.fullName ? data?.fullName : ''
|
|
52
|
-
);
|
|
53
|
-
ref.current.setFieldValue('dob', data?.dob ? data?.dob : '');
|
|
54
|
-
ref.current.setFieldValue('phone', data?.phone ? data?.phone : '');
|
|
55
|
-
ref.current.setFieldValue(
|
|
56
|
-
'nationalCard',
|
|
57
|
-
data?.nationalId ? data?.nationalId : ''
|
|
58
|
-
);
|
|
59
|
-
ref.current.setFieldValue(
|
|
60
|
-
'nationalCardDate',
|
|
61
|
-
data?.dateNationalId ? data?.dateNationalId : ''
|
|
62
|
-
);
|
|
63
|
-
ref.current.setFieldValue('email', data?.email ? data?.email : '');
|
|
64
|
-
ref.current.setFieldValue(
|
|
65
|
-
'loanAmount',
|
|
66
|
-
data?.loanAmount ? data?.loanAmount : 0
|
|
67
|
-
);
|
|
68
|
-
ref.current.setFieldValue(
|
|
69
|
-
'loanTime',
|
|
70
|
-
data?.loanTime ? data?.loanTime : ''
|
|
71
|
-
);
|
|
72
|
-
ref.current.setFieldValue(
|
|
73
|
-
'salary',
|
|
74
|
-
data?.totalIncome ? data?.totalIncome : 0
|
|
75
|
-
);
|
|
76
|
-
ref.current.setFieldValue(
|
|
77
|
-
'province',
|
|
78
|
-
data?.provinceId
|
|
79
|
-
? { id: data?.provinceId, name: data?.provinceName }
|
|
80
|
-
: null
|
|
81
|
-
);
|
|
82
|
-
ref.current.setFieldValue(
|
|
83
|
-
'brand',
|
|
84
|
-
data?.brandId ? { id: data?.brandId, name: data?.brandName } : null
|
|
85
|
-
);
|
|
86
|
-
if (data?.brandId) {
|
|
87
|
-
QuickSubmitStore.getYearProduct(data?.brandId);
|
|
88
|
-
}
|
|
89
|
-
ref.current.setFieldValue(
|
|
90
|
-
'year',
|
|
91
|
-
data?.yearProductBrand
|
|
92
|
-
? {
|
|
93
|
-
id: data?.yearProductBrand,
|
|
94
|
-
name: `Năm ${data?.yearProductBrand}`,
|
|
95
|
-
}
|
|
96
|
-
: null
|
|
97
|
-
);
|
|
98
|
-
if (data?.yearProductBrand) {
|
|
99
|
-
QuickSubmitStore.getModelProduct(data?.brandId, data?.yearProductBrand);
|
|
100
|
-
}
|
|
101
|
-
ref.current.setFieldValue(
|
|
102
|
-
'model',
|
|
103
|
-
data?.productBrandId
|
|
104
|
-
? { id: data?.productBrandId, name: data?.productBrandName }
|
|
105
|
-
: null
|
|
106
|
-
);
|
|
107
|
-
ref.current.setFieldValue(
|
|
108
|
-
'occupation',
|
|
109
|
-
data?.jobNameCIMB
|
|
110
|
-
? {
|
|
111
|
-
id: data?.jobCIMBId,
|
|
112
|
-
name: data?.jobNameCIMB,
|
|
113
|
-
}
|
|
114
|
-
: null
|
|
115
|
-
);
|
|
116
|
-
ref.current.setFieldValue('productId', data?.productId),
|
|
49
|
+
QuickSubmitStore.getDetailLoan(
|
|
50
|
+
props?.route?.params?.loan?.id,
|
|
51
|
+
(data) => {
|
|
52
|
+
setLoan(data);
|
|
117
53
|
ref.current.setFieldValue(
|
|
118
|
-
'
|
|
119
|
-
data?.
|
|
120
|
-
)
|
|
54
|
+
'fullName',
|
|
55
|
+
data?.fullName ? data?.fullName : ''
|
|
56
|
+
);
|
|
57
|
+
ref.current.setFieldValue('dob', data?.dob ? data?.dob : '');
|
|
58
|
+
ref.current.setFieldValue('phone', data?.phone ? data?.phone : '');
|
|
121
59
|
ref.current.setFieldValue(
|
|
122
|
-
'
|
|
123
|
-
data?.
|
|
124
|
-
)
|
|
60
|
+
'nationalCard',
|
|
61
|
+
data?.nationalId ? data?.nationalId : ''
|
|
62
|
+
);
|
|
125
63
|
ref.current.setFieldValue(
|
|
126
|
-
'
|
|
127
|
-
data?.
|
|
64
|
+
'nationalCardDate',
|
|
65
|
+
data?.dateNationalId ? data?.dateNationalId : ''
|
|
128
66
|
);
|
|
129
|
-
|
|
67
|
+
ref.current.setFieldValue('email', data?.email ? data?.email : '');
|
|
68
|
+
ref.current.setFieldValue(
|
|
69
|
+
'loanAmount',
|
|
70
|
+
data?.loanAmount ? data?.loanAmount : 0
|
|
71
|
+
);
|
|
72
|
+
ref.current.setFieldValue(
|
|
73
|
+
'loanTime',
|
|
74
|
+
data?.loanTime ? data?.loanTime : ''
|
|
75
|
+
);
|
|
76
|
+
ref.current.setFieldValue(
|
|
77
|
+
'salary',
|
|
78
|
+
data?.totalIncome ? data?.totalIncome : 0
|
|
79
|
+
);
|
|
80
|
+
ref.current.setFieldValue(
|
|
81
|
+
'province',
|
|
82
|
+
data?.provinceId
|
|
83
|
+
? { id: data?.provinceId, name: data?.provinceName }
|
|
84
|
+
: null
|
|
85
|
+
);
|
|
86
|
+
ref.current.setFieldValue(
|
|
87
|
+
'brand',
|
|
88
|
+
data?.brandId ? { id: data?.brandId, name: data?.brandName } : null
|
|
89
|
+
);
|
|
90
|
+
if (data?.brandId) {
|
|
91
|
+
QuickSubmitStore.getYearProduct(data?.brandId);
|
|
92
|
+
}
|
|
93
|
+
ref.current.setFieldValue(
|
|
94
|
+
'year',
|
|
95
|
+
data?.yearProductBrand
|
|
96
|
+
? {
|
|
97
|
+
id: data?.yearProductBrand,
|
|
98
|
+
name: `Năm ${data?.yearProductBrand}`,
|
|
99
|
+
}
|
|
100
|
+
: null
|
|
101
|
+
);
|
|
102
|
+
if (data?.yearProductBrand) {
|
|
103
|
+
QuickSubmitStore.getModelProduct(
|
|
104
|
+
data?.brandId,
|
|
105
|
+
data?.yearProductBrand
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
ref.current.setFieldValue(
|
|
109
|
+
'model',
|
|
110
|
+
data?.productBrandId
|
|
111
|
+
? { id: data?.productBrandId, name: data?.productBrandName }
|
|
112
|
+
: null
|
|
113
|
+
);
|
|
114
|
+
ref.current.setFieldValue(
|
|
115
|
+
'occupation',
|
|
116
|
+
data?.jobNameCIMB
|
|
117
|
+
? {
|
|
118
|
+
id: data?.jobCIMBId,
|
|
119
|
+
name: data?.jobNameCIMB,
|
|
120
|
+
}
|
|
121
|
+
: null
|
|
122
|
+
);
|
|
123
|
+
ref.current.setFieldValue('productId', data?.productId),
|
|
124
|
+
ref.current.setFieldValue(
|
|
125
|
+
'vehiclesCar',
|
|
126
|
+
data?.vehiclesCar ? data?.vehiclesCar : ''
|
|
127
|
+
),
|
|
128
|
+
ref.current.setFieldValue(
|
|
129
|
+
'yearCar',
|
|
130
|
+
data?.yearCar ? String(data?.yearCar) : ''
|
|
131
|
+
),
|
|
132
|
+
ref.current.setFieldValue(
|
|
133
|
+
'brandCar',
|
|
134
|
+
data?.brandCar ? data?.brandCar : ''
|
|
135
|
+
);
|
|
136
|
+
setIsLoading(false);
|
|
137
|
+
},
|
|
138
|
+
() => {
|
|
139
|
+
setIsLoading(false);
|
|
140
|
+
}
|
|
141
|
+
);
|
|
130
142
|
}, []);
|
|
131
143
|
|
|
132
144
|
const onSubmit = (values: any) => {
|
|
@@ -1051,7 +1063,7 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
|
|
|
1051
1063
|
</Formik>
|
|
1052
1064
|
</ScrollView>
|
|
1053
1065
|
</SafeAreaView>
|
|
1054
|
-
<CIMBLoading isLoading={
|
|
1066
|
+
<CIMBLoading isLoading={isLoading} />
|
|
1055
1067
|
</View>
|
|
1056
1068
|
);
|
|
1057
1069
|
});
|
|
@@ -137,7 +137,7 @@ class Store {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
@action
|
|
140
|
-
async getDetailLoan(id, onSuccess?) {
|
|
140
|
+
async getDetailLoan(id, onSuccess?, onError?) {
|
|
141
141
|
this.isLoading = true;
|
|
142
142
|
try {
|
|
143
143
|
const response = await Api.getInstance().getDetailLoan(id);
|
|
@@ -148,13 +148,16 @@ class Store {
|
|
|
148
148
|
if (onSuccess) onSuccess(response.data.data);
|
|
149
149
|
} else {
|
|
150
150
|
Alert.alert('Thông báo', response.data.meta.errorMessage);
|
|
151
|
+
if (onError) onError();
|
|
151
152
|
}
|
|
152
153
|
} else {
|
|
153
154
|
Alert.alert('Thông báo', 'Không thể lấy thông tin đơn vay');
|
|
155
|
+
if (onError) onError();
|
|
154
156
|
}
|
|
155
157
|
} catch (error) {
|
|
156
158
|
this.isLoading = false;
|
|
157
159
|
console.log(error);
|
|
160
|
+
if (onError) onError();
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
|
|
@@ -47,31 +47,7 @@ export const Video = observer(function Video(props: any) {
|
|
|
47
47
|
Platform.OS === 'ios'
|
|
48
48
|
? [PERMISSIONS.IOS.CAMERA, PERMISSIONS.IOS.MICROPHONE]
|
|
49
49
|
: [PERMISSIONS.ANDROID.CAMERA, PERMISSIONS.ANDROID.RECORD_AUDIO]
|
|
50
|
-
).then((statuses) => {
|
|
51
|
-
console.log(statuses);
|
|
52
|
-
|
|
53
|
-
// if (Platform.OS === 'android') {
|
|
54
|
-
// if (
|
|
55
|
-
// statuses[PERMISSIONS.ANDROID.CAMERA] !== 'granted' ||
|
|
56
|
-
// statuses[PERMISSIONS.ANDROID.RECORD_AUDIO] !== 'granted'
|
|
57
|
-
// ) {
|
|
58
|
-
// requestMultiple([
|
|
59
|
-
// PERMISSIONS.ANDROID.CAMERA,
|
|
60
|
-
// PERMISSIONS.ANDROID.RECORD_AUDIO,
|
|
61
|
-
// ]).then((statuses) => {});
|
|
62
|
-
// }
|
|
63
|
-
// } else {
|
|
64
|
-
// if (
|
|
65
|
-
// statuses[PERMISSIONS.IOS.CAMERA] !== 'granted' ||
|
|
66
|
-
// statuses[PERMISSIONS.IOS.MICROPHONE] !== 'granted'
|
|
67
|
-
// ) {
|
|
68
|
-
// requestMultiple([
|
|
69
|
-
// PERMISSIONS.IOS.CAMERA,
|
|
70
|
-
// PERMISSIONS.IOS.MICROPHONE,
|
|
71
|
-
// ]).then((statuses) => {});
|
|
72
|
-
// }
|
|
73
|
-
// }
|
|
74
|
-
});
|
|
50
|
+
).then((statuses) => {});
|
|
75
51
|
};
|
|
76
52
|
|
|
77
53
|
useEffect(() => {
|