react-native-timacare 0.0.13 → 0.0.15

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 (38) hide show
  1. package/lib/commonjs/screens/full-submit/update-info.js +1 -1
  2. package/lib/commonjs/screens/full-submit/update-info.js.flow +80 -56
  3. package/lib/commonjs/screens/full-submit/update-info.js.map +1 -1
  4. package/lib/commonjs/screens/home/index.js +1 -1
  5. package/lib/commonjs/screens/home/index.js.flow +5 -4
  6. package/lib/commonjs/screens/home/index.js.map +1 -1
  7. package/lib/commonjs/screens/quick-submit/index.js +1 -1
  8. package/lib/commonjs/screens/quick-submit/index.js.flow +53 -18
  9. package/lib/commonjs/screens/quick-submit/index.js.map +1 -1
  10. package/lib/commonjs/screens/quick-submit/store.js +1 -1
  11. package/lib/commonjs/screens/quick-submit/store.js.flow +20 -0
  12. package/lib/commonjs/screens/quick-submit/store.js.map +1 -1
  13. package/lib/commonjs/services/api/api.js +1 -1
  14. package/lib/commonjs/services/api/api.js.flow +22 -1
  15. package/lib/commonjs/services/api/api.js.map +1 -1
  16. package/lib/module/screens/full-submit/update-info.js +1 -1
  17. package/lib/module/screens/full-submit/update-info.js.map +1 -1
  18. package/lib/module/screens/home/index.js +1 -1
  19. package/lib/module/screens/home/index.js.map +1 -1
  20. package/lib/module/screens/quick-submit/index.js +1 -1
  21. package/lib/module/screens/quick-submit/index.js.map +1 -1
  22. package/lib/module/screens/quick-submit/store.js +1 -1
  23. package/lib/module/screens/quick-submit/store.js.map +1 -1
  24. package/lib/module/services/api/api.js +1 -1
  25. package/lib/module/services/api/api.js.map +1 -1
  26. package/lib/typescript/screens/full-submit/update-info.d.ts.map +1 -1
  27. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  28. package/lib/typescript/screens/quick-submit/index.d.ts.map +1 -1
  29. package/lib/typescript/screens/quick-submit/store.d.ts +2 -0
  30. package/lib/typescript/screens/quick-submit/store.d.ts.map +1 -1
  31. package/lib/typescript/services/api/api.d.ts +16 -0
  32. package/lib/typescript/services/api/api.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/screens/full-submit/update-info.tsx +80 -56
  35. package/src/screens/home/index.tsx +5 -4
  36. package/src/screens/quick-submit/index.tsx +53 -18
  37. package/src/screens/quick-submit/store.tsx +20 -0
  38. package/src/services/api/api.ts +22 -1
@@ -105,9 +105,9 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
105
105
  Merried: values?.married.id,
106
106
  AddressResident: values.address,
107
107
  AddressHouseHold: values?.addressHouseHold,
108
- // EmploymentStatus: values.statusWorking.id,
109
- // JobTitle: values.jobTitle.id,
110
- // SourceOfFund: values.sourceFund.id,
108
+ EmploymentStatus: values.statusWorking.id,
109
+ JobTitle: values.jobTitle.id,
110
+ SourceOfFund: values.sourceFund.id,
111
111
  TaxCode: values.taxCode,
112
112
  LoanPurpose: values.purpose.id,
113
113
  BankId: values?.bank.id,
@@ -163,7 +163,10 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
163
163
  onSubmit={onSubmit}
