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_TYPE": "Savings type",
"CAUTION_CREDIT": "Caution credit demand",
"CAUTIONNEMENT_DONE": "Caution done",
"ID_DEMAND": "Demand ID",
"DATE": "Date",
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",

View File

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

View File

@ -1,55 +1,76 @@
import {
CREATE_GROUP_PENDING,
CREATE_GROUP_SUCCESS,
CREATE_GROUP_ERROR,
CREATE_GROUP_RESET,
GET_DEMAND_GROUP_PENDING,
GET_DEMAND_GROUP_SUCCESS,
GET_DEMAND_GROUP_ERROR,
GET_DEMAND_GROUP_RESET,
GET_UNIQUE_DEMAND_GROUP_PENDING,
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,
ASK_NANO_CREDIT_ERROR,
ASK_NANO_CREDIT_PENDING,
ASK_NANO_CREDIT_RESET,
ASK_NANO_CREDIT_SUCCESS,
CASSER_EPARGNE_USER_ERROR,
CASSER_EPARGNE_USER_PENDING,
CASSER_EPARGNE_USER_RESET,
CASSER_EPARGNE_USER_SUCCESS,
CAUTION_CREDIT_DEMAND_AGENT_ERROR,
CAUTION_CREDIT_DEMAND_AGENT_PENDING,
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,
EPARGNER_ARGENT_USER_PENDING,
EPARGNER_ARGENT_USER_SUCCESS,
CREATE_GROUP_ERROR,
CREATE_GROUP_PENDING,
CREATE_GROUP_RESET,
CREATE_GROUP_SUCCESS,
EPARGNER_ARGENT_USER_ERROR,
EPARGNER_ARGENT_USER_PENDING,
EPARGNER_ARGENT_USER_RESET,
CASSER_EPARGNE_USER_PENDING,
CASSER_EPARGNE_USER_SUCCESS,
CASSER_EPARGNE_USER_ERROR,
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
EPARGNER_ARGENT_USER_SUCCESS,
GET_DEMAND_GROUP_ERROR,
GET_DEMAND_GROUP_PENDING,
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";
export const fetchCreateGroupPending = () => ({
@ -225,7 +246,7 @@ export const fetchCautionCreditDemandUserPending = () => ({
});
export const fetchCautionCreditDemandUserSuccess = (res) => ({
type: REFUND_CREDIT_DEMAND_USER_RESET,
type: REFUND_CREDIT_DEMAND_USER_SUCCESS,
result: res,
});
@ -351,3 +372,41 @@ export const fetchGetNanoCreditUserHistoryError = (error) => ({
export const fetchGetNanoCreditUserHistoryReset = () => ({
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 = {
loading: false,
@ -8,23 +13,27 @@ const initialState = {
export default (state = initialState, action) => {
switch (action.type) {
case GET_DEMAND_GROUP_PENDING: return {
case GET_DEMAND_GROUP_PENDING:
return {
...state,
loading: true
}
case GET_DEMAND_GROUP_SUCCESS: return {
case GET_DEMAND_GROUP_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_DEMAND_GROUP_ERROR: return {
case GET_DEMAND_GROUP_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_DEMAND_GROUP_RESET: return initialState;
case GET_DEMAND_GROUP_RESET:
return initialState;
default: {
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 GetBankListReducer from "./GetBankListReducer";
import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer";
import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer";
import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer";
const persistConfig = {
key: 'root',
@ -96,7 +98,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
getNanoCreditHistoryUserReducer: GetNanoCreditHistoryUserReducer,
getHyperSuperHistoryReducer: GetHyperSuperHistoryReducer,
getBankListReducer: GetBankListReducer,
envoieUserWalletToBank: EnvoieUserWalletToBank
envoieUserWalletToBank: EnvoieUserWalletToBank,
getEpargneInProgressReducer: GetEpargneInProgressReducer,
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer
});
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_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_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_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_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_USER_SUCCESS';
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_PENDING_USER_PENDING = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_PENDING';
export const GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_SUCCESS';
export const GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR = 'GET_NANO_CREDIT_HISTORY_PENDING_USER_ERROR';
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}
/>
{/* Start here to comment */}
{/* {
{/*{
(this.state.loadingDialog || this.props.loading) ?
<View
style={{

View File

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

View File

@ -1,24 +1,26 @@
import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil';
import React, { Component } from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
import React, {Component} from 'react';
import {Alert, ScrollView, StyleSheet, Text, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import I18n from 'react-native-i18n';
import { Dropdown } from 'react-native-material-dropdown';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs';
import { Fumi } from 'react-native-textinput-effects';
import {Dropdown} from 'react-native-material-dropdown';
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import {ProgressDialog} from 'react-native-simple-dialogs';
import {Fumi} from 'react-native-textinput-effects';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Color } from '../../config/Color';
import { FontWeight, Typography } from '../../config/typography';
import { store } from "../../redux/store";
import { isNormalInteger, typeEpargne } from '../../utils/UtilsFunction';
import { readUser } from '../../webservice/AuthApi';
import { getNanoCreditDemandDurationAction, getNanoCreditDemandDurationReset } from '../../webservice/NanoCreditApi';
import { epargnerArgentUserAction, epargnerArgentUserReset } from "../../webservice/user/NanoCreditApi";
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {Color} from '../../config/Color';
import {FontWeight, Typography} from '../../config/typography';
import {store} from "../../redux/store";
import {isNormalInteger, typeEpargne} from '../../utils/UtilsFunction';
import {readUser} from '../../webservice/AuthApi';
import {getNanoCreditDemandDurationAction, getNanoCreditDemandDurationReset} from '../../webservice/NanoCreditApi';
import {epargnerArgentUserAction, epargnerArgentUserReset} from "../../webservice/user/NanoCreditApi";
import {IlinkEmitter} from "../../utils/events";
let theme = require('../../utils/theme.json');
let route = require('../../route.json');
@ -81,8 +83,9 @@ class EpargnerArgentUser extends Component {
console.log("USER", user);
if (user) {
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) => {
if (user) {
if (user !== undefined) {
this.setState({ user });
this.setState({user});
}
}
});
@ -105,7 +108,7 @@ class EpargnerArgentUser extends Component {
}
isMontantValid = () => {
const { montant } = this.state;
const {montant} = this.state;
if ((parseInt(isEqual(montant, 0)) || montant < 0))
return {
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
@ -133,7 +136,7 @@ class EpargnerArgentUser extends Component {
}
renderGetDurationesponse = () => {
const { resultGetNanoCreditDuration, errorGetNanoCreditDuration } = this.props;
const {resultGetNanoCreditDuration, errorGetNanoCreditDuration} = this.props;
if (resultGetNanoCreditDuration !== null) {
if (typeof resultGetNanoCreditDuration.response !== 'undefined') {
if (resultGetNanoCreditDuration.response.length > 0) {
@ -143,8 +146,7 @@ class EpargnerArgentUser extends Component {
durationSelect: resultGetNanoCreditDuration.response[0].value,
modalVisible: false
});
}
else if (resultGetNanoCreditDuration.response.length === 0) {
} else if (resultGetNanoCreditDuration.response.length === 0) {
this.setState({
hasLoadDuration: true,
durations: [],
@ -168,7 +170,7 @@ class EpargnerArgentUser extends Component {
}
],
{ cancelable: false }
{cancelable: false}
)
} else {
Alert.alert(
@ -182,7 +184,7 @@ class EpargnerArgentUser extends Component {
}
],
{ cancelable: false }
{cancelable: false}
)
}
}
@ -191,7 +193,7 @@ class EpargnerArgentUser extends Component {
renderEpargnerArgentResponse = () => {
const { result, error } = this.props;
const {result, error} = this.props;
if (error !== null) {
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: () => {
this.props.epargnerArgentUserReset();
//IlinkEmitter.emit("treatNanoGroupDemand");
IlinkEmitter.emit("updateNanoCreditAccount");
this.props.navigation.pop();
}
}
],
{ cancelable: false }
{cancelable: false}
)
}
}
}
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('SAVE_MONEY') })
this.props.navigation.setParams({name: I18n.t('SAVE_MONEY')})
this.forceUpdate()
}
onSubmitEpargnerArgent = () => {
const { montant, typeEpargneName, durationSelect } = this.state;
const {montant, typeEpargneName, durationSelect} = this.state;
if (this.ckeckIfFieldIsOK(typeEpargneName))
this.typeEpargneAnim.shake(800);
@ -283,7 +286,9 @@ class EpargnerArgentUser extends Component {
<Text style={styles.subbigtitle}>{I18n.t('FILL_INFORMATION')}</Text>
<Animatable.View ref={(comp) => { this.typeEpargneAnim = comp }}
<Animatable.View ref={(comp) => {
this.typeEpargneAnim = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
@ -314,14 +319,20 @@ class EpargnerArgentUser extends Component {
displayDuration: true
})
}}
valueExtractor={(value) => { return I18n.t(value.name) }}
labelExtractor={(value) => { return I18n.t(value.name) }}
valueExtractor={(value) => {
return I18n.t(value.name)
}}
labelExtractor={(value) => {
return I18n.t(value.name)
}}
/>
</Animatable.View>
{
this.state.displayDuration &&
<Animatable.View ref={(comp) => { this.durationAnim = comp }}
<Animatable.View ref={(comp) => {
this.durationAnim = comp
}}
style={{
width: responsiveWidth(90),
height: 60,
@ -338,15 +349,21 @@ class EpargnerArgentUser extends Component {
useNativeDriver={true}
value={this.state.durationSelect !== null ? this.state.durationSelect : ''}
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 ref={(comp) => { this.montantAnim = comp }}>
<Animatable.View ref={(comp) => {
this.montantAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
label={I18n.t('AMOUNT')}
iconColor={'#f95a25'}
@ -354,7 +371,7 @@ class EpargnerArgentUser extends Component {
iconSize={20}
value={this.state.montant}
onChangeText={(montant) => {
this.setState({ montant })
this.setState({montant})
}}
style={styles.input}
>
@ -380,7 +397,9 @@ class EpargnerArgentUser extends Component {
</View>
</Animatable.View>
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
<Animatable.View ref={(comp) => {
this.passwordAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
label={I18n.t('PASSWORD')}
iconColor={'#f95a25'}
@ -388,7 +407,7 @@ class EpargnerArgentUser extends Component {
secureTextEntry={true}
value={this.state.password}
onChangeText={(password) => {
this.setState({ password })
this.setState({password})
}}
style={styles.input}
>
@ -397,7 +416,9 @@ class EpargnerArgentUser extends Component {
<Button style={styles.btnvalide}
textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitEpargnerArgent(); }}>
onPress={() => {
this.onSubmitEpargnerArgent();
}}>
{I18n.t('SUBMIT_LABEL')}</Button>
</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 isNil from 'lodash/isNil';
import React, { Component } from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
import * as Animatable from 'react-native-animatable';
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 { Fumi } from 'react-native-textinput-effects';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Color } from '../../config/Color';
import { FontWeight, Typography } from '../../config/typography';
import { store } from "../../redux/store";
import { IlinkEmitter } from '../../utils/events';
import { readUser } from '../../webservice/AuthApi';
import { createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi';
import { isNormalInteger } from '../../utils/UtilsFunction';
import { refundCreditDemandUserAction, refundCreditDemandUserReset } from '../../webservice/user/NanoCreditApi';
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, 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 route = require('../../route.json');
@ -39,7 +53,14 @@ class RefundNanoCreditUser extends Component {
isDataSubmit: false,
isModalConfirmVisible: 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) => {
if (user) {
if (user !== undefined) {
this.setState({ user });
this.setState({user});
this.props.getNanoCreditUserHistoryInProgressAction(user.id);
}
}
});
@ -86,7 +108,7 @@ class RefundNanoCreditUser extends Component {
renderRefundNanoCreditResponse = () => {
const { result, error } = this.props;
const {result, error} = this.props;
if (error !== null) {
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: () => {
this.props.refundCreditDemandUserReset();
IlinkEmitter.emit("refreshWallet");
IlinkEmitter.emit("updateNanoCreditAccount");
this.props.navigation.pop();
}
}
],
{ cancelable: false }
{cancelable: false}
)
}
}
}
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') })
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
this.forceUpdate()
}
@ -136,7 +159,7 @@ class RefundNanoCreditUser extends Component {
}
onSubmitRefundNanoCredit = () => {
const { idDemand, password } = this.state;
const {idDemand, password} = this.state;
if (this.ckeckIfFieldIsOK(idDemand))
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() {
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}>
<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'}
label={I18n.t('ID_DEMAND')}
iconColor={'#f95a25'}
@ -183,7 +535,7 @@ class RefundNanoCreditUser extends Component {
value={this.state.idDemand}
onChangeText={(idDemand) => {
this.setState({ idDemand })
this.setState({idDemand})
}}
style={styles.input}
>
@ -191,7 +543,9 @@ class RefundNanoCreditUser extends Component {
</Animatable.View>
<Animatable.View ref={(comp) => { this.passwordAnim = comp }}>
<Animatable.View ref={(comp) => {
this.passwordAnim = comp
}}>
<Fumi iconClass={FontAwesomeIcon} iconName={'lock'}
label={I18n.t('PASSWORD')}
iconColor={'#f95a25'}
@ -199,7 +553,7 @@ class RefundNanoCreditUser extends Component {
secureTextEntry={true}
value={this.state.password}
onChangeText={(password) => {
this.setState({ password })
this.setState({password})
}}
style={styles.input}
>
@ -208,8 +562,10 @@ class RefundNanoCreditUser extends Component {
<Button style={styles.btnvalide}
textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitRefundNanoCredit(); }}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
onPress={() => {
this.onSubmitRefundNanoCredit();
}}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
</ScrollView>
</>
)
@ -221,12 +577,18 @@ 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);
@ -235,7 +597,8 @@ export default connect(maptStateToProps, mapDispatchToProps)(RefundNanoCreditUse
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Color.primaryDarkColor,
backgroundColor: Color.containerBackgroundColor,
paddingHorizontal: 20
},
textbtnvalide: {
color: 'white',
@ -282,5 +645,98 @@ const styles = StyleSheet.create({
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

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

View File

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

View File

@ -1,41 +1,57 @@
import React, { Component } from 'react';
import { StyleSheet, ScrollView, View, Image, StatusBar, Alert, FlatList, TouchableOpacity, ActivityIndicator, Platform, ProgressBarAndroid, Text } from 'react-native';
import { ActionSheetProvider, connectActionSheet } from '@expo/react-native-action-sheet'
import React, {Component} from 'react';
import {
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 { useActionSheet } from '@expo/react-native-action-sheet'
const route = require('./../../route.json');
let slugify = require('slugify');
import I18n from 'react-native-i18n';
import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil';
import omit from 'lodash/omit';
import * as Utils from '../../utils/DeviceUtils';
import { Images } from '../../config/Images';
import { Color } from '../../config/Color';
import { baseUrl } from '../../webservice/IlinkConstants';
import { IlinkEmitter } from "../../utils/events";
import { Provider, Appbar } from 'react-native-paper';
import { readUser } from '../../webservice/AuthApi';
import { getNanoCreditAccountReset, getNanoCreditAccountAction, getNanoCreditUserHistoryAction, getNanoCreditUserHistoryReset } from '../../webservice/user/NanoCreditApi';
import {Color} from '../../config/Color';
import {IlinkEmitter} from "../../utils/events";
import {Appbar, Provider} from 'react-native-paper';
import {readUser} from '../../webservice/AuthApi';
import {
getNanoCreditAccountAction,
getNanoCreditAccountReset,
getNanoCreditUserHistoryAction,
getNanoCreditUserHistoryReset
} from '../../webservice/user/NanoCreditApi';
import _ from 'lodash';
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 { 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 thousands from 'thousands';
import Tag from '../../components/Tag';
import Dialog from "react-native-dialog";
import { transactionHistoryNanoCreditLabel } from '../../utils/UtilsFunction';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { responsiveWidth } from 'react-native-responsive-dimensions';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {responsiveWidth} from 'react-native-responsive-dimensions';
const route = require('./../../route.json');
let slugify = require('slugify');
class WalletOptionSelect extends Component {
constructor(props) {
super(props);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = {
options: this.props.navigation.state.params.optionSelect.options,
title: this.props.navigation.state.params.optionSelect.title,
@ -67,7 +83,7 @@ class WalletOptionSelect extends Component {
if (user.category === 'geolocated')
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,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
drawerIcon: ({tintColor}) => (
<Icon
name={'credit-card'}
size={24}
@ -109,12 +125,18 @@ class WalletOptionSelect extends Component {
});
renderResultGetNanoCreditAccount() {
const { result } = this.props;
const {result} = this.props;
console.log("BEFORE", this.props);
if (result !== null) {
if (result.response !== null) {
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
});
console.log("AFTER", this.props);
@ -124,7 +146,7 @@ class WalletOptionSelect extends Component {
}
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') });
this.props.navigation.setParams({name: I18n.t('WALLET')});
this.forceUpdate()
}
@ -215,7 +237,7 @@ class WalletOptionSelect extends Component {
<Icon name={options.icon}
color={Color.primaryColor}
size={30}
style={styles.imageBanner} />
style={styles.imageBanner}/>
<View style={[styles.content]}>
@ -229,7 +251,7 @@ class WalletOptionSelect extends Component {
</TouchableOpacity>
</View>
<View style={{ flex: 1 }} />
<View style={{flex: 1}}/>
</> :
<>
@ -244,15 +266,13 @@ class WalletOptionSelect extends Component {
displayToast(I18n.t('ALREADY_IDENTIFIED'));
else
this.redirectToRoute(options);
}
else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
} else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
if (!this.state.isIdentified)
displayToast(I18n.t('NOT_YET_IDENTIFY'));
else
this.redirectToRoute(options);
}
}
else
} else
this.redirectToRoute(options);
}}
@ -261,7 +281,7 @@ class WalletOptionSelect extends Component {
<Icon name={options.icon}
color={Color.primaryColor}
size={30}
style={styles.imageBanner} />
style={styles.imageBanner}/>
<View style={[styles.content]}>
@ -271,7 +291,7 @@ class WalletOptionSelect extends Component {
</Text>
</View>
<View style={{ flex: 1 }}>
<View style={{flex: 1}}>
</View>
</View>
@ -282,15 +302,15 @@ class WalletOptionSelect extends Component {
);
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') })
this.props.navigation.setParams({name: I18n.t('WALLET')})
this.forceUpdate();
}
renderAccountDetail = (options) => (
<>
<View
style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
<View
style={{
@ -300,7 +320,7 @@ class WalletOptionSelect extends Component {
<View
style={[
styles.circlePoint,
{ backgroundColor: Color.primaryColor },
{backgroundColor: Color.primaryColor},
]}>
<Icons name='md-wallet'
size={28}
@ -308,11 +328,12 @@ class WalletOptionSelect extends Component {
/>
</View>
<View>
<Text style={[Typography.title3, Color.primaryColor], { marginBottom: 3 }}>
<Text style={[Typography.title3, Color.primaryColor], {marginBottom: 3}}>
{I18n.t('CREDIT_ACCOUNT')}
</Text>
{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}
</View>
</View>
@ -324,7 +345,7 @@ class WalletOptionSelect extends Component {
<View
style={[
styles.circlePoint,
{ backgroundColor: Color.primaryColor },
{backgroundColor: Color.primaryColor},
]}>
<Icons name='md-key'
size={28}
@ -332,20 +353,28 @@ class WalletOptionSelect extends Component {
/>
</View>
<View>
<Text style={[Typography.title3, Color.primaryColor], { marginBottom: 3 }}>
<Text style={[Typography.title3, Color.primaryColor], {marginBottom: 3}}>
{I18n.t('SAVINGS_ACCOUNT')}
</Text>
{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}
</View>
</View>
</View>
</View>
<View style={{ flexDirection: 'row', 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 }}
<View style={{
flexDirection: 'row',
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
onPress={() => {
this._scrollView.scrollToEnd();
@ -357,18 +386,17 @@ class WalletOptionSelect extends Component {
);
renderHistoryTransactionList = () => {
const { resultHistory, errorHistory } = this.props;
const {resultHistory, errorHistory} = this.props;
if (errorHistory !== null) {
if (typeof errorHistory.data !== 'undefined') {
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>
</View>
)
}
else {
} else {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorHistory}</Text>
</View>
)
@ -382,12 +410,12 @@ class WalletOptionSelect extends Component {
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) => (
<View style={{ alignItems: 'center' }} key={index}>
<Icon name={item.icon} size={24} color={Color.primaryColor} />
<Text style={[Typography.overline, Color.grayColor], { marginTop: 4 }}>
<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>
@ -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>
</View>
)
@ -414,14 +442,16 @@ class WalletOptionSelect extends Component {
renderHistoryTransactionItem = (item, index) => {
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) ?
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') ?
` ${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) => (
<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') ?
` ${thousands(item[element], ' ')} ${this.state.wallet.currency_code}`
@ -453,7 +483,7 @@ class WalletOptionSelect extends Component {
}
renderModalHistoryDetail = () => {
const { historyItemDetail } = this.state;
const {historyItemDetail} = this.state;
return (
@ -464,325 +494,364 @@ class WalletOptionSelect extends Component {
isNil(this.state.user.category) ?
isEqual(historyItemDetail.type_historique, 'N') ?
<ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
<View style={{ flex: 1 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 + ' ' + this.state.wallet.currency_code}</Text>
<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 }}>
<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 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('DEMAND_DATE')}</Text>
<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_demande}</Text>
<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 }}>
<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 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 }}>
<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 style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text>
</View>
</View>
</View>
</ScrollView>
:
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
<View style={{ flex: 1 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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]}>{this.state.historyItemDetail.type}</Text>
<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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text>
</View>
</View>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
<View style={{ flex: 1 }}>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('CASSATION_DATE')}</Text>
</View>
<View style={{ flex: 1, alignItems: 'flex-end' }}>
<Text style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_cassation}</Text>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_cassation}</Text>
</View>
</View>
</View>
: <ScrollView persistentScrollbar={true}>
<View style={[styles.blockView, { borderBottomColor: Color.borderColor }]}>
<View style={{ flexDirection: 'row', marginTop: 10 }}>
<View style={{ flex: 1 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 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 }}>
<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 style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_remboursement}</Text>
</View>
</View>
</View>
@ -793,7 +862,7 @@ class WalletOptionSelect extends Component {
displayModalHistory: !this.state.displayModalHistory,
});
}} />
}}/>
</Dialog.Container>
@ -802,8 +871,8 @@ class WalletOptionSelect extends Component {
renderHistory = () => {
return (
<View style={{ backgroundColor: Color.containerBackgroundColor, flex: 1 }}>
<View style={[styles.checkDefault, { borderBottomColor: Color.borderColor }]}>
<View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
<View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text
style={[Typography.title3, Typography.semibold]}>
{I18n.t('TRANSACTION_HISTORY')}
@ -813,18 +882,18 @@ class WalletOptionSelect extends Component {
{
this.props.loadingHistory ?
(
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid />
<ProgressBarAndroid/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'} />
<ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
@ -836,11 +905,12 @@ class WalletOptionSelect extends Component {
</View>
);
}
render() {
!this.state.isDataHasLoaded && this.renderResultGetNanoCreditAccount();
return (
<Provider>
<View style={{ flex: 1 }}>
<View style={{flex: 1}}>
<StatusBar
backgroundColor={Color.primaryDarkColor}
@ -848,9 +918,11 @@ class WalletOptionSelect extends Component {
translucent={false}
/>
<Appbar.Header dark={true} style={{ backgroundColor: Color.primaryColor }}>
<Appbar.Header dark={true} style={{backgroundColor: Color.primaryColor}}>
<Appbar.BackAction
onPress={() => { this.props.navigation.pop() }}
onPress={() => {
this.props.navigation.pop()
}}
/>
<Appbar.Content
title={I18n.t(this.state.title)}
@ -858,7 +930,7 @@ class WalletOptionSelect extends Component {
/>
</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()}
@ -882,7 +954,7 @@ class WalletOptionSelect extends Component {
</View>
<View style={[styles.checkDefault, { borderBottomColor: Color.borderColor }]}>
<View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text
style={[Typography.title3, Typography.semibold]}>
{I18n.t('OPERATIONS')}
@ -909,7 +981,7 @@ class WalletOptionSelect extends Component {
{
isEqual(this.props.navigation.state.params.optionSelect.type, 'NANO_CREDIT') ?
this.renderHistory()
: <View style={{ flex: 1 }} />
: <View style={{flex: 1}}/>
}
</ScrollView>
@ -984,7 +1056,7 @@ const styles = StyleSheet.create({
shadowColor: Color.borderColor,
borderColor: Color.borderColor,
borderWidth: 0.5,
shadowOffset: { width: 1.5, height: 1.5 },
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
borderRadius: 10,
@ -1026,7 +1098,7 @@ const styles = StyleSheet.create({
padding: 10,
marginBottom: 20,
borderWidth: 0.5,
shadowOffset: { width: 1.5, height: 1.5 },
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
flexDirection: "row",
@ -1054,6 +1126,6 @@ const styles = StyleSheet.create({
paddingRight: 10,
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_network: this.state.wallet.id_network,
iban: codeIban,
id_bank: this.state.bank.id_bank,
id_bank: this.state.bank.id_operator,
montant: montant,
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 = () => {
return [
/*{

View File

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

View File

@ -162,6 +162,8 @@
"DEPOSIT_TO_CARD": "Votre Wallet vers carte",
"DEPOSIT_TO_BANK": "Votre Wallet vers banque",
"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_SANTE": "Nano santé",
"NANO_SANTE_DESCRIPTION": "Nano santé iLink",
@ -172,6 +174,7 @@
"SAVE_MONEY_TYPE": "Type d'épargne",
"REFUND_DONE": "Remboursement effectué",
"CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande",
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
"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 getNanoCreditAgentHistoryUrl = testBaseUrl + '/walletService/groups/nanoCredit/guarantee_demands';
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 videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";

View File

@ -1,9 +1,45 @@
import axios from "axios";
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 { store } from "../redux/store";
import { groupUrl, getNanoCreditDemandDureationUrl, treatDemandUrl, joinGroupUrl, cancelDemandUrl, askNanoCreditUrl } from "./IlinkConstants";
import {
fetchAskNanoCreditError,
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());
}
}
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());
}
}