react-native-timacare 2.0.11 → 2.0.13
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/navigation/primary-navigator.js +1 -1
- package/lib/commonjs/navigation/primary-navigator.js.flow +6 -0
- package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
- package/lib/commonjs/screens/eSign/PreviewContract.js +2 -0
- package/lib/commonjs/screens/eSign/PreviewContract.js.flow +76 -0
- package/lib/commonjs/screens/eSign/PreviewContract.js.map +1 -0
- package/lib/commonjs/screens/eSign/Store.js +1 -1
- package/lib/commonjs/screens/eSign/Store.js.flow +22 -1
- package/lib/commonjs/screens/eSign/Store.js.map +1 -1
- package/lib/commonjs/screens/eSign/index.js +1 -1
- package/lib/commonjs/screens/eSign/index.js.flow +281 -181
- package/lib/commonjs/screens/eSign/index.js.map +1 -1
- package/lib/commonjs/services/api/api.js +1 -1
- package/lib/commonjs/services/api/api.js.flow +17 -0
- package/lib/commonjs/services/api/api.js.map +1 -1
- package/lib/module/navigation/primary-navigator.js +1 -1
- package/lib/module/navigation/primary-navigator.js.map +1 -1
- package/lib/module/screens/eSign/PreviewContract.js +2 -0
- package/lib/module/screens/eSign/PreviewContract.js.map +1 -0
- package/lib/module/screens/eSign/Store.js +1 -1
- package/lib/module/screens/eSign/Store.js.map +1 -1
- package/lib/module/screens/eSign/index.js +1 -1
- package/lib/module/screens/eSign/index.js.map +1 -1
- package/lib/module/services/api/api.js +1 -1
- package/lib/module/services/api/api.js.map +1 -1
- package/lib/typescript/navigation/primary-navigator.d.ts +1 -0
- package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
- package/lib/typescript/screens/eSign/PreviewContract.d.ts +2 -0
- package/lib/typescript/screens/eSign/PreviewContract.d.ts.map +1 -0
- package/lib/typescript/screens/eSign/Store.d.ts +1 -0
- package/lib/typescript/screens/eSign/Store.d.ts.map +1 -1
- package/lib/typescript/screens/eSign/index.d.ts.map +1 -1
- package/lib/typescript/services/api/api.d.ts +16 -0
- package/lib/typescript/services/api/api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/navigation/primary-navigator.tsx +6 -0
- package/src/screens/eSign/PreviewContract.tsx +76 -0
- package/src/screens/eSign/Store.tsx +22 -1
- package/src/screens/eSign/index.tsx +281 -181
- package/src/services/api/api.ts +17 -0
|
@@ -50,6 +50,7 @@ import { DigitalLending } from '../screens/digital-lending';
|
|
|
50
50
|
import { DetailLoanTima } from '../screens/detail-loan/DetailLoanTima';
|
|
51
51
|
import MRZScanner from '../screens/mrz-scanner';
|
|
52
52
|
import { LivenessV2 } from '../screens/liveness-v2';
|
|
53
|
+
import PreviewContract from '../screens/eSign/PreviewContract';
|
|
53
54
|
|
|
54
55
|
export const ScreenNames = {
|
|
55
56
|
Splash: 'Splash',
|
|
@@ -100,6 +101,7 @@ export const ScreenNames = {
|
|
|
100
101
|
DetailLoanTima: 'DetailLoanTima',
|
|
101
102
|
MRZScanner: 'MRZScanner',
|
|
102
103
|
LivenessV2: 'LivenessV2',
|
|
104
|
+
PreviewContract: 'PreviewContract',
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
const Stack = createNativeStackNavigator();
|
|
@@ -189,6 +191,10 @@ export function PrimaryNavigator() {
|
|
|
189
191
|
/>
|
|
190
192
|
<Stack.Screen name={ScreenNames.MRZScanner} component={MRZScanner} />
|
|
191
193
|
<Stack.Screen name={ScreenNames.LivenessV2} component={LivenessV2} />
|
|
194
|
+
<Stack.Screen
|
|
195
|
+
name={ScreenNames.PreviewContract}
|
|
196
|
+
component={PreviewContract}
|
|
197
|
+
/>
|
|
192
198
|
</Stack.Navigator>
|
|
193
199
|
);
|
|
194
200
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SafeAreaView, View } from 'react-native';
|
|
4
|
+
import { MText } from '../../components/MText';
|
|
5
|
+
import { color } from '../../theme';
|
|
6
|
+
import { IconBack } from '../../assets/icons';
|
|
7
|
+
import { commonStyles } from '../CommonStyles';
|
|
8
|
+
import MButton from '../../components/MButton';
|
|
9
|
+
import { useNavigation } from '@react-navigation/native';
|
|
10
|
+
import Pdf from 'react-native-pdf';
|
|
11
|
+
|
|
12
|
+
export default function PreviewContract(props: any) {
|
|
13
|
+
const navigation = useNavigation();
|
|
14
|
+
const source = props?.route?.params;
|
|
15
|
+
return (
|
|
16
|
+
<View style={{ flex: 1, backgroundColor: 'white' }}>
|
|
17
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
18
|
+
<View
|
|
19
|
+
style={[
|
|
20
|
+
commonStyles.row,
|
|
21
|
+
commonStyles.alignCenter,
|
|
22
|
+
{ paddingHorizontal: 16, height: 55 },
|
|
23
|
+
]}
|
|
24
|
+
>
|
|
25
|
+
<MButton
|
|
26
|
+
//@ts-ignore
|
|
27
|
+
onPress={() => {
|
|
28
|
+
navigation.goBack();
|
|
29
|
+
}}
|
|
30
|
+
style={{
|
|
31
|
+
width: 30,
|
|
32
|
+
height: 55,
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<IconBack width={18} height={18} fill={'black'} />
|
|
38
|
+
</MButton>
|
|
39
|
+
|
|
40
|
+
<MText
|
|
41
|
+
style={{
|
|
42
|
+
marginRight: 30,
|
|
43
|
+
fontSize: 16,
|
|
44
|
+
paddingHorizontal: 4,
|
|
45
|
+
color: color.headerColor,
|
|
46
|
+
fontWeight: 'bold',
|
|
47
|
+
textAlign: 'center',
|
|
48
|
+
flex: 1,
|
|
49
|
+
}}
|
|
50
|
+
></MText>
|
|
51
|
+
</View>
|
|
52
|
+
<View style={{ backgroundColor: color.border }} />
|
|
53
|
+
<View style={{ flex: 1 }}>
|
|
54
|
+
<Pdf
|
|
55
|
+
source={source}
|
|
56
|
+
onLoadComplete={(numberOfPages, filePath) => {
|
|
57
|
+
console.log(`Number of pages: ${numberOfPages}`);
|
|
58
|
+
}}
|
|
59
|
+
onPageChanged={(page, numberOfPages) => {
|
|
60
|
+
console.log(`Current page: ${page}`);
|
|
61
|
+
}}
|
|
62
|
+
onError={(error) => {
|
|
63
|
+
console.log(error);
|
|
64
|
+
}}
|
|
65
|
+
onPressLink={(uri) => {
|
|
66
|
+
console.log(`Link pressed: ${uri}`);
|
|
67
|
+
}}
|
|
68
|
+
style={{
|
|
69
|
+
flex: 1,
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</View>
|
|
73
|
+
</SafeAreaView>
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -11,7 +11,7 @@ class Store {
|
|
|
11
11
|
@observable reSendOTPLoading = false;
|
|
12
12
|
|
|
13
13
|
@observable countDown;
|
|
14
|
-
@observable currentTime =
|
|
14
|
+
@observable currentTime = 10;
|
|
15
15
|
|
|
16
16
|
@observable linkPreview = '';
|
|
17
17
|
@observable linkContract = '';
|
|
@@ -125,6 +125,27 @@ class Store {
|
|
|
125
125
|
]);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
@action
|
|
130
|
+
async getPreviewContract(id, onSuccess, onError) {
|
|
131
|
+
try {
|
|
132
|
+
const response = await Api.getInstance().previewContract(id);
|
|
133
|
+
if (response.kind === 'ok') {
|
|
134
|
+
if (response.data.meta.errorCode === 200) {
|
|
135
|
+
if (onSuccess) onSuccess(response.data.data);
|
|
136
|
+
} else {
|
|
137
|
+
Alert.alert('Thông báo', response.data.meta.errorMessage);
|
|
138
|
+
if (onError) onError();
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau');
|
|
142
|
+
if (onError) onError();
|
|
143
|
+
}
|
|
144
|
+
} catch (error) {
|
|
145
|
+
Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau');
|
|
146
|
+
if (onError) onError();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
128
149
|
}
|
|
129
150
|
const eSignStore = new Store();
|
|
130
151
|
export default eSignStore;
|
|
@@ -10,10 +10,12 @@ import {
|
|
|
10
10
|
ActivityIndicator,
|
|
11
11
|
Platform,
|
|
12
12
|
Alert,
|
|
13
|
+
TouchableOpacity,
|
|
13
14
|
} from 'react-native';
|
|
14
15
|
import { CommonActions, useNavigation } from '@react-navigation/native';
|
|
15
|
-
import { observer } from 'mobx-react-lite';
|
|
16
|
+
import { observer, Observer } from 'mobx-react-lite';
|
|
16
17
|
import WebView from 'react-native-webview';
|
|
18
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
17
19
|
import { commonStyles } from '../CommonStyles';
|
|
18
20
|
import MButton from '../../components/MButton';
|
|
19
21
|
import { MText, MTextInput } from '../../components/MText';
|
|
@@ -28,27 +30,36 @@ import { ScreenNames } from '../../navigation';
|
|
|
28
30
|
import Slack from 'react-native-slack-webhook';
|
|
29
31
|
import homeStore from '../home/Store';
|
|
30
32
|
import appStore from '../../AppStore';
|
|
33
|
+
import Pdf from 'react-native-pdf';
|
|
34
|
+
import Modal from 'react-native-modal';
|
|
35
|
+
import KeyboardSpacer from '../../components/keyboardspace';
|
|
36
|
+
import Loading from '../../components/Loading';
|
|
37
|
+
|
|
31
38
|
const webHookURL =
|
|
32
39
|
'https://hooks.slack.com/services/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';
|
|
33
40
|
|
|
34
41
|
export const ESign = observer(function ESign(props: any) {
|
|
35
42
|
const navigation = useNavigation();
|
|
36
43
|
const loan = props.route.params?.loan;
|
|
37
|
-
const [
|
|
44
|
+
const [loading, setLoading] = useState(true);
|
|
45
|
+
const [contract, setContract] = useState<any>();
|
|
46
|
+
const [showModal, setShowModal] = useState(false);
|
|
47
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
48
|
+
const [currentTime, setCurrentTime] = useState(300);
|
|
49
|
+
const timerRef = React.useRef(currentTime);
|
|
38
50
|
|
|
39
51
|
const countDown = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
eSignStore.countDown = setInterval(() => {
|
|
45
|
-
if (eSignStore.currentTime > 0) {
|
|
46
|
-
eSignStore.currentTime = eSignStore.currentTime - 1;
|
|
47
|
-
myLog(eSignStore.currentTime);
|
|
52
|
+
const timerId = setInterval(() => {
|
|
53
|
+
timerRef.current -= 1;
|
|
54
|
+
if (timerRef.current < 0) {
|
|
55
|
+
clearInterval(timerId);
|
|
48
56
|
} else {
|
|
49
|
-
|
|
57
|
+
setCurrentTime(timerRef.current);
|
|
50
58
|
}
|
|
51
59
|
}, 1000);
|
|
60
|
+
return () => {
|
|
61
|
+
clearInterval(timerId);
|
|
62
|
+
};
|
|
52
63
|
};
|
|
53
64
|
|
|
54
65
|
const verify = (OTP) => {
|
|
@@ -68,38 +79,48 @@ export const ESign = observer(function ESign(props: any) {
|
|
|
68
79
|
'#timacare'
|
|
69
80
|
);
|
|
70
81
|
} catch (e) {}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
setShowModal(false);
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
Alert.alert('Thông báo', 'Ký hợp đồng thành công', [
|
|
85
|
+
{
|
|
86
|
+
text: 'Đồng ý',
|
|
87
|
+
onPress: () => {
|
|
88
|
+
navigation.dispatch(
|
|
89
|
+
CommonActions.reset({
|
|
90
|
+
index: 1,
|
|
91
|
+
routes: [
|
|
92
|
+
{
|
|
93
|
+
name: ScreenNames.Main,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
})
|
|
97
|
+
);
|
|
78
98
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
}, 300);
|
|
82
102
|
}
|
|
83
103
|
);
|
|
84
104
|
}
|
|
85
105
|
};
|
|
86
106
|
|
|
87
|
-
|
|
107
|
+
const signContract = () => {
|
|
108
|
+
setIsLoading(true);
|
|
88
109
|
eSignStore.signContractForBorrower(
|
|
89
110
|
{
|
|
90
111
|
loanBriefId: loan.id,
|
|
91
112
|
},
|
|
92
113
|
() => {
|
|
114
|
+
setIsLoading(false);
|
|
115
|
+
setShowModal(true);
|
|
93
116
|
countDown();
|
|
94
117
|
},
|
|
95
118
|
() => {
|
|
96
119
|
navigation.goBack();
|
|
120
|
+
setIsLoading(false);
|
|
97
121
|
}
|
|
98
122
|
);
|
|
99
|
-
|
|
100
|
-
clearInterval(eSignStore.countDown);
|
|
101
|
-
};
|
|
102
|
-
}, []);
|
|
123
|
+
};
|
|
103
124
|
|
|
104
125
|
const back = () => {
|
|
105
126
|
navigation.goBack();
|
|
@@ -111,11 +132,26 @@ export const ESign = observer(function ESign(props: any) {
|
|
|
111
132
|
customerId: loan.id,
|
|
112
133
|
},
|
|
113
134
|
() => {
|
|
135
|
+
setCurrentTime(300);
|
|
136
|
+
timerRef.current = 300;
|
|
114
137
|
countDown();
|
|
115
138
|
}
|
|
116
139
|
);
|
|
117
140
|
};
|
|
118
141
|
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
eSignStore.getPreviewContract(
|
|
144
|
+
loan?.id,
|
|
145
|
+
(res) => {
|
|
146
|
+
setContract(res);
|
|
147
|
+
setLoading(false);
|
|
148
|
+
},
|
|
149
|
+
() => {
|
|
150
|
+
setLoading(false);
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}, []);
|
|
154
|
+
|
|
119
155
|
return (
|
|
120
156
|
<View style={{ flex: 1, backgroundColor: 'white' }}>
|
|
121
157
|
<SafeAreaView style={{ flex: 1 }}>
|
|
@@ -153,180 +189,244 @@ export const ESign = observer(function ESign(props: any) {
|
|
|
153
189
|
flex: 1,
|
|
154
190
|
}}
|
|
155
191
|
>
|
|
156
|
-
|
|
192
|
+
Ký hợp đồng
|
|
157
193
|
</MText>
|
|
158
194
|
</View>
|
|
159
195
|
<View style={{ backgroundColor: color.border }} />
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
196
|
+
|
|
197
|
+
<View style={{ flex: 1 }}>
|
|
198
|
+
<Pdf
|
|
199
|
+
source={{
|
|
200
|
+
uri:
|
|
201
|
+
'data:application/pdf;base64,' +
|
|
202
|
+
contract?.base64_hopdongdichvu,
|
|
203
|
+
}}
|
|
204
|
+
onLoadComplete={(numberOfPages, filePath) => {
|
|
205
|
+
console.log(`Number of pages: ${numberOfPages}`);
|
|
206
|
+
}}
|
|
207
|
+
onPageChanged={(page, numberOfPages) => {
|
|
208
|
+
console.log(`Current page: ${page}`);
|
|
209
|
+
}}
|
|
210
|
+
onError={(error) => {
|
|
211
|
+
console.log(error);
|
|
212
|
+
}}
|
|
213
|
+
onPressLink={(uri) => {
|
|
214
|
+
console.log(`Link pressed: ${uri}`);
|
|
215
|
+
}}
|
|
165
216
|
style={{
|
|
166
|
-
|
|
167
|
-
shadowOffset: { width: 0, height: 2 },
|
|
168
|
-
shadowOpacity: 1,
|
|
169
|
-
shadowRadius: 5,
|
|
170
|
-
backgroundColor: 'white',
|
|
171
|
-
elevation: 2,
|
|
172
|
-
margin: 16,
|
|
173
|
-
padding: 24,
|
|
174
|
-
borderRadius: 4,
|
|
175
|
-
borderWidth: 1,
|
|
176
|
-
borderColor: color.border,
|
|
177
|
-
alignItems: 'center',
|
|
217
|
+
flex: 1,
|
|
178
218
|
}}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
219
|
+
/>
|
|
220
|
+
</View>
|
|
221
|
+
<View style={{ paddingHorizontal: 24 }}>
|
|
222
|
+
{contract?.base64_giaoket_1 && (
|
|
223
|
+
<TouchableOpacity
|
|
224
|
+
style={{ marginTop: 10 }}
|
|
225
|
+
onPress={() => {
|
|
226
|
+
navigation.push(ScreenNames.PreviewContract, {
|
|
227
|
+
uri:
|
|
228
|
+
'data:application/pdf;base64,' +
|
|
229
|
+
contract?.base64_giaoket_1,
|
|
230
|
+
});
|
|
183
231
|
}}
|
|
184
|
-
onSubmit={(values) => {}}
|
|
185
|
-
validationSchema={yup.object().shape({
|
|
186
|
-
otp: yup.string().required('Yêu cầu mã OTP.'),
|
|
187
|
-
})}
|
|
188
232
|
>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
handleChange,
|
|
192
|
-
errors,
|
|
193
|
-
setFieldTouched,
|
|
194
|
-
setFieldValue,
|
|
195
|
-
touched,
|
|
196
|
-
isValid,
|
|
197
|
-
handleSubmit,
|
|
198
|
-
}) => (
|
|
199
|
-
<View style={{}}>
|
|
200
|
-
{eSignStore.isLoading ? (
|
|
201
|
-
<View
|
|
202
|
-
style={[
|
|
203
|
-
commonStyles.alignCenter,
|
|
204
|
-
commonStyles.justifyCenter,
|
|
205
|
-
{ paddingVertical: 16 },
|
|
206
|
-
]}
|
|
207
|
-
>
|
|
208
|
-
<ActivityIndicator
|
|
209
|
-
size={'large'}
|
|
210
|
-
color={color.primary}
|
|
211
|
-
/>
|
|
212
|
-
<MText>Đang xác thực số điện thoại của bạn</MText>
|
|
213
|
-
</View>
|
|
214
|
-
) : (
|
|
215
|
-
<View style={{ width: '80%' }}>
|
|
216
|
-
<MText
|
|
217
|
-
style={{
|
|
218
|
-
fontSize: 12,
|
|
219
|
-
color: color.textHeader,
|
|
220
|
-
marginBottom: 10,
|
|
221
|
-
}}
|
|
222
|
-
>{`Nhập mã OTP`}</MText>
|
|
223
|
-
<View
|
|
224
|
-
style={[commonStyles.row, commonStyles.alignCenter]}
|
|
225
|
-
>
|
|
226
|
-
<MTextInput
|
|
227
|
-
placeholderTextColor={'#939598'}
|
|
228
|
-
placeholder={'••••••'}
|
|
229
|
-
style={[
|
|
230
|
-
commonStyles.textNormal,
|
|
231
|
-
commonStyles.fill,
|
|
232
|
-
{
|
|
233
|
-
textAlign: 'center',
|
|
234
|
-
fontSize: 16,
|
|
235
|
-
borderRadius: 4,
|
|
236
|
-
borderWidth: 1,
|
|
237
|
-
borderColor: color.border,
|
|
238
|
-
paddingVertical:
|
|
239
|
-
Platform.OS === 'android' ? 8 : 14,
|
|
240
|
-
paddingHorizontal: 16,
|
|
241
|
-
},
|
|
242
|
-
]}
|
|
243
|
-
onChangeText={(text) => {
|
|
244
|
-
setFieldValue('otp', text);
|
|
245
|
-
if (
|
|
246
|
-
text.length === 6 &&
|
|
247
|
-
eSignStore.currentTime !== 0
|
|
248
|
-
) {
|
|
249
|
-
verify(text);
|
|
250
|
-
}
|
|
251
|
-
}}
|
|
252
|
-
maxLength={6}
|
|
253
|
-
onBlur={() => setFieldTouched('otp')}
|
|
254
|
-
returnKeyType={'done'}
|
|
255
|
-
value={values.otp}
|
|
256
|
-
autoFocus={true}
|
|
257
|
-
textContentType={'oneTimeCode'}
|
|
258
|
-
keyboardType={'numeric'}
|
|
259
|
-
/>
|
|
260
|
-
</View>
|
|
261
|
-
<MText
|
|
262
|
-
style={{
|
|
263
|
-
fontSize: 12,
|
|
264
|
-
color: '#AAAAAA',
|
|
265
|
-
marginTop: 8,
|
|
266
|
-
fontStyle: 'italic',
|
|
267
|
-
}}
|
|
268
|
-
>{`Tin nhắn SMS sẽ được gửi tới số điện thoại của bạn có hạn là 5 phút`}</MText>
|
|
269
|
-
</View>
|
|
270
|
-
)}
|
|
271
|
-
</View>
|
|
272
|
-
)}
|
|
273
|
-
</Formik>
|
|
274
|
-
{eSignStore.currentTime === 0 ? (
|
|
275
|
-
<MButton
|
|
276
|
-
onPress={reSendOTP}
|
|
277
|
-
style={[
|
|
278
|
-
commonStyles.alignCenter,
|
|
279
|
-
commonStyles.justifyCenter,
|
|
280
|
-
{
|
|
281
|
-
marginTop: 12,
|
|
282
|
-
backgroundColor: color.primary,
|
|
283
|
-
height: 50,
|
|
284
|
-
borderRadius: 4,
|
|
285
|
-
paddingHorizontal: 20,
|
|
286
|
-
marginLeft: 16,
|
|
287
|
-
},
|
|
288
|
-
]}
|
|
233
|
+
<MText
|
|
234
|
+
style={{ color: 'blue', textDecorationLine: 'underline' }}
|
|
289
235
|
>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
236
|
+
Đề nghị giao kết thoả thuận cho vay 1
|
|
237
|
+
</MText>
|
|
238
|
+
</TouchableOpacity>
|
|
239
|
+
)}
|
|
240
|
+
{contract?.base64_giaoket_2 && (
|
|
241
|
+
<TouchableOpacity
|
|
242
|
+
style={{ marginTop: 10 }}
|
|
243
|
+
onPress={() => {
|
|
244
|
+
navigation.push(ScreenNames.PreviewContract, {
|
|
245
|
+
uri:
|
|
246
|
+
'data:application/pdf;base64,' +
|
|
247
|
+
contract?.base64_giaoket_2,
|
|
248
|
+
});
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
<MText
|
|
252
|
+
style={{ color: 'blue', textDecorationLine: 'underline' }}
|
|
253
|
+
>
|
|
254
|
+
Đề nghị giao kết thoả thuận cho vay 2
|
|
255
|
+
</MText>
|
|
256
|
+
</TouchableOpacity>
|
|
257
|
+
)}
|
|
258
|
+
{contract?.base64_phulucsuadoithoathuanchovay && (
|
|
259
|
+
<TouchableOpacity
|
|
260
|
+
style={{ marginTop: 10 }}
|
|
261
|
+
onPress={() => {
|
|
262
|
+
navigation.push(ScreenNames.PreviewContract, {
|
|
263
|
+
uri:
|
|
264
|
+
'data:application/pdf;base64,' +
|
|
265
|
+
contract?.base64_phulucsuadoithoathuanchovay,
|
|
266
|
+
});
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
<MText
|
|
270
|
+
style={{ color: 'blue', textDecorationLine: 'underline' }}
|
|
271
|
+
>
|
|
272
|
+
Phụ lục sửa đổi thoả thuận cho vay
|
|
273
|
+
</MText>
|
|
274
|
+
</TouchableOpacity>
|
|
275
|
+
)}
|
|
276
|
+
<MButton
|
|
277
|
+
disabled={isLoading}
|
|
278
|
+
onPress={() => {
|
|
279
|
+
signContract();
|
|
280
|
+
}}
|
|
281
|
+
>
|
|
282
|
+
<LinearGradient
|
|
283
|
+
style={{
|
|
284
|
+
height: 40,
|
|
285
|
+
marginVertical: 16,
|
|
286
|
+
borderRadius: 30,
|
|
287
|
+
alignItems: 'center',
|
|
288
|
+
justifyContent: 'center',
|
|
289
|
+
}}
|
|
290
|
+
colors={['#FF7A00', '#EF4123']}
|
|
291
|
+
>
|
|
301
292
|
<MText
|
|
302
293
|
style={[
|
|
303
294
|
commonStyles.textNormalBold,
|
|
304
295
|
{
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
color: color.primary,
|
|
296
|
+
color: 'white',
|
|
297
|
+
textAlign: 'center',
|
|
308
298
|
},
|
|
309
299
|
]}
|
|
310
300
|
>
|
|
311
|
-
|
|
301
|
+
Ký hợp đồng
|
|
312
302
|
</MText>
|
|
313
|
-
|
|
314
|
-
</View>
|
|
315
|
-
<MButton onPress={() => setIsVisible(true)}>
|
|
316
|
-
<Image
|
|
317
|
-
source={{ uri: eSignStore.linkPreview }}
|
|
318
|
-
style={{
|
|
319
|
-
width: Dimensions.get('window').width - 32,
|
|
320
|
-
height: ((Dimensions.get('window').width - 32) * 16) / 9,
|
|
321
|
-
marginHorizontal: 16,
|
|
322
|
-
marginVertical: 12,
|
|
323
|
-
backgroundColor: '#f0f0f0',
|
|
324
|
-
}}
|
|
325
|
-
/>
|
|
303
|
+
</LinearGradient>
|
|
326
304
|
</MButton>
|
|
327
|
-
</
|
|
305
|
+
</View>
|
|
328
306
|
</View>
|
|
329
307
|
</SafeAreaView>
|
|
308
|
+
<Modal isVisible={showModal}>
|
|
309
|
+
<View style={{ backgroundColor: 'white', padding: 16 }}>
|
|
310
|
+
<MText
|
|
311
|
+
style={{
|
|
312
|
+
fontSize: 12,
|
|
313
|
+
color: color.textHeader,
|
|
314
|
+
marginBottom: 10,
|
|
315
|
+
}}
|
|
316
|
+
>{`Nhập mã OTP`}</MText>
|
|
317
|
+
<Formik
|
|
318
|
+
initialValues={{
|
|
319
|
+
otp: __DEV__ ? '' : '',
|
|
320
|
+
}}
|
|
321
|
+
onSubmit={(values, setFieldValue) => {}}
|
|
322
|
+
validationSchema={yup.object().shape({
|
|
323
|
+
otp: yup.string().required('Yêu cầu mã OTP.'),
|
|
324
|
+
})}
|
|
325
|
+
>
|
|
326
|
+
{({ values, setFieldValue, setFieldTouched }) => (
|
|
327
|
+
<View>
|
|
328
|
+
<View style={[commonStyles.row, commonStyles.alignCenter]}>
|
|
329
|
+
<MTextInput
|
|
330
|
+
placeholderTextColor={'#939598'}
|
|
331
|
+
placeholder={'••••••'}
|
|
332
|
+
style={[
|
|
333
|
+
commonStyles.textNormal,
|
|
334
|
+
commonStyles.fill,
|
|
335
|
+
{
|
|
336
|
+
textAlign: 'center',
|
|
337
|
+
fontSize: 16,
|
|
338
|
+
borderRadius: 4,
|
|
339
|
+
borderWidth: 1,
|
|
340
|
+
borderColor: color.border,
|
|
341
|
+
paddingVertical: Platform.OS === 'android' ? 8 : 14,
|
|
342
|
+
paddingHorizontal: 16,
|
|
343
|
+
},
|
|
344
|
+
]}
|
|
345
|
+
onChangeText={(text) => {
|
|
346
|
+
setFieldValue('otp', text);
|
|
347
|
+
if (text.length === 6 && eSignStore.currentTime !== 0) {
|
|
348
|
+
verify(text);
|
|
349
|
+
}
|
|
350
|
+
}}
|
|
351
|
+
maxLength={6}
|
|
352
|
+
onBlur={() => setFieldTouched('otp')}
|
|
353
|
+
returnKeyType={'done'}
|
|
354
|
+
value={values.otp}
|
|
355
|
+
autoFocus={true}
|
|
356
|
+
textContentType={'oneTimeCode'}
|
|
357
|
+
keyboardType={'numeric'}
|
|
358
|
+
/>
|
|
359
|
+
</View>
|
|
360
|
+
|
|
361
|
+
<MText
|
|
362
|
+
style={{
|
|
363
|
+
fontSize: 12,
|
|
364
|
+
color: '#AAAAAA',
|
|
365
|
+
marginTop: 8,
|
|
366
|
+
fontStyle: 'italic',
|
|
367
|
+
}}
|
|
368
|
+
>{`Tin nhắn SMS sẽ được gửi tới số điện thoại của bạn có hạn là 5 phút`}</MText>
|
|
369
|
+
|
|
370
|
+
<Observer>
|
|
371
|
+
{() => (
|
|
372
|
+
<View style={{ alignItems: 'center' }}>
|
|
373
|
+
{currentTime === 0 ? (
|
|
374
|
+
<MButton
|
|
375
|
+
onPress={reSendOTP}
|
|
376
|
+
style={[
|
|
377
|
+
commonStyles.alignCenter,
|
|
378
|
+
commonStyles.justifyCenter,
|
|
379
|
+
{
|
|
380
|
+
marginTop: 12,
|
|
381
|
+
backgroundColor: color.primary,
|
|
382
|
+
height: 50,
|
|
383
|
+
borderRadius: 4,
|
|
384
|
+
paddingHorizontal: 20,
|
|
385
|
+
marginLeft: 16,
|
|
386
|
+
},
|
|
387
|
+
]}
|
|
388
|
+
>
|
|
389
|
+
{eSignStore.reSendOTPLoading ? (
|
|
390
|
+
<ActivityIndicator color={'white'} size={'small'} />
|
|
391
|
+
) : (
|
|
392
|
+
<MText
|
|
393
|
+
style={[
|
|
394
|
+
commonStyles.textNormalBold,
|
|
395
|
+
{ color: 'white' },
|
|
396
|
+
]}
|
|
397
|
+
>
|
|
398
|
+
Lấy OTP
|
|
399
|
+
</MText>
|
|
400
|
+
)}
|
|
401
|
+
</MButton>
|
|
402
|
+
) : (
|
|
403
|
+
<Observer>
|
|
404
|
+
{() => (
|
|
405
|
+
<MText
|
|
406
|
+
style={[
|
|
407
|
+
commonStyles.textNormalBold,
|
|
408
|
+
{
|
|
409
|
+
marginTop: 12,
|
|
410
|
+
paddingHorizontal: 16,
|
|
411
|
+
color: color.primary,
|
|
412
|
+
},
|
|
413
|
+
]}
|
|
414
|
+
>
|
|
415
|
+
{currentTime}s
|
|
416
|
+
</MText>
|
|
417
|
+
)}
|
|
418
|
+
</Observer>
|
|
419
|
+
)}
|
|
420
|
+
</View>
|
|
421
|
+
)}
|
|
422
|
+
</Observer>
|
|
423
|
+
</View>
|
|
424
|
+
)}
|
|
425
|
+
</Formik>
|
|
426
|
+
</View>
|
|
427
|
+
</Modal>
|
|
428
|
+
|
|
429
|
+
<Loading isLoading={loading} />
|
|
330
430
|
</View>
|
|
331
431
|
);
|
|
332
432
|
});
|