react-native-timacare 0.0.15 → 0.0.17

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 (45) hide show
  1. package/lib/commonjs/index.js +1 -1
  2. package/lib/commonjs/index.js.flow +8 -6
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/screens/full-submit/index.js +1 -1
  5. package/lib/commonjs/screens/full-submit/index.js.flow +14 -7
  6. package/lib/commonjs/screens/full-submit/index.js.map +1 -1
  7. package/lib/commonjs/screens/full-submit/store.js +1 -1
  8. package/lib/commonjs/screens/full-submit/store.js.flow +61 -0
  9. package/lib/commonjs/screens/full-submit/store.js.map +1 -1
  10. package/lib/commonjs/screens/full-submit/update-info.js +1 -1
  11. package/lib/commonjs/screens/full-submit/update-info.js.flow +59 -23
  12. package/lib/commonjs/screens/full-submit/update-info.js.map +1 -1
  13. package/lib/commonjs/screens/home/index.js +1 -1
  14. package/lib/commonjs/screens/home/index.js.flow +3 -0
  15. package/lib/commonjs/screens/home/index.js.map +1 -1
  16. package/lib/commonjs/services/api/api.js +1 -1
  17. package/lib/commonjs/services/api/api.js.flow +51 -0
  18. package/lib/commonjs/services/api/api.js.map +1 -1
  19. package/lib/module/index.js +1 -1
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/module/screens/full-submit/index.js +1 -1
  22. package/lib/module/screens/full-submit/index.js.map +1 -1
  23. package/lib/module/screens/full-submit/store.js +1 -1
  24. package/lib/module/screens/full-submit/store.js.map +1 -1
  25. package/lib/module/screens/full-submit/update-info.js +1 -1
  26. package/lib/module/screens/full-submit/update-info.js.map +1 -1
  27. package/lib/module/screens/home/index.js +1 -1
  28. package/lib/module/screens/home/index.js.map +1 -1
  29. package/lib/module/services/api/api.js +1 -1
  30. package/lib/module/services/api/api.js.map +1 -1
  31. package/lib/typescript/index.d.ts.map +1 -1
  32. package/lib/typescript/screens/full-submit/index.d.ts.map +1 -1
  33. package/lib/typescript/screens/full-submit/store.d.ts +6 -0
  34. package/lib/typescript/screens/full-submit/store.d.ts.map +1 -1
  35. package/lib/typescript/screens/full-submit/update-info.d.ts.map +1 -1
  36. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  37. package/lib/typescript/services/api/api.d.ts +48 -0
  38. package/lib/typescript/services/api/api.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/index.tsx +8 -6
  41. package/src/screens/full-submit/index.tsx +14 -7
  42. package/src/screens/full-submit/store.tsx +61 -0
  43. package/src/screens/full-submit/update-info.tsx +59 -23
  44. package/src/screens/home/index.tsx +3 -0
  45. package/src/services/api/api.ts +51 -0
@@ -1,7 +1,7 @@
1
1
  //@ts-nocheck
2
2
  import { useNavigation } from '@react-navigation/native';
3
- import { observer } from 'mobx-react-lite';
4
- import React, { useState } from 'react';
3
+ import { observer, Observer } from 'mobx-react-lite';
4
+ import React, { useEffect, useState } from 'react';
5
5
  import { SafeAreaView, TouchableOpacity, View } from 'react-native';
6
6
  import LinearGradient from 'react-native-linear-gradient';
7
7
  import { IconBack } from '../../assets/icons';
