remboursement nano credit OK

This commit is contained in:
Brice 2020-11-11 11:18:19 +01:00
parent 996cdd3aab
commit 1adcfa786e
23 changed files with 5189 additions and 3581 deletions

File diff suppressed because one or more lines are too long

View File

@ -167,6 +167,7 @@
"SAVE_MONEY": "Save money", "SAVE_MONEY": "Save money",
"SAVE_MONEY_TYPE": "Savings type", "SAVE_MONEY_TYPE": "Savings type",
"CAUTION_CREDIT": "Caution credit demand", "CAUTION_CREDIT": "Caution credit demand",
"CAUTIONNEMENT_DONE": "Caution done",
"ID_DEMAND": "Demand ID", "ID_DEMAND": "Demand ID",
"DATE": "Date", "DATE": "Date",
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill", "PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",

View File

@ -174,6 +174,7 @@
"SAVE_MONEY_TYPE": "Type d'épargne", "SAVE_MONEY_TYPE": "Type d'épargne",
"REFUND_DONE": "Remboursement effectué", "REFUND_DONE": "Remboursement effectué",
"CAUTION_CREDIT": "Cautionner une demande de crédit", "CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande", "ID_DEMAND": "Identifiant de la demande",
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité", "PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
"PAIEMENT_ECOLE": "Paiement école", "PAIEMENT_ECOLE": "Paiement école",

View File

