group manage
This commit is contained in:
parent
8199e6c181
commit
9b55962767
136
App.js
136
App.js
|
@ -7,8 +7,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
|
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 } from 'react-navigation';
|
||||||
|
import OneSignal from 'react-native-onesignal';
|
||||||
|
import _ from 'lodash';
|
||||||
import Connect from "./screens/login/Connect";
|
import Connect from "./screens/login/Connect";
|
||||||
import SplashScreen from "./screens/splashscreen/SplashScreen";
|
import SplashScreen from "./screens/splashscreen/SplashScreen";
|
||||||
import HelpMenu from "./screens/help/HelpMenu";
|
import HelpMenu from "./screens/help/HelpMenu";
|
||||||
|
@ -44,7 +47,7 @@ import WalletDetail from './screens/wallet/WalletDetail';
|
||||||
import WalletSelect from './screens/wallet/WalletSelect';
|
import WalletSelect from './screens/wallet/WalletSelect';
|
||||||
import { PersistGate } from 'redux-persist/integration/react';
|
import { PersistGate } from 'redux-persist/integration/react';
|
||||||
import { store, persistor } from './redux/store';
|
import { store, persistor } from './redux/store';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider, connect } from 'react-redux';
|
||||||
import WalletDepot from './screens/wallet/WalletDepot';
|
import WalletDepot from './screens/wallet/WalletDepot';
|
||||||
import WalletRetrait from './screens/wallet/WalletRetrait';
|
import WalletRetrait from './screens/wallet/WalletRetrait';
|
||||||
import CreateIdentification from './screens/identification/createIdentification';
|
import CreateIdentification from './screens/identification/createIdentification';
|
||||||
|
@ -68,6 +71,10 @@ import EnvoieCashVersWalletAgent from './screens/wallet/agent/EnvoieCashVersWall
|
||||||
import EnvoieCashVersAutreWalletAgent from './screens/wallet/agent/EnvoieCashVersAutreWalletAgent';
|
import EnvoieCashVersAutreWalletAgent from './screens/wallet/agent/EnvoieCashVersAutreWalletAgent';
|
||||||
import EnvoieCashVersCarteAgent from './screens/wallet/agent/EnvoieCashVersCarteAgent';
|
import EnvoieCashVersCarteAgent from './screens/wallet/agent/EnvoieCashVersCarteAgent';
|
||||||
import EnvoiCashVersCashAgent from './screens/wallet/agent/EnvoiCashVersCashAgent';
|
import EnvoiCashVersCashAgent from './screens/wallet/agent/EnvoiCashVersCashAgent';
|
||||||
|
import ModifyIdentificationUser from './screens/identification/ModifyIdentificationUser';
|
||||||
|
import CreateGroupNanoCredit from './screens/nano-credit/CreateGroupNanoCredit';
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit';
|
||||||
|
|
||||||
const instructions = Platform.select({
|
const instructions = Platform.select({
|
||||||
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
|
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
|
||||||
|
@ -103,6 +110,7 @@ const AppStack = createDrawerNavigator({
|
||||||
},
|
},
|
||||||
walletSelect: WalletSelect,
|
walletSelect: WalletSelect,
|
||||||
createIdentificationUser: CreateIdentificationUser,
|
createIdentificationUser: CreateIdentificationUser,
|
||||||
|
modifyIdentificationUser: ModifyIdentificationUser,
|
||||||
notificationview: Notifications,
|
notificationview: Notifications,
|
||||||
configuration: Configurations,
|
configuration: Configurations,
|
||||||
about: About,
|
about: About,
|
||||||
|
@ -118,7 +126,39 @@ const AppStack = createDrawerNavigator({
|
||||||
retraitWalletVersCashUser: RetraitWalletVersCashUser,
|
retraitWalletVersCashUser: RetraitWalletVersCashUser,
|
||||||
retraitCarteVersCashUser: RetraitCarteVersCashUser,
|
retraitCarteVersCashUser: RetraitCarteVersCashUser,
|
||||||
retraitCarteVersWalletUser: RetraitCarteVersWalletUser,
|
retraitCarteVersWalletUser: RetraitCarteVersWalletUser,
|
||||||
linkCard: LinkCard
|
linkCard: LinkCard,
|
||||||
|
createGroupNanoCredit: CreateGroupNanoCredit,
|
||||||
|
groupNanoCredit: {
|
||||||
|
screen: createBottomTabNavigator({
|
||||||
|
demandeValidationGroupe: DemandValidationGroup,
|
||||||
|
OthersDemand: MyHistory
|
||||||
|
}, {
|
||||||
|
headerMode: "none",
|
||||||
|
header: null,
|
||||||
|
headerTitle: null,
|
||||||
|
title: I18n.t('MANAGE_GROUP'),
|
||||||
|
tabBarOptions: {
|
||||||
|
labelStyle: {
|
||||||
|
fontSize: 13,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
navigationOptions: ({ navigation }) => ({
|
||||||
|
header: null,
|
||||||
|
headerMode: 'none',
|
||||||
|
headerTitle: null,
|
||||||
|
activeColor: '#f0edf6',
|
||||||
|
inactiveColor: '#3e2465',
|
||||||
|
barStyle: { backgroundColor: '#694fad' },
|
||||||
|
|
||||||
|
drawerLabel: I18n.t('MANAGE_GROUP'),
|
||||||
|
drawerIcon: ({ tintColor }) => (
|
||||||
|
<Icon
|
||||||
|
name={'account-multiple'}
|
||||||
|
size={24}
|
||||||
|
/>)
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
|
||||||
})
|
})
|
||||||
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
|
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
|
||||||
|
@ -180,14 +220,15 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
envoieCashVersAutreWalletAgent: EnvoieCashVersAutreWalletAgent,
|
envoieCashVersAutreWalletAgent: EnvoieCashVersAutreWalletAgent,
|
||||||
envoieCashVersCarteAgent: EnvoieCashVersCarteAgent,
|
envoieCashVersCarteAgent: EnvoieCashVersCarteAgent,
|
||||||
envoiCashVersCashAgent: EnvoiCashVersCashAgent,
|
envoiCashVersCashAgent: EnvoiCashVersCashAgent,
|
||||||
|
createGroupNanoCredit: CreateGroupNanoCredit
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
contentComponent: OptionsMenu,
|
contentComponent: OptionsMenu,
|
||||||
backBehavior: "none",
|
backBehavior: "none",
|
||||||
lazy: false,
|
lazy: false,
|
||||||
headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
|
headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
|
||||||
})
|
});
|
||||||
|
|
||||||
const AppAdministratorStack = createDrawerNavigator({
|
const AppAdministratorStack = createDrawerNavigator({
|
||||||
sta: createStackNavigator({
|
sta: createStackNavigator({
|
||||||
home: Home,
|
home: Home,
|
||||||
|
@ -240,7 +281,8 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
contentComponent: OptionsMenu,
|
contentComponent: OptionsMenu,
|
||||||
backBehavior: "none",
|
backBehavior: "none",
|
||||||
headerMode: 'none'
|
headerMode: 'none'
|
||||||
})
|
});
|
||||||
|
|
||||||
const AppSuperAdministrator = createDrawerNavigator({
|
const AppSuperAdministrator = createDrawerNavigator({
|
||||||
sta: createStackNavigator({
|
sta: createStackNavigator({
|
||||||
home: Home,
|
home: Home,
|
||||||
|
@ -286,7 +328,8 @@ const AppSuperAdministrator = createDrawerNavigator({
|
||||||
contentComponent: OptionsMenu,
|
contentComponent: OptionsMenu,
|
||||||
backBehavior: "none",
|
backBehavior: "none",
|
||||||
headerMode: 'none'
|
headerMode: 'none'
|
||||||
})
|
});
|
||||||
|
|
||||||
export const AppNavigator = createSwitchNavigator({
|
export const AppNavigator = createSwitchNavigator({
|
||||||
first: {
|
first: {
|
||||||
screen: SplashScreen
|
screen: SplashScreen
|
||||||
|
@ -304,17 +347,94 @@ const AppContainer = createAppContainer(AppNavigator);
|
||||||
class App extends React.Component {
|
class App extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(properties) {
|
||||||
|
super(properties);
|
||||||
|
//Remove this method to stop OneSignal Debugging
|
||||||
|
OneSignal.setLogLevel(6, 0);
|
||||||
|
|
||||||
|
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
|
||||||
|
OneSignal.init("e8e7251f-713d-4658-9510-86d877fa6a7c", { kOSSettingsKeyAutoPrompt: false, kOSSettingsKeyInAppLaunchURL: false, kOSSettingsKeyInFocusDisplayOption: 2 });
|
||||||
|
OneSignal.inFocusDisplaying(2); // Controls what should happen if a notification is received while the app is open. 2 means that the notification will go directly to the device's notification center.
|
||||||
|
|
||||||
|
// The promptForPushNotifications function code will show the iOS push notification prompt. We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step below)
|
||||||
|
OneSignal.promptForPushNotificationsWithUserResponse(myiOSPromptCallback);
|
||||||
|
|
||||||
|
OneSignal.addEventListener('received', this.onReceived);
|
||||||
|
OneSignal.addEventListener('opened', this.onOpened);
|
||||||
|
OneSignal.addEventListener('ids', this.onIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getOneSignalIds = () => {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const getElement = await AsyncStorage.getItem('@config:onesignalIds');
|
||||||
|
resolve(getElement);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_saveOneSignalIds = async (ids) => {
|
||||||
|
try {
|
||||||
|
await AsyncStorage.setItem('@config:onesignalIds', ids);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
OneSignal.removeEventListener('received', this.onReceived);
|
||||||
|
OneSignal.removeEventListener('opened', this.onOpened);
|
||||||
|
OneSignal.removeEventListener('ids', this.onIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
onReceived(notification) {
|
||||||
|
console.log("Notification received: ", notification);
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpened(openResult) {
|
||||||
|
console.log('Message: ', openResult.notification.payload.body);
|
||||||
|
console.log('Data: ', openResult.notification.payload.additionalData);
|
||||||
|
console.log('isActive: ', openResult.notification.isAppInFocus);
|
||||||
|
console.log('openResult: ', openResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
onIds = async (device) => {
|
||||||
|
console.log('Device info: ', device);
|
||||||
|
|
||||||
|
AsyncStorage.getAllKeys((err, keys) => {
|
||||||
|
AsyncStorage.multiGet(keys, (err, stores) => {
|
||||||
|
stores.map(async (result, i, store) => {
|
||||||
|
|
||||||
|
let key = store[i][0];
|
||||||
|
if (!_.isEqual(key, '@config:onesignalIds')) {
|
||||||
|
if (i === stores.length - 1) {
|
||||||
|
this._saveOneSignalIds(device.userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<PersistGate persistor={persistor}>
|
<PersistGate persistor={persistor}>
|
||||||
<AppContainer />
|
<ActionSheetProvider>
|
||||||
|
<AppContainer />
|
||||||
|
</ActionSheetProvider>
|
||||||
</PersistGate>
|
</PersistGate>
|
||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function myiOSPromptCallback(permission) {
|
||||||
|
// do something with permission value
|
||||||
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
|
|
@ -182,6 +182,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation project(':react-native-onesignal')
|
||||||
implementation project(':react-native-maps')
|
implementation project(':react-native-maps')
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
|
|
||||||
import com.facebook.react.PackageList;
|
import com.facebook.react.PackageList;
|
||||||
import com.facebook.react.ReactApplication;
|
import com.facebook.react.ReactApplication;
|
||||||
|
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
|
||||||
import com.facebook.react.ReactNativeHost;
|
import com.facebook.react.ReactNativeHost;
|
||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
import com.facebook.soloader.SoLoader;
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -51,5 +51,7 @@
|
||||||
"envoieCashVersWalletAgent": "envoieCashVersWalletAgent",
|
"envoieCashVersWalletAgent": "envoieCashVersWalletAgent",
|
||||||
"envoieCashVersAutreWalletAgent": "envoieCashVersAutreWalletAgent",
|
"envoieCashVersAutreWalletAgent": "envoieCashVersAutreWalletAgent",
|
||||||
"envoieCashVersCarteAgent": "envoieCashVersCarteAgent",
|
"envoieCashVersCarteAgent": "envoieCashVersCarteAgent",
|
||||||
"envoiCashVersCashAgent": "envoiCashVersCashAgent"
|
"envoiCashVersCashAgent": "envoiCashVersCashAgent",
|
||||||
|
"modifyIdentificationUser": "modifyIdentificationUser",
|
||||||
|
"createGroupNanoCredit": "createGroupNanoCredit"
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
"WITHDRAWAL": "Withdrawal",
|
"WITHDRAWAL": "Withdrawal",
|
||||||
"LINK_CARD": "Link my card",
|
"LINK_CARD": "Link my card",
|
||||||
"WITHDRAWAL_IN_CASH": "Withdrawal in cash",
|
"WITHDRAWAL_IN_CASH": "Withdrawal in cash",
|
||||||
|
"WITHDRAWAL_IN_CASH_DESCRIPTION": "Withdrawal money in cash",
|
||||||
"WITHDRAWAL_WALLET_TO_CASH": "Withdrawal wallet to cash",
|
"WITHDRAWAL_WALLET_TO_CASH": "Withdrawal wallet to cash",
|
||||||
"WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Withdrawal money from wallet to cash",
|
"WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Withdrawal money from wallet to cash",
|
||||||
"WITHDRAWAL_CARD_TO_WALLET": "Withdrawal card to wallet",
|
"WITHDRAWAL_CARD_TO_WALLET": "Withdrawal card to wallet",
|
||||||
|
@ -100,6 +101,20 @@
|
||||||
"TRANSACTION_DETAIL": "Transaction detail",
|
"TRANSACTION_DETAIL": "Transaction detail",
|
||||||
"CODE_IBAN": "IBAN Code",
|
"CODE_IBAN": "IBAN Code",
|
||||||
"FEES_AND_TAXES": "Fees and taxes",
|
"FEES_AND_TAXES": "Fees and taxes",
|
||||||
|
"SUCCESS_CREATION_GROUP": "Creation information",
|
||||||
|
"ERROR_CREATION_GROUP": "Creation error",
|
||||||
|
"CREATE_GROUP": "Create group",
|
||||||
|
"MANAGE_GROUP": "Manage group",
|
||||||
|
"GROUP_INFOS": "Fill in the group information",
|
||||||
|
"NOM_GROUP": "Group name",
|
||||||
|
"LIMIT_OF_CREDIT": "Credit limit",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_1": "iLink user code sponsor 1",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_2": "iLink user code sponsor 2",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_3": "iLink user code sponsor 3",
|
||||||
|
"JOIN_GROUP": "Join group",
|
||||||
|
"OPEN_ACCOUNT": "Open account",
|
||||||
|
"MANAGE_CREDIT": "Manage credit",
|
||||||
|
"MANAGE_SAVINGS": "Manage savings",
|
||||||
"INIT_COUNTRY": "Departure countryt",
|
"INIT_COUNTRY": "Departure countryt",
|
||||||
"FINAL_COUNTRY": "Arrival country",
|
"FINAL_COUNTRY": "Arrival country",
|
||||||
"INIT_AMOUNT": "Init amount",
|
"INIT_AMOUNT": "Init amount",
|
||||||
|
@ -137,6 +152,7 @@
|
||||||
"SELECT_YOUR_WALLET": "Select your wallet",
|
"SELECT_YOUR_WALLET": "Select your wallet",
|
||||||
"TRANSACTION_ID": "Transaction number",
|
"TRANSACTION_ID": "Transaction number",
|
||||||
"OPERATION": "Operation",
|
"OPERATION": "Operation",
|
||||||
|
"OPERATIONS": "Operations",
|
||||||
"TRANSACTIONS": "Transactions",
|
"TRANSACTIONS": "Transactions",
|
||||||
"TRANSACTION_HISTORY": "Transactions history",
|
"TRANSACTION_HISTORY": "Transactions history",
|
||||||
"HISTORY": "History",
|
"HISTORY": "History",
|
||||||
|
@ -261,6 +277,7 @@
|
||||||
"NETWORK_LOST": "Connection lost!",
|
"NETWORK_LOST": "Connection lost!",
|
||||||
"SHOW": "Show",
|
"SHOW": "Show",
|
||||||
"CALL": "Call",
|
"CALL": "Call",
|
||||||
|
"MODIFY": "Modify",
|
||||||
"FORGOTTEN_PASSWORD": "Forgot your password?",
|
"FORGOTTEN_PASSWORD": "Forgot your password?",
|
||||||
"CONNECT_USER": "Connect",
|
"CONNECT_USER": "Connect",
|
||||||
"PASSWORD": "Password",
|
"PASSWORD": "Password",
|
||||||
|
@ -353,9 +370,12 @@
|
||||||
"PREVISUALISATION": "Preview",
|
"PREVISUALISATION": "Preview",
|
||||||
"ACCOUNT_INFO": "My Account Information",
|
"ACCOUNT_INFO": "My Account Information",
|
||||||
"ALREADY_IDENTIFIED": "You are already identified",
|
"ALREADY_IDENTIFIED": "You are already identified",
|
||||||
|
"CREATE_MY_IDENTIFICATION": "Create my identification",
|
||||||
"NOT_IDENTIFIED": "This number exists, its identification is not yet entered",
|
"NOT_IDENTIFIED": "This number exists, its identification is not yet entered",
|
||||||
"NOT_VALIDATED": "Your identicaiton is not yet validated",
|
"NOT_VALIDATED": "Your identicaiton is not yet validated",
|
||||||
"ALREADY_VALIDATED": "The identification of this client has already been validated",
|
"ALREADY_VALIDATED": "The identification of this client has already been validated",
|
||||||
|
"MODIFY_IDENTIFICATION": "Modify my identification",
|
||||||
|
"NOT_YET_IDENTIFY": "You are not yet identified",
|
||||||
"IDENTIFICATION": " Identification",
|
"IDENTIFICATION": " Identification",
|
||||||
"CREATION_IDENTIFICATION": "Creation",
|
"CREATION_IDENTIFICATION": "Creation",
|
||||||
"CREATION_IDENTIFICATION_CLIENT": "Identify me",
|
"CREATION_IDENTIFICATION_CLIENT": "Identify me",
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
"WITHDRAWAL": "Retrait",
|
"WITHDRAWAL": "Retrait",
|
||||||
"LINK_CARD": "Lier ma carte",
|
"LINK_CARD": "Lier ma carte",
|
||||||
"WITHDRAWAL_IN_CASH": "Retrait en cash",
|
"WITHDRAWAL_IN_CASH": "Retrait en cash",
|
||||||
|
"WITHDRAWAL_IN_CASH_DESCRIPTION": "Retrait d'argent en cash",
|
||||||
"WITHDRAWAL_WALLET_TO_CASH": "Retrait de votre wallet vers cash",
|
"WITHDRAWAL_WALLET_TO_CASH": "Retrait de votre wallet vers cash",
|
||||||
"WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Retirer de l'argent de votre Wallet vers cash",
|
"WITHDRAWAL_WALLET_TO_CASH_DESCRIPTION": "Retirer de l'argent de votre Wallet vers cash",
|
||||||
"WITHDRAWAL_CARD_TO_WALLET": "Retrait de votre carte vers wallet",
|
"WITHDRAWAL_CARD_TO_WALLET": "Retrait de votre carte vers wallet",
|
||||||
|
@ -104,6 +105,20 @@
|
||||||
"ENVOIE_CASH_TO_CASH": "Envoie d'argent en cash vers cash",
|
"ENVOIE_CASH_TO_CASH": "Envoie d'argent en cash vers cash",
|
||||||
"TRANSACTION_DETAIL": "Détail de la transaction",
|
"TRANSACTION_DETAIL": "Détail de la transaction",
|
||||||
"FEES_AND_TAXES": "Frais et taxes",
|
"FEES_AND_TAXES": "Frais et taxes",
|
||||||
|
"CREATE_GROUP": "Créer un groupe",
|
||||||
|
"MANAGE_GROUP": "Gérer le groupe",
|
||||||
|
"GROUP_INFOS": "Renseigner les informations du groupe",
|
||||||
|
"SUCCESS_CREATION_GROUP": "Informations sur la création",
|
||||||
|
"ERROR_CREATION_GROUP": "Erreur de création",
|
||||||
|
"NOM_GROUP": "Nom du groupe",
|
||||||
|
"LIMIT_OF_CREDIT": "Limite du crédit",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_3": "Code utilisateur iLink Sponsor 3",
|
||||||
|
"JOIN_GROUP": "Adhérer à un groupe",
|
||||||
|
"OPEN_ACCOUNT": "Ouvrir un compte",
|
||||||
|
"MANAGE_CREDIT": "Gérer son crédit",
|
||||||
|
"MANAGE_SAVINGS": "Gérer son épargne",
|
||||||
"CODE_IBAN": "Code IBAN",
|
"CODE_IBAN": "Code IBAN",
|
||||||
"INIT_COUNTRY": "Pays de départ",
|
"INIT_COUNTRY": "Pays de départ",
|
||||||
"FINAL_COUNTRY": "Pays d'arrivée",
|
"FINAL_COUNTRY": "Pays d'arrivée",
|
||||||
|
@ -135,6 +150,7 @@
|
||||||
"COMMISSION_TRANSFER_ERROR_EMPTY": "Le solde commission est vide",
|
"COMMISSION_TRANSFER_ERROR_EMPTY": "Le solde commission est vide",
|
||||||
"TRANSACTION_ID": "Numéro de transaction",
|
"TRANSACTION_ID": "Numéro de transaction",
|
||||||
"OPERATION": "Opération",
|
"OPERATION": "Opération",
|
||||||
|
"OPERATIONS": "Opérations",
|
||||||
"TRANSACTIONS": "Transactions",
|
"TRANSACTIONS": "Transactions",
|
||||||
"TRANSACTION_HISTORY": "Historique des transactions",
|
"TRANSACTION_HISTORY": "Historique des transactions",
|
||||||
"HISTORY": "Historique",
|
"HISTORY": "Historique",
|
||||||
|
@ -267,6 +283,7 @@
|
||||||
"NETWORK_LOST": "Connexion perdue !",
|
"NETWORK_LOST": "Connexion perdue !",
|
||||||
"SHOW": "Afficher",
|
"SHOW": "Afficher",
|
||||||
"CALL": "Appeler",
|
"CALL": "Appeler",
|
||||||
|
"MODIFY": "Modifier",
|
||||||
"FORGOTTEN_PASSWORD": "Mots de passe oublié ?",
|
"FORGOTTEN_PASSWORD": "Mots de passe oublié ?",
|
||||||
"CONNECT_USER": "Se connecter",
|
"CONNECT_USER": "Se connecter",
|
||||||
"PASSWORD": "Mot de passe",
|
"PASSWORD": "Mot de passe",
|
||||||
|
@ -357,9 +374,12 @@
|
||||||
"PREVISUALISATION": "Prévisualisation",
|
"PREVISUALISATION": "Prévisualisation",
|
||||||
"ACCOUNT_INFO": " Information sur mon compte",
|
"ACCOUNT_INFO": " Information sur mon compte",
|
||||||
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
|
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
|
||||||
|
"CREATE_MY_IDENTIFICATION": "Créer mon identification",
|
||||||
"NOT_IDENTIFIED": "Ce numéro existe, son identification n'est pas encore saisi",
|
"NOT_IDENTIFIED": "Ce numéro existe, son identification n'est pas encore saisi",
|
||||||
"NOT_VALIDATED": "Votre identicaiton n'est pas encore validé",
|
"NOT_VALIDATED": "Votre identicaiton n'est pas encore validé",
|
||||||
"ALREADY_VALIDATED": "L'identification de ce client a déjà été validée",
|
"ALREADY_VALIDATED": "L'identification de ce client a déjà été validée",
|
||||||
|
"MODIFY_IDENTIFICATION": "Modifier mon identification",
|
||||||
|
"NOT_YET_IDENTIFY": "Vous n'êtes pas encore identifié",
|
||||||
"IDENTIFICATION": " Identification",
|
"IDENTIFICATION": " Identification",
|
||||||
"CREATION_IDENTIFICATION": "Création",
|
"CREATION_IDENTIFICATION": "Création",
|
||||||
"CREATION_IDENTIFICATION_CLIENT": "M'identifier",
|
"CREATION_IDENTIFICATION_CLIENT": "M'identifier",
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
rootProject.name = 'iLink'
|
rootProject.name = 'iLink'
|
||||||
|
include ':react-native-onesignal'
|
||||||
|
project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')
|
||||||
include ':react-native-maps'
|
include ':react-native-maps'
|
||||||
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
|
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
|
||||||
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
|
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,8 @@ target 'iLink' do
|
||||||
|
|
||||||
pod 'react-native-maps', :path => '../node_modules/react-native-maps'
|
pod 'react-native-maps', :path => '../node_modules/react-native-maps'
|
||||||
|
|
||||||
|
pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'
|
||||||
|
|
||||||
target 'iLinkTests' do
|
target 'iLinkTests' do
|
||||||
inherit! :search_paths
|
inherit! :search_paths
|
||||||
# Pods for testing
|
# Pods for testing
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release"
|
"run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@expo/react-native-action-sheet": "^3.8.0",
|
||||||
"@react-native-community/async-storage": "^1.9.0",
|
"@react-native-community/async-storage": "^1.9.0",
|
||||||
"@react-native-community/datetimepicker": "^2.4.0",
|
"@react-native-community/datetimepicker": "^2.4.0",
|
||||||
"@react-native-community/viewpager": "^3.3.0",
|
"@react-native-community/viewpager": "^3.3.0",
|
||||||
|
@ -56,6 +57,7 @@
|
||||||
"react-native-material-cards": "^1.0.9",
|
"react-native-material-cards": "^1.0.9",
|
||||||
"react-native-material-dialog": "^0.7.6",
|
"react-native-material-dialog": "^0.7.6",
|
||||||
"react-native-material-dropdown": "^0.11.1",
|
"react-native-material-dropdown": "^0.11.1",
|
||||||
|
"react-native-onesignal": "^3.9.0",
|
||||||
"react-native-paper": "^2.16.0",
|
"react-native-paper": "^2.16.0",
|
||||||
"react-native-phone-call": "^1.0.9",
|
"react-native-phone-call": "^1.0.9",
|
||||||
"react-native-popup-dialog": "^0.18.3",
|
"react-native-popup-dialog": "^0.18.3",
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { CREATE_GROUP_PENDING, CREATE_GROUP_SUCCESS, CREATE_GROUP_ERROR, CREATE_GROUP_RESET } from "../types/NanoCreditType";
|
||||||
|
|
||||||
|
export const fetchCreateGroupPending = () => ({
|
||||||
|
type: CREATE_GROUP_PENDING
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchCreateGroupSuccess = (res) => ({
|
||||||
|
type: CREATE_GROUP_SUCCESS,
|
||||||
|
result: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchCreateGroupError = (error) => ({
|
||||||
|
type: CREATE_GROUP_ERROR,
|
||||||
|
result: error
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchCreateGroupReset = () => ({
|
||||||
|
type: CREATE_GROUP_RESET
|
||||||
|
});
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { SAVE_ONESIGNAL_IDS_PENDING, SAVE_ONESIGNAL_IDS_SUCCESS, SAVE_ONESIGNAL_IDS_ERROR, SAVE_ONESIGNAL_IDS_RESET } from "../types/NotificationType";
|
||||||
|
|
||||||
|
|
||||||
|
export const fetchSaveOnesignalPlayerIdsPending = () => ({
|
||||||
|
type: SAVE_ONESIGNAL_IDS_PENDING
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchSaveOnesignalPlayerIdsSuccess = (res) => ({
|
||||||
|
type: SAVE_ONESIGNAL_IDS_SUCCESS,
|
||||||
|
result: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchSaveOnesignalPlayerIdsError = (error) => ({
|
||||||
|
type: SAVE_ONESIGNAL_IDS_ERROR,
|
||||||
|
result: error
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchSaveOnesignalPlayerIdsReset = () => ({
|
||||||
|
type: SAVE_ONESIGNAL_IDS_RESET
|
||||||
|
});
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { CREATE_GROUP_PENDING, CREATE_GROUP_SUCCESS, CREATE_GROUP_ERROR, CREATE_GROUP_RESET } from "../types/NanoCreditType";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case CREATE_GROUP_PENDING: return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case CREATE_GROUP_SUCCESS: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: action.result.data,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case CREATE_GROUP_ERROR: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case CREATE_GROUP_RESET: return initialState;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { SAVE_ONESIGNAL_IDS_PENDING, SAVE_ONESIGNAL_IDS_SUCCESS, SAVE_ONESIGNAL_IDS_ERROR, SAVE_ONESIGNAL_IDS_RESET } from "../types/NotificationType";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case SAVE_ONESIGNAL_IDS_PENDING: return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case SAVE_ONESIGNAL_IDS_SUCCESS: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: action.result.data,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case SAVE_ONESIGNAL_IDS_ERROR: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case SAVE_ONESIGNAL_IDS_RESET: return initialState;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -24,6 +24,8 @@ import EnvoieUserWalletToCardReducer from "./EnvoieUserWalletToCardReducer";
|
||||||
import EnvoieUserWalletToCardGetCommissionReducer from "./EnvoieUserWalletToCardGetCommissionReducer";
|
import EnvoieUserWalletToCardGetCommissionReducer from "./EnvoieUserWalletToCardGetCommissionReducer";
|
||||||
import LinkCardReducer from "./LinkCardReducer";
|
import LinkCardReducer from "./LinkCardReducer";
|
||||||
import RetraitCashAgentIdVerificationReducer from "./RetraitCashAgentIdVerificationReducer";
|
import RetraitCashAgentIdVerificationReducer from "./RetraitCashAgentIdVerificationReducer";
|
||||||
|
import CreateGroupReducer from "./CreateGroupReducer";
|
||||||
|
import SaveOnesignalReducer from "./SaveOnesignalReducer";
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
key: 'root',
|
key: 'root',
|
||||||
|
@ -57,7 +59,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
|
||||||
envoieUserWalletToCardReducer: EnvoieUserWalletToCardReducer,
|
envoieUserWalletToCardReducer: EnvoieUserWalletToCardReducer,
|
||||||
envoieUserWalletToCardGetCommissionReducer: EnvoieUserWalletToCardGetCommissionReducer,
|
envoieUserWalletToCardGetCommissionReducer: EnvoieUserWalletToCardGetCommissionReducer,
|
||||||
linkCardReduder: LinkCardReducer,
|
linkCardReduder: LinkCardReducer,
|
||||||
retraitCashAgentIdVerificationReducer: RetraitCashAgentIdVerificationReducer
|
retraitCashAgentIdVerificationReducer: RetraitCashAgentIdVerificationReducer,
|
||||||
|
createGroupReducer: CreateGroupReducer,
|
||||||
|
saveOnesignalReducer: SaveOnesignalReducer
|
||||||
});
|
});
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
|
@ -0,0 +1,4 @@
|
||||||
|
export const CREATE_GROUP_PENDING = 'CREATE_GROUP_PENDING';
|
||||||
|
export const CREATE_GROUP_SUCCESS = 'CREATE_GROUP_SUCCESS';
|
||||||
|
export const CREATE_GROUP_ERROR = 'CREATE_GROUP_ERROR';
|
||||||
|
export const CREATE_GROUP_RESET = 'CREATE_GROUP_RESET';
|
|
@ -0,0 +1,4 @@
|
||||||
|
export const SAVE_ONESIGNAL_IDS_PENDING = 'SAVE_ONESIGNAL_IDS_PENDING';
|
||||||
|
export const SAVE_ONESIGNAL_IDS_SUCCESS = 'SAVE_ONESIGNAL_IDS_SUCCESS';
|
||||||
|
export const SAVE_ONESIGNAL_IDS_ERROR = 'SAVE_ONESIGNAL_IDS_ERROR';
|
||||||
|
export const SAVE_ONESIGNAL_IDS_RESET = 'SAVE_ONESIGNAL_IDS_RESET';
|
|
@ -51,5 +51,8 @@
|
||||||
"envoieCashVersWalletAgent": "envoieCashVersWalletAgent",
|
"envoieCashVersWalletAgent": "envoieCashVersWalletAgent",
|
||||||
"envoieCashVersAutreWalletAgent": "envoieCashVersAutreWalletAgent",
|
"envoieCashVersAutreWalletAgent": "envoieCashVersAutreWalletAgent",
|
||||||
"envoieCashVersCarteAgent": "envoieCashVersCarteAgent",
|
"envoieCashVersCarteAgent": "envoieCashVersCarteAgent",
|
||||||
"envoiCashVersCashAgent": "envoiCashVersCashAgent"
|
"envoiCashVersCashAgent": "envoiCashVersCashAgent",
|
||||||
|
"modifyIdentificationUser": "modifyIdentificationUser",
|
||||||
|
"createGroupNanoCredit": "createGroupNanoCredit",
|
||||||
|
"groupNanoCredit": "groupNanoCredit"
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ import { bindActionCreators } from 'redux';
|
||||||
import getAuthApiKey from '../../webservice/AuthKeyApi';
|
import getAuthApiKey from '../../webservice/AuthKeyApi';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import getWalletActivated from '../../webservice/WalletApi';
|
import getWalletActivated from '../../webservice/WalletApi';
|
||||||
|
import { saveOnesignalIdsAction } from '../../webservice/OnesignalApi';
|
||||||
|
|
||||||
|
|
||||||
const slideHeight = responsiveHeight(30) > 270 ? 270 : responsiveHeight(30)
|
const slideHeight = responsiveHeight(30) > 270 ? 270 : responsiveHeight(30)
|
||||||
|
@ -165,6 +166,17 @@ class Home extends BaseScreen {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_getOneSignalIds = () => {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const getElement = await AsyncStorage.getItem('@config:onesignalIds');
|
||||||
|
resolve(getElement);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
/* AsyncStorage.getAllKeys((err, keys) => {
|
/* AsyncStorage.getAllKeys((err, keys) => {
|
||||||
AsyncStorage.multiGet(keys, (err, stores) => {
|
AsyncStorage.multiGet(keys, (err, stores) => {
|
||||||
|
@ -176,12 +188,34 @@ class Home extends BaseScreen {
|
||||||
});
|
});
|
||||||
}); */
|
}); */
|
||||||
|
|
||||||
readUser().then((user) => {
|
readUser().then(async (user) => {
|
||||||
console.log("USER", user);
|
console.log("USER", user);
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
if (user.phone !== undefined)
|
if (user.phone !== undefined)
|
||||||
this.props.getAuthApiKey(user.phone);
|
this.props.getAuthApiKey(user.phone);
|
||||||
|
|
||||||
|
const onesignalIds = await this._getOneSignalIds();
|
||||||
|
if (onesignalIds) {
|
||||||
|
console.log("ONESIGNAL", onesignalIds);
|
||||||
|
if (user !== undefined) {
|
||||||
|
if (user.category !== undefined) {
|
||||||
|
if (user.category === "geolocated") {
|
||||||
|
this.props.saveOnesignalIdsAction(false, {
|
||||||
|
code_membre: user.user_code,
|
||||||
|
player_id: onesignalIds
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.props.saveOnesignalIdsAction(true, {
|
||||||
|
user_code: user.user_code,
|
||||||
|
player_id: onesignalIds
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} //this.props.saveOnesignalIdsAction()
|
||||||
|
}
|
||||||
|
|
||||||
//this.props.getWalletActivated(user.agentId);
|
//this.props.getWalletActivated(user.agentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1390,8 +1424,8 @@ class Home extends BaseScreen {
|
||||||
translucent={true}
|
translucent={true}
|
||||||
/>
|
/>
|
||||||
{/* Start here to comment */}
|
{/* Start here to comment */}
|
||||||
{/*
|
|
||||||
{
|
{
|
||||||
(this.state.loadingDialog || this.props.loading) ?
|
(this.state.loadingDialog || this.props.loading) ?
|
||||||
<View
|
<View
|
||||||
style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: this.state.loadingDialog ? responsiveWidth(100) : 0, height: this.state.loadingDialog ? responsiveHeight(100) : 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}
|
style={{ position: "absolute", zIndex: 1, backgroundColor: "#00000050", width: this.state.loadingDialog ? responsiveWidth(100) : 0, height: this.state.loadingDialog ? responsiveHeight(100) : 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}
|
||||||
|
@ -1427,7 +1461,7 @@ class Home extends BaseScreen {
|
||||||
this.setState({ showProgress: false })
|
this.setState({ showProgress: false })
|
||||||
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
|
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
|
||||||
}}
|
}}
|
||||||
/> */}
|
/>
|
||||||
{this.makeCardSearch()}
|
{this.makeCardSearch()}
|
||||||
{this.makeSlidingUp()}
|
{this.makeSlidingUp()}
|
||||||
{this.makeDialogLoader()}
|
{this.makeDialogLoader()}
|
||||||
|
@ -2230,7 +2264,8 @@ const mapStateToProps = state => ({
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
getAuthApiKey,
|
getAuthApiKey,
|
||||||
getWalletActivated
|
getWalletActivated,
|
||||||
|
saveOnesignalIdsAction
|
||||||
}, dispatch);
|
}, dispatch);
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Home);
|
export default connect(mapStateToProps, mapDispatchToProps)(Home);
|
||||||
|
|
|
@ -0,0 +1,645 @@
|
||||||
|
import DateTimePicker from '@react-native-community/datetimepicker';
|
||||||
|
import Button from 'apsl-react-native-button';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
import isNil from 'lodash/isNil';
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import { Alert, Keyboard, PermissionsAndroid, Platform, ProgressBarAndroid, ScrollView, StyleSheet, Text, View } from 'react-native';
|
||||||
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
import Geolocation from 'react-native-geolocation-service';
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import { MaterialDialog } from "react-native-material-dialog";
|
||||||
|
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 { store } from '../../redux/store';
|
||||||
|
import { identityPieces } from '../../utils/UtilsFunction';
|
||||||
|
import { createIndentificationResetAction, getNumberDetailAction, getNumberResetAction, getUserIdentificationAction, updateIndentificationAction } from '../../webservice/IdentificationApi';
|
||||||
|
import { getListCountriesActive, getTownInformationName, readUser } from './../../webservice/AuthApi';
|
||||||
|
import { getPositionInformation } from './../../webservice/MapService';
|
||||||
|
let theme = require('./../../utils/theme.json');
|
||||||
|
let route = require('./../../route.json');
|
||||||
|
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, useSignificantChanges: true };
|
||||||
|
const moment = require('moment');
|
||||||
|
|
||||||
|
class ModifyIdentificationUser extends Component {
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('IDENTIFICATION'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('IDENTIFICATION')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
enterPhone: null,
|
||||||
|
firstname: null,
|
||||||
|
lastname: null,
|
||||||
|
numeroIdentite: null,
|
||||||
|
dateNaissance: null,
|
||||||
|
dateExpiration: null,
|
||||||
|
numeroTelephone: null,
|
||||||
|
networksinglePickerVisible: false,
|
||||||
|
confirmpassanim: null,
|
||||||
|
isLoging: false,
|
||||||
|
countries: [],
|
||||||
|
town: [],
|
||||||
|
townName: null,
|
||||||
|
country: null,
|
||||||
|
identityPieces: identityPieces(),
|
||||||
|
identityPiecesName: (identityPieces()[0]).name,
|
||||||
|
snackVisible: false,
|
||||||
|
snackText: '',
|
||||||
|
disableNetwork: false,
|
||||||
|
networks: [],
|
||||||
|
showPickerDateNaissance: false,
|
||||||
|
showPickerDateExpiration: false,
|
||||||
|
modalVisible: true,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
triggerNextClick: false,
|
||||||
|
displayFirstStep: true,
|
||||||
|
displaySecondStep: false,
|
||||||
|
userIdentificationData: store.getState().getUserIdentificationReducer.result.response.data
|
||||||
|
};
|
||||||
|
this.dateNaissanceFumiProps = {};
|
||||||
|
this.dateExpirationFumiProps = {};
|
||||||
|
this.props.createIndentificationResetAction();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
this.dateNaissanceFumiProps.value = moment(this.state.userIdentificationData.birth_date).format('DD-MM-YYYY');
|
||||||
|
this.dateExpirationFumiProps.value = moment(this.state.userIdentificationData.expiry_date_document).format('DD-MM-YYYY');
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
//this.props.getNumberDetailAction(user.phone);
|
||||||
|
this.setState({
|
||||||
|
user,
|
||||||
|
lastname: this.state.userIdentificationData.firstname + ' ' + this.state.userIdentificationData.lastname,
|
||||||
|
numeroIdentite: this.state.userIdentificationData.id_identity_document
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Platform.OS === 'android') {
|
||||||
|
this.requestCameraPermission();
|
||||||
|
} else {
|
||||||
|
this.watchLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
renderCreateIdentificationResponse() {
|
||||||
|
const { result, error } = this.props;
|
||||||
|
|
||||||
|
console.log("PROPS", this.props);
|
||||||
|
|
||||||
|
if (result !== null) {
|
||||||
|
if (typeof result.response !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('SUCCESS_IDENTIFICATION'),
|
||||||
|
result.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.getUserIdentificationAction(this.state.user.phone);
|
||||||
|
this.props.createIndentificationResetAction();
|
||||||
|
this.setState({ triggerSubmitClick: false });
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error !== null) {
|
||||||
|
if (typeof error.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_IDENTIFICATION'),
|
||||||
|
error.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.createIndentificationResetAction();
|
||||||
|
this.setState({ triggerSubmitClick: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t('ERROR_IDENTIFICATION'),
|
||||||
|
JSON.stringify(error),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.createIndentificationResetAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUpdate(nextProps, nextState) {
|
||||||
|
let dateNaissance = nextState.dateNaissance || new Date();
|
||||||
|
|
||||||
|
if (this.state.showPickerDateNaissance)
|
||||||
|
this.dateNaissanceFumiProps.value = moment(dateNaissance).format('DD-MM-YYYY');
|
||||||
|
if (this.state.showPickerDateExpiration)
|
||||||
|
this.dateExpirationFumiProps.value = moment(nextState.dateExpiration).format('DD-MM-YYYY');
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.mounted = false;
|
||||||
|
if (this.watchID) Geolocation.clearWatch(this.watchID);
|
||||||
|
}
|
||||||
|
|
||||||
|
showErrorDialog() {
|
||||||
|
this.setState({ modalDialog: false })
|
||||||
|
Alert.alert("Une erreur est survenue", "Impossible de récuperer des informations du pays verifier que votre gps est activé," +
|
||||||
|
"et que vous êtes connecté à internet puis ressayer", [{
|
||||||
|
text: "Recommencer", onPress: () => {
|
||||||
|
this.watchLocation()
|
||||||
|
}
|
||||||
|
}, { text: "Annuler", onPress: () => { this.props.navigation.popToTop() } }])
|
||||||
|
}
|
||||||
|
|
||||||
|
async watchLocation() {
|
||||||
|
Geolocation.getCurrentPosition((position) => {
|
||||||
|
this.treatPosition(position)
|
||||||
|
}, (e) => {
|
||||||
|
this.showErrorDialog()
|
||||||
|
}, this.props.geolocationOptions);
|
||||||
|
if (!this.watchID) {
|
||||||
|
Geolocation.watchPosition((position) => { this.treatPosition(position) }, (e) => { this.showErrorDialog() }, this.props.geolocationOptions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async requestCameraPermission() {
|
||||||
|
try {
|
||||||
|
const granted = await PermissionsAndroid.request(
|
||||||
|
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||||
|
{
|
||||||
|
'title': 'Cool Photo App Camera Permission',
|
||||||
|
'message': 'Cool Photo App needs access to your camera ' +
|
||||||
|
'so you can take awesome pictures.'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||||
|
this.watchLocation();
|
||||||
|
} else {
|
||||||
|
this.setState({ modalDialog: false })
|
||||||
|
Alert.alert("Echec à l'autorisation",
|
||||||
|
"L'application n'est pas autorisé à acceder à votre position veuillez verifier que votre GPS est activé et configurer en mode Haute Precision",
|
||||||
|
[{
|
||||||
|
text: "Ok", onPress: () => {
|
||||||
|
this.props.navigation.popToTop()
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.setState({ modalDialog: false })
|
||||||
|
Alert.alert("Une erreur est Survenue",
|
||||||
|
"Une erreur est survenu lors du demarrage de l'application veuillez relancer l'application",
|
||||||
|
[{
|
||||||
|
text: "Ok", onPress: () => {
|
||||||
|
BackHandler.exitApp()
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
treatPosition(position) {
|
||||||
|
const myLastPosition = this.state.myPosition;
|
||||||
|
const myPosition = position.coords;
|
||||||
|
|
||||||
|
if (!isEqual(myPosition, myLastPosition)) {
|
||||||
|
getPositionInformation(myPosition).then((response) => {
|
||||||
|
if (response.results !== undefined) {
|
||||||
|
if (response.results.length > 0) {
|
||||||
|
let most = response.results[0]
|
||||||
|
let { address_components, formatted_address, place_id } = most
|
||||||
|
this.setState({ address: address_components, textadress: formatted_address, place: place_id })
|
||||||
|
|
||||||
|
let results = response.results;
|
||||||
|
let shortcountry;
|
||||||
|
let mcountry;
|
||||||
|
for (let i = 0; i < results[0].address_components.length; i++) {
|
||||||
|
for (let j = 0; j < results[0].address_components[i].types.length; j++) {
|
||||||
|
if (results[0].address_components[i].types[j] === "country") {
|
||||||
|
mcountry = results[0].address_components[i];
|
||||||
|
shortcountry = mcountry.short_name;
|
||||||
|
this.setState({ shortCountry: mcountry.short_name, longCountry: mcountry.long_name })
|
||||||
|
} else if (results[0].address_components[i].types[j] === "locality") {
|
||||||
|
const name = results[0].address_components[i].short_name;
|
||||||
|
this.setState({ townName: name });
|
||||||
|
getTownInformationName(name).then((result) => {
|
||||||
|
let town = null;
|
||||||
|
if (result instanceof Array) {
|
||||||
|
town = result[0];
|
||||||
|
} else {
|
||||||
|
town = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ modalVisible: false, town: new Array(town) });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getListCountriesActive().then((cnt) => {
|
||||||
|
this.setState({ countries: cnt })
|
||||||
|
console.debug(cnt, shortcountry);
|
||||||
|
var found = false
|
||||||
|
for (let i of cnt) {
|
||||||
|
if (i.code_country === shortcountry) {
|
||||||
|
found = true;
|
||||||
|
this.setState({ modalVisible: false, indicatif: i.code_dial, country: i.name })
|
||||||
|
/* this.getNetworks(i.code_dial); */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
Alert.alert("Impossible de recupérer vos informations", "Nous n'avons pas pu recuperer les informations de votre pays veuillez contacter les administrateurs", [{ text: "OK" }]);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.showErrorDialog()
|
||||||
|
});
|
||||||
|
this.setState({ myPosition: myPosition });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeDateNaissance = (event, selectedDate) => {
|
||||||
|
let dateNaissance = isNil(this.state.dateNaissance) ? new Date() : this.state.dateNaissance;
|
||||||
|
const currentDate = selectedDate || dateNaissance;
|
||||||
|
this.setState({
|
||||||
|
showPickerDateNaissance: Platform.OS === 'ios' || false,
|
||||||
|
dateNaissance: currentDate,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onChangeDateExpiration = (event, selectedDate) => {
|
||||||
|
let dateExpiration = isNil(this.state.dateExpiration) ? new Date() : this.state.dateExpiration;
|
||||||
|
const currentDate = selectedDate || dateExpiration;
|
||||||
|
this.setState({
|
||||||
|
showPickerDateExpiration: Platform.OS === 'ios' || false,
|
||||||
|
dateExpiration: currentDate,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitIdentityClient = () => {
|
||||||
|
const { lastname, numeroIdentite, dateNaissance, dateExpiration, country, townName, identityPiecesName } = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(lastname))
|
||||||
|
this.lastnameAnim.shake(800);
|
||||||
|
/* else if (this.ckeckIfFieldIsOK(dateNaissance))
|
||||||
|
this.datenaissanceAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(dateExpiration))
|
||||||
|
this.identityDateExpiryAnim.shake(800); */
|
||||||
|
else if (this.ckeckIfFieldIsOK(country))
|
||||||
|
this.countryAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(townName))
|
||||||
|
this.townAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(identityPiecesName))
|
||||||
|
this.identityPiecesAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(numeroIdentite))
|
||||||
|
this.numeroIdentiteAnim.shake(800);
|
||||||
|
else {
|
||||||
|
console.log('USER ID', this.state.user.id);
|
||||||
|
moment(dateNaissance).format('DD-MM-YYYY')
|
||||||
|
this.props.updateIndentificationAction({
|
||||||
|
id: this.state.userIdentificationData.id,
|
||||||
|
lastname: this.state.lastname,
|
||||||
|
firstname: "",
|
||||||
|
birth_date: isNil(this.state.dateNaissance) ? this.dateNaissanceFumiProps.value : moment(this.state.dateNaissance).format('DD-MM-YYYY'),
|
||||||
|
town: this.state.townName,
|
||||||
|
country: this.state.country,
|
||||||
|
identity_document: this.state.identityPiecesName,
|
||||||
|
id_identity_document: this.state.numeroIdentite,
|
||||||
|
expiry_date_document: isNil(this.state.dateExpiration) ? this.dateExpirationFumiProps.value : moment(this.state.dateExpiration).format('DD-MM-YYYY'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
triggerSubmitClick: true
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoaderModal() {
|
||||||
|
return (
|
||||||
|
<MaterialDialog
|
||||||
|
visible={this.state.modalVisible}
|
||||||
|
title={I18n.t("LOADING_INFO")}>
|
||||||
|
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
|
||||||
|
<Text>{I18n.t("LOADING_DESCRIPTION_COUNTRY")}</Text>
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
</View>
|
||||||
|
</MaterialDialog>)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loading || this.props.loadingNumberDetail}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDateNaissancePicker = () => {
|
||||||
|
return (
|
||||||
|
<DateTimePicker
|
||||||
|
testID="dateTimePicker"
|
||||||
|
timeZoneOffsetInMinutes={0}
|
||||||
|
is24Hour={true}
|
||||||
|
value={isNil(this.state.dateNaissance) ? new Date() : this.state.dateNaissance}
|
||||||
|
mode='date'
|
||||||
|
maximumDate={new Date()}
|
||||||
|
display="spinner"
|
||||||
|
onChange={this.onChangeDateNaissance}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDateExpirationPicker = () => {
|
||||||
|
return (
|
||||||
|
<DateTimePicker
|
||||||
|
testID="dateTimePicker"
|
||||||
|
timeZoneOffsetInMinutes={0}
|
||||||
|
is24Hour={true}
|
||||||
|
value={isNil(this.state.dateExpiration) ? new Date() : this.state.dateExpiration}
|
||||||
|
mode='date'
|
||||||
|
maximumDate={new Date(2300, 10, 20)}
|
||||||
|
display="spinner"
|
||||||
|
onChange={this.onChangeDateExpiration}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
console.log("STATE", this.state);
|
||||||
|
const { showPickerDateNaissance } = this.state;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{this.state.showPickerDateNaissance && this.renderDateNaissancePicker()}
|
||||||
|
{this.state.showPickerDateExpiration && this.renderDateExpirationPicker()}
|
||||||
|
{this.state.modalVisible && this.renderLoaderModal()}
|
||||||
|
{(this.props.loading || this.props.loadingNumberDetail) && this.renderLoader()}
|
||||||
|
{this.state.triggerSubmitClick && this.renderCreateIdentificationResponse()}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.lastnameAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user'}
|
||||||
|
label={`${I18n.t('NAME')} ${I18n.t('AND')} ${I18n.t('FIRSTNAME')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.lastname}
|
||||||
|
onChangeText={(lastname) => {
|
||||||
|
this.setState({ lastname })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.datenaissanceAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'calendar'}
|
||||||
|
label={I18n.t('DATE_NAISSANCE')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
style={styles.input}
|
||||||
|
onFocus={() => {
|
||||||
|
Keyboard.dismiss();
|
||||||
|
this.setState({ showPickerDateNaissance: true })
|
||||||
|
}}
|
||||||
|
{...this.dateNaissanceFumiProps}>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.countryAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('COUNTRY_CHOICE')}
|
||||||
|
data={this.state.countries}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.country === null ? "" :
|
||||||
|
this.state.country}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.setState({ country: value });
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.townAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('CHOICE_TOWN')}
|
||||||
|
data={this.state.town}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.townName === null ? "" :
|
||||||
|
this.state.townName}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.setState({ townName: value });
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.identityPiecesAnim = comp }}
|
||||||
|
style={{
|
||||||
|
width: responsiveWidth(90),
|
||||||
|
height: 60,
|
||||||
|
marginTop: 20,
|
||||||
|
alignSelf: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingLeft: 20,
|
||||||
|
paddingRight: 20,
|
||||||
|
backgroundColor: 'white'
|
||||||
|
}}>
|
||||||
|
<Dropdown
|
||||||
|
label={I18n.t('PIECE_IDENTITE')}
|
||||||
|
data={this.state.identityPieces}
|
||||||
|
useNativeDriver={true}
|
||||||
|
value={this.state.identityPiecesName}
|
||||||
|
onChangeText={(value, index, data) => {
|
||||||
|
this.setState({ identityPiecesName: value });
|
||||||
|
}}
|
||||||
|
valueExtractor={(value) => { return value.name }}
|
||||||
|
labelExtractor={(value) => { return value.name }}
|
||||||
|
/>
|
||||||
|
</Animatable.View>
|
||||||
|
<Animatable.View ref={(comp) => { this.numeroIdentiteAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'address-card'}
|
||||||
|
label={`${I18n.t('NUMERO_IDENTITE')}`}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.numeroIdentite}
|
||||||
|
onChangeText={(numeroIdentite) => {
|
||||||
|
this.setState({ numeroIdentite })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
<Animatable.View ref={(comp) => { this.identityDateExpiryAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'calendar-times-o'}
|
||||||
|
label={I18n.t('IDENTITY_PIECE_EXPIRY_DATE')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
style={styles.input}
|
||||||
|
onFocus={() => {
|
||||||
|
Keyboard.dismiss();
|
||||||
|
this.setState({ showPickerDateExpiration: true })
|
||||||
|
}}
|
||||||
|
{...this.dateExpirationFumiProps}>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Button style={styles.btnvalide}
|
||||||
|
textStyle={styles.textbtnvalide}
|
||||||
|
isLoading={this.state.isLoging}
|
||||||
|
onPress={() => { this.onSubmitIdentityClient() }}>
|
||||||
|
{I18n.t('MODIFY')}</Button>
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
loading: state.createIdentificationReducer.loading,
|
||||||
|
result: state.createIdentificationReducer.result,
|
||||||
|
error: state.createIdentificationReducer.error,
|
||||||
|
|
||||||
|
loadingNumberDetail: state.getNumberInformationReducer.loading,
|
||||||
|
resultNumberDetail: state.getNumberInformationReducer.result,
|
||||||
|
errorNumberDetail: state.getNumberInformationReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
updateIndentificationAction,
|
||||||
|
createIndentificationResetAction,
|
||||||
|
getUserIdentificationAction,
|
||||||
|
getNumberDetailAction,
|
||||||
|
getNumberResetAction
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(ModifyIdentificationUser);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.primaryDarkColor,
|
||||||
|
},
|
||||||
|
textbtnvalide: {
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
bigtitle: {
|
||||||
|
color: 'white',
|
||||||
|
fontSize: 20,
|
||||||
|
flex: 1,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 20,
|
||||||
|
},
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,403 @@
|
||||||
|
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 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';
|
||||||
|
let theme = require('../../utils/theme.json');
|
||||||
|
let route = require('../../route.json');
|
||||||
|
|
||||||
|
|
||||||
|
class CreateGroupNanoCredit extends Component {
|
||||||
|
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
static navigationOptions = () => {
|
||||||
|
return {
|
||||||
|
drawerLabel: () => null,
|
||||||
|
headerTitle: I18n.t('CREATE_GROUP'),
|
||||||
|
headerTintColor: 'white',
|
||||||
|
headerStyle: {
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
marginTop: 0,
|
||||||
|
color: 'white'
|
||||||
|
},
|
||||||
|
headerTitleStyle: {
|
||||||
|
color: "white"
|
||||||
|
},
|
||||||
|
title: I18n.t('CREATE_GROUP')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
montant: null,
|
||||||
|
password: null,
|
||||||
|
nomGroupe: null,
|
||||||
|
limitCredit: null,
|
||||||
|
codeSponsor1: null,
|
||||||
|
codeSponsor2: null,
|
||||||
|
codeSponsor3: null,
|
||||||
|
loading: false,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
isSubmitClick: false,
|
||||||
|
isDataSubmit: false,
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({ user });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
isMontantValid = () => {
|
||||||
|
const { limitCredit } = this.state;
|
||||||
|
if ((parseInt(isEqual(limitCredit, 0)) || limitCredit < 0))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_AMOUNT_SUPERIOR_ZEROR'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
else if (!isNormalInteger(limitCredit))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('ENTER_VALID_AMOUNT'),
|
||||||
|
isValid: false
|
||||||
|
};
|
||||||
|
|
||||||
|
/* else if (montant > parseInt(this.state.comptePrincipal))
|
||||||
|
return {
|
||||||
|
errorMessage: I18n.t('AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT'),
|
||||||
|
isValid: false
|
||||||
|
}; */
|
||||||
|
|
||||||
|
else
|
||||||
|
return {
|
||||||
|
errorMessage: '',
|
||||||
|
isValid: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
renderCreateGroupReponse = () => {
|
||||||
|
|
||||||
|
const { result, error } = this.props;
|
||||||
|
|
||||||
|
if (error !== null) {
|
||||||
|
if (typeof error.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_CREATION_GROUP"),
|
||||||
|
error.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.createGroupReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result !== null) {
|
||||||
|
if (result.response !== null) {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("SUCCESS_CREATION_GROUP"),
|
||||||
|
result.response,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.createGroupReset();
|
||||||
|
IlinkEmitter.emit("refreshWallet");
|
||||||
|
this.props.navigation.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLangue() {
|
||||||
|
this.props.navigation.setParams({ name: I18n.t('DEPOSIT_TO_CARD') })
|
||||||
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
ckeckIfFieldIsOK(champ) {
|
||||||
|
return (isNil(champ) || isEqual(champ.length, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
onSubmitSendWalletToCard = () => {
|
||||||
|
const { codeSponsor1, codeSponsor2, nomGroupe, codeSponsor3, limitCredit, password } = this.state;
|
||||||
|
|
||||||
|
if (this.ckeckIfFieldIsOK(nomGroupe))
|
||||||
|
this.nomGroupeAnim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(limitCredit) || !this.isMontantValid().isValid) {
|
||||||
|
this.limitCreditAnim.shake(800);
|
||||||
|
}
|
||||||
|
else if (this.ckeckIfFieldIsOK(codeSponsor1))
|
||||||
|
this.codeSponsor1Anim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(codeSponsor2))
|
||||||
|
this.codeSponsor2Anim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(codeSponsor3))
|
||||||
|
this.codeSponsor3Anim.shake(800);
|
||||||
|
else if (this.ckeckIfFieldIsOK(password))
|
||||||
|
this.passwordAnim.shake(800);
|
||||||
|
else {
|
||||||
|
|
||||||
|
this.props.createGroupAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
nom: this.state.nomGroupe,
|
||||||
|
code_sponsor1: this.state.codeSponsor1,
|
||||||
|
code_sponsor2: this.state.codeSponsor2,
|
||||||
|
code_sponsor3: this.state.codeSponsor3,
|
||||||
|
password: this.state.password,
|
||||||
|
limite_credit: this.state.limitCredit
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
isDataSubmit: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<ProgressDialog
|
||||||
|
visible={this.props.loading || this.props.loadingGetCommission}
|
||||||
|
title={I18n.t('LOADING')}
|
||||||
|
message={I18n.t('LOADING_INFO')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
|
||||||
|
{this.state.isDataSubmit && this.renderCreateGroupReponse()}
|
||||||
|
<ScrollView style={styles.container}>
|
||||||
|
|
||||||
|
<Text style={styles.subbigtitle}>{I18n.t('GROUP_INFOS')}</Text>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.nomGroupeAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
|
||||||
|
label={I18n.t('NOM_GROUP')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.nomGroupe}
|
||||||
|
onChangeText={(nomGroupe) => {
|
||||||
|
|
||||||
|
this.setState({ nomGroupe })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.limitCreditAnim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'money'}
|
||||||
|
label={I18n.t('LIMIT_OF_CREDIT')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
keyboardType='numeric'
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.limitCredit}
|
||||||
|
onChangeText={(limitCredit) => {
|
||||||
|
this.setState({ limitCredit })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
<View style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: responsiveWidth(82),
|
||||||
|
top: 35,
|
||||||
|
flexDirection: 'row'
|
||||||
|
}}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 1,
|
||||||
|
borderLeftColor: '#f0f0f0',
|
||||||
|
height: 40,
|
||||||
|
left: -8,
|
||||||
|
top: -10,
|
||||||
|
borderLeftWidth: 1,
|
||||||
|
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={[Typography.body1, FontWeight.bold]}>{this.state.wallet.currency_code}</Text>
|
||||||
|
</View>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.codeSponsor1Anim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user-circle-o'}
|
||||||
|
label={I18n.t('CODE_USER_ILINK_SPONSOR_1')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.codeSponsor1}
|
||||||
|
onChangeText={(codeSponsor1) => {
|
||||||
|
|
||||||
|
this.setState({ codeSponsor1 })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.codeSponsor2Anim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user-circle-o'}
|
||||||
|
label={I18n.t('CODE_USER_ILINK_SPONSOR_2')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.codeSponsor2}
|
||||||
|
onChangeText={(codeSponsor2) => {
|
||||||
|
|
||||||
|
this.setState({ codeSponsor2 })
|
||||||
|
}}
|
||||||
|
style={styles.input}
|
||||||
|
>
|
||||||
|
</Fumi>
|
||||||
|
</Animatable.View>
|
||||||
|
|
||||||
|
<Animatable.View ref={(comp) => { this.codeSponsor3Anim = comp }}>
|
||||||
|
<Fumi iconClass={FontAwesomeIcon} iconName={'user-circle-o'}
|
||||||
|
label={I18n.t('CODE_USER_ILINK_SPONSOR_3')}
|
||||||
|
iconColor={'#f95a25'}
|
||||||
|
iconSize={20}
|
||||||
|
value={this.state.codeSponsor3}
|
||||||
|
onChangeText={(codeSponsor3) => {
|
||||||
|
|
||||||
|
this.setState({ codeSponsor3 })
|
||||||
|
}}
|
||||||
|
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.onSubmitSendWalletToCard(); }}>
|
||||||
|
{I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
|
</ScrollView>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const maptStateToProps = state => ({
|
||||||
|
|
||||||
|
loading: state.createGroupReducer.loading,
|
||||||
|
result: state.createGroupReducer.result,
|
||||||
|
error: state.createGroupReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
|
createGroupAction,
|
||||||
|
createGroupReset,
|
||||||
|
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(maptStateToProps, mapDispatchToProps)(CreateGroupNanoCredit);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: Color.primaryDarkColor,
|
||||||
|
},
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,898 @@
|
||||||
|
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import {
|
||||||
|
Platform,
|
||||||
|
StyleSheet,
|
||||||
|
AppState,
|
||||||
|
FlatList,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
TouchableOpacity,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
Animated,
|
||||||
|
StatusBar
|
||||||
|
} from 'react-native';
|
||||||
|
import ActionButton from 'react-native-action-button';
|
||||||
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
||||||
|
import { responsiveFontSize, responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
||||||
|
import { HistoryListItem, HistoryItemSectionned } from '../history-request/HistoryItem';
|
||||||
|
import { credrequester } from './../../route.json';
|
||||||
|
import { loadDemandeCredit, loadMyDemandeCredit } from './../../webservice/HistoryRequestApi';
|
||||||
|
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import BaseScreen from './../../screens/BaseScreen'
|
||||||
|
import Button from 'apsl-react-native-button'
|
||||||
|
import { readUser } from "../../webservice/AuthApi";
|
||||||
|
import Calendar from 'react-native-calendario';
|
||||||
|
let route = require('./../../route.json')
|
||||||
|
import 'moment';
|
||||||
|
import 'moment/locale/fr'
|
||||||
|
import 'moment/locale/es-us'
|
||||||
|
import 'moment/locale/en-au'
|
||||||
|
import 'moment/locale/en-ca'
|
||||||
|
import 'moment/locale/en-ie'
|
||||||
|
import 'moment/locale/en-il'
|
||||||
|
import 'moment/locale/en-nz'
|
||||||
|
import 'moment/locale/en-gb'
|
||||||
|
import moment from 'moment-timezone';
|
||||||
|
let theme = require('./../../utils/theme.json')
|
||||||
|
import { primary, primaryDark, accent, purpleLight, primaryLight } from './../../utils/theme.json';
|
||||||
|
import { PagerTabIndicator, PagerTitleIndicator, PagerDotIndicator } from 'react-native-best-viewpager'
|
||||||
|
var sortIcons;
|
||||||
|
var sectionIcons;
|
||||||
|
import I18n from 'react-native-i18n'
|
||||||
|
require('./../../utils/Translations')
|
||||||
|
import { SinglePickerMaterialDialog } from 'react-native-material-dialog';
|
||||||
|
import { Header } from "react-native-elements";
|
||||||
|
import { withNavigationFocus } from "react-navigation";
|
||||||
|
import IconWithBadge from "../IconWithBadge";
|
||||||
|
import { Appbar, Paragraph, Menu, Divider, Provider } from 'react-native-paper';
|
||||||
|
import DeviceInfo from 'react-native-device-info'
|
||||||
|
|
||||||
|
|
||||||
|
class DemandValidationGroup extends React.Component {
|
||||||
|
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: primary,
|
||||||
|
statusBarColor: primaryDark,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF',
|
||||||
|
contextualMenuStatusBarColor: theme.accent,
|
||||||
|
contextualMenuBackgroundColor: theme.accentLight,
|
||||||
|
contextualMenuButtonsColor: '#ffffff'
|
||||||
|
|
||||||
|
};
|
||||||
|
static navigationOptions = ({ navigation }) => {
|
||||||
|
const { routeName } = navigation.state
|
||||||
|
return {
|
||||||
|
|
||||||
|
tabBarLabel: routeName === "demandeValidationGroupe" ? I18n.t('MANAGE_GROUP') : I18n.t('DEMAND_RECEIVE'),
|
||||||
|
tabBarIcon: ({ focused, horizontal, tintColor }) => {
|
||||||
|
return (<IconWithBadge
|
||||||
|
badgeCount={navigation.getParam("count", 0)}
|
||||||
|
size={20}
|
||||||
|
name={routeName === "demandeValidationGroupe" ? "mail" : "inbox"}
|
||||||
|
color={focused ? tintColor : "grey"}
|
||||||
|
/>)
|
||||||
|
},
|
||||||
|
|
||||||
|
drawerLabel: I18n.t('MANAGE_GROUP'),
|
||||||
|
drawerIcon: ({ tintColor }) => (
|
||||||
|
<Icon
|
||||||
|
name={'credit-card'}
|
||||||
|
size={24}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props, true);
|
||||||
|
this.state = this.initState();
|
||||||
|
readUser().then((user) => { this.setState({ user: user }) })
|
||||||
|
this._populateIcons().then(() => {
|
||||||
|
});
|
||||||
|
|
||||||
|
this.navigation = this.props.navigation
|
||||||
|
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
|
||||||
|
//moment.locale(this.currentLocale);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
navigationButtonPressed({ buttonId }) {
|
||||||
|
if (buttonId === 'id') {
|
||||||
|
this.showFilter();
|
||||||
|
} else if (buttonId === 'sectionned') {
|
||||||
|
this.setState({ isSectionned: !this.state.isSectionned })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
showFilter() {
|
||||||
|
|
||||||
|
/*if (this.state.filter) {
|
||||||
|
Navigation.mergeOptions(route.stackRoot,
|
||||||
|
{
|
||||||
|
topBar: {
|
||||||
|
rightButtons: [
|
||||||
|
{
|
||||||
|
title: 'Non Traité',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Traité',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Période',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Tout',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Trier par',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onButtonPressed: (index) => {
|
||||||
|
let data = this.state.conserve
|
||||||
|
console.log(index)
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data !== null) {
|
||||||
|
let filtre = "";
|
||||||
|
if (index < 2) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
filtre = I18n.t('NO_TREAT')
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
filtre = I18n.t('TREAT');
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
let fi = data.filter(item => item.statut === filtre)
|
||||||
|
this.setState({listdata: fi, filter: true})
|
||||||
|
} else if (index === 2) {
|
||||||
|
this.setState({panelVisible: true})
|
||||||
|
} else {
|
||||||
|
this.setState({listdata: data, filter: false})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Navigation.mergeOptions(route.stackRoot,
|
||||||
|
{
|
||||||
|
topBar: {
|
||||||
|
rightButtons: [
|
||||||
|
{
|
||||||
|
title: I18n.t('NO_TREAT'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('TREAT'),
|
||||||
|
}
|
||||||
|
, {
|
||||||
|
title: I18n.t('PERIOD'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Trier par',
|
||||||
|
}, {
|
||||||
|
title: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onButtonPressed: (index) => {
|
||||||
|
let data = this.state.conserve
|
||||||
|
if (data != null && data.length > 0) {
|
||||||
|
var filtre = "";
|
||||||
|
if (index < 2) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
filtre = I18n.t('NO_TREATED');
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
filtre = I18n.t('TREATED');
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
let fi = data.filter(item => item.statut === filtre)
|
||||||
|
this.setState({listdata: fi, filter: true})
|
||||||
|
} else if (index === 2) {
|
||||||
|
this.setState({panelVisible: true})
|
||||||
|
this.props.navigator.showContextualMenu(
|
||||||
|
{
|
||||||
|
rightButtons: [
|
||||||
|
{
|
||||||
|
title: I18n.t('CANCEL'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('FILTER'),
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
onButtonPressed: (index) => {
|
||||||
|
console.log(index)
|
||||||
|
|
||||||
|
switch (index) {
|
||||||
|
case 1:
|
||||||
|
let {dateend, datestart} = this.state;
|
||||||
|
this.onfilterPress();
|
||||||
|
}
|
||||||
|
this.setState({panelVisible: false});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.setState({listdata: data, filter: false})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
_populateIcons = function () {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
Promise.all(
|
||||||
|
[
|
||||||
|
Icon.getImageSource('sort', 30),
|
||||||
|
Icon.getImageSource('layer-group', 30),
|
||||||
|
]
|
||||||
|
).then((values) => {
|
||||||
|
sortIcons = values[0];
|
||||||
|
sectionIcons = values[1];
|
||||||
|
resolve(true);
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
reject(error);
|
||||||
|
}).done();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
initState() {
|
||||||
|
return {
|
||||||
|
user: {},
|
||||||
|
listdata: [],
|
||||||
|
listdataSend: [],
|
||||||
|
conserve: [],
|
||||||
|
count: 0,
|
||||||
|
translateAnim: new Animated.Value(0),
|
||||||
|
visibleMenu: false,
|
||||||
|
appState: AppState.currentState,
|
||||||
|
filter: false,
|
||||||
|
sortIcons: null,
|
||||||
|
panelVisible: false,
|
||||||
|
filder_disable: true,
|
||||||
|
datestartformated: 'La date de debut',
|
||||||
|
dateendformated: 'La date de fin',
|
||||||
|
datestart: null,
|
||||||
|
dateend: null,
|
||||||
|
isLoaded: false,
|
||||||
|
isSectionned: false,
|
||||||
|
isDateTimePickerVisible: false,
|
||||||
|
isDateEndTimePickerVisible: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateList(data) {
|
||||||
|
if (!this.state.filter) {
|
||||||
|
let rev = data.reverse()
|
||||||
|
this.setState({ listdata: rev, conserve: rev, isLoaded: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateMyList(data) {
|
||||||
|
if (!this.state.filter) {
|
||||||
|
let rev = data.reverse()
|
||||||
|
this.setState({ listdataSend: rev, conserve: rev, isLoaded: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const { routeName } = this.navigation.state
|
||||||
|
this.setState({ position: routeName === "demandeValidationGroupe" ? 0 : 1 })
|
||||||
|
this.refreshData()
|
||||||
|
/* this.intervaller = setInterval(() => {
|
||||||
|
this.refreshData(false)
|
||||||
|
}, 2000) */
|
||||||
|
this.animateSlidingUp(false)
|
||||||
|
this.props.navigation.addListener("didFocus", () => {
|
||||||
|
this.refreshData(false)
|
||||||
|
console.warn("loading")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
clearInterval(this.intervaller)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderOptionsMenu() {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
zIndex: 100,
|
||||||
|
paddingTop: 50,
|
||||||
|
right: 10,
|
||||||
|
flexDirection: 'row',
|
||||||
|
visible: this.state.visibleMenu,
|
||||||
|
justifyContent: 'center'
|
||||||
|
}}>
|
||||||
|
<Menu
|
||||||
|
visible={this.state.visibleMenu}
|
||||||
|
onDismiss={this._closeMenu}
|
||||||
|
anchor={
|
||||||
|
<Button onPress={this._openMenu}>Show menu</Button>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Menu.Item onPress={() => {
|
||||||
|
this.setState({ isSectionned: !this.state.isSectionned })
|
||||||
|
this._closeMenu()
|
||||||
|
}}
|
||||||
|
title="Section" />
|
||||||
|
<Divider />
|
||||||
|
<Menu.Item onPress={() => {
|
||||||
|
|
||||||
|
this.animateSlidingUp(!this.state.isSliding)
|
||||||
|
this._closeMenu()
|
||||||
|
}} title={I18n.t("FILTER_DATE")} />
|
||||||
|
</Menu>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
animateSlidingUp(state = false) {
|
||||||
|
const height = responsiveHeight(100)
|
||||||
|
let initialValue = !state ? 0 : height,
|
||||||
|
finalValue = !state ? height : 0;
|
||||||
|
|
||||||
|
this.setState({ isSliding: state })
|
||||||
|
|
||||||
|
|
||||||
|
this.state.translateAnim.setValue(initialValue); //Step 3
|
||||||
|
Animated.timing( //Step 4
|
||||||
|
this.state.translateAnim,
|
||||||
|
{
|
||||||
|
toValue: finalValue,
|
||||||
|
duration: 500,
|
||||||
|
useNativeDriver: true,
|
||||||
|
}
|
||||||
|
).start()
|
||||||
|
}
|
||||||
|
_openMenu = () => this.setState({ visibleMenu: true });
|
||||||
|
|
||||||
|
_closeMenu = () => this.setState({ visibleMenu: false });
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<Provider>
|
||||||
|
<View style={{ flex: 1 }}
|
||||||
|
>
|
||||||
|
<StatusBar
|
||||||
|
backgroundColor={theme.primaryDark}
|
||||||
|
barStyle="light-content"
|
||||||
|
translucent={false}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{this.renderSliding()}
|
||||||
|
|
||||||
|
<Appbar.Header dark={true} style={{ backgroundColor: theme.primary }}>
|
||||||
|
<Appbar.BackAction
|
||||||
|
onPress={() => { this.props.navigation.pop() }}
|
||||||
|
/>
|
||||||
|
<Appbar.Content
|
||||||
|
title={I18n.t('MANAGE_GROUP')}
|
||||||
|
subtitle={this.state.position === 0 ? I18n.t('VALIDATION_DEMAND') : I18n.t('DELETE_DEMAND')}
|
||||||
|
/>
|
||||||
|
<Appbar.Action icon="refresh" onPress={() => { this.refreshData() }} />
|
||||||
|
<Appbar.Action icon="more-vert" onPress={() => { this._openMenu(); this.renderSliding(); }} />
|
||||||
|
</Appbar.Header>
|
||||||
|
{this.renderOptionsMenu()}
|
||||||
|
|
||||||
|
{this.state.position === 0 ? this._renderListDemandsSend() : this._renderListDemandReceive()}
|
||||||
|
</View>
|
||||||
|
</Provider>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
renderSliding() {
|
||||||
|
return (
|
||||||
|
<Animated.View style={[styles.slidingup, { translateY: this.state.translateAnim }]}>
|
||||||
|
<Calendar
|
||||||
|
onChange={(range) => console.log(range)}
|
||||||
|
minDate="2018-04-20"
|
||||||
|
startDate="2018-04-30"
|
||||||
|
endDate="2018-05-05"
|
||||||
|
theme={{
|
||||||
|
activeDayColor: {},
|
||||||
|
monthTitleTextStyle: {
|
||||||
|
color: '#6d95da',
|
||||||
|
fontWeight: '300',
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
emptyMonthContainerStyle: {},
|
||||||
|
emptyMonthTextStyle: {
|
||||||
|
fontWeight: '200',
|
||||||
|
},
|
||||||
|
weekColumnsContainerStyle: {},
|
||||||
|
weekColumnStyle: {
|
||||||
|
paddingVertical: 10,
|
||||||
|
},
|
||||||
|
weekColumnTextStyle: {
|
||||||
|
color: '#b6c1cd',
|
||||||
|
fontSize: 13,
|
||||||
|
},
|
||||||
|
nonTouchableDayContainerStyle: {},
|
||||||
|
nonTouchableDayTextStyle: {},
|
||||||
|
startDateContainerStyle: {},
|
||||||
|
endDateContainerStyle: {},
|
||||||
|
dayContainerStyle: {},
|
||||||
|
dayTextStyle: {
|
||||||
|
color: '#2d4150',
|
||||||
|
fontWeight: '200',
|
||||||
|
fontSize: 15,
|
||||||
|
},
|
||||||
|
dayOutOfRangeContainerStyle: {},
|
||||||
|
dayOutOfRangeTextStyle: {},
|
||||||
|
todayContainerStyle: {},
|
||||||
|
todayTextStyle: {
|
||||||
|
color: '#6d95da',
|
||||||
|
},
|
||||||
|
activeDayContainerStyle: {
|
||||||
|
backgroundColor: '#6d95da',
|
||||||
|
},
|
||||||
|
activeDayTextStyle: {
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
nonTouchableLastMonthDayTextStyle: {}
|
||||||
|
}}
|
||||||
|
style={{ height: responsiveHeight(60) }}
|
||||||
|
/>
|
||||||
|
<View style={{ flexDirection: 'row' }}>
|
||||||
|
<Button>{I18n.t('QUIT')}</Button>
|
||||||
|
<Button>{I18n.t('FILTER')}</Button>
|
||||||
|
</View>
|
||||||
|
</Animated.View>)
|
||||||
|
}
|
||||||
|
renderSectionnedList(list) {
|
||||||
|
|
||||||
|
if (this.state.isLoaded) {
|
||||||
|
let data = list;
|
||||||
|
if (data !== null) {
|
||||||
|
if (data.length > 0) {
|
||||||
|
return (<HistoryItemSectionned
|
||||||
|
user={this.state.user}
|
||||||
|
list={list}
|
||||||
|
refresh={() => this.refreshData()}
|
||||||
|
style={styles.listbackground} />)
|
||||||
|
} else if (this.state.filter) {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<Text>{I18n.t('NO_ITEMS_REQUEST')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<Text>{I18n.t('EMPTY_LIST_REQUEST')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderList(list) {
|
||||||
|
if (this.state.isLoaded && list instanceof Array) {
|
||||||
|
let data = list;
|
||||||
|
if (data !== null) {
|
||||||
|
if (data.length > 0) {
|
||||||
|
return (<HistoryListItem
|
||||||
|
user={this.state.user}
|
||||||
|
list={list}
|
||||||
|
refreshing={() => { this.refreshData() }}
|
||||||
|
refresh={() => this.refreshData()}
|
||||||
|
isRefreshing={this.state.isRefreshing}
|
||||||
|
navigator={this.props.navigation}
|
||||||
|
style={styles.listbackground}
|
||||||
|
isDemandSend={this.state.position === 0} />)
|
||||||
|
} else if (this.state.filter) {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
} else if (data.length === 0) {
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<Text>{I18n.t('EMPTY_LIST_REQUEST')} </Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (list.length === 0) {
|
||||||
|
return (
|
||||||
|
<View style={styles.emptyListe}>
|
||||||
|
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoading() {
|
||||||
|
return (<View><ProgressBarAndroid /><Text>{I18n.t('LOADING_DOTS')}</Text></View>)
|
||||||
|
}
|
||||||
|
showSlidingUpPanel() {
|
||||||
|
/* return (<SlidingUpPanel
|
||||||
|
style={styles.slidingup}
|
||||||
|
height={responsiveHeight(100)}
|
||||||
|
visible={this.state.panelVisible}
|
||||||
|
ref={(c) => this.panel = c}
|
||||||
|
draggableRange={{top: responsiveHeight(100), bottom: 0}}
|
||||||
|
onRequestClose={() => this.setState({panelVisible: false})}>
|
||||||
|
<View style={styles.container}>
|
||||||
|
{this.showSlidingUpView()}
|
||||||
|
</View>
|
||||||
|
</SlidingUpPanel>)
|
||||||
|
}
|
||||||
|
|
||||||
|
showSlidingUpView() {
|
||||||
|
/* return (
|
||||||
|
<View style={datefilter.container}>
|
||||||
|
<View stlye={datefilter.content}>
|
||||||
|
<DatepickerRange
|
||||||
|
styles={{
|
||||||
|
borderColor: 'transparent',
|
||||||
|
borderRadius: 0,
|
||||||
|
margin: 10,
|
||||||
|
height:responsiveWidth(50)
|
||||||
|
}}
|
||||||
|
initialMonth='201801'
|
||||||
|
onSelect={(fromdate,untildate)=>this._handleDatePicked(fromdate,untildate)}
|
||||||
|
dayHeadings={['D', 'L', 'M', 'M', 'J', 'V', 'S']}
|
||||||
|
maxMonth={12}
|
||||||
|
startdate={moment('20180101').format('YYYYMMDD')}
|
||||||
|
untilDate='20181231'
|
||||||
|
minDate='20180101'
|
||||||
|
maxDate='20181231'
|
||||||
|
buttonColor='green'
|
||||||
|
showReset={false}
|
||||||
|
showClose={false}
|
||||||
|
placeHolderStart= 'Date de debut'
|
||||||
|
placeHolderUntil= 'Date fin'
|
||||||
|
selectedBackgroundColor= 'green'
|
||||||
|
selectedTextColor='white'
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
)*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
onfilterPress() {
|
||||||
|
let { datestart, dateend } = this.state;
|
||||||
|
let data = this.state.conserve;
|
||||||
|
|
||||||
|
if (data !== null) {
|
||||||
|
data = data.filter(item => {
|
||||||
|
let mda = moment(item.dateAjout)
|
||||||
|
return moment(item.dateAjout).isAfter(moment(datestart).toDate()) && (mda.isBefore(moment(dateend).toDate()))
|
||||||
|
})
|
||||||
|
|
||||||
|
this.setState({ listdata: data, panelVisible: false, filter: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
_showDateTimePicker = (type) => {
|
||||||
|
if (type === 1)
|
||||||
|
this.setState({
|
||||||
|
isDateTimePickerVisible: true
|
||||||
|
});
|
||||||
|
else this.setState({
|
||||||
|
isDateEndTimePickerVisible: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_showDateEndPicker = () => this.setState({ isDateEndTimePickerVisible: true });
|
||||||
|
|
||||||
|
_hideDateTimePicker = () => this.setState({ isDateTimePickerVisible: false, isDateEndTimePickerVisible: false });
|
||||||
|
/*
|
||||||
|
_handleDatePicked = (fromdate, enddate) => {
|
||||||
|
console.log([fromdate, enddate]);
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
datestart: fromdate,
|
||||||
|
datestartformated: moment(fromdate).format('dddd Do ,MMMM YYYY'),
|
||||||
|
dateend: enddate,
|
||||||
|
dateendformated: moment(enddate).format('dddd Do ,MMMM YYYY')
|
||||||
|
});
|
||||||
|
let startdate = this.state.datestart;
|
||||||
|
let enddatemo = moment(enddate);
|
||||||
|
let dif = moment(enddatemo).diff(startdate);
|
||||||
|
if (dif < 0) {
|
||||||
|
this.setState({ filder_disable: true });
|
||||||
|
this.props.navigator.showSnackbar({
|
||||||
|
text: I18n.t('DATE_WRONG'),
|
||||||
|
duration: 'long',
|
||||||
|
backgroundColor: 'red',
|
||||||
|
textColor: 'white'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setState({ filder_disable: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
this._hideDateTimePicker();
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
printOptions() {
|
||||||
|
if (this.state.user.category === "hyper") {
|
||||||
|
return (<ActionButton buttonColor={accent}>
|
||||||
|
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('SAVE_HISTORY')} onPress={() => {
|
||||||
|
|
||||||
|
}}>
|
||||||
|
<Icon name="save" style={styles.actionButtonIcon} />
|
||||||
|
</ActionButton.Item>
|
||||||
|
</ActionButton>);
|
||||||
|
} else {
|
||||||
|
return (<ActionButton buttonColor={accent}>
|
||||||
|
<ActionButton.Item buttonColor={primary} title={I18n.t('MAKE_REQUEST')}
|
||||||
|
onPress={() => {
|
||||||
|
this.props.navigation.push(route.credrequester, {
|
||||||
|
onGoBack: () => this.refreshData()
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon name="edit" style={styles.actionButtonIcon} />
|
||||||
|
</ActionButton.Item>
|
||||||
|
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('SAVE_HISTORY')} onPress={() => {
|
||||||
|
|
||||||
|
}}>
|
||||||
|
<Icon name="save" style={styles.actionButtonIcon} />
|
||||||
|
</ActionButton.Item>
|
||||||
|
</ActionButton>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderListDemandsSend() {
|
||||||
|
console.log('this.state', this.state);
|
||||||
|
return (<View style={styles.container}>
|
||||||
|
{
|
||||||
|
this.state.isLoaded ?
|
||||||
|
this.state.isSectionned ?
|
||||||
|
this.renderSectionnedList(this.state.listdataSend) :
|
||||||
|
this.renderList(this.state.listdataSend) : this.renderLoading()
|
||||||
|
}
|
||||||
|
{this.printOptions()}
|
||||||
|
{this.showSlidingUpPanel()}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderListDemandReceive() {
|
||||||
|
|
||||||
|
return (<View style={styles.container}>
|
||||||
|
{
|
||||||
|
this.state.isLoaded ?
|
||||||
|
this.state.isSectionned ?
|
||||||
|
this.renderSectionnedList(this.state.listdata) :
|
||||||
|
this.renderList(this.state.listdata) : this.renderLoading()
|
||||||
|
}
|
||||||
|
{this.printOptions()}
|
||||||
|
{this.showSlidingUpPanel()}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderTabGeolocated() {
|
||||||
|
let tabs = [{
|
||||||
|
text: I18n.t('DEMAND_SEND'),
|
||||||
|
}]
|
||||||
|
return <PagerTabIndicator
|
||||||
|
style={{
|
||||||
|
height: responsiveHeight(8)
|
||||||
|
}}
|
||||||
|
tabs={tabs} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderTabHyper() {
|
||||||
|
let tabs = [{
|
||||||
|
text: I18n.t('DEMAND_RECEIVE'),
|
||||||
|
}]
|
||||||
|
return <PagerTabIndicator
|
||||||
|
style={{
|
||||||
|
height: responsiveHeight(8)
|
||||||
|
}}
|
||||||
|
tabs={tabs} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderTabs() {
|
||||||
|
let tabs = [{
|
||||||
|
text: I18n.t('VALIDATION_DEMAND'),
|
||||||
|
iconSource: this.state.usersicon
|
||||||
|
}, {
|
||||||
|
text: I18n.t('DELETE_DEMAND'),
|
||||||
|
iconSource: this.state.charticon
|
||||||
|
}]
|
||||||
|
return <PagerTabIndicator
|
||||||
|
style={{
|
||||||
|
height: responsiveHeight(8)
|
||||||
|
}}
|
||||||
|
tabs={tabs} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshData(autoref = true) {
|
||||||
|
if (autoref)
|
||||||
|
this.setState({ isRefreshing: true })
|
||||||
|
loadDemandeCredit().then((data) => {
|
||||||
|
|
||||||
|
if (data.success !== undefined) {
|
||||||
|
this.setState({ listdata: [] })
|
||||||
|
this.updateList(data.demands);
|
||||||
|
if (this.state.position !== 0) this.props.navigation.setParams({ count: data.demands.length })
|
||||||
|
this.setState({ isRefreshing: false })
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
console.warn(e)
|
||||||
|
});
|
||||||
|
|
||||||
|
loadMyDemandeCredit().then((data) => {
|
||||||
|
if (data.success !== undefined) {
|
||||||
|
this.setState({ listdataSend: [] })
|
||||||
|
this.setState({ isRefreshing: false })
|
||||||
|
if (this.state.position === 0) this.props.navigation.setParams({ count: data.demands.length })
|
||||||
|
|
||||||
|
this.updateMyList(data.demands)
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
console.warn(e)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default DemandValidationGroup;
|
||||||
|
const datefilter = StyleSheet.create({
|
||||||
|
titleHeader: {
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: 'black',
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
datetitle: {
|
||||||
|
fontSize: 17,
|
||||||
|
color: 'black',
|
||||||
|
marginLeft: responsiveWidth(2),
|
||||||
|
},
|
||||||
|
datetext: {
|
||||||
|
fontSize: 16,
|
||||||
|
marginLeft: responsiveWidth(5)
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
flex: 2,
|
||||||
|
|
||||||
|
},
|
||||||
|
btnContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
width: responsiveWidth(100),
|
||||||
|
alignSelf: 'flex-end',
|
||||||
|
flex: 2,
|
||||||
|
},
|
||||||
|
btn: {
|
||||||
|
flex: 1,
|
||||||
|
borderColor: 'transparent',
|
||||||
|
borderRadius: 0,
|
||||||
|
},
|
||||||
|
btntext: {
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: accent
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'space-evenly'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
slidingup: {
|
||||||
|
position: "absolute",
|
||||||
|
height: responsiveHeight(84),
|
||||||
|
bottom: 0,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
width: responsiveWidth(100),
|
||||||
|
zIndex: 1000
|
||||||
|
},
|
||||||
|
root: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: 'white',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
emptylist: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center'
|
||||||
|
},
|
||||||
|
backgroundd_drawer: {
|
||||||
|
backgroundColor: '#000',
|
||||||
|
},
|
||||||
|
listbackground: {
|
||||||
|
},
|
||||||
|
actionButtonIcon: {
|
||||||
|
fontSize: 20,
|
||||||
|
height: 22,
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
welcome: {
|
||||||
|
fontSize: 20,
|
||||||
|
textAlign: 'center',
|
||||||
|
margin: 10,
|
||||||
|
},
|
||||||
|
instructions: {
|
||||||
|
textAlign: 'center',
|
||||||
|
color: '#333333',
|
||||||
|
marginBottom: 5,
|
||||||
|
},
|
||||||
|
dateText: {
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: responsiveWidth(13),
|
||||||
|
marginBottom: 20,
|
||||||
|
fontSize: 17,
|
||||||
|
},
|
||||||
|
titlecontent: {
|
||||||
|
fontSize: 17,
|
||||||
|
marginLeft: responsiveWidth(10),
|
||||||
|
|
||||||
|
color: 'black'
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
flex: 8
|
||||||
|
},
|
||||||
|
|
||||||
|
title: {
|
||||||
|
fontSize: 20,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginTop: 20,
|
||||||
|
color: 'black',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
},
|
||||||
|
});
|
|
@ -181,6 +181,7 @@ export default class OptionsMenu extends Component {
|
||||||
updateUser(user) {
|
updateUser(user) {
|
||||||
let menu = [];
|
let menu = [];
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
|
console.log("USER", user.category);
|
||||||
/* Navigation.mergeOptions("drawer", {
|
/* Navigation.mergeOptions("drawer", {
|
||||||
sideMenu: {
|
sideMenu: {
|
||||||
left: {
|
left: {
|
||||||
|
@ -257,7 +258,7 @@ export default class OptionsMenu extends Component {
|
||||||
|| item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser'
|
|| item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser'
|
||||||
|| item === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent'
|
|| item === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent'
|
||||||
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|
||||||
|| item === 'envoieCashVersCarteAgent') {
|
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit') {
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
||||||
|
|
|
@ -24,7 +24,7 @@ import Dialog from "react-native-dialog";
|
||||||
import { Typography } from '../../config/typography';
|
import { Typography } from '../../config/typography';
|
||||||
import * as Utils from '../../utils/DeviceUtils';
|
import * as Utils from '../../utils/DeviceUtils';
|
||||||
import { IlinkEmitter } from "../../utils/events";
|
import { IlinkEmitter } from "../../utils/events";
|
||||||
import { cutString, cutStringWithoutDot, isEmptyObject, transactionHistoryIlinkLabel, isIlinkWorldWallet, optionDepotScreen, optionIdentificationScreen, optionPaiementFacture, optionRetraitScreen, transactionHistoryLabel } from '../../utils/UtilsFunction';
|
import { cutString, cutStringWithoutDot, isEmptyObject, transactionHistoryIlinkLabel, isIlinkWorldWallet, optionDepotScreen, optionIdentificationScreen, optionPaiementFacture, optionRetraitScreen, transactionHistoryLabel, optionNanoCreditScreen } from '../../utils/UtilsFunction';
|
||||||
import { depositActionReset } from '../../webservice/DepositApi';
|
import { depositActionReset } from '../../webservice/DepositApi';
|
||||||
import { baseUrl } from '../../webservice/IlinkConstants';
|
import { baseUrl } from '../../webservice/IlinkConstants';
|
||||||
import { getWalletDetailActivated, resetWalletListDetailReducer } from '../../webservice/WalletApi';
|
import { getWalletDetailActivated, resetWalletListDetailReducer } from '../../webservice/WalletApi';
|
||||||
|
@ -766,7 +766,18 @@ class WalletDetail extends Component {
|
||||||
<View style={[styles.containerTouch]}>
|
<View style={[styles.containerTouch]}>
|
||||||
|
|
||||||
<TouchableOpacity style={styles.contain}
|
<TouchableOpacity style={styles.contain}
|
||||||
onPress={() => { }}
|
onPress={
|
||||||
|
() => {
|
||||||
|
this.props.navigation.push(route.walletOptionSelect, {
|
||||||
|
optionSelect: optionNanoCreditScreen,
|
||||||
|
wallet,
|
||||||
|
lottie: {
|
||||||
|
source: require("./../../datas/json/cedit-cards.json"),
|
||||||
|
loop: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
activeOpacity={0.9}>
|
activeOpacity={0.9}>
|
||||||
|
|
||||||
<Icon name='cash-multiple'
|
<Icon name='cash-multiple'
|
||||||
|
|
|
@ -34,7 +34,7 @@ import 'moment/locale/en-nz'
|
||||||
import 'moment/locale/en-gb'
|
import 'moment/locale/en-gb'
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { thousandsSeparators, isEmptyObject, transactionHistoryUser, optionDepotUserScreen, optionRetraitUserScreen, transactionHistoryLabel, optionPaiementFacture, displayToast, transactionHistoryIlinkLabel, isIlinkWorldWallet, cutStringWithoutDot, cutString } from '../../utils/UtilsFunction';
|
import { thousandsSeparators, isEmptyObject, transactionHistoryUser, optionDepotUserScreen, optionRetraitUserScreen, transactionHistoryLabel, optionPaiementFacture, displayToast, transactionHistoryIlinkLabel, isIlinkWorldWallet, cutStringWithoutDot, cutString, optionIdentificationUserScreen, optionNanoCreditScreen } from '../../utils/UtilsFunction';
|
||||||
import DeviceInfo from 'react-native-device-info';
|
import DeviceInfo from 'react-native-device-info';
|
||||||
import { readUser } from '../../webservice/AuthApi';
|
import { readUser } from '../../webservice/AuthApi';
|
||||||
const thousands = require('thousands');
|
const thousands = require('thousands');
|
||||||
|
@ -478,9 +478,18 @@ class WalletDetailUser extends Component {
|
||||||
<View style={[styles.containerTouch]}>
|
<View style={[styles.containerTouch]}>
|
||||||
|
|
||||||
<TouchableOpacity style={styles.contain}
|
<TouchableOpacity style={styles.contain}
|
||||||
onPress={() => {
|
onPress={
|
||||||
|
() => {
|
||||||
}}
|
this.props.navigation.push(route.walletOptionSelect, {
|
||||||
|
optionSelect: optionNanoCreditScreen,
|
||||||
|
wallet,
|
||||||
|
lottie: {
|
||||||
|
source: require("./../../datas/json/cedit-cards.json"),
|
||||||
|
loop: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
activeOpacity={0.9}>
|
activeOpacity={0.9}>
|
||||||
|
|
||||||
<Icon name='cash-multiple'
|
<Icon name='cash-multiple'
|
||||||
|
@ -490,18 +499,16 @@ class WalletDetailUser extends Component {
|
||||||
|
|
||||||
<View style={[styles.content]}>
|
<View style={[styles.content]}>
|
||||||
|
|
||||||
<View style={styles.contentTitle}>
|
|
||||||
<Text style={[Typography.headline, Typography.semibold]}>
|
<View style={[styles.content]}>
|
||||||
{I18n.t('NANO_CREDIT')}
|
|
||||||
</Text>
|
<View style={{ paddingTop: 20, }}>
|
||||||
|
<Text style={[Typography.headline, Typography.semibold]}>
|
||||||
|
{I18n.t('NANO_CREDIT')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={{ flex: 1 }}>
|
|
||||||
<Text style={[Typography.overline, Color.grayColor], { paddingVertical: 5 }} numberOfLines={5}>
|
|
||||||
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
@ -515,21 +522,14 @@ class WalletDetailUser extends Component {
|
||||||
color={Color.primaryColor}
|
color={Color.primaryColor}
|
||||||
size={30}
|
size={30}
|
||||||
style={styles.imageBanner} />
|
style={styles.imageBanner} />
|
||||||
|
|
||||||
<View style={[styles.content]}>
|
<View style={[styles.content]}>
|
||||||
|
|
||||||
<View style={styles.contentTitle}>
|
<View style={{ paddingTop: 20, }}>
|
||||||
<Text style={[Typography.headline, Typography.semibold]}>
|
<Text style={[Typography.headline, Typography.semibold]}>
|
||||||
{I18n.t('NANO_SANTE')}
|
{I18n.t('NANO_SANTE')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={{ flex: 1 }}>
|
|
||||||
<Text numberOfLines={1} style={[Typography.overline, Color.grayColor], { paddingVertical: 5 }} numberOfLines={5}>
|
|
||||||
{I18n.t('NANO_SANTE_DESCRIPTION')}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
@ -579,10 +579,19 @@ class WalletDetailUser extends Component {
|
||||||
|
|
||||||
<TouchableOpacity style={styles.contain}
|
<TouchableOpacity style={styles.contain}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!this.state.isIdentified)
|
/*if (!this.state.isIdentified)
|
||||||
this.props.navigation.push(route.createIdentificationUser)
|
this.props.navigation.push(route.createIdentificationUser)
|
||||||
else
|
else
|
||||||
displayToast(I18n.t('ALREADY_IDENTIFIED'))
|
displayToast(I18n.t('ALREADY_IDENTIFIED')); */
|
||||||
|
this.props.navigation.push(route.walletOptionSelect, {
|
||||||
|
optionSelect: optionIdentificationUserScreen,
|
||||||
|
lottie: {
|
||||||
|
source: require("./../../datas/json/identification.json"),
|
||||||
|
loop: true
|
||||||
|
},
|
||||||
|
isIdentified: this.props.resultUserIdentification.response.isIdentified
|
||||||
|
})
|
||||||
|
|
||||||
}}
|
}}
|
||||||
activeOpacity={0.9}>
|
activeOpacity={0.9}>
|
||||||
|
|
||||||
|
@ -593,7 +602,7 @@ class WalletDetailUser extends Component {
|
||||||
|
|
||||||
<View style={[styles.content]}>
|
<View style={[styles.content]}>
|
||||||
|
|
||||||
<View style={styles.contentTitle}>
|
<View style={{ paddingTop: 20, }}>
|
||||||
<Text style={[Typography.headline, Typography.semibold]}>
|
<Text style={[Typography.headline, Typography.semibold]}>
|
||||||
{I18n.t('CREATION_IDENTIFICATION_CLIENT')}
|
{I18n.t('CREATION_IDENTIFICATION_CLIENT')}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -612,8 +621,6 @@ class WalletDetailUser extends Component {
|
||||||
|
|
||||||
{this.renderHistoryTransaction(wallet)}
|
{this.renderHistoryTransaction(wallet)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { StyleSheet, View, Image, StatusBar, Alert, FlatList, TouchableOpacity, ActivityIndicator, Platform, ProgressBarAndroid, Text } from 'react-native';
|
import { StyleSheet, View, Image, StatusBar, Alert, FlatList, TouchableOpacity, ActivityIndicator, Platform, ProgressBarAndroid, Text } from 'react-native';
|
||||||
|
import { ActionSheetProvider, connectActionSheet } from '@expo/react-native-action-sheet'
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import { useActionSheet } from '@expo/react-native-action-sheet'
|
||||||
const route = require('./../../route.json');
|
const route = require('./../../route.json');
|
||||||
let slugify = require('slugify');
|
let slugify = require('slugify');
|
||||||
import I18n from 'react-native-i18n'
|
import I18n from 'react-native-i18n'
|
||||||
|
@ -11,12 +13,13 @@ import { baseUrl } from '../../webservice/IlinkConstants';
|
||||||
import { IlinkEmitter } from "../../utils/events";
|
import { IlinkEmitter } from "../../utils/events";
|
||||||
import { Provider, Appbar } from 'react-native-paper';
|
import { Provider, Appbar } from 'react-native-paper';
|
||||||
import { readUser } from '../../webservice/AuthApi';
|
import { readUser } from '../../webservice/AuthApi';
|
||||||
|
import _ from 'lodash';
|
||||||
import { FontWeight, Typography } from '../../config/typography';
|
import { FontWeight, Typography } from '../../config/typography';
|
||||||
import LottieView from 'lottie-react-native';
|
import LottieView from 'lottie-react-native';
|
||||||
import { isIlinkWorldWallet, optionDepotScreen, optionPaiementFactureSubScreen } from '../../utils/UtilsFunction';
|
import { isIlinkWorldWallet, optionDepotScreen, optionPaiementFactureSubScreen, displayToast } from '../../utils/UtilsFunction';
|
||||||
import chunk from 'lodash/chunk';
|
import chunk from 'lodash/chunk';
|
||||||
|
|
||||||
export default class WalletOptionSelect extends Component {
|
class WalletOptionSelect extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -29,6 +32,7 @@ export default class WalletOptionSelect extends Component {
|
||||||
wallet: this.props.navigation.state.params.wallet,
|
wallet: this.props.navigation.state.params.wallet,
|
||||||
lottie: this.props.navigation.state.params.lottie,
|
lottie: this.props.navigation.state.params.lottie,
|
||||||
onGoBack: this.props.navigation.state.params.onGoBack,
|
onGoBack: this.props.navigation.state.params.onGoBack,
|
||||||
|
isIdentified: this.props.navigation.state.params.isIdentified || null,
|
||||||
}
|
}
|
||||||
console.log("WALLET OPTION PROPS", this.props);
|
console.log("WALLET OPTION PROPS", this.props);
|
||||||
|
|
||||||
|
@ -51,51 +55,84 @@ export default class WalletOptionSelect extends Component {
|
||||||
/>)
|
/>)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateLangue() {
|
updateLangue() {
|
||||||
this.props.navigation.setParams({ name: I18n.t('WALLET') })
|
this.props.navigation.setParams({ name: I18n.t('WALLET') })
|
||||||
this.forceUpdate()
|
this.forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToRoute = (options) => {
|
redirectToRoute = (optionsParam) => {
|
||||||
switch (this.state.type) {
|
|
||||||
case 'FACTURE':
|
|
||||||
this.props.navigation.push(options.screen, {
|
|
||||||
optionSelect: options.subScreenOption,
|
|
||||||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'DEPOT':
|
|
||||||
this.props.navigation.push(options.screen, {
|
|
||||||
optionSelect: options.subScreenOption,
|
|
||||||
wallet: this.state.wallet,
|
|
||||||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'DEPOT_USER':
|
|
||||||
this.props.navigation.push(options.screen, {
|
|
||||||
wallet: this.state.wallet,
|
|
||||||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
|
||||||
optionSelect: options.subScreenOption,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'RETRAIT':
|
|
||||||
this.props.navigation.push(options.screen, {
|
|
||||||
wallet: this.state.wallet,
|
|
||||||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'WALLET_TO_BANK':
|
|
||||||
this.props.navigation.push(options.screen, {
|
|
||||||
wallet: this.state.wallet,
|
|
||||||
optionSelect: options.subScreenOption,
|
|
||||||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
if (optionsParam.hasOwnProperty('hasSubMenu')) {
|
||||||
this.props.navigation.push(options.screen)
|
|
||||||
break;
|
let options = [];
|
||||||
|
for (let index = 0; index < optionsParam.subMenuOption.length; index++) {
|
||||||
|
options.push(optionsParam.subMenuOption[index].title);
|
||||||
|
}
|
||||||
|
const destructiveButtonIndex = 0;
|
||||||
|
const cancelButtonIndex = 2;
|
||||||
|
|
||||||
|
this.props.showActionSheetWithOptions(
|
||||||
|
{
|
||||||
|
options,
|
||||||
|
cancelButtonIndex,
|
||||||
|
destructiveButtonIndex,
|
||||||
|
},
|
||||||
|
buttonIndex => {
|
||||||
|
this.props.navigation.push(optionsParam.subMenuOption[buttonIndex].screen);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
console.log(this.props);
|
||||||
|
} else {
|
||||||
|
switch (this.state.type) {
|
||||||
|
case 'FACTURE':
|
||||||
|
this.props.navigation.push(optionsParam.screen, {
|
||||||
|
optionSelect: optionsParam.subScreenOption,
|
||||||
|
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'DEPOT':
|
||||||
|
this.props.navigation.push(optionsParam.screen, {
|
||||||
|
optionSelect: optionsParam.subScreenOption,
|
||||||
|
wallet: this.state.wallet,
|
||||||
|
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'DEPOT_USER':
|
||||||
|
this.props.navigation.push(optionsParam.screen, {
|
||||||
|
wallet: this.state.wallet,
|
||||||
|
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||||
|
optionSelect: optionsParam.subScreenOption,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'RETRAIT':
|
||||||
|
this.props.navigation.push(optionsParam.screen, {
|
||||||
|
wallet: this.state.wallet,
|
||||||
|
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'WALLET_TO_BANK':
|
||||||
|
this.props.navigation.push(optionsParam.screen, {
|
||||||
|
wallet: this.state.wallet,
|
||||||
|
optionSelect: optionsParam.subScreenOption,
|
||||||
|
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'NANO_CREDIT':
|
||||||
|
this.props.navigation.push(optionsParam.screen, {
|
||||||
|
wallet: this.state.wallet,
|
||||||
|
optionSelect: optionsParam.subScreenOption,
|
||||||
|
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.props.navigation.push(optionsParam.screen)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderItem = (options, isOneElement, index) => (
|
renderItem = (options, isOneElement, index) => (
|
||||||
|
@ -128,33 +165,53 @@ export default class WalletOptionSelect extends Component {
|
||||||
|
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</> :
|
</> :
|
||||||
<View style={[styles.containerTouch]}>
|
|
||||||
|
|
||||||
<TouchableOpacity style={styles.contain}
|
<>
|
||||||
onPress={() => {
|
<View style={[styles.containerTouch]}>
|
||||||
this.redirectToRoute(options);
|
|
||||||
}}
|
|
||||||
activeOpacity={0.9}>
|
|
||||||
|
|
||||||
<Icon name={options.icon}
|
<TouchableOpacity style={styles.contain}
|
||||||
color={Color.primaryColor}
|
onPress={() => {
|
||||||
size={30}
|
if (!_.isNil(this.state.isIdentified)) {
|
||||||
style={styles.imageBanner} />
|
console.log(options);
|
||||||
|
if (_.isEqual(options.screen, 'createIdentificationUser')) {
|
||||||
|
if (this.state.isIdentified)
|
||||||
|
displayToast(I18n.t('ALREADY_IDENTIFIED'));
|
||||||
|
else
|
||||||
|
this.redirectToRoute(options);
|
||||||
|
}
|
||||||
|
else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
|
||||||
|
if (!this.state.isIdentified)
|
||||||
|
displayToast(I18n.t('NOT_YET_IDENTIFY'));
|
||||||
|
else
|
||||||
|
this.redirectToRoute(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.redirectToRoute(options);
|
||||||
|
|
||||||
<View style={[styles.content]}>
|
}}
|
||||||
|
activeOpacity={0.9}>
|
||||||
|
|
||||||
|
<Icon name={options.icon}
|
||||||
|
color={Color.primaryColor}
|
||||||
|
size={30}
|
||||||
|
style={styles.imageBanner} />
|
||||||
|
|
||||||
|
<View style={[styles.content]}>
|
||||||
|
|
||||||
|
<View style={styles.contentTitle}>
|
||||||
|
<Text style={[Typography.headline, Typography.semibold]}>
|
||||||
|
{options.title}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
</View>
|
||||||
|
|
||||||
<View style={styles.contentTitle}>
|
|
||||||
<Text style={[Typography.headline, Typography.semibold]}>
|
|
||||||
{options.title}
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
<View style={{ flex: 1 }}>
|
</View>
|
||||||
</View>
|
</>
|
||||||
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -201,7 +258,7 @@ export default class WalletOptionSelect extends Component {
|
||||||
<View style={[styles.checkDefault, { borderBottomColor: Color.borderColor }]}>
|
<View style={[styles.checkDefault, { borderBottomColor: Color.borderColor }]}>
|
||||||
<Text
|
<Text
|
||||||
style={[Typography.title3, Typography.semibold]}>
|
style={[Typography.title3, Typography.semibold]}>
|
||||||
{I18n.t('TRANSACTIONS')}
|
{I18n.t('OPERATIONS')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
|
@ -230,6 +287,7 @@ export default class WalletOptionSelect extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default connectActionSheet(WalletOptionSelect);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
|
|
@ -377,6 +377,76 @@ export const optionIdentificationScreen = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const optionIdentificationUserScreen = {
|
||||||
|
type: 'IDENTIFICATION',
|
||||||
|
title: I18n.t('IDENTIFICATION'),
|
||||||
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
screen: route.createIdentificationUser,
|
||||||
|
icon: 'pencil-plus',
|
||||||
|
title: I18n.t('CREATE_MY_IDENTIFICATION'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
screen: route.modifyIdentificationUser,
|
||||||
|
icon: 'pencil',
|
||||||
|
title: I18n.t('MODIFY_IDENTIFICATION'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
export const optionNanoCreditScreen = {
|
||||||
|
type: 'NANO_CREDIT',
|
||||||
|
title: I18n.t('NANO_CREDIT'),
|
||||||
|
subTitle: I18n.t('CHOOSE_OPTION'),
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
screen: route.createGroupNanoCredit,
|
||||||
|
icon: 'account-multiple',
|
||||||
|
title: I18n.t('MANAGE_GROUP'),
|
||||||
|
hasSubMenu: true,
|
||||||
|
subMenuOption: [
|
||||||
|
{
|
||||||
|
title: I18n.t('DELETE'),
|
||||||
|
screen: ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREATE'),
|
||||||
|
screen: route.createGroupNanoCredit
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('JOIN'),
|
||||||
|
screen: ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('VALIDATE'),
|
||||||
|
screen: route.groupNanoCredit
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
/* {
|
||||||
|
screen: "",
|
||||||
|
icon: 'account-multiple-plus',
|
||||||
|
title: I18n.t('JOIN_GROUP'),
|
||||||
|
}, */
|
||||||
|
{
|
||||||
|
screen: "",
|
||||||
|
icon: 'account-card-details',
|
||||||
|
title: I18n.t('OPEN_ACCOUNT'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
screen: "",
|
||||||
|
icon: 'cash',
|
||||||
|
title: I18n.t('MANAGE_CREDIT'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
screen: "",
|
||||||
|
icon: 'briefcase-edit',
|
||||||
|
title: I18n.t('MANAGE_SAVINGS'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
export const optionPaiementEauElectricite = {
|
export const optionPaiementEauElectricite = {
|
||||||
title: I18n.t('PAIEMENT_FACTURE'),
|
title: I18n.t('PAIEMENT_FACTURE'),
|
||||||
subTitle: I18n.t('CHOOSE_OPERATOR'),
|
subTitle: I18n.t('CHOOSE_OPERATOR'),
|
||||||
|
|
|
@ -101,6 +101,22 @@
|
||||||
"TRANSACTION_DETAIL": "Transaction detail",
|
"TRANSACTION_DETAIL": "Transaction detail",
|
||||||
"CODE_IBAN": "IBAN Code",
|
"CODE_IBAN": "IBAN Code",
|
||||||
"FEES_AND_TAXES": "Fees and taxes",
|
"FEES_AND_TAXES": "Fees and taxes",
|
||||||
|
"SUCCESS_CREATION_GROUP": "Creation information",
|
||||||
|
"ERROR_CREATION_GROUP": "Creation error",
|
||||||
|
"CREATE_GROUP": "Create group",
|
||||||
|
"MANAGE_GROUP": "Manage group",
|
||||||
|
"VALIDATION_DEMAND": "Validation request",
|
||||||
|
"DELETE_DEMAND": "Deletion request",
|
||||||
|
"GROUP_INFOS": "Fill in the group information",
|
||||||
|
"NOM_GROUP": "Group name",
|
||||||
|
"LIMIT_OF_CREDIT": "Credit limit",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_1": "iLink user code sponsor 1",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_2": "iLink user code sponsor 2",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_3": "iLink user code sponsor 3",
|
||||||
|
"JOIN_GROUP": "Join group",
|
||||||
|
"OPEN_ACCOUNT": "Open account",
|
||||||
|
"MANAGE_CREDIT": "Manage credit",
|
||||||
|
"MANAGE_SAVINGS": "Manage savings",
|
||||||
"INIT_COUNTRY": "Departure countryt",
|
"INIT_COUNTRY": "Departure countryt",
|
||||||
"FINAL_COUNTRY": "Arrival country",
|
"FINAL_COUNTRY": "Arrival country",
|
||||||
"INIT_AMOUNT": "Init amount",
|
"INIT_AMOUNT": "Init amount",
|
||||||
|
@ -138,6 +154,7 @@
|
||||||
"SELECT_YOUR_WALLET": "Select your wallet",
|
"SELECT_YOUR_WALLET": "Select your wallet",
|
||||||
"TRANSACTION_ID": "Transaction number",
|
"TRANSACTION_ID": "Transaction number",
|
||||||
"OPERATION": "Operation",
|
"OPERATION": "Operation",
|
||||||
|
"OPERATIONS": "Operations",
|
||||||
"TRANSACTIONS": "Transactions",
|
"TRANSACTIONS": "Transactions",
|
||||||
"TRANSACTION_HISTORY": "Transactions history",
|
"TRANSACTION_HISTORY": "Transactions history",
|
||||||
"HISTORY": "History",
|
"HISTORY": "History",
|
||||||
|
@ -262,6 +279,7 @@
|
||||||
"NETWORK_LOST": "Connection lost!",
|
"NETWORK_LOST": "Connection lost!",
|
||||||
"SHOW": "Show",
|
"SHOW": "Show",
|
||||||
"CALL": "Call",
|
"CALL": "Call",
|
||||||
|
"MODIFY": "Modify",
|
||||||
"FORGOTTEN_PASSWORD": "Forgot your password?",
|
"FORGOTTEN_PASSWORD": "Forgot your password?",
|
||||||
"CONNECT_USER": "Connect",
|
"CONNECT_USER": "Connect",
|
||||||
"PASSWORD": "Password",
|
"PASSWORD": "Password",
|
||||||
|
@ -348,15 +366,20 @@
|
||||||
"DELETE": "Delete",
|
"DELETE": "Delete",
|
||||||
"FREE": "Available",
|
"FREE": "Available",
|
||||||
"SAVED": "Registered",
|
"SAVED": "Registered",
|
||||||
|
"CREATE": "Create",
|
||||||
|
"JOIN": "Join",
|
||||||
"PROFILE_PICTURE": "Profile picture",
|
"PROFILE_PICTURE": "Profile picture",
|
||||||
"FRONT_FACE_CB": "CB front side",
|
"FRONT_FACE_CB": "CB front side",
|
||||||
"BACK_FACE_CB": "CB back side",
|
"BACK_FACE_CB": "CB back side",
|
||||||
"PREVISUALISATION": "Preview",
|
"PREVISUALISATION": "Preview",
|
||||||
"ACCOUNT_INFO": "My Account Information",
|
"ACCOUNT_INFO": "My Account Information",
|
||||||
"ALREADY_IDENTIFIED": "You are already identified",
|
"ALREADY_IDENTIFIED": "You are already identified",
|
||||||
|
"CREATE_MY_IDENTIFICATION": "Create my identification",
|
||||||
"NOT_IDENTIFIED": "This number exists, its identification is not yet entered",
|
"NOT_IDENTIFIED": "This number exists, its identification is not yet entered",
|
||||||
"NOT_VALIDATED": "Your identicaiton is not yet validated",
|
"NOT_VALIDATED": "Your identicaiton is not yet validated",
|
||||||
"ALREADY_VALIDATED": "The identification of this client has already been validated",
|
"ALREADY_VALIDATED": "The identification of this client has already been validated",
|
||||||
|
"MODIFY_IDENTIFICATION": "Modify my identification",
|
||||||
|
"NOT_YET_IDENTIFY": "You are not yet identified",
|
||||||
"IDENTIFICATION": " Identification",
|
"IDENTIFICATION": " Identification",
|
||||||
"CREATION_IDENTIFICATION": "Creation",
|
"CREATION_IDENTIFICATION": "Creation",
|
||||||
"CREATION_IDENTIFICATION_CLIENT": "Identify me",
|
"CREATION_IDENTIFICATION_CLIENT": "Identify me",
|
||||||
|
|
|
@ -105,6 +105,22 @@
|
||||||
"ENVOIE_CASH_TO_CASH": "Envoie d'argent en cash vers cash",
|
"ENVOIE_CASH_TO_CASH": "Envoie d'argent en cash vers cash",
|
||||||
"TRANSACTION_DETAIL": "Détail de la transaction",
|
"TRANSACTION_DETAIL": "Détail de la transaction",
|
||||||
"FEES_AND_TAXES": "Frais et taxes",
|
"FEES_AND_TAXES": "Frais et taxes",
|
||||||
|
"CREATE_GROUP": "Créer un groupe",
|
||||||
|
"MANAGE_GROUP": "Gérer le groupe",
|
||||||
|
"VALIDATION_DEMAND": "Demandes de validation",
|
||||||
|
"DELETE_DEMAND": "Demande de suppression",
|
||||||
|
"GROUP_INFOS": "Renseigner les informations du groupe",
|
||||||
|
"SUCCESS_CREATION_GROUP": "Informations sur la création",
|
||||||
|
"ERROR_CREATION_GROUP": "Erreur de création",
|
||||||
|
"NOM_GROUP": "Nom du groupe",
|
||||||
|
"LIMIT_OF_CREDIT": "Limite du crédit",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2",
|
||||||
|
"CODE_USER_ILINK_SPONSOR_3": "Code utilisateur iLink Sponsor 3",
|
||||||
|
"JOIN_GROUP": "Adhérer à un groupe",
|
||||||
|
"OPEN_ACCOUNT": "Ouvrir un compte",
|
||||||
|
"MANAGE_CREDIT": "Gérer son crédit",
|
||||||
|
"MANAGE_SAVINGS": "Gérer son épargne",
|
||||||
"CODE_IBAN": "Code IBAN",
|
"CODE_IBAN": "Code IBAN",
|
||||||
"INIT_COUNTRY": "Pays de départ",
|
"INIT_COUNTRY": "Pays de départ",
|
||||||
"FINAL_COUNTRY": "Pays d'arrivée",
|
"FINAL_COUNTRY": "Pays d'arrivée",
|
||||||
|
@ -136,6 +152,7 @@
|
||||||
"COMMISSION_TRANSFER_ERROR_EMPTY": "Le solde commission est vide",
|
"COMMISSION_TRANSFER_ERROR_EMPTY": "Le solde commission est vide",
|
||||||
"TRANSACTION_ID": "Numéro de transaction",
|
"TRANSACTION_ID": "Numéro de transaction",
|
||||||
"OPERATION": "Opération",
|
"OPERATION": "Opération",
|
||||||
|
"OPERATIONS": "Opérations",
|
||||||
"TRANSACTIONS": "Transactions",
|
"TRANSACTIONS": "Transactions",
|
||||||
"TRANSACTION_HISTORY": "Historique des transactions",
|
"TRANSACTION_HISTORY": "Historique des transactions",
|
||||||
"HISTORY": "Historique",
|
"HISTORY": "Historique",
|
||||||
|
@ -268,6 +285,7 @@
|
||||||
"NETWORK_LOST": "Connexion perdue !",
|
"NETWORK_LOST": "Connexion perdue !",
|
||||||
"SHOW": "Afficher",
|
"SHOW": "Afficher",
|
||||||
"CALL": "Appeler",
|
"CALL": "Appeler",
|
||||||
|
"MODIFY": "Modifier",
|
||||||
"FORGOTTEN_PASSWORD": "Mots de passe oublié ?",
|
"FORGOTTEN_PASSWORD": "Mots de passe oublié ?",
|
||||||
"CONNECT_USER": "Se connecter",
|
"CONNECT_USER": "Se connecter",
|
||||||
"PASSWORD": "Mot de passe",
|
"PASSWORD": "Mot de passe",
|
||||||
|
@ -352,15 +370,20 @@
|
||||||
"DELETE": "Supprimer",
|
"DELETE": "Supprimer",
|
||||||
"FREE": "disponibles",
|
"FREE": "disponibles",
|
||||||
"SAVED": "enregistrés",
|
"SAVED": "enregistrés",
|
||||||
|
"CREATE": "Créer",
|
||||||
|
"JOIN": "Rejoindre",
|
||||||
"PROFILE_PICTURE": "Photo de profil",
|
"PROFILE_PICTURE": "Photo de profil",
|
||||||
"FRONT_FACE_CB": "Face avant CB",
|
"FRONT_FACE_CB": "Face avant CB",
|
||||||
"BACK_FACE_CB": "Face arrière CB",
|
"BACK_FACE_CB": "Face arrière CB",
|
||||||
"PREVISUALISATION": "Prévisualisation",
|
"PREVISUALISATION": "Prévisualisation",
|
||||||
"ACCOUNT_INFO": " Information sur mon compte",
|
"ACCOUNT_INFO": " Information sur mon compte",
|
||||||
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
|
"ALREADY_IDENTIFIED": "Vous êtes déjà identifié",
|
||||||
|
"CREATE_MY_IDENTIFICATION": "Créer mon identification",
|
||||||
"NOT_IDENTIFIED": "Ce numéro existe, son identification n'est pas encore saisi",
|
"NOT_IDENTIFIED": "Ce numéro existe, son identification n'est pas encore saisi",
|
||||||
"NOT_VALIDATED": "Votre identicaiton n'est pas encore validé",
|
"NOT_VALIDATED": "Votre identicaiton n'est pas encore validé",
|
||||||
"ALREADY_VALIDATED": "L'identification de ce client a déjà été validée",
|
"ALREADY_VALIDATED": "L'identification de ce client a déjà été validée",
|
||||||
|
"MODIFY_IDENTIFICATION": "Modifier mon identification",
|
||||||
|
"NOT_YET_IDENTIFY": "Vous n'êtes pas encore identifié",
|
||||||
"IDENTIFICATION": " Identification",
|
"IDENTIFICATION": " Identification",
|
||||||
"CREATION_IDENTIFICATION": "Création",
|
"CREATION_IDENTIFICATION": "Création",
|
||||||
"CREATION_IDENTIFICATION_CLIENT": "M'identifier",
|
"CREATION_IDENTIFICATION_CLIENT": "M'identifier",
|
||||||
|
|
|
@ -40,6 +40,40 @@ export const createIndentificationAction = (data) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const updateIndentificationAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchCreateIdentificationPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `${createIdentificationUrl}`,
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
},
|
||||||
|
data
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchCreateIdentificationSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error);
|
||||||
|
//dispatch(fetchCreateIdentificationError(error.message));
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchCreateIdentificationError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchCreateIdentificationError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchCreateIdentificationError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const createIndentificationResetAction = () => {
|
export const createIndentificationResetAction = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchCreateIdentificationReset());
|
dispatch(fetchCreateIdentificationReset());
|
||||||
|
|
|
@ -51,6 +51,8 @@ export const envoieCommissionUrl = testBaseUrl + '/walletService/transactions/il
|
||||||
export const idVerificationUrl = testBaseUrl + '/walletService/transactions/ilink/check_retraits';
|
export const idVerificationUrl = testBaseUrl + '/walletService/transactions/ilink/check_retraits';
|
||||||
|
|
||||||
export const linkCardUrl = testBaseUrl + '/walletService/identifications/rattach_card';
|
export const linkCardUrl = testBaseUrl + '/walletService/identifications/rattach_card';
|
||||||
|
export const groupUrl = testBaseUrl + '/walletService/groups';
|
||||||
|
export const saveOnesignalIds = testBaseUrl + '/notificationService/onesignal';
|
||||||
|
|
||||||
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
||||||
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
|
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import { fetchCreateGroupError, fetchCreateGroupPending, fetchCreateGroupReset, fetchCreateGroupSuccess } from "../redux/actions/NanoCreditAction";
|
||||||
|
import { store } from "../redux/store";
|
||||||
|
import { groupUrl } from "./IlinkConstants";
|
||||||
|
|
||||||
|
export const createGroupAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchCreateGroupPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `${groupUrl}`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchCreateGroupSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchCreateGroupError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchCreateGroupError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchCreateGroupError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createGroupReset = () => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchCreateGroupReset());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import { store } from "../redux/store";
|
||||||
|
import { saveOnesignalIds } from "./IlinkConstants";
|
||||||
|
import { fetchSaveOnesignalPlayerIdsPending, fetchSaveOnesignalPlayerIdsSuccess, fetchSaveOnesignalPlayerIdsError, fetchSaveOnesignalPlayerIdsReset } from "../redux/actions/NotificationAction";
|
||||||
|
|
||||||
|
export const saveOnesignalIdsAction = (isUser, data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchSaveOnesignalPlayerIdsPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: isUser ? `${saveOnesignalIds}/saveUser` : `${saveOnesignalIds}/saveAgent`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchSaveOnesignalPlayerIdsSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchSaveOnesignalPlayerIdsError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchSaveOnesignalPlayerIdsError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchSaveOnesignalPlayerIdsError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const saveOnesignalIdsReset = () => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchSaveOnesignalPlayerIdsReset());
|
||||||
|
}
|
||||||
|
}
|
23
yarn.lock
23
yarn.lock
|
@ -690,6 +690,14 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/hammerjs" "^2.0.36"
|
"@types/hammerjs" "^2.0.36"
|
||||||
|
|
||||||
|
"@expo/react-native-action-sheet@^3.8.0":
|
||||||
|
version "3.8.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@expo/react-native-action-sheet/-/react-native-action-sheet-3.8.0.tgz#0db8b70ea8550ceb2983abda8584efa3a61d7389"
|
||||||
|
integrity sha512-tCfwysuqy0sfaN+aA98IKUrwCLKsbDHSYLcnHrx9wNbawOHNez8rSeFtieAS48/HyrPI75yg/ZGvxe6UsJRS8Q==
|
||||||
|
dependencies:
|
||||||
|
"@types/hoist-non-react-statics" "^3.3.1"
|
||||||
|
hoist-non-react-statics "^3.3.0"
|
||||||
|
|
||||||
"@hapi/address@2.x.x":
|
"@hapi/address@2.x.x":
|
||||||
version "2.1.4"
|
version "2.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"
|
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"
|
||||||
|
@ -1056,6 +1064,14 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.36.tgz#17ce0a235e9ffbcdcdf5095646b374c2bf615a4c"
|
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.36.tgz#17ce0a235e9ffbcdcdf5095646b374c2bf615a4c"
|
||||||
integrity sha512-7TUK/k2/QGpEAv/BCwSHlYu3NXZhQ9ZwBYpzr9tjlPIL2C5BeGhH3DmVavRx3ZNyELX5TLC91JTz/cen6AAtIQ==
|
integrity sha512-7TUK/k2/QGpEAv/BCwSHlYu3NXZhQ9ZwBYpzr9tjlPIL2C5BeGhH3DmVavRx3ZNyELX5TLC91JTz/cen6AAtIQ==
|
||||||
|
|
||||||
|
"@types/hoist-non-react-statics@^3.3.1":
|
||||||
|
version "3.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
|
||||||
|
integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==
|
||||||
|
dependencies:
|
||||||
|
"@types/react" "*"
|
||||||
|
hoist-non-react-statics "^3.3.0"
|
||||||
|
|
||||||
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
|
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
|
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
|
||||||
|
@ -6599,6 +6615,13 @@ react-native-modal@^9.0.0:
|
||||||
prop-types "^15.6.2"
|
prop-types "^15.6.2"
|
||||||
react-native-animatable "^1.2.4"
|
react-native-animatable "^1.2.4"
|
||||||
|
|
||||||
|
react-native-onesignal@^3.9.0:
|
||||||
|
version "3.9.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-native-onesignal/-/react-native-onesignal-3.9.0.tgz#8f67a8f3c95096adcd179db556cc2838afead914"
|
||||||
|
integrity sha512-Ux2S+MlPb6+RUg1clmgUcwHIM4XhF0DrZTWcrBPxue3PJkuoIhtsNbxbQJA9fGSNeAMHScxr2RTofuVDp2puSw==
|
||||||
|
dependencies:
|
||||||
|
invariant "^2.2.2"
|
||||||
|
|
||||||
react-native-paper@^2.16.0:
|
react-native-paper@^2.16.0:
|
||||||
version "2.16.0"
|
version "2.16.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-2.16.0.tgz#5a9edd5615bb010ec0d29cbfd5524c2944b2505d"
|
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-2.16.0.tgz#5a9edd5615bb010ec0d29cbfd5524c2944b2505d"
|
||||||
|
|
Loading…
Reference in New Issue