@@ -17,6 +17,7 @@ export const FullSubmit = observer(function FullSubmit(props: any) {
17
17
  const navigation = useNavigation();
18
18
  const [tab, setTab] = useState(1);
19
19
  const loan = props?.route.params?.loan;
20
+
20
21
  return (
21
22
  <View style={{ flex: 1, backgroundColor: '#FFFFFF' }}>
22
23
  <SafeAreaView style={{ flex: 1 }}>
@@ -113,11 +114,17 @@ export const FullSubmit = observer(function FullSubmit(props: any) {
113
114
  </LinearGradient>
114
115
  </View>
115
116
  </View>
116
- {FullSubmitStore.tab === 1 ? (
117
- <UpdateInfo loan={loan} />
118
- ) : (
119
- <UpdateDocument loan={loan} />
120
- )}
117
+ <Observer>
118
+ {() => (
119
+ <View style={{ flex: 1 }}>
120
+ {tab === 1 ? (
121
+ <UpdateInfo loan={loan} callback={(value) => setTab(value)} />
122
+ ) : (
123
+ <UpdateDocument loan={loan} />
124
+ )}
125
+ </View>
126
+ )}
127
+ </Observer>
121
128
  </SafeAreaView>
122
129
  </View>
123
130
  );
@@ -17,6 +17,11 @@ class Store {
17
17
  @observable loadingButton = false;
18
18
  @observable loadingInsurance = false;
19
19
  @observable dataInsurance = null;
20
+
21
+ @observable lstStatusJobCIMB = [];
22
+ @observable lstIncomeCIMB = [];
23
+ @observable lstPositionCIMB = [];
24
+
20
25
  @action
21
26
  async getDetailLoan(id, onSuccess?) {
22
27
  this.isLoading = true;
@@ -217,6 +222,7 @@ class Store {
217
222
  if (response.kind === 'ok') {
218
223
  if (response.data.meta.errorCode === 200) {
219
224
  if (onSuccess) onSuccess();
225
+ this.tab = 2;
220
226
  } else {
221
227
  Alert.alert('Thông báo', response.data.meta.errorMessage);
222
228
  }
@@ -269,6 +275,61 @@ class Store {
269
275
  console.log(error);
270
276
  }
271
277
  }
278
+
279
+ @action
280
+ async getPositionCIMB() {
281
+ try {
282
+ const response = await Api.getInstance().getPositionCIMB();
283
+ console.log(response);
284
+ if (response.kind === 'ok') {
285
+ if (response.data.meta.errorCode === 200) {
286
+ this.lstPositionCIMB = response.data.data;
287
+ } else {
288
+ // Alert.alert("Thông báo", response.data.meta.errorMessage)
289
+ }
290
+ } else {
291
+ // Alert.alert("Thông báo", "Không lấy được danh sách chức vụ.")
292
+ }
293
+ } catch (error) {
294
+ console.log(error);
295
+ }
296
+ }
297
+ @action
298
+ async getJobStatusCIMB() {
299
+ try {
300
+ const response = await Api.getInstance().getJobStatusCIMB();
301
+ console.log(response);
302
+ if (response.kind === 'ok') {
303
+ if (response.data.meta.errorCode === 200) {
304
+ this.lstStatusJobCIMB = response.data.data;
305
+ } else {
306
+ // Alert.alert("Thông báo", response.data.meta.errorMessage)
307
+ }
308
+ } else {
309
+ // Alert.alert("Thông báo", "Không lấy được danh sách chức vụ.")
310
+ }
311
+ } catch (error) {
312
+ console.log(error);
313
+ }
314
+ }
315
+ @action
316
+ async getIncomeCIMB() {
317
+ try {
318
+ const response = await Api.getInstance().getIncomeCIMB();
319
+ console.log(response);
320
+ if (response.kind === 'ok') {
321
+ if (response.data.meta.errorCode === 200) {
322
+ this.lstIncomeCIMB = response.data.data;
323
+ } else {
324
+ // Alert.alert("Thông báo", response.data.meta.errorMessage)
325
+ }
326
+ } else {
327
+ // Alert.alert("Thông báo", "Không lấy được danh sách chức vụ.")
328
+ }
329
+ } catch (error) {
330
+ console.log(error);
331
+ }
332
+ }
272
333
  }
273
334
  const FullSubmitStore = new Store();
274
335
  export default FullSubmitStore;
@@ -36,9 +36,13 @@ import appStore from '../../AppStore';
36
36
 
37
37
  interface IProps {
38
38
  loan: any;
39
+ callback: any;
39
40
  }
40
41
 
41
- export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
42
+ export const UpdateInfo = observer(function UpdateInfo({
43
+ loan,
44
+ callback,
45
+ }: IProps) {
42
46
  const navigation = useNavigation();
43
47
  const ref = useRef(null);
44
48
  const [data, setData] = useState(null);
@@ -67,9 +71,33 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
67
71
  )[0]
68
72
  : null
69
73
  );
70
- ref.current.setFieldValue('statusWorking', res?.jobStatusNameCIMB);
71
- ref.current.setFieldValue('jobTitle', res?.positionNameCIMB);
72
- ref.current.setFieldValue('sourceFund', res?.incomeNameCIMB);
74
+ ref.current.setFieldValue(
75
+ 'statusWorking',
76
+ res?.jobStatusNameCIMB
77
+ ? {
78
+ id: res?.jobStatusCIMBId,
79
+ name: res?.jobStatusNameCIMB,
80
+ }
81
+ : null
82
+ );
83
+ ref.current.setFieldValue(
84
+ 'jobTitle',
85
+ res?.positionNameCIMB
86
+ ? {
87
+ id: res?.positionCIMBId,
88
+ name: res?.positionNameCIMB,
89
+ }
90
+ : null
91
+ );
92
+ ref.current.setFieldValue(
93
+ 'sourceFund',
94
+ res?.incomeNameCIMB
95
+ ? {
96
+ id: res?.incomeCIMBId,
97
+ name: res?.incomeNameCIMB,
98
+ }
99
+ : null
100
+ );
73
101
  ref.current.setFieldValue('taxCode', res?.taxCode ? res?.taxCode : '');
74
102
 
75
103
  ref.current.setFieldValue(
@@ -105,9 +133,9 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
105
133
  Merried: values?.married.id,
106
134
  AddressResident: values.address,
107
135
  AddressHouseHold: values?.addressHouseHold,
108
- EmploymentStatus: values.statusWorking.id,
109
- JobTitle: values.jobTitle.id,
110
- SourceOfFund: values.sourceFund.id,
136
+ // EmploymentStatus: values.statusWorking.id,
137
+ // JobTitle: values.jobTitle.id,
138
+ // SourceOfFund: values.sourceFund.id,
111
139
  TaxCode: values.taxCode,
112
140
  LoanPurpose: values.purpose.id,
113
141
  BankId: values?.bank.id,
@@ -119,10 +147,14 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
119
147
  CustomerDeviceID: appStore.deviceId,
120
148
  PartnerAppRefID: appStore.appRefID,
121
149
  UserDevicePayload: appStore.userDevicePayload,
150
+ incomeCIMBId: values.sourceFund.id,
151
+ jobStatusCIMBId: values.statusWorking.id,
152
+ positionCIMBId: values.jobTitle.id,
122
153
  };
123
154
 
124
155
  FullSubmitStore.fullSubmit(body, () => {
125
156
  FullSubmitStore.tab = 2;
157
+ callback(2);
126
158
  });
127
159
  };
128
160
 
@@ -149,9 +181,9 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
149
181
  name: 'Mua sắm trang thiết bị, vật dụng gia đình',
150
182
  },
151
183
  loanTime: '',
152
- statusWorking: '',
153
- jobTitle: '',
154
- sourceFund: '',
184
+ statusWorking: null,
185
+ jobTitle: null,
186
+ sourceFund: null,
155
187
  taxCode: '',
156
188
  address: '',
157
189
  addressHouseHold: '',
@@ -319,14 +351,15 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
319
351
  <MText style={{ color: 'red' }}>*</MText>
320
352
  </MText>
321
353
  <TouchableOpacity
322
- // disabled
354
+ disabled={loan?.typeLoan === 4 ? false : true}
323
355
  style={[
324
356
  styles.input,
325
357
  {
326
358
  justifyContent: 'space-between',
327
359
  flexDirection: 'row',
328
360
  alignItems: 'center',
329
- // backgroundColor: '#F2F3F5',
361
+ backgroundColor:
362
+ loan?.typeLoan === 4 ? 'white' : '#F2F3F5',
330
363
  },
331
364
  ]}
332
365
  onPress={() =>
@@ -366,7 +399,8 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
366
399
  Địa chỉ nơi ở <MText style={{ color: 'red' }}>*</MText>
367
400
  </MText>
368
401
  <TextInput
369
- style={styles.input}
402
+ editable={false}
403
+ style={[styles.input, { backgroundColor: '#F2F3F5' }]}
370
404
  value={values.address}
371
405
  onChangeText={handleChange('address')}
372
406
  />
@@ -427,15 +461,16 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
427
461
  justifyContent: 'space-between',
428
462
  flexDirection: 'row',
429
463
  alignItems: 'center',
430
- // backgroundColor: '#F2F3F5',
464
+ backgroundColor:
465
+ loan?.typeLoan === 4 ? 'white' : '#F2F3F5',
431
466
  },
432
467
  ]}
433
- // disabled
468
+ disabled={loan?.typeLoan === 4 ? false : true}
434
469
  onPress={() =>
435
470
  navigation.dispatch(
436
471
  StackActions.push(ScreenNames.CommonSelect, {
437
472
  title: 'Tình trạng làm việc',
438
- data: FullSubmitStore.listStatusWorking,
473
+ data: FullSubmitStore.lstStatusJobCIMB,
439
474
  callback: (value) => {
440
475
  setFieldValue('statusWorking', value);
441
476
  },
@@ -447,7 +482,7 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
447
482
  style={[commonStyles.textNormalBold]}
448
483
  numberOfLines={1}
449
484
  >
450
- {values.statusWorking}
485
+ {values.statusWorking?.name}
451
486
  </MText>
452
487
  <DropDown2 />
453
488
  </TouchableOpacity>
@@ -475,15 +510,16 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
475
510
  justifyContent: 'space-between',
476
511
  flexDirection: 'row',
477
512
  alignItems: 'center',
478
- // backgroundColor: '#F2F3F5',
513
+ backgroundColor:
514
+ loan?.typeLoan === 4 ? 'white' : '#F2F3F5',
479
515
  },
480
516
  ]}
481
- // disabled
517
+ disabled={loan?.typeLoan === 4 ? false : true}
482
518
  onPress={() =>
483
519
  navigation.dispatch(
484
520
  StackActions.push(ScreenNames.CommonSelect, {
485
521
  title: 'Chọn chức vụ',
486
- data: FullSubmitStore.listJobTitle,
522
+ data: FullSubmitStore.lstPositionCIMB,
487
523
  callback: (value) => {
488
524
  setFieldValue('jobTitle', value);
489
525
  },
@@ -495,7 +531,7 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
495
531
  style={[commonStyles.textNormalBold]}
496
532
  numberOfLines={1}
497
533
  >
498
- {values.jobTitle}
534
+ {values.jobTitle?.name}
499
535
  </MText>
500
536
  <DropDown2 />
501
537
  </TouchableOpacity>
@@ -539,7 +575,7 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
539
575
  navigation.dispatch(
540
576
  StackActions.push(ScreenNames.CommonSelect, {
541
577
  title: 'Nguồn thu nhập',
542
- data: FullSubmitStore.listSourceFund,
578
+ data: FullSubmitStore.lstIncomeCIMB,
543
579
  callback: (value) => {
544
580
  setFieldValue('sourceFund', value);
545
581
  },
@@ -551,7 +587,7 @@ export const UpdateInfo = observer(function UpdateInfo({ loan }: IProps) {
551
587
  style={[commonStyles.textNormalBold]}
552
588
  numberOfLines={1}
553
589
  >
554
- {values.sourceFund}
590
+ {values.sourceFund?.name}
555
591
  </MText>
556
592
  <DropDown2 />
557
593
  </TouchableOpacity>
@@ -102,6 +102,9 @@ export const Home = observer(function Home() {
102
102
  useEffect(() => {
103
103
  FullSubmitStore.getTypeMerried();
104
104
  FullSubmitStore.getListBank();
105
+ FullSubmitStore.getIncomeCIMB();
106
+ FullSubmitStore.getPositionCIMB();
107
+ FullSubmitStore.getJobStatusCIMB();
105
108
  QuickSubmitStore.getJobsCIMB();
106
109
  }, []);
107
110
 
@@ -1830,6 +1830,57 @@ export class Api {
1830
1830
  return { kind: "bad-data" }
1831
1831
  }
1832
1832
  }
1833
+ async getPositionCIMB() {
1834
+ // make the api call
1835
+ const response: ApiResponse<any> = await this.apisauce.get(`api/v2.0/loanbrief/position_cimb`)
1836
+ myLog(response)
1837
+ // the typical ways to die when calling an api
1838
+ if (!response.ok) {
1839
+ const problem = getGeneralApiProblem(response)
1840
+ if (problem) return problem
1841
+ }
1842
+
1843
+ // transform the data into the format we are expecting
1844
+ try {
1845
+ return { kind: "ok", data: response.data }
1846
+ } catch {
1847
+ return { kind: "bad-data" }
1848
+ }
1849
+ }
1850
+ async getIncomeCIMB() {
1851
+ // make the api call
1852
+ const response: ApiResponse<any> = await this.apisauce.get(`api/v2.0/loanbrief/income_cimb`)
1853
+ myLog(response)
1854
+ // the typical ways to die when calling an api
1855
+ if (!response.ok) {
1856
+ const problem = getGeneralApiProblem(response)
1857
+ if (problem) return problem
1858
+ }
1859
+
1860
+ // transform the data into the format we are expecting
1861
+ try {
1862
+ return { kind: "ok", data: response.data }
1863
+ } catch {
1864
+ return { kind: "bad-data" }
1865
+ }
1866
+ }
1867
+ async getJobStatusCIMB() {
1868
+ // make the api call
1869
+ const response: ApiResponse<any> = await this.apisauce.get(`api/v2.0/loanbrief/job_status_cimb`)
1870
+ myLog(response)
1871
+ // the typical ways to die when calling an api
1872
+ if (!response.ok) {
1873
+ const problem = getGeneralApiProblem(response)
1874
+ if (problem) return problem
1875
+ }
1876
+
1877
+ // transform the data into the format we are expecting
1878
+ try {
1879
+ return { kind: "ok", data: response.data }
1880
+ } catch {
1881
+ return { kind: "bad-data" }
1882
+ }
1883
+ }
1833
1884
 
1834
1885
  async getDetailFullSubmit(id) {
1835
1886
  // make the api call