react-native-timacare 3.1.13-beta → 3.1.14-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 (136) hide show
  1. package/lib/commonjs/assets/svgs/ekyc_disable.svg +4 -0
  2. package/lib/commonjs/assets/svgs/expand.svg +8 -0
  3. package/lib/commonjs/assets/svgs/expand_up.svg +8 -0
  4. package/lib/commonjs/assets/svgs/index.js +1 -1
  5. package/lib/commonjs/assets/svgs/index.js.flow +14 -0
  6. package/lib/commonjs/assets/svgs/index.js.map +1 -1
  7. package/lib/commonjs/assets/svgs/money.svg +5 -0
  8. package/lib/commonjs/assets/svgs/sign_disable.svg +12 -0
  9. package/lib/commonjs/assets/svgs/sign_success.svg +12 -0
  10. package/lib/commonjs/assets/svgs/tima_16.svg +13 -0
  11. package/lib/commonjs/screens/home/index.js +1 -1
  12. package/lib/commonjs/screens/home/index.js.flow +2051 -1628
  13. package/lib/commonjs/screens/home/index.js.map +1 -1
  14. package/lib/commonjs/screens/liveness-v2/index.js +1 -1
  15. package/lib/commonjs/screens/liveness-v2/index.js.flow +10 -6
  16. package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
  17. package/lib/commonjs/screens/register/index.js +1 -1
  18. package/lib/commonjs/screens/register/index.js.flow +1 -1
  19. package/lib/commonjs/screens/toan-trinh-so/LoanInterestRate.js +1 -1
  20. package/lib/commonjs/screens/toan-trinh-so/LoanInterestRate.js.flow +123 -36
  21. package/lib/commonjs/screens/toan-trinh-so/LoanInterestRate.js.map +1 -1
  22. package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
  23. package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +3 -1
  24. package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
  25. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js +1 -1
  26. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.flow +3 -1
  27. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  28. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js +1 -1
  29. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.flow +538 -510
  30. package/lib/commonjs/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  31. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  32. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.flow +76 -57
  33. package/lib/commonjs/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  34. package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js +1 -1
  35. package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.flow +58 -12
  36. package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
  37. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js +1 -1
  38. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js.flow +6 -7
  39. package/lib/commonjs/screens/toan-trinh-so/TTSOTP.js.map +1 -1
  40. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js +1 -1
  41. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.flow +185 -50
  42. package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
  43. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
  44. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +3 -1
  45. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  46. package/lib/commonjs/screens/toan-trinh-so/store.js +1 -1
  47. package/lib/commonjs/screens/toan-trinh-so/store.js.flow +23 -1
  48. package/lib/commonjs/screens/toan-trinh-so/store.js.map +1 -1
  49. package/lib/commonjs/services/api/api.js +1 -1
  50. package/lib/commonjs/services/api/api.js.flow +46 -0
  51. package/lib/commonjs/services/api/api.js.map +1 -1
  52. package/lib/commonjs/utils/index.js +1 -1
  53. package/lib/commonjs/utils/index.js.flow +51 -0
  54. package/lib/commonjs/utils/index.js.map +1 -1
  55. package/lib/module/assets/svgs/ekyc_disable.svg +4 -0
  56. package/lib/module/assets/svgs/expand.svg +8 -0
  57. package/lib/module/assets/svgs/expand_up.svg +8 -0
  58. package/lib/module/assets/svgs/index.js +1 -1
  59. package/lib/module/assets/svgs/index.js.map +1 -1
  60. package/lib/module/assets/svgs/money.svg +5 -0
  61. package/lib/module/assets/svgs/sign_disable.svg +12 -0
  62. package/lib/module/assets/svgs/sign_success.svg +12 -0
  63. package/lib/module/assets/svgs/tima_16.svg +13 -0
  64. package/lib/module/screens/home/index.js +1 -1
  65. package/lib/module/screens/home/index.js.map +1 -1
  66. package/lib/module/screens/liveness-v2/index.js +1 -1
  67. package/lib/module/screens/liveness-v2/index.js.map +1 -1
  68. package/lib/module/screens/register/index.js +1 -1
  69. package/lib/module/screens/toan-trinh-so/LoanInterestRate.js +1 -1
  70. package/lib/module/screens/toan-trinh-so/LoanInterestRate.js.map +1 -1
  71. package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
  72. package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
  73. package/lib/module/screens/toan-trinh-so/RegisterCamera.js +1 -1
  74. package/lib/module/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  75. package/lib/module/screens/toan-trinh-so/ReviewInformation.js +1 -1
  76. package/lib/module/screens/toan-trinh-so/ReviewInformation.js.map +1 -1
  77. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js +1 -1
  78. package/lib/module/screens/toan-trinh-so/ReviewInformationOther.js.map +1 -1
  79. package/lib/module/screens/toan-trinh-so/ReviewLoan.js +1 -1
  80. package/lib/module/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
  81. package/lib/module/screens/toan-trinh-so/TTSOTP.js +1 -1
  82. package/lib/module/screens/toan-trinh-so/TTSOTP.js.map +1 -1
  83. package/lib/module/screens/toan-trinh-so/TTSSignLoan.js +1 -1
  84. package/lib/module/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
  85. package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
  86. package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  87. package/lib/module/screens/toan-trinh-so/store.js +1 -1
  88. package/lib/module/screens/toan-trinh-so/store.js.map +1 -1
  89. package/lib/module/services/api/api.js +1 -1
  90. package/lib/module/services/api/api.js.map +1 -1
  91. package/lib/module/utils/index.js +1 -1
  92. package/lib/module/utils/index.js.map +1 -1
  93. package/lib/typescript/assets/svgs/index.d.ts +8 -1
  94. package/lib/typescript/assets/svgs/index.d.ts.map +1 -1
  95. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  96. package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
  97. package/lib/typescript/screens/toan-trinh-so/LoanInterestRate.d.ts.map +1 -1
  98. package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
  99. package/lib/typescript/screens/toan-trinh-so/RegisterCamera.d.ts.map +1 -1
  100. package/lib/typescript/screens/toan-trinh-so/ReviewInformation.d.ts.map +1 -1
  101. package/lib/typescript/screens/toan-trinh-so/ReviewInformationOther.d.ts.map +1 -1
  102. package/lib/typescript/screens/toan-trinh-so/ReviewLoan.d.ts.map +1 -1
  103. package/lib/typescript/screens/toan-trinh-so/TTSOTP.d.ts +1 -1
  104. package/lib/typescript/screens/toan-trinh-so/TTSOTP.d.ts.map +1 -1
  105. package/lib/typescript/screens/toan-trinh-so/TTSSignLoan.d.ts.map +1 -1
  106. package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
  107. package/lib/typescript/screens/toan-trinh-so/store.d.ts +2 -0
  108. package/lib/typescript/screens/toan-trinh-so/store.d.ts.map +1 -1
  109. package/lib/typescript/services/api/api.d.ts +48 -0
  110. package/lib/typescript/services/api/api.d.ts.map +1 -1
  111. package/lib/typescript/utils/index.d.ts +8 -0
  112. package/lib/typescript/utils/index.d.ts.map +1 -1
  113. package/package.json +1 -1
  114. package/src/assets/svgs/ekyc_disable.svg +4 -0
  115. package/src/assets/svgs/expand.svg +8 -0
  116. package/src/assets/svgs/expand_up.svg +8 -0
  117. package/src/assets/svgs/index.tsx +14 -0
  118. package/src/assets/svgs/money.svg +5 -0
  119. package/src/assets/svgs/sign_disable.svg +12 -0
  120. package/src/assets/svgs/sign_success.svg +12 -0
  121. package/src/assets/svgs/tima_16.svg +13 -0
  122. package/src/screens/home/index.tsx +2051 -1628
  123. package/src/screens/liveness-v2/index.tsx +10 -6
  124. package/src/screens/register/index.tsx +1 -1
  125. package/src/screens/toan-trinh-so/LoanInterestRate.tsx +123 -36
  126. package/src/screens/toan-trinh-so/OCR.tsx +3 -1
  127. package/src/screens/toan-trinh-so/RegisterCamera.tsx +3 -1
  128. package/src/screens/toan-trinh-so/ReviewInformation.tsx +538 -510
  129. package/src/screens/toan-trinh-so/ReviewInformationOther.tsx +76 -57
  130. package/src/screens/toan-trinh-so/ReviewLoan.tsx +58 -12
  131. package/src/screens/toan-trinh-so/TTSOTP.tsx +6 -7
  132. package/src/screens/toan-trinh-so/TTSSignLoan.tsx +185 -50
  133. package/src/screens/toan-trinh-so/VehicleCamera.tsx +3 -1
  134. package/src/screens/toan-trinh-so/store.ts +23 -1
  135. package/src/services/api/api.ts +46 -0
  136. package/src/utils/index.tsx +51 -0