164
164
  validationSchema={yup.object().shape({
165
165
  terms: yup.bool().oneOf([true], ''),
166
- // statusWorking: yup.object().required("Vui lòng chọn tình trạng làm việc").nullable(),
166
+ statusWorking: yup
167
+ .object()
168
+ .required('Vui lòng chọn tình trạng làm việc')
169
+ .nullable(),
167
170
  married: yup
168
171
  .object()
169
172
  .required('Vui lòng chọn tình trạng hôn nhân')
@@ -173,8 +176,14 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
173
176
  .required('Vui lòng chọn giới tính')
174
177
  .nullable(),
175
178
  bank: yup.object().required('Vui lòng chọn ngân hàng').nullable(),
176
- // jobTitle: yup.object().required("Vui lòng chọn chức vụ").nullable(),
177
- // sourceFund: yup.object().required("Vui lòng chọn nguồn thu nhập").nullable(),
179
+ jobTitle: yup
180
+ .object()
181
+ .required('Vui lòng chọn chức vụ')
182
+ .nullable(),
183
+ sourceFund: yup
184
+ .object()
185
+ .required('Vui lòng chọn nguồn thu nhập')
186
+ .nullable(),
178
187
  address: yup.string().required('Vui lòng nhập địa chỉ nơi ở'),
179
188
  addressHouseHold: yup
180
189
  .string()
@@ -310,14 +319,14 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
310
319
  <MText style={{ color: 'red' }}>*</MText>
311
320
  </MText>
312
321
  <TouchableOpacity
313
- disabled
322
+ // disabled
314
323
  style={[
315
324
  styles.input,
316
325
  {
317
326
  justifyContent: 'space-between',
318
327
  flexDirection: 'row',
319
328
  alignItems: 'center',
320
- backgroundColor: '#F2F3F5',
329
+ // backgroundColor: '#F2F3F5',
321
330
  },
322
331
  ]}
323
332
  onPress={() =>
@@ -418,21 +427,21 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
418
427
  justifyContent: 'space-between',
419
428
  flexDirection: 'row',
420
429
  alignItems: 'center',
421
- backgroundColor: '#F2F3F5',
430
+ // backgroundColor: '#F2F3F5',
422
431
  },
423
432
  ]}
424
- disabled
425
- // onPress={() =>
426
- // navigation.dispatch(
427
- // StackActions.push(ScreenNames.CommonSelect, {
428
- // title: "Tình trạng làm việc",
429
- // data: FullSubmitStore.listStatusWorking,
430
- // callback: (value) => {
431
- // setFieldValue("statusWorking", value)
432
- // },
433
- // }),
434
- // )
435
- // }
433
+ // disabled
434
+ onPress={() =>
435
+ navigation.dispatch(
436
+ StackActions.push(ScreenNames.CommonSelect, {
437
+ title: 'Tình trạng làm việc',
438
+ data: FullSubmitStore.listStatusWorking,
439
+ callback: (value) => {
440
+ setFieldValue('statusWorking', value);
441
+ },
442
+ })
443
+ )
444
+ }
436
445
  >
437
446
  <MText
438
447
  style={[commonStyles.textNormalBold]}
@@ -442,13 +451,18 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
442
451
  </MText>
443
452
  <DropDown2 />
444
453
  </TouchableOpacity>
445
- {/* {errors && errors.statusWorking && (
454
+ {errors && errors.statusWorking && (
446
455
  <MText
447
- style={{ fontSize: 12, color: "red", fontStyle: "italic", marginTop: 5 }}
456
+ style={{
457
+ fontSize: 12,
458
+ color: 'red',
459
+ fontStyle: 'italic',
460
+ marginTop: 5,
461
+ }}
448
462
  >
449
463
  {errors.statusWorking}
450
464
  </MText>
451
- )} */}
465
+ )}
452
466
  </View>
453
467
  <View style={{ flex: 1, marginLeft: 8 }}>
454
468
  <MText style={[commonStyles.textNormal]}>
@@ -461,21 +475,21 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
461
475
  justifyContent: 'space-between',
462
476
  flexDirection: 'row',
463
477
  alignItems: 'center',
464
- backgroundColor: '#F2F3F5',
478
+ // backgroundColor: '#F2F3F5',
465
479
  },
466
480
  ]}
467
- disabled
468
- // onPress={() =>
469
- // navigation.dispatch(
470
- // StackActions.push(ScreenNames.CommonSelect, {
471
- // title: "Chọn chức vụ",
472
- // data: FullSubmitStore.listJobTitle,
473
- // callback: (value) => {
474
- // setFieldValue("jobTitle", value)
475
- // },
476
- // }),
477
- // )
478
- // }
481
+ // disabled
482
+ onPress={() =>
483
+ navigation.dispatch(
484
+ StackActions.push(ScreenNames.CommonSelect, {
485
+ title: 'Chọn chức vụ',
486
+ data: FullSubmitStore.listJobTitle,
487
+ callback: (value) => {
488
+ setFieldValue('jobTitle', value);
489
+ },
490
+ })
491
+ )
492
+ }
479
493
  >
