diff --git a/App.js b/App.js
index 2186b95b..f751978b 100644
--- a/App.js
+++ b/App.js
@@ -9,7 +9,7 @@
import React, { Component } from 'react';
import { ActionSheetProvider, connectActionSheet } from '@expo/react-native-action-sheet'
import { Platform, StyleSheet, Text, View, YellowBox, AsyncStorage } from 'react-native';
-import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator, HeaderBackButton } from 'react-navigation';
+import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator, HeaderBackButton, withNavigation } from 'react-navigation';
import OneSignal from 'react-native-onesignal';
import _ from 'lodash';
import Connect from "./screens/login/Connect";
@@ -352,6 +352,8 @@ class App extends React.Component {
constructor(properties) {
super(properties);
+ console.log("APP PROPS", this.props);
+
//Remove this method to stop OneSignal Debugging
OneSignal.setLogLevel(6, 0);
@@ -441,11 +443,12 @@ class App extends React.Component {
goToScreen = (routeName, params, isReset = true) => {
const { navigator } = this.refs;
- navigator.dispatch({
- type: "Navigation/NAVIGATE",
- routeName,
- params
- });
+ console.log("APP REFS", this.refs);
+ // navigator.dispatch({
+ // type: "Navigation/NAVIGATE",
+ // routeName,
+ // params
+ // });
// if (isReset) {
// const resetAction = NavigationActions.reset({
diff --git a/screens/nano-credit/CreateGroupNanoCredit.js b/screens/nano-credit/CreateGroupNanoCredit.js
index 00d23cf6..7ded084a 100644
--- a/screens/nano-credit/CreateGroupNanoCredit.js
+++ b/screens/nano-credit/CreateGroupNanoCredit.js
@@ -139,7 +139,7 @@ class CreateGroupNanoCredit extends Component {
{
text: I18n.t("OK"), onPress: () => {
this.props.createGroupReset();
- IlinkEmitter.emit("refreshWallet");
+ IlinkEmitter.emit("treatNanoGroupDemand");
this.props.navigation.pop();
}
}
diff --git a/screens/nano-credit/DemandGroupNanoCredit.js b/screens/nano-credit/DemandGroupNanoCredit.js
index 81b75b4f..c3ba1722 100644
--- a/screens/nano-credit/DemandGroupNanoCredit.js
+++ b/screens/nano-credit/DemandGroupNanoCredit.js
@@ -125,19 +125,13 @@ class DemandValidationGroup extends React.Component {
this.navigation = this.props.navigation
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
//moment.locale(this.currentLocale);
-
+ IlinkEmitter.on('treatNanoGroupDemand', this.refreshData);
};
componentDidMount() {
const { routeName } = this.navigation.state
this.setState({ position: routeName === "demandeValidationGroupe" ? 0 : 1, isDataSubmit: true });
- this.refreshData();
this.animateSlidingUp(false)
- this.props.navigation.addListener("didFocus", () => {
- this.refreshData(false)
- console.warn("loading")
-
- })
}
@@ -302,8 +296,8 @@ class DemandValidationGroup extends React.Component {
)
}
- refreshData(autoref = true) {
-
+ refreshData() {
+ this.props.getNanoCreditDemandsAction(this.state.user.id);
}
render() {
diff --git a/screens/nano-credit/DemandGroupNanoCreditDetail.js b/screens/nano-credit/DemandGroupNanoCreditDetail.js
index 23abf24a..c6c2e15b 100644
--- a/screens/nano-credit/DemandGroupNanoCreditDetail.js
+++ b/screens/nano-credit/DemandGroupNanoCreditDetail.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
-import { StyleSheet, View, Text, Alert, Platform, ProgressBarAndroid } from 'react-native'
+import { StyleSheet, View, Text, Alert, Platform, ScrollView, ProgressBarAndroid } from 'react-native'
import CardView from 'react-native-cardview'
import Button from 'apsl-react-native-button'
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'
@@ -142,62 +142,18 @@ class DemandGroupNanoCreditDetail extends Component {
if (errorTreatDemand !== null) {
if (typeof errorTreatDemand.data !== 'undefined') {
- if (errorTreatDemand.status === 426) {
- Alert.alert(
- I18n.t("ERROR_TREATMENT_DEMAND"),
- errorTreatDemand.data.error,
- [{
- text: I18n.t('CANCEL_LABEL'),
- onPress: () => { },
- style: 'cancel'
- },
- {
- text: I18n.t("OK"), onPress: () => {
- setTimeout(() => {
- this.setState({
- displayAmountModifyDialog: true
- });
- }, 10);
- this.props.creditDemandResetReducer();
- this.props.creditCancelResetReducer();
- }
- }],
- { cancelable: false }
- );
- }
- else {
- Alert.alert(
- I18n.t("ERROR_TREATMENT_DEMAND"),
- errorTreatDemand.data.error,
- [
- {
- text: I18n.t("OK"), onPress: () => {
- this.props.creditDemandResetReducer();
- this.props.creditCancelResetReducer();
- }
- }
- ],
- { cancelable: false }
- );
- }
- }
- }
-
- if (errorCancelDemand !== null) {
- if (typeof errorCancelDemand.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
- errorCancelDemand.data.error,
+ errorTreatDemand.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
- this.props.creditCancelResetReducer();
- this.props.creditDemandResetReducer();
+ this.props.treatDemandGroupReset();
}
}
],
{ cancelable: false }
- )
+ );
}
}
@@ -206,22 +162,8 @@ class DemandGroupNanoCreditDetail extends Component {
if (resultTreatDemand.status === 200) {
this.displayToast(resultTreatDemand.response);
this.props.navigation.goBack();
- this.props.navigation.state.params.onGoBack();
- this.props.creditCancelResetReducer();
- this.props.creditDemandResetReducer();
- }
- }
-
- if (resultCancelDemand !== null) {
- console.log("resultCancelDemand", resultCancelDemand);
- if (resultCancelDemand.status === 200) {
-
- this.displayToast(resultCancelDemand.response);
- this.props.navigation.goBack();
- this.props.navigation.state.params.onGoBack();
- this.props.creditCancelResetReducer();
- this.props.creditDemandResetReducer();
-
+ IlinkEmitter.emit('treatNanoGroupDemand');
+ this.props.treatDemandGroupReset();
}
}
@@ -230,7 +172,7 @@ class DemandGroupNanoCreditDetail extends Component {
renderLabelState = (state) => {
if (state === 0)
return I18n.t('NO_TREAT')
- else if (statut === 1)
+ else if (state === 1)
return I18n.t('TREAT')
else
return I18n.t('REFUSED')
@@ -359,8 +301,9 @@ class DemandGroupNanoCreditDetail extends Component {
renderDetail = () => {
- const resultGetUniqueDemand = this.props.resultGetUniqueDemand;
- console.log("resultGetUniqueDemand", resultGetUniqueDemand);
+ const {resultGetUniqueDemand} = this.props;
+ let ago = moment.tz(resultGetUniqueDemand.response.date_creation, 'Etc/GMT+0').format();
+ ago = moment(ago)
return (
- {I18n.t('DEMAND_INFO')}
+ {resultGetUniqueDemand.response.nom}
- {`${I18n.t('CREATOR')} ${resultGetUniqueDemand.response.createur}`}
+ {`${I18n.t('CREATOR')}: ${resultGetUniqueDemand.response.createur}`}
- {`${I18n.t('COUNTRY')} ${resultGetUniqueDemand.response.country}`}
+ {`${I18n.t('COUNTRY')}: ${resultGetUniqueDemand.response.country}`}
- {/*
-
+
+
+ {`SPONSOR 1: ${resultGetUniqueDemand.response.sponsor1}`}
+
+
+
+ {`SPONSOR 2: ${resultGetUniqueDemand.response.sponsor2}`}
+
+
+
+ {`SPONSOR 3: ${resultGetUniqueDemand.response.sponsor3}`}
+
+
+
+
+ {/*
{this.item.code_parrain}
-
+ */}
-
- {this.item.reseau}
+ {resultGetUniqueDemand.response.code_groupe}
-
- {this.item.montant}
+ {`${I18n.t('LIMITE_GROUP')}: ${resultGetUniqueDemand.response.limite_credit} ${resultGetUniqueDemand.response.currency_code}`}
-
- {ago.format(" Do MMMM YYYY à HH:mm")}
+ {`${I18n.t('CREATION_DATE')}: ${ago.format(" Do MMMM YYYY à HH:mm")}`}
-
@@ -476,22 +464,24 @@ class DemandGroupNanoCreditDetail extends Component {
}}>{ago.fromNow()}
- */}
+
+
{this.renderBtn()}
);
}
render() {
console.log("DEMAND GROUP PROPS", this.props);
- //let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format();
- //ago = moment(ago)
+
return (
<>
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()}
{
this.props.loadingGetUniqueDemand ?
this.renderLoader() :
- this.renderDetail()
+ this.props.resultGetUniqueDemand != null ?
+ this.renderDetail() :
+ null
}
>
);
diff --git a/utils/i18n/en.json b/utils/i18n/en.json
index 0a9a8578..19a3d4dd 100644
--- a/utils/i18n/en.json
+++ b/utils/i18n/en.json
@@ -331,6 +331,10 @@
"SEND": "Send",
"CHANGE_INFORMATION": "Change my information",
"VALIDATE": "Validate",
+ "NO_VALIDATE": "Invalid",
+ "VALIDATION": "validation",
+ "VALIDATIONS": "validations",
+ "LIMITE_GROUP": "Credit limit",
"CONNECT": "Connection",
"TEXT_BIG_CREATE_1": "Register as a User",
"TEXT_SUBTITLE_CREATE_1": "Fill in your personal information",
diff --git a/utils/i18n/fr.json b/utils/i18n/fr.json
index 11c51876..513322ec 100644
--- a/utils/i18n/fr.json
+++ b/utils/i18n/fr.json
@@ -337,6 +337,7 @@
"NO_VALIDATE": "Non validé",
"VALIDATION": "validation",
"VALIDATIONS": "validations",
+ "LIMITE_GROUP": "Limite crédit",
"SELECT_YOUR_WALLET": "Selectionner un wallet",
"CONNECT": "Connexion",
"TEXT_BIG_CREATE_1": "Inscrivez vous en tant qu'Utilisateur",