react-native-timacare 0.0.20 → 0.0.21

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.
@@ -65,6 +65,7 @@ import appStore from '../../AppStore';
65
65
  import Modal from 'react-native-modal';
66
66
  import { Api } from '../../services/api';
67
67
  import { load, save } from '../../utils/storage';
68
+ import Loading from '../../components/Loading';
68
69
 
69
70
  const listBanners = [
70
71
  require('../../assets/img/banner1.png'),
@@ -1062,7 +1063,260 @@ export const Home = observer(function Home() {
1062
1063
  )}
1063
1064
  </View>
1064
1065
  ) : (
1065
- <View
1066
+ <Observer>
1067
+ {() => (
1068
+ <View>
1069
+ <View
1070
+ style={{
1071
+ backgroundColor: '#FFFFFF',
1072
+ paddingHorizontal: 16,
1073
+ paddingTop: 16,
1074
+ borderRadius: 8,
1075
+ borderWidth: 0.5,
1076
+ borderColor: '#E0E0E0',
1077
+ }}
1078
+ >
1079
+ <View
1080
+ style={{
1081
+ flexDirection: 'row',
1082
+ alignItems: 'center',
1083
+ }}
1084
+ >
1085
+ <Contract />
1086
+ <View style={{ flex: 1, paddingLeft: 8 }}>
1087
+ <MText style={commonStyles.textNormalBold}>
1088
+ Đơn vay {homeStore.listLoanPending?.id}
1089
+ </MText>
1090
+ <MText style={commonStyles.textNormal}>
1091
+ Số tiền vay (VND):{' '}
1092
+ {homeStore.listLoanPending?.loanAmount
1093
+ ? formatMoney(
1094
+ homeStore.listLoanPending?.loanAmount
1095
+ )
1096
+ : 'Chưa xác định'}
1097
+ </MText>
1098
+ </View>
1099
+ </View>
1100
+ <View
1101
+ style={{
1102
+ height: 1,
1103
+ backgroundColor: '#E0E0E0',
1104
+ marginVertical: 16,
1105
+ }}
1106
+ />
1107
+ <View
1108
+ style={{
1109
+ flexDirection: 'row',
1110
+ justifyContent: 'space-between',
1111
+ }}
1112
+ >
1113
+ <MText style={commonStyles.textNormal}>
1114
+ Trạng thái
1115
+ </MText>
1116
+ <MText
1117
+ style={[
1118
+ commonStyles.textNormalBold,
1119
+ { color: '#F05123' },
1120
+ ]}
1121
+ >
1122
+ {homeStore?.listLoanPending?.loanStatus}
1123
+ </MText>
1124
+ </View>
1125
+ <View
1126
+ style={{
1127
+ height: 0.5,
1128
+ backgroundColor: '#E0E0E0',
1129
+ marginVertical: 16,
1130
+ }}
1131
+ />
1132
+ <View style={{ flexDirection: 'row' }}>
1133
+ {!homeStore.checkEKYC[
1134
+ homeStore.listLoanPending?.id
1135
+ ] ? (
1136
+ <TouchableOpacity
1137
+ style={{ alignItems: 'center' }}
1138
+ onPress={() => {
1139
+ navigation.dispatch(
1140
+ StackActions.push(
1141
+ ScreenNames.NationalID,
1142
+ {
1143
+ loan: homeStore.listLoanPending,
1144
+ reLoan: true,
1145
+ }
1146
+ )
1147
+ );
1148
+ }}
1149
+ >
1150
+ <AddInfo />
1151
+ <MText
1152
+ style={[
1153
+ commonStyles.textNormal,
1154
+ {
1155
+ fontSize: 12,
1156
+ fontWeight: '300',
1157
+ marginTop: 8,
1158
+ },
1159
+ ]}
1160
+ >
1161
+ EKYC
1162
+ </MText>
1163
+ </TouchableOpacity>
1164
+ ) : (
1165
+ <View style={{ alignItems: 'center' }}>
1166
+ <AddInfoDisable />
1167
+ <MText
1168
+ style={[
1169
+ commonStyles.textNormal,
1170
+ {
1171
+ fontSize: 12,
1172
+ fontWeight: '300',
1173
+ marginTop: 8,
1174
+ },
1175
+ ]}
1176
+ >
1177
+ EKYC
1178
+ </MText>
1179
+ </View>
1180
+ )}
1181
+
1182
+ <TouchableOpacity
1183
+ style={{
1184
+ alignItems: 'center',
1185
+ marginLeft: 20,
1186
+ }}
1187
+ onPress={() => {
1188
+ navigation.dispatch(
1189
+ StackActions.push(ScreenNames.Video, {
1190
+ loan: homeStore.listLoanPending,
1191
+ })
1192
+ );
1193
+ }}
1194
+ >
1195
+ <IconVideo />
1196
+ <MText
1197
+ style={[
1198
+ commonStyles.textNormal,
1199
+ {
1200
+ fontSize: 12,
1201
+ fontWeight: '300',
1202
+ marginTop: 8,
1203
+ },
1204
+ ]}
1205
+ >
1206
+ Quay video
1207
+ </MText>
1208
+ </TouchableOpacity>
1209
+
1210
+ {homeStore.checkEKYC[
1211
+ homeStore.listLoanPending?.id
1212
+ ] ? (
1213
+ <TouchableOpacity
1214
+ style={{
1215
+ alignItems: 'center',
1216
+ marginLeft: 20,
1217
+ }}
1218
+ onPress={() => {
1219
+ signLoan(homeStore.listLoanPending);
1220
+ }}
1221
+ >
1222
+ <IconSign2 />
1223
+ <MText
1224
+ style={[
1225
+ commonStyles.textNormal,
1226
+ {
1227
+ fontSize: 12,
1228
+ fontWeight: '300',
1229
+ marginTop: 8,
1230
+ },
1231
+ ]}
1232
+ >
1233
+ Ký HĐ
1234
+ </MText>
1235
+ </TouchableOpacity>
1236
+ ) : (
1237
+ <View
1238
+ style={{
1239
+ alignItems: 'center',
1240
+ marginLeft: 20,
1241
+ }}
1242
+ >
1243
+ <SignDisable />
1244
+ <MText
1245
+ style={[
1246
+ commonStyles.textNormal,
1247
+ {
1248
+ fontSize: 12,
1249
+ fontWeight: '300',
1250
+ marginTop: 8,
1251
+ },
1252
+ ]}
1253
+ >
1254
+ Ký HĐ
1255
+ </MText>
1256
+ </View>
1257
+ )}
1258
+ </View>
1259
+ <View
1260
+ style={{
1261
+ flexDirection: 'row',
1262
+ alignItems: 'center',
1263
+ backgroundColor: '#FBEFE7',
1264
+ marginHorizontal: -16,
1265
+ paddingVertical: 8,
1266
+ marginTop: 16,
1267
+ borderBottomRightRadius: 8,
1268
+ borderBottomLeftRadius: 8,
1269
+ paddingHorizontal: 16,
1270
+ }}
1271
+ >
1272
+ <Info />
1273
+ <MText
1274
+ style={[
1275
+ {
1276
+ fontWeight: '300',
1277
+ fontSize: 12,
1278
+ fontStyle: 'italic',
1279
+ color: '#333333',
1280
+ marginLeft: 8,
1281
+ },
1282
+ ]}
1283
+ >
1284
+ Thực hiện đầy đủ các bước để giải ngân nhanh
1285
+ nhất
1286
+ </MText>
1287
+ </View>
1288
+ </View>
1289
+ </View>
1290
+ )}
1291
+ </Observer>
1292
+ )}
1293
+ </>
1294
+ )}
1295
+ </View>
1296
+ )}
1297
+ </Observer>
1298
+ <Observer>
1299
+ {() => (
1300
+ <View>
1301
+ {homeStore.listLoan && homeStore.listLoan.length > 0 && (
1302
+ <MText
1303
+ style={{
1304
+ fontSize: 16,
1305
+ fontWeight: 'bold',
1306
+ marginBottom: 16,
1307
+ marginTop: 16,
1308
+ }}
1309
+ >
1310
+ Danh sách đơn đang vay
1311
+ </MText>
1312
+ )}
1313
+ {homeStore?.listLoan &&
1314
+ homeStore?.listLoan.map((loan, index) => (
1315
+ <View key={index}>
1316
+ <TouchableOpacity
1317
+ disabled={
1318
+ loan?.disbursementPartner === 'CIMB' ? false : true
1319
+ }
1066
1320
  style={{
1067
1321
  backgroundColor: '#FFFFFF',
1068
1322
  paddingHorizontal: 16,
@@ -1070,23 +1324,28 @@ export const Home = observer(function Home() {
1070
1324
  borderRadius: 8,
1071
1325
  borderWidth: 0.5,
1072
1326
  borderColor: '#E0E0E0',
1327
+ marginBottom: 16,
1328
+ }}
1329
+ onPress={() => {
1330
+ if (loan?.disbursementPartner === 'CIMB') {
1331
+ navigation.dispatch(
1332
+ StackActions.push(ScreenNames.DetailLoan, {
1333
+ loan,
1334
+ })
1335
+ );
1336
+ }
1073
1337
  }}
1074
1338
  >
1075
1339
  <View
1076
1340
  style={{ flexDirection: 'row', alignItems: 'center' }}
1077
1341
  >
1078
- <Contract />
1342
+ <ContractActive />
1079
1343
  <View style={{ flex: 1, paddingLeft: 8 }}>
1080
1344
  <MText style={commonStyles.textNormalBold}>
1081
- Đơn vay {homeStore.listLoanPending?.id}
1345
+ Đơn vay-{loan?.id}
1082
1346
  </MText>
1083
1347
  <MText style={commonStyles.textNormal}>
1084
- Số tiền vay (VND):{' '}
1085
- {homeStore.listLoanPending?.loanAmount
1086
- ? formatMoney(
1087
- homeStore.listLoanPending?.loanAmount
1088
- )
1089
- : 'Chưa xác định'}
1348
+ Số tiền vay (VND): {formatMoney(loan?.loanAmount)}
1090
1349
  </MText>
1091
1350
  </View>
1092
1351
  </View>
@@ -1104,15 +1363,10 @@ export const Home = observer(function Home() {
1104
1363
  }}
1105
1364
  >
1106
1365
  <MText style={commonStyles.textNormal}>
1107
- Trạng thái
1366
+ Ngày giải ngân
1108
1367
  </MText>
1109
- <MText
1110
- style={[
1111
- commonStyles.textNormalBold,
1112
- { color: '#F05123' },
1113
- ]}
1114
- >
1115
- {homeStore?.listLoanPending?.loanStatus}
1368
+ <MText style={commonStyles.textNormalBold}>
1369
+ {formatDDMMYYY(loan?.disbursementAt)}
1116
1370
  </MText>
1117
1371
  </View>
1118
1372
  <View
@@ -1122,126 +1376,44 @@ export const Home = observer(function Home() {
1122
1376
  marginVertical: 16,
1123
1377
  }}
1124
1378
  />
1125
- <View style={{ flexDirection: 'row' }}>
1126
- {!homeStore.checkEKYC[
1127
- homeStore.listLoanPending?.id
1128
- ] ? (
1129
- <TouchableOpacity
1130
- style={{ alignItems: 'center' }}
1131
- onPress={() => {
1132
- navigation.dispatch(
1133
- StackActions.push(ScreenNames.NationalID, {
1134
- loan: homeStore.listLoanPending,
1135
- reLoan: true,
1136
- })
1137
- );
1138
- }}
1139
- >
1140
- <AddInfo />
1141
- <MText
1142
- style={[
1143
- commonStyles.textNormal,
1144
- {
1145
- fontSize: 12,
1146
- fontWeight: '300',
1147
- marginTop: 8,
1148
- },
1149
- ]}
1150
- >
1151
- EKYC
1152
- </MText>
1153
- </TouchableOpacity>
1154
- ) : (
1155
- <View style={{ alignItems: 'center' }}>
1156
- <AddInfoDisable />
1157
- <MText
1158
- style={[
1159
- commonStyles.textNormal,
1160
- {
1161
- fontSize: 12,
1162
- fontWeight: '300',
1163
- marginTop: 8,
1164
- },
1165
- ]}
1166
- >
1167
- EKYC
1168
- </MText>
1169
- </View>
1170
- )}
1171
-
1172
- <TouchableOpacity
1173
- style={{ alignItems: 'center', marginLeft: 20 }}
1174
- onPress={() => {
1175
- navigation.dispatch(
1176
- StackActions.push(ScreenNames.Video, {
1177
- loan: homeStore.listLoanPending,
1178
- })
1179
- );
1180
- }}
1181
- >
1182
- <IconVideo />
1183
- <MText
1184
- style={[
1185
- commonStyles.textNormal,
1186
- {
1187
- fontSize: 12,
1188
- fontWeight: '300',
1189
- marginTop: 8,
1190
- },
1191
- ]}
1192
- >
1193
- Quay video
1194
- </MText>
1195
- </TouchableOpacity>
1196
-
1197
- {homeStore.checkEKYC[
1198
- homeStore.listLoanPending?.id
1199
- ] ? (
1200
- <TouchableOpacity
1201
- style={{ alignItems: 'center', marginLeft: 20 }}
1202
- onPress={() => {
1203
- signLoan(homeStore.listLoanPending);
1204
- }}
1205
- >
1206
- <IconSign2 />
1207
- <MText
1208
- style={[
1209
- commonStyles.textNormal,
1210
- {
1211
- fontSize: 12,
1212
- fontWeight: '300',
1213
- marginTop: 8,
1214
- },
1215
- ]}
1216
- >
1217
- Ký HĐ
1218
- </MText>
1219
- </TouchableOpacity>
1220
- ) : (
1221
- <View
1222
- style={{ alignItems: 'center', marginLeft: 20 }}
1223
- >
1224
- <SignDisable />
1225
- <MText
1226
- style={[
1227
- commonStyles.textNormal,
1228
- {
1229
- fontSize: 12,
1230
- fontWeight: '300',
1231
- marginTop: 8,
1232
- },
1233
- ]}
1234
- >
1235
- Ký HĐ
1236
- </MText>
1237
- </View>
1238
- )}
1379
+ <View
1380
+ style={{
1381
+ flexDirection: 'row',
1382
+ justifyContent: 'space-between',
1383
+ }}
1384
+ >
1385
+ <MText style={commonStyles.textNormal}>
1386
+ Ngày kết thúc khoản vay
1387
+ </MText>
1388
+ <MText style={commonStyles.textNormalBold}>
1389
+ {formatDDMMYYY(loan?.finishAt)}
1390
+ </MText>
1391
+ </View>
1392
+ <View
1393
+ style={{
1394
+ height: 0.5,
1395
+ backgroundColor: '#E0E0E0',
1396
+ marginVertical: 16,
1397
+ }}
1398
+ />
1399
+ <View
1400
+ style={{
1401
+ flexDirection: 'row',
1402
+ justifyContent: 'space-between',
1403
+ }}
1404
+ >
1405
+ <MText style={commonStyles.textNormal}>
1406
+ Ngày đến hạn tiếp theo
1407
+ </MText>
1408
+ <MText style={commonStyles.textNormalBold}>
1409
+ {formatDDMMYYY(loan?.nextDate)}
1410
+ </MText>
1239
1411
  </View>
1240
1412
  <View
1241
1413
  style={{
1242
1414
  flexDirection: 'row',
1243
1415
  alignItems: 'center',
1244
- backgroundColor: '#FBEFE7',
1416
+ backgroundColor: '#EAF5E4',
1245
1417
  marginHorizontal: -16,
1246
1418
  paddingVertical: 8,
1247
1419
  marginTop: 16,
@@ -1262,164 +1434,18 @@ export const Home = observer(function Home() {
1262
1434
  },
1263
1435
  ]}
1264
1436
  >
1265
- Thực hiện đầy đủ các bước để giải ngân nhanh nhất
1437
+ Thời gian tất toán còn lại là{' '}
1438
+ {diffDays(new Date(), loan?.finishAt)} ngày
1266
1439
  </MText>
1267
1440
  </View>
1268
- </View>
1269
- )}
1270
- </>
1271
- )}
1441
+ </TouchableOpacity>
1442
+ </View>
1443
+ ))}
1272
1444
  </View>
1273
1445
  )}