480
494
  <MText
481
495
  style={[commonStyles.textNormalBold]}
@@ -485,13 +499,18 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
485
499
  </MText>
486
500
  <DropDown2 />
487
501
  </TouchableOpacity>
488
- {/* {errors && errors.jobTitle && (
502
+ {errors && errors.jobTitle && (
489
503
  <MText
490
- style={{ fontSize: 12, color: "red", fontStyle: "italic", marginTop: 5 }}
504
+ style={{
505
+ fontSize: 12,
506
+ color: 'red',
507
+ fontStyle: 'italic',
508
+ marginTop: 5,
509
+ }}
491
510
  >
492
511
  {errors.jobTitle}
493
512
  </MText>
494
- )} */}
513
+ )}
495
514
  </View>
496
515
  </View>
497
516
  <View
@@ -512,21 +531,21 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
512
531
  justifyContent: 'space-between',
513
532
  flexDirection: 'row',
514
533
  alignItems: 'center',
515
- backgroundColor: '#F2F3F5',
534
+ // backgroundColor: '#F2F3F5',
516
535
  },
517
536
  ]}
518
- disabled
519
- // onPress={() =>
520
- // navigation.dispatch(
521
- // StackActions.push(ScreenNames.CommonSelect, {
522
- // title: "Nguồn thu nhập",
523
- // data: FullSubmitStore.listSourceFund,
524
- // callback: (value) => {
525
- // setFieldValue("sourceFund", value)
526
- // },
527
- // }),
528
- // )
529
- // }
537
+ // disabled
538
+ onPress={() =>
539
+ navigation.dispatch(
540
+ StackActions.push(ScreenNames.CommonSelect, {
541
+ title: 'Nguồn thu nhập',
542
+ data: FullSubmitStore.listSourceFund,
543
+ callback: (value) => {
544
+ setFieldValue('sourceFund', value);
545
+ },
546
+ })
547
+ )
548
+ }
530
549
  >
531
550
  <MText
532
551
  style={[commonStyles.textNormalBold]}
@@ -536,13 +555,18 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
536
555
  </MText>
537
556
  <DropDown2 />
538
557
  </TouchableOpacity>
539
- {/* {errors && errors.sourceFund && (
558
+ {errors && errors.sourceFund && (
540
559
  <MText
541
- style={{ fontSize: 12, color: "red", fontStyle: "italic", marginTop: 5 }}
560
+ style={{
561
+ fontSize: 12,
562
+ color: 'red',
563
+ fontStyle: 'italic',
564
+ marginTop: 5,
565
+ }}
542
566
  >
543
567
  {errors.sourceFund}
544
568
  </MText>
545
- )} */}
569
+ )}
546
570
  </View>
547
571
  <View style={{ flex: 1, marginLeft: 8 }}>
548
572
  <MText style={[commonStyles.textNormal]}>Mã số thuế</MText>
@@ -99,10 +99,11 @@ export const Home = observer(function Home() {
99
99
  onRefresh();
100
100
  }, []);
101
101
 
102
- // useEffect(() => {
103
- // FullSubmitStore.getTypeMerried();
104
- // FullSubmitStore.getListBank();
105
- // }, []);
102
+ useEffect(() => {
103
+ FullSubmitStore.getTypeMerried();
104
+ FullSubmitStore.getListBank();
105
+ QuickSubmitStore.getJobsCIMB();
106
+ }, []);
106
107
 