@ -1,55 +1,76 @@
import { import {
CREATE_GROUP_PENDING, ASK_NANO_CREDIT_ERROR,
CREATE_GROUP_SUCCESS, ASK_NANO_CREDIT_PENDING,
CREATE_GROUP_ERROR, ASK_NANO_CREDIT_RESET,
CREATE_GROUP_RESET, ASK_NANO_CREDIT_SUCCESS,
GET_DEMAND_GROUP_PENDING, CASSER_EPARGNE_USER_ERROR,
GET_DEMAND_GROUP_SUCCESS, CASSER_EPARGNE_USER_PENDING,
GET_DEMAND_GROUP_ERROR, CASSER_EPARGNE_USER_RESET,
GET_DEMAND_GROUP_RESET, CASSER_EPARGNE_USER_SUCCESS,
GET_UNIQUE_DEMAND_GROUP_PENDING, CAUTION_CREDIT_DEMAND_AGENT_ERROR,
GET_UNIQUE_DEMAND_GROUP_RESET,
GET_UNIQUE_DEMAND_GROUP_ERROR,
GET_UNIQUE_DEMAND_GROUP_SUCCESS,
TREAT_DEMAND_GROUP_PENDING,
TREAT_DEMAND_GROUP_SUCCESS,
TREAT_DEMAND_GROUP_ERROR,
TREAT_DEMAND_GROUP_RESET,
JOIN_GROUP_PENDING,
JOIN_GROUP_SUCCESS,
JOIN_GROUP_RESET,
JOIN_GROUP_ERROR,
GET_USER_GROUP_DETAIL_PENDING,
GET_USER_GROUP_DETAIL_SUCCESS,
GET_USER_GROUP_DETAIL_RESET,
GET_USER_GROUP_DETAIL_ERROR,
GET_NOTIFICATIONS_ERROR,
GET_NOTIFICATIONS_RESET,
GET_NOTIFICATIONS_PENDING,
GET_NOTIFICATIONS_SUCCESS, ASK_NANO_CREDIT_PENDING, ASK_NANO_CREDIT_SUCCESS, ASK_NANO_CREDIT_ERROR, ASK_NANO_CREDIT_RESET,
GET_NANO_CREDIT_DEMAND_DURATION_PENDING,
GET_NANO_CREDIT_DEMAND_DURATION_SUCCESS,
GET_NANO_CREDIT_DEMAND_DURATION_ERROR,
GET_NANO_CREDIT_DEMAND_DURATION_RESET,
REFUND_CREDIT_DEMAND_USER_PENDING,
REFUND_CREDIT_DEMAND_USER_RESET,
REFUND_CREDIT_DEMAND_USER_ERROR,
CAUTION_CREDIT_DEMAND_AGENT_PENDING, CAUTION_CREDIT_DEMAND_AGENT_PENDING,
CAUTION_CREDIT_DEMAND_AGENT_RESET, CAUTION_CREDIT_DEMAND_AGENT_RESET,
CAUTION_CREDIT_DEMAND_AGENT_ERROR,
GET_NANO_CREDIT_DEMAND_DETAIL_PENDING,
GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS,
GET_NANO_CREDIT_DEMAND_DETAIL_ERROR,
GET_NANO_CREDIT_DEMAND_DETAIL_RESET,
CAUTION_CREDIT_DEMAND_AGENT_SUCCESS, CAUTION_CREDIT_DEMAND_AGENT_SUCCESS,
EPARGNER_ARGENT_USER_PENDING, CREATE_GROUP_ERROR,
EPARGNER_ARGENT_USER_SUCCESS, CREATE_GROUP_PENDING,
CREATE_GROUP_RESET,
CREATE_GROUP_SUCCESS,
EPARGNER_ARGENT_USER_ERROR, EPARGNER_ARGENT_USER_ERROR,
EPARGNER_ARGENT_USER_PENDING,
EPARGNER_ARGENT_USER_RESET, EPARGNER_ARGENT_USER_RESET,
CASSER_EPARGNE_USER_PENDING, EPARGNER_ARGENT_USER_SUCCESS,
CASSER_EPARGNE_USER_SUCCESS, GET_DEMAND_GROUP_ERROR,
CASSER_EPARGNE_USER_ERROR, GET_DEMAND_GROUP_PENDING,
CASSER_EPARGNE_USER_RESET, GET_NANO_CREDIT_ACCOUNT_USER_PENDING, GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS, GET_NANO_CREDIT_ACCOUNT_USER_ERROR, GET_NANO_CREDIT_ACCOUNT_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_PENDING, GET_NANO_CREDIT_HISTORY_USER_SUCCESS, GET_NANO_CREDIT_HISTORY_USER_RESET, GET_NANO_CREDIT_HISTORY_USER_ERROR GET_DEMAND_GROUP_RESET,
GET_DEMAND_GROUP_SUCCESS,
GET_EPARGNE_HISTORY_PENDING_USER_ERROR,
GET_EPARGNE_HISTORY_PENDING_USER_PENDING,
GET_EPARGNE_HISTORY_PENDING_USER_RESET,
GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS,
GET_NANO_CREDIT_ACCOUNT_USER_ERROR,
GET_NANO_CREDIT_ACCOUNT_USER_PENDING,
GET_NANO_CREDIT_ACCOUNT_USER_RESET,
GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS,
GET_NANO_CREDIT_DEMAND_DETAIL_ERROR,
GET_NANO_CREDIT_DEMAND_DETAIL_PENDING,
GET_NANO_CREDIT_DEMAND_DETAIL_RESET,
GET_NANO_CREDIT_DEMAND_DETAIL_SUCCESS,
GET_NANO_CREDIT_DEMAND_DURATION_ERROR,
GET_NANO_CREDIT_DEMAND_DURATION_PENDING,
GET_NANO_CREDIT_DEMAND_DURATION_RESET,
GET_NANO_CREDIT_DEMAND_DURATION_SUCCESS,
GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR,
GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING,
GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET,
GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS,
GET_NANO_CREDIT_HISTORY_USER_ERROR,
GET_NANO_CREDIT_HISTORY_USER_PENDING,
GET_NANO_CREDIT_HISTORY_USER_RESET,
GET_NANO_CREDIT_HISTORY_USER_SUCCESS,
GET_NOTIFICATIONS_ERROR,
GET_NOTIFICATIONS_PENDING,
GET_NOTIFICATIONS_RESET,
GET_NOTIFICATIONS_SUCCESS,
GET_UNIQUE_DEMAND_GROUP_ERROR,
GET_UNIQUE_DEMAND_GROUP_PENDING,
GET_UNIQUE_DEMAND_GROUP_RESET,
GET_UNIQUE_DEMAND_GROUP_SUCCESS,
GET_USER_GROUP_DETAIL_ERROR,
GET_USER_GROUP_DETAIL_PENDING,
GET_USER_GROUP_DETAIL_RESET,
GET_USER_GROUP_DETAIL_SUCCESS,
JOIN_GROUP_ERROR,
JOIN_GROUP_PENDING,
JOIN_GROUP_RESET,
JOIN_GROUP_SUCCESS,
REFUND_CREDIT_DEMAND_USER_ERROR,
REFUND_CREDIT_DEMAND_USER_PENDING,
REFUND_CREDIT_DEMAND_USER_RESET,
REFUND_CREDIT_DEMAND_USER_SUCCESS,
TREAT_DEMAND_GROUP_ERROR,
TREAT_DEMAND_GROUP_PENDING,
TREAT_DEMAND_GROUP_RESET,
TREAT_DEMAND_GROUP_SUCCESS
} from "../types/NanoCreditType"; } from "../types/NanoCreditType";
export const fetchCreateGroupPending = () => ({ export const fetchCreateGroupPending = () => ({
@ -225,7 +246,7 @@ export const fetchCautionCreditDemandUserPending = () => ({
}); });
export const fetchCautionCreditDemandUserSuccess = (res) => ({ export const fetchCautionCreditDemandUserSuccess = (res) => ({
type: REFUND_CREDIT_DEMAND_USER_RESET, type: REFUND_CREDIT_DEMAND_USER_SUCCESS,
result: res, result: res,
}); });
@ -351,3 +372,41 @@ export const fetchGetNanoCreditUserHistoryError = (error) => ({
export const fetchGetNanoCreditUserHistoryReset = () => ({ export const fetchGetNanoCreditUserHistoryReset = () => ({
type: GET_NANO_CREDIT_HISTORY_USER_RESET type: GET_NANO_CREDIT_HISTORY_USER_RESET
}); });
export const fetchGetNanoCreditUserHistoryInProgressPending = () => ({
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING
});
export const fetchGetNanoCreditUserHistoryInProgressSuccess = (res) => ({
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS,
result: res,
});
export const fetchGetNanoCreditUserHistoryInProgressError = (error) => ({
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR,
result: error
});
export const fetchGetNanoCreditUserHistoryInProgressReset = () => ({
type: GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET
});
export const fetchGetEpargneInProgressPending = () => ({
type: GET_EPARGNE_HISTORY_PENDING_USER_PENDING
});
export const fetchGetEpargneInProgressSuccess = (res) => ({
type: GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS,
result: res,
});
export const fetchGetEpargneInProgressError = (error) => ({
type: GET_EPARGNE_HISTORY_PENDING_USER_ERROR,
result: error
});
export const fetchGetEpargneInProgressReset = () => ({
type: GET_EPARGNE_HISTORY_PENDING_USER_RESET
});

View File

@ -1,4 +1,9 @@
import { GET_DEMAND_GROUP_ERROR, GET_DEMAND_GROUP_PENDING, GET_DEMAND_GROUP_RESET, GET_DEMAND_GROUP_SUCCESS } from "../types/NanoCreditType"; import {
GET_DEMAND_GROUP_ERROR,
GET_DEMAND_GROUP_PENDING,
GET_DEMAND_GROUP_RESET,
GET_DEMAND_GROUP_SUCCESS
} from "../types/NanoCreditType";
const initialState = { const initialState = {
loading: false, loading: false,
@ -8,23 +13,27 @@ const initialState = {
export default (state = initialState, action) => { export default (state = initialState, action) => {
switch (action.type) { switch (action.type) {
case GET_DEMAND_GROUP_PENDING: return { case GET_DEMAND_GROUP_PENDING:
return {
...state, ...state,
loading: true loading: true
} }
case GET_DEMAND_GROUP_SUCCESS: return { case GET_DEMAND_GROUP_SUCCESS:
return {
...state, ...state,
loading: false, loading: false,
result: action.result.data, result: action.result.data,
error: null error: null
} }
case GET_DEMAND_GROUP_ERROR: return { case GET_DEMAND_GROUP_ERROR:
return {
...state, ...state,
loading: false, loading: false,
result: null, result: null,
error: action.result error: action.result
} }
case GET_DEMAND_GROUP_RESET: return initialState; case GET_DEMAND_GROUP_RESET:
return initialState;
default: { default: {
return state; return state;

View File

@ -0,0 +1,42 @@
import {
GET_EPARGNE_HISTORY_PENDING_USER_ERROR,
GET_EPARGNE_HISTORY_PENDING_USER_PENDING,
GET_EPARGNE_HISTORY_PENDING_USER_RESET,
GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS
} from "../types/NanoCreditType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_EPARGNE_HISTORY_PENDING_USER_PENDING:
return {
...state,
loading: true
}
case GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_EPARGNE_HISTORY_PENDING_USER_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_EPARGNE_HISTORY_PENDING_USER_RESET:
return initialState;
default: {
return state;
}
}
};

View File

@ -0,0 +1,42 @@
import {
GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR,
GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING,
GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET,
GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS
} from "../types/NanoCreditType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING:
return {
...state,
loading: true
}
case GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET:
return initialState;
default: {
return state;
}
}
};

View File

@ -44,6 +44,8 @@ import GetNanoCreditHistoryUserReducer from "./GetNanoCreditHistoryUserReducer";
import GetHyperSuperHistoryReducer from "./GetHyperSuperHistoryReducer"; import GetHyperSuperHistoryReducer from "./GetHyperSuperHistoryReducer";
import GetBankListReducer from "./GetBankListReducer"; import GetBankListReducer from "./GetBankListReducer";
import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer"; import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer";
import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer";
import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer";
const persistConfig = { const persistConfig = {
key: 'root', key: 'root',
@ -96,7 +98,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
getNanoCreditHistoryUserReducer: GetNanoCreditHistoryUserReducer, getNanoCreditHistoryUserReducer: GetNanoCreditHistoryUserReducer,
getHyperSuperHistoryReducer: GetHyperSuperHistoryReducer, getHyperSuperHistoryReducer: GetHyperSuperHistoryReducer,
getBankListReducer: GetBankListReducer, getBankListReducer: GetBankListReducer,
envoieUserWalletToBank: EnvoieUserWalletToBank envoieUserWalletToBank: EnvoieUserWalletToBank,
getEpargneInProgressReducer: GetEpargneInProgressReducer,
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer
}); });
export default rootReducer; export default rootReducer;

View File

@ -68,12 +68,22 @@ export const CASSER_EPARGNE_USER_SUCCESS = 'CASSER_EPARGNE_USER_SUCCESS';
export const CASSER_EPARGNE_USER_ERROR = 'CASSER_EPARGNE_USER_ERROR'; export const CASSER_EPARGNE_USER_ERROR = 'CASSER_EPARGNE_USER_ERROR';
export const CASSER_EPARGNE_USER_RESET = 'CASSER_EPARGNE_USER_RESET'; export const CASSER_EPARGNE_USER_RESET = 'CASSER_EPARGNE_USER_RESET';
export const GET_NANO_CREDIT_HISTORY_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_USER_ERROR';
export const GET_NANO_CREDIT_HISTORY_USER_RESET = 'GET_NANO_CREDIT_HISTORY_USER_RESET';
export const GET_NANO_CREDIT_HISTORY_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_USER_SUCCESS';
export const GET_NANO_CREDIT_HISTORY_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_USER_PENDING';
export const GET_NANO_CREDIT_ACCOUNT_USER_PENDING = 'GET_NANO_CREDIT_ACCOUNT_USER_PENDING'; export const GET_NANO_CREDIT_ACCOUNT_USER_PENDING = 'GET_NANO_CREDIT_ACCOUNT_USER_PENDING';
export const GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS = 'GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS'; export const GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS = 'GET_NANO_CREDIT_ACCOUNT_USER_SUCCESS';
export const GET_NANO_CREDIT_ACCOUNT_USER_ERROR = 'GET_NANO_CREDIT_ACCOUNT_USER_ERROR'; export const GET_NANO_CREDIT_ACCOUNT_USER_ERROR = 'GET_NANO_CREDIT_ACCOUNT_USER_ERROR';
export const GET_NANO_CREDIT_ACCOUNT_USER_RESET = 'GET_NANO_CREDIT_ACCOUNT_USER_RESET'; export const GET_NANO_CREDIT_ACCOUNT_USER_RESET = 'GET_NANO_CREDIT_ACCOUNT_USER_RESET';
export const GET_NANO_CREDIT_HISTORY_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_USER_PENDING'; export const GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING';
export const GET_NANO_CREDIT_HISTORY_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_USER_SUCCESS'; export const GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS';
export const GET_NANO_CREDIT_HISTORY_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_USER_ERROR'; export const GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR';
export const GET_NANO_CREDIT_HISTORY_USER_RESET = 'GET_NANO_CREDIT_HISTORY_USER_RESET'; export const GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_RESET';
export const GET_EPARGNE_HISTORY_PENDING_USER_PENDING = 'GET_EPARGNE_HISTORY_PENDING_USER_PENDING';
export const GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS = 'GET_EPARGNE_HISTORY_PENDING_USER_SUCCESS';
export const GET_EPARGNE_HISTORY_PENDING_USER_ERROR = 'GET_EPARGNE_HISTORY_PENDING_USER_ERROR';
export const GET_EPARGNE_HISTORY_PENDING_USER_RESET = 'GET_EPARGNE_HISTORY_PENDING_USER_RESET';

View File

@ -1656,7 +1656,7 @@ class Home extends BaseScreen {
translucent={true} translucent={true}
/> />
{/* Start here to comment */} {/* Start here to comment */}
{/* { {/*{
(this.state.loadingDialog || this.props.loading) ? (this.state.loadingDialog || this.props.loading) ?
<View <View
style={{ style={{

View File

@ -1,26 +1,32 @@
import Button from 'apsl-react-native-button'; import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native'; import {Alert, ScrollView, StyleSheet, Text, View} from 'react-native';
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import Dialog from "react-native-dialog"; import Dialog from "react-native-dialog";
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { store } from "../../redux/store"; import {store} from "../../redux/store";
import { Dropdown } from 'react-native-material-dropdown'; import {Dropdown} from 'react-native-material-dropdown';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs'; import {ProgressDialog} from 'react-native-simple-dialogs';
import { Fumi } from 'react-native-textinput-effects'; import {Fumi} from 'react-native-textinput-effects';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux'; import {connect} from 'react-redux';
import { bindActionCreators } from 'redux'; import {bindActionCreators} from 'redux';
import { Color } from '../../config/Color'; import {Color} from '../../config/Color';
import { FontWeight, Typography } from '../../config/typography'; import {Typography} from '../../config/typography';
import { IlinkEmitter } from '../../utils/events'; import {IlinkEmitter} from '../../utils/events';
import { cautionCreditDemandAgentAction, cautionCreditDemandAgentReset, getNanoCreditDemandDetailAction, getNanoCreditDemandDetailReset } from '../../webservice/agent/NanoCreditAgentApi'; import {
import { readUser } from '../../webservice/AuthApi'; cautionCreditDemandAgentAction,
import { withdrawalMode } from '../../utils/UtilsFunction'; cautionCreditDemandAgentReset,
getNanoCreditDemandDetailAction,
getNanoCreditDemandDetailReset
} from '../../webservice/agent/NanoCreditAgentApi';
import {readUser} from '../../webservice/AuthApi';
import {withdrawalMode} from '../../utils/UtilsFunction';
import thousands from 'thousands'; import thousands from 'thousands';
const moment = require('moment'); const moment = require('moment');
let theme = require('../../utils/theme.json'); let theme = require('../../utils/theme.json');
@ -45,7 +51,6 @@ class CautionNanoCreditAgent extends Component {
withdrawalInCashTypeName: withdrawalMode()[0].name, withdrawalInCashTypeName: withdrawalMode()[0].name,
isModalConfirmVisible: false, isModalConfirmVisible: false,
isGroupToModify: false, isGroupToModify: false,
isModalConfirmVisible: false,
withdrawalInCash: true, withdrawalInCash: true,
wallet: store.getState().walletDetailReducer.result.response wallet: store.getState().walletDetailReducer.result.response
}; };
@ -85,7 +90,7 @@ class CautionNanoCreditAgent extends Component {
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
this.setState({ user }); this.setState({user});
} }
} }
}); });
@ -128,69 +133,74 @@ class CautionNanoCreditAgent extends Component {
<View> <View>
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}> <View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text> <Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{idDemand}</Text> <Text style={[Typography.caption1, Color.grayColor]}>{idDemand}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text> <Text style={[styles.body2]}>{I18n.t('AMOUNT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant, ' ')} ${this.state.wallet.currency_code}`}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{`${thousands(montant, ' ')} ${this.state.wallet.currency_code}`}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(taxe, ' ')} ${this.state.wallet.currency_code}`}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{`${thousands(taxe, ' ')} ${this.state.wallet.currency_code}`}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{`${thousands(interet, ' ')} ${this.state.wallet.currency_code}`}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{`${thousands(interet, ' ')} ${this.state.wallet.currency_code}`}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_TYPE')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_TYPE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{retraitCash ? I18n.t('WITHDRAWAL_IN_CASH') : I18n.t('TRANSFER_IN_ACCOUNT')}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{retraitCash ? I18n.t('WITHDRAWAL_IN_CASH') : I18n.t('TRANSFER_IN_ACCOUNT')}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('ETAT')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('ETAT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{I18n.t(etat)}</Text> <Text style={[Typography.caption1, Color.grayColor]}>{etat}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{duree}</Text> <Text style={[Typography.caption1, Color.grayColor]}>{duree}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('CREATION_DATE')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{moment(dateCreation).format('DD-MM-YYYY')}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{moment(dateCreation).format('DD-MM-YYYY')}</Text>
</View> </View>
</View> </View>
</View> </View>
@ -200,7 +210,7 @@ class CautionNanoCreditAgent extends Component {
this.setState({ this.setState({
isModalConfirmVisible: false isModalConfirmVisible: false
}); });
}} /> }}/>
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => { <Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({ this.setState({
isModalConfirmVisible: false, isModalConfirmVisible: false,
@ -213,7 +223,7 @@ class CautionNanoCreditAgent extends Component {
password: this.state.password password: this.state.password
}); });
this.props.getNanoCreditDemandDetailReset(); this.props.getNanoCreditDemandDetailReset();
}} /> }}/>
</Dialog.Container> </Dialog.Container>
@ -227,7 +237,7 @@ class CautionNanoCreditAgent extends Component {
renderRefundNanoCreditResponse = () => { renderRefundNanoCreditResponse = () => {
const { result, error } = this.props; const {result, error} = this.props;
if (error !== null) { if (error !== null) {
if (typeof error.data !== 'undefined') { if (typeof error.data !== 'undefined') {
@ -242,7 +252,7 @@ class CautionNanoCreditAgent extends Component {
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -250,7 +260,7 @@ class CautionNanoCreditAgent extends Component {
if (result !== null) { if (result !== null) {
if (result.response !== null) { if (result.response !== null) {
Alert.alert( Alert.alert(
I18n.t("REFUND_DONE"), I18n.t("CAUTIONNEMENT_DONE"),
result.response, result.response,
[ [
{ {
@ -262,14 +272,14 @@ class CautionNanoCreditAgent extends Component {
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
} }
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') }) this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
this.forceUpdate() this.forceUpdate()
} }
@ -278,7 +288,7 @@ class CautionNanoCreditAgent extends Component {
} }
onSubmitCautionnerNanoCredit = () => { onSubmitCautionnerNanoCredit = () => {
const { idDemand, password } = this.state; const {idDemand, password} = this.state;
if (this.ckeckIfFieldIsOK(idDemand)) if (this.ckeckIfFieldIsOK(idDemand))
this.idDemandAnim.shake(800); this.idDemandAnim.shake(800);
@ -294,7 +304,7 @@ class CautionNanoCreditAgent extends Component {
} }
renderGetNanoCreditDemandDetailResponse = () => { renderGetNanoCreditDemandDetailResponse = () => {
const { resultGetNanoCreditDemandDetail, errorGetNanoCreditDemandDetail } = this.props; const {resultGetNanoCreditDemandDetail, errorGetNanoCreditDemandDetail} = this.props;
if (errorGetNanoCreditDemandDetail !== null) { if (errorGetNanoCreditDemandDetail !== null) {
if (typeof errorGetNanoCreditDemandDetail.data !== 'undefined') { if (typeof errorGetNanoCreditDemandDetail.data !== 'undefined') {
@ -309,7 +319,7 @@ class CautionNanoCreditAgent extends Component {
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} else { } else {
Alert.alert( Alert.alert(
@ -323,7 +333,7 @@ class CautionNanoCreditAgent extends Component {
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -341,7 +351,7 @@ class CautionNanoCreditAgent extends Component {
} }
render() { render() {
const { resultGetNanoCreditDemandDetail } = this.props; const {resultGetNanoCreditDemandDetail} = this.props;
return ( return (
<> <>
@ -356,7 +366,9 @@ class CautionNanoCreditAgent extends Component {
<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text> <Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
<Animatable.View ref={(comp) => { this.idDemandAnim = comp }}> <Animatable.View ref={(comp) => {
this.idDemandAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'} <Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
label={I18n.t('ID_DEMAND')} label={I18n.t('ID_DEMAND')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -364,14 +376,16 @@ class CautionNanoCreditAgent extends Component {
value={this.state.idDemand} value={this.state.idDemand}
onChangeText={(idDemand) => { onChangeText={(idDemand) => {
this.setState({ idDemand }) this.setState({idDemand})
}} }}
style={styles.input} style={styles.input}
> >
</Fumi> </Fumi>
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.typeRetraitAnim = comp }} <Animatable.View ref={(comp) => {
this.typeRetraitAnim = comp
}}
style={{ style={{
width: responsiveWidth(90), width: responsiveWidth(90),
height: 60, height: 60,
@ -386,7 +400,7 @@ class CautionNanoCreditAgent extends Component {
label={I18n.t('WITHDRAWAL_TYPE')} label={I18n.t('WITHDRAWAL_TYPE')}
data={this.state.withdrawalInCashType} data={this.state.withdrawalInCashType}
useNativeDriver={true} useNativeDriver={true}
value={this.state.withdrawalInCashTypeName} value={I18n.t(this.state.withdrawalInCashTypeName)}
onChangeText={(value, index, data) => { onChangeText={(value, index, data) => {
if (value === I18n.t('WITHDRAWAL_IN_CASH')) if (value === I18n.t('WITHDRAWAL_IN_CASH'))
this.setState({ this.setState({
@ -399,13 +413,19 @@ class CautionNanoCreditAgent extends Component {
withdrawalInCashTypeName: I18n.t('TRANSFER_IN_ACCOUNT') withdrawalInCashTypeName: I18n.t('TRANSFER_IN_ACCOUNT')
}) })
}} }}
valueExtractor={(value) => { return value.name }} valueExtractor={(value) => {
labelExtractor={(value) => { return value.name }} return value.name
}}
labelExtractor={(value) => {
return value.name
}}
/> />
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}> <Animatable.View ref={(comp) => {
this.passwordAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'} <Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
label={I18n.t('PASSWORD')} label={I18n.t('PASSWORD')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -413,7 +433,7 @@ class CautionNanoCreditAgent extends Component {
secureTextEntry={true} secureTextEntry={true}
value={this.state.password} value={this.state.password}
onChangeText={(password) => { onChangeText={(password) => {
this.setState({ password }) this.setState({password})
}} }}
style={styles.input} style={styles.input}
> >
@ -422,7 +442,9 @@ class CautionNanoCreditAgent extends Component {
<Button style={styles.btnvalide} <Button style={styles.btnvalide}
textStyle={styles.textbtnvalide} textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitCautionnerNanoCredit(); }}> onPress={() => {
this.onSubmitCautionnerNanoCredit();
}}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button> {this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
</ScrollView> </ScrollView>
</> </>

View File

@ -1,24 +1,26 @@
import Button from 'apsl-react-native-button'; import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native'; import {Alert, ScrollView, StyleSheet, Text, View} from 'react-native';
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { Dropdown } from 'react-native-material-dropdown'; import {Dropdown} from 'react-native-material-dropdown';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs'; import {ProgressDialog} from 'react-native-simple-dialogs';
import { Fumi } from 'react-native-textinput-effects'; import {Fumi} from 'react-native-textinput-effects';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux'; import {connect} from 'react-redux';
import { bindActionCreators } from 'redux'; import {bindActionCreators} from 'redux';
import { Color } from '../../config/Color'; import {Color} from '../../config/Color';
import { FontWeight, Typography } from '../../config/typography'; import {FontWeight, Typography} from '../../config/typography';
import { store } from "../../redux/store"; import {store} from "../../redux/store";
import { isNormalInteger, typeEpargne } from '../../utils/UtilsFunction'; import {isNormalInteger, typeEpargne} from '../../utils/UtilsFunction';
import { readUser } from '../../webservice/AuthApi'; import {readUser} from '../../webservice/AuthApi';
import { getNanoCreditDemandDurationAction, getNanoCreditDemandDurationReset } from '../../webservice/NanoCreditApi'; import {getNanoCreditDemandDurationAction, getNanoCreditDemandDurationReset} from '../../webservice/NanoCreditApi';
import { epargnerArgentUserAction, epargnerArgentUserReset } from "../../webservice/user/NanoCreditApi"; import {epargnerArgentUserAction, epargnerArgentUserReset} from "../../webservice/user/NanoCreditApi";
import {IlinkEmitter} from "../../utils/events";
let theme = require('../../utils/theme.json'); let theme = require('../../utils/theme.json');
let route = require('../../route.json'); let route = require('../../route.json');
@ -81,8 +83,9 @@ class EpargnerArgentUser extends Component {
console.log("USER", user); console.log("USER", user);
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
this.props.getNanoCreditDemandDurationAction({ id_user: user.id, type: "epargne" }); this.props.getNanoCreditDemandDurationAction({id_user: user.id, type: "epargne"});
}; }
;
} }
}) })
@ -93,7 +96,7 @@ class EpargnerArgentUser extends Component {
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
this.setState({ user }); this.setState({user});
} }
} }
}); });
@ -105,7 +108,7 @@ class EpargnerArgentUser extends Component {
} }
isMontantValid = () => { isMontantValid = () => {
const { montant } = this.state; const {montant} = this.state;
if ((parseInt(isEqual(montant, 0)) || montant < 0)) if ((parseInt(isEqual(montant, 0)) || montant < 0))
return { return {
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'), errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
@ -133,7 +136,7 @@ class EpargnerArgentUser extends Component {
} }
renderGetDurationesponse = () => { renderGetDurationesponse = () => {
const { resultGetNanoCreditDuration, errorGetNanoCreditDuration } = this.props; const {resultGetNanoCreditDuration, errorGetNanoCreditDuration} = this.props;
if (resultGetNanoCreditDuration !== null) { if (resultGetNanoCreditDuration !== null) {
if (typeof resultGetNanoCreditDuration.response !== 'undefined') { if (typeof resultGetNanoCreditDuration.response !== 'undefined') {
if (resultGetNanoCreditDuration.response.length > 0) { if (resultGetNanoCreditDuration.response.length > 0) {
@ -143,8 +146,7 @@ class EpargnerArgentUser extends Component {
durationSelect: resultGetNanoCreditDuration.response[0].value, durationSelect: resultGetNanoCreditDuration.response[0].value,
modalVisible: false modalVisible: false
}); });
} } else if (resultGetNanoCreditDuration.response.length === 0) {
else if (resultGetNanoCreditDuration.response.length === 0) {
this.setState({ this.setState({
hasLoadDuration: true, hasLoadDuration: true,
durations: [], durations: [],
@ -168,7 +170,7 @@ class EpargnerArgentUser extends Component {
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} else { } else {
Alert.alert( Alert.alert(
@ -182,7 +184,7 @@ class EpargnerArgentUser extends Component {
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -191,7 +193,7 @@ class EpargnerArgentUser extends Component {
renderEpargnerArgentResponse = () => { renderEpargnerArgentResponse = () => {
const { result, error } = this.props; const {result, error} = this.props;
if (error !== null) { if (error !== null) {
if (typeof error.data !== 'undefined') { if (typeof error.data !== 'undefined') {
@ -205,7 +207,7 @@ class EpargnerArgentUser extends Component {
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -220,25 +222,26 @@ class EpargnerArgentUser extends Component {
text: I18n.t("OK"), onPress: () => { text: I18n.t("OK"), onPress: () => {
this.props.epargnerArgentUserReset(); this.props.epargnerArgentUserReset();
//IlinkEmitter.emit("treatNanoGroupDemand"); //IlinkEmitter.emit("treatNanoGroupDemand");
IlinkEmitter.emit("updateNanoCreditAccount");
this.props.navigation.pop(); this.props.navigation.pop();
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
} }
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('SAVE_MONEY') }) this.props.navigation.setParams({name: I18n.t('SAVE_MONEY')})
this.forceUpdate() this.forceUpdate()
} }
onSubmitEpargnerArgent = () => { onSubmitEpargnerArgent = () => {
const { montant, typeEpargneName, durationSelect } = this.state; const {montant, typeEpargneName, durationSelect} = this.state;
if (this.ckeckIfFieldIsOK(typeEpargneName)) if (this.ckeckIfFieldIsOK(typeEpargneName))
this.typeEpargneAnim.shake(800); this.typeEpargneAnim.shake(800);
@ -283,7 +286,9 @@ class EpargnerArgentUser extends Component {
<Text style={styles.subbigtitle}>{I18n.t('FILL_INFORMATION')}</Text> <Text style={styles.subbigtitle}>{I18n.t('FILL_INFORMATION')}</Text>
<Animatable.View ref={(comp) => { this.typeEpargneAnim = comp }} <Animatable.View ref={(comp) => {
this.typeEpargneAnim = comp
}}
style={{ style={{
width: responsiveWidth(90), width: responsiveWidth(90),
height: 60, height: 60,
@ -314,14 +319,20 @@ class EpargnerArgentUser extends Component {
displayDuration: true displayDuration: true
}) })
}} }}
valueExtractor={(value) => { return I18n.t(value.name) }} valueExtractor={(value) => {
labelExtractor={(value) => { return I18n.t(value.name) }} return I18n.t(value.name)
}}
labelExtractor={(value) => {
return I18n.t(value.name)
}}
/> />
</Animatable.View> </Animatable.View>
{ {
this.state.displayDuration && this.state.displayDuration &&
<Animatable.View ref={(comp) => { this.durationAnim = comp }} <Animatable.View ref={(comp) => {
this.durationAnim = comp
}}
style={{ style={{
width: responsiveWidth(90), width: responsiveWidth(90),
height: 60, height: 60,
@ -338,15 +349,21 @@ class EpargnerArgentUser extends Component {
useNativeDriver={true} useNativeDriver={true}
value={this.state.durationSelect !== null ? this.state.durationSelect : ''} value={this.state.durationSelect !== null ? this.state.durationSelect : ''}
onChangeText={(value, index, data) => { onChangeText={(value, index, data) => {
this.setState({ durationSelect: value }); this.setState({durationSelect: value});
}}
valueExtractor={(value) => {
return I18n.t(value.value)
}}
labelExtractor={(value) => {
return I18n.t(value.value)
}} }}
valueExtractor={(value) => { return I18n.t(value.value) }}
labelExtractor={(value) => { return I18n.t(value.value) }}
/> />
</Animatable.View> </Animatable.View>
} }
<Animatable.View ref={(comp) => { this.montantAnim = comp }}> <Animatable.View ref={(comp) => {
this.montantAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'money'} <Fumi iconClass={FontAwesomeIcon} iconName={'money'}
label={I18n.t('AMOUNT')} label={I18n.t('AMOUNT')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -354,7 +371,7 @@ class EpargnerArgentUser extends Component {
iconSize={20} iconSize={20}
value={this.state.montant} value={this.state.montant}
onChangeText={(montant) => { onChangeText={(montant) => {
this.setState({ montant }) this.setState({montant})
}} }}
style={styles.input} style={styles.input}
> >
@ -380,7 +397,9 @@ class EpargnerArgentUser extends Component {
</View> </View>
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}> <Animatable.View ref={(comp) => {
this.passwordAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'} <Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
label={I18n.t('PASSWORD')} label={I18n.t('PASSWORD')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -388,7 +407,7 @@ class EpargnerArgentUser extends Component {
secureTextEntry={true} secureTextEntry={true}
value={this.state.password} value={this.state.password}
onChangeText={(password) => { onChangeText={(password) => {
this.setState({ password }) this.setState({password})
}} }}
style={styles.input} style={styles.input}
> >
@ -397,7 +416,9 @@ class EpargnerArgentUser extends Component {
<Button style={styles.btnvalide} <Button style={styles.btnvalide}
textStyle={styles.textbtnvalide} textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitEpargnerArgent(); }}> onPress={() => {
this.onSubmitEpargnerArgent();
}}>
{I18n.t('SUBMIT_LABEL')}</Button> {I18n.t('SUBMIT_LABEL')}</Button>
</ScrollView> </ScrollView>
</> </>

View File

@ -0,0 +1,692 @@
import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil';
import React, {Component} from 'react';
import {
ActivityIndicator,
Alert,
Platform,
ProgressBarAndroid,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
import I18n from 'react-native-i18n';
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import {ProgressDialog} from 'react-native-simple-dialogs';
import {connect} from 'react-redux';
import omit from 'lodash/omit';
import {bindActionCreators} from 'redux';
import {Color} from '../../config/Color';
import {IlinkEmitter} from '../../utils/events';
import {readUser} from '../../webservice/AuthApi';
import {refundCreditDemandUserAction, refundCreditDemandUserReset} from '../../webservice/user/NanoCreditApi';
import {
getNanoCreditUserHistoryInProgressAction,
getNanoCreditUserHistoryInProgressReset,
} from "../../webservice/NanoCreditApi";
import {Typography} from "../../config/typography";
import {cutStringWithoutDot, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import thousands from "thousands";
import * as Utils from "../../utils/DeviceUtils";
import Dialog from "react-native-dialog";
let theme = require('../../utils/theme.json');
let route = require('../../route.json');
class RefundNanoCreditUser extends Component {
constructor(props) {
super(props);
this.state = {
password: null,
idDemand: null,
codeGroup: null,
loading: false,
user: null,
triggerSubmitClick: false,
isSubmitClick: false,
isDataSubmit: false,
isModalConfirmVisible: false,
isGroupToModify: false,
displayModalHistory: false,
historyItemDetail: null,
isDataHasLoaded: false,
displayPasswordModal: false,
wallet: this.props.navigation.state.params.wallet,
};
this.props.getNanoCreditUserHistoryInProgressReset();
}
static navigatorStyle = {
navBarBackgroundColor: Color.primaryColor,
statusBarColor: Color.primaryDarkColor,
navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF'
};
static navigationOptions = () => {
return {
drawerLabel: () => null,
headerTitle: I18n.t('REFUND_NANO_CREDIT'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
marginTop: 0,
color: 'white'
},
headerTitleStyle: {
color: "white"
},
title: I18n.t('REFUND_NANO_CREDIT')
}
};
componentDidMount() {
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getNanoCreditUserHistoryInProgressAction(user.id);
}
}
});
}
ckeckIfFieldIsOK(champ) {
return (isNil(champ) || isEqual(champ.length, 0));
}
renderRefundNanoCreditResponse = () => {
const {result, error} = this.props;
if (error !== null) {
if (typeof error.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_LABLE"),
error.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.refundCreditDemandUserReset();
}
}
],
{cancelable: false}
)
}
}
if (result !== null) {
if (result.response !== null) {
Alert.alert(
I18n.t("REFUND_DONE"),
result.response,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.refundCreditDemandUserReset();
IlinkEmitter.emit("refreshWallet");
IlinkEmitter.emit("updateNanoCreditAccount");
this.props.navigation.pop();
}
}
],
{cancelable: false}
)
}
}
}
updateLangue() {
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
this.forceUpdate()
}
ckeckIfFieldIsOK(champ) {
return (isNil(champ) || isEqual(champ.length, 0));
}
onSubmitRefundNanoCredit = () => {
const {idDemand, password} = this.state;
if (this.ckeckIfFieldIsOK(idDemand))
this.idDemandAnim.shake(800);
else if (this.ckeckIfFieldIsOK(password))
this.passwordAnim.shake(800);
else {
this.props.refundCreditDemandUserAction({
id_user: this.state.user.id,
id_demande: this.state.idDemand,
password: this.state.password
}, 0);
}
this.setState({
isDataSubmit: true
});
}
renderLoader = () => {
return (
<ProgressDialog
visible={this.props.loading || this.props.loadingGetCommission}
title={I18n.t('LOADING')}
message={I18n.t('LOADING_INFO')}
/>
)
}
renderModalHistoryDetail = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayModalHistory}>
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
{
<ScrollView>
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_EPARGNE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_epargne}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ETAT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('HISTORY_TYPE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.type}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('FINAL_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text>
</View>
</View>
</View>
</ScrollView>
}
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
this.setState({
displayModalHistory: !this.state.displayModalHistory,
});
}}/>
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({
displayPasswordModal: !this.state.displayPasswordModal,
});
}}/>
</Dialog.Container>
);
}
renderPasswordDialog = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayPasswordModal}>
<Dialog.Title>{I18n.t('PASSWORD')}</Dialog.Title>
<Dialog.Input placeholder={I18n.t('PLEASE_ENTER_THE_PASSWORD')}
style={{borderBottomWidth: 1, borderBottomColor: Color.borderColor}}
showSoftInputOnFocus={true}
onChangeText={(password) => {
this.setState({password})
}}
secureTextEntry={true}
value={this.state.password}
onSubmitEditing={() => {
this.props.refundCreditDemandUserAction({
id_user: this.state.user.id,
id_demande: this.state.historyItemDetail.id_epargne,
password: this.state.password
});
}}/>
<Dialog.Button label={I18n.t('CANCEL_LABEL')} onPress={() => {
this.setState({displayPasswordModal: !this.state.displayPasswordModal});
}}/>
<Dialog.Button label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({
displayPasswordModal: false,
displayModalHistory: false,
isDataSubmit: true
})
this.props.refundCreditDemandUserAction({
id_user: this.state.user.id,
id_demande: this.state.historyItemDetail.id_epargne,
password: this.state.password
});
}}/>
</Dialog.Container>
);
}
renderNanoCreditItem = (item, index) => {
return (
<TouchableOpacity onPress={() => {
this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
Object.keys(omit(item, ['id', 'id_epargne', 'duree_mois', 'date_fin', 'interet', 'taxe'])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{
isEqual(element, 'montant') ?
` ${thousands(item[element], ' ')}`
: isEqual(element, 'date_creation') ?
cutStringWithoutDot(item[element], 16)
: item[element]
}
</Text>
</View>
))
}
</TouchableOpacity>
);
}
renderNanoCreditList = () => {
const {errorNanoCreditHistory, resultNanoCreditHistory} = this.props;
if (errorNanoCreditHistory !== null) {
if (typeof errorNanoCreditHistory.data !== 'undefined') {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorNanoCreditHistory.data.error}</Text>
</View>
)
} else {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorNanoCreditHistory}</Text>
</View>
)
}
}
if (resultNanoCreditHistory !== null) {
if (resultNanoCreditHistory.response !== null) {
return (
Array.isArray(resultNanoCreditHistory.response) && (resultNanoCreditHistory.response.length) > 0 ?
(
<>
<View style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
nanoCreditHistoryLabel().map((item, index) => (
<View style={{alignItems: 'center'}} key={index}>
<Icon name={item.icon} size={24} color={Color.primaryColor}/>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{I18n.t(item.label)}
</Text>
</View>
))
}
</View>
{
resultNanoCreditHistory.response.map((item, index) => (
this.renderNanoCreditItem(item, index)
))
}
</>
) :
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
<Text style={Typography.body1}>{I18n.t('NO_NANO_CREDIT')}</Text>
</View>
)
)
}
}
}
renderNanoCreditHistory = () => {
return (
<View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
{
this.props.loadingNanoCreditHistory ?
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
) : this.renderNanoCreditList()
}
</View>
);
}
render() {
return (
<>
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
{this.state.displayModalHistory && this.renderModalHistoryDetail()}
{this.state.displayPasswordModal && this.renderPasswordDialog()}
<ScrollView style={styles.container}>
<View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text
style={[Typography.title3, Typography.semibold]}>
{I18n.t('NANO_CREDIT_LIST')}
</Text>
</View>
{
this.renderNanoCreditHistory()
}
{/* <Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
<Animatable.View ref={(comp) => {
this.idDemandAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
label={I18n.t('ID_DEMAND')}
iconColor={'#f95a25'}
iconSize={20}
value={this.state.idDemand}
onChangeText={(idDemand) => {
this.setState({idDemand})
}}
style={styles.input}
>
</Fumi>
</Animatable.View>
<Animatable.View ref={(comp) => {
this.passwordAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
label={I18n.t('PASSWORD')}
iconColor={'#f95a25'}
iconSize={20}
secureTextEntry={true}
value={this.state.password}
onChangeText={(password) => {
this.setState({password})
}}
style={styles.input}
>
</Fumi>
</Animatable.View>
<Button style={styles.btnvalide}
textStyle={styles.textbtnvalide}
onPress={() => {
this.onSubmitRefundNanoCredit();
}}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
</ScrollView>
</>
)
}
}
const maptStateToProps = state => ({
loading: state.refundCreditDemandReducer.loading,
result: state.refundCreditDemandReducer.result,
error: state.refundCreditDemandReducer.error,
loadingNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.loading,
resultNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.result,
errorNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
refundCreditDemandUserAction,
refundCreditDemandUserReset,
getNanoCreditUserHistoryInProgressAction,
getNanoCreditUserHistoryInProgressReset
}, dispatch);
export default connect(maptStateToProps, mapDispatchToProps)(RefundNanoCreditUser);
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Color.containerBackgroundColor,
paddingHorizontal: 20
},
textbtnvalide: {
color: 'white',
fontWeight: 'bold'
},
bigtitle: {
color: 'white',
fontSize: 20,
flex: 1,
fontWeight: 'bold',
textAlign: 'center',
margin: 20,
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 1
},
subbigtitle: {
color: 'white',
fontSize: 17,
textAlign: 'center',
margin: 5,
},
btnvalide: {
marginTop: 20,
marginLeft: 20,
marginRight: 20,
borderColor: 'transparent',
backgroundColor: Color.accentLightColor,
height: 52
},
btnSubmit: {
marginTop: 20,
borderColor: 'transparent',
backgroundColor: Color.accentLightColor,
height: 52,
width: "30%",
marginLeft: 20,
marginRight: 20,
},
input: {
height: 60,
marginTop: responsiveHeight(2),
marginLeft: responsiveWidth(5),
marginRight: responsiveWidth(5),
borderRadius: 5,
},
circlePoint: {
width: 50,
height: 50,
borderRadius: 25,
marginRight: 5,
alignItems: 'center',
justifyContent: 'center',
},
checkDefault: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
borderBottomWidth: 1,
paddingVertical: 10,
marginTop: 5
},
transactionContainer: {
flexDirection: 'row',
paddingTop: 10,
},
containerTouch: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
shadowColor: Color.borderColor,
borderColor: Color.borderColor,
borderWidth: 0.5,
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
borderRadius: 10,
backgroundColor: Color.cardBackgroundColor
},
contain: {
flexDirection: 'row',
justifyContent: 'space-between',
},
imageBanner: {
marginTop: 15,
marginLeft: 5,
width: Utils.scaleWithPixel(30),
height: Utils.scaleWithPixel(30)
},
content: {
height: Utils.scaleWithPixel(65),
paddingHorizontal: 10,
justifyContent: 'space-between',
alignItems: 'flex-start',
flex: 1,
},
contentTitle: {
paddingTop: 12,
},
contentService: {
paddingVertical: 10,
borderBottomWidth: 0.5,
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-between',
},
containField: {
padding: 10,
marginBottom: 20,
borderWidth: 0.5,
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
flexDirection: "row",
height: 140,
borderRadius: 10
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
borderBottomWidth: 1,
paddingVertical: 5,
width: responsiveWidth(100),
marginBottom: 15
},
iconContent: {
width: 60,
marginRight: 10,
alignItems: "center"
},
contentLeftItem: {
flex: 1,
paddingTop: 40,
paddingLeft: 10,
paddingRight: 10,
alignItems: "center"
},
});

View File

@ -1,24 +1,38 @@
import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native'; import {
import * as Animatable from 'react-native-animatable'; ActivityIndicator,
Alert,
Platform,
ProgressBarAndroid,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs'; import {ProgressDialog} from 'react-native-simple-dialogs';
import { Fumi } from 'react-native-textinput-effects'; import {connect} from 'react-redux';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import omit from 'lodash/omit';
import { connect } from 'react-redux'; import {bindActionCreators} from 'redux';
import { bindActionCreators } from 'redux'; import {Color} from '../../config/Color';
import { Color } from '../../config/Color'; import {IlinkEmitter} from '../../utils/events';
import { FontWeight, Typography } from '../../config/typography'; import {readUser} from '../../webservice/AuthApi';
import { store } from "../../redux/store"; import {refundCreditDemandUserAction, refundCreditDemandUserReset} from '../../webservice/user/NanoCreditApi';
import { IlinkEmitter } from '../../utils/events'; import {
import { readUser } from '../../webservice/AuthApi'; getNanoCreditUserHistoryInProgressAction,
import { createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi'; getNanoCreditUserHistoryInProgressReset,
import { isNormalInteger } from '../../utils/UtilsFunction'; } from "../../webservice/NanoCreditApi";
import { refundCreditDemandUserAction, refundCreditDemandUserReset } from '../../webservice/user/NanoCreditApi'; import {Typography} from "../../config/typography";
import {cutStringWithoutDot, displayTransactionType, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import thousands from "thousands";
import * as Utils from "../../utils/DeviceUtils";
import Dialog from "react-native-dialog";
let theme = require('../../utils/theme.json'); let theme = require('../../utils/theme.json');
let route = require('../../route.json'); let route = require('../../route.json');
@ -39,7 +53,14 @@ class RefundNanoCreditUser extends Component {
isDataSubmit: false, isDataSubmit: false,
isModalConfirmVisible: false, isModalConfirmVisible: false,
isGroupToModify: false, isGroupToModify: false,
displayModalHistory: false,
historyItemDetail: null,
isDataHasLoaded: false,
displayPasswordModal: false,
wallet: this.props.navigation.state.params.wallet,
}; };
this.props.getNanoCreditUserHistoryInProgressReset();
} }
@ -73,7 +94,8 @@ class RefundNanoCreditUser extends Component {
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
this.setState({ user }); this.setState({user});
this.props.getNanoCreditUserHistoryInProgressAction(user.id);
} }
} }
}); });
@ -86,7 +108,7 @@ class RefundNanoCreditUser extends Component {
renderRefundNanoCreditResponse = () => { renderRefundNanoCreditResponse = () => {
const { result, error } = this.props; const {result, error} = this.props;
if (error !== null) { if (error !== null) {
if (typeof error.data !== 'undefined') { if (typeof error.data !== 'undefined') {
@ -100,7 +122,7 @@ class RefundNanoCreditUser extends Component {
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
@ -115,19 +137,20 @@ class RefundNanoCreditUser extends Component {
text: I18n.t("OK"), onPress: () => { text: I18n.t("OK"), onPress: () => {
this.props.refundCreditDemandUserReset(); this.props.refundCreditDemandUserReset();
IlinkEmitter.emit("refreshWallet"); IlinkEmitter.emit("refreshWallet");
IlinkEmitter.emit("updateNanoCreditAccount");
this.props.navigation.pop(); this.props.navigation.pop();
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} }
} }
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') }) this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
this.forceUpdate() this.forceUpdate()
} }
@ -136,7 +159,7 @@ class RefundNanoCreditUser extends Component {
} }
onSubmitRefundNanoCredit = () => { onSubmitRefundNanoCredit = () => {
const { idDemand, password } = this.state; const {idDemand, password} = this.state;
if (this.ckeckIfFieldIsOK(idDemand)) if (this.ckeckIfFieldIsOK(idDemand))
this.idDemandAnim.shake(800); this.idDemandAnim.shake(800);
@ -166,16 +189,345 @@ class RefundNanoCreditUser extends Component {
) )
} }
renderModalHistoryDetail = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayModalHistory}>
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
{
<ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('STATUS')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_REFUND')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_rembourse + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_PARTIALLY_REFUND')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.partiellement_rembourse + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_IN_CASH')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.retrait_cash == 1 ? I18n.t('YES') : I18n.t('NO')}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('VALIDATION_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_validation}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT_PREVU')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement_prevu}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text>
</View>
</View>
</View>
</ScrollView>
}
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
this.setState({
displayModalHistory: !this.state.displayModalHistory,
});
}}/>
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({
displayPasswordModal: !this.state.displayPasswordModal,
});
}}/>
</Dialog.Container>
);
}
renderPasswordDialog = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayPasswordModal}>
<Dialog.Title>{I18n.t('PASSWORD')}</Dialog.Title>
<Dialog.Input placeholder={I18n.t('PLEASE_ENTER_THE_PASSWORD')}
style={{borderBottomWidth: 1, borderBottomColor: Color.borderColor}}
showSoftInputOnFocus={true}
onChangeText={(password) => {
this.setState({password})
}}
secureTextEntry={true}
value={this.state.password}
onSubmitEditing={() => {
this.setState({
displayPasswordModal: false,
displayModalHistory: false,
isDataSubmit: true
});
this.props.refundCreditDemandUserAction({
id_user: this.state.user.id,
id_demande: this.state.historyItemDetail.id_demande,
password: this.state.password
});
}}/>
<Dialog.Button label={I18n.t('CANCEL_LABEL')} onPress={() => {
this.setState({displayPasswordModal: !this.state.displayPasswordModal});
}}/>
<Dialog.Button label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({
displayPasswordModal: false,
displayModalHistory: false,
isDataSubmit: true
});
this.props.refundCreditDemandUserAction({
id_user: this.state.user.id,
id_demande: this.state.historyItemDetail.id_demande,
password: this.state.password
});
}}/>
</Dialog.Container>
);
}
renderNanoCreditItem = (item, index) => {
return (
<TouchableOpacity onPress={() => {
this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
Object.keys(omit(item, ['id', 'id_demande', 'agent', 'retrait_cash', 'date_remboursement_prevu', 'taxe', 'date_validation', 'duree_mois', 'interet', 'montant_rembourse', 'partiellement_rembourse',])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{
isEqual(element, 'montant') ?
` ${thousands(item[element], ' ')}`
: isEqual(element, 'date_creation') ?
cutStringWithoutDot(item[element], 16)
: item[element]
}
</Text>
</View>
))
}
</TouchableOpacity>
);
}
renderNanoCreditList = () => {
const {errorNanoCreditHistory, resultNanoCreditHistory} = this.props;
if (errorNanoCreditHistory !== null) {
if (typeof errorNanoCreditHistory.data !== 'undefined') {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorNanoCreditHistory.data.error}</Text>
</View>
)
} else {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorNanoCreditHistory}</Text>
</View>
)
}
}
if (resultNanoCreditHistory !== null) {
if (resultNanoCreditHistory.response !== null) {
return (
Array.isArray(resultNanoCreditHistory.response) && (resultNanoCreditHistory.response.length) > 0 ?
(
<>
<View style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
nanoCreditHistoryLabel().map((item, index) => (
<View style={{alignItems: 'center'}} key={index}>
<Icon name={item.icon} size={24} color={Color.primaryColor}/>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{I18n.t(item.label)}
</Text>
</View>
))
}
</View>
{
resultNanoCreditHistory.response.map((item, index) => (
this.renderNanoCreditItem(item, index)
))
}
</>
) :
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
<Text style={Typography.body1}>{I18n.t('NO_NANO_CREDIT')}</Text>
</View>
)
)
}
}
}
renderNanoCreditHistory = () => {
return (
<View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
{
this.props.loadingNanoCreditHistory ?
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
) : this.renderNanoCreditList()
}
</View>
);
}
render() { render() {
return ( return (
<> <>
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()} {(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()} {this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
{this.state.displayModalHistory && this.renderModalHistoryDetail()}
{this.state.displayPasswordModal && this.renderPasswordDialog()}
<ScrollView style={styles.container}> <ScrollView style={styles.container}>
<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text> <View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text
style={[Typography.title3, Typography.semibold]}>
{I18n.t('NANO_CREDIT_LIST')}
</Text>
</View>
<Animatable.View ref={(comp) => { this.idDemandAnim = comp }}> {
this.renderNanoCreditHistory()
}
{/* <Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
<Animatable.View ref={(comp) => {
this.idDemandAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'} <Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
label={I18n.t('ID_DEMAND')} label={I18n.t('ID_DEMAND')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -183,7 +535,7 @@ class RefundNanoCreditUser extends Component {
value={this.state.idDemand} value={this.state.idDemand}
onChangeText={(idDemand) => { onChangeText={(idDemand) => {
this.setState({ idDemand }) this.setState({idDemand})
}} }}
style={styles.input} style={styles.input}
> >
@ -191,7 +543,9 @@ class RefundNanoCreditUser extends Component {
</Animatable.View> </Animatable.View>
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}> <Animatable.View ref={(comp) => {
this.passwordAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'} <Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
label={I18n.t('PASSWORD')} label={I18n.t('PASSWORD')}
iconColor={'#f95a25'} iconColor={'#f95a25'}
@ -199,7 +553,7 @@ class RefundNanoCreditUser extends Component {
secureTextEntry={true} secureTextEntry={true}
value={this.state.password} value={this.state.password}
onChangeText={(password) => { onChangeText={(password) => {
this.setState({ password }) this.setState({password})
}} }}
style={styles.input} style={styles.input}
> >
@ -208,8 +562,10 @@ class RefundNanoCreditUser extends Component {
<Button style={styles.btnvalide} <Button style={styles.btnvalide}
textStyle={styles.textbtnvalide} textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitRefundNanoCredit(); }}> onPress={() => {
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button> this.onSubmitRefundNanoCredit();
}}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
</ScrollView> </ScrollView>
</> </>
) )
@ -221,12 +577,18 @@ const maptStateToProps = state => ({
loading: state.refundCreditDemandReducer.loading, loading: state.refundCreditDemandReducer.loading,
result: state.refundCreditDemandReducer.result, result: state.refundCreditDemandReducer.result,
error: state.refundCreditDemandReducer.error, error: state.refundCreditDemandReducer.error,
loadingNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.loading,
resultNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.result,
errorNanoCreditHistory: state.getNanoCreditUserHistoryInProgressReducer.error,
}); });
const mapDispatchToProps = dispatch => bindActionCreators({ const mapDispatchToProps = dispatch => bindActionCreators({
refundCreditDemandUserAction, refundCreditDemandUserAction,
refundCreditDemandUserReset, refundCreditDemandUserReset,
getNanoCreditUserHistoryInProgressAction,
getNanoCreditUserHistoryInProgressReset
}, dispatch); }, dispatch);
@ -235,7 +597,8 @@ export default connect(maptStateToProps, mapDispatchToProps)(RefundNanoCreditUse
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: Color.primaryDarkColor, backgroundColor: Color.containerBackgroundColor,
paddingHorizontal: 20
}, },
textbtnvalide: { textbtnvalide: {
color: 'white', color: 'white',
@ -282,5 +645,98 @@ const styles = StyleSheet.create({
marginLeft: responsiveWidth(5), marginLeft: responsiveWidth(5),
marginRight: responsiveWidth(5), marginRight: responsiveWidth(5),
borderRadius: 5, borderRadius: 5,
} },
circlePoint: {
width: 50,
height: 50,
borderRadius: 25,
marginRight: 5,
alignItems: 'center',
justifyContent: 'center',
},
checkDefault: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
borderBottomWidth: 1,
paddingVertical: 10,
marginTop: 5
},
transactionContainer: {
flexDirection: 'row',
paddingTop: 10,
},
containerTouch: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
shadowColor: Color.borderColor,
borderColor: Color.borderColor,
borderWidth: 0.5,
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
borderRadius: 10,
backgroundColor: Color.cardBackgroundColor
},
contain: {
flexDirection: 'row',
justifyContent: 'space-between',
},
imageBanner: {
marginTop: 15,
marginLeft: 5,
width: Utils.scaleWithPixel(30),
height: Utils.scaleWithPixel(30)
},
content: {
height: Utils.scaleWithPixel(65),
paddingHorizontal: 10,
justifyContent: 'space-between',
alignItems: 'flex-start',
flex: 1,
},
contentTitle: {
paddingTop: 12,
},
contentService: {
paddingVertical: 10,
borderBottomWidth: 0.5,
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-between',
},
containField: {
padding: 10,
marginBottom: 20,
borderWidth: 0.5,
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
flexDirection: "row",
height: 140,
borderRadius: 10
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
borderBottomWidth: 1,
paddingVertical: 5,
width: responsiveWidth(100),
marginBottom: 15
},
iconContent: {
width: 60,
marginRight: 10,
alignItems: "center"
},
contentLeftItem: {
flex: 1,
paddingTop: 40,
paddingLeft: 10,
paddingRight: 10,
alignItems: "center"
},
}); });

View File

@ -7,27 +7,24 @@
*/ */
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Platform, StyleSheet, Alert, FlatList, Text, View, TouchableOpacity, Linking, AsyncStorage } from 'react-native'; import {Alert, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import ActionButton from 'react-native-action-button';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import { responsiveFontSize, responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import HeaderMenu from './HeaderMenu'; import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
import { historiques as histo, first, useraccount, notification, configurations } from './../../route.json'; import {disconnect, readUser} from './../../webservice/AuthApi';
import { primary, primaryDarkAdvanced } from './../../utils/theme.json';
import { readUser, disconnect } from './../../webservice/AuthApi';
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
import Button from 'apsl-react-native-button'
import {IlinkEmitter} from "./../../utils/events"
import {SafeAreaView} from 'react-navigation';
import DeviceInfo from "react-native-device-info"
import Configuration from "../../webservice/persistences/Configuration";
import {ScrollView} from 'react-native-gesture-handler';
const route = require("./../../route.json") const route = require("./../../route.json")
require('./../../utils/Translations') require('./../../utils/Translations')
var DBEvents = require('react-native-db-models').DBEvents var DBEvents = require('react-native-db-models').DBEvents
let theme = require('./../../utils/theme.json') let theme = require('./../../utils/theme.json')
import Button from 'apsl-react-native-button'
import { IlinkEmitter } from "./../../utils/events"
import { DrawerItems, SafeAreaView } from 'react-navigation';
import DeviceInfo from "react-native-device-info"
import AppContainer, { AppNavigator } from "../../App";
import Configuration from "../../webservice/persistences/Configuration";
import { ScrollView } from 'react-native-gesture-handler';
export default class OptionsMenu extends Component { export default class OptionsMenu extends Component {
@ -35,6 +32,7 @@ export default class OptionsMenu extends Component {
statusBarColor: primaryDarkAdvanced, statusBarColor: primaryDarkAdvanced,
}; };
commandeListe commandeListe
constructor(props) { constructor(props) {
super(props); super(props);
this.state = this.initState(); this.state = this.initState();
@ -45,7 +43,7 @@ export default class OptionsMenu extends Component {
this.configuration = new Configuration(); this.configuration = new Configuration();
readUser().then((user) => { readUser().then((user) => {
if (user !== null && user !== undefined) { if (user !== null && user !== undefined) {
this.setState({ user }); this.setState({user});
} }
}); });
} }
@ -90,18 +88,21 @@ export default class OptionsMenu extends Component {
componentDidMount() { componentDidMount() {
const items = this.props.navigation.router.childRouters.sta.childRouters; const items = this.props.navigation.router.childRouters.sta.childRouters;
this.setState({ items: items }) this.setState({items: items})
this.retrieveAndroidInformation() this.retrieveAndroidInformation()
} }
updateLangue() { updateLangue() {
this.setState({ lang: "change" }) this.setState({lang: "change"})
this.forceUpdate() this.forceUpdate()
} }
componentWillUnmount() { componentWillUnmount() {
} }
onMenuNavigationEvent(menuOption) { onMenuNavigationEvent(menuOption) {
/* Navigation.mergeOptions(this.props.componentId,{ /* Navigation.mergeOptions(this.props.componentId,{
sideMenu: { sideMenu: {
@ -120,6 +121,7 @@ export default class OptionsMenu extends Component {
} }
}*/ }*/
} }
onUserConnect() { onUserConnect() {
readUser().then((user) => { readUser().then((user) => {
if (user !== null && user !== undefined) { if (user !== null && user !== undefined) {
@ -127,9 +129,11 @@ export default class OptionsMenu extends Component {
} }
}); });
} }
onNavigatorEvent(event) { onNavigatorEvent(event) {
} }
hideSideMenu() { hideSideMenu() {
/* Navigation.mergeOptions("drawer", { /* Navigation.mergeOptions("drawer", {
sideMenu: { sideMenu: {
@ -140,6 +144,7 @@ export default class OptionsMenu extends Component {
} }
});*/ });*/
} }
initState() { initState() {
return { return {
user: null, user: null,
@ -147,37 +152,41 @@ export default class OptionsMenu extends Component {
currentId: 0, currentId: 0,
} }
} }
getGeolocatedUserMenu() { getGeolocatedUserMenu() {
return [ return [
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true } {title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false } , {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
, { title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false } , {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false } , {title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false}
, { title: I18n.t('ADD_NETWORK'), id: 11, key: 11, icon: 'md-people', active: false } , {title: I18n.t('ADD_NETWORK'), id: 11, key: 11, icon: 'md-people', active: false}
, { title: I18n.t('CHANGE_INFORMATION'), id: 13, key: 13, icon: 'md-person', active: false } , {title: I18n.t('CHANGE_INFORMATION'), id: 13, key: 13, icon: 'md-person', active: false}
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false } , {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }] , {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
} }
getSuperUserMenu() { getSuperUserMenu() {
return [ return [
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true } {title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false } , {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
, { title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false } , {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false } , {title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false}
, { title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false } , {title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false}
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false } , {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }] , {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
} }
getHyperUsermenu() { getHyperUsermenu() {
return [ return [
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true } {title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false } , {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
, { title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false } , {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false } , {title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false}
, { title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false } , {title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false}
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false } , {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }] , {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
} }
updateUser(user) { updateUser(user) {
let menu = []; let menu = [];
if (user !== undefined) { if (user !== undefined) {
@ -208,16 +217,18 @@ export default class OptionsMenu extends Component {
} }
this.setState({ user: user, menu: menu }); this.setState({user: user, menu: menu});
} }
getUserMenu() { getUserMenu() {
return [ return [
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true } {title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false } , {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
, { title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false } , {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false } , {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }] , {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
} }
redirectToScreen = (item) => { redirectToScreen = (item) => {
console.log("Item Menu Click", item); console.log("Item Menu Click", item);
@ -228,13 +239,13 @@ export default class OptionsMenu extends Component {
case "super": case "super":
if (item === "walletSelect") if (item === "walletSelect")
item = "walletDetail"; item = "walletDetail";
this.props.navigation.navigate(item, { agentId: this.state.user.agentId }); this.props.navigation.navigate(item, {agentId: this.state.user.agentId});
break; break;
case "hyper": case "hyper":
if (item === "walletSelect") if (item === "walletSelect")
item = "walletDetail"; item = "walletDetail";
this.props.navigation.navigate(item, { agentId: this.state.user.agentId }); this.props.navigation.navigate(item, {agentId: this.state.user.agentId});
break; break;
case "geolocated": case "geolocated":
@ -244,7 +255,7 @@ export default class OptionsMenu extends Component {
default: default:
if (item === "walletSelect") if (item === "walletSelect")
item = "walletDetailUser"; item = "walletDetailUser";
this.props.navigation.navigate(item, { userId: this.state.user.id }); this.props.navigation.navigate(item, {userId: this.state.user.id});
break; break;
} }
@ -260,7 +271,7 @@ export default class OptionsMenu extends Component {
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent' || item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe' || item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent' || item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser') { || item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent') {
return null return null
} else { } else {
const color = this.state.currentId === item.id ? theme.accent : "grey" const color = this.state.currentId === item.id ? theme.accent : "grey"
@ -268,7 +279,7 @@ export default class OptionsMenu extends Component {
return ( return (
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.props.navigation.toggleDrawer(); this.props.navigation.toggleDrawer();
this.setState({ currentId: item.id }); this.setState({currentId: item.id});
this.redirectToScreen(item); this.redirectToScreen(item);
}} }}
> >
@ -289,8 +300,10 @@ export default class OptionsMenu extends Component {
}; };
_onPress = ((item) => { _onPress = ((item) => {
this.setState({ currentId: item.id }) this.setState({currentId: item.id})
let current = this.state.menu.filter((item) => { return item.active })[0] let current = this.state.menu.filter((item) => {
return item.active
})[0]
current.active = false; current.active = false;
item.active = true; item.active = true;
let newMenu = []; let newMenu = [];
@ -300,7 +313,7 @@ export default class OptionsMenu extends Component {
else newMenu.push(it) else newMenu.push(it)
} }
) )
this.setState({ menu: newMenu }) this.setState({menu: newMenu})
/* switch(item.id){ /* switch(item.id){
case 2: case 2:
Navigation.push(route.stackRoot,{ Navigation.push(route.stackRoot,{
@ -444,59 +457,83 @@ export default class OptionsMenu extends Component {
} }
} }
}) })
*/ }); */
});
getNameItems(item) { getNameItems(item) {
let icon = item let icon = item
switch (item) { switch (item) {
case "home": icon = I18n.t('MAP') case "home":
icon = I18n.t('MAP')
break break
case 'useraccount': icon = I18n.t('MY_ACCOUNT') case 'useraccount':
icon = I18n.t('MY_ACCOUNT')
break break
case 'walletSelect': icon = I18n.t('WALLET') case 'walletSelect':
icon = I18n.t('WALLET')
break break
case 'Historique': icon = I18n.t('CREDIT_MANAGE') case 'Historique':
icon = I18n.t('CREDIT_MANAGE')
break break
case "superviseurgroup": icon = I18n.t('GROUP_MANAGE') case "superviseurgroup":
icon = I18n.t('GROUP_MANAGE')
break break
case "updateinformation": icon = I18n.t("CHANGE_INFORMATION") case "updateinformation":
icon = I18n.t("CHANGE_INFORMATION")
break break
case 'notificationview': icon = I18n.t('NOTIFICATIONS') case 'notificationview':
icon = I18n.t('NOTIFICATIONS')
break break
case 'configuration': icon = I18n.t('CONFIGURATIONS') case 'configuration':
icon = I18n.t('CONFIGURATIONS')
break; break;
case 'addNetwork': icon = I18n.t('ADD_NETWORK') case 'addNetwork':
icon = I18n.t('ADD_NETWORK')
break break
case 'about': icon = I18n.t('ABOUT') case 'about':
icon = I18n.t('ABOUT')
} }
return icon; return icon;
} }
getIcon(item) { getIcon(item) {
let icon = "md-map" let icon = "md-map"
switch (item) { switch (item) {
case "home": icon = "md-map" case "home":
icon = "md-map"
break break
case 'useraccount': icon = "md-person" case 'useraccount':
icon = "md-person"
break break
case 'walletSelect': icon = "md-wallet" case 'walletSelect':
icon = "md-wallet"
break break
case 'Historique': icon = "md-card" case 'Historique':
icon = "md-card"
break break
case "superviseurgroup": icon = "md-people" case "superviseurgroup":
icon = "md-people"
break break
case 'notificationview': icon = "md-notifications"; case 'notificationview':
icon = "md-notifications";
break break
case "updateinformation": icon = "md-people" case "updateinformation":
icon = "md-people"
break break
case 'configuration': icon = 'md-settings' case 'configuration':
icon = 'md-settings'
break; break;
case 'addNetwork': icon = "md-people" case 'addNetwork':
icon = "md-people"
break break
case 'about': icon = 'md-contacts'; case 'about':
icon = 'md-contacts';
break; break;
} }
return icon; return icon;
} }
render() { render() {
var name = this.state.user ? this.state.user.firstname : ""; var name = this.state.user ? this.state.user.firstname : "";
const surname = this.state.user ? this.state.user.lastname : ""; const surname = this.state.user ? this.state.user.lastname : "";
@ -512,8 +549,8 @@ export default class OptionsMenu extends Component {
</View> </View>
<ScrollView style={{ <ScrollView style={{
flex: 1, height: responsiveHeight(40) flex: 1, height: responsiveHeight(40)
}} > }}>
<SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}> <SafeAreaView forceInset={{top: 'always', horizontal: 'never'}}>
{ {
this.state.items && Object.keys(this.state.items).map((item, key) => { this.state.items && Object.keys(this.state.items).map((item, key) => {
return this._renderItem(item) return this._renderItem(item)
@ -529,17 +566,18 @@ export default class OptionsMenu extends Component {
</View> </View>
) )
else { else {
setTimeout(() => this.setState({ lang: "" }), 500) setTimeout(() => this.setState({lang: ""}), 500)
return (<View />) return (<View/>)
} }
} }
userDeconnect() { userDeconnect() {
Alert.alert( Alert.alert(
I18n.t('DISCONNEXION'), I18n.t('DISCONNEXION'),
I18n.t('DISCONNEXION_TEXT'), I18n.t('DISCONNEXION_TEXT'),
[ [
{}, {},
{ text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel' }, {text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
{ {
text: I18n.t('YES'), onPress: () => { text: I18n.t('YES'), onPress: () => {
disconnect().then(() => { disconnect().then(() => {
@ -550,9 +588,10 @@ export default class OptionsMenu extends Component {
} }
}, },
], ],
{ cancelable: false } {cancelable: false}
) )
} }
watchUser() { watchUser() {
readUser().then((user) => { readUser().then((user) => {
if (user !== null && user !== undefined) { if (user !== null && user !== undefined) {
@ -621,8 +660,7 @@ const styles = StyleSheet.create({
backgroundd_drawer: { backgroundd_drawer: {
backgroundColor: '#000', backgroundColor: '#000',
}, },
listbackground: { listbackground: {},
},
actionButtonIcon: { actionButtonIcon: {
fontSize: 20, fontSize: 20,
height: 22, height: 22,

View File

@ -120,9 +120,9 @@ class OperateurOptionSelect extends Component {
}}> }}>
<View style={{flexDirection: 'row', alignItems: 'center'}}> <View style={{flexDirection: 'row', alignItems: 'center'}}>
<View> <View>
<Text style={Typography.body1}>{item.bank_name}</Text> <Text style={Typography.body1}>{item.operator_name}</Text>
<Text style={[Typography.footnote, Color.grayColor]} style={{marginTop: 5}}> <Text style={[Typography.footnote, Color.grayColor]} style={{marginTop: 5}}>
{I18n.t('COUNTRY')}: {item.country} {I18n.t('COUNTRY')}: {`${item.operator_address}, ${item.country}`}
</Text> </Text>
</View> </View>
</View> </View>
@ -177,7 +177,10 @@ class OperateurOptionSelect extends Component {
key={index} key={index}
style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]} style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]}
onPress={() => { onPress={() => {
this.props.navigation.navigate(item.screen, {
type: item.type,
title: item.title
})
}}> }}>
<View style={{flexDirection: 'row', alignItems: 'center'}}> <View style={{flexDirection: 'row', alignItems: 'center'}}>

View File

@ -1,41 +1,57 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { StyleSheet, ScrollView, View, Image, StatusBar, Alert, FlatList, TouchableOpacity, ActivityIndicator, Platform, ProgressBarAndroid, Text } from 'react-native'; import {
import { ActionSheetProvider, connectActionSheet } from '@expo/react-native-action-sheet' ActivityIndicator,
Platform,
ProgressBarAndroid,
ScrollView,
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
import {connectActionSheet} from '@expo/react-native-action-sheet'
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { useActionSheet } from '@expo/react-native-action-sheet'
const route = require('./../../route.json');
let slugify = require('slugify');
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
import * as Utils from '../../utils/DeviceUtils'; import * as Utils from '../../utils/DeviceUtils';
import { Images } from '../../config/Images'; import {Color} from '../../config/Color';
import { Color } from '../../config/Color'; import {IlinkEmitter} from "../../utils/events";
import { baseUrl } from '../../webservice/IlinkConstants'; import {Appbar, Provider} from 'react-native-paper';
import { IlinkEmitter } from "../../utils/events"; import {readUser} from '../../webservice/AuthApi';
import { Provider, Appbar } from 'react-native-paper'; import {
import { readUser } from '../../webservice/AuthApi'; getNanoCreditAccountAction,
import { getNanoCreditAccountReset, getNanoCreditAccountAction, getNanoCreditUserHistoryAction, getNanoCreditUserHistoryReset } from '../../webservice/user/NanoCreditApi'; getNanoCreditAccountReset,
getNanoCreditUserHistoryAction,
getNanoCreditUserHistoryReset
} from '../../webservice/user/NanoCreditApi';
import _ from 'lodash'; import _ from 'lodash';
import Icons from 'react-native-vector-icons/Ionicons' import Icons from 'react-native-vector-icons/Ionicons'
import { FontWeight, Typography } from '../../config/typography'; import {Typography} from '../../config/typography';
import LottieView from 'lottie-react-native'; import LottieView from 'lottie-react-native';
import { isIlinkWorldWallet, optionDepotScreen, optionPaiementFactureSubScreen, displayTransactionType, displayToast, cutStringWithoutDot, cutString, transactionHistoryIlinkLabel } from '../../utils/UtilsFunction'; import {
cutStringWithoutDot,
displayToast,
displayTransactionType,
transactionHistoryIlinkLabel
} from '../../utils/UtilsFunction';
import chunk from 'lodash/chunk'; import chunk from 'lodash/chunk';
import thousands from 'thousands'; import thousands from 'thousands';
import Tag from '../../components/Tag'; import Tag from '../../components/Tag';
import Dialog from "react-native-dialog"; import Dialog from "react-native-dialog";
import { transactionHistoryNanoCreditLabel } from '../../utils/UtilsFunction'; import {connect} from 'react-redux';
import { connect } from 'react-redux'; import {bindActionCreators} from 'redux';
import { bindActionCreators } from 'redux'; import {responsiveWidth} from 'react-native-responsive-dimensions';
import { responsiveWidth } from 'react-native-responsive-dimensions';
const route = require('./../../route.json');
let slugify = require('slugify');
class WalletOptionSelect extends Component { class WalletOptionSelect extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = { this.state = {
options: this.props.navigation.state.params.optionSelect.options, options: this.props.navigation.state.params.optionSelect.options,
title: this.props.navigation.state.params.optionSelect.title, title: this.props.navigation.state.params.optionSelect.title,
@ -67,7 +83,7 @@ class WalletOptionSelect extends Component {
if (user.category === 'geolocated') if (user.category === 'geolocated')
this.props.getNanoCreditUserHistoryAction(this.state.wallet.id, false); this.props.getNanoCreditUserHistoryAction(this.state.wallet.id, false);
} }
this.setState({ user }); this.setState({user});
} }
} }
}); });
@ -92,16 +108,16 @@ class WalletOptionSelect extends Component {
}); });
} }
static navigationOptions = ({ navigation }) => ({ static navigationOptions = ({navigation}) => ({
header: null, header: null,
headerMode: 'none', headerMode: 'none',
headerTitle: null, headerTitle: null,
activeColor: '#f0edf6', activeColor: '#f0edf6',
inactiveColor: '#3e2465', inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' }, barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('CREDIT_MANAGE'), drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => ( drawerIcon: ({tintColor}) => (
<Icon <Icon
name={'credit-card'} name={'credit-card'}
size={24} size={24}
@ -109,12 +125,18 @@ class WalletOptionSelect extends Component {
}); });
renderResultGetNanoCreditAccount() { renderResultGetNanoCreditAccount() {
const { result } = this.props; const {result} = this.props;
console.log("BEFORE", this.props); console.log("BEFORE", this.props);
if (result !== null) { if (result !== null) {
if (result.response !== null) { if (result.response !== null) {
this.setState({ this.setState({
user: { ...this.state.user, balance_credit: result.response.balance_credit, balance_epargne: result.response.balance_epargne }, balance_credit: result.response.balance_credit,
balance_epargne: result.response.balance_epargne,
user: {
...this.state.user,
balance_credit: result.response.balance_credit,
balance_epargne: result.response.balance_epargne
},
isDataHasLoaded: true isDataHasLoaded: true
}); });
console.log("AFTER", this.props); console.log("AFTER", this.props);
@ -124,7 +146,7 @@ class WalletOptionSelect extends Component {
} }
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') }); this.props.navigation.setParams({name: I18n.t('WALLET')});
this.forceUpdate() this.forceUpdate()
} }
@ -215,7 +237,7 @@ class WalletOptionSelect extends Component {
<Icon name={options.icon} <Icon name={options.icon}
color={Color.primaryColor} color={Color.primaryColor}
size={30} size={30}
style={styles.imageBanner} /> style={styles.imageBanner}/>
<View style={[styles.content]}> <View style={[styles.content]}>
@ -229,7 +251,7 @@ class WalletOptionSelect extends Component {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={{ flex: 1 }} /> <View style={{flex: 1}}/>
</> : </> :
<> <>
@ -244,15 +266,13 @@ class WalletOptionSelect extends Component {
displayToast(I18n.t('ALREADY_IDENTIFIED')); displayToast(I18n.t('ALREADY_IDENTIFIED'));
else else
this.redirectToRoute(options); this.redirectToRoute(options);
} } else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
if (!this.state.isIdentified) if (!this.state.isIdentified)
displayToast(I18n.t('NOT_YET_IDENTIFY')); displayToast(I18n.t('NOT_YET_IDENTIFY'));
else else
this.redirectToRoute(options); this.redirectToRoute(options);
} }
} } else
else
this.redirectToRoute(options); this.redirectToRoute(options);
}} }}
@ -261,7 +281,7 @@ class WalletOptionSelect extends Component {
<Icon name={options.icon} <Icon name={options.icon}
color={Color.primaryColor} color={Color.primaryColor}
size={30} size={30}
style={styles.imageBanner} /> style={styles.imageBanner}/>
<View style={[styles.content]}> <View style={[styles.content]}>
@ -271,7 +291,7 @@ class WalletOptionSelect extends Component {
</Text> </Text>
</View> </View>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
</View> </View>
</View> </View>
@ -282,15 +302,15 @@ class WalletOptionSelect extends Component {
); );
updateLangue() { updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') }) this.props.navigation.setParams({name: I18n.t('WALLET')})
this.forceUpdate(); this.forceUpdate();
} }
renderAccountDetail = (options) => ( renderAccountDetail = (options) => (
<> <>
<View <View
style={[styles.blockView, { borderBottomColor: Color.borderColor }]}> style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}> <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View <View
style={{ style={{
@ -300,7 +320,7 @@ class WalletOptionSelect extends Component {
<View <View
style={[ style={[
styles.circlePoint, styles.circlePoint,
{ backgroundColor: Color.primaryColor }, {backgroundColor: Color.primaryColor},
]}> ]}>
<Icons name='md-wallet' <Icons name='md-wallet'
size={28} size={28}
@ -308,11 +328,12 @@ class WalletOptionSelect extends Component {
/> />
</View> </View>
<View> <View>
<Text style={[Typography.title3, Color.primaryColor], { marginBottom: 3 }}> <Text style={[Typography.title3, Color.primaryColor], {marginBottom: 3}}>
{I18n.t('CREDIT_ACCOUNT')} {I18n.t('CREDIT_ACCOUNT')}
</Text> </Text>
{this.state.user !== null ? {this.state.user !== null ?
<Text style={[Typography.body2]}>{`${thousands(this.state.user.balance_credit, ' ')} ${this.state.wallet.currency_code}`}</Text> <Text
style={[Typography.body2]}>{this.props.result != null ? `${thousands(this.props.result.response.balance_credit, ' ')} ${this.state.wallet.currency_code}` : `${thousands(this.state.user.balance_credit, ' ')} ${this.state.wallet.currency_code}`}</Text>
: null} : null}
</View> </View>
</View> </View>
@ -324,7 +345,7 @@ class WalletOptionSelect extends Component {
<View <View
style={[ style={[
styles.circlePoint, styles.circlePoint,
{ backgroundColor: Color.primaryColor }, {backgroundColor: Color.primaryColor},
]}> ]}>
<Icons name='md-key' <Icons name='md-key'
size={28} size={28}
@ -332,20 +353,28 @@ class WalletOptionSelect extends Component {
/> />
</View> </View>
<View> <View>
<Text style={[Typography.title3, Color.primaryColor], { marginBottom: 3 }}> <Text style={[Typography.title3, Color.primaryColor], {marginBottom: 3}}>
{I18n.t('SAVINGS_ACCOUNT')} {I18n.t('SAVINGS_ACCOUNT')}
</Text> </Text>
{this.state.user !== null ? {this.state.user !== null ?
<Text style={[Typography.body2]}>{`${thousands(this.state.user.balance_epargne, ' ')} ${this.state.wallet.currency_code}`}</Text> <Text
style={[Typography.body2]}>{this.props.result != null ? `${thousands(this.props.result.response.balance_epargne, ' ')} ${this.state.wallet.currency_code}` : `${thousands(this.state.user.balance_epargne, ' ')} ${this.state.wallet.currency_code}`}</Text>
: null} : null}
</View> </View>
</View> </View>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 30, marginBottom: 10, flex: 1, alignItems: 'center', justifyContent: 'center' }}> <View style={{
<Tag icon={<Icon name='update' size={20} color={Color.whiteColor} style={{ marginLeft: -15 }} />} flexDirection: 'row',
style={{ paddingRight: 10, width: 120, borderRightWidth: 1, borderRightColor: Color.whiteColor }} marginTop: 30,
marginBottom: 10,
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}}>
<Tag icon={<Icon name='update' size={20} color={Color.whiteColor} style={{marginLeft: -15}}/>}
style={{paddingRight: 10, width: 120, borderRightWidth: 1, borderRightColor: Color.whiteColor}}
primary primary
onPress={() => { onPress={() => {
this._scrollView.scrollToEnd(); this._scrollView.scrollToEnd();
@ -357,18 +386,17 @@ class WalletOptionSelect extends Component {
); );
renderHistoryTransactionList = () => { renderHistoryTransactionList = () => {
const { resultHistory, errorHistory } = this.props; const {resultHistory, errorHistory} = this.props;
if (errorHistory !== null) { if (errorHistory !== null) {
if (typeof errorHistory.data !== 'undefined') { if (typeof errorHistory.data !== 'undefined') {
return ( return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorHistory.data.error}</Text> <Text style={Typography.body1}>{errorHistory.data.error}</Text>
</View> </View>
) )
} } else {
else {
return ( return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorHistory}</Text> <Text style={Typography.body1}>{errorHistory}</Text>
</View> </View>
) )
@ -382,12 +410,12 @@ class WalletOptionSelect extends Component {
Array.isArray(resultHistory.response) && (resultHistory.response.length) > 0 ? Array.isArray(resultHistory.response) && (resultHistory.response.length) > 0 ?
( (
<> <>
<View style={[styles.contentService, { borderBottomColor: Color.primaryColor }]}> <View style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{ {
transactionHistoryIlinkLabel().map((item, index) => ( transactionHistoryIlinkLabel().map((item, index) => (
<View style={{ alignItems: 'center' }} key={index}> <View style={{alignItems: 'center'}} key={index}>
<Icon name={item.icon} size={24} color={Color.primaryColor} /> <Icon name={item.icon} size={24} color={Color.primaryColor}/>
<Text style={[Typography.overline, Color.grayColor], { marginTop: 4 }}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{I18n.t(item.label)} {I18n.t(item.label)}
</Text> </Text>
</View> </View>
@ -402,7 +430,7 @@ class WalletOptionSelect extends Component {
</> </>
) : ) :
( (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'flex-start' }}> <View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
<Text style={Typography.body1}>{I18n.t('NO_WALLET_HISTORY')}</Text> <Text style={Typography.body1}>{I18n.t('NO_WALLET_HISTORY')}</Text>
</View> </View>
) )
@ -414,14 +442,16 @@ class WalletOptionSelect extends Component {
renderHistoryTransactionItem = (item, index) => { renderHistoryTransactionItem = (item, index) => {
return ( return (
<TouchableOpacity onPress={() => { this.setState({ displayModalHistory: true, historyItemDetail: item }) }} style={[styles.contentService, { borderBottomColor: Color.primaryColor }]}> <TouchableOpacity onPress={() => {
this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{ {
!isNil(this.state.user.category) ? !isNil(this.state.user.category) ?
Object.keys(omit(item, ['id', 'retrait_cash', 'type_historique', 'type_caution', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => ( Object.keys(omit(item, ['id', 'retrait_cash', 'type_historique', 'type_caution', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => (
<View style={{ alignItems: 'center' }} key={i}> <View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], { marginTop: 4 }}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{ {
isEqual(element, 'montant') ? isEqual(element, 'montant') ?
` ${thousands(item[element], ' ')} ${this.state.wallet.currency_code}` ` ${thousands(item[element], ' ')} ${this.state.wallet.currency_code}`
@ -434,9 +464,9 @@ class WalletOptionSelect extends Component {
)) ))
: :
Object.keys(omit(item, ['id', 'type', 'id_epargne', 'type_historique', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'etat', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'type_caution', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => ( Object.keys(omit(item, ['id', 'type', 'id_epargne', 'type_historique', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'etat', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'type_caution', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => (
<View style={{ alignItems: 'center' }} key={i}> <View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], { marginTop: 4 }}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{ {
isEqual(element, 'montant') ? isEqual(element, 'montant') ?
` ${thousands(item[element], ' ')} ${this.state.wallet.currency_code}` ` ${thousands(item[element], ' ')} ${this.state.wallet.currency_code}`
@ -453,7 +483,7 @@ class WalletOptionSelect extends Component {
} }
renderModalHistoryDetail = () => { renderModalHistoryDetail = () => {
const { historyItemDetail } = this.state; const {historyItemDetail} = this.state;
return ( return (
@ -464,325 +494,364 @@ class WalletOptionSelect extends Component {
isNil(this.state.user.category) ? isNil(this.state.user.category) ?
isEqual(historyItemDetail.type_historique, 'N') ? isEqual(historyItemDetail.type_historique, 'N') ?
<ScrollView persistentScrollbar={true}> <ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}> <View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text> <Text style={[styles.body2]}>Type</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text> <Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('STATUS')}</Text> <Text style={[styles.body2]}>{I18n.t('STATUS')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text> <Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_REFUND')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_REFUND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_rembourse + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_rembourse + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_PARTIALLY_REFUND')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_PARTIALLY_REFUND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.partiellement_rembourse + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.partiellement_rembourse + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_IN_CASH')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_IN_CASH')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.retrait_cash + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.retrait_cash == 1 ? I18n.t('YES') : I18n.t('NO')}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text> <Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DEMAND_DATE')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('VALIDATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_demande}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_validation}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT_PREVU')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT_PREVU')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement_prevu}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement_prevu}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text>
</View> </View>
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
: :
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}> <View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text> <Text style={[styles.body2]}>Type</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text> <Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('STATUS')}</Text> <Text style={[styles.body2]}>{I18n.t('STATUS')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text> <Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text> <Text style={[styles.body2]}>Type</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.type}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.type}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text> <Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('FINAL_DATE')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('FINAL_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('CASSATION_DATE')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('CASSATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_cassation}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_cassation}</Text>
</View> </View>
</View> </View>
</View> </View>
: <ScrollView persistentScrollbar={true}> : <ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}> <View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text> <Text style={[styles.body2]}>Type</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text> <Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_demande}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('STATUS')}</Text> <Text style={[styles.body2]}>{I18n.t('STATUS')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text> <Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_REFUND')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_REFUND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_rembourse + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_rembourse + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_PARTIALLY_REFUND')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_PARTIALLY_REFUND')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.partiellement_rembourse + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.partiellement_rembourse + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_IN_CASH')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('WITHDRAWAL_IN_CASH')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.retrait_cash == 1 ? I18n.t('YES') : I18n.t('NO')}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.retrait_cash == 1 ? I18n.t('YES') : I18n.t('NO')}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text> <Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('VALIDATION_DATE')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('VALIDATION_DATE')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_validation}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_validation}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT_PREVU')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT_PREVU')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement_prevu}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement_prevu}</Text>
</View> </View>
</View> </View>
<View style={{ flexDirection: 'row', marginTop: 10 }}> <View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT')}</Text> <Text tyle={[Typography.body2]}>{I18n.t('DATE_REMBOURSEMENT')}</Text>
</View> </View>
<View style={{ flex: 1, alignItems: 'flex-end' }}> <View style={{flex: 1, alignItems: 'flex-end'}}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text> <Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text>
</View> </View>
</View> </View>
</View> </View>
@ -793,7 +862,7 @@ class WalletOptionSelect extends Component {
displayModalHistory: !this.state.displayModalHistory, displayModalHistory: !this.state.displayModalHistory,
}); });
}} /> }}/>
</Dialog.Container> </Dialog.Container>
@ -802,8 +871,8 @@ class WalletOptionSelect extends Component {
renderHistory = () => { renderHistory = () => {
return ( return (
<View style={{ backgroundColor: Color.containerBackgroundColor, flex: 1 }}> <View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
<View style={[styles.checkDefault, { borderBottomColor: Color.borderColor }]}> <View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text <Text
style={[Typography.title3, Typography.semibold]}> style={[Typography.title3, Typography.semibold]}>
{I18n.t('TRANSACTION_HISTORY')} {I18n.t('TRANSACTION_HISTORY')}
@ -813,18 +882,18 @@ class WalletOptionSelect extends Component {
{ {
this.props.loadingHistory ? this.props.loadingHistory ?
( (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
{Platform.OS === 'android' {Platform.OS === 'android'
? ?
( (
<> <>
<ProgressBarAndroid /> <ProgressBarAndroid/>
<Text>{I18n.t('LOADING_DOTS')}</Text> <Text>{I18n.t('LOADING_DOTS')}</Text>
</> </>
) : ) :
<> <>
<ActivityIndicator size="large" color={'#ccc'} /> <ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text> <Text>{I18n.t('LOADING_DOTS')}</Text>
</> </>
} }
@ -836,11 +905,12 @@ class WalletOptionSelect extends Component {
</View> </View>
); );
} }
render() { render() {
!this.state.isDataHasLoaded && this.renderResultGetNanoCreditAccount(); !this.state.isDataHasLoaded && this.renderResultGetNanoCreditAccount();
return ( return (
<Provider> <Provider>
<View style={{ flex: 1 }}> <View style={{flex: 1}}>
<StatusBar <StatusBar
backgroundColor={Color.primaryDarkColor} backgroundColor={Color.primaryDarkColor}
@ -848,9 +918,11 @@ class WalletOptionSelect extends Component {
translucent={false} translucent={false}
/> />
<Appbar.Header dark={true} style={{ backgroundColor: Color.primaryColor }}> <Appbar.Header dark={true} style={{backgroundColor: Color.primaryColor}}>
<Appbar.BackAction <Appbar.BackAction
onPress={() => { this.props.navigation.pop() }} onPress={() => {
this.props.navigation.pop()
}}
/> />
<Appbar.Content <Appbar.Content
title={I18n.t(this.state.title)} title={I18n.t(this.state.title)}
@ -858,7 +930,7 @@ class WalletOptionSelect extends Component {
/> />
</Appbar.Header> </Appbar.Header>
<ScrollView style={styles.container} ref={component => this._scrollView = component} > <ScrollView style={styles.container} ref={component => this._scrollView = component}>
{this.state.displayModalHistory && this.renderModalHistoryDetail()} {this.state.displayModalHistory && this.renderModalHistoryDetail()}
@ -882,7 +954,7 @@ class WalletOptionSelect extends Component {
</View> </View>
<View style={[styles.checkDefault, { borderBottomColor: Color.borderColor }]}> <View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text <Text
style={[Typography.title3, Typography.semibold]}> style={[Typography.title3, Typography.semibold]}>
{I18n.t('OPERATIONS')} {I18n.t('OPERATIONS')}
@ -909,7 +981,7 @@ class WalletOptionSelect extends Component {
{ {
isEqual(this.props.navigation.state.params.optionSelect.type, 'NANO_CREDIT') ? isEqual(this.props.navigation.state.params.optionSelect.type, 'NANO_CREDIT') ?
this.renderHistory() this.renderHistory()
: <View style={{ flex: 1 }} /> : <View style={{flex: 1}}/>
} }
</ScrollView> </ScrollView>
@ -984,7 +1056,7 @@ const styles = StyleSheet.create({
shadowColor: Color.borderColor, shadowColor: Color.borderColor,
borderColor: Color.borderColor, borderColor: Color.borderColor,
borderWidth: 0.5, borderWidth: 0.5,
shadowOffset: { width: 1.5, height: 1.5 }, shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0, shadowOpacity: 1.0,
elevation: 5, elevation: 5,
borderRadius: 10, borderRadius: 10,
@ -1026,7 +1098,7 @@ const styles = StyleSheet.create({
padding: 10, padding: 10,
marginBottom: 20, marginBottom: 20,
borderWidth: 0.5, borderWidth: 0.5,
shadowOffset: { width: 1.5, height: 1.5 }, shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0, shadowOpacity: 1.0,
elevation: 5, elevation: 5,
flexDirection: "row", flexDirection: "row",
@ -1054,6 +1126,6 @@ const styles = StyleSheet.create({
paddingRight: 10, paddingRight: 10,
alignItems: "center" alignItems: "center"
}, },
tagFollow: { width: 150, margin: 10 }, tagFollow: {width: 150, margin: 10},
}); });

View File

@ -285,7 +285,7 @@ class EnvoieWalletToBankAgent extends Component {
id_wallet_agent: this.state.wallet.id, id_wallet_agent: this.state.wallet.id,
id_wallet_network: this.state.wallet.id_network, id_wallet_network: this.state.wallet.id_network,
iban: codeIban, iban: codeIban,
id_bank: this.state.bank.id_bank, id_bank: this.state.bank.id_operator,
montant: montant, montant: montant,
password: password password: password

View File

@ -223,6 +223,26 @@ export const transactionHistoryIlinkLabel = () => {
}, },
] ]
} }
export const nanoCreditHistoryLabel = () => {
return [
{
icon: 'arrow-expand',
label: 'HISTORY_TYPE'
},
{
icon: 'inbox-arrow-up',
label: 'ETAT'
},
{
icon: 'cash',
label: 'AMOUNT_LABEL'
},
{
icon: 'calendar-clock',
label: 'DATE'
},
]
}
export const transactionHistoryNanoCreditLabel = () => { export const transactionHistoryNanoCreditLabel = () => {
return [ return [
/*{ /*{

View File

@ -155,6 +155,8 @@
"DEPOSIT_TO_CARD": "Your Wallet to card", "DEPOSIT_TO_CARD": "Your Wallet to card",
"DEPOSIT_TO_BANK": "Your Wallet to bank", "DEPOSIT_TO_BANK": "Your Wallet to bank",
"NANO_CREDIT": "Nano credit", "NANO_CREDIT": "Nano credit",
"NANO_CREDIT_LIST": "Nano credit list",
"NO_NANO_CREDIT": "No nano credit demand",
"NANO_CREDIT_DESCRIPTION": "Nano credit description", "NANO_CREDIT_DESCRIPTION": "Nano credit description",
"NANO_SANTE": "Nano health", "NANO_SANTE": "Nano health",
"NANO_SANTE_DESCRIPTION": "Nano health description", "NANO_SANTE_DESCRIPTION": "Nano health description",
@ -165,6 +167,7 @@
"SAVE_MONEY": "Save money", "SAVE_MONEY": "Save money",
"SAVE_MONEY_TYPE": "Savings type", "SAVE_MONEY_TYPE": "Savings type",
"CAUTION_CREDIT": "Caution credit demand", "CAUTION_CREDIT": "Caution credit demand",
"CAUTIONNEMENT_DONE": "Caution done",
"ID_DEMAND": "Demand ID", "ID_DEMAND": "Demand ID",
"DATE": "Date", "DATE": "Date",
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill", "PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",

View File

@ -162,6 +162,8 @@
"DEPOSIT_TO_CARD": "Votre Wallet vers carte", "DEPOSIT_TO_CARD": "Votre Wallet vers carte",
"DEPOSIT_TO_BANK": "Votre Wallet vers banque", "DEPOSIT_TO_BANK": "Votre Wallet vers banque",
"NANO_CREDIT": "Nano crédit", "NANO_CREDIT": "Nano crédit",
"NANO_CREDIT_LIST": "Liste des nano crédit",
"NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink", "NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
"NANO_SANTE": "Nano santé", "NANO_SANTE": "Nano santé",
"NANO_SANTE_DESCRIPTION": "Nano santé iLink", "NANO_SANTE_DESCRIPTION": "Nano santé iLink",
@ -172,6 +174,7 @@
"SAVE_MONEY_TYPE": "Type d'épargne", "SAVE_MONEY_TYPE": "Type d'épargne",
"REFUND_DONE": "Remboursement effectué", "REFUND_DONE": "Remboursement effectué",
"CAUTION_CREDIT": "Cautionner une demande de crédit", "CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande", "ID_DEMAND": "Identifiant de la demande",
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité", "PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
"PAIEMENT_ECOLE": "Paiement école", "PAIEMENT_ECOLE": "Paiement école",

View File

@ -69,7 +69,9 @@ export const getNanoCreditAccount = testBaseUrl + '/walletService/groups/nanoCre
export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands'; export const getNanoCreditUserHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/all_demands';
export const getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands'; export const getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands';
export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_hyper_history'; export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets/all_hyper_history';
export const getBankUrl = testBaseUrl + '/walletService/wallets/users/banks'; export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank';
export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress';
export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress';
export const authKeyUrl = testBaseUrl + '/oauth/token'; export const authKeyUrl = testBaseUrl + '/oauth/token';
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY"; export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";

View File

@ -1,9 +1,45 @@
import axios from "axios"; import axios from "axios";
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { fetchCreateGroupError, fetchCreateGroupPending, fetchCreateGroupReset, fetchCreateGroupSuccess, fetchTreatDemandsGroupPending, fetchTreatDemandsGroupSuccess, fetchTreatDemandsGroupError, fetchTreatDemandsGroupReset, fetchJoinGroupPending, fetchJoinGroupSuccess, fetchJoinGroupError, fetchJoinGroupReset, fetchAskNanoCreditPending, fetchAskNanoCreditSuccess, fetchAskNanoCreditError, fetchAskNanoCreditReset, fetchGetNanoCreditDemandDurationPending, fetchGetNanoCreditDemandDurationSuccess, fetchGetNanoCreditDemandDurationError, fetchGetNanoCreditDemandDurationReset } from "../redux/actions/NanoCreditAction"; import {
import { store } from "../redux/store"; fetchAskNanoCreditError,
import { groupUrl, getNanoCreditDemandDureationUrl, treatDemandUrl, joinGroupUrl, cancelDemandUrl, askNanoCreditUrl } from "./IlinkConstants"; fetchAskNanoCreditPending,
fetchAskNanoCreditReset,
fetchAskNanoCreditSuccess,
fetchCreateGroupError,
fetchCreateGroupPending,
fetchCreateGroupReset,
fetchCreateGroupSuccess,
fetchGetEpargneInProgressError,
fetchGetEpargneInProgressPending,
fetchGetEpargneInProgressReset,
fetchGetEpargneInProgressSuccess,
fetchGetNanoCreditDemandDurationError,
fetchGetNanoCreditDemandDurationPending,
fetchGetNanoCreditDemandDurationReset,
fetchGetNanoCreditDemandDurationSuccess,
fetchGetNanoCreditUserHistoryInProgressError,
fetchGetNanoCreditUserHistoryInProgressPending,
fetchGetNanoCreditUserHistoryInProgressReset,
fetchGetNanoCreditUserHistoryInProgressSuccess,
fetchJoinGroupError,
fetchJoinGroupPending,
fetchJoinGroupReset,
fetchJoinGroupSuccess,
fetchTreatDemandsGroupError,
fetchTreatDemandsGroupPending,
fetchTreatDemandsGroupReset,
fetchTreatDemandsGroupSuccess
} from "../redux/actions/NanoCreditAction";
import {store} from "../redux/store";
import {
askNanoCreditUrl,
cancelDemandUrl,
getHistoryNanoPendingCreditUrl,
getNanoCreditDemandDureationUrl,
groupUrl,
joinGroupUrl,
treatDemandUrl
} from "./IlinkConstants";
/** /**
* *
@ -235,3 +271,79 @@ export const getNanoCreditDemandDurationReset = () => {
dispatch(fetchGetNanoCreditDemandDurationReset()); dispatch(fetchGetNanoCreditDemandDurationReset());
} }
} }
export const getEpargneInProgressAction = (data) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchGetEpargneInProgressPending());
axios({
url: `${getHistoryNanoPendingCreditUrl}`,
method: 'POST',
data,
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchGetEpargneInProgressSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchGetEpargneInProgressError(error.response));
else if (error.request)
dispatch(fetchGetEpargneInProgressError(error.request))
else
dispatch(fetchGetEpargneInProgressError(error.message))
});
}
}
export const getEpargneInProgressReset = () => {
return dispatch => {
dispatch(fetchGetEpargneInProgressReset());
}
}
export const getNanoCreditUserHistoryInProgressAction = (data) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchGetNanoCreditUserHistoryInProgressPending());
axios({
url: `${getHistoryNanoPendingCreditUrl}/${data}`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchGetNanoCreditUserHistoryInProgressSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchGetNanoCreditUserHistoryInProgressError(error.response));
else if (error.request)
dispatch(fetchGetNanoCreditUserHistoryInProgressError(error.request))
else
dispatch(fetchGetNanoCreditUserHistoryInProgressError(error.message))
});
}
}
export const getNanoCreditUserHistoryInProgressReset = () => {
return dispatch => {
dispatch(fetchGetNanoCreditUserHistoryInProgressReset());
}
}