1274
1446
  </Observer>
1275
- <View>
1276
- {homeStore.listLoan && homeStore.listLoan.length > 0 && (
1277
- <MText
1278
- style={{
1279
- fontSize: 16,
1280
- fontWeight: 'bold',
1281
- marginBottom: 16,
1282
- marginTop: 16,
1283
- }}
1284
- >
1285
- Danh sách đơn đang vay
1286
- </MText>
1287
- )}
1288
- {homeStore?.listLoan &&
1289
- homeStore?.listLoan.map((loan, index) => (
1290
- <View key={index}>
1291
- <TouchableOpacity
1292
- disabled={
1293
- loan?.disbursementPartner === 'CIMB' ? false : true
1294
- }
1295
- style={{
1296
- backgroundColor: '#FFFFFF',
1297
- paddingHorizontal: 16,
1298
- paddingTop: 16,
1299
- borderRadius: 8,
1300
- borderWidth: 0.5,
1301
- borderColor: '#E0E0E0',
1302
- marginBottom: 16,
1303
- }}
1304
- onPress={() => {
1305
- if (loan?.disbursementPartner === 'CIMB') {
1306
- navigation.dispatch(
1307
- StackActions.push(ScreenNames.DetailLoan, {
1308
- loan,
1309
- })
1310
- );
1311
- }
1312
- }}
1313
- >
1314
- <View
1315
- style={{ flexDirection: 'row', alignItems: 'center' }}
1316
- >
1317
- <ContractActive />
1318
- <View style={{ flex: 1, paddingLeft: 8 }}>
1319
- <MText style={commonStyles.textNormalBold}>
1320
- Đơn vay-{loan?.id}
1321
- </MText>
1322
- <MText style={commonStyles.textNormal}>
1323
- Số tiền vay (VND): {formatMoney(loan?.loanAmount)}
1324
- </MText>
1325
- </View>
1326
- </View>
1327
- <View
1328
- style={{
1329
- height: 1,
1330
- backgroundColor: '#E0E0E0',
1331
- marginVertical: 16,
1332
- }}
1333
- />
1334
- <View
1335
- style={{
1336
- flexDirection: 'row',
1337
- justifyContent: 'space-between',
1338
- }}
1339
- >
1340
- <MText style={commonStyles.textNormal}>
1341
- Ngày giải ngân
1342
- </MText>
1343
- <MText style={commonStyles.textNormalBold}>
1344
- {formatDDMMYYY(loan?.disbursementAt)}
1345
- </MText>
1346
- </View>
1347
- <View
1348
- style={{
1349
- height: 0.5,
1350
- backgroundColor: '#E0E0E0',
1351
- marginVertical: 16,
1352
- }}
1353
- />
1354
- <View
1355
- style={{
1356
- flexDirection: 'row',
1357
- justifyContent: 'space-between',
1358
- }}
1359
- >
1360
- <MText style={commonStyles.textNormal}>
1361
- Ngày kết thúc khoản vay
1362
- </MText>
1363
- <MText style={commonStyles.textNormalBold}>
1364
- {formatDDMMYYY(loan?.finishAt)}
1365
- </MText>
1366
- </View>
1367
- <View
1368
- style={{
1369
- height: 0.5,
1370
- backgroundColor: '#E0E0E0',
1371
- marginVertical: 16,
1372
- }}
1373
- />
1374
- <View
1375
- style={{
1376
- flexDirection: 'row',
1377
- justifyContent: 'space-between',
1378
- }}
1379
- >
1380
- <MText style={commonStyles.textNormal}>
1381
- Ngày đến hạn tiếp theo
1382
- </MText>
1383
- <MText style={commonStyles.textNormalBold}>
1384
- {formatDDMMYYY(loan?.nextDate)}
1385
- </MText>
1386
- </View>
1387
- <View
1388
- style={{
1389
- flexDirection: 'row',
1390
- alignItems: 'center',
1391
- backgroundColor: '#EAF5E4',
1392
- marginHorizontal: -16,
1393
- paddingVertical: 8,
1394
- marginTop: 16,
1395
- borderBottomRightRadius: 8,
1396
- borderBottomLeftRadius: 8,
1397
- paddingHorizontal: 16,
1398
- }}
1399
- >
1400
- <Info />
1401
- <MText
1402
- style={[
1403
- {
1404
- fontWeight: '300',
1405
- fontSize: 12,
1406
- fontStyle: 'italic',
1407
- color: '#333333',
1408
- marginLeft: 8,
1409
- },
1410
- ]}
1411
- >
1412
- Thời gian tất toán còn lại là{' '}
1413
- {diffDays(new Date(), loan?.finishAt)} ngày
1414
- </MText>
1415
- </View>
1416
- </TouchableOpacity>
1417
- </View>
1418
- ))}
1419
- </View>
1420
1447
  </View>
1421
1448
  </ScrollView>
1422
-
1423
1449
  <Modal
1424
1450
  isVisible={showModal}
1425
1451
  onDismiss={() => setShowModal(false)}
@@ -1593,6 +1619,7 @@ export const Home = observer(function Home() {
1593
1619
  </View>
1594
1620
  </SafeAreaView>
1595
1621
  </Modal>
1622
+ <Observer>{() => <Loading isLoading={homeStore.isLoading} />}</Observer>
1596
1623
  </View>
1597
1624
  );
1598
1625
  });