107
108
  useEffect(() => {
108
109
  return navigation.addListener('focus', () => {
@@ -40,6 +40,8 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
40
40
  const [showDatePicker, setShowDatePicker] = useState(false);
41
41
  const [typePicker, setTypePicker] = useState(0);
42
42
 
43
+ console.log(props.route);
44
+
43
45
  useEffect(() => {
44
46
  QuickSubmitStore.getBrandProduct();
45
47
  QuickSubmitStore.getProvinces();
@@ -103,7 +105,15 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
103
105
  ? { id: data?.productBrandId, name: data?.productBrandName }
104
106
  : null
105
107
  );
106
- ref.current.setFieldValue('occupation', data?.jobNameCIMB);
108
+ ref.current.setFieldValue(
109
+ 'occupation',
110
+ data?.jobNameCIMB
111
+ ? {
112
+ id: data?.jobCIMBId,
113
+ name: data?.jobNameCIMB,
114
+ }
115
+ : null
116
+ );
107
117
  ref.current.setFieldValue('productId', data?.productId),
108
118
  ref.current.setFieldValue(
109
119
  'vehiclesCar',
@@ -139,7 +149,11 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
139
149
  yearProductBrand: values.year?.id,
140
150
  districtId: loan?.districtId,
141
151
  wardId: loan?.wardId,
142
- // jobId: values.occupation?.id,
152
+ jobId: loan?.jobId,
153
+ jobCIMBId:
154
+ props?.route?.params?.loan?.typeLoan === 4
155
+ ? values?.occupation?.id
156
+ : loan?.jobCIMBId,
143
157
  productId: loan?.productId,
144
158
  brandCar: loan?.brandCar,
145
159
  yearCar: loan?.yearCar,
@@ -250,7 +264,7 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
250
264
  loanAmount: '',
251
265
  loanTime: null,
252
266
  salary: '',
253
- occupation: '',
267
+ occupation: null,
254
268
  productId: 2,
255
269
  brandCar: '',
256
270
  yearCar: '',
@@ -292,7 +306,13 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
292
306
  loan?.productId !== 8
293
307
  ? yup.object().required('Vui lòng chọn dòng xe').nullable()
294
308
  : null,
295
- // occupation: yup.object().required("Vui lòng chọn nghề nghiệp").nullable(),
309
+ occupation:
310
+ props.route?.params?.loan?.typeLoan === 4
311
+ ? yup
312
+ .object()
313
+ .required('Vui lòng chọn nghề nghiệp')
314
+ .nullable()
315
+ : undefined,
296
316
  })}
297
317
  >
298
318
  {({
@@ -570,8 +590,10 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
570
590
  justifyContent: 'space-between',
571
591
  flexDirection: 'row',
572
592
  alignItems: 'center',
593
+ backgroundColor: '#F2F3F5',
573
594
  },
574
595
  ]}
596
+ disabled
575
597
  onPress={() =>
576
598
  navigation.dispatch(
577
599
  StackActions.push(ScreenNames.CommonSelect, {
@@ -616,8 +638,10 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
616
638
  justifyContent: 'space-between',
617
639
  flexDirection: 'row',
618
640
  alignItems: 'center',
641
+ backgroundColor: '#F2F3F5',
619
642
  },
620
643
  ]}
644
+ disabled
621
645
  onPress={() =>
622
646
  navigation.dispatch(
623
647
  StackActions.push(ScreenNames.CommonSelect, {
@@ -665,8 +689,10 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
665
689
  justifyContent: 'space-between',
666
690
  flexDirection: 'row',
667
691
  alignItems: 'center',
692
+ backgroundColor: '#F2F3F5',
668
693
  },
669
694
  ]}
695
+ disabled
670
696
  onPress={() =>
671
697
  navigation.dispatch(
672
698
  StackActions.push(ScreenNames.CommonSelect, {
@@ -875,27 +901,36 @@ export const QuickSubmit = observer(function QuickSubmit(props: any) {
875
901
  justifyContent: 'space-between',
876
902
  flexDirection: 'row',
877
903
  alignItems: 'center',
878
- backgroundColor: '#F2F3F5',
904
+ backgroundColor:
905
+ props?.route?.params?.loan?.typeLoan !== 4
906
+ ? '#F2F3F5'
907
+ : '#FFFFFF',
879
908
  },
880
909
  ]}
881
- disabled
882
- // onPress={() =>
883
- // navigation.dispatch(
884
- // StackActions.push(ScreenNames.CommonSelect, {
885
- // title: "Chọn nghề nghiệp",
886
- // data: QuickSubmitStore.listOccupation,
887
- // callback: (value) => {
888
- // setFieldValue("occupation", value)
889
- // },
890
- // }),
891
- // )
892
- // }
910
+ disabled={
911
+ props?.route?.params?.loan?.typeLoan === 4
912
+ ? false
913
+ : true
914
+ }
915
+ onPress={() =>
916
+ navigation.dispatch(
917
+ StackActions.push(ScreenNames.CommonSelect, {
918
+ title: 'Chọn nghề nghiệp',
919
+ data: QuickSubmitStore.listJobCimb,
920
+ callback: (value) => {
921
+ setFieldValue('occupation', value);
922
+ },
923
+ })
924
+ )
925
+ }
893
926
  >
894
927
  <MText
895
928
  style={[commonStyles.textNormalBold]}
896
929
  numberOfLines={1}
897
930
  >
898
- {values.occupation}
931
+ {props?.route?.params?.loan?.typeLoan === 4
932
+ ? values.occupation?.name
933
+ : loan?.jobNameCIMB}
899
934
  </MText>
900
935
  <DropDown2 />
901
936
  </TouchableOpacity>
@@ -12,9 +12,29 @@ class Store {
12
12
  @observable listYear = [];
13
13
  @observable listModel = [];
14
14
  @observable listOccupation = [];
15
+ @observable listJobCimb = [];
15
16
 
16
17
  @observable loadingButton = false;
17
18
 
19
+ @action
20
+ async getJobsCIMB() {
21
+ try {
22
+ const response = await Api.getInstance().getJobCIMB();
23
+ console.log('JOB_CIMB', response);
24
+ if (response.kind === 'ok') {
25
+ if (response.data.meta.errorCode === 200) {
26
+ this.listJobCimb = response.data.data;
27
+ } else {
28
+ this.listJobCimb = [];
29
+ Alert.alert('Thông báo', response.data.meta.errorMessage);
30
+ }
31
+ } else {
32
+ }
33
+ } catch (error) {
34
+ console.log(error);
35
+ }
36
+ }
37
+
18
38
  @action
19
39
  async getOccupation() {
20
40
  try {
@@ -1403,7 +1403,10 @@ export class Api {
1403
1403
 
1404
1404
  async checkSelfieImage(params, loanbriefId) {
1405
1405
  // make the api call
1406
- const response: ApiResponse<any> = await this.apisauce.post(`api/v1.0/timacare/CompareFaceNationalCard?loanbriefId=${loanbriefId}`, params, {})
1406
+ const response: ApiResponse<any> = await this.apisauce.post(`api/v1.0/timacare/CompareFaceNationalCard?loanbriefId=${loanbriefId}`, params, {
1407
+ headers:
1408
+ { 'Content-Type': 'multipart/form-data' }
1409
+ })
1407
1410
  // the typical ways to die when calling an api
1408
1411
  if (!response.ok) {
1409
1412
  const problem = getGeneralApiProblem(response)
@@ -1810,6 +1813,24 @@ export class Api {
1810
1813
  }
1811
1814
  }
1812
1815
 
1816
+ async getJobCIMB() {
1817
+ // make the api call
1818
+ const response: ApiResponse<any> = await this.apisauce.get(`api/v2.0/loanbrief/job_cimb`)
1819
+ myLog(response)
1820
+ // the typical ways to die when calling an api
1821
+ if (!response.ok) {
1822
+ const problem = getGeneralApiProblem(response)
1823
+ if (problem) return problem
1824
+ }
1825
+
1826
+ // transform the data into the format we are expecting
1827
+ try {
1828
+ return { kind: "ok", data: response.data }
1829
+ } catch {
1830
+ return { kind: "bad-data" }
1831
+ }
1832
+ }
1833
+
1813
1834
  async getDetailFullSubmit(id) {
1814
1835
  // make the api call
1815
1836
  const response: ApiResponse<any> = await this.apisauce.get(`api/v2.0/loanbrief/detail_next?id=${id}`)