@@ -22,7 +22,11 @@ import { ScreenNames } from '../../navigation';
22
22
  import KeyboardSpacer from '../../components/keyboardspace';
23
23
  import MButton from '../../components/MButton';
24
24
  import LinearGradient from 'react-native-linear-gradient';
25
- import { formatMoney } from '../../utils';
25
+ import {
26
+ EnumRelationshipOption1,
27
+ EnumRelationshipOption2,
28
+ formatMoney,
29
+ } from '../../utils';
26
30
  import { Api } from '../../services/api';
27
31
  import Loading from '../../components/Loading';
28
32
  import * as yup from 'yup';
@@ -115,7 +119,7 @@ export default function ReviewInformationOther(props) {
115
119
  }
116
120
 
117
121
  if (response.data?.data?.listRelationships[0]?.relationshipType) {
118
- let r = ttsStore.listRelationship.find(
122
+ let r = EnumRelationshipOption1.find(
119
123
  (x) =>
120
124
  x.id ===
121
125
  response.data?.data?.listRelationships[0]?.relationshipType
@@ -123,7 +127,7 @@ export default function ReviewInformationOther(props) {
123
127
  formRef.current.setFieldValue('relationshipType1', r);
124
128
  }
125
129
  if (response.data?.data?.listRelationships[1]?.relationshipType) {
126
- let r = ttsStore.listRelationship.find(
130
+ let r = EnumRelationshipOption2.find(
127
131
  (x) =>
128
132
  x.id ===
129
133
  response.data?.data?.listRelationships[1]?.relationshipType
@@ -145,59 +149,74 @@ export default function ReviewInformationOther(props) {
145
149
  }, []);
146
150
 
147
151
  const onSubmit = async (values) => {
148
- try {
149
- setIsLoading(true);
150
- const body = {
151
- loanBriefId: props.route?.params?.loan?.id,
152
- jobId: values.jobId,
153
- totalIncome: Number(values.totalIncome),
154
- companyName: values.companyName,
155
- description: values.description,
156
- provinceId: values.provinceId,
157
- districtId: values.districtId,
158
- wardId: values.wardId,
159
- address: values?.address,
160
- listRelationships: [
161
- {
162
- relationshipType: values.relationshipType1?.id,
163
- fullName: values.fullName1,
164
- phone: values.phone1,
165
- },
166
- {
167
- relationshipType: values.relationshipType2?.id,
168
- fullName: values.fullName2,
169
- phone: values.phone2,
170
- },
171
- ],
172
- };
152
+ Alert.alert(
153
+ 'Thông báo',
154
+ 'Bạn chắc chắn muốn cập nhật thông tin này không?',
155
+ [
156
+ {
157
+ text: 'Hủy',
158
+ style: 'cancel',
159
+ },
160
+ {
161
+ text: 'Đồng ý',
162
+ onPress: async () => {
163
+ try {
164
+ setIsLoading(true);
165
+ const body = {
166
+ loanBriefId: props.route?.params?.loan?.id,
167
+ jobId: values.jobId,
168
+ totalIncome: Number(values.totalIncome),
169
+ companyName: values.companyName,
170
+ description: values.description,
171
+ provinceId: values.provinceId,
172
+ districtId: values.districtId,
173
+ wardId: values.wardId,
174
+ address: values?.address,
175
+ listRelationships: [
176
+ {
177
+ relationshipType: values.relationshipType1?.id,
178
+ fullName: values.fullName1,
179
+ phone: values.phone1,
180
+ },
181
+ {
182
+ relationshipType: values.relationshipType2?.id,
183
+ fullName: values.fullName2,
184
+ phone: values.phone2,
185
+ },
186
+ ],
187
+ };
173
188
 
174
- const response = await Api.getInstance().updateInfoJob(body);
175
- setIsLoading(false);
176
- if (response.kind === 'ok') {
177
- if (response.data?.meta?.errorCode === 200) {
178
- Alert.alert('Thông báo', 'Cập nhật thông tin thành công', [
179
- {
180
- text: 'Đồng ý',
181
- onPress: () => {
182
- navigation.dispatch(
183
- CommonActions.reset({
184
- index: 1,
185
- routes: [{ name: ScreenNames.Main }],
186
- })
187
- );
188
- },
189
- },
190
- ]);
191
- } else {
192
- Alert.alert('Thông báo', response.data?.meta?.errorMessage);
193
- }
194
- } else {
195
- Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau');
196
- }
197
- } catch (error) {
198
- setIsLoading(false);
199
- console.log(error);
200
- }
189
+ const response = await Api.getInstance().updateInfoJob(body);
190
+ setIsLoading(false);
191
+ if (response.kind === 'ok') {
192
+ if (response.data?.meta?.errorCode === 200) {
193
+ Alert.alert('Thông báo', 'Cập nhật thông tin thành công', [
194
+ {
195
+ text: 'Đồng ý',
196
+ onPress: () => {
197
+ navigation.dispatch(
198
+ CommonActions.reset({
199
+ index: 1,
200
+ routes: [{ name: ScreenNames.Main }],
201
+ })
202
+ );
203
+ },
204
+ },
205
+ ]);
206
+ } else {
207
+ Alert.alert('Thông báo', response.data?.meta?.errorMessage);
208
+ }
209
+ } else {
210
+ Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau');
211
+ }
212
+ } catch (error) {
213
+ setIsLoading(false);
214
+ console.log(error);
215
+ }
216
+ },
217
+ },
218
+ ]
219
+ );
201
220
  };
202
221
 
203
222
  return (
@@ -535,7 +554,7 @@ export default function ReviewInformationOther(props) {
535
554
  onPress={() => {
536
555
  navigation.push(ScreenNames.MSelect, {
537
556
  title: 'Mối quan hệ',
538
- data: ttsStore.listRelationship,
557
+ data: EnumRelationshipOption1,
539
558
  callback: (item) => {
540
559
  setFieldValue('relationshipType1', item);
541
560
  },
@@ -626,7 +645,7 @@ export default function ReviewInformationOther(props) {
626
645
  onPress={() => {
627
646
  navigation.push(ScreenNames.MSelect, {
628
647
  title: 'Mối quan hệ',
629
- data: ttsStore.listRelationship,
648
+ data: EnumRelationshipOption2,
630
649
  callback: (item) => {
631
650
  setFieldValue('relationshipType2', item);
632
651
  },
@@ -50,6 +50,9 @@ export default function ReviewLoan(props: any) {
50
50
  loanAmount: Number(values.loanAmount),
51
51
  rateTypeId: values.rateTypeId,
52
52
  loanTime: values.loanTime,
53
+ firstPaymentDate: moment(values.firstPaymentDate, 'DD/MM/YYYY').format(
54
+ 'YYYY-MM-DD'
55
+ ),
53
56
  buyInsurenceCustomer: values?.buyInsurenceCustomer,
54
57
  buyInsuranceProperty: values?.buyInsuranceProperty,
55
58
  timeInsurenceCustomer: values?.timeInsurenceCustomer?.id,
@@ -119,6 +122,10 @@ export default function ReviewLoan(props: any) {
119
122
  'loanAmount',
120
123
  response?.data?.data?.loanAmount ?? 0
121
124
  );
125
+ formRef.current.setFieldValue(
126
+ 'firstPaymentDate',
127
+ formatDDMMYYY(response?.data?.data?.firstPaymentDate) ?? ''
128
+ );
122
129
  formRef.current.setFieldValue(
123
130
  'rateTypeId',
124
131
  response?.data?.data?.rateTypeId ?? null
@@ -229,7 +236,7 @@ export default function ReviewLoan(props: any) {
229
236
  useEffect(() => {
230
237
  getData();
231
238
  ttsStore.getListBrand();
232
- ttsStore.getRelationship();
239
+ ttsStore.getFirstPayment(props.route?.params?.loan?.id);
233
240
  }, []);
234
241
 
235
242
  const getInfoInsurence = async (
@@ -323,6 +330,7 @@ export default function ReviewLoan(props: any) {
323
330
  loanAmount: '',
324
331
  rateTypeId: null,
325
332
  loanTime: null,
333
+ firstPaymentDate: '',
326
334
  buyInsurenceCustomer: false,
327
335
  buyInsuranceProperty: false,
328
336
  timeInsurenceCustomer: null,
@@ -349,6 +357,7 @@ export default function ReviewLoan(props: any) {
349
357
  loanAmount: yup.string().required('Số tiền là bắt buộc'),
350
358
  rateTypeId: yup.number().required('Vui lòng chọn').nullable(),
351
359
  loanTime: yup.number().required('Vui lòng chọn').nullable(),
360
+ firstPaymentDate: yup.string().required('Vui lòng chọn'),
352
361
  bankName: yup.string().required('Vui lòng chọn ngân hàng'),
353
362
  bankAccountName: yup.string().required('Vui lòng nhập chủ thẻ'),
354
363
  bankAccountNumber: yup
@@ -494,6 +503,39 @@ export default function ReviewLoan(props: any) {
494
503
  <MText style={$error}>{errors.loanTime}</MText>
495
504
  )}
496
505
 
506
+ <MText style={[$label, { marginTop: 16 }]}>
507
+ Ngày thanh toán kỳ đầu
508
+ </MText>
509
+ <TouchableOpacity
510
+ style={$select}
511
+ onPress={() => {
512
+ navigation.push(ScreenNames.MSelect, {
513
+ title: 'Ngày thanh toán kỳ đầu',
514
+ data: ttsStore.listFirstPayment,
515
+ callback: (value) => {
516
+ setFieldValue('firstPaymentDate', value?.name);
517
+ },
518
+ });
519
+ }}
520
+ >
521
+ <MText
522
+ numberOfLines={1}
523
+ style={{
524
+ color: '#333333',
525
+ fontSize: 16,
526
+ fontWeight: '500',
527
+ flex: 1,
528
+ fontFamily: 'Be Vietnam Pro Medium',
529
+ }}
530
+ >
531
+ {values?.firstPaymentDate}
532
+ </MText>
533
+ <DropDown2 />
534
+ </TouchableOpacity>
535
+ {errors && errors.firstPaymentDate && (
536
+ <MText style={$error}>{errors.firstPaymentDate}</MText>
537
+ )}
538
+
497
539
  <View
498
540
  style={{
499
541
  backgroundColor: '#FFF8F2',
@@ -758,7 +800,9 @@ export default function ReviewLoan(props: any) {
758
800
  {errors && errors.bankName && (
759
801
  <MText style={$error}>{errors.bankName}</MText>
760
802
  )}
761
- <MText style={[$label, { marginTop: 16 }]}>Tên chủ thẻ</MText>
803
+ <MText style={[$label, { marginTop: 16 }]}>
804
+ Tên số tài khoản
805
+ </MText>
762
806
  <TextInput
763
807
  numberOfLines={1}
764
808
  style={[
@@ -899,7 +943,7 @@ export default function ReviewLoan(props: any) {
899
943
  <MText style={$error}>{errors.vehicles}</MText>
900
944
  )}
901
945
 
902
- <MText style={[$label, { marginTop: 16 }]}>Biển số xe</MText>
946
+ <MText style={[$label, { marginTop: 16 }]}>Số khung</MText>
903
947
  <TextInput
904
948
  numberOfLines={1}
905
949
  style={[
@@ -910,16 +954,16 @@ export default function ReviewLoan(props: any) {
910
954
  fontWeight: '500',
911
955
  },
912
956
  ]}
913
- value={values.plateNumber}
914
- onChangeText={handleChange('plateNumber')}
957
+ value={values.chassis}
958
+ onChangeText={handleChange('chassis')}
915
959
  />
916
- {errors && errors.plateNumber && (
917
- <MText style={$error}>{errors.plateNumber}</MText>
960
+ {errors && errors.chassis && (
961
+ <MText style={$error}>{errors.chassis}</MText>
918
962
  )}
919
963
 
920
964
  <View style={[$row, { marginTop: 16 }]}>
921
965
  <View style={{ flex: 1 }}>
922
- <MText style={$label}>Số khung</MText>
966
+ <MText style={$label}>Biển số xe</MText>
923
967
  <TextInput
924
968
  numberOfLines={1}
925
969
  style={[
@@ -930,11 +974,11 @@ export default function ReviewLoan(props: any) {
930
974
  fontWeight: '500',
931
975
  },
932
976
  ]}
933
- value={values.chassis}
934
- onChangeText={handleChange('chassis')}
977
+ value={values.plateNumber}
978
+ onChangeText={handleChange('plateNumber')}
935
979
  />
936
- {errors && errors.chassis && (
937
- <MText style={$error}>{errors.chassis}</MText>
980
+ {errors && errors.plateNumber && (
981
+ <MText style={$error}>{errors.plateNumber}</MText>
938
982
  )}
939
983
  </View>
940
984
  <View style={{ flex: 1 }}>
@@ -1010,6 +1054,8 @@ export default function ReviewLoan(props: any) {
1010
1054
  fontWeight: '500',
1011
1055
  },
1012
1056
  ]}
1057
+ placeholder="DD/MM/YYYY"
1058
+ placeholderTextColor="#BDBDBD"
1013
1059
  value={values.motobikeCertificateDate}
1014
1060
  onChangeText={handleChange('motobikeCertificateDate')}
1015
1061
  />
@@ -22,6 +22,7 @@ import {
22
22
  import { Api } from '../../services/api';
23
23
  import Loading from '../../components/Loading';
24
24
  import { ScreenNames } from '../../navigation';
25
+ import { CommonActions, useNavigation } from '@react-navigation/native';
25
26
 
26
27
  const logoView: ImageStyle = {
27
28
  position: 'absolute',
@@ -30,7 +31,8 @@ const logoView: ImageStyle = {
30
31
  resizeMode: 'cover',
31
32
  };
32
33
 
33
- export default function TTSOTP({ navigation, route }: any) {
34
+ export default function TTSOTP({ route }: any) {
35
+ const navigation = useNavigation();
34
36
  const loan = route?.params?.loan;
35
37
  const [description, setDescription] = useState(
36
38
  'Vui lòng click “Gửi mã OTP” để nhận mã xác thực được gửi vào số điện thoại của bạn'
@@ -66,6 +68,7 @@ export default function TTSOTP({ navigation, route }: any) {
66
68
  const response = await Api.getInstance().signContractForBorrower({
67
69
  loanBriefId: loan.id,
68
70
  });
71
+
69
72
  setIsLoading(false);
70
73
  if (response.kind === 'ok' && response.data.meta.errorCode === 200) {
71
74
  setTimeLeft(300);
@@ -74,9 +77,7 @@ export default function TTSOTP({ navigation, route }: any) {
74
77
  );
75
78
  setIsCounting(true);
76
79
  } else {
77
- Alert.alert('Thông báo', response.data.meta.errorMessage, [
78
- { text: 'Đồng ý' },
79
- ]);
80
+ Alert.alert('Thông báo', response.data.meta.errorMessage);
80
81
  setValue('');
81
82
  }
82
83
  };
@@ -136,9 +137,7 @@ export default function TTSOTP({ navigation, route }: any) {
136
137
  setValue('');
137
138
  }
138
139
  } else {
139
- Alert.alert('Thông báo', 'Vui lòng nhập đầy đủ mã OTP gồm 6 chữ số.', [
140
- { text: 'Đồng ý' },
141
- ]);
140
+ Alert.alert('Thông báo', 'Vui lòng nhập đầy đủ mã OTP gồm 6 chữ số.');
142
141
  setValue('');
143
142
  }
144
143
  };
@@ -1,17 +1,59 @@
1
1
  //@ts-nocheck
2
- import React from 'react';
3
- import { SafeAreaView, ScrollView, TouchableOpacity, View } from 'react-native';
2
+ import React, { useEffect } from 'react';
3
+ import {
4
+ Alert,
5
+ SafeAreaView,
6
+ ScrollView,
7
+ TouchableOpacity,
8
+ View,
9
+ } from 'react-native';
4
10
  import { MText } from '../../components/MText';
5
- import { CheckBoxActive, IconBack } from '../../assets/icons';
11
+ import { CheckBox, CheckBoxActive, IconBack } from '../../assets/icons';
6
12
  import LinearGradient from 'react-native-linear-gradient';
7
13
  import { CommonActions, useNavigation } from '@react-navigation/native';
8
14
  import { ScreenNames } from '../../navigation';
9
15
  import Pdf from 'react-native-pdf';
16
+ import { Api } from '../../services/api';
17
+ import { is, set } from 'ramda';
18
+ import Loading from '../../components/Loading';
10
19
 
11
20
  export default function TTSSignLoan(props) {
12
21
  const loan = props?.route?.params?.loan;
22
+ const [isLoading, setIsLoading] = React.useState(false);
23
+ const [contract, setContract] = React.useState(null);
24
+ const [step, setStep] = React.useState(1);
25
+ const [isAgree, setIsAgree] = React.useState(false);
13
26
  const navigation = useNavigation();
14
27
 
28
+ const getContract = async () => {
29
+ try {
30
+ setIsLoading(true);
31
+ const response = await Api.getInstance().previewContract(loan?.id);
32
+ setIsLoading(false);
33
+ if (response.kind === 'ok') {
34
+ if (response.data?.meta?.errorCode === 200) {
35
+ setContract(response.data?.data);
36
+ } else {
37
+ Alert.alert(
38
+ 'Thông báo',
39
+ response.data?.meta?.errorMessage ||
40
+ 'Có lỗi xảy ra. Vui lòng thử lại sau.'
41
+ );
42
+ }
43
+ } else {
44
+ Alert.alert('Thông báo', 'Có lỗi xảy ra. Vui lòng thử lại sau.');
45
+ }
46
+ } catch (error) {
47
+ setIsLoading(false);
48
+ }
49
+ };
50
+
51
+ useEffect(() => {
52
+ if (loan) {
53
+ getContract();
54
+ }
55
+ }, []);
56
+
15
57
  return (
16
58
  <View
17
59
  style={{
@@ -34,7 +76,12 @@ export default function TTSSignLoan(props) {
34
76
  >
35
77
  <TouchableOpacity
36
78
  onPress={() => {
37
- navigation.goBack();
79
+ navigation.dispatch(
80
+ CommonActions.reset({
81
+ index: 1,
82
+ routes: [{ name: ScreenNames.Main }],
83
+ })
84
+ );
38
85
  }}
39
86
  style={{
40
87
  position: 'absolute',
@@ -61,26 +108,52 @@ export default function TTSSignLoan(props) {
61
108
  </View>
62
109
 
63
110
  <View style={{ flex: 1 }}>
64
- <Pdf
65
- source={{
66
- uri: 'https://file.tima.vn/uploads/ESignContract/9506778/HD-9506778_borrower_d0a70791-e213-4a83-b760-089df216afa4.pdf',
67
- }}
68
- onLoadComplete={(numberOfPages, filePath) => {
69
- console.log(`Number of pages: ${numberOfPages}`);
70
- }}
71
- onPageChanged={(page, numberOfPages) => {
72
- console.log(`Current page: ${page}`);
73
- }}
74
- onError={(error) => {
75
- console.log(error);
76
- }}
77
- onPressLink={(uri) => {
78
- console.log(`Link pressed: ${uri}`);
79
- }}
80
- style={{
81
- flex: 1,
82
- }}
83
- />
111
+ {step === 1 ? (
112
+ <Pdf
113
+ source={{
114
+ uri:
115
+ 'data:application/pdf;base64,' +
116
+ contract?.base64_hopdongdichvu,
117
+ }}
118
+ onLoadComplete={(numberOfPages, filePath) => {
119
+ console.log(`Number of pages: ${numberOfPages}`);
120
+ }}
121
+ onPageChanged={(page, numberOfPages) => {
122
+ console.log(`Current page: ${page}`);
123
+ }}
124
+ onError={(error) => {
125
+ console.log(error);
126
+ }}
127
+ onPressLink={(uri) => {
128
+ console.log(`Link pressed: ${uri}`);
129
+ }}
130
+ style={{
131
+ flex: 1,
132
+ }}
133
+ />
134
+ ) : (
135
+ <Pdf
136
+ source={{
137
+ uri:
138
+ 'data:application/pdf;base64,' + contract?.base64_giaoket_1,
139
+ }}
140
+ onLoadComplete={(numberOfPages, filePath) => {
141
+ console.log(`Number of pages: ${numberOfPages}`);
142
+ }}
143
+ onPageChanged={(page, numberOfPages) => {
144
+ console.log(`Current page: ${page}`);
145
+ }}
146
+ onError={(error) => {
147
+ console.log(error);
148
+ }}
149
+ onPressLink={(uri) => {
150
+ console.log(`Link pressed: ${uri}`);
151
+ }}
152
+ style={{
153
+ flex: 1,
154
+ }}
155
+ />
156
+ )}
84
157
  </View>
85
158
 
86
159
  <View
@@ -90,54 +163,116 @@ export default function TTSSignLoan(props) {
90
163
  paddingVertical: 16,
91
164
  }}
92
165
  >
166
+ {step === 2 && (
167
+ <View
168
+ style={{
169
+ flexDirection: 'row',
170
+ gap: 10,
171
+ paddingHorizontal: 16,
172
+ }}
173
+ >
174
+ <TouchableOpacity onPress={() => setIsAgree(!isAgree)}>
175
+ {isAgree ? <CheckBoxActive /> : <CheckBox />}
176
+ </TouchableOpacity>
177
+ <MText
178
+ style={{
179
+ color: '#333333',
180
+ }}
181
+ >
182
+ Tôi đồng ý với tất cả những điều kiện trong hợp đồng.
183
+ </MText>
184
+ </View>
185
+ )}
93
186
  <View
94
187
  style={{
95
188
  flexDirection: 'row',
96
- gap: 10,
97
- paddingHorizontal: 16,
189
+ gap: 6,
190
+ marginTop: 16,
191
+ marginHorizontal: 16,
98
192
  }}
99
193
  >
100
- <CheckBoxActive />
101
- <MText
194
+ <View
102
195
  style={{
103
- color: '#333333',
196
+ height: 4,
197
+ backgroundColor: step === 1 ? '#FF7A00' : '#FFEAD8',
198
+ flex: 1,
199
+ borderRadius: 6,
104
200
  }}
105
- >
106
- Tôi đồng ý với tất cả những điều kiện trong hợp đồng.
107
- </MText>
201
+ />
202
+ <View
203
+ style={{
204
+ height: 4,
205
+ backgroundColor: step === 2 ? '#FF7A00' : '#F2F2F2',
206
+ flex: 1,
207
+ borderRadius: 6,
208
+ }}
209
+ />
108
210
  </View>
109
- <TouchableOpacity
110
- onPress={() => {
111
- navigation.push(ScreenNames.TTSOTP, { loan });
112
- }}
113
- style={{
114
- marginTop: 24,
115
- marginHorizontal: 16,
116
- }}
117
- >
118
- <LinearGradient
119
- start={{ x: 1, y: 0 }}
120
- end={{ x: 0, y: 1 }}
211
+ {step === 1 ? (
212
+ <TouchableOpacity
213
+ onPress={() => setStep(2)}
121
214
  style={{
122
215
  height: 40,
123
- borderRadius: 6,
124
216
  alignItems: 'center',
125
217
  justifyContent: 'center',
218
+ borderWidth: 1,
219
+ borderColor: '#FF7A00',
220
+ marginHorizontal: 16,
221
+ borderRadius: 6,
222
+ marginTop: 10,
126
223
  }}
127
- colors={['#FF7A00', '#EF4123']}
128
224
  >
129
225
  <MText
130
226
  style={{
131
- color: 'white',
227
+ color: '#FF7A00',
132
228
  fontSize: 16,
133
229
  }}
134
230
  >
135
- Xác nhận ký
231
+ Tiếp tục
136
232
  </MText>
137
- </LinearGradient>
138
- </TouchableOpacity>
233
+ </TouchableOpacity>
234
+ ) : (
235
+ <TouchableOpacity
236
+ onPress={() => {
237
+ if (!isAgree) {
238
+ Alert.alert(
239
+ 'Thông báo',
240
+ 'Bạn cần đồng ý với tất cả những điều kiện trong hợp đồng trước khi ký.'
241
+ );
242
+ return;
243
+ }
244
+ navigation.push(ScreenNames.TTSOTP, { loan });
245
+ }}
246
+ style={{
247
+ marginTop: 10,
248
+ marginHorizontal: 16,
249
+ }}
250
+ >
251
+ <LinearGradient
252
+ start={{ x: 1, y: 0 }}
253
+ end={{ x: 0, y: 1 }}
254
+ style={{
255
+ height: 40,
256
+ borderRadius: 6,
257
+ alignItems: 'center',
258
+ justifyContent: 'center',
259
+ }}
260
+ colors={['#FF7A00', '#EF4123']}
261
+ >
262
+ <MText
263
+ style={{
264
+ color: 'white',
265
+ fontSize: 16,
266
+ }}
267
+ >
268
+ Xác nhận ký
269
+ </MText>
270
+ </LinearGradient>
271
+ </TouchableOpacity>
272
+ )}
139
273
  </View>
140
274
  </SafeAreaView>
275
+ <Loading isLoading={isLoading} />
141
276
  </View>
142
277
  );
143
278
  }
@@ -52,7 +52,7 @@ export default function VehicleCamera(props: any) {
52
52
  const takePhoto = async () => {
53
53
  setTaking(true);
54
54
  const options = {
55
- width: 720,
55
+ // width: 720,
56
56
  base64: true,
57
57
  pauseAfterCapture: true,
58
58
  fixOrientation: false,
@@ -228,6 +228,8 @@ export default function VehicleCamera(props: any) {
228
228
  buttonPositive: 'Ok',
229
229
  buttonNegative: 'Cancel',
230
230
  }}
231
+ quality={0.8}
232
+ pictureSize="1280x720"
231
233
  >
232
234
  {({ camera, status, recordAudioPermissionStatus }) => {
233
235
  if (status !== 'READY') return <ActivityIndicator />;