resolution du bug lier au bouton retour de credit management lors de la connection en tant que agent
This commit is contained in:
parent
78f21b52f4
commit
ce4897eaa2
|
@ -8,8 +8,8 @@
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
# org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
|
||||||
org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/Contents/Home
|
# org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/Contents/Home
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
|
447
app/App.js
447
app/App.js
|
@ -7,39 +7,39 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {ActionSheetProvider} from '@expo/react-native-action-sheet'
|
import {ActionSheetProvider} from '@expo/react-native-action-sheet';
|
||||||
import {AsyncStorage, Platform, StyleSheet, Text} from 'react-native';
|
import {AsyncStorage, Platform, StyleSheet, Text} from 'react-native';
|
||||||
import {
|
import {
|
||||||
createAppContainer,
|
createAppContainer,
|
||||||
createBottomTabNavigator,
|
createBottomTabNavigator,
|
||||||
createDrawerNavigator,
|
createDrawerNavigator,
|
||||||
createStackNavigator,
|
createStackNavigator,
|
||||||
createSwitchNavigator
|
createSwitchNavigator,
|
||||||
} from 'react-navigation';
|
} from 'react-navigation';
|
||||||
import OneSignal from 'react-native-onesignal';
|
import OneSignal from 'react-native-onesignal';
|
||||||
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';
|
||||||
import Help from "./screens/help/Help";
|
import Help from './screens/help/Help';
|
||||||
import ForgottenPassword from "./screens/login/ForgottenPassword";
|
import ForgottenPassword from './screens/login/ForgottenPassword';
|
||||||
import TypeChoiser from "./screens/login/TypeChoiser";
|
import TypeChoiser from './screens/login/TypeChoiser';
|
||||||
import CreateUserStep2 from "./screens/login/createUserStep2";
|
import CreateUserStep2 from './screens/login/createUserStep2';
|
||||||
import createAccount from "./screens/login/createAccount";
|
import createAccount from './screens/login/createAccount';
|
||||||
import UpdateInformations from "./screens/account/UpdateInformations";
|
import UpdateInformations from './screens/account/UpdateInformations';
|
||||||
import UserAccount from "./screens/account/UserAccount";
|
import UserAccount from './screens/account/UserAccount';
|
||||||
import ActivateAccount from "./screens/login/ActivateAccount";
|
import ActivateAccount from './screens/login/ActivateAccount';
|
||||||
import Notifications from "./screens/notifications/Notifications";
|
import Notifications from './screens/notifications/Notifications';
|
||||||
import About from "./screens/configurations/About";
|
import About from './screens/configurations/About';
|
||||||
import Configurations from "./screens/configurations/Configurations";
|
import Configurations from './screens/configurations/Configurations';
|
||||||
import OptionsMenu from "./screens/optionMenu/OptionsMenu";
|
import OptionsMenu from './screens/optionMenu/OptionsMenu';
|
||||||
import Home from "./screens/home/Home";
|
import Home from './screens/home/Home';
|
||||||
import HistoryItemDetails from "./screens/history-request/HistoryItemDetails";
|
import HistoryItemDetails from './screens/history-request/HistoryItemDetails';
|
||||||
import SuperViseurGroupeHome from "./screens/groupes/SuperViseurGroupeHome";
|
import SuperViseurGroupeHome from './screens/groupes/SuperViseurGroupeHome';
|
||||||
import HistoryRequester from "./screens/history-request/HistoryRequester";
|
import HistoryRequester from './screens/history-request/HistoryRequester';
|
||||||
import AddNetwork from "./screens/account/AddNetwork";
|
import AddNetwork from './screens/account/AddNetwork';
|
||||||
import MyHistory from "./screens/history-request/MyHistory";
|
import MyHistory from './screens/history-request/MyHistory';
|
||||||
import Icon from "react-native-vector-icons/FontAwesome5";
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import I18n from "react-native-i18n";
|
import I18n from 'react-native-i18n';
|
||||||
|
|
||||||
import WalletDetail from './screens/wallet/WalletDetail';
|
import WalletDetail from './screens/wallet/WalletDetail';
|
||||||
import WalletSelect from './screens/wallet/WalletSelect';
|
import WalletSelect from './screens/wallet/WalletSelect';
|
||||||
|
@ -81,28 +81,27 @@ import CautionNanoCreditAgent from './screens/nano-credit/CautionNanoCreditAgent
|
||||||
import EpargnerArgentUser from './screens/nano-credit/EpargnerArgentUser';
|
import EpargnerArgentUser from './screens/nano-credit/EpargnerArgentUser';
|
||||||
import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser';
|
import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser';
|
||||||
import {IlinkEmitter} from './utils/events';
|
import {IlinkEmitter} from './utils/events';
|
||||||
import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent";
|
import EnvoieWalletToBankAgent from './screens/wallet/agent/EnvoieWalletToBankAgent';
|
||||||
import ReattachAccountUser from "./screens/wallet/user/ReattachAccountUser";
|
import ReattachAccountUser from './screens/wallet/user/ReattachAccountUser';
|
||||||
import InsuranceSubscriptionScreen from "./screens/wallet/user/InsuranceSubscriptionScreen";
|
import InsuranceSubscriptionScreen from './screens/wallet/user/InsuranceSubscriptionScreen';
|
||||||
import AddBeneficiaryScreen from "./screens/wallet/user/AddBeneficiaryScreen";
|
import AddBeneficiaryScreen from './screens/wallet/user/AddBeneficiaryScreen';
|
||||||
import ActivateBuySubscriptionScreen from "./screens/wallet/user/ActivateBuySubscriptionScreen";
|
import ActivateBuySubscriptionScreen from './screens/wallet/user/ActivateBuySubscriptionScreen';
|
||||||
import SaisirFeuilleSoinScreen from "./screens/wallet/agent/SaisirFeuilleSoinScreen";
|
import SaisirFeuilleSoinScreen from './screens/wallet/agent/SaisirFeuilleSoinScreen';
|
||||||
import ValidateConsultationScreen from "./screens/wallet/user/ValidateConsultationScreen";
|
import ValidateConsultationScreen from './screens/wallet/user/ValidateConsultationScreen';
|
||||||
import ValidateConsultationDetailScreen from "./screens/wallet/user/ValidateConsultationDetailScreen";
|
import ValidateConsultationDetailScreen from './screens/wallet/user/ValidateConsultationDetailScreen';
|
||||||
import ExecuterPrescriptionScreen from "./screens/wallet/agent/ExecuterPrescriptionScreen";
|
import ExecuterPrescriptionScreen from './screens/wallet/agent/ExecuterPrescriptionScreen';
|
||||||
import ModifierFeuilleSoinScreen from "./screens/wallet/agent/ModifierFeuilleSoinScreen";
|
import ModifierFeuilleSoinScreen from './screens/wallet/agent/ModifierFeuilleSoinScreen';
|
||||||
import ModifierExecutionPrescriptionScreen from "./screens/wallet/agent/ModifierExecutionPrescriptionScreen";
|
import ModifierExecutionPrescriptionScreen from './screens/wallet/agent/ModifierExecutionPrescriptionScreen';
|
||||||
import HistoriqueNanoSanteUserScreen from "./screens/wallet/user/HistoriqueNanoSanteUserScreen";
|
import HistoriqueNanoSanteUserScreen from './screens/wallet/user/HistoriqueNanoSanteUserScreen';
|
||||||
import DemandeAutorisationSoinScreen from "./screens/wallet/user/DemandeAutorisationSoinScreen";
|
import DemandeAutorisationSoinScreen from './screens/wallet/user/DemandeAutorisationSoinScreen';
|
||||||
import DeleteBeneficiaryScreen from "./screens/wallet/user/DeleteBeneficiaryScreen";
|
import DeleteBeneficiaryScreen from './screens/wallet/user/DeleteBeneficiaryScreen';
|
||||||
import StopSubscriptionScreen from "./screens/wallet/user/StopSubscriptionScreen";
|
import StopSubscriptionScreen from './screens/wallet/user/StopSubscriptionScreen';
|
||||||
import RenewAssuranceScreen from "./screens/wallet/user/RenewAssuranceScreen";
|
import RenewAssuranceScreen from './screens/wallet/user/RenewAssuranceScreen';
|
||||||
import WebviewScreen from "./screens/WebviewScreen";
|
import WebviewScreen from './screens/WebviewScreen';
|
||||||
import HistoriqueNanoSanteAgentScreen from "./screens/wallet/agent/HistoriqueNanoSanteAgentScreen";
|
import HistoriqueNanoSanteAgentScreen from './screens/wallet/agent/HistoriqueNanoSanteAgentScreen';
|
||||||
import HistoriqueNanoSanteSuperHyperScreen from "./screens/wallet/agent/HistoriqueNanoSanteSuperHyperScreen";
|
import HistoriqueNanoSanteSuperHyperScreen from './screens/wallet/agent/HistoriqueNanoSanteSuperHyperScreen';
|
||||||
import PDFViewerScreen from "./screens/PdfViewerScreen";
|
import PDFViewerScreen from './screens/PdfViewerScreen';
|
||||||
import UbaFormScreen from "./screens/wallet/user/UbaForm";
|
import UbaFormScreen from './screens/wallet/user/UbaForm';
|
||||||
|
|
||||||
|
|
||||||
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',
|
||||||
|
@ -111,9 +110,10 @@ const instructions = Platform.select({
|
||||||
'Shake or press menu button for dev menu',
|
'Shake or press menu button for dev menu',
|
||||||
});
|
});
|
||||||
|
|
||||||
const theme = require("./utils/theme")
|
const theme = require('./utils/theme');
|
||||||
|
|
||||||
const AuthStack = createStackNavigator({
|
const AuthStack = createStackNavigator(
|
||||||
|
{
|
||||||
login: Connect,
|
login: Connect,
|
||||||
helpMenu: HelpMenu,
|
helpMenu: HelpMenu,
|
||||||
help: Help,
|
help: Help,
|
||||||
|
@ -121,12 +121,14 @@ const AuthStack = createStackNavigator({
|
||||||
typeaccountcreate: TypeChoiser,
|
typeaccountcreate: TypeChoiser,
|
||||||
simpleusercreate: createAccount,
|
simpleusercreate: createAccount,
|
||||||
step2: CreateUserStep2,
|
step2: CreateUserStep2,
|
||||||
activateaccout: ActivateAccount
|
activateaccout: ActivateAccount,
|
||||||
|
},
|
||||||
}, {
|
{
|
||||||
headerMode: 'none'
|
headerMode: 'none',
|
||||||
})
|
},
|
||||||
const AppStack = createDrawerNavigator({
|
);
|
||||||
|
const AppStack = createDrawerNavigator(
|
||||||
|
{
|
||||||
sta: createStackNavigator({
|
sta: createStackNavigator({
|
||||||
home: Home,
|
home: Home,
|
||||||
/* filtre:Filter,
|
/* filtre:Filter,
|
||||||
|
@ -149,30 +151,48 @@ const AppStack = createDrawerNavigator({
|
||||||
envoieWalletToCashUser: EnvoieWalletToCashUser,
|
envoieWalletToCashUser: EnvoieWalletToCashUser,
|
||||||
envoieWalletToCardUser: EnvoieWalletToCardUser,
|
envoieWalletToCardUser: EnvoieWalletToCardUser,
|
||||||
envoieWalletToBankUser: EnvoieWalletToBankUser,
|
envoieWalletToBankUser: EnvoieWalletToBankUser,
|
||||||
insuranceSubscriptionScreen: {screen: InsuranceSubscriptionScreen, navigationOptions: ()=> ({
|
insuranceSubscriptionScreen: {
|
||||||
|
screen: InsuranceSubscriptionScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('SUBSCRIBE_ASSURANCE'),
|
headerTitle: I18n.t('SUBSCRIBE_ASSURANCE'),
|
||||||
title: I18n.t('SUBSCRIBE_ASSURANCE'),
|
title: I18n.t('SUBSCRIBE_ASSURANCE'),
|
||||||
})},
|
}),
|
||||||
addBeneficiaryScreen: {screen: AddBeneficiaryScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
addBeneficiaryScreen: {
|
||||||
|
screen: AddBeneficiaryScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('ADD_SUBSCRIBE'),
|
headerTitle: I18n.t('ADD_SUBSCRIBE'),
|
||||||
title: I18n.t('ADD_SUBSCRIBE'),
|
title: I18n.t('ADD_SUBSCRIBE'),
|
||||||
})},
|
}),
|
||||||
activateBuySubscriptionScreen: {screen: ActivateBuySubscriptionScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
activateBuySubscriptionScreen: {
|
||||||
|
screen: ActivateBuySubscriptionScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('ACTIVATE_INSSURANCE'),
|
headerTitle: I18n.t('ACTIVATE_INSSURANCE'),
|
||||||
title: I18n.t('ACTIVATE_INSSURANCE'),
|
title: I18n.t('ACTIVATE_INSSURANCE'),
|
||||||
})},
|
}),
|
||||||
renewAssuranceScreen: {screen: RenewAssuranceScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
renewAssuranceScreen: {
|
||||||
|
screen: RenewAssuranceScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('RENEW_INSSURANCE'),
|
headerTitle: I18n.t('RENEW_INSSURANCE'),
|
||||||
title: I18n.t('RENEW_INSSURANCE'),
|
title: I18n.t('RENEW_INSSURANCE'),
|
||||||
})},
|
}),
|
||||||
deleteBeneficiaryScreen: {screen: DeleteBeneficiaryScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
deleteBeneficiaryScreen: {
|
||||||
|
screen: DeleteBeneficiaryScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('DELETE_SUBSCRIBE'),
|
headerTitle: I18n.t('DELETE_SUBSCRIBE'),
|
||||||
title: I18n.t('DELETE_SUBSCRIBE'),
|
title: I18n.t('DELETE_SUBSCRIBE'),
|
||||||
})},
|
}),
|
||||||
stopSubscriptionScreen: {screen: StopSubscriptionScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
stopSubscriptionScreen: {
|
||||||
|
screen: StopSubscriptionScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('STOP_SUBSCRIBE'),
|
headerTitle: I18n.t('STOP_SUBSCRIBE'),
|
||||||
title: I18n.t('STOP_SUBSCRIBE'),
|
title: I18n.t('STOP_SUBSCRIBE'),
|
||||||
})},
|
}),
|
||||||
|
},
|
||||||
validateConsultationScreen: ValidateConsultationScreen,
|
validateConsultationScreen: ValidateConsultationScreen,
|
||||||
validateConsultationDetailScreen: ValidateConsultationDetailScreen,
|
validateConsultationDetailScreen: ValidateConsultationDetailScreen,
|
||||||
historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen,
|
historiqueNanoSanteUserScreen: HistoriqueNanoSanteUserScreen,
|
||||||
|
@ -184,35 +204,41 @@ const AppStack = createDrawerNavigator({
|
||||||
epargnerArgentUser: EpargnerArgentUser,
|
epargnerArgentUser: EpargnerArgentUser,
|
||||||
createGroupNanoCredit: CreateGroupNanoCredit,
|
createGroupNanoCredit: CreateGroupNanoCredit,
|
||||||
groupNanoCredit: {
|
groupNanoCredit: {
|
||||||
screen: createBottomTabNavigator({
|
screen: createBottomTabNavigator(
|
||||||
|
{
|
||||||
demandeValidationGroupe: {
|
demandeValidationGroupe: {
|
||||||
screen: DemandValidationGroup,
|
screen: DemandValidationGroup,
|
||||||
navigationOptions: {
|
navigationOptions: {
|
||||||
tabBarLabel: I18n.t('DEMAND_VALIDATION_GROUP_RECEIVE'),
|
tabBarLabel: I18n.t('DEMAND_VALIDATION_GROUP_RECEIVE'),
|
||||||
tabBarIcon: ({focused, horizontal, tintColor}) => {
|
tabBarIcon: ({focused, horizontal, tintColor}) => {
|
||||||
return (<Icon
|
return (
|
||||||
|
<Icon
|
||||||
size={20}
|
size={20}
|
||||||
name={"users-cog"}
|
name={'users-cog'}
|
||||||
color={focused ? tintColor : "grey"}
|
color={focused ? tintColor : 'grey'}
|
||||||
/>)
|
/>
|
||||||
}
|
);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
myNanoCreditGroup: {
|
myNanoCreditGroup: {
|
||||||
screen: MyNanoCreditGroup,
|
screen: MyNanoCreditGroup,
|
||||||
navigationOptions: {
|
navigationOptions: {
|
||||||
tabBarLabel: I18n.t('MY_GROUP'),
|
tabBarLabel: I18n.t('MY_GROUP'),
|
||||||
tabBarIcon: ({focused, horizontal, tintColor}) => {
|
tabBarIcon: ({focused, horizontal, tintColor}) => {
|
||||||
return (<Icon
|
return (
|
||||||
|
<Icon
|
||||||
size={20}
|
size={20}
|
||||||
name={"users"}
|
name={'users'}
|
||||||
color={focused ? tintColor : "grey"}
|
color={focused ? tintColor : 'grey'}
|
||||||
/>)
|
/>
|
||||||
}
|
);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}, {
|
},
|
||||||
headerMode: "none",
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
title: I18n.t('MANAGE_GROUP'),
|
title: I18n.t('MANAGE_GROUP'),
|
||||||
|
@ -220,8 +246,9 @@ const AppStack = createDrawerNavigator({
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
navigationOptions: () => ({
|
navigationOptions: () => ({
|
||||||
header: null,
|
header: null,
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
|
@ -232,10 +259,8 @@ const AppStack = createDrawerNavigator({
|
||||||
|
|
||||||
drawerLabel: I18n.t('MANAGE_GROUP'),
|
drawerLabel: I18n.t('MANAGE_GROUP'),
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => (
|
||||||
<Icon
|
<Icon name={'account-multiple'} size={24} />
|
||||||
name={'account-multiple'}
|
),
|
||||||
size={24}
|
|
||||||
/>)
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
demandeValidationGroupe: DemandGroupNanoCreditDetail,
|
demandeValidationGroupe: DemandGroupNanoCreditDetail,
|
||||||
|
@ -245,22 +270,27 @@ const AppStack = createDrawerNavigator({
|
||||||
casserEpargneUser: CasserEpargneUser,
|
casserEpargneUser: CasserEpargneUser,
|
||||||
webviewScreen: WebviewScreen,
|
webviewScreen: WebviewScreen,
|
||||||
PDFViewerScreen: PDFViewerScreen,
|
PDFViewerScreen: PDFViewerScreen,
|
||||||
ubaFormScreen: {screen: UbaFormScreen, navigationOptions: ()=> ({
|
ubaFormScreen: {
|
||||||
|
screen: UbaFormScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('ENREGISTREMENT_UBA'),
|
headerTitle: I18n.t('ENREGISTREMENT_UBA'),
|
||||||
title: I18n.t('ENREGISTREMENT_UBA'),
|
title: I18n.t('ENREGISTREMENT_UBA'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
})},
|
}),
|
||||||
|
},
|
||||||
})
|
}),
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
contentComponent: OptionsMenu,
|
contentComponent: OptionsMenu,
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
contentOptions: {activeTintColor: theme.accent},
|
contentOptions: {activeTintColor: theme.accent},
|
||||||
})
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const AppAgentStack = createDrawerNavigator({
|
const AppAgentStack = createDrawerNavigator(
|
||||||
|
{
|
||||||
sta: createStackNavigator({
|
sta: createStackNavigator({
|
||||||
home: Home,
|
home: Home,
|
||||||
useraccount: UserAccount,
|
useraccount: UserAccount,
|
||||||
|
@ -268,19 +298,21 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
walletSelect: WalletSelect,
|
walletSelect: WalletSelect,
|
||||||
createIdentification: CreateIdentification,
|
createIdentification: CreateIdentification,
|
||||||
validateIdentification: ValidateIdentification,
|
validateIdentification: ValidateIdentification,
|
||||||
Historique:
|
Historique: {
|
||||||
|
screen: createBottomTabNavigator(
|
||||||
|
{myDemand: MyHistory},
|
||||||
{
|
{
|
||||||
screen: createBottomTabNavigator({myDemand: MyHistory}, {
|
headerMode: 'none',
|
||||||
headerMode: "none",
|
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: I18n.t('CREDIT_MANAGE'),
|
headerTitle: I18n.t('CREDIT_MANAGE'),
|
||||||
tabBarOptions: {
|
tabBarOptions: {
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: "bold"
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
navigationOptions: () => ({
|
navigationOptions: () => ({
|
||||||
header: null,
|
header: null,
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
|
@ -288,60 +320,74 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
activeColor: '#f0edf6',
|
activeColor: '#f0edf6',
|
||||||
inactiveColor: '#3e2465',
|
inactiveColor: '#3e2465',
|
||||||
barStyle: {backgroundColor: '#694fad'},
|
barStyle: {backgroundColor: '#694fad'},
|
||||||
/* headerLeft: (<HeaderBackButton />), */
|
// headerLeft: <HeaderBackButton />,
|
||||||
drawerLabel: I18n.t('CREDIT_MANAGE'),
|
drawerLabel: I18n.t('CREDIT_MANAGE'),
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => <Icon name={'credit-card'} size={24} />,
|
||||||
<Icon
|
|
||||||
name={'credit-card'}
|
|
||||||
size={24}
|
|
||||||
/>)
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
historyItemDetails: HistoryItemDetails,
|
historyItemDetails: HistoryItemDetails,
|
||||||
creditrequest: HistoryRequester,
|
creditrequest: HistoryRequester,
|
||||||
saisirFeuilleSoinScreen: {screen: SaisirFeuilleSoinScreen, navigationOptions: ()=> ({
|
saisirFeuilleSoinScreen: {
|
||||||
|
screen: SaisirFeuilleSoinScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('SAISIR_FEUILLE_SOIN'),
|
headerTitle: I18n.t('SAISIR_FEUILLE_SOIN'),
|
||||||
title: I18n.t('SAISIR_FEUILLE_SOIN'),
|
title: I18n.t('SAISIR_FEUILLE_SOIN'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
})},
|
}),
|
||||||
executerPrescriptionScreen: {screen: ExecuterPrescriptionScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
executerPrescriptionScreen: {
|
||||||
|
screen: ExecuterPrescriptionScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('EXECUTER_PRESCRIPTION'),
|
headerTitle: I18n.t('EXECUTER_PRESCRIPTION'),
|
||||||
title: I18n.t('EXECUTER_PRESCRIPTION'),
|
title: I18n.t('EXECUTER_PRESCRIPTION'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
})},
|
}),
|
||||||
modifierExecutionPrescriptionScreen: {screen: ModifierExecutionPrescriptionScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
modifierExecutionPrescriptionScreen: {
|
||||||
|
screen: ModifierExecutionPrescriptionScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('MODIFY_CONSULTATION'),
|
headerTitle: I18n.t('MODIFY_CONSULTATION'),
|
||||||
title: I18n.t('MODIFY_CONSULTATION'),
|
title: I18n.t('MODIFY_CONSULTATION'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
})},
|
}),
|
||||||
modifierFeuilleSoinScreen: {screen: ModifierFeuilleSoinScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
modifierFeuilleSoinScreen: {
|
||||||
|
screen: ModifierFeuilleSoinScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('MODIFY_EXECUTION'),
|
headerTitle: I18n.t('MODIFY_EXECUTION'),
|
||||||
title: I18n.t('MODIFY_EXECUTION'),
|
title: I18n.t('MODIFY_EXECUTION'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
})},
|
}),
|
||||||
demandeAutorisationSoinScreen: {screen: DemandeAutorisationSoinScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
demandeAutorisationSoinScreen: {
|
||||||
|
screen: DemandeAutorisationSoinScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('DEMAND_AUTORIZATION_HEALTH'),
|
headerTitle: I18n.t('DEMAND_AUTORIZATION_HEALTH'),
|
||||||
title: I18n.t('DEMAND_AUTORIZATION_HEALTH'),
|
title: I18n.t('DEMAND_AUTORIZATION_HEALTH'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
})},
|
}),
|
||||||
historiqueNanoSanteAgentScreen: {screen: HistoriqueNanoSanteAgentScreen, navigationOptions: ()=> ({
|
},
|
||||||
|
historiqueNanoSanteAgentScreen: {
|
||||||
|
screen: HistoriqueNanoSanteAgentScreen,
|
||||||
|
navigationOptions: () => ({
|
||||||
headerTitle: I18n.t('HISTORY'),
|
headerTitle: I18n.t('HISTORY'),
|
||||||
title: I18n.t('HISTORY'),
|
title: I18n.t('HISTORY'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
marginTop: 20
|
marginTop: 20,
|
||||||
|
},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
})},
|
|
||||||
addNetwork: AddNetwork,
|
addNetwork: AddNetwork,
|
||||||
updateinformation: UpdateInformations,
|
updateinformation: UpdateInformations,
|
||||||
notificationview: Notifications,
|
notificationview: Notifications,
|
||||||
|
@ -363,24 +409,31 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
createGroupNanoCredit: CreateGroupNanoCredit,
|
createGroupNanoCredit: CreateGroupNanoCredit,
|
||||||
cautionNanoCreditAgent: CautionNanoCreditAgent,
|
cautionNanoCreditAgent: CautionNanoCreditAgent,
|
||||||
PDFViewerScreen: PDFViewerScreen,
|
PDFViewerScreen: PDFViewerScreen,
|
||||||
})
|
}),
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
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,
|
||||||
useraccount: UserAccount,
|
useraccount: UserAccount,
|
||||||
walletSelect: WalletSelect,
|
walletSelect: WalletSelect,
|
||||||
Historique: {
|
Historique: {
|
||||||
screen: createBottomTabNavigator({
|
screen: createBottomTabNavigator(
|
||||||
myDemand: MyHistory, OthersDemand: MyHistory
|
{
|
||||||
}, {
|
myDemand: MyHistory,
|
||||||
headerMode: "none",
|
OthersDemand: MyHistory,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
title: I18n.t('CREDIT_MANAGE'),
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
@ -388,8 +441,9 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
navigationOptions: () => ({
|
navigationOptions: () => ({
|
||||||
header: null,
|
header: null,
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
|
@ -399,11 +453,7 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
barStyle: {backgroundColor: '#694fad'},
|
barStyle: {backgroundColor: '#694fad'},
|
||||||
|
|
||||||
drawerLabel: I18n.t('CREDIT_MANAGE'),
|
drawerLabel: I18n.t('CREDIT_MANAGE'),
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => <Icon name={'credit-card'} size={24} />,
|
||||||
<Icon
|
|
||||||
name={'credit-card'}
|
|
||||||
size={24}
|
|
||||||
/>)
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
creditrequest: HistoryRequester,
|
creditrequest: HistoryRequester,
|
||||||
|
@ -419,43 +469,43 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
historiqueNanoSanteSuperHyperScreen: HistoriqueNanoSanteSuperHyperScreen,
|
historiqueNanoSanteSuperHyperScreen: HistoriqueNanoSanteSuperHyperScreen,
|
||||||
webviewScreen: WebviewScreen,
|
webviewScreen: WebviewScreen,
|
||||||
PDFViewerScreen: PDFViewerScreen,
|
PDFViewerScreen: PDFViewerScreen,
|
||||||
|
}),
|
||||||
})
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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,
|
||||||
useraccount: UserAccount,
|
useraccount: UserAccount,
|
||||||
walletSelect: WalletSelect,
|
walletSelect: WalletSelect,
|
||||||
Historique: {
|
Historique: {
|
||||||
screen: createBottomTabNavigator({OthersDemand: MyHistory}, {
|
screen: createBottomTabNavigator(
|
||||||
headerMode: "none",
|
{OthersDemand: MyHistory},
|
||||||
|
{
|
||||||
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
title: I18n.t('CREDIT_MANAGE'),
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
tabBarOptions: {
|
tabBarOptions: {
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: "bold"
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
navigationOptions: () => ({
|
navigationOptions: () => ({
|
||||||
title: I18n.t('CREDIT_MANAGE'),
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
headerMode: "none",
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => <Icon name={'credit-card'} size={24} />,
|
||||||
<Icon
|
|
||||||
name={'credit-card'}
|
|
||||||
size={24}
|
|
||||||
/>)
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
creditrequest: HistoryRequester,
|
creditrequest: HistoryRequester,
|
||||||
|
@ -470,43 +520,45 @@ const AppSuperAdministrator = createDrawerNavigator({
|
||||||
historiqueNanoSanteSuperHyperScreen: HistoriqueNanoSanteSuperHyperScreen,
|
historiqueNanoSanteSuperHyperScreen: HistoriqueNanoSanteSuperHyperScreen,
|
||||||
webviewScreen: WebviewScreen,
|
webviewScreen: WebviewScreen,
|
||||||
PDFViewerScreen: PDFViewerScreen,
|
PDFViewerScreen: PDFViewerScreen,
|
||||||
|
}),
|
||||||
|
},
|
||||||
})
|
{
|
||||||
}, {
|
|
||||||
contentComponent: OptionsMenu,
|
contentComponent: OptionsMenu,
|
||||||
backBehavior: "none",
|
backBehavior: 'none',
|
||||||
headerMode: 'none'
|
headerMode: 'none',
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const AppNavigator = createSwitchNavigator({
|
const AppNavigator = createSwitchNavigator(
|
||||||
|
{
|
||||||
first: {
|
first: {
|
||||||
screen: SplashScreen
|
screen: SplashScreen,
|
||||||
},
|
},
|
||||||
App: AppStack,
|
App: AppStack,
|
||||||
AgentApp: AppAgentStack,
|
AgentApp: AppAgentStack,
|
||||||
adminApp: AppAdministratorStack,
|
adminApp: AppAdministratorStack,
|
||||||
supAdminApp: AppSuperAdministrator,
|
supAdminApp: AppSuperAdministrator,
|
||||||
Auth: AuthStack
|
Auth: AuthStack,
|
||||||
}, {
|
},
|
||||||
initialRouteName: 'first'
|
{
|
||||||
});
|
initialRouteName: 'first',
|
||||||
|
},
|
||||||
|
);
|
||||||
const AppContainer = createAppContainer(AppNavigator);
|
const AppContainer = createAppContainer(AppNavigator);
|
||||||
|
|
||||||
export default class App extends React.Component {
|
export default class App extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
console.log("APP PROPS", this.props);
|
console.log('APP PROPS', this.props);
|
||||||
global.appHasLoaded = false;
|
global.appHasLoaded = false;
|
||||||
//Remove this method to stop OneSignal Debugging
|
//Remove this method to stop OneSignal Debugging
|
||||||
OneSignal.setLogLevel(6, 0);
|
OneSignal.setLogLevel(6, 0);
|
||||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
IlinkEmitter.on('langueChange', this.updateLangue.bind(this));
|
||||||
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
|
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
|
||||||
OneSignal.init("ab02121a-ecec-424f-910a-2709ef85698d", {
|
OneSignal.init('ab02121a-ecec-424f-910a-2709ef85698d', {
|
||||||
kOSSettingsKeyAutoPrompt: false,
|
kOSSettingsKeyAutoPrompt: false,
|
||||||
kOSSettingsKeyInAppLaunchURL: false,
|
kOSSettingsKeyInAppLaunchURL: false,
|
||||||
kOSSettingsKeyInFocusDisplayOption: 2
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -519,7 +571,7 @@ export default class App extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLangue() {
|
updateLangue() {
|
||||||
this.forceUpdate()
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
_getOneSignalIds = () => {
|
_getOneSignalIds = () => {
|
||||||
|
@ -531,26 +583,25 @@ export default class App extends React.Component {
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
_saveOneSignalIds = async (ids) => {
|
_saveOneSignalIds = async ids => {
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.setItem('@config:onesignalIds', ids);
|
await AsyncStorage.setItem('@config:onesignalIds', ids);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
goToScreen = (routeName, params, isReset = true) => {
|
goToScreen = (routeName, params, isReset = true) => {
|
||||||
const {navigator} = this.refs;
|
const {navigator} = this.refs;
|
||||||
if (typeof navigator !== 'undefined') {
|
if (typeof navigator !== 'undefined') {
|
||||||
console.log("APP HAS LOADED", global.appHasLoaded);
|
console.log('APP HAS LOADED', global.appHasLoaded);
|
||||||
if (global.appHasLoaded) {
|
if (global.appHasLoaded) {
|
||||||
|
|
||||||
navigator.dispatch({
|
navigator.dispatch({
|
||||||
type: "Navigation/NAVIGATE",
|
type: 'Navigation/NAVIGATE',
|
||||||
routeName,
|
routeName,
|
||||||
params
|
params,
|
||||||
});
|
});
|
||||||
/* readUser().then((result) => {
|
/* readUser().then((result) => {
|
||||||
if (result === null || result === undefined) {
|
if (result === null || result === undefined) {
|
||||||
|
@ -571,30 +622,30 @@ export default class App extends React.Component {
|
||||||
}); */
|
}); */
|
||||||
} else {
|
} else {
|
||||||
navigator.dispatch({
|
navigator.dispatch({
|
||||||
type: "Navigation/NAVIGATE",
|
type: 'Navigation/NAVIGATE',
|
||||||
routeName: "first",
|
routeName: 'first',
|
||||||
params: {routeName, params}
|
params: {routeName, params},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleDeepLink = (openResult) => {
|
handleDeepLink = openResult => {
|
||||||
const data = openResult.notification.payload.additionalData;
|
const data = openResult.notification.payload.additionalData;
|
||||||
//const dataParse = data.replace("'", "\"");
|
//const dataParse = data.replace("'", "\"");
|
||||||
console.warn("HANDLE DEEP LINK", data);
|
console.warn('HANDLE DEEP LINK', data);
|
||||||
switch (data.screen) {
|
switch (data.screen) {
|
||||||
case 'historyItemDetails':
|
case 'historyItemDetails':
|
||||||
console.log("History Item");
|
console.log('History Item');
|
||||||
this.goToScreen(data.screen, {
|
this.goToScreen(data.screen, {
|
||||||
item: data.data
|
item: data.data,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log("Not History Item");
|
console.log('Not History Item');
|
||||||
this.goToScreen(data.screen, {
|
this.goToScreen(data.screen, {
|
||||||
id: data.data.id
|
id: data.data.id,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -616,17 +667,17 @@ export default class App extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onReceived(notification) {
|
onReceived(notification) {
|
||||||
console.log("Notification received: ", notification);
|
console.log('Notification received: ', notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened = (openResult) => {
|
onOpened = openResult => {
|
||||||
let data = openResult.notification.payload.additionalData;
|
let data = openResult.notification.payload.additionalData;
|
||||||
this.handleDeepLink(openResult);
|
this.handleDeepLink(openResult);
|
||||||
console.log('Message: ', openResult.notification.payload.body);
|
console.log('Message: ', openResult.notification.payload.body);
|
||||||
console.log('Data: ', openResult.notification.payload.additionalData);
|
console.log('Data: ', openResult.notification.payload.additionalData);
|
||||||
console.log('isActive: ', openResult.notification.isAppInFocus);
|
console.log('isActive: ', openResult.notification.isAppInFocus);
|
||||||
console.log('openResult: ', openResult);
|
console.log('openResult: ', openResult);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"modalhistoryfilter": "filterhistory",
|
"modalhistoryfilter": "filterhistory",
|
||||||
"superviseurgroup": "superviseurgroup",
|
"superviseurgroup": "superviseurgroup",
|
||||||
"historyItemDetails": "historyItemDetails",
|
"historyItemDetails": "historyItemDetails",
|
||||||
|
"myHistory": "MyHistory",
|
||||||
"forgotpass": "forgottenpass",
|
"forgotpass": "forgottenpass",
|
||||||
"confirmcode": "confirmcode",
|
"confirmcode": "confirmcode",
|
||||||
"creationstep2": "step2",
|
"creationstep2": "step2",
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
|
/* eslint-disable prettier/prettier */
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Alert, Image, ProgressBarAndroid, ScrollView, StatusBar, StyleSheet, Text, View} from 'react-native';
|
import {Alert, Image, ProgressBarAndroid, ScrollView, StatusBar, StyleSheet, Text, View} from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons';
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
||||||
import {deleteUser, readUser} from './../../webservice/AuthApi';
|
import {deleteUser, readUser} from './../../webservice/AuthApi';
|
||||||
import {getAgentNetworksList} from './../../webservice/NetworkApi'
|
import {getAgentNetworksList} from './../../webservice/NetworkApi';
|
||||||
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
||||||
import MapView, {Marker} from 'react-native-maps';
|
import MapView, {Marker} from 'react-native-maps';
|
||||||
import * as Utils from '../../utils/DeviceUtils';
|
import * as Utils from '../../utils/DeviceUtils';
|
||||||
import CardView from "react-native-cardview";
|
import CardView from 'react-native-cardview';
|
||||||
import I18n from 'react-native-i18n'
|
import I18n from 'react-native-i18n';
|
||||||
import {IlinkEmitter} from "../../utils/events";
|
import {IlinkEmitter} from '../../utils/events';
|
||||||
import {Card, CardAction, CardButton, CardContent, CardTitle} from 'react-native-material-cards'
|
import {Card, CardAction, CardButton, CardContent, CardTitle} from 'react-native-material-cards';
|
||||||
import {Color} from '../../config/Color';
|
import {Color} from '../../config/Color';
|
||||||
import Fontisto from "react-native-vector-icons/Fontisto";
|
import Fontisto from 'react-native-vector-icons/Fontisto';
|
||||||
|
|
||||||
let theme = require('./../../utils/theme.json');
|
let theme = require('./../../utils/theme.json');
|
||||||
let route = require('../../route.json');
|
let route = require('../../route.json');
|
||||||
|
|
||||||
require('./../../utils/Translations')
|
require('./../../utils/Translations');
|
||||||
const height = responsiveHeight(100) - 250;
|
const height = responsiveHeight(100) - 250;
|
||||||
/*
|
/*
|
||||||
var Fabric = require('react-native-fabric');
|
var Fabric = require('react-native-fabric');
|
||||||
|
@ -36,10 +38,10 @@ export default class UserAccount extends Component {
|
||||||
headerTitle: I18n.t('USER_ACCOUNT'),
|
headerTitle: I18n.t('USER_ACCOUNT'),
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
backgroundColor: theme.primary,
|
backgroundColor: theme.primary,
|
||||||
paddingTop: 10
|
paddingTop: 10,
|
||||||
},
|
},
|
||||||
headerTitleStyle: {
|
headerTitleStyle: {
|
||||||
color: "white"
|
color: 'white',
|
||||||
},
|
},
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => (
|
||||||
<Icon
|
<Icon
|
||||||
|
@ -47,7 +49,7 @@ export default class UserAccount extends Component {
|
||||||
size={24}
|
size={24}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
static options(passProps) {
|
static options(passProps) {
|
||||||
|
@ -60,49 +62,49 @@ export default class UserAccount extends Component {
|
||||||
background: {
|
background: {
|
||||||
color: theme.primaryDark,
|
color: theme.primaryDark,
|
||||||
},
|
},
|
||||||
rightButtons: []
|
rightButtons: [],
|
||||||
},
|
},
|
||||||
backButton: {
|
backButton: {
|
||||||
visible: true,
|
visible: true,
|
||||||
color: "white"
|
color: 'white',
|
||||||
},
|
},
|
||||||
buttonColor: "white",
|
buttonColor: 'white',
|
||||||
background: {
|
background: {
|
||||||
color: theme.primaryDark
|
color: theme.primaryDark,
|
||||||
},
|
},
|
||||||
statusBar: {
|
statusBar: {
|
||||||
drawBehind: false,
|
drawBehind: false,
|
||||||
visible: true,
|
visible: true,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
IlinkEmitter.on('langueChange', this.updateLangue.bind(this));
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
if (user !== null) {
|
if (user !== null) {
|
||||||
this.setState({user: user})
|
this.setState({user: user});
|
||||||
|
|
||||||
this.updateContent(user)
|
this.updateContent(user);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLangue() {
|
updateLangue() {
|
||||||
|
|
||||||
this.props.navigation.setParams({name: I18n.t('USER_ACCOUNT')})
|
this.props.navigation.setParams({name: I18n.t('USER_ACCOUNT')});
|
||||||
this.forceUpdate()
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateContent(user) {
|
updateContent(user) {
|
||||||
getAgentNetworksList(user.agentId).then((networks) => {
|
getAgentNetworksList(user.agentId).then((networks) => {
|
||||||
console.log("networks", networks.networks);
|
console.log('networks', networks.networks);
|
||||||
if (networks['success'] !== undefined) {
|
if (networks.success !== undefined) {
|
||||||
this.setState({mynetworks: networks.networks})
|
this.setState({mynetworks: networks.networks});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -112,22 +114,22 @@ export default class UserAccount extends Component {
|
||||||
initState() {
|
initState() {
|
||||||
return {
|
return {
|
||||||
user: {},
|
user: {},
|
||||||
mynetworks: []
|
mynetworks: [],
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
let cat = "";
|
let cat = '';
|
||||||
|
|
||||||
const {user} = this.state
|
const {user} = this.state;
|
||||||
|
|
||||||
if (user.category !== undefined || user.category !== null)
|
if (user.category !== undefined || user.category !== null)
|
||||||
cat = user.category === 'super' ? I18n.t("ADMIN") : user.category === 'hyper' ?
|
{cat = user.category === 'super' ? I18n.t('ADMIN') : user.category === 'hyper' ?
|
||||||
I18n.t("SUPER_ADMIN") : user.category === 'geolocated' ?
|
I18n.t('SUPER_ADMIN') : user.category === 'geolocated' ?
|
||||||
I18n.t("GEOLOCATED") : I18n.t("SIMPLE_USER")
|
I18n.t('GEOLOCATED') : I18n.t('SIMPLE_USER');}
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<StatusBar
|
<StatusBar
|
||||||
|
@ -137,7 +139,7 @@ export default class UserAccount extends Component {
|
||||||
/>
|
/>
|
||||||
<ScrollView style={{
|
<ScrollView style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
marginTop: -5
|
marginTop: -5,
|
||||||
}}>
|
}}>
|
||||||
<View style={styles.userInformation}>
|
<View style={styles.userInformation}>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
|
@ -156,7 +158,7 @@ export default class UserAccount extends Component {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
textAlign: 'center'
|
textAlign: 'center',
|
||||||
}}>{cat}</Text>
|
}}>{cat}</Text>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,29 +175,29 @@ export default class UserAccount extends Component {
|
||||||
|
|
||||||
<Text style={{
|
<Text style={{
|
||||||
marginLeft: 10, marginRight: 10, marginTop: 15, marginBottom: 5, fontSize: 17,
|
marginLeft: 10, marginRight: 10, marginTop: 15, marginBottom: 5, fontSize: 17,
|
||||||
fontWeight: 'bold', color: 'black'
|
fontWeight: 'bold', color: 'black',
|
||||||
}}>{I18n.t("ACCOUNT_INFO")}</Text>
|
}}>{I18n.t('ACCOUNT_INFO')}</Text>
|
||||||
<CardView style={{marginLeft: 10, marginRight: 10, paddingBottom: 20}}>
|
<CardView style={{marginLeft: 10, marginRight: 10, paddingBottom: 20}}>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
{user.category !== undefined && user.category !== null ? this
|
{user.category !== undefined && user.category !== null ? this
|
||||||
.addAgentInformation(user) : null}
|
.addAgentInformation(user) : null}
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
<Icon name={"location-on"} size={18}/>{" " + this.state.user.country}</Text>
|
<Icon name={'location-on'} size={18}/>{' ' + this.state.user.country}</Text>
|
||||||
|
|
||||||
{user.balance !== undefined && user.balance !== null ? this.showBalance(user) : null}
|
{user.balance !== undefined && user.balance !== null ? this.showBalance(user) : null}
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
<Icon name={"mail"} size={18}/>{" " + this.state.user.email}</Text>
|
<Icon name={'mail'} size={18}/>{' ' + this.state.user.email}</Text>
|
||||||
|
|
||||||
|
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
|
|
||||||
<Icon name={"phone"} size={18}/>
|
<Icon name={'phone'} size={18}/>
|
||||||
{" " + this.state.user.phone}</Text>
|
{' ' + this.state.user.phone}</Text>
|
||||||
{this.showPhoneSup()}
|
{this.showPhoneSup()}
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
|
|
||||||
<Icon name={"account-balance-wallet"} size={18}/>
|
<Icon name={'account-balance-wallet'} size={18}/>
|
||||||
{" " + this.state.user.network}</Text>
|
{' ' + this.state.user.network}</Text>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</CardView>
|
</CardView>
|
||||||
|
|
||||||
|
@ -207,8 +209,8 @@ export default class UserAccount extends Component {
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'black'
|
color: 'black',
|
||||||
}}>{I18n.t("MY_NETWORK")}</Text>)
|
}}>{I18n.t('MY_NETWORK')}</Text>)
|
||||||
|
|
||||||
: null}
|
: null}
|
||||||
{user.category === 'geolocated' ? (this.state.mynetworks.length > 0 ? this.state.mynetworks.map(item => this.generateItemNetwork(item)) : this.showLoader()) : null}
|
{user.category === 'geolocated' ? (this.state.mynetworks.length > 0 ? this.state.mynetworks.map(item => this.generateItemNetwork(item)) : this.showLoader()) : null}
|
||||||
|
@ -216,7 +218,7 @@ export default class UserAccount extends Component {
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
showPhoneSup() {
|
showPhoneSup() {
|
||||||
|
@ -224,9 +226,9 @@ export default class UserAccount extends Component {
|
||||||
|
|
||||||
return (<Text style={styles.textInformation2}>
|
return (<Text style={styles.textInformation2}>
|
||||||
|
|
||||||
<Icon name={"phone"} size={18}/>
|
<Icon name={'phone'} size={18}/>
|
||||||
{" " + this.state.user.phoneTransaction}</Text>
|
{' ' + this.state.user.phoneTransaction}</Text>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,15 +238,14 @@ export default class UserAccount extends Component {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
textAlign: 'center'
|
textAlign: 'center',
|
||||||
}}>{I18n.t("NETWORK")}</Text>
|
}}>{I18n.t('NETWORK')}</Text>
|
||||||
<Text style={{color: 'white', fontSize: 15, textAlign: 'center'}}>{user.network}</Text>
|
<Text style={{color: 'white', fontSize: 15, textAlign: 'center'}}>{user.network}</Text>
|
||||||
</View>)
|
</View>);
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeaderRight(user) {
|
getHeaderRight(user) {
|
||||||
return (<View style={{flex: 0}}>
|
return (<View style={{flex: 0}} />);
|
||||||
</View>)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeaderRightAgent(user) {
|
getHeaderRightAgent(user) {
|
||||||
|
@ -254,10 +255,10 @@ export default class UserAccount extends Component {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold',
|
||||||
}}>{I18n.t("MEMBER_CODE")}</Text>
|
}}>{I18n.t('MEMBER_CODE')}</Text>
|
||||||
<Text style={{color: 'white', fontSize: 13, textAlign: 'center'}}>{user.code_membre}</Text>
|
<Text style={{color: 'white', fontSize: 13, textAlign: 'center'}}>{user.code_membre}</Text>
|
||||||
</View>)
|
</View>);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,69 +268,69 @@ export default class UserAccount extends Component {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
textAlign: 'center'
|
textAlign: 'center',
|
||||||
}}>{I18n.t("NETWORK")}</Text>
|
}}>{I18n.t('NETWORK')}</Text>
|
||||||
<Text style={{color: 'white', fontSize: 13, textAlign: 'center'}}>{user.network}</Text>
|
<Text style={{color: 'white', fontSize: 13, textAlign: 'center'}}>{user.network}</Text>
|
||||||
</View>)
|
</View>);
|
||||||
}
|
}
|
||||||
|
|
||||||
addAgentInformation(user) {
|
addAgentInformation(user) {
|
||||||
console.log(user)
|
console.log(user);
|
||||||
if (user.category === "geolocated") {
|
if (user.category === 'geolocated') {
|
||||||
(<View>
|
(<View>
|
||||||
<Text style={{marginLeft: 10, marginTop: 10, color: theme.primaryDark}}>
|
<Text style={{marginLeft: 10, marginTop: 10, color: theme.primaryDark}}>
|
||||||
<Icon name={'code'} size={18} color={theme.primaryDark} style={{paddingRight: 10}}/>
|
<Icon name={'code'} size={18} color={theme.primaryDark} style={{paddingRight: 10}}/>
|
||||||
{" " + user.code_parrain}</Text>
|
{' ' + user.code_parrain}</Text>
|
||||||
</View>)
|
</View>);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return (<View>
|
{return (<View>
|
||||||
|
|
||||||
<Text style={{marginLeft: 10, marginTop: 10, color: theme.primaryDark}}>
|
<Text style={{marginLeft: 10, marginTop: 10, color: theme.primaryDark}}>
|
||||||
<Icon name={'code'} size={18} color={theme.primaryDark} style={{paddingRight: 10}}/>
|
<Icon name={'code'} size={18} color={theme.primaryDark} style={{paddingRight: 10}}/>
|
||||||
{" " + user.code_parrain}</Text>
|
{' ' + user.code_parrain}</Text>
|
||||||
<View style={{
|
<View style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
width: responsiveWidth(90),
|
width: responsiveWidth(90),
|
||||||
marginRight: 50
|
marginRight: 50,
|
||||||
}}>
|
}}>
|
||||||
<Text style={{marginLeft: 12, marginTop: 10, color: theme.primaryDark}}>
|
<Text style={{marginLeft: 12, marginTop: 10, color: theme.primaryDark}}>
|
||||||
<Icon name={"group-work"} color={theme.primaryDark} size={18}/>
|
<Icon name={'group-work'} color={theme.primaryDark} size={18}/>
|
||||||
{" " + ((user.nbre_reseau === null || user.nbre_reseau === undefined) ? 0 : user.nbre_reseau) + " " + I18n.t("FREE")}
|
{' ' + ((user.nbre_reseau === null || user.nbre_reseau === undefined) ? 0 : user.nbre_reseau) + ' ' + I18n.t('FREE')}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={{marginLeft: 12, marginTop: 10, color: theme.primaryDark}}>
|
<Text style={{marginLeft: 12, marginTop: 10, color: theme.primaryDark}}>
|
||||||
<Icon name={"book"} color={theme.primaryDark}
|
<Icon name={'book'} color={theme.primaryDark}
|
||||||
size={18}/>{" " + ((user.nbre_reseau === null || user.nbre_membre === undefined) ? 0 : user.nbre_membre) + " " + I18n.t("SAVED")}
|
size={18}/>{' ' + ((user.nbre_reseau === null || user.nbre_membre === undefined) ? 0 : user.nbre_membre) + ' ' + I18n.t('SAVED')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>)
|
</View>);}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapUser(user) {
|
mapUser(user) {
|
||||||
const myPosition = {latitude: parseFloat(user.latitude), longitude: parseFloat(user.longitude)}
|
const myPosition = {latitude: parseFloat(user.latitude), longitude: parseFloat(user.longitude)};
|
||||||
|
|
||||||
return (<MapView
|
return (<MapView
|
||||||
liteMode
|
liteMode
|
||||||
ref={(ref) => {
|
ref={(ref) => {
|
||||||
this.mapRef = ref
|
this.mapRef = ref;
|
||||||
}}
|
}}
|
||||||
style={styles.map}
|
style={styles.map}
|
||||||
>
|
>
|
||||||
{this.state.myPosition !== undefined ?
|
{this.state.myPosition !== undefined ?
|
||||||
<Marker
|
<Marker
|
||||||
title={"Vous êtes ici"}
|
title={'Vous êtes ici'}
|
||||||
minZoomLevel={10}
|
minZoomLevel={10}
|
||||||
coordinate={{longitude: myPosition.longitude, latitude: myPosition.latitude}}
|
coordinate={{longitude: myPosition.longitude, latitude: myPosition.latitude}}
|
||||||
/> :
|
/> :
|
||||||
null}
|
null}
|
||||||
</MapView>
|
</MapView>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
showBalance(user) {
|
showBalance(user) {
|
||||||
return <Text style={styles.textInformation2}>
|
return <Text style={styles.textInformation2}>
|
||||||
<Icon name={"folder"} size={18}/>{" " + this.state.user.balance + " "}</Text>
|
<Icon name={'folder'} size={18}/>{' ' + this.state.user.balance + ' '}</Text>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,10 +344,10 @@ export default class UserAccount extends Component {
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'black'
|
color: 'black',
|
||||||
}}>Mes reseaux</Text>
|
}}>Mes reseaux</Text>
|
||||||
|
|
||||||
</View>)
|
</View>);
|
||||||
}
|
}
|
||||||
|
|
||||||
generateItemNetwork(item) {
|
generateItemNetwork(item) {
|
||||||
|
@ -361,13 +362,13 @@ export default class UserAccount extends Component {
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<View Style={{flex: 1}}>
|
<View Style={{flex: 1}}>
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
<Icon name={"code"} size={18}/>{" " + item.code_membre + " "}</Text>
|
<Icon name={'code'} size={18}/>{' ' + item.code_membre + ' '}</Text>
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
<Icon name={"people"} size={18}/>{" " + item.code_parrain + " "}</Text>
|
<Icon name={'people'} size={18}/>{' ' + item.code_parrain + ' '}</Text>
|
||||||
{item.provider_class !== null && (
|
{item.provider_class !== null && (
|
||||||
<>
|
<>
|
||||||
<Text style={styles.textInformation2}>
|
<Text style={styles.textInformation2}>
|
||||||
<Fontisto name={"doctor"} size={18}/>{" " + item.provider_class + " "}</Text>
|
<Fontisto name={'doctor'} size={18}/>{' ' + item.provider_class + ' '}</Text>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
@ -380,37 +381,37 @@ export default class UserAccount extends Component {
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("TITLE_SUPPRESS_CONFIRM"),
|
I18n.t('TITLE_SUPPRESS_CONFIRM'),
|
||||||
I18n.t("TEXT_SUPPRESS_CONFIRM"),
|
I18n.t('TEXT_SUPPRESS_CONFIRM'),
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t('NO'), onPress: () => {
|
text: I18n.t('NO'), onPress: () => {
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: I18n.t("YES"), onPress: () => {
|
text: I18n.t('YES'), onPress: () => {
|
||||||
deleteUser(item).then(() => {
|
deleteUser(item).then(() => {
|
||||||
this.setState({isLoading: true})
|
this.setState({isLoading: true});
|
||||||
this.updateContent(this.state.user)
|
this.updateContent(this.state.user);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
style: 'cancel'
|
style: 'cancel',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
)
|
);
|
||||||
}}
|
}}
|
||||||
title={I18n.t('DELETE_GEOLOCATED_USER')}
|
title={I18n.t('DELETE_GEOLOCATED_USER')}
|
||||||
color="crimson"
|
color="crimson"
|
||||||
/>
|
/>
|
||||||
</CardAction>
|
</CardAction>
|
||||||
</Card>)
|
</Card>);
|
||||||
}
|
}
|
||||||
|
|
||||||
showLoader() {
|
showLoader() {
|
||||||
return (<View style={{height: responsiveHeight(20)}}><ProgressBarAndroid
|
return (<View style={{height: responsiveHeight(20)}}><ProgressBarAndroid
|
||||||
|
|
||||||
style={{justifyContent: "center", alignItems: "center"}}
|
style={{justifyContent: 'center', alignItems: 'center'}}
|
||||||
/></View>)
|
/></View>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +421,7 @@ const styles = StyleSheet.create({
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
paddingTop: responsiveHeight(2),
|
paddingTop: responsiveHeight(2),
|
||||||
paddingBottom: responsiveHeight(5)
|
paddingBottom: responsiveHeight(5),
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
height: 200,
|
height: 200,
|
||||||
|
@ -431,7 +432,7 @@ const styles = StyleSheet.create({
|
||||||
networkInformation: {
|
networkInformation: {
|
||||||
width: responsiveWidth(100),
|
width: responsiveWidth(100),
|
||||||
backgroundColor: '#EEEEEE',
|
backgroundColor: '#EEEEEE',
|
||||||
flex: 1
|
flex: 1,
|
||||||
},
|
},
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -458,7 +459,7 @@ const styles = StyleSheet.create({
|
||||||
shadowOpacity: 1.0,
|
shadowOpacity: 1.0,
|
||||||
elevation: 5,
|
elevation: 5,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
backgroundColor: Color.cardBackgroundColor
|
backgroundColor: Color.cardBackgroundColor,
|
||||||
},
|
},
|
||||||
contain: {
|
contain: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
@ -468,7 +469,7 @@ const styles = StyleSheet.create({
|
||||||
marginTop: 15,
|
marginTop: 15,
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
width: Utils.scaleWithPixel(30),
|
width: Utils.scaleWithPixel(30),
|
||||||
height: Utils.scaleWithPixel(30)
|
height: Utils.scaleWithPixel(30),
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
height: Utils.scaleWithPixel(60),
|
height: Utils.scaleWithPixel(60),
|
||||||
|
@ -483,7 +484,7 @@ const styles = StyleSheet.create({
|
||||||
textInformation: {
|
textInformation: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: 'white',
|
color: 'white',
|
||||||
textAlign: 'center'
|
textAlign: 'center',
|
||||||
},
|
},
|
||||||
textInformation2: {
|
textInformation2: {
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
|
@ -494,12 +495,12 @@ const styles = StyleSheet.create({
|
||||||
textTitle: {
|
textTitle: {
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
color: 'white',
|
color: 'white',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
|
|
||||||
textTitle2: {
|
textTitle2: {
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
color: theme.primaryDark,
|
color: theme.primaryDark,
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable prettier/prettier */
|
||||||
/**
|
/**
|
||||||
* Sample React Native App
|
* Sample React Native App
|
||||||
* https://github.com/facebook/react-native
|
* https://github.com/facebook/react-native
|
||||||
|
@ -41,7 +42,7 @@ class History extends BaseScreen {
|
||||||
navBarButtonColor: '#FFFFFF',
|
navBarButtonColor: '#FFFFFF',
|
||||||
contextualMenuStatusBarColor: theme.accent,
|
contextualMenuStatusBarColor: theme.accent,
|
||||||
contextualMenuBackgroundColor: theme.accentLight,
|
contextualMenuBackgroundColor: theme.accentLight,
|
||||||
contextualMenuButtonsColor: '#ffffff'
|
contextualMenuButtonsColor: '#ffffff',
|
||||||
|
|
||||||
};
|
};
|
||||||
static navigationOptions = ({ navigation }) => {
|
static navigationOptions = ({ navigation }) => {
|
||||||
|
@ -63,9 +64,9 @@ class History extends BaseScreen {
|
||||||
visible: true,
|
visible: true,
|
||||||
drawBehind: false,
|
drawBehind: false,
|
||||||
background: {
|
background: {
|
||||||
color: theme.primaryDark
|
color: theme.primaryDark,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +103,6 @@ class History extends BaseScreen {
|
||||||
case 'willAppear':
|
case 'willAppear':
|
||||||
this.refreshData()
|
this.refreshData()
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
case 'didAppear':
|
case 'didAppear':
|
||||||
break;
|
break;
|
||||||
case 'willDisappear':
|
case 'willDisappear':
|
||||||
|
@ -282,7 +282,7 @@ class History extends BaseScreen {
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
isSectionned: false,
|
isSectionned: false,
|
||||||
isDateTimePickerVisible: false,
|
isDateTimePickerVisible: false,
|
||||||
isDateEndTimePickerVisible: false
|
isDateEndTimePickerVisible: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,10 +491,10 @@ class History extends BaseScreen {
|
||||||
_showDateTimePicker = (type) => {
|
_showDateTimePicker = (type) => {
|
||||||
if (type === 1)
|
if (type === 1)
|
||||||
this.setState({
|
this.setState({
|
||||||
isDateTimePickerVisible: true
|
isDateTimePickerVisible: true,
|
||||||
});
|
});
|
||||||
else this.setState({
|
else this.setState({
|
||||||
isDateEndTimePickerVisible: true
|
isDateEndTimePickerVisible: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_showDateEndPicker = () => this.setState({ isDateEndTimePickerVisible: true });
|
_showDateEndPicker = () => this.setState({ isDateEndTimePickerVisible: true });
|
||||||
|
@ -507,7 +507,7 @@ class History extends BaseScreen {
|
||||||
datestart: fromdate,
|
datestart: fromdate,
|
||||||
datestartformated: moment(fromdate).format('dddd Do ,MMMM YYYY'),
|
datestartformated: moment(fromdate).format('dddd Do ,MMMM YYYY'),
|
||||||
dateend: enddate,
|
dateend: enddate,
|
||||||
dateendformated: moment(enddate).format('dddd Do ,MMMM YYYY')
|
dateendformated: moment(enddate).format('dddd Do ,MMMM YYYY'),
|
||||||
});
|
});
|
||||||
let startdate = this.state.datestart;
|
let startdate = this.state.datestart;
|
||||||
let enddatemo = moment(enddate);
|
let enddatemo = moment(enddate);
|
||||||
|
@ -518,7 +518,7 @@ class History extends BaseScreen {
|
||||||
text: I18n.t('DATE_WRONG'),
|
text: I18n.t('DATE_WRONG'),
|
||||||
duration: 'long',
|
duration: 'long',
|
||||||
backgroundColor: 'red',
|
backgroundColor: 'red',
|
||||||
textColor: 'white'
|
textColor: 'white',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.setState({ filder_disable: false });
|
this.setState({ filder_disable: false });
|
||||||
|
@ -541,7 +541,7 @@ class History extends BaseScreen {
|
||||||
<ActionButton.Item buttonColor={primary} title={I18n.t('MAKE_REQUEST')}
|
<ActionButton.Item buttonColor={primary} title={I18n.t('MAKE_REQUEST')}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.props.navigation.push(route.credrequester, {
|
this.props.navigation.push(route.credrequester, {
|
||||||
onGoBack: () => this.refreshData()
|
onGoBack: () => this.refreshData(),
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -590,7 +590,7 @@ class History extends BaseScreen {
|
||||||
}]
|
}]
|
||||||
return <PagerTabIndicator
|
return <PagerTabIndicator
|
||||||
style={{
|
style={{
|
||||||
height: responsiveHeight(8)
|
height: responsiveHeight(8),
|
||||||
}}
|
}}
|
||||||
tabs={tabs} />;
|
tabs={tabs} />;
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ class History extends BaseScreen {
|
||||||
}]
|
}]
|
||||||
return <PagerTabIndicator
|
return <PagerTabIndicator
|
||||||
style={{
|
style={{
|
||||||
height: responsiveHeight(8)
|
height: responsiveHeight(8),
|
||||||
}}
|
}}
|
||||||
tabs={tabs} />;
|
tabs={tabs} />;
|
||||||
}
|
}
|
||||||
|
@ -609,14 +609,14 @@ class History extends BaseScreen {
|
||||||
_renderTabs() {
|
_renderTabs() {
|
||||||
let tabs = [{
|
let tabs = [{
|
||||||
text: I18n.t('MY_DEMANDE'),
|
text: I18n.t('MY_DEMANDE'),
|
||||||
iconSource: this.state.usersicon
|
iconSource: this.state.usersicon,
|
||||||
}, {
|
}, {
|
||||||
text: I18n.t('DEMANDE_RECEIVE'),
|
text: I18n.t('DEMANDE_RECEIVE'),
|
||||||
iconSource: this.state.charticon
|
iconSource: this.state.charticon,
|
||||||
}]
|
}]
|
||||||
return <PagerTabIndicator
|
return <PagerTabIndicator
|
||||||
style={{
|
style={{
|
||||||
height: responsiveHeight(8)
|
height: responsiveHeight(8),
|
||||||
}}
|
}}
|
||||||
tabs={tabs} />;
|
tabs={tabs} />;
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ const datefilter = StyleSheet.create({
|
||||||
},
|
},
|
||||||
datetext: {
|
datetext: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
marginLeft: responsiveWidth(5)
|
marginLeft: responsiveWidth(5),
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
flex: 2,
|
flex: 2,
|
||||||
|
@ -672,12 +672,12 @@ const datefilter = StyleSheet.create({
|
||||||
},
|
},
|
||||||
btntext: {
|
btntext: {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: accent
|
color: accent,
|
||||||
},
|
},
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'space-evenly'
|
justifyContent: 'space-evenly',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
slidingup: {
|
slidingup: {
|
||||||
|
@ -695,7 +695,7 @@ const styles = StyleSheet.create({
|
||||||
emptylist: {
|
emptylist: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
backgroundd_drawer: {
|
backgroundd_drawer: {
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
|
@ -727,10 +727,10 @@ const styles = StyleSheet.create({
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
marginLeft: responsiveWidth(10),
|
marginLeft: responsiveWidth(10),
|
||||||
|
|
||||||
color: 'black'
|
color: 'black',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
flex: 8
|
flex: 8,
|
||||||
},
|
},
|
||||||
|
|
||||||
title: {
|
title: {
|
||||||
|
@ -738,6 +738,6 @@ const styles = StyleSheet.create({
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
color: 'black',
|
color: 'black',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,22 @@
|
||||||
|
/* eslint-disable react/jsx-no-duplicate-props */
|
||||||
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
import React, {PureComponent} from 'react';
|
import React, {PureComponent} from 'react';
|
||||||
import {FlatList, RefreshControl, SectionList, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
|
import {
|
||||||
import {responsiveFontSize, responsiveWidth} from 'react-native-responsive-dimensions';
|
FlatList,
|
||||||
|
RefreshControl,
|
||||||
|
SectionList,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
import {
|
||||||
|
responsiveFontSize,
|
||||||
|
responsiveWidth,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import I18n from "react-native-i18n"
|
import I18n from 'react-native-i18n';
|
||||||
|
|
||||||
import 'moment/locale/fr';
|
import 'moment/locale/fr';
|
||||||
import 'moment/locale/es-us';
|
import 'moment/locale/es-us';
|
||||||
|
@ -21,16 +35,15 @@ let route = require('./../../route.json');
|
||||||
var theme = require('./../../utils/theme.json');
|
var theme = require('./../../utils/theme.json');
|
||||||
|
|
||||||
export class HistoryItem extends React.Component {
|
export class HistoryItem extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||||
console.log("Current Locale item", this.currentLocale);
|
console.log('Current Locale item', this.currentLocale);
|
||||||
moment.locale(this.currentLocale);
|
moment.locale(this.currentLocale);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
statusLabel = (status) => {
|
statusLabel = status => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case '0':
|
case '0':
|
||||||
return I18n.t('NO_TREAT');
|
return I18n.t('NO_TREAT');
|
||||||
|
@ -39,9 +52,9 @@ export class HistoryItem extends React.Component {
|
||||||
case '2':
|
case '2':
|
||||||
return I18n.t('REFUSED');
|
return I18n.t('REFUSED');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
colorLabel = (status) => {
|
colorLabel = status => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case '0':
|
case '0':
|
||||||
return Color.accentColor;
|
return Color.accentColor;
|
||||||
|
@ -50,34 +63,54 @@ export class HistoryItem extends React.Component {
|
||||||
case '2':
|
case '2':
|
||||||
return Color.redColor;
|
return Color.redColor;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
descriptionLabelUserType = (user) => {
|
descriptionLabelUserType = user => {
|
||||||
let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau;
|
let textDescription =
|
||||||
|
this.props.selfData.montant +
|
||||||
|
' ' +
|
||||||
|
I18n.t('TO_') +
|
||||||
|
' ' +
|
||||||
|
this.props.selfData.reseau;
|
||||||
|
|
||||||
switch (user.category) {
|
switch (user.category) {
|
||||||
case 'geolocated':
|
case 'geolocated':
|
||||||
return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`;
|
return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`;
|
||||||
case 'super':
|
case 'super':
|
||||||
return this.props.isDemandSend ?
|
return this.props.isDemandSend
|
||||||
`${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`
|
? `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`
|
||||||
:
|
: `${I18n.t('THE_AGENT')} ${this.props.selfData.lastname} (${
|
||||||
`${I18n.t('THE_AGENT')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
this.props.selfData.phone
|
||||||
|
}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
||||||
|
|
||||||
case 'hyper':
|
case 'hyper':
|
||||||
return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${
|
||||||
}
|
this.props.selfData.phone
|
||||||
|
}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
initState() {
|
initState() {
|
||||||
var textTitle = ' Transaction ' + this.props.selfData.id;
|
var textTitle = ' Transaction ' + this.props.selfData.id;
|
||||||
var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ';
|
var textDescription =
|
||||||
|
I18n.t('PHONE') +
|
||||||
|
' ' +
|
||||||
|
this.props.selfData.phone +
|
||||||
|
' ' +
|
||||||
|
I18n.t('DEMAND_TEXT_FIRST_PART') +
|
||||||
|
' ' +
|
||||||
|
this.props.selfData.montant +
|
||||||
|
' ' +
|
||||||
|
I18n.t('TO_') +
|
||||||
|
' ';
|
||||||
textDescription += this.props.selfData.reseau;
|
textDescription += this.props.selfData.reseau;
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
var l = this.props.selfData.date_creation;
|
var l = this.props.selfData.date_creation;
|
||||||
let t = this.props.selfData.status;
|
let t = this.props.selfData.status;
|
||||||
var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format();
|
var re = moment
|
||||||
re = moment(re)
|
.tz(this.props.selfData.date_creation, moment.tz.guess())
|
||||||
|
.format();
|
||||||
|
re = moment(re);
|
||||||
return {
|
return {
|
||||||
title: textTitle,
|
title: textTitle,
|
||||||
description: this.descriptionLabelUserType(this.props.user),
|
description: this.descriptionLabelUserType(this.props.user),
|
||||||
|
@ -85,61 +118,57 @@ export class HistoryItem extends React.Component {
|
||||||
time: re.fromNow(),
|
time: re.fromNow(),
|
||||||
navigator: this.props.navigator,
|
navigator: this.props.navigator,
|
||||||
type: t,
|
type: t,
|
||||||
colorstate: this.colorLabel(t)
|
colorstate: this.colorLabel(t),
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
//console.log("ITEM RENDER", this.props.selfData)
|
//console.log("ITEM RENDER", this.props.selfData)
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity onPress={() =>
|
<TouchableOpacity
|
||||||
|
onPress={() =>
|
||||||
this.props.navigator.navigate(route.historyItemDetails, {
|
this.props.navigator.navigate(route.historyItemDetails, {
|
||||||
item: this.props.selfData,
|
item: this.props.selfData,
|
||||||
onGoBack: () => this.props.refresh(),
|
onGoBack: () => this.props.refresh(),
|
||||||
}
|
})
|
||||||
)}>
|
}>
|
||||||
<View style={style.content}>
|
<View style={style.content}>
|
||||||
<Text style={style.title}>{this.state.title}</Text>
|
<Text style={style.title}>{this.state.title}</Text>
|
||||||
<Text style={style.description}>{this.state.description}</Text>
|
<Text style={style.description}>{this.state.description}</Text>
|
||||||
<View style={style.timeContent}>
|
<View style={style.timeContent}>
|
||||||
<Text style={{
|
<Text
|
||||||
|
style={{
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
color: this.state.colorstate,
|
color: this.state.colorstate,
|
||||||
|
}}>
|
||||||
}}>{this.statusLabel(this.props.selfData.status)}</Text>
|
{this.statusLabel(this.props.selfData.status)}
|
||||||
|
</Text>
|
||||||
<Text style={style.time}>{this.state.time}</Text>
|
<Text style={style.time}>{this.state.time}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={style.bottomSeparator} />
|
<View style={style.bottomSeparator} />
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HistoryItemSectionned extends PureComponent {
|
export class HistoryItemSectionned extends PureComponent {
|
||||||
_keyExtractor = (item, index) => item.id;
|
_keyExtractor = (item, index) => item.id;
|
||||||
_renderItem = ({item}) => (
|
_renderItem = ({item}) => (
|
||||||
<HistoryItem
|
<HistoryItem navigator={this.props.navigator} selfData={item} />
|
||||||
navigator={this.props.navigator}
|
|
||||||
selfData={item}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||||
moment.locale(this.currentLocale);
|
moment.locale(this.currentLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<SectionList
|
<SectionList
|
||||||
sections={[
|
sections={[
|
||||||
{
|
{
|
||||||
|
@ -147,44 +176,62 @@ export class HistoryItemSectionned extends PureComponent {
|
||||||
type: 0,
|
type: 0,
|
||||||
data: this.state.treat,
|
data: this.state.treat,
|
||||||
size: this.state.conservetreat.length,
|
size: this.state.conservetreat.length,
|
||||||
expandState: this.state.istreatexpand
|
expandState: this.state.istreatexpand,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Demande non traité',
|
title: 'Demande non traité',
|
||||||
type: 1,
|
type: 1,
|
||||||
data: this.state.untreat,
|
data: this.state.untreat,
|
||||||
size: this.state.conserveuntreat.length,
|
size: this.state.conserveuntreat.length,
|
||||||
expandState: this.state.isuntreatexpand
|
expandState: this.state.isuntreatexpand,
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
renderSectionHeader={({section: {title, type, data, size, expandState}}) => (
|
renderSectionHeader={({
|
||||||
<TouchableOpacity onPress={() => this.onPressedHeader(type)} style={{
|
section: {title, type, data, size, expandState},
|
||||||
|
}) => (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => this.onPressedHeader(type)}
|
||||||
|
style={{
|
||||||
backgroundColor: theme.accent,
|
backgroundColor: theme.accent,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100)
|
flexDirection: 'row',
|
||||||
|
flex: 1,
|
||||||
|
height: 70,
|
||||||
|
width: responsiveWidth(100),
|
||||||
}}>
|
}}>
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
height: 70,
|
height: 70,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
width: responsiveWidth(100),
|
width: responsiveWidth(100),
|
||||||
}}>
|
}}>
|
||||||
<Text style={{
|
<Text
|
||||||
|
style={{
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: 'white'
|
color: 'white',
|
||||||
}}>{title}</Text>
|
}}>
|
||||||
<Text style={{
|
{title}
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: 'white'
|
color: 'white',
|
||||||
}}>{size} demande(s)</Text>
|
}}>
|
||||||
|
{size} demande(s)
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Icon name={expandState ? 'sort-up' : 'sort-down'} size={30} color={'white'}
|
<Icon
|
||||||
style={{marginRight: 20}}/>
|
name={expandState ? 'sort-up' : 'sort-down'}
|
||||||
|
size={30}
|
||||||
|
color={'white'}
|
||||||
|
style={{marginRight: 20}}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
style={style.listStyle}
|
style={style.listStyle}
|
||||||
|
@ -199,19 +246,18 @@ export class HistoryItemSectionned extends PureComponent {
|
||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
istreatexpand: !this.state.istreatexpand,
|
istreatexpand: !this.state.istreatexpand,
|
||||||
treat: this.state.istreatexpand ? [] : this.state.conservetreat
|
treat: this.state.istreatexpand ? [] : this.state.conservetreat,
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
isuntreatexpand: !this.state.isuntreatexpand,
|
isuntreatexpand: !this.state.isuntreatexpand,
|
||||||
untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat
|
untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat,
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initState() {
|
initState() {
|
||||||
let data = this.props.list
|
let data = this.props.list;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
|
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
|
||||||
|
@ -219,17 +265,15 @@ export class HistoryItemSectionned extends PureComponent {
|
||||||
istreatexpand: true,
|
istreatexpand: true,
|
||||||
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
||||||
untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
|
||||||
isuntreatexpand: true
|
isuntreatexpand: true,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HistoryListItem extends React.Component {
|
export class HistoryListItem extends React.Component {
|
||||||
_keyExtractor = (item, index) => item.id;
|
_keyExtractor = (item, index) => item.id;
|
||||||
|
|
||||||
_onPressItem = (id: string) => {
|
_onPressItem = id => {};
|
||||||
|
|
||||||
};
|
|
||||||
_renderItem = ({item}) => {
|
_renderItem = ({item}) => {
|
||||||
//console.log('ITEM ', item);
|
//console.log('ITEM ', item);
|
||||||
return (
|
return (
|
||||||
|
@ -239,22 +283,21 @@ export class HistoryListItem extends React.Component {
|
||||||
refresh={this.props.refresh}
|
refresh={this.props.refresh}
|
||||||
navigator={this.props.navigator}
|
navigator={this.props.navigator}
|
||||||
selfData={item}
|
selfData={item}
|
||||||
refresh={this.props.refresh}
|
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||||
moment.locale(this.currentLocale);
|
moment.locale(this.currentLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
initState() {
|
initState() {
|
||||||
return {
|
return {
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -268,7 +311,12 @@ export class HistoryListItem extends React.Component {
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={this.props.isRefreshing}
|
refreshing={this.props.isRefreshing}
|
||||||
colors={[theme.primary, theme.purpleLight, theme.reddeconnect, theme.accentLight]}
|
colors={[
|
||||||
|
theme.primary,
|
||||||
|
theme.purpleLight,
|
||||||
|
theme.reddeconnect,
|
||||||
|
theme.accentLight,
|
||||||
|
]}
|
||||||
onRefresh={this.props.refreshing}
|
onRefresh={this.props.refreshing}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
@ -277,9 +325,9 @@ export class HistoryListItem extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onRefresh() {
|
_onRefresh() {
|
||||||
this.setState({refreshing: true})
|
this.setState({refreshing: true});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({refreshing: false})
|
this.setState({refreshing: false});
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,10 +339,9 @@ const style = StyleSheet.create({
|
||||||
flex: 1,
|
flex: 1,
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
paddingTop: 10,
|
paddingTop: 10,
|
||||||
|
|
||||||
},
|
},
|
||||||
listStyle: {
|
listStyle: {
|
||||||
backgroundColor: 'white'
|
backgroundColor: 'white',
|
||||||
},
|
},
|
||||||
bottomSeparator: {
|
bottomSeparator: {
|
||||||
width: responsiveWidth(100),
|
width: responsiveWidth(100),
|
||||||
|
@ -306,13 +353,12 @@ const style = StyleSheet.create({
|
||||||
title: {
|
title: {
|
||||||
color: '#000',
|
color: '#000',
|
||||||
paddingLeft: 10,
|
paddingLeft: 10,
|
||||||
fontSize: responsiveFontSize(2.2)
|
fontSize: responsiveFontSize(2.2),
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
fontSize: responsiveFontSize(1.8),
|
fontSize: responsiveFontSize(1.8),
|
||||||
color: '#4f5b62',
|
color: '#4f5b62',
|
||||||
paddingLeft: 10,
|
paddingLeft: 10,
|
||||||
|
|
||||||
},
|
},
|
||||||
timeContent: {
|
timeContent: {
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
|
@ -328,5 +374,4 @@ const style = StyleSheet.create({
|
||||||
color: theme.accent,
|
color: theme.accent,
|
||||||
},
|
},
|
||||||
treat: {},
|
treat: {},
|
||||||
|
|
||||||
});
|
});
|
|
@ -1,21 +1,29 @@
|
||||||
import React, {Component} from 'react'
|
/* eslint-disable radix */
|
||||||
import {Alert, Platform, StyleSheet, Text, View} from 'react-native'
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
import CardView from 'react-native-cardview'
|
import React, {Component} from 'react';
|
||||||
import Button from 'apsl-react-native-button'
|
import {Alert, Platform, StyleSheet, Text, View} from 'react-native';
|
||||||
import {responsiveWidth} from 'react-native-responsive-dimensions'
|
import CardView from 'react-native-cardview';
|
||||||
import Icons from 'react-native-vector-icons/Ionicons'
|
import Button from 'apsl-react-native-button';
|
||||||
import {readUser} from "../../webservice/AuthApi";
|
import {responsiveWidth} from 'react-native-responsive-dimensions';
|
||||||
|
import Icons from 'react-native-vector-icons/Ionicons';
|
||||||
|
import {readUser} from '../../webservice/AuthApi';
|
||||||
import isNil from 'lodash/isNil';
|
import isNil from 'lodash/isNil';
|
||||||
import {creditDemandResetReducer, treatCreditDemand} from '../../webservice/CreditTreatDemandApi';
|
import {
|
||||||
import {creditCancelResetReducer, treatCancelDemand} from '../../webservice/CreditCancelDemandeApi';
|
creditDemandResetReducer,
|
||||||
import {getAgentNetworksList} from "../../webservice/NetworkApi";
|
treatCreditDemand,
|
||||||
|
} from '../../webservice/CreditTreatDemandApi';
|
||||||
|
import {
|
||||||
|
creditCancelResetReducer,
|
||||||
|
treatCancelDemand,
|
||||||
|
} from '../../webservice/CreditCancelDemandeApi';
|
||||||
|
import {getAgentNetworksList} from '../../webservice/NetworkApi';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import Toast from 'react-native-root-toast';
|
import Toast from 'react-native-root-toast';
|
||||||
import {Color} from '../../config/Color'
|
import {Color} from '../../config/Color';
|
||||||
import Dialog from "react-native-dialog";
|
import Dialog from 'react-native-dialog';
|
||||||
import {FontWeight} from '../../config/typography'
|
import {FontWeight} from '../../config/typography';
|
||||||
import I18n from "react-native-i18n";
|
import I18n from 'react-native-i18n';
|
||||||
|
|
||||||
import 'moment/locale/fr';
|
import 'moment/locale/fr';
|
||||||
import 'moment/locale/es-us';
|
import 'moment/locale/es-us';
|
||||||
|
@ -30,14 +38,13 @@ const momentJS = require('moment');
|
||||||
|
|
||||||
let typesta = 0;
|
let typesta = 0;
|
||||||
|
|
||||||
var colorback = 'white'
|
var colorback = 'white';
|
||||||
|
|
||||||
let theme = require('./../../utils/theme.json');
|
let theme = require('./../../utils/theme.json');
|
||||||
|
|
||||||
const route = require("./../../route.json");
|
const route = require('./../../route.json');
|
||||||
|
|
||||||
class HistoryItemDetails extends Component {
|
class HistoryItemDetails extends Component {
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarBackgroundColor: theme.accentLight,
|
navBarBackgroundColor: theme.accentLight,
|
||||||
statusBarColor: theme.accent,
|
statusBarColor: theme.accent,
|
||||||
|
@ -47,37 +54,37 @@ class HistoryItemDetails extends Component {
|
||||||
static navigationOptions = ({navigation}) => {
|
static navigationOptions = ({navigation}) => {
|
||||||
return {
|
return {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
title: isNil(navigation.getParam("item", null).item) ?
|
title: isNil(navigation.getParam('item', null).item)
|
||||||
"Transaction N°" + navigation.getParam("item", {id: "-"}).id :
|
? 'Transaction N°' + navigation.getParam('item', {id: '-'}).id
|
||||||
"Transaction N°" + navigation.getParam("item", {id: "-"}).item.id
|
: 'Transaction N°' + navigation.getParam('item', {id: '-'}).item.id,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.item = this.props.navigation.getParam("item", null);
|
this.item = this.props.navigation.getParam('item', null);
|
||||||
if (isNil(this.props.navigation.getParam("item", null).item)) {
|
if (isNil(this.props.navigation.getParam('item', null).item)) {
|
||||||
this.item = this.props.navigation.getParam("item", null);
|
this.item = this.props.navigation.getParam('item', null);
|
||||||
} else {
|
} else {
|
||||||
this.item = this.props.navigation.getParam("item", null).item;
|
this.item = this.props.navigation.getParam('item', null).item;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||||
moment.locale(this.currentLocale);
|
moment.locale(this.currentLocale);
|
||||||
|
|
||||||
let sta = ''
|
let sta = '';
|
||||||
if (this.item.status === '1') {
|
if (this.item.status === '1') {
|
||||||
typesta = 1
|
typesta = 1;
|
||||||
colorback = '#AEAEAE'
|
colorback = '#AEAEAE';
|
||||||
sta = I18n.t('TREAT_DEMAND')
|
sta = I18n.t('TREAT_DEMAND');
|
||||||
} else if (this.item.status === '0') {
|
} else if (this.item.status === '0') {
|
||||||
colorback = 'green'
|
colorback = 'green';
|
||||||
typesta = 2
|
typesta = 2;
|
||||||
sta = I18n.t('ACCEPTER_DEMANDE')
|
sta = I18n.t('ACCEPTER_DEMANDE');
|
||||||
} else {
|
} else {
|
||||||
colorback = '#AEAEAE'
|
colorback = '#AEAEAE';
|
||||||
typesta = 2
|
typesta = 2;
|
||||||
sta = I18n.t('REFUSED')
|
sta = I18n.t('REFUSED');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -91,37 +98,33 @@ class HistoryItemDetails extends Component {
|
||||||
triggerCancelClick: false,
|
triggerCancelClick: false,
|
||||||
color: colorback,
|
color: colorback,
|
||||||
montant: null,
|
montant: null,
|
||||||
isBtnModifyAmountEnabled: false
|
isBtnModifyAmountEnabled: false,
|
||||||
}
|
};
|
||||||
readUser().then(async (user) => {
|
readUser().then(async user => {
|
||||||
let networks = []
|
let networks = [];
|
||||||
networks = await getAgentNetworksList(user.agentId);
|
networks = await getAgentNetworksList(user.agentId);
|
||||||
this.setState({user: user, networks: networks.networks})
|
this.setState({user: user, networks: networks.networks});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isNormalInteger = (str) => {
|
isNormalInteger = str => {
|
||||||
return (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str)) ? false : true;
|
return /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str) ? false : true;
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
isMontantValid = () => {
|
isMontantValid = () => {
|
||||||
const {montant} = this.state;
|
const {montant} = this.state;
|
||||||
if ((parseInt(montant) == 0 || montant < 0))
|
if (parseInt(montant) == 0 || montant < 0) {
|
||||||
return false;
|
return false;
|
||||||
|
} else if (!this.isNormalInteger(montant)) {
|
||||||
else if (!this.isNormalInteger(montant))
|
|
||||||
return false;
|
return false;
|
||||||
|
} else if (parseInt(montant) > parseInt(this.item.montant)) {
|
||||||
else if (parseInt(montant) > parseInt(this.item.montant))
|
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
else
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
displayToast = (message) => {
|
displayToast = message => {
|
||||||
Toast.show(message, {
|
Toast.show(message, {
|
||||||
duration: Toast.durations.SHORT,
|
duration: Toast.durations.SHORT,
|
||||||
position: Toast.positions.BOTTOM,
|
position: Toast.positions.BOTTOM,
|
||||||
|
@ -141,12 +144,12 @@ class HistoryItemDetails extends Component {
|
||||||
},
|
},
|
||||||
onHidden: () => {
|
onHidden: () => {
|
||||||
// calls on toast\`s hide animation end.
|
// calls on toast\`s hide animation end.
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onTreatDemand() {
|
onTreatDemand() {
|
||||||
if (this.item !== "1") {
|
if (this.item !== '1') {
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
this.props.treatCreditDemand(this.item.id);
|
this.props.treatCreditDemand(this.item.id);
|
||||||
/* updateCreditDemand(this.item.phone, this.item.id).then((data) => {
|
/* updateCreditDemand(this.item.phone, this.item.id).then((data) => {
|
||||||
|
@ -163,94 +166,117 @@ class HistoryItemDetails extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancelDemand = () => {
|
onCancelDemand = () => {
|
||||||
if (this.item !== "1") {
|
if (this.item !== '1') {
|
||||||
this.props.treatCancelDemand(this.item.id);
|
this.props.treatCancelDemand(this.item.id);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
renderPromptModifyAmountToSend = () => {
|
renderPromptModifyAmountToSend = () => {
|
||||||
return (
|
return (
|
||||||
<Dialog.Container useNativeDriver={true} visible={this.state.displayAmountModifyDialog}>
|
<Dialog.Container
|
||||||
|
useNativeDriver={true}
|
||||||
|
visible={this.state.displayAmountModifyDialog}>
|
||||||
<Dialog.Title>{I18n.t('MODIFY_AMOUNT')}</Dialog.Title>
|
<Dialog.Title>{I18n.t('MODIFY_AMOUNT')}</Dialog.Title>
|
||||||
|
|
||||||
<Dialog.Description style={[FontWeight.bold]}>
|
<Dialog.Description style={[FontWeight.bold]}>
|
||||||
{I18n.t('ENTER_NEW_AMOUNT_TO_SEND')}
|
{I18n.t('ENTER_NEW_AMOUNT_TO_SEND')}
|
||||||
</Dialog.Description>
|
</Dialog.Description>
|
||||||
|
|
||||||
<Dialog.Input style={styles.inputAmountText}
|
<Dialog.Input
|
||||||
|
style={styles.inputAmountText}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
keyboardType="numeric"
|
keyboardType="numeric"
|
||||||
onChangeText={(montant) => {
|
onChangeText={montant => {
|
||||||
|
|
||||||
this.setState({montant}, () => {
|
this.setState({montant}, () => {
|
||||||
if (this.isMontantValid(montant)) {
|
if (this.isMontantValid(montant)) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isBtnModifyAmountEnabled: true
|
isBtnModifyAmountEnabled: true,
|
||||||
})
|
});
|
||||||
} else
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
isBtnModifyAmountEnabled: false
|
isBtnModifyAmountEnabled: false,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
console.log("this.isMontantValid().isValid", this.isMontantValid());
|
console.log(
|
||||||
console.log("isBtnModifyAmountEnabled", this.state.isBtnModifyAmountEnabled);
|
'this.isMontantValid().isValid',
|
||||||
|
this.isMontantValid(),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
'isBtnModifyAmountEnabled',
|
||||||
|
this.state.isBtnModifyAmountEnabled,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
}}/>
|
<Dialog.Button
|
||||||
|
bold={true}
|
||||||
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')}
|
label={I18n.t('CANCEL_LABEL')}
|
||||||
onPress={() => this.setState({displayAmountModifyDialog: false})}/>
|
onPress={() => this.setState({displayAmountModifyDialog: false})}
|
||||||
<Dialog.Button bold={true} label={I18n.t('SEND')} disable={this.state.isBtnModifyAmountEnabled}
|
/>
|
||||||
|
<Dialog.Button
|
||||||
|
bold={true}
|
||||||
|
label={I18n.t('SEND')}
|
||||||
|
disable={this.state.isBtnModifyAmountEnabled}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
this.props.treatCreditDemand(this.item.id, this.state.montant);
|
this.props.treatCreditDemand(this.item.id, this.state.montant);
|
||||||
}}/>
|
}}
|
||||||
|
/>
|
||||||
</Dialog.Container>
|
</Dialog.Container>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
renderAlertErrorTreatOrCancelDemand = () => {
|
renderAlertErrorTreatOrCancelDemand = () => {
|
||||||
const {errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand} = this.props;
|
const {
|
||||||
|
errorTreatDemand,
|
||||||
|
resultTreatDemand,
|
||||||
|
resultCancelDemand,
|
||||||
|
errorCancelDemand,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
if (errorTreatDemand !== null) {
|
if (errorTreatDemand !== null) {
|
||||||
if (typeof errorTreatDemand.data !== 'undefined') {
|
if (typeof errorTreatDemand.data !== 'undefined') {
|
||||||
if (errorTreatDemand.status === 426) {
|
if (errorTreatDemand.status === 426) {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_TREATMENT_DEMAND"),
|
I18n.t('ERROR_TREATMENT_DEMAND'),
|
||||||
errorTreatDemand.data.error,
|
errorTreatDemand.data.error,
|
||||||
[{
|
[
|
||||||
|
{
|
||||||
text: I18n.t('CANCEL_LABEL'),
|
text: I18n.t('CANCEL_LABEL'),
|
||||||
onPress: () => {
|
onPress: () => {},
|
||||||
},
|
style: 'cancel',
|
||||||
style: 'cancel'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t('OK'),
|
||||||
|
onPress: () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
displayAmountModifyDialog: true
|
displayAmountModifyDialog: true,
|
||||||
});
|
});
|
||||||
}, 10);
|
}, 10);
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
this.props.creditCancelResetReducer();
|
this.props.creditCancelResetReducer();
|
||||||
}
|
},
|
||||||
}],
|
},
|
||||||
{cancelable: false}
|
],
|
||||||
|
{cancelable: false},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_TREATMENT_DEMAND"),
|
I18n.t('ERROR_TREATMENT_DEMAND'),
|
||||||
errorTreatDemand.data.error,
|
errorTreatDemand.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t('OK'),
|
||||||
|
onPress: () => {
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
this.props.creditCancelResetReducer();
|
this.props.creditCancelResetReducer();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
{cancelable: false}
|
{cancelable: false},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,101 +285,103 @@ class HistoryItemDetails extends Component {
|
||||||
if (errorCancelDemand !== null) {
|
if (errorCancelDemand !== null) {
|
||||||
if (typeof errorCancelDemand.data !== 'undefined') {
|
if (typeof errorCancelDemand.data !== 'undefined') {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
I18n.t("ERROR_TREATMENT_DEMAND"),
|
I18n.t('ERROR_TREATMENT_DEMAND'),
|
||||||
errorCancelDemand.data.error,
|
errorCancelDemand.data.error,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: I18n.t("OK"), onPress: () => {
|
text: I18n.t('OK'),
|
||||||
|
onPress: () => {
|
||||||
this.props.creditCancelResetReducer();
|
this.props.creditCancelResetReducer();
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
{cancelable: false}
|
{cancelable: false},
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultTreatDemand !== null) {
|
if (resultTreatDemand !== null) {
|
||||||
console.log("resultTreatDemand", resultTreatDemand);
|
console.log('resultTreatDemand', resultTreatDemand);
|
||||||
if (resultTreatDemand.status === 200) {
|
if (resultTreatDemand.status === 200) {
|
||||||
this.displayToast(resultTreatDemand.response);
|
this.displayToast(resultTreatDemand.response);
|
||||||
this.props.navigation.goBack();
|
this.props.navigation.goBack();
|
||||||
if (!isNil(this.props.navigation.state.params.onGoBack))
|
if (!isNil(this.props.navigation.state.params.onGoBack)) {
|
||||||
this.props.navigation.state.params.onGoBack();
|
this.props.navigation.state.params.onGoBack();
|
||||||
|
}
|
||||||
this.props.creditCancelResetReducer();
|
this.props.creditCancelResetReducer();
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultCancelDemand !== null) {
|
if (resultCancelDemand !== null) {
|
||||||
console.log("resultCancelDemand", resultCancelDemand);
|
console.log('resultCancelDemand', resultCancelDemand);
|
||||||
if (resultCancelDemand.status === 200) {
|
if (resultCancelDemand.status === 200) {
|
||||||
|
|
||||||
this.displayToast(resultCancelDemand.response);
|
this.displayToast(resultCancelDemand.response);
|
||||||
this.props.navigation.goBack();
|
this.props.navigation.goBack();
|
||||||
if (!isNil(this.props.navigation.state.params.onGoBack))
|
if (!isNil(this.props.navigation.state.params.onGoBack)) {
|
||||||
this.props.navigation.state.params.onGoBack();
|
this.props.navigation.state.params.onGoBack();
|
||||||
|
}
|
||||||
this.props.creditCancelResetReducer();
|
this.props.creditCancelResetReducer();
|
||||||
this.props.creditDemandResetReducer();
|
this.props.creditDemandResetReducer();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
renderBtn() {
|
renderBtn() {
|
||||||
const {user} = this.state;
|
const {user} = this.state;
|
||||||
console.warn("ITEM ITEM", this.item);
|
console.warn('ITEM ITEM', this.item);
|
||||||
console.warn("Code Membre", user.code_membre);
|
console.warn('Code Membre', user.code_membre);
|
||||||
if (user) {
|
if (user) {
|
||||||
if (this.item.code_parrain.toLowerCase() === user.code_membre.toLowerCase()) {
|
if (
|
||||||
console.warn("Conditions vérifié");
|
this.item.code_parrain.toLowerCase() === user.code_membre.toLowerCase()
|
||||||
|
) {
|
||||||
|
console.warn('Conditions vérifié');
|
||||||
if (this.item.status === '1') {
|
if (this.item.status === '1') {
|
||||||
return (<Button
|
return (
|
||||||
|
<Button
|
||||||
style={{
|
style={{
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
backgroundColor: this.state.color
|
backgroundColor: this.state.color,
|
||||||
}}
|
}}
|
||||||
isLoading={this.props.loadingTreatDemand}
|
isLoading={this.props.loadingTreatDemand}
|
||||||
onPress={() => {
|
onPress={() => {}}
|
||||||
}}
|
|
||||||
disabled={true}
|
disabled={true}
|
||||||
textStyle={styles.textbtnstyle}
|
textStyle={styles.textbtnstyle}>
|
||||||
>
|
|
||||||
{this.state.statut}
|
{this.state.statut}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
if (this.item.status === '2') {
|
if (this.item.status === '2') {
|
||||||
return (<Button
|
return (
|
||||||
|
<Button
|
||||||
style={{
|
style={{
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
backgroundColor: this.state.color
|
backgroundColor: this.state.color,
|
||||||
}}
|
|
||||||
onPress={() => {
|
|
||||||
}}
|
}}
|
||||||
|
onPress={() => {}}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
textStyle={styles.textbtnstyle}
|
textStyle={styles.textbtnstyle}>
|
||||||
>
|
|
||||||
{this.state.statut}
|
{this.state.statut}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
return (<View style={{
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
paddingTop: 10
|
paddingTop: 10,
|
||||||
}}>
|
}}>
|
||||||
|
<View
|
||||||
<View style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
}}>
|
}}>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
|
@ -361,24 +389,25 @@ class HistoryItemDetails extends Component {
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
backgroundColor: this.state.color
|
backgroundColor: this.state.color,
|
||||||
}}
|
}}
|
||||||
isLoading={this.props.loadingTreatDemand}
|
isLoading={this.props.loadingTreatDemand}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
triggerTreatmentClick: true
|
triggerTreatmentClick: true,
|
||||||
});
|
});
|
||||||
this.onTreatDemand()
|
this.onTreatDemand();
|
||||||
|
|
||||||
}}
|
}}
|
||||||
textStyle={styles.textbtnstyle}
|
textStyle={styles.textbtnstyle}>
|
||||||
>
|
|
||||||
{this.state.statut}
|
{this.state.statut}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
}}>
|
}}>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
|
@ -386,21 +415,21 @@ class HistoryItemDetails extends Component {
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
backgroundColor: Color.redColor
|
backgroundColor: Color.redColor,
|
||||||
}}
|
}}
|
||||||
isLoading={this.props.loadingCancelDemand}
|
isLoading={this.props.loadingCancelDemand}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
triggerCancelClick: true
|
triggerCancelClick: true,
|
||||||
});
|
});
|
||||||
this.onCancelDemand();
|
this.onCancelDemand();
|
||||||
}}
|
}}
|
||||||
textStyle={styles.textbtnstyle}
|
textStyle={styles.textbtnstyle}>
|
||||||
>
|
|
||||||
{I18n.t('REFUSER_DEMANDE')}
|
{I18n.t('REFUSER_DEMANDE')}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>)
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,174 +439,201 @@ class HistoryItemDetails extends Component {
|
||||||
let ago = moment.tz(this.item.date_creation, moment.tz.guess()).format();
|
let ago = moment.tz(this.item.date_creation, moment.tz.guess()).format();
|
||||||
ago = moment(ago);
|
ago = moment(ago);
|
||||||
|
|
||||||
let cancelDate = "";
|
let cancelDate = '';
|
||||||
if (parseInt(this.item.canceled_by_hypervisor) === 1) {
|
if (parseInt(this.item.canceled_by_hypervisor) === 1) {
|
||||||
console.log("CANCEL DATE", this.item.cancellation_date);
|
console.log('CANCEL DATE', this.item.cancellation_date);
|
||||||
cancelDate = moment.tz(this.item.cancellation_date, moment.tz.guess()).format();
|
cancelDate = moment
|
||||||
|
.tz(this.item.cancellation_date, moment.tz.guess())
|
||||||
|
.format();
|
||||||
cancelDate = moment(cancelDate);
|
cancelDate = moment(cancelDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{this.renderPromptModifyAmountToSend()}
|
{this.renderPromptModifyAmountToSend()}
|
||||||
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()}
|
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) &&
|
||||||
<CardView
|
this.renderAlertErrorTreatOrCancelDemand()}
|
||||||
style={styles.cardcontainer1}
|
<CardView style={styles.cardcontainer1}>
|
||||||
><Text style={{
|
<Text
|
||||||
|
style={{
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'black',
|
color: 'black',
|
||||||
marginLeft: responsiveWidth(5)
|
marginLeft: responsiveWidth(5),
|
||||||
}}>{I18n.t('MEMBER_INFO')}</Text>
|
|
||||||
<View style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'flex-start'
|
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-call'
|
{I18n.t('MEMBER_INFO')}
|
||||||
|
</Text>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
}}>
|
||||||
|
<Icons
|
||||||
|
name="md-call"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.simpleuser}>{this.item.phone}</Text>
|
<Text style={styles.simpleuser}>{this.item.phone}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'flex-start'
|
justifyContent: 'flex-start',
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-person'
|
<Icons
|
||||||
|
name="md-person"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.simpleuser}>{this.item.code_membre}</Text>
|
<Text style={styles.simpleuser}>{this.item.code_membre}</Text>
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
<CardView
|
<CardView style={styles.cardcontainer}>
|
||||||
style={styles.cardcontainer}
|
<Text
|
||||||
>
|
style={{
|
||||||
<Text style={{
|
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'black',
|
color: 'black',
|
||||||
marginLeft: responsiveWidth(5)
|
marginLeft: responsiveWidth(5),
|
||||||
}}>{I18n.t('DEMAND_INFO')}</Text>
|
|
||||||
<View style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'flex-start'
|
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-git-branch'
|
{I18n.t('DEMAND_INFO')}
|
||||||
|
</Text>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
}}>
|
||||||
|
<Icons
|
||||||
|
name="md-git-branch"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.simpleuser}>{this.item.code_parrain}</Text>
|
<Text style={styles.simpleuser}>{this.item.code_parrain}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'flex-start'
|
justifyContent: 'flex-start',
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-code-working'
|
<Icons
|
||||||
|
name="md-code-working"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
|
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'flex-start'
|
justifyContent: 'flex-start',
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-wallet'
|
<Icons
|
||||||
|
name="md-wallet"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.simpleuser}>{this.item.montant}</Text>
|
<Text style={styles.simpleuser}>{this.item.montant}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'flex-start'
|
justifyContent: 'flex-start',
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-calendar'
|
<Icons
|
||||||
|
name="md-calendar"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.simpleuser}>{ago.format(" Do MMMM YYYY à HH:mm")}</Text>
|
<Text style={styles.simpleuser}>
|
||||||
|
{ago.format(' Do MMMM YYYY à HH:mm')}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{
|
<View
|
||||||
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignSelf: 'flex-end',
|
alignSelf: 'flex-end',
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
justifyContent: 'flex-start'
|
justifyContent: 'flex-start',
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-time'
|
<Icons name="md-time" size={28} color={theme.accent} />
|
||||||
size={28}
|
<Text
|
||||||
color={theme.accent}
|
style={{
|
||||||
/>
|
|
||||||
<Text style={{
|
|
||||||
marginLeft: responsiveWidth(2),
|
marginLeft: responsiveWidth(2),
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: theme.accent
|
color: theme.accent,
|
||||||
|
}}>
|
||||||
}}>{ago.fromNow()}</Text>
|
{ago.fromNow()}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
{
|
{parseInt(this.item.canceled_by_hypervisor) === 1 && (
|
||||||
parseInt(this.item.canceled_by_hypervisor) === 1 &&
|
|
||||||
<CardView style={styles.cardcontainer}>
|
<CardView style={styles.cardcontainer}>
|
||||||
<Text style={{
|
<Text
|
||||||
|
style={{
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'black',
|
color: 'black',
|
||||||
marginLeft: responsiveWidth(5)
|
marginLeft: responsiveWidth(5),
|
||||||
}}>
|
}}>
|
||||||
{I18n.t('DEMAND_STATE')}
|
{I18n.t('DEMAND_STATE')}
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{
|
<View
|
||||||
flexDirection: 'row',
|
style={{
|
||||||
justifyContent: 'flex-start'
|
|
||||||
}}>
|
|
||||||
<Icons name='md-git-branch'
|
|
||||||
size={28}
|
|
||||||
color={theme.accent}
|
|
||||||
style={{marginLeft: 20}}/>
|
|
||||||
<Text style={styles.simpleuser}>{I18n.t('CANCEL_BY_HYPERVISOR')}</Text>
|
|
||||||
</View>
|
|
||||||
<View style={{
|
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'flex-start',
|
justifyContent: 'flex-start',
|
||||||
marginTop: -20
|
|
||||||
}}>
|
}}>
|
||||||
<Icons name='md-calendar'
|
<Icons
|
||||||
|
name="md-git-branch"
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{marginLeft: 20}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>
|
||||||
|
{I18n.t('CANCEL_BY_HYPERVISOR')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
marginTop: -20,
|
||||||
|
}}>
|
||||||
|
<Icons
|
||||||
|
name="md-calendar"
|
||||||
size={28}
|
size={28}
|
||||||
color={theme.accent}
|
color={theme.accent}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 20
|
marginLeft: 20,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text style={styles.simpleuser}>{`${I18n.t(
|
||||||
style={styles.simpleuser}>{`${I18n.t('CANCEL_ON')} ${cancelDate.format(" Do MMMM YYYY à HH:mm")}`}</Text>
|
'CANCEL_ON',
|
||||||
|
)} ${cancelDate.format(' Do MMMM YYYY à HH:mm')}`}</Text>
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
}
|
)}
|
||||||
{this.state.user ? this.renderBtn() : null}
|
{this.state.user ? this.renderBtn() : null}
|
||||||
</View>)
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
|
@ -587,16 +643,20 @@ const mapStateToProps = state => ({
|
||||||
|
|
||||||
loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand,
|
loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand,
|
||||||
resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand,
|
resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand,
|
||||||
errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand
|
errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
const mapDispatchToProps = dispatch =>
|
||||||
|
bindActionCreators(
|
||||||
|
{
|
||||||
treatCreditDemand: treatCreditDemand,
|
treatCreditDemand: treatCreditDemand,
|
||||||
creditDemandResetReducer: creditDemandResetReducer,
|
creditDemandResetReducer: creditDemandResetReducer,
|
||||||
|
|
||||||
treatCancelDemand: treatCancelDemand,
|
treatCancelDemand: treatCancelDemand,
|
||||||
creditCancelResetReducer: creditCancelResetReducer
|
creditCancelResetReducer: creditCancelResetReducer,
|
||||||
}, dispatch);
|
},
|
||||||
|
dispatch,
|
||||||
|
);
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(HistoryItemDetails);
|
export default connect(mapStateToProps, mapDispatchToProps)(HistoryItemDetails);
|
||||||
|
|
||||||
|
@ -611,30 +671,29 @@ const styles = StyleSheet.create({
|
||||||
android: {
|
android: {
|
||||||
borderBottomColor: Color.borderColor,
|
borderBottomColor: Color.borderColor,
|
||||||
borderBottomWidth: 0.5,
|
borderBottomWidth: 0.5,
|
||||||
}
|
},
|
||||||
})
|
}),
|
||||||
},
|
},
|
||||||
simpleuser: {
|
simpleuser: {
|
||||||
marginLeft: responsiveWidth(2),
|
marginLeft: responsiveWidth(2),
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: '#3E3E3E'
|
color: '#3E3E3E',
|
||||||
},
|
},
|
||||||
textbtnstyle: {
|
textbtnstyle: {
|
||||||
color: "white",
|
color: 'white',
|
||||||
fontWeight: "bold",
|
fontWeight: 'bold',
|
||||||
fontSize: 18
|
fontSize: 18,
|
||||||
},
|
},
|
||||||
cardcontainer1: {
|
cardcontainer1: {
|
||||||
justifyContent: 'space-evenly',
|
justifyContent: 'space-evenly',
|
||||||
flex: 2,
|
flex: 2,
|
||||||
marginRight: 3,
|
marginRight: 3,
|
||||||
marginLeft: 3,
|
marginLeft: 3,
|
||||||
|
|
||||||
},
|
},
|
||||||
cardcontainer: {
|
cardcontainer: {
|
||||||
justifyContent: 'space-evenly',
|
justifyContent: 'space-evenly',
|
||||||
|
|
||||||
flex: 3,
|
flex: 3,
|
||||||
margin: 3,
|
margin: 3,
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
|
/* eslint-disable no-sequences */
|
||||||
/**
|
/**
|
||||||
* Sample React Native App
|
* Sample React Native App
|
||||||
* https://github.com/facebook/react-native
|
* https://github.com/facebook/react-native
|
||||||
|
@ -7,12 +9,26 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Platform, StyleSheet, Text, View,ScrollView,
|
import {
|
||||||
|
Platform,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
ScrollView,
|
||||||
Alert,
|
Alert,
|
||||||
FlatList,ProgressViewIOS,ProgressBarAndroid,PickerIOS,StatusBar} from 'react-native';
|
FlatList,
|
||||||
|
ProgressViewIOS,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
PickerIOS,
|
||||||
|
StatusBar,
|
||||||
|
} from 'react-native';
|
||||||
import ActionButton from 'react-native-action-button';
|
import ActionButton from 'react-native-action-button';
|
||||||
import MapView from 'react-native-maps';
|
import MapView from 'react-native-maps';
|
||||||
import {responsiveHeight,responsiveWidth, responsiveFontSize} from 'react-native-responsive-dimensions';
|
import {
|
||||||
|
responsiveHeight,
|
||||||
|
responsiveWidth,
|
||||||
|
responsiveFontSize,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
import CardView from 'react-native-cardview';
|
import CardView from 'react-native-cardview';
|
||||||
import {Sae} from 'react-native-textinput-effects';
|
import {Sae} from 'react-native-textinput-effects';
|
||||||
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
|
@ -20,16 +36,24 @@ import Button from 'apsl-react-native-button';
|
||||||
import {primary, primaryDark, accent} from '../../utils/theme.json';
|
import {primary, primaryDark, accent} from '../../utils/theme.json';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import {isNumber} from 'util';
|
import {isNumber} from 'util';
|
||||||
import {readUser} from './../../webservice/AuthApi'
|
import {readUser} from './../../webservice/AuthApi';
|
||||||
import {sendDemande} from './../../webservice/HistoryRequestApi'
|
import {sendDemande} from './../../webservice/HistoryRequestApi';
|
||||||
import {sendDemandeSpecificque} from "../../webservice/HistoryRequestApi";
|
import {sendDemandeSpecificque} from '../../webservice/HistoryRequestApi';
|
||||||
import {getAgentNetworksList} from "../../webservice/NetworkApi";
|
import {getAgentNetworksList} from '../../webservice/NetworkApi';
|
||||||
import {HelperText,TextInput} from 'react-native-paper'
|
import {HelperText, TextInput} from 'react-native-paper';
|
||||||
import I18n from "react-native-i18n"
|
import I18n from 'react-native-i18n';
|
||||||
import { Dropdown } from "react-native-material-dropdown-v2"
|
import {Dropdown} from 'react-native-material-dropdown-v2';
|
||||||
type Props = {}
|
type Props = {};
|
||||||
const route=require('../../route.json')
|
const route = require('../../route.json');
|
||||||
import { Card, CardTitle, CardContent, CardAction, CardButton, CardImage,Title } from 'react-native-material-cards'
|
import {
|
||||||
|
Card,
|
||||||
|
CardTitle,
|
||||||
|
CardContent,
|
||||||
|
CardAction,
|
||||||
|
CardButton,
|
||||||
|
CardImage,
|
||||||
|
Title,
|
||||||
|
} from 'react-native-material-cards';
|
||||||
export default class HistoryRequester extends Component {
|
export default class HistoryRequester extends Component {
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarHidden: true,
|
navBarHidden: true,
|
||||||
|
@ -37,15 +61,15 @@ export default class HistoryRequester extends Component {
|
||||||
static navigationOptions = {
|
static navigationOptions = {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
headerTitle: I18n.t('ASK_CREDIT'),
|
headerTitle: I18n.t('ASK_CREDIT'),
|
||||||
title:I18n.t('ASK_CREDIT')
|
title: I18n.t('ASK_CREDIT'),
|
||||||
};
|
};
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
this.updateState()
|
this.updateState();
|
||||||
}
|
}
|
||||||
handleViewRef=ref=>this.numberView=ref;
|
handleViewRef = ref => (this.numberView = ref);
|
||||||
handleMontantRef=ref=>this.montantView=ref;
|
handleMontantRef = ref => (this.montantView = ref);
|
||||||
initState() {
|
initState() {
|
||||||
return {
|
return {
|
||||||
phone: null,
|
phone: null,
|
||||||
|
@ -56,157 +80,168 @@ export default class HistoryRequester extends Component {
|
||||||
user: null,
|
user: null,
|
||||||
visibleError: false,
|
visibleError: false,
|
||||||
currentNetwork: {nt: 1},
|
currentNetwork: {nt: 1},
|
||||||
errorAnimation:"",
|
errorAnimation: '',
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onUserCancel() {
|
onUserCancel() {
|
||||||
this.props.navigation.goBack()
|
this.props.navigation.goBack();
|
||||||
}
|
}
|
||||||
onUserSend() {
|
onUserSend() {
|
||||||
var validMontant=true
|
var validMontant = true;
|
||||||
if (!isNumber(this.state.montant) || this.state.montant > 1000000) {
|
if (!isNumber(this.state.montant) || this.state.montant > 1000000) {
|
||||||
validMontant=false
|
validMontant = false;
|
||||||
}
|
}
|
||||||
this.setState({visibleError:!validMontant})
|
this.setState({visibleError: !validMontant});
|
||||||
if (!validMontant) {
|
if (!validMontant) {
|
||||||
this.montantView.shake(800)
|
this.montantView.shake(800);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({visibleError:false})
|
this.setState({visibleError: false});
|
||||||
},3000)
|
}, 3000);
|
||||||
}
|
} else {
|
||||||
else {
|
this.setState({isSending: true});
|
||||||
this.setState({isSending:true})
|
let title = '';
|
||||||
let title=""
|
let message = '';
|
||||||
let message=""
|
sendDemandeSpecificque(
|
||||||
sendDemandeSpecificque(this.state.montant,this.state.user.phoneTransaction,this.state.user.code_membre).then((data)=> {
|
this.state.montant,
|
||||||
|
this.state.user.phoneTransaction,
|
||||||
|
this.state.user.code_membre,
|
||||||
|
)
|
||||||
|
.then(data => {
|
||||||
if (data.success !== undefined) {
|
if (data.success !== undefined) {
|
||||||
if (data.success === 1) {
|
if (data.success === 1) {
|
||||||
title= I18n.t('DEMAND_SEND'),
|
(title = I18n.t('DEMAND_SEND')),
|
||||||
message=I18n.t('DEMAND_SEND_SUCCESFUL')
|
(message = I18n.t('DEMAND_SEND_SUCCESFUL'));
|
||||||
} else {
|
} else {
|
||||||
title= "Erreur survenu lors de l'envoie ",
|
(title = "Erreur survenu lors de l'envoie "),
|
||||||
message="Une erreur est survenu lors de l'envoie de la demande"
|
(message =
|
||||||
|
"Une erreur est survenu lors de l'envoie de la demande");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
title= "Erreur survenu lors de l'envoie ",
|
(title = "Erreur survenu lors de l'envoie "),
|
||||||
message="Une erreur est survenu lors de l'envoie de la demande"
|
(message =
|
||||||
|
"Une erreur est survenu lors de l'envoie de la demande");
|
||||||
}
|
}
|
||||||
Alert.alert(title,message,[{text:'Ok',onPress:()=>{
|
Alert.alert(title, message, [
|
||||||
this.setState({montant: ""})
|
{
|
||||||
}}])
|
text: 'Ok',
|
||||||
|
onPress: () => {
|
||||||
|
this.setState({montant: ''});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({isSending: false})
|
this.setState({isSending: false});
|
||||||
}, 800)
|
}, 800);
|
||||||
|
|
||||||
}).catch((error)=>{
|
|
||||||
title= "Erreur survenu lors de l'envoie ",
|
|
||||||
message="Une erreur est survenu lors de l'envoie de la demande"
|
|
||||||
Alert.alert(title,message,[{text:'Ok'}])
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
.catch(error => {
|
||||||
|
(title = "Erreur survenu lors de l'envoie "),
|
||||||
|
(message = "Une erreur est survenu lors de l'envoie de la demande");
|
||||||
|
Alert.alert(title, message, [{text: 'Ok'}]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const {user}=this.state
|
const {user} = this.state;
|
||||||
return (
|
return (
|
||||||
<View style={{flex:1,alignItems:'center',backgroundColor:"lightgrey",paddingTop:responsiveHeight(10)}}>
|
<View
|
||||||
<StatusBar
|
style={{
|
||||||
translucent={false}
|
flex: 1,
|
||||||
/>
|
alignItems: 'center',
|
||||||
{user?((user.category === "geolocated")?
|
backgroundColor: 'lightgrey',
|
||||||
this.multiNetwork(): this.simpleAgent()):
|
paddingTop: responsiveHeight(10),
|
||||||
<ProgressBarAndroid/>
|
}}>
|
||||||
}
|
<StatusBar translucent={false} />
|
||||||
</View>
|
{user ? (
|
||||||
|
user.category === 'geolocated' ? (
|
||||||
|
this.multiNetwork()
|
||||||
|
) : (
|
||||||
|
this.simpleAgent()
|
||||||
)
|
)
|
||||||
|
) : (
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
simpleAgent() {
|
simpleAgent() {
|
||||||
let montant=0
|
let montant = 0;
|
||||||
if (true) {
|
if (true) {
|
||||||
return (<View style={{height:200}}>
|
return (
|
||||||
|
<View style={{height: 200}}>
|
||||||
<Card style={{width: responsiveWidth(96), paddingTop: 20}}>
|
<Card style={{width: responsiveWidth(96), paddingTop: 20}}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<View>
|
<View>
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<TextInput
|
<TextInput
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
ref={(ref)=> {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
|
mode={'outlined'}
|
||||||
mode={"outlined"}
|
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
try {
|
try {
|
||||||
let neb=parseInt(text)
|
let neb = parseInt(text);
|
||||||
this.setState({montant:neb,isDisabled:isNaN(neb)})
|
this.setState({montant: neb, isDisabled: isNaN(neb)});
|
||||||
}catch (e) {
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
/>
|
/>
|
||||||
<HelperText
|
<HelperText type="error" visible={this.state.visibleError}>
|
||||||
type="error"
|
|
||||||
visible={this.state.visibleError}>
|
|
||||||
{I18n.t('INVALID_MONTANT')}
|
{I18n.t('INVALID_MONTANT')}
|
||||||
</HelperText>
|
</HelperText>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardAction
|
<CardAction separator={true} inColumn={false}>
|
||||||
separator={true}
|
|
||||||
inColumn={false}>
|
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {this.onUserCancel()}}
|
onPress={() => {
|
||||||
|
this.onUserCancel();
|
||||||
|
}}
|
||||||
title={I18n.t('CANCEL')}
|
title={I18n.t('CANCEL')}
|
||||||
color="crimson"
|
color="crimson"
|
||||||
/>
|
/>
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {this.onUserSend()}}
|
onPress={() => {
|
||||||
|
this.onUserSend();
|
||||||
|
}}
|
||||||
title={I18n.t('SEND')}
|
title={I18n.t('SEND')}
|
||||||
color="steelblue"
|
color="steelblue"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</CardAction>
|
</CardAction>
|
||||||
</Card>
|
</Card>
|
||||||
</View>)
|
</View>
|
||||||
}else
|
);
|
||||||
return ( <View style={styles.container}>
|
} else {
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
<CardView style={styles.cardInput}>
|
<CardView style={styles.cardInput}>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.title}>Demande de credit</Text>
|
<Text style={styles.title}>Demande de credit</Text>
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<Sae
|
<Sae
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
iconClass={FontAwesomeIcon}
|
iconClass={FontAwesomeIcon}
|
||||||
iconName={'dollar'}
|
iconName={'dollar'}
|
||||||
iconColor={primary}
|
iconColor={primary}
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
ref={(ref)=> {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
try {
|
try {
|
||||||
montant = parseFloat(text);
|
montant = parseFloat(text);
|
||||||
this.setState({isDisabled:montant>0,montant:montant})
|
this.setState({
|
||||||
|
isDisabled: montant > 0,
|
||||||
} catch (e) {
|
montant: montant,
|
||||||
|
});
|
||||||
}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
|
@ -215,103 +250,112 @@ export default class HistoryRequester extends Component {
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.btnContainer}>
|
<View style={styles.btnContainer}>
|
||||||
<Button style={styles.button_1} textStyle={styles.button_1_text} onPress={()=>this.onUserCancel()}>
|
<Button
|
||||||
|
style={styles.button_1}
|
||||||
|
textStyle={styles.button_1_text}
|
||||||
|
onPress={() => this.onUserCancel()}>
|
||||||
{I18n.t('CANCEL')}
|
{I18n.t('CANCEL')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button isLoading={this.state.isSending} isDisabled={!this.state.isDisabled} style={styles.button_2}
|
<Button
|
||||||
ref={(r)=>{this.refBtn=r}}
|
isLoading={this.state.isSending}
|
||||||
textStyle={styles.button_2_text} onPress={()=>{
|
isDisabled={!this.state.isDisabled}
|
||||||
this.onUserSend()
|
style={styles.button_2}
|
||||||
|
ref={r => {
|
||||||
|
this.refBtn = r;
|
||||||
|
}}
|
||||||
|
textStyle={styles.button_2_text}
|
||||||
|
onPress={() => {
|
||||||
|
this.onUserSend();
|
||||||
}}>
|
}}>
|
||||||
{I18n.t('SEND')}
|
{I18n.t('SEND')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
multiNetwork() {
|
multiNetwork() {
|
||||||
if (true) {
|
if (true) {
|
||||||
return (<View style={{height:250,justifyContent:'center'}}>
|
return (
|
||||||
|
<View style={{height: 250, justifyContent: 'center'}}>
|
||||||
<Card style={{width: responsiveWidth(96), justifyContent: 'center'}}>
|
<Card style={{width: responsiveWidth(96), justifyContent: 'center'}}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<View style={{flex: 1}}>
|
<View style={{flex: 1}}>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
label={I18n.t("SELECT_NETWORK")}
|
label={I18n.t('SELECT_NETWORK')}
|
||||||
style={{flex: 1, width: responsiveWidth(70)}}
|
style={{flex: 1, width: responsiveWidth(70)}}
|
||||||
labelExtractor={(item, index) => {
|
labelExtractor={(item, index) => {
|
||||||
return (item)?I18n.t("FOR_NUMB")+item.phone +" ("+item.name+")":I18n.t("SELECT_NETWORK")
|
return item
|
||||||
|
? I18n.t('FOR_NUMB') + item.phone + ' (' + item.name + ')'
|
||||||
|
: I18n.t('SELECT_NETWORK');
|
||||||
}}
|
}}
|
||||||
valueExtractor={(item, index) => {
|
valueExtractor={(item, index) => {
|
||||||
return item.phone +" ("+item.name+")"
|
return item.phone + ' (' + item.name + ')';
|
||||||
|
|
||||||
}}
|
}}
|
||||||
onChangeText={(value, index, data) => {
|
onChangeText={(value, index, data) => {
|
||||||
this.setState({currentNetwork: data[index]})
|
this.setState({currentNetwork: data[index]});
|
||||||
|
|
||||||
}}
|
}}
|
||||||
data={this.state.networks}
|
data={this.state.networks}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<TextInput
|
<TextInput
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
ref={(ref)=> {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
|
mode={'outlined'}
|
||||||
mode={"outlined"}
|
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
try {
|
try {
|
||||||
let neb=parseInt(text)
|
let neb = parseInt(text);
|
||||||
this.setState({montant:neb,isDisabled:isNaN(neb)})
|
this.setState({montant: neb, isDisabled: isNaN(neb)});
|
||||||
}catch (e) {
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
/>
|
/>
|
||||||
<HelperText
|
<HelperText type="error" visible={this.state.visibleError}>
|
||||||
type="error"
|
|
||||||
visible={this.state.visibleError}>
|
|
||||||
{I18n.t('INVALID_MONTANT')}
|
{I18n.t('INVALID_MONTANT')}
|
||||||
</HelperText>
|
</HelperText>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
</View>
|
</View>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardAction
|
<CardAction separator={true} inColumn={false}>
|
||||||
separator={true}
|
|
||||||
inColumn={false}>
|
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {this.onUserCancel()}}
|
onPress={() => {
|
||||||
|
this.onUserCancel();
|
||||||
|
}}
|
||||||
title={I18n.t('CANCEL')}
|
title={I18n.t('CANCEL')}
|
||||||
color="crimson"
|
color="crimson"
|
||||||
/>
|
/>
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => { const {currentNetwork,montant}=this.state
|
onPress={() => {
|
||||||
if(currentNetwork!==undefined && currentNetwork.nt===undefined) {
|
const {currentNetwork, montant} = this.state;
|
||||||
this.onNetworkSend(currentNetwork.phone, currentNetwork.code_membre, montant)
|
if (
|
||||||
}}}
|
currentNetwork !== undefined &&
|
||||||
|
currentNetwork.nt === undefined
|
||||||
|
) {
|
||||||
|
this.onNetworkSend(
|
||||||
|
currentNetwork.phone,
|
||||||
|
currentNetwork.code_membre,
|
||||||
|
montant,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
title={I18n.t('SEND')}
|
title={I18n.t('SEND')}
|
||||||
color="steelblue"
|
color="steelblue"
|
||||||
/>
|
/>
|
||||||
</CardAction>
|
</CardAction>
|
||||||
</Card>
|
</Card>
|
||||||
</View>)
|
</View>
|
||||||
}
|
);
|
||||||
else
|
} else {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container2}>
|
<View style={styles.container2}>
|
||||||
<CardView style={styles.cardInput2}>
|
<CardView style={styles.cardInput2}>
|
||||||
|
@ -319,37 +363,41 @@ export default class HistoryRequester extends Component {
|
||||||
<Text style={styles.title}>{I18n.t('ASK_CREDIT')}</Text>
|
<Text style={styles.title}>{I18n.t('ASK_CREDIT')}</Text>
|
||||||
<Picker
|
<Picker
|
||||||
selectedValue={this.state.currentNetwork}
|
selectedValue={this.state.currentNetwork}
|
||||||
prompt={"Selectionner un reseau"}
|
prompt={'Selectionner un reseau'}
|
||||||
style={{height: 50, width: responsiveWidth(100)}}
|
style={{height: 50, width: responsiveWidth(100)}}
|
||||||
itemStyle={styles.subtitle}
|
itemStyle={styles.subtitle}
|
||||||
onValueChange={(itemValue, itemIndex) =>
|
onValueChange={(itemValue, itemIndex) =>
|
||||||
this.setState({currentNetwork: itemValue})
|
this.setState({currentNetwork: itemValue})
|
||||||
}>
|
}>
|
||||||
{this.state.networks.map((item, index) => {
|
{this.state.networks.map((item, index) => {
|
||||||
return(<Picker.Item label={item.nt?"Selectionner un reseau":"Pour le "+item.phone +" ("+item.name+")"} value={item} />)
|
return (
|
||||||
|
<Picker.Item
|
||||||
|
label={
|
||||||
|
item.nt
|
||||||
|
? 'Selectionner un reseau'
|
||||||
|
: 'Pour le ' + item.phone + ' (' + item.name + ')'
|
||||||
|
}
|
||||||
|
value={item}
|
||||||
|
/>
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
</Picker>
|
</Picker>
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<Sae
|
<Sae
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
iconClass={FontAwesomeIcon}
|
iconClass={FontAwesomeIcon}
|
||||||
iconName={'dollar'}
|
iconName={'dollar'}
|
||||||
iconColor={primary}
|
iconColor={primary}
|
||||||
ref={(ref)=> {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
try {
|
try {
|
||||||
let neb=parseInt(text)
|
let neb = parseInt(text);
|
||||||
this.setState({montant:neb,isDisabled:isNaN(neb)})
|
this.setState({montant: neb, isDisabled: isNaN(neb)});
|
||||||
}catch (e) {
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
labelStyle={input.label}
|
labelStyle={input.label}
|
||||||
|
@ -357,72 +405,82 @@ export default class HistoryRequester extends Component {
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.btnContainer}>
|
<View style={styles.btnContainer}>
|
||||||
<Button style={styles.button_1}
|
<Button
|
||||||
textStyle={styles.button_1_text} onPress={()=>this.onUserCancel()}>
|
style={styles.button_1}
|
||||||
|
textStyle={styles.button_1_text}
|
||||||
|
onPress={() => this.onUserCancel()}>
|
||||||
{I18n.t('CANCEL')}
|
{I18n.t('CANCEL')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
ref={ref => {
|
ref={ref => {
|
||||||
this.refBtn=ref
|
this.refBtn = ref;
|
||||||
}}
|
}}
|
||||||
isDisabled={this.state.isDisabled}
|
isDisabled={this.state.isDisabled}
|
||||||
style={styles.button_2}
|
style={styles.button_2}
|
||||||
textStyle={styles.button_2_text}
|
textStyle={styles.button_2_text}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
const {currentNetwork,montant}=this.state
|
const {currentNetwork, montant} = this.state;
|
||||||
if(currentNetwork!==undefined && currentNetwork.nt===undefined) {
|
if (
|
||||||
this.onNetworkSend(currentNetwork.phone, currentNetwork.code_membre, montant, this.refInp, this.refBtn)
|
currentNetwork !== undefined &&
|
||||||
|
currentNetwork.nt === undefined
|
||||||
|
) {
|
||||||
|
this.onNetworkSend(
|
||||||
|
currentNetwork.phone,
|
||||||
|
currentNetwork.code_membre,
|
||||||
|
montant,
|
||||||
|
this.refInp,
|
||||||
|
this.refBtn,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
{I18n.t('SEND')}
|
{I18n.t('SEND')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
</View>)
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSingleNetwork(item) {
|
renderSingleNetwork(item) {
|
||||||
const itm=item.item
|
const itm = item.item;
|
||||||
console.log(item)
|
console.log(item);
|
||||||
let refInp=null,refBtn=null
|
let refInp = null,
|
||||||
let montant=0
|
refBtn = null;
|
||||||
return ( <View style={styles.container2}>
|
let montant = 0;
|
||||||
|
return (
|
||||||
|
<View style={styles.container2}>
|
||||||
<CardView style={styles.cardInput2}>
|
<CardView style={styles.cardInput2}>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.title}>{I18n.t('ASK_CREDIT')}</Text>
|
<Text style={styles.title}>{I18n.t('ASK_CREDIT')}</Text>
|
||||||
<Text style={styles.subtitle}>{I18n.t("FOR_NUMB")} {itm.phone} ({itm.name})</Text>
|
<Text style={styles.subtitle}>
|
||||||
<Animatable.View
|
{I18n.t('FOR_NUMB')} {itm.phone} ({itm.name})
|
||||||
ref={this.handleMontantRef}
|
</Text>
|
||||||
>
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
<Sae
|
<Sae
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
iconClass={FontAwesomeIcon}
|
iconClass={FontAwesomeIcon}
|
||||||
iconName={'dollar'}
|
iconName={'dollar'}
|
||||||
iconColor={primary}
|
iconColor={primary}
|
||||||
ref={(ref)=> {
|
ref={ref => {
|
||||||
refInp = ref
|
refInp = ref;
|
||||||
this.setState({refIn:refInp})
|
this.setState({refIn: refInp});
|
||||||
}}
|
}}
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
|
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
try {
|
try {
|
||||||
montant = parseFloat(text);
|
montant = parseFloat(text);
|
||||||
this.setStat({montant:montant})
|
this.setStat({montant: montant});
|
||||||
if (refBtn) {
|
if (refBtn) {
|
||||||
refBtn.setState({isDisabled:montant>0})
|
refBtn.setState({isDisabled: montant > 0});
|
||||||
refBtn.isDisabled=montant>0
|
refBtn.isDisabled = montant > 0;
|
||||||
|
|
||||||
}} catch (e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
|
@ -431,100 +489,107 @@ export default class HistoryRequester extends Component {
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.btnContainer}>
|
<View style={styles.btnContainer}>
|
||||||
<Button style={styles.button_1} textStyle={styles.button_1_text} onPress={()=>this.onUserCancel()}>
|
<Button
|
||||||
|
style={styles.button_1}
|
||||||
|
textStyle={styles.button_1_text}
|
||||||
|
onPress={() => this.onUserCancel()}>
|
||||||
{I18n.t('CANCEL')}
|
{I18n.t('CANCEL')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
ref={ref => {
|
ref={ref => {
|
||||||
refBtn=ref
|
refBtn = ref;
|
||||||
}}
|
}}
|
||||||
style={styles.button_2}
|
style={styles.button_2}
|
||||||
textStyle={styles.button_2_text}
|
textStyle={styles.button_2_text}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onNetworkSend(itm.phone,itm.code_membre,refInp.state.value,refInp,refBtn)
|
this.onNetworkSend(
|
||||||
|
itm.phone,
|
||||||
|
itm.code_membre,
|
||||||
|
refInp.state.value,
|
||||||
|
refInp,
|
||||||
|
refBtn,
|
||||||
|
);
|
||||||
}}>
|
}}>
|
||||||
{I18n.t('SEND')}
|
{I18n.t('SEND')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
|
</View>
|
||||||
</View>)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
onNetworkSend(phone, code_membre, text) {
|
onNetworkSend(phone, code_membre, text) {
|
||||||
var validMontant=true
|
var validMontant = true;
|
||||||
let montant=parseFloat(text)
|
let montant = parseFloat(text);
|
||||||
if (montant === null || !isNumber(montant) || montant > 1000000) {
|
if (montant === null || !isNumber(montant) || montant > 1000000) {
|
||||||
validMontant=false
|
validMontant = false;
|
||||||
}
|
}
|
||||||
this.setState({visibleError:!validMontant})
|
this.setState({visibleError: !validMontant});
|
||||||
if (!validMontant) {
|
if (!validMontant) {
|
||||||
this.montantView.shake(800)
|
this.montantView.shake(800);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({visibleError:false})
|
this.setState({visibleError: false});
|
||||||
},3000)
|
}, 3000);
|
||||||
}
|
} else {
|
||||||
else {
|
sendDemandeSpecificque(montant, phone, code_membre).then(data => {
|
||||||
sendDemandeSpecificque(montant,phone,code_membre).then((data)=>{
|
var title = '';
|
||||||
var title=""
|
var message = '';
|
||||||
var message=""
|
|
||||||
if (data.success !== undefined) {
|
if (data.success !== undefined) {
|
||||||
if (data.success === 1) {
|
if (data.success === 1) {
|
||||||
title = I18n.t("DEMAND_SEND")
|
title = I18n.t('DEMAND_SEND');
|
||||||
message = I18n.t('DEMAND_SEND_SUCCESFUL')
|
message = I18n.t('DEMAND_SEND_SUCCESFUL');
|
||||||
} else {
|
} else {
|
||||||
title = "Erreur survenu lors de l'envoie "
|
title = "Erreur survenu lors de l'envoie ";
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
message = "Une erreur est survenu lors de l'envoie de la demande";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
title = "Erreur survenu lors de l'envoie "
|
title = "Erreur survenu lors de l'envoie ";
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
message = "Une erreur est survenu lors de l'envoie de la demande";
|
||||||
}
|
}
|
||||||
|
|
||||||
Alert.alert(title,message,[{text:"Ok",onPress:()=>{this.setState({montant:""})}}])
|
Alert.alert(title, message, [
|
||||||
|
{
|
||||||
})
|
text: 'Ok',
|
||||||
|
onPress: () => {
|
||||||
|
this.setState({montant: ''});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateState() {
|
async updateState() {
|
||||||
|
|
||||||
let user = await readUser();
|
let user = await readUser();
|
||||||
if(user.category==="geolocated"){
|
if (user.category === 'geolocated') {
|
||||||
let networks = await getAgentNetworksList(user.agentId);
|
let networks = await getAgentNetworksList(user.agentId);
|
||||||
console.log(networks)
|
console.log(networks);
|
||||||
if (networks.success === 1) {
|
if (networks.success === 1) {
|
||||||
let net=[this.state.currentNetwork]
|
let net = [this.state.currentNetwork];
|
||||||
networks.networks.forEach((item)=>{
|
networks.networks.forEach(item => {
|
||||||
net.push(item)
|
net.push(item);
|
||||||
|
});
|
||||||
})
|
this.setState({networks: net});
|
||||||
this.setState({networks: net})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({user:user})
|
this.setState({user: user});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = StyleSheet.create({
|
const input = StyleSheet.create({
|
||||||
selfitem: {
|
selfitem: {
|
||||||
|
|
||||||
width: responsiveWidth(70),
|
width: responsiveWidth(70),
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
color:primary
|
color: primary,
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
color:'black'
|
color: 'black',
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
title: {
|
title: {
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
|
@ -564,7 +629,6 @@ export default class HistoryRequester extends Component {
|
||||||
button_1: {
|
button_1: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
|
|
||||||
},
|
},
|
||||||
button_2: {
|
button_2: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -583,17 +647,15 @@ button_2_text:{
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
cardInput: {
|
cardInput: {
|
||||||
|
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
marginTop: responsiveHeight(5),
|
marginTop: responsiveHeight(5),
|
||||||
width: responsiveWidth(98),
|
width: responsiveWidth(98),
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
height:responsiveHeight(40)
|
height: responsiveHeight(40),
|
||||||
},
|
},
|
||||||
cardInput2: {
|
cardInput2: {
|
||||||
|
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
marginTop: responsiveHeight(1),
|
marginTop: responsiveHeight(1),
|
||||||
|
@ -601,5 +663,5 @@ button_2_text:{
|
||||||
height: responsiveHeight(50),
|
height: responsiveHeight(50),
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable prettier/prettier */
|
||||||
/**
|
/**
|
||||||
* Sample React Native App
|
* Sample React Native App
|
||||||
* https://github.com/facebook/react-native
|
* https://github.com/facebook/react-native
|
||||||
|
@ -7,8 +8,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Alert, BackHandler, Picker, ProgressBarAndroid, StatusBar, StyleSheet, Text, View} from 'react-native';
|
import {
|
||||||
import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
Alert,
|
||||||
|
BackHandler,
|
||||||
|
Picker,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
StatusBar,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
import {
|
||||||
|
responsiveFontSize,
|
||||||
|
responsiveHeight,
|
||||||
|
responsiveWidth,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
import CardView from 'react-native-cardview';
|
import CardView from 'react-native-cardview';
|
||||||
import {Sae} from 'react-native-textinput-effects';
|
import {Sae} from 'react-native-textinput-effects';
|
||||||
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||||
|
@ -16,16 +30,21 @@ import Button from 'apsl-react-native-button';
|
||||||
import {primary} from '../../utils/theme.json';
|
import {primary} from '../../utils/theme.json';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import {isNumber} from 'util';
|
import {isNumber} from 'util';
|
||||||
import {readUser} from './../../webservice/AuthApi'
|
import {readUser} from './../../webservice/AuthApi';
|
||||||
import {sendDemandeSpecificque} from "../../webservice/HistoryRequestApi";
|
import {sendDemandeSpecificque} from '../../webservice/HistoryRequestApi';
|
||||||
import {getAgentNetworksList} from "../../webservice/NetworkApi";
|
import {getAgentNetworksList} from '../../webservice/NetworkApi';
|
||||||
import {HelperText, TextInput} from 'react-native-paper'
|
import {HelperText, TextInput} from 'react-native-paper';
|
||||||
import I18n from "react-native-i18n"
|
import I18n from 'react-native-i18n';
|
||||||
import {ProgressDialog} from 'react-native-simple-dialogs';
|
import {ProgressDialog} from 'react-native-simple-dialogs';
|
||||||
import {Card, CardAction, CardButton, CardContent} from 'react-native-material-cards'
|
import {
|
||||||
|
Card,
|
||||||
|
CardAction,
|
||||||
|
CardButton,
|
||||||
|
CardContent,
|
||||||
|
} from 'react-native-material-cards';
|
||||||
|
|
||||||
type Props = {}
|
type Props = {};
|
||||||
const route = require('../../route.json')
|
const route = require('../../route.json');
|
||||||
|
|
||||||
export default class HistoryRequester extends Component {
|
export default class HistoryRequester extends Component {
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
|
@ -34,7 +53,7 @@ export default class HistoryRequester extends Component {
|
||||||
static navigationOptions = {
|
static navigationOptions = {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
headerTitle: I18n.t('ASK_CREDIT'),
|
headerTitle: I18n.t('ASK_CREDIT'),
|
||||||
title: I18n.t('ASK_CREDIT')
|
title: I18n.t('ASK_CREDIT'),
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -56,8 +75,8 @@ export default class HistoryRequester extends Component {
|
||||||
this.props.navigation.state.params.onGoBack();
|
this.props.navigation.state.params.onGoBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleViewRef = ref => this.numberView = ref;
|
handleViewRef = ref => (this.numberView = ref);
|
||||||
handleMontantRef = ref => this.montantView = ref;
|
handleMontantRef = ref => (this.montantView = ref);
|
||||||
|
|
||||||
initState() {
|
initState() {
|
||||||
return {
|
return {
|
||||||
|
@ -69,13 +88,13 @@ export default class HistoryRequester extends Component {
|
||||||
user: null,
|
user: null,
|
||||||
visibleError: false,
|
visibleError: false,
|
||||||
currentNetwork: {nt: 1},
|
currentNetwork: {nt: 1},
|
||||||
errorAnimation: "",
|
errorAnimation: '',
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
backPressed = () => {
|
backPressed = () => {
|
||||||
this.props.navigation.state.params.onGoBack();
|
this.props.navigation.state.params.onGoBack();
|
||||||
}
|
};
|
||||||
|
|
||||||
onUserCancel() {
|
onUserCancel() {
|
||||||
console.log(this.props);
|
console.log(this.props);
|
||||||
|
@ -84,50 +103,58 @@ export default class HistoryRequester extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onUserSend() {
|
onUserSend() {
|
||||||
var validMontant = true
|
var validMontant = true;
|
||||||
if (!isNumber(this.state.montant) || this.state.montant > 1000000) {
|
if (!isNumber(this.state.montant) || this.state.montant > 1000000) {
|
||||||
validMontant = false
|
validMontant = false;
|
||||||
}
|
}
|
||||||
this.setState({visibleError: !validMontant})
|
this.setState({visibleError: !validMontant});
|
||||||
if (!validMontant) {
|
if (!validMontant) {
|
||||||
this.montantView.shake(800)
|
this.montantView.shake(800);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({visibleError: false})
|
this.setState({visibleError: false});
|
||||||
}, 3000)
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
this.setState({isSending: true});
|
this.setState({isSending: true});
|
||||||
let title = ""
|
let title = '';
|
||||||
let message = ""
|
let message = '';
|
||||||
sendDemandeSpecificque(this.state.montant, this.state.user.phoneTransaction, this.state.user.code_membre).then((data) => {
|
sendDemandeSpecificque(
|
||||||
|
this.state.montant,
|
||||||
|
this.state.user.phoneTransaction,
|
||||||
|
this.state.user.code_membre,
|
||||||
|
)
|
||||||
|
.then(data => {
|
||||||
console.warn(data);
|
console.warn(data);
|
||||||
this.setState({isSending: false});
|
this.setState({isSending: false});
|
||||||
if (data.success !== undefined) {
|
if (data.success !== undefined) {
|
||||||
if (data.success === 1) {
|
if (data.success === 1) {
|
||||||
title = I18n.t('DEMAND_SEND'),
|
(title = I18n.t('DEMAND_SEND')),
|
||||||
message = I18n.t('DEMAND_SEND_SUCCESFUL')
|
(message = I18n.t('DEMAND_SEND_SUCCESFUL'));
|
||||||
} else {
|
} else {
|
||||||
title = "Erreur survenu lors de l'envoie ",
|
(title = "Erreur survenu lors de l'envoie "),
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
(message =
|
||||||
|
"Une erreur est survenu lors de l'envoie de la demande");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
title = "Erreur survenu lors de l'envoie ",
|
(title = "Erreur survenu lors de l'envoie "),
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
(message =
|
||||||
|
"Une erreur est survenu lors de l'envoie de la demande");
|
||||||
}
|
}
|
||||||
Alert.alert(title, message, [{
|
Alert.alert(title, message, [
|
||||||
text: 'Ok', onPress: () => {
|
{
|
||||||
this.setState({montant: ""})
|
text: 'Ok',
|
||||||
}
|
onPress: () => {
|
||||||
}]);
|
this.setState({montant: ''});
|
||||||
}).catch((error) => {
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
this.setState({isSending: false});
|
this.setState({isSending: false});
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
title = "Erreur survenu lors de l'envoie ",
|
(title = "Erreur survenu lors de l'envoie "),
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
(message = "Une erreur est survenu lors de l'envoie de la demande");
|
||||||
Alert.alert(title, message, [{text: 'Ok'}])
|
Alert.alert(title, message, [{text: 'Ok'}]);
|
||||||
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,107 +163,105 @@ export default class HistoryRequester extends Component {
|
||||||
console.log(this.state);
|
console.log(this.state);
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{flex: 1, alignItems: 'center', backgroundColor: "lightgrey", paddingTop: responsiveHeight(10)}}>
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center',
|
||||||
|
backgroundColor: 'lightgrey',
|
||||||
|
paddingTop: responsiveHeight(10),
|
||||||
|
}}>
|
||||||
{this.state.isSending && this.renderLoader()}
|
{this.state.isSending && this.renderLoader()}
|
||||||
<StatusBar
|
<StatusBar translucent={false} />
|
||||||
translucent={false}
|
{user ? (
|
||||||
/>
|
user.category === 'geolocated' ? (
|
||||||
{user ? ((user.category === "geolocated") ?
|
this.multiNetwork()
|
||||||
this.multiNetwork() : this.simpleAgent()) :
|
) : (
|
||||||
<ProgressBarAndroid/>
|
this.simpleAgent()
|
||||||
}
|
|
||||||
</View>
|
|
||||||
)
|
)
|
||||||
|
) : (
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
simpleAgent() {
|
simpleAgent() {
|
||||||
let montant = 0
|
let montant = 0;
|
||||||
if (true) {
|
if (true) {
|
||||||
return (<View style={{height: 200}}>
|
return (
|
||||||
|
<View style={{height: 200}}>
|
||||||
<Card style={{width: responsiveWidth(96), paddingTop: 20}}>
|
<Card style={{width: responsiveWidth(96), paddingTop: 20}}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<View>
|
<View>
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<TextInput
|
<TextInput
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
ref={(ref) => {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
|
mode={'outlined'}
|
||||||
mode={"outlined"}
|
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
try {
|
try {
|
||||||
let neb = parseInt(text)
|
let neb = parseInt(text);
|
||||||
this.setState({montant: neb, isDisabled: isNaN(neb)})
|
this.setState({montant: neb, isDisabled: isNaN(neb)});
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
/>
|
/>
|
||||||
<HelperText
|
<HelperText type="error" visible={this.state.visibleError}>
|
||||||
type="error"
|
|
||||||
visible={this.state.visibleError}>
|
|
||||||
{I18n.t('INVALID_MONTANT')}
|
{I18n.t('INVALID_MONTANT')}
|
||||||
</HelperText>
|
</HelperText>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardAction
|
<CardAction separator={true} inColumn={false}>
|
||||||
separator={true}
|
|
||||||
inColumn={false}>
|
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onUserCancel()
|
this.onUserCancel();
|
||||||
}}
|
}}
|
||||||
title={I18n.t('CANCEL')}
|
title={I18n.t('CANCEL')}
|
||||||
color="crimson"
|
color="crimson"
|
||||||
/>
|
/>
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onUserSend()
|
this.onUserSend();
|
||||||
}}
|
}}
|
||||||
title={I18n.t('SEND')}
|
title={I18n.t('SEND')}
|
||||||
color="steelblue"
|
color="steelblue"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</CardAction>
|
</CardAction>
|
||||||
</Card>
|
</Card>
|
||||||
</View>)
|
</View>
|
||||||
|
);
|
||||||
} else
|
} else
|
||||||
return (<View style={styles.container}>
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
<CardView style={styles.cardInput}>
|
<CardView style={styles.cardInput}>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.title}>Demande de credit</Text>
|
<Text style={styles.title}>Demande de credit</Text>
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<Sae
|
<Sae
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
iconClass={FontAwesomeIcon}
|
iconClass={FontAwesomeIcon}
|
||||||
iconName={'dollar'}
|
iconName={'dollar'}
|
||||||
iconColor={primary}
|
iconColor={primary}
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
ref={(ref) => {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
try {
|
try {
|
||||||
montant = parseFloat(text);
|
montant = parseFloat(text);
|
||||||
this.setState({isDisabled: montant > 0, montant: montant})
|
this.setState({
|
||||||
|
isDisabled: montant > 0,
|
||||||
} catch (e) {
|
montant: montant,
|
||||||
|
});
|
||||||
}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
|
@ -245,29 +270,31 @@ export default class HistoryRequester extends Component {
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.btnContainer}>
|
<View style={styles.btnContainer}>
|
||||||
<Button style={styles.button_1} textStyle={styles.button_1_text}
|
<Button
|
||||||
|
style={styles.button_1}
|
||||||
|
textStyle={styles.button_1_text}
|
||||||
onPress={() => this.onUserCancel()}>
|
onPress={() => this.onUserCancel()}>
|
||||||
{I18n.t('CANCEL')}
|
{I18n.t('CANCEL')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button isLoading={this.state.isSending} isDisabled={!this.state.isDisabled}
|
<Button
|
||||||
|
isLoading={this.state.isSending}
|
||||||
|
isDisabled={!this.state.isDisabled}
|
||||||
style={styles.button_2}
|
style={styles.button_2}
|
||||||
ref={(r) => {
|
ref={r => {
|
||||||
this.refBtn = r
|
this.refBtn = r;
|
||||||
}}
|
}}
|
||||||
textStyle={styles.button_2_text} onPress={() => {
|
textStyle={styles.button_2_text}
|
||||||
this.onUserSend()
|
onPress={() => {
|
||||||
|
this.onUserSend();
|
||||||
}}>
|
}}>
|
||||||
{I18n.t('SEND')}
|
{I18n.t('SEND')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLoader = () => {
|
renderLoader = () => {
|
||||||
|
@ -277,81 +304,87 @@ export default class HistoryRequester extends Component {
|
||||||
title={I18n.t('LOADING')}
|
title={I18n.t('LOADING')}
|
||||||
message={I18n.t('LOADING_INFO')}
|
message={I18n.t('LOADING_INFO')}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
multiNetwork() {
|
multiNetwork() {
|
||||||
if (true) {
|
if (true) {
|
||||||
return (<View style={{height: 250, justifyContent: 'center'}}>
|
return (
|
||||||
|
<View style={{height: 250, justifyContent: 'center'}}>
|
||||||
<Card style={{width: responsiveWidth(96), justifyContent: 'center'}}>
|
<Card style={{width: responsiveWidth(96), justifyContent: 'center'}}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<View style={{flex: 1}}>
|
<View style={{flex: 1}}>
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={{flexDirection: 'row'}}>
|
||||||
<Picker
|
<Picker
|
||||||
|
|
||||||
selectedValue={this.state.currentNetwork}
|
selectedValue={this.state.currentNetwork}
|
||||||
prompt={I18n.t("SELECT_NETWORK")}
|
prompt={I18n.t('SELECT_NETWORK')}
|
||||||
style={{height: 50, flex: 1, marginLeft: 20}}
|
style={{height: 50, flex: 1, marginLeft: 20}}
|
||||||
itemStyle={styles.subtitle}
|
itemStyle={styles.subtitle}
|
||||||
onValueChange={(itemValue, itemIndex) =>
|
onValueChange={(itemValue, itemIndex) =>
|
||||||
this.setState({currentNetwork: itemValue})
|
this.setState({currentNetwork: itemValue})
|
||||||
}>
|
}>
|
||||||
{this.state.networks.map((item, index) => {
|
{this.state.networks.map((item, index) => {
|
||||||
return (<Picker.Item
|
return (
|
||||||
label={item.nt ? I18n.t("SELECT_NETWORK") : I18n.t("FOR_NUMB") + item.phone + " (" + item.name + ")"}
|
<Picker.Item
|
||||||
value={item}/>)
|
label={
|
||||||
|
item.nt
|
||||||
|
? I18n.t('SELECT_NETWORK')
|
||||||
|
: I18n.t('FOR_NUMB') +
|
||||||
|
item.phone +
|
||||||
|
' (' +
|
||||||
|
item.name +
|
||||||
|
')'
|
||||||
|
}
|
||||||
|
value={item}
|
||||||
|
/>
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
</Picker>
|
</Picker>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<Animatable.View
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
ref={this.handleMontantRef}
|
|
||||||
>
|
|
||||||
<TextInput
|
<TextInput
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
ref={(ref) => {
|
ref={ref => {
|
||||||
this.refInp = ref
|
this.refInp = ref;
|
||||||
}}
|
}}
|
||||||
|
mode={'outlined'}
|
||||||
mode={"outlined"}
|
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
try {
|
try {
|
||||||
let neb = parseInt(text)
|
let neb = parseInt(text);
|
||||||
this.setState({montant: neb, isDisabled: isNaN(neb)})
|
this.setState({montant: neb, isDisabled: isNaN(neb)});
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
/>
|
/>
|
||||||
<HelperText
|
<HelperText type="error" visible={this.state.visibleError}>
|
||||||
type="error"
|
|
||||||
visible={this.state.visibleError}>
|
|
||||||
{I18n.t('INVALID_MONTANT')}
|
{I18n.t('INVALID_MONTANT')}
|
||||||
</HelperText>
|
</HelperText>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
</View>
|
</View>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardAction
|
<CardAction separator={true} inColumn={false}>
|
||||||
separator={true}
|
|
||||||
inColumn={false}>
|
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onUserCancel()
|
this.onUserCancel();
|
||||||
}}
|
}}
|
||||||
title={I18n.t('CANCEL')}
|
title={I18n.t('CANCEL')}
|
||||||
color="crimson"
|
color="crimson"
|
||||||
/>
|
/>
|
||||||
<CardButton
|
<CardButton
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
const {currentNetwork, montant} = this.state
|
const {currentNetwork, montant} = this.state;
|
||||||
if (currentNetwork !== undefined && currentNetwork.nt === undefined) {
|
if (
|
||||||
this.onNetworkSend(currentNetwork.phone, currentNetwork.code_membre, montant)
|
currentNetwork !== undefined &&
|
||||||
|
currentNetwork.nt === undefined
|
||||||
|
) {
|
||||||
|
this.onNetworkSend(
|
||||||
|
currentNetwork.phone,
|
||||||
|
currentNetwork.code_membre,
|
||||||
|
montant,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
title={I18n.t('SEND')}
|
title={I18n.t('SEND')}
|
||||||
|
@ -359,9 +392,10 @@ export default class HistoryRequester extends Component {
|
||||||
/>
|
/>
|
||||||
</CardAction>
|
</CardAction>
|
||||||
</Card>
|
</Card>
|
||||||
</View>)
|
</View>
|
||||||
|
);
|
||||||
} else
|
} else
|
||||||
return (
|
{return (
|
||||||
<View style={styles.container2}>
|
<View style={styles.container2}>
|
||||||
<CardView style={styles.cardInput2}>
|
<CardView style={styles.cardInput2}>
|
||||||
<View>
|
<View>
|
||||||
|
@ -433,48 +467,47 @@ export default class HistoryRequester extends Component {
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
</View>)
|
</View>)};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSingleNetwork(item) {
|
renderSingleNetwork(item) {
|
||||||
const itm = item.item
|
const itm = item.item;
|
||||||
console.log(item)
|
console.log(item);
|
||||||
let refInp = null, refBtn = null
|
let refInp = null,
|
||||||
let montant = 0
|
refBtn = null;
|
||||||
return (<View style={styles.container2}>
|
let montant = 0;
|
||||||
|
return (
|
||||||
|
<View style={styles.container2}>
|
||||||
<CardView style={styles.cardInput2}>
|
<CardView style={styles.cardInput2}>
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.title}>{I18n.t('ASK_CREDIT')}</Text>
|
<Text style={styles.title}>{I18n.t('ASK_CREDIT')}</Text>
|
||||||
<Text style={styles.subtitle}>{I18n.t("FOR_NUMB")} {itm.phone} ({itm.name})</Text>
|
<Text style={styles.subtitle}>
|
||||||
<Animatable.View
|
{I18n.t('FOR_NUMB')} {itm.phone} ({itm.name})
|
||||||
ref={this.handleMontantRef}
|
</Text>
|
||||||
>
|
<Animatable.View ref={this.handleMontantRef}>
|
||||||
<Sae
|
<Sae
|
||||||
label={I18n.t('AMOUNT')}
|
label={I18n.t('AMOUNT')}
|
||||||
iconClass={FontAwesomeIcon}
|
iconClass={FontAwesomeIcon}
|
||||||
iconName={'dollar'}
|
iconName={'dollar'}
|
||||||
iconColor={primary}
|
iconColor={primary}
|
||||||
ref={(ref) => {
|
ref={ref => {
|
||||||
refInp = ref
|
refInp = ref;
|
||||||
this.setState({refIn: refInp})
|
this.setState({refIn: refInp});
|
||||||
}}
|
}}
|
||||||
inputStyle={input.style}
|
inputStyle={input.style}
|
||||||
|
|
||||||
value={this.state.montant}
|
value={this.state.montant}
|
||||||
keyboardType={"numeric"}
|
keyboardType={'numeric'}
|
||||||
onChangeText={(text) => {
|
onChangeText={text => {
|
||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
try {
|
try {
|
||||||
montant = parseFloat(text);
|
montant = parseFloat(text);
|
||||||
this.setStat({montant: montant})
|
this.setStat({montant: montant});
|
||||||
if (refBtn) {
|
if (refBtn) {
|
||||||
refBtn.setState({isDisabled: montant > 0})
|
refBtn.setState({isDisabled: montant > 0});
|
||||||
refBtn.isDisabled = montant > 0
|
refBtn.isDisabled = montant > 0;
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
style={input.selfitem}
|
style={input.selfitem}
|
||||||
|
@ -483,108 +516,111 @@ export default class HistoryRequester extends Component {
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.btnContainer}>
|
<View style={styles.btnContainer}>
|
||||||
<Button style={styles.button_1} textStyle={styles.button_1_text}
|
<Button
|
||||||
|
style={styles.button_1}
|
||||||
|
textStyle={styles.button_1_text}
|
||||||
onPress={() => this.onUserCancel()}>
|
onPress={() => this.onUserCancel()}>
|
||||||
{I18n.t('CANCEL')}
|
{I18n.t('CANCEL')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
ref={ref => {
|
ref={ref => {
|
||||||
refBtn = ref
|
refBtn = ref;
|
||||||
}}
|
}}
|
||||||
style={styles.button_2}
|
style={styles.button_2}
|
||||||
textStyle={styles.button_2_text}
|
textStyle={styles.button_2_text}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onNetworkSend(itm.phone, itm.code_membre, refInp.state.value, refInp, refBtn)
|
this.onNetworkSend(
|
||||||
|
itm.phone,
|
||||||
|
itm.code_membre,
|
||||||
|
refInp.state.value,
|
||||||
|
refInp,
|
||||||
|
refBtn,
|
||||||
|
);
|
||||||
}}>
|
}}>
|
||||||
{I18n.t('SEND')}
|
{I18n.t('SEND')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</CardView>
|
</CardView>
|
||||||
|
</View>
|
||||||
</View>)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onNetworkSend(phone, code_membre, text) {
|
onNetworkSend(phone, code_membre, text) {
|
||||||
var validMontant = true
|
var validMontant = true;
|
||||||
let montant = parseFloat(text)
|
let montant = parseFloat(text);
|
||||||
if (montant === null || !isNumber(montant) || montant > 1000000) {
|
if (montant === null || !isNumber(montant) || montant > 1000000) {
|
||||||
validMontant = false
|
validMontant = false;
|
||||||
}
|
}
|
||||||
this.setState({visibleError: !validMontant})
|
this.setState({visibleError: !validMontant});
|
||||||
if (!validMontant) {
|
if (!validMontant) {
|
||||||
this.montantView.shake(800)
|
this.montantView.shake(800);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({visibleError: false})
|
this.setState({visibleError: false});
|
||||||
}, 3000)
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
this.setState({isSending: true});
|
this.setState({isSending: true});
|
||||||
sendDemandeSpecificque(montant, phone, code_membre).then((data) => {
|
sendDemandeSpecificque(montant, phone, code_membre).then(data => {
|
||||||
this.setState({isSending: false});
|
this.setState({isSending: false});
|
||||||
var title = ""
|
var title = '';
|
||||||
var message = "";
|
var message = '';
|
||||||
console.warn(data);
|
console.warn(data);
|
||||||
if (data.success !== undefined) {
|
if (data.success !== undefined) {
|
||||||
if (data.success === 1) {
|
if (data.success === 1) {
|
||||||
title = I18n.t("DEMAND_SEND")
|
title = I18n.t('DEMAND_SEND');
|
||||||
message = I18n.t('DEMAND_SEND_SUCCESFUL')
|
message = I18n.t('DEMAND_SEND_SUCCESFUL');
|
||||||
} else {
|
} else {
|
||||||
title = "Erreur survenu lors de l'envoie "
|
title = "Erreur survenu lors de l'envoie ";
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
message = "Une erreur est survenu lors de l'envoie de la demande";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
title = "Erreur survenu lors de l'envoie "
|
title = "Erreur survenu lors de l'envoie ";
|
||||||
message = "Une erreur est survenu lors de l'envoie de la demande"
|
message = "Une erreur est survenu lors de l'envoie de la demande";
|
||||||
}
|
}
|
||||||
|
|
||||||
Alert.alert(title, message, [{
|
Alert.alert(title, message, [
|
||||||
text: "Ok", onPress: () => {
|
{
|
||||||
this.setState({montant: ""})
|
text: 'Ok',
|
||||||
}
|
onPress: () => {
|
||||||
}])
|
this.setState({montant: ''});
|
||||||
|
},
|
||||||
})
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateState() {
|
async updateState() {
|
||||||
|
|
||||||
let user = await readUser();
|
let user = await readUser();
|
||||||
if (user.category === "geolocated") {
|
if (user.category === 'geolocated') {
|
||||||
let networks = await getAgentNetworksList(user.agentId);
|
let networks = await getAgentNetworksList(user.agentId);
|
||||||
console.log(networks)
|
console.log(networks);
|
||||||
if (networks.success === 1) {
|
if (networks.success === 1) {
|
||||||
let net = [this.state.currentNetwork]
|
let net = [this.state.currentNetwork];
|
||||||
networks.networks.forEach((item) => {
|
networks.networks.forEach(item => {
|
||||||
net.push(item)
|
net.push(item);
|
||||||
|
});
|
||||||
})
|
this.setState({networks: net});
|
||||||
this.setState({networks: net})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({user: user})
|
this.setState({user: user});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = StyleSheet.create({
|
const input = StyleSheet.create({
|
||||||
selfitem: {
|
selfitem: {
|
||||||
|
|
||||||
width: responsiveWidth(70),
|
width: responsiveWidth(70),
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
color: primary
|
color: primary,
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
color: 'black'
|
color: 'black',
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
title: {
|
title: {
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
|
@ -624,7 +660,6 @@ const styles = StyleSheet.create({
|
||||||
button_1: {
|
button_1: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
|
|
||||||
},
|
},
|
||||||
button_2: {
|
button_2: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -643,17 +678,15 @@ const styles = StyleSheet.create({
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
cardInput: {
|
cardInput: {
|
||||||
|
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
marginTop: responsiveHeight(5),
|
marginTop: responsiveHeight(5),
|
||||||
width: responsiveWidth(98),
|
width: responsiveWidth(98),
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
height: responsiveHeight(40)
|
height: responsiveHeight(40),
|
||||||
},
|
},
|
||||||
cardInput2: {
|
cardInput2: {
|
||||||
|
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
marginTop: responsiveHeight(1),
|
marginTop: responsiveHeight(1),
|
||||||
|
@ -661,5 +694,5 @@ const styles = StyleSheet.create({
|
||||||
height: responsiveHeight(50),
|
height: responsiveHeight(50),
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,30 @@
|
||||||
|
/* eslint-disable no-undef */
|
||||||
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Animated, AppState, ProgressBarAndroid, StatusBar, StyleSheet, Text, View} from 'react-native';
|
import {
|
||||||
|
Animated,
|
||||||
|
AppState,
|
||||||
|
ProgressBarAndroid,
|
||||||
|
StatusBar,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
import ActionButton from 'react-native-action-button';
|
import ActionButton from 'react-native-action-button';
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons';
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
||||||
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
import {
|
||||||
|
responsiveHeight,
|
||||||
|
responsiveWidth,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
import {HistoryItemSectionned, HistoryListItem} from './HistoryItem';
|
import {HistoryItemSectionned, HistoryListItem} from './HistoryItem';
|
||||||
import {loadDemandeCredit, loadMyDemandeCredit} from './../../webservice/HistoryRequestApi';
|
import {
|
||||||
import Button from 'apsl-react-native-button'
|
loadDemandeCredit,
|
||||||
import {readUser} from "../../webservice/AuthApi";
|
loadMyDemandeCredit,
|
||||||
|
} from './../../webservice/HistoryRequestApi';
|
||||||
|
import Button from 'apsl-react-native-button';
|
||||||
|
import {readUser} from '../../webservice/AuthApi';
|
||||||
import Calendar from 'react-native-calendario';
|
import Calendar from 'react-native-calendario';
|
||||||
import I18n from "react-native-i18n";
|
import I18n from 'react-native-i18n';
|
||||||
|
|
||||||
import 'moment/locale/fr';
|
import 'moment/locale/fr';
|
||||||
import 'moment/locale/es-us';
|
import 'moment/locale/es-us';
|
||||||
|
@ -17,9 +33,14 @@ import 'moment/locale/en-ca';
|
||||||
import 'moment/locale/en-ie';
|
import 'moment/locale/en-ie';
|
||||||
import 'moment/locale/en-il';
|
import 'moment/locale/en-il';
|
||||||
import 'moment/locale/en-nz';
|
import 'moment/locale/en-nz';
|
||||||
import {accent, primary, primaryDark, purpleLight} from './../../utils/theme.json';
|
import {
|
||||||
import {PagerTabIndicator} from 'react-native-best-viewpager'
|
accent,
|
||||||
import IconWithBadge from "../IconWithBadge";
|
primary,
|
||||||
|
primaryDark,
|
||||||
|
purpleLight,
|
||||||
|
} from './../../utils/theme.json';
|
||||||
|
import {PagerTabIndicator} from 'react-native-best-viewpager';
|
||||||
|
import IconWithBadge from '../IconWithBadge';
|
||||||
import {Appbar, Divider, Menu, Provider} from 'react-native-paper';
|
import {Appbar, Divider, Menu, Provider} from 'react-native-paper';
|
||||||
|
|
||||||
var moment = require('moment-timezone');
|
var moment = require('moment-timezone');
|
||||||
|
@ -31,10 +52,9 @@ let theme = require('./../../utils/theme.json');
|
||||||
var sortIcons;
|
var sortIcons;
|
||||||
var sectionIcons;
|
var sectionIcons;
|
||||||
|
|
||||||
require('./../../utils/Translations')
|
require('./../../utils/Translations');
|
||||||
|
|
||||||
class MyHistory extends React.Component {
|
class MyHistory extends React.Component {
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarBackgroundColor: primary,
|
navBarBackgroundColor: primary,
|
||||||
statusBarColor: primaryDark,
|
statusBarColor: primaryDark,
|
||||||
|
@ -42,59 +62,53 @@ class MyHistory extends React.Component {
|
||||||
navBarButtonColor: '#FFFFFF',
|
navBarButtonColor: '#FFFFFF',
|
||||||
contextualMenuStatusBarColor: theme.accent,
|
contextualMenuStatusBarColor: theme.accent,
|
||||||
contextualMenuBackgroundColor: theme.accentLight,
|
contextualMenuBackgroundColor: theme.accentLight,
|
||||||
contextualMenuButtonsColor: '#ffffff'
|
contextualMenuButtonsColor: '#ffffff',
|
||||||
|
|
||||||
};
|
};
|
||||||
static navigationOptions = ({navigation}) => {
|
static navigationOptions = ({navigation}) => {
|
||||||
const {routeName} = navigation.state
|
const {routeName} = navigation.state;
|
||||||
return {
|
return {
|
||||||
|
tabBarLabel:
|
||||||
tabBarLabel: routeName === "myDemand" ? I18n.t('MY_DEMAND') : I18n.t('DEMAND_RECEIVE'),
|
routeName === 'myDemand'
|
||||||
|
? I18n.t('MY_DEMAND')
|
||||||
|
: I18n.t('DEMAND_RECEIVE'),
|
||||||
tabBarIcon: ({focused, horizontal, tintColor}) => {
|
tabBarIcon: ({focused, horizontal, tintColor}) => {
|
||||||
return (<IconWithBadge
|
return (
|
||||||
badgeCount={navigation.getParam("count", 0)}
|
<IconWithBadge
|
||||||
|
badgeCount={navigation.getParam('count', 0)}
|
||||||
size={20}
|
size={20}
|
||||||
name={routeName === "myDemand" ? "mail" : "inbox"}
|
name={routeName === 'myDemand' ? 'mail' : 'inbox'}
|
||||||
color={focused ? tintColor : "grey"}
|
color={focused ? tintColor : 'grey'}
|
||||||
/>)
|
/>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
drawerLabel: I18n.t('CREDIT_MANAGE'),
|
drawerLabel: I18n.t('CREDIT_MANAGE'),
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => <Icon name={'credit-card'} size={24} />,
|
||||||
<Icon
|
};
|
||||||
name={'credit-card'}
|
|
||||||
size={24}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props, true);
|
super(props, true);
|
||||||
this.currentLocale = I18n.locale.includes("fr") ? "fr" : "en-gb";
|
this.currentLocale = I18n.locale.includes('fr') ? 'fr' : 'en-gb';
|
||||||
moment.locale(this.currentLocale);
|
moment.locale(this.currentLocale);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
readUser().then((user) => {
|
readUser().then(user => {
|
||||||
this.setState({user: user})
|
this.setState({user: user});
|
||||||
})
|
|
||||||
this._populateIcons().then(() => {
|
|
||||||
});
|
});
|
||||||
|
this._populateIcons().then(() => {});
|
||||||
|
|
||||||
this.navigation = this.props.navigation
|
this.navigation = this.props.navigation;
|
||||||
|
}
|
||||||
};
|
|
||||||
|
|
||||||
navigationButtonPressed({buttonId}) {
|
navigationButtonPressed({buttonId}) {
|
||||||
if (buttonId === 'id') {
|
if (buttonId === 'id') {
|
||||||
this.showFilter();
|
this.showFilter();
|
||||||
} else if (buttonId === 'sectionned') {
|
} else if (buttonId === 'sectionned') {
|
||||||
this.setState({isSectionned: !this.state.isSectionned})
|
this.setState({isSectionned: !this.state.isSectionned});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
showFilter() {
|
showFilter() {
|
||||||
|
|
||||||
/*if (this.state.filter) {
|
/*if (this.state.filter) {
|
||||||
Navigation.mergeOptions(route.stackRoot,
|
Navigation.mergeOptions(route.stackRoot,
|
||||||
{
|
{
|
||||||
|
@ -226,19 +240,20 @@ class MyHistory extends React.Component {
|
||||||
|
|
||||||
_populateIcons = function () {
|
_populateIcons = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
Promise.all(
|
Promise.all([
|
||||||
[
|
|
||||||
Icon.getImageSource('sort', 30),
|
Icon.getImageSource('sort', 30),
|
||||||
Icon.getImageSource('layer-group', 30),
|
Icon.getImageSource('layer-group', 30),
|
||||||
]
|
])
|
||||||
).then((values) => {
|
.then(values => {
|
||||||
sortIcons = values[0];
|
sortIcons = values[0];
|
||||||
sectionIcons = values[1];
|
sectionIcons = values[1];
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}).catch((error) => {
|
})
|
||||||
|
.catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
reject(error);
|
reject(error);
|
||||||
}).done();
|
})
|
||||||
|
.done();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -263,97 +278,90 @@ class MyHistory extends React.Component {
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
isSectionned: false,
|
isSectionned: false,
|
||||||
isDateTimePickerVisible: false,
|
isDateTimePickerVisible: false,
|
||||||
isDateEndTimePickerVisible: false
|
isDateEndTimePickerVisible: false,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
updateList(data) {
|
updateList(data) {
|
||||||
if (!this.state.filter) {
|
if (!this.state.filter) {
|
||||||
let rev = data.reverse()
|
let rev = data.reverse();
|
||||||
this.setState({listdata: rev, conserve: rev, isLoaded: true});
|
this.setState({listdata: rev, conserve: rev, isLoaded: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMyList(data) {
|
updateMyList(data) {
|
||||||
if (!this.state.filter) {
|
if (!this.state.filter) {
|
||||||
let rev = data.reverse()
|
let rev = data.reverse();
|
||||||
this.setState({listdataSend: rev, conserve: rev, isLoaded: true});
|
this.setState({listdataSend: rev, conserve: rev, isLoaded: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const {routeName} = this.navigation.state
|
const {routeName} = this.navigation.state;
|
||||||
this.setState({position: routeName === "myDemand" ? 0 : 1})
|
this.setState({position: routeName === 'myDemand' ? 0 : 1});
|
||||||
this.refreshData()
|
this.refreshData();
|
||||||
/* this.intervaller = setInterval(() => {
|
/* this.intervaller = setInterval(() => {
|
||||||
this.refreshData(false)
|
this.refreshData(false)
|
||||||
}, 2000) */
|
}, 2000) */
|
||||||
this.animateSlidingUp(false)
|
this.animateSlidingUp(false);
|
||||||
this.props.navigation.addListener("didFocus", () => {
|
this.props.navigation.addListener('didFocus', () => {
|
||||||
this.refreshData(false)
|
this.refreshData(false);
|
||||||
console.warn("loading")
|
console.warn('loading');
|
||||||
|
});
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
clearInterval(this.intervaller)
|
|
||||||
}
|
|
||||||
|
|
||||||
renderOptionsMenu() {
|
renderOptionsMenu() {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: 'absolute',
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
paddingTop: 50,
|
paddingTop: 50,
|
||||||
right: 10,
|
right: 10,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
visible: this.state.visibleMenu,
|
visible: this.state.visibleMenu,
|
||||||
justifyContent: 'center'
|
justifyContent: 'center',
|
||||||
}}>
|
}}>
|
||||||
<Menu
|
<Menu
|
||||||
visible={this.state.visibleMenu}
|
visible={this.state.visibleMenu}
|
||||||
onDismiss={this._closeMenu}
|
onDismiss={this._closeMenu}
|
||||||
anchor={
|
anchor={<Button onPress={this._openMenu}>Show menu</Button>}>
|
||||||
<Button onPress={this._openMenu}>Show menu</Button>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{/* <Menu.Item onPress={() => {
|
{/* <Menu.Item onPress={() => {
|
||||||
this.setState({isSectionned: !this.state.isSectionned})
|
this.setState({isSectionned: !this.state.isSectionned})
|
||||||
this._closeMenu()
|
this._closeMenu()
|
||||||
}}
|
}}
|
||||||
title="Section"/>*/}
|
title="Section"/>*/}
|
||||||
<Divider />
|
<Divider />
|
||||||
<Menu.Item onPress={() => {
|
<Menu.Item
|
||||||
|
onPress={() => {
|
||||||
this.animateSlidingUp(!this.state.isSliding)
|
this.animateSlidingUp(!this.state.isSliding);
|
||||||
this._closeMenu()
|
this._closeMenu();
|
||||||
}} title={I18n.t("FILTER_DATE")}/>
|
}}
|
||||||
|
title={I18n.t('FILTER_DATE')}
|
||||||
|
/>
|
||||||
</Menu>
|
</Menu>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
animateSlidingUp(state = false) {
|
animateSlidingUp(state = false) {
|
||||||
const height = responsiveHeight(100)
|
const height = responsiveHeight(100);
|
||||||
let initialValue = !state ? 0 : height,
|
let initialValue = !state ? 0 : height,
|
||||||
finalValue = !state ? height : 0;
|
finalValue = !state ? height : 0;
|
||||||
|
|
||||||
this.setState({isSliding: state})
|
this.setState({isSliding: state});
|
||||||
|
|
||||||
|
|
||||||
this.state.translateAnim.setValue(initialValue); //Step 3
|
this.state.translateAnim.setValue(initialValue); //Step 3
|
||||||
Animated.timing( //Step 4
|
Animated.timing(
|
||||||
|
//Step 4
|
||||||
this.state.translateAnim,
|
this.state.translateAnim,
|
||||||
{
|
{
|
||||||
toValue: finalValue,
|
toValue: finalValue,
|
||||||
duration: 500,
|
duration: 500,
|
||||||
useNativeDriver: true,
|
useNativeDriver: true,
|
||||||
}
|
},
|
||||||
).start()
|
).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
_openMenu = () => this.setState({visibleMenu: true});
|
_openMenu = () => this.setState({visibleMenu: true});
|
||||||
|
@ -363,8 +371,7 @@ class MyHistory extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Provider>
|
<Provider>
|
||||||
<View style={{flex: 1}}
|
<View style={{flex: 1}}>
|
||||||
>
|
|
||||||
<StatusBar
|
<StatusBar
|
||||||
backgroundColor={theme.primaryDark}
|
backgroundColor={theme.primaryDark}
|
||||||
barStyle="light-content"
|
barStyle="light-content"
|
||||||
|
@ -376,35 +383,49 @@ class MyHistory extends React.Component {
|
||||||
<Appbar.Header dark={true} style={{backgroundColor: theme.primary}}>
|
<Appbar.Header dark={true} style={{backgroundColor: theme.primary}}>
|
||||||
<Appbar.BackAction
|
<Appbar.BackAction
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.props.navigation.pop()
|
// resolution du proble de bug de navigation retour credit management
|
||||||
|
this.props.navigation.push('home');
|
||||||
|
//this.props.navigation.pop();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Appbar.Content
|
<Appbar.Content
|
||||||
title={I18n.t('CREDIT_MANAGE')}
|
title={I18n.t('CREDIT_MANAGE')}
|
||||||
subtitle={this.state.position === 0 ? I18n.t('MY_DEMAND') : I18n.t('DEMAND_RECEIVE')}
|
subtitle={
|
||||||
|
this.state.position === 0
|
||||||
|
? I18n.t('MY_DEMAND')
|
||||||
|
: I18n.t('DEMAND_RECEIVE')
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Appbar.Action icon="refresh" onPress={() => {
|
<Appbar.Action
|
||||||
this.refreshData()
|
icon="refresh"
|
||||||
}}/>
|
onPress={() => {
|
||||||
<Appbar.Action icon="more-vert" onPress={() => {
|
this.refreshData();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Appbar.Action
|
||||||
|
icon="more-vert"
|
||||||
|
onPress={() => {
|
||||||
this._openMenu();
|
this._openMenu();
|
||||||
this.renderSliding();
|
this.renderSliding();
|
||||||
}}/>
|
}}
|
||||||
|
/>
|
||||||
</Appbar.Header>
|
</Appbar.Header>
|
||||||
{this.renderOptionsMenu()}
|
{this.renderOptionsMenu()}
|
||||||
|
|
||||||
{this.state.position === 0 ? this._renderListDemandsSend() : this._renderListDemandReceive()}
|
{this.state.position === 0
|
||||||
|
? this._renderListDemandsSend()
|
||||||
|
: this._renderListDemandReceive()}
|
||||||
</View>
|
</View>
|
||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSliding() {
|
renderSliding() {
|
||||||
return (
|
return (
|
||||||
<Animated.View style={[styles.slidingup, {translateY: this.state.translateAnim}]}>
|
<Animated.View
|
||||||
|
style={[styles.slidingup, {translateY: this.state.translateAnim}]}>
|
||||||
<Calendar
|
<Calendar
|
||||||
onChange={(range) => console.log(range)}
|
onChange={range => console.log(range)}
|
||||||
minDate="2018-04-20"
|
minDate="2018-04-20"
|
||||||
startDate="2018-04-30"
|
startDate="2018-04-30"
|
||||||
endDate="2018-05-05"
|
endDate="2018-05-05"
|
||||||
|
@ -449,7 +470,7 @@ class MyHistory extends React.Component {
|
||||||
activeDayTextStyle: {
|
activeDayTextStyle: {
|
||||||
color: 'white',
|
color: 'white',
|
||||||
},
|
},
|
||||||
nonTouchableLastMonthDayTextStyle: {}
|
nonTouchableLastMonthDayTextStyle: {},
|
||||||
}}
|
}}
|
||||||
style={{height: responsiveHeight(60)}}
|
style={{height: responsiveHeight(60)}}
|
||||||
/>
|
/>
|
||||||
|
@ -457,42 +478,43 @@ class MyHistory extends React.Component {
|
||||||
<Button>{I18n.t('QUIT')}</Button>
|
<Button>{I18n.t('QUIT')}</Button>
|
||||||
<Button>{I18n.t('FILTER')}</Button>
|
<Button>{I18n.t('FILTER')}</Button>
|
||||||
</View>
|
</View>
|
||||||
</Animated.View>)
|
</Animated.View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSectionnedList(list) {
|
renderSectionnedList(list) {
|
||||||
|
|
||||||
if (this.state.isLoaded) {
|
if (this.state.isLoaded) {
|
||||||
let data = list;
|
let data = list;
|
||||||
if (data !== null) {
|
if (data !== null) {
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
return (<HistoryItemSectionned
|
return (
|
||||||
|
<HistoryItemSectionned
|
||||||
user={this.state.user}
|
user={this.state.user}
|
||||||
list={list}
|
list={list}
|
||||||
refresh={() => this.refreshData()}
|
refresh={() => this.refreshData()}
|
||||||
style={styles.listbackground}/>)
|
style={styles.listbackground}
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else if (this.state.filter) {
|
} else if (this.state.filter) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<Text>{I18n.t('NO_ITEMS_REQUEST')}</Text>
|
<Text>{I18n.t('NO_ITEMS_REQUEST')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<ProgressBarAndroid />
|
<ProgressBarAndroid />
|
||||||
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<Text>{I18n.t('EMPTY_LIST_REQUEST')}</Text>
|
<Text>{I18n.t('EMPTY_LIST_REQUEST')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,62 +524,63 @@ class MyHistory extends React.Component {
|
||||||
let data = list;
|
let data = list;
|
||||||
if (data !== null) {
|
if (data !== null) {
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
return (<HistoryListItem
|
return (
|
||||||
|
<HistoryListItem
|
||||||
user={this.state.user}
|
user={this.state.user}
|
||||||
list={list}
|
list={list}
|
||||||
refreshing={() => {
|
refreshing={() => {
|
||||||
this.refreshData()
|
this.refreshData();
|
||||||
}}
|
}}
|
||||||
refresh={() => this.refreshData()}
|
refresh={() => this.refreshData()}
|
||||||
isRefreshing={this.state.isRefreshing}
|
isRefreshing={this.state.isRefreshing}
|
||||||
navigator={this.props.navigation}
|
navigator={this.props.navigation}
|
||||||
style={styles.listbackground}
|
style={styles.listbackground}
|
||||||
isDemandSend={this.state.position === 0}/>)
|
isDemandSend={this.state.position === 0}
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else if (this.state.filter) {
|
} else if (this.state.filter) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
} else if (data.length === 0) {
|
} else if (data.length === 0) {
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<ProgressBarAndroid />
|
<ProgressBarAndroid />
|
||||||
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<Text>{I18n.t('EMPTY_LIST_REQUEST')} </Text>
|
<Text>{I18n.t('EMPTY_LIST_REQUEST')} </Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (list.length === 0) {
|
} else if (list.length === 0) {
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyListe}>
|
<View style={styles.emptyListe}>
|
||||||
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
<Text>{I18n.t('NO_ITEM_REQUEST')}</Text>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLoading() {
|
renderLoading() {
|
||||||
return (<View><ProgressBarAndroid/><Text>{I18n.t('LOADING_DOTS')}</Text></View>)
|
return (
|
||||||
|
<View>
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSlidingUpPanel() {
|
showSlidingUpPanel() {
|
||||||
|
@ -624,18 +647,24 @@ class MyHistory extends React.Component {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_showDateTimePicker = (type) => {
|
_showDateTimePicker = type => {
|
||||||
if (type === 1)
|
if (type === 1) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDateTimePickerVisible: true
|
isDateTimePickerVisible: true,
|
||||||
});
|
});
|
||||||
else this.setState({
|
} else {
|
||||||
isDateEndTimePickerVisible: true
|
this.setState({
|
||||||
|
isDateEndTimePickerVisible: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
_showDateEndPicker = () => this.setState({isDateEndTimePickerVisible: true});
|
_showDateEndPicker = () => this.setState({isDateEndTimePickerVisible: true});
|
||||||
|
|
||||||
_hideDateTimePicker = () => this.setState({isDateTimePickerVisible: false, isDateEndTimePickerVisible: false});
|
_hideDateTimePicker = () =>
|
||||||
|
this.setState({
|
||||||
|
isDateTimePickerVisible: false,
|
||||||
|
isDateEndTimePickerVisible: false,
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
_handleDatePicked = (fromdate, enddate) => {
|
_handleDatePicked = (fromdate, enddate) => {
|
||||||
|
@ -667,126 +696,156 @@ class MyHistory extends React.Component {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printOptions() {
|
printOptions() {
|
||||||
if (this.state.user.category === "hyper") {
|
if (this.state.user.category === 'hyper') {
|
||||||
return (<ActionButton buttonColor={accent}>
|
return (
|
||||||
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('SAVE_HISTORY')} onPress={() => {
|
<ActionButton buttonColor={accent}>
|
||||||
|
<ActionButton.Item
|
||||||
}}>
|
buttonColor={purpleLight}
|
||||||
|
title={I18n.t('SAVE_HISTORY')}
|
||||||
|
onPress={() => {}}>
|
||||||
<Icon name="save" style={styles.actionButtonIcon} />
|
<Icon name="save" style={styles.actionButtonIcon} />
|
||||||
</ActionButton.Item>
|
</ActionButton.Item>
|
||||||
</ActionButton>);
|
</ActionButton>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return (<ActionButton buttonColor={accent}>
|
return (
|
||||||
<ActionButton.Item buttonColor={primary} title={I18n.t('MAKE_REQUEST')}
|
<ActionButton buttonColor={accent}>
|
||||||
|
<ActionButton.Item
|
||||||
|
buttonColor={primary}
|
||||||
|
title={I18n.t('MAKE_REQUEST')}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.props.navigation.push(route.credrequester, {
|
this.props.navigation.push(route.credrequester, {
|
||||||
onGoBack: () => this.refreshData()
|
onGoBack: () => this.refreshData(),
|
||||||
})
|
});
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
<Icon name="edit" style={styles.actionButtonIcon} />
|
<Icon name="edit" style={styles.actionButtonIcon} />
|
||||||
</ActionButton.Item>
|
</ActionButton.Item>
|
||||||
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('SAVE_HISTORY')} onPress={() => {
|
<ActionButton.Item
|
||||||
|
buttonColor={purpleLight}
|
||||||
}}>
|
title={I18n.t('SAVE_HISTORY')}
|
||||||
|
onPress={() => {}}>
|
||||||
<Icon name="save" style={styles.actionButtonIcon} />
|
<Icon name="save" style={styles.actionButtonIcon} />
|
||||||
</ActionButton.Item>
|
</ActionButton.Item>
|
||||||
</ActionButton>)
|
</ActionButton>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderListDemandsSend() {
|
_renderListDemandsSend() {
|
||||||
//console.log('this.state', this.state);
|
//console.log('this.state', this.state);
|
||||||
return (<View style={styles.container}>
|
return (
|
||||||
{
|
<View style={styles.container}>
|
||||||
this.state.isLoaded ?
|
{this.state.isLoaded
|
||||||
this.state.isSectionned ?
|
? this.state.isSectionned
|
||||||
this.renderSectionnedList(this.state.listdataSend) :
|
? this.renderSectionnedList(this.state.listdataSend)
|
||||||
this.renderList(this.state.listdataSend) : this.renderLoading()
|
: this.renderList(this.state.listdataSend)
|
||||||
}
|
: this.renderLoading()}
|
||||||
{this.printOptions()}
|
{this.printOptions()}
|
||||||
{this.showSlidingUpPanel()}
|
{this.showSlidingUpPanel()}
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderListDemandReceive() {
|
_renderListDemandReceive() {
|
||||||
|
return (
|
||||||
return (<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
{
|
{this.state.isLoaded
|
||||||
this.state.isLoaded ?
|
? this.state.isSectionned
|
||||||
this.state.isSectionned ?
|
? this.renderSectionnedList(this.state.listdata)
|
||||||
this.renderSectionnedList(this.state.listdata) :
|
: this.renderList(this.state.listdata)
|
||||||
this.renderList(this.state.listdata) : this.renderLoading()
|
: this.renderLoading()}
|
||||||
}
|
|
||||||
{this.printOptions()}
|
{this.printOptions()}
|
||||||
{this.showSlidingUpPanel()}
|
{this.showSlidingUpPanel()}
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderTabGeolocated() {
|
_renderTabGeolocated() {
|
||||||
let tabs = [{
|
let tabs = [
|
||||||
|
{
|
||||||
text: I18n.t('DEMAND_SEND'),
|
text: I18n.t('DEMAND_SEND'),
|
||||||
}]
|
},
|
||||||
return <PagerTabIndicator
|
];
|
||||||
|
return (
|
||||||
|
<PagerTabIndicator
|
||||||
style={{
|
style={{
|
||||||
height: responsiveHeight(8)
|
height: responsiveHeight(8),
|
||||||
}}
|
}}
|
||||||
tabs={tabs}/>;
|
tabs={tabs}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderTabHyper() {
|
_renderTabHyper() {
|
||||||
let tabs = [{
|
let tabs = [
|
||||||
|
{
|
||||||
text: I18n.t('DEMAND_RECEIVE'),
|
text: I18n.t('DEMAND_RECEIVE'),
|
||||||
}]
|
},
|
||||||
return <PagerTabIndicator
|
];
|
||||||
|
return (
|
||||||
|
<PagerTabIndicator
|
||||||
style={{
|
style={{
|
||||||
height: responsiveHeight(8)
|
height: responsiveHeight(8),
|
||||||
}}
|
}}
|
||||||
tabs={tabs}/>;
|
tabs={tabs}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderTabs() {
|
_renderTabs() {
|
||||||
let tabs = [{
|
let tabs = [
|
||||||
|
{
|
||||||
text: I18n.t('MY_DEMAND'),
|
text: I18n.t('MY_DEMAND'),
|
||||||
iconSource: this.state.usersicon
|
iconSource: this.state.usersicon,
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
text: I18n.t('DEMAND_RECEIVE'),
|
text: I18n.t('DEMAND_RECEIVE'),
|
||||||
iconSource: this.state.charticon
|
iconSource: this.state.charticon,
|
||||||
}]
|
},
|
||||||
return <PagerTabIndicator
|
];
|
||||||
|
return (
|
||||||
|
<PagerTabIndicator
|
||||||
style={{
|
style={{
|
||||||
height: responsiveHeight(8)
|
height: responsiveHeight(8),
|
||||||
}}
|
}}
|
||||||
tabs={tabs}/>;
|
tabs={tabs}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshData(autoref = true) {
|
refreshData(autoref = true) {
|
||||||
if (autoref)
|
if (autoref) {
|
||||||
this.setState({isRefreshing: true})
|
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) => {
|
loadDemandeCredit()
|
||||||
console.warn(e)
|
.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) => {
|
loadMyDemandeCredit()
|
||||||
|
.then(data => {
|
||||||
if (data.success !== undefined) {
|
if (data.success !== undefined) {
|
||||||
this.setState({listdataSend: []})
|
this.setState({listdataSend: []});
|
||||||
this.setState({isRefreshing: false})
|
this.setState({isRefreshing: false});
|
||||||
if (this.state.position === 0) this.props.navigation.setParams({count: data.demands.length})
|
if (this.state.position === 0) {
|
||||||
|
this.props.navigation.setParams({count: data.demands.length});
|
||||||
this.updateMyList(data.demands)
|
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
|
||||||
console.warn(e)
|
this.updateMyList(data.demands);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.warn(e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,11 +865,10 @@ const datefilter = StyleSheet.create({
|
||||||
},
|
},
|
||||||
datetext: {
|
datetext: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
marginLeft: responsiveWidth(5)
|
marginLeft: responsiveWidth(5),
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
flex: 2,
|
flex: 2,
|
||||||
|
|
||||||
},
|
},
|
||||||
btnContainer: {
|
btnContainer: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
@ -825,21 +883,21 @@ const datefilter = StyleSheet.create({
|
||||||
},
|
},
|
||||||
btntext: {
|
btntext: {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: accent
|
color: accent,
|
||||||
},
|
},
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'space-evenly'
|
justifyContent: 'space-evenly',
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
slidingup: {
|
slidingup: {
|
||||||
position: "absolute",
|
position: 'absolute',
|
||||||
height: responsiveHeight(84),
|
height: responsiveHeight(84),
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
width: responsiveWidth(100),
|
width: responsiveWidth(100),
|
||||||
zIndex: 1000
|
zIndex: 1000,
|
||||||
},
|
},
|
||||||
root: {
|
root: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
@ -853,7 +911,7 @@ const styles = StyleSheet.create({
|
||||||
emptylist: {
|
emptylist: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
backgroundd_drawer: {
|
backgroundd_drawer: {
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
|
@ -884,10 +942,10 @@ const styles = StyleSheet.create({
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
marginLeft: responsiveWidth(10),
|
marginLeft: responsiveWidth(10),
|
||||||
|
|
||||||
color: 'black'
|
color: 'black',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
flex: 8
|
flex: 8,
|
||||||
},
|
},
|
||||||
|
|
||||||
title: {
|
title: {
|
||||||
|
@ -895,6 +953,6 @@ const styles = StyleSheet.create({
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
color: 'black',
|
color: 'black',
|
||||||
fontWeight: 'bold'
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,6 +36,7 @@ import WalletRetrait from './wallet/WalletRetrait';
|
||||||
import WalletSelect from './wallet/WalletSelect';
|
import WalletSelect from './wallet/WalletSelect';
|
||||||
import CreateIdentification from './identification/createIdentification';
|
import CreateIdentification from './identification/createIdentification';
|
||||||
import DemandGroupNanoCredit from './nano-credit/DemandGroupNanoCredit';
|
import DemandGroupNanoCredit from './nano-credit/DemandGroupNanoCredit';
|
||||||
|
import MyHistory from './history-request/MyHistory';
|
||||||
let route = require('./../route.json')
|
let route = require('./../route.json')
|
||||||
export function registerScreens() {
|
export function registerScreens() {
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
/* eslint-disable no-shadow */
|
||||||
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
/**
|
/**
|
||||||
* Sample React Native App
|
* Sample React Native App
|
||||||
* https://github.com/facebook/react-native
|
* https://github.com/facebook/react-native
|
||||||
|
@ -6,102 +9,111 @@
|
||||||
* @flow
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Alert, AsyncStorage, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
|
import {
|
||||||
|
Alert,
|
||||||
|
AsyncStorage,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/Ionicons';
|
import Icon from 'react-native-vector-icons/Ionicons';
|
||||||
import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
import {
|
||||||
|
responsiveFontSize,
|
||||||
|
responsiveHeight,
|
||||||
|
responsiveWidth,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
|
import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
|
||||||
import {disconnect, readUser} from './../../webservice/AuthApi';
|
import {disconnect, readUser} from './../../webservice/AuthApi';
|
||||||
import I18n from 'react-native-i18n'
|
import I18n from 'react-native-i18n';
|
||||||
import Button from 'apsl-react-native-button'
|
import Button from 'apsl-react-native-button';
|
||||||
import {IlinkEmitter} from "./../../utils/events"
|
import {IlinkEmitter} from './../../utils/events';
|
||||||
import {SafeAreaView} from 'react-navigation';
|
import {SafeAreaView} from 'react-navigation';
|
||||||
import DeviceInfo from "react-native-device-info"
|
import DeviceInfo from 'react-native-device-info';
|
||||||
import Configuration from "../../webservice/persistences/Configuration";
|
import Configuration from '../../webservice/persistences/Configuration';
|
||||||
import {ScrollView} from 'react-native-gesture-handler';
|
import {ScrollView} from 'react-native-gesture-handler';
|
||||||
|
|
||||||
const route = require("./../../route.json")
|
const route = require('./../../route.json');
|
||||||
require('./../../utils/Translations')
|
require('./../../utils/Translations');
|
||||||
var DBEvents = require('react-native-db-models').DBEvents
|
var DBEvents = require('react-native-db-models').DBEvents;
|
||||||
let theme = require('./../../utils/theme.json')
|
let theme = require('./../../utils/theme.json');
|
||||||
|
|
||||||
export default class OptionsMenu extends Component {
|
export default class OptionsMenu extends Component {
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
statusBarColor: primaryDarkAdvanced,
|
statusBarColor: primaryDarkAdvanced,
|
||||||
};
|
};
|
||||||
commandeListe
|
commandeListe;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this))
|
IlinkEmitter.on('menuLink', this.onMenuNavigationEvent.bind(this));
|
||||||
IlinkEmitter.on("userconnect", this.onUserConnect.bind(this))
|
IlinkEmitter.on('userconnect', this.onUserConnect.bind(this));
|
||||||
IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this))
|
IlinkEmitter.on('userdisconnect', this.hideSideMenu.bind(this));
|
||||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
IlinkEmitter.on('langueChange', this.updateLangue.bind(this));
|
||||||
this.configuration = new Configuration();
|
this.configuration = new Configuration();
|
||||||
readUser().then((user) => {
|
readUser().then(user => {
|
||||||
if (user !== null && user !== undefined) {
|
if (user !== null && user !== undefined) {
|
||||||
this.setState({user});
|
this.setState({user});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
retrieveAndroidInformation() {
|
retrieveAndroidInformation() {
|
||||||
this.configuration._getData().then((lang) => {
|
this.configuration
|
||||||
|
._getData()
|
||||||
|
.then(lang => {
|
||||||
if (lang) {
|
if (lang) {
|
||||||
I18n.locale = lang
|
I18n.locale = lang;
|
||||||
readUser().then((result) => {
|
readUser().then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateUser(result);
|
this.updateUser(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
let code = DeviceInfo.getDeviceLocale();
|
let code = DeviceInfo.getDeviceLocale();
|
||||||
I18n.locale = code.toLowerCase()
|
I18n.locale = code.toLowerCase();
|
||||||
readUser().then((result) => {
|
readUser()
|
||||||
|
.then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateUser(result);
|
this.updateUser(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
}).catch((e) => {
|
})
|
||||||
this.props.navigation.navigate("Auth")
|
.catch(e => {
|
||||||
|
this.props.navigation.navigate('Auth');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
})
|
||||||
let code = DeviceInfo.getDeviceLocale()
|
.catch(e => {
|
||||||
I18n.locale = code.toLowerCase()
|
let code = DeviceInfo.getDeviceLocale();
|
||||||
readUser().then((result) => {
|
I18n.locale = code.toLowerCase();
|
||||||
|
readUser()
|
||||||
|
.then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateUser(result);
|
this.updateUser(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
}).catch((e) => {
|
})
|
||||||
this.props.navigation.navigate("Auth")
|
.catch(e => {
|
||||||
|
this.props.navigation.navigate('Auth');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return '';
|
||||||
})
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
||||||
this.setState({items: items})
|
this.setState({items: items});
|
||||||
this.retrieveAndroidInformation()
|
this.retrieveAndroidInformation();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLangue() {
|
updateLangue() {
|
||||||
this.setState({lang: "change"})
|
this.setState({lang: 'change'});
|
||||||
this.forceUpdate()
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
onMenuNavigationEvent(menuOption) {
|
onMenuNavigationEvent(menuOption) {
|
||||||
/* Navigation.mergeOptions(this.props.componentId,{
|
/* Navigation.mergeOptions(this.props.componentId,{
|
||||||
|
@ -123,16 +135,14 @@ export default class OptionsMenu extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onUserConnect() {
|
onUserConnect() {
|
||||||
readUser().then((user) => {
|
readUser().then(user => {
|
||||||
if (user !== null && user !== undefined) {
|
if (user !== null && user !== undefined) {
|
||||||
this.updateUser(user);
|
this.updateUser(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onNavigatorEvent(event) {
|
onNavigatorEvent(event) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
hideSideMenu() {
|
hideSideMenu() {
|
||||||
/* Navigation.mergeOptions("drawer", {
|
/* Navigation.mergeOptions("drawer", {
|
||||||
|
@ -150,47 +160,161 @@ export default class OptionsMenu extends Component {
|
||||||
user: null,
|
user: null,
|
||||||
menu: [],
|
menu: [],
|
||||||
currentId: 0,
|
currentId: 0,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getGeolocatedUserMenu() {
|
getGeolocatedUserMenu() {
|
||||||
return [
|
return [
|
||||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
|
{
|
||||||
, {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, {title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false}
|
id: 1,
|
||||||
, {title: I18n.t('ADD_NETWORK'), id: 11, key: 11, icon: 'md-people', active: false}
|
key: 1,
|
||||||
, {title: I18n.t('CHANGE_INFORMATION'), id: 13, key: 13, icon: 'md-person', active: false}
|
icon: 'md-person',
|
||||||
, {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
|
active: false,
|
||||||
, {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('WALLET'),
|
||||||
|
id: 6,
|
||||||
|
key: 6,
|
||||||
|
icon: 'md-wallet-outline',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
id: 2,
|
||||||
|
key: 2,
|
||||||
|
icon: 'md-card',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('ADD_NETWORK'),
|
||||||
|
id: 11,
|
||||||
|
key: 11,
|
||||||
|
icon: 'md-people',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CHANGE_INFORMATION'),
|
||||||
|
id: 13,
|
||||||
|
key: 13,
|
||||||
|
icon: 'md-person',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getSuperUserMenu() {
|
getSuperUserMenu() {
|
||||||
return [
|
return [
|
||||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
|
{
|
||||||
, {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, {title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false}
|
id: 1,
|
||||||
, {title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false}
|
key: 1,
|
||||||
, {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
|
icon: 'md-person',
|
||||||
, {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('WALLET'),
|
||||||
|
id: 6,
|
||||||
|
key: 6,
|
||||||
|
icon: 'md-wallet-outline',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
id: 2,
|
||||||
|
key: 2,
|
||||||
|
icon: 'md-card',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('GROUP_MANAGE'),
|
||||||
|
id: 5,
|
||||||
|
key: 5,
|
||||||
|
icon: 'md-people',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getHyperUsermenu() {
|
getHyperUsermenu() {
|
||||||
return [
|
return [
|
||||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
|
{
|
||||||
, {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, {title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false}
|
id: 1,
|
||||||
, {title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false}
|
key: 1,
|
||||||
, {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
|
icon: 'md-person',
|
||||||
, {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('WALLET'),
|
||||||
|
id: 6,
|
||||||
|
key: 6,
|
||||||
|
icon: 'md-wallet-outline',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
id: 2,
|
||||||
|
key: 2,
|
||||||
|
icon: 'md-card',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('GROUP_MANAGE'),
|
||||||
|
id: 5,
|
||||||
|
key: 5,
|
||||||
|
icon: 'md-people',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUser(user) {
|
updateUser(user) {
|
||||||
let menu = [];
|
let menu = [];
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
console.log("USER", user.category);
|
console.log('USER', user.category);
|
||||||
/* Navigation.mergeOptions("drawer", {
|
/* Navigation.mergeOptions("drawer", {
|
||||||
sideMenu: {
|
sideMenu: {
|
||||||
left: {
|
left: {
|
||||||
|
@ -201,13 +325,13 @@ export default class OptionsMenu extends Component {
|
||||||
});*/
|
});*/
|
||||||
if (user.category !== undefined) {
|
if (user.category !== undefined) {
|
||||||
switch (user.category) {
|
switch (user.category) {
|
||||||
case "geolocated":
|
case 'geolocated':
|
||||||
menu = this.getGeolocatedUserMenu();
|
menu = this.getGeolocatedUserMenu();
|
||||||
break;
|
break;
|
||||||
case "super":
|
case 'super':
|
||||||
menu = this.getSuperUserMenu();
|
menu = this.getSuperUserMenu();
|
||||||
break;
|
break;
|
||||||
case "hyper":
|
case 'hyper':
|
||||||
menu = this.getHyperUsermenu();
|
menu = this.getHyperUsermenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -216,108 +340,196 @@ export default class OptionsMenu extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.setState({user: user, menu: menu});
|
this.setState({user: user, menu: menu});
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserMenu() {
|
getUserMenu() {
|
||||||
return [
|
return [
|
||||||
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true}
|
{
|
||||||
, {title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false}
|
title: I18n.t('MAP'),
|
||||||
, {title: I18n.t('WALLET'), id: 6, key: 6, icon: 'md-wallet-outline', active: false}
|
id: 0,
|
||||||
, {title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false}
|
key: 0,
|
||||||
, {title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false}]
|
icon: 'md-map',
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
|
id: 1,
|
||||||
|
key: 1,
|
||||||
|
icon: 'md-person',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('WALLET'),
|
||||||
|
id: 6,
|
||||||
|
key: 6,
|
||||||
|
icon: 'md-wallet-outline',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToScreen = (item) => {
|
redirectToScreen = item => {
|
||||||
console.log("Item Menu Click", item);
|
console.log('Item Menu Click', item);
|
||||||
|
|
||||||
if (this.state.user === null)
|
if (this.state.user === null) {
|
||||||
return;
|
return;
|
||||||
else {
|
} else {
|
||||||
switch (this.state.user.category) {
|
switch (this.state.user.category) {
|
||||||
case "super":
|
case 'super':
|
||||||
if (item === "walletSelect")
|
if (item === 'walletSelect') {
|
||||||
item = "walletDetail";
|
item = 'walletDetail';
|
||||||
this.props.navigation.navigate(item, {agentId: this.state.user.agentId});
|
}
|
||||||
|
this.props.navigation.navigate(item, {
|
||||||
|
agentId: this.state.user.agentId,
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "hyper":
|
case 'hyper':
|
||||||
if (item === "walletSelect")
|
if (item === 'walletSelect') {
|
||||||
item = "walletDetail";
|
item = 'walletDetail';
|
||||||
this.props.navigation.navigate(item, {agentId: this.state.user.agentId});
|
}
|
||||||
|
this.props.navigation.navigate(item, {
|
||||||
|
agentId: this.state.user.agentId,
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "geolocated":
|
case 'geolocated':
|
||||||
this.props.navigation.navigate(item);
|
this.props.navigation.navigate(item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (item === "walletSelect")
|
if (item === 'walletSelect') {
|
||||||
item = "walletDetailUser";
|
item = 'walletDetailUser';
|
||||||
|
}
|
||||||
this.props.navigation.navigate(item, {userId: this.state.user.id});
|
this.props.navigation.navigate(item, {userId: this.state.user.id});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
_renderItem = item => {
|
||||||
_renderItem = (item) => {
|
if (
|
||||||
if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks' || item === 'walletDetail' || item === 'walletDetailUser'
|
item === 'creditrequest' ||
|
||||||
|| item === 'walletDepot' || item === 'walletRetrait' || item === 'createIdentification' || item === 'walletOptionSelect' || item === 'validateIdentification'
|
item === 'historyItemDetails' ||
|
||||||
|| item === 'createIdentificationUser' || item === 'operateurOptionSelect' || item === 'paiementFacture' || item === 'envoieWalletToWalletUser'
|
item === 'filter' ||
|
||||||
|| item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser'
|
item === 'networks' ||
|
||||||
|| item === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent'
|
item === 'walletDetail' ||
|
||||||
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|
item === 'walletDetailUser' ||
|
||||||
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|
item === 'walletDepot' ||
|
||||||
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|
item === 'walletRetrait' ||
|
||||||
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'insuranceSubscriptionScreen'
|
item === 'createIdentification' ||
|
||||||
|| item === 'addBeneficiaryScreen' || item === 'activateBuySubscriptionScreen' || item === 'saisirFeuilleSoinScreen' || item === 'validateConsultationScreen' || item === 'validateConsultationDetailScreen'
|
item === 'walletOptionSelect' ||
|
||||||
|| item === 'executerPrescriptionScreen' || item === 'modifierFeuilleSoinScreen' || item === 'modifierExecutionPrescriptionScreen' || item === 'historiqueNanoSanteUserScreen'
|
item === 'validateIdentification' ||
|
||||||
|| item === 'demandeAutorisationSoinScreen' || item === 'deleteBeneficiaryScreen' || item === 'StopSubscriptionScreen' || item === 'stopSubscriptionScreen' || item === 'renewAssuranceScreen'
|
item === 'createIdentificationUser' ||
|
||||||
|| item === 'webviewScreen' || item === 'historiqueNanoSanteAgentScreen' || item === 'historiqueNanoSanteSuperHyperScreen' || item === 'PDFViewerScreen' || item === 'ubaFormScreen') {
|
item === 'operateurOptionSelect' ||
|
||||||
return null
|
item === 'paiementFacture' ||
|
||||||
|
item === 'envoieWalletToWalletUser' ||
|
||||||
|
item === 'envoieWalletToCashUser' ||
|
||||||
|
item === 'linkCard' ||
|
||||||
|
item === 'envoieWalletToCardUser' ||
|
||||||
|
item === 'envoieWalletToBankUser' ||
|
||||||
|
item === 'retraitWalletVersCashUser' ||
|
||||||
|
item === 'retraitCarteVersWalletUser' ||
|
||||||
|
item === 'retraitEnCashAgent' ||
|
||||||
|
item === 'retraitCarteVersCashAgent' ||
|
||||||
|
item === 'envoieCashVersWalletAgent' ||
|
||||||
|
item === 'envoieCashVersAutreWalletAgent' ||
|
||||||
|
item === 'retraitCarteVersCashUser' ||
|
||||||
|
item === 'envoiCashVersCashAgent' ||
|
||||||
|
item === 'envoieCashVersCashAgent' ||
|
||||||
|
item === 'envoieCashVersCarteAgent' ||
|
||||||
|
item === 'modifyIdentificationUser' ||
|
||||||
|
item === 'createGroupNanoCredit' ||
|
||||||
|
item === 'groupNanoCredit' ||
|
||||||
|
item === 'demandeValidationGroupe' ||
|
||||||
|
item === 'adhererGroupNanoCredit' ||
|
||||||
|
item === 'myNanoCreditGroup' ||
|
||||||
|
item === 'askNanoCredit' ||
|
||||||
|
item === 'refundNanoCreditUser' ||
|
||||||
|
item === 'cautionNanoCreditAgent' ||
|
||||||
|
item === 'epargnerArgentUser' ||
|
||||||
|
item === 'askNanoCredit' ||
|
||||||
|
item === 'casserEpargneUser' ||
|
||||||
|
item === 'envoieWalletToBankAgent' ||
|
||||||
|
item === 'reattachAccountUser' ||
|
||||||
|
item === 'insuranceSubscriptionScreen' ||
|
||||||
|
item === 'addBeneficiaryScreen' ||
|
||||||
|
item === 'activateBuySubscriptionScreen' ||
|
||||||
|
item === 'saisirFeuilleSoinScreen' ||
|
||||||
|
item === 'validateConsultationScreen' ||
|
||||||
|
item === 'validateConsultationDetailScreen' ||
|
||||||
|
item === 'executerPrescriptionScreen' ||
|
||||||
|
item === 'modifierFeuilleSoinScreen' ||
|
||||||
|
item === 'modifierExecutionPrescriptionScreen' ||
|
||||||
|
item === 'historiqueNanoSanteUserScreen' ||
|
||||||
|
item === 'demandeAutorisationSoinScreen' ||
|
||||||
|
item === 'deleteBeneficiaryScreen' ||
|
||||||
|
item === 'StopSubscriptionScreen' ||
|
||||||
|
item === 'stopSubscriptionScreen' ||
|
||||||
|
item === 'renewAssuranceScreen' ||
|
||||||
|
item === 'webviewScreen' ||
|
||||||
|
item === 'historiqueNanoSanteAgentScreen' ||
|
||||||
|
item === 'historiqueNanoSanteSuperHyperScreen' ||
|
||||||
|
item === 'PDFViewerScreen' ||
|
||||||
|
item === 'ubaFormScreen'
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
} else {
|
} else {
|
||||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
const color = this.state.currentId === item.id ? theme.accent : 'grey';
|
||||||
//console.log("ITEM OPTION MENU", item);
|
//console.log("ITEM OPTION MENU", item);
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity onPress={() => {
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
this.props.navigation.toggleDrawer();
|
this.props.navigation.toggleDrawer();
|
||||||
this.setState({currentId: item.id});
|
this.setState({currentId: item.id});
|
||||||
this.redirectToScreen(item);
|
this.redirectToScreen(item);
|
||||||
}}
|
}}>
|
||||||
>
|
<View style={items.content}>
|
||||||
<View
|
<Icon name={this.getIcon(item)} size={32} />
|
||||||
style={items.content}
|
<Text
|
||||||
>
|
style={{
|
||||||
<Icon
|
|
||||||
name={this.getIcon(item)}
|
|
||||||
size={32}
|
|
||||||
/>
|
|
||||||
<Text style={{
|
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
}}>{this.getNameItems(item)}
|
}}>
|
||||||
|
{this.getNameItems(item)}
|
||||||
</Text>
|
</Text>
|
||||||
</View></TouchableOpacity>)
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_onPress = ((item) => {
|
_onPress = item => {
|
||||||
|
this.setState({currentId: item.id});
|
||||||
this.setState({currentId: item.id})
|
let current = this.state.menu.filter(item => {
|
||||||
let current = this.state.menu.filter((item) => {
|
return item.active;
|
||||||
return item.active
|
})[0];
|
||||||
})[0]
|
|
||||||
current.active = false;
|
current.active = false;
|
||||||
item.active = true;
|
item.active = true;
|
||||||
let newMenu = [];
|
let newMenu = [];
|
||||||
this.state.menu.forEach(function (it) {
|
this.state.menu.forEach(function (it) {
|
||||||
if (it.id === current.id) newMenu.push(current)
|
if (it.id === current.id) {
|
||||||
else if (it.id === item.id) newMenu.push(item)
|
newMenu.push(current);
|
||||||
else newMenu.push(it)
|
} else if (it.id === item.id) {
|
||||||
|
newMenu.push(item);
|
||||||
|
} else {
|
||||||
|
newMenu.push(it);
|
||||||
}
|
}
|
||||||
)
|
});
|
||||||
this.setState({menu: newMenu})
|
this.setState({menu: newMenu});
|
||||||
/* switch(item.id){
|
/* switch(item.id){
|
||||||
case 2:
|
case 2:
|
||||||
Navigation.push(route.stackRoot,{
|
Navigation.push(route.stackRoot,{
|
||||||
|
@ -462,76 +674,75 @@ export default class OptionsMenu extends Component {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
});
|
};
|
||||||
|
|
||||||
getNameItems(item) {
|
getNameItems(item) {
|
||||||
|
let icon = item;
|
||||||
let icon = item
|
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "home":
|
case 'home':
|
||||||
icon = I18n.t('MAP')
|
icon = I18n.t('MAP');
|
||||||
break
|
break;
|
||||||
case 'useraccount':
|
case 'useraccount':
|
||||||
icon = I18n.t('MY_ACCOUNT')
|
icon = I18n.t('MY_ACCOUNT');
|
||||||
break
|
break;
|
||||||
case 'walletSelect':
|
case 'walletSelect':
|
||||||
icon = I18n.t('WALLET')
|
icon = I18n.t('WALLET');
|
||||||
break
|
break;
|
||||||
case 'Historique':
|
case 'Historique':
|
||||||
icon = I18n.t('CREDIT_MANAGE')
|
icon = I18n.t('CREDIT_MANAGE');
|
||||||
break
|
break;
|
||||||
case "superviseurgroup":
|
case 'superviseurgroup':
|
||||||
icon = I18n.t('GROUP_MANAGE')
|
icon = I18n.t('GROUP_MANAGE');
|
||||||
break
|
break;
|
||||||
case "updateinformation":
|
case 'updateinformation':
|
||||||
icon = I18n.t("CHANGE_INFORMATION")
|
icon = I18n.t('CHANGE_INFORMATION');
|
||||||
break
|
break;
|
||||||
case 'notificationview':
|
case 'notificationview':
|
||||||
icon = I18n.t('NOTIFICATIONS')
|
icon = I18n.t('NOTIFICATIONS');
|
||||||
break
|
break;
|
||||||
case 'configuration':
|
case 'configuration':
|
||||||
icon = I18n.t('CONFIGURATIONS')
|
icon = I18n.t('CONFIGURATIONS');
|
||||||
break;
|
break;
|
||||||
case 'addNetwork':
|
case 'addNetwork':
|
||||||
icon = I18n.t('ADD_NETWORK')
|
icon = I18n.t('ADD_NETWORK');
|
||||||
break
|
break;
|
||||||
case 'about':
|
case 'about':
|
||||||
icon = I18n.t('ABOUT')
|
icon = I18n.t('ABOUT');
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
getIcon(item) {
|
getIcon(item) {
|
||||||
let icon = "md-map"
|
let icon = 'md-map';
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "home":
|
case 'home':
|
||||||
icon = "md-map"
|
icon = 'md-map';
|
||||||
break
|
break;
|
||||||
case 'useraccount':
|
case 'useraccount':
|
||||||
icon = "md-person"
|
icon = 'md-person';
|
||||||
break
|
break;
|
||||||
case 'walletSelect':
|
case 'walletSelect':
|
||||||
icon = "md-wallet"
|
icon = 'md-wallet';
|
||||||
break
|
break;
|
||||||
case 'Historique':
|
case 'Historique':
|
||||||
icon = "md-card"
|
icon = 'md-card';
|
||||||
break
|
break;
|
||||||
case "superviseurgroup":
|
case 'superviseurgroup':
|
||||||
icon = "md-people"
|
icon = 'md-people';
|
||||||
break
|
break;
|
||||||
case 'notificationview':
|
case 'notificationview':
|
||||||
icon = "md-notifications";
|
icon = 'md-notifications';
|
||||||
break
|
break;
|
||||||
case "updateinformation":
|
case 'updateinformation':
|
||||||
icon = "md-people"
|
icon = 'md-people';
|
||||||
break
|
break;
|
||||||
case 'configuration':
|
case 'configuration':
|
||||||
icon = 'md-settings'
|
icon = 'md-settings';
|
||||||
break;
|
break;
|
||||||
case 'addNetwork':
|
case 'addNetwork':
|
||||||
icon = "md-people"
|
icon = 'md-people';
|
||||||
break
|
break;
|
||||||
case 'about':
|
case 'about':
|
||||||
icon = 'md-contacts';
|
icon = 'md-contacts';
|
||||||
break;
|
break;
|
||||||
|
@ -543,39 +754,41 @@ export default class OptionsMenu extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var name = this.state.user ? this.state.user.firstname : "";
|
var name = this.state.user ? this.state.user.firstname : '';
|
||||||
const surname = this.state.user ? this.state.user.lastname : "";
|
const surname = this.state.user ? this.state.user.lastname : '';
|
||||||
if (!this.state.lang && this.state.lang !== "change")
|
if (!this.state.lang && this.state.lang !== 'change') {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View
|
<View style={styles.headercontent}>
|
||||||
style={styles.headercontent}
|
|
||||||
>
|
|
||||||
<Text style={styles.headerTitle}>{name}</Text>
|
<Text style={styles.headerTitle}>{name}</Text>
|
||||||
<Text style={styles.headerTitle}>{surname}</Text>
|
<Text style={styles.headerTitle}>{surname}</Text>
|
||||||
<Text style={styles.headerPhone}>{this.state.user ? "" + this.state.user.phone : ""}</Text>
|
<Text style={styles.headerPhone}>
|
||||||
|
{this.state.user ? '' + this.state.user.phone : ''}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<ScrollView style={{
|
<ScrollView
|
||||||
flex: 1, height: responsiveHeight(40)
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
height: responsiveHeight(40),
|
||||||
}}>
|
}}>
|
||||||
<SafeAreaView forceInset={{top: 'always', horizontal: 'never'}}>
|
<SafeAreaView forceInset={{top: 'always', horizontal: 'never'}}>
|
||||||
{
|
{this.state.items &&
|
||||||
this.state.items && Object.keys(this.state.items).map((item, key) => {
|
Object.keys(this.state.items).map((item, key) => {
|
||||||
return this._renderItem(item)
|
return this._renderItem(item);
|
||||||
})
|
})}
|
||||||
}
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<Button
|
<Button
|
||||||
textStyle={styles.btntext}
|
textStyle={styles.btntext}
|
||||||
style={styles.btnDeconnect}
|
style={styles.btnDeconnect}
|
||||||
onPress={() => this.userDeconnect()}
|
onPress={() => this.userDeconnect()}>
|
||||||
>{I18n.t('DISCONNEXION')}</Button>
|
{I18n.t('DISCONNEXION')}
|
||||||
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
else {
|
} else {
|
||||||
setTimeout(() => this.setState({lang: ""}), 500)
|
setTimeout(() => this.setState({lang: ''}), 500);
|
||||||
return (<View/>)
|
return <View />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,23 +798,28 @@ export default class OptionsMenu extends Component {
|
||||||
I18n.t('DISCONNEXION_TEXT'),
|
I18n.t('DISCONNEXION_TEXT'),
|
||||||
[
|
[
|
||||||
{},
|
{},
|
||||||
{text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
|
|
||||||
{
|
{
|
||||||
text: I18n.t('YES'), onPress: () => {
|
text: I18n.t('NO'),
|
||||||
|
onPress: () => console.log('Cancel Pressed'),
|
||||||
|
style: 'cancel',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: I18n.t('YES'),
|
||||||
|
onPress: () => {
|
||||||
disconnect().then(() => {
|
disconnect().then(() => {
|
||||||
IlinkEmitter.emit("userdisconnect");
|
IlinkEmitter.emit('userdisconnect');
|
||||||
AsyncStorage.removeItem('@config:onesignalIds');
|
AsyncStorage.removeItem('@config:onesignalIds');
|
||||||
this.props.navigation.navigate("Auth");
|
this.props.navigation.navigate('Auth');
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
{cancelable: false}
|
{cancelable: false},
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
watchUser() {
|
watchUser() {
|
||||||
readUser().then((user) => {
|
readUser().then(user => {
|
||||||
if (user !== null && user !== undefined) {
|
if (user !== null && user !== undefined) {
|
||||||
if (user.id !== this.state.user.id) {
|
if (user.id !== this.state.user.id) {
|
||||||
this.updateUser(user);
|
this.updateUser(user);
|
||||||
|
@ -617,42 +835,41 @@ const items = StyleSheet.create({
|
||||||
height: 50,
|
height: 50,
|
||||||
paddingLeft: 20,
|
paddingLeft: 20,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
itemText: {
|
itemText: {
|
||||||
color: '#000000',
|
color: '#000000',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
fontSize: responsiveFontSize(2),
|
fontSize: responsiveFontSize(2),
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: "white",
|
backgroundColor: 'white',
|
||||||
},
|
},
|
||||||
btnDeconnect: {
|
btnDeconnect: {
|
||||||
borderColor: "transparent",
|
borderColor: 'transparent',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
backgroundColor: theme.accent
|
backgroundColor: theme.accent,
|
||||||
},
|
},
|
||||||
btntext: {
|
btntext: {
|
||||||
color: "white",
|
color: 'white',
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: "bold"
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
headerTitle: {
|
headerTitle: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
color: "white",
|
color: 'white',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
headerPhone: {
|
headerPhone: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
color: "white",
|
color: 'white',
|
||||||
justifyContent: 'flex-end'
|
justifyContent: 'flex-end',
|
||||||
|
|
||||||
},
|
},
|
||||||
listMenu: {
|
listMenu: {
|
||||||
paddingTop: 15,
|
paddingTop: 15,
|
||||||
|
@ -662,8 +879,7 @@ const styles = StyleSheet.create({
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
paddingLeft: 20
|
paddingLeft: 20,
|
||||||
|
|
||||||
},
|
},
|
||||||
backgroundd_drawer: {
|
backgroundd_drawer: {
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
|
|
|
@ -6,97 +6,116 @@
|
||||||
* @flow
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import { Platform, StyleSheet, Alert, FlatList, Text, View, TouchableOpacity, Linking } from 'react-native';
|
import {
|
||||||
|
Platform,
|
||||||
|
StyleSheet,
|
||||||
|
Alert,
|
||||||
|
FlatList,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
TouchableOpacity,
|
||||||
|
Linking,
|
||||||
|
} from 'react-native';
|
||||||
import ActionButton from 'react-native-action-button';
|
import ActionButton from 'react-native-action-button';
|
||||||
import Icon from 'react-native-vector-icons/Ionicons';
|
import Icon from 'react-native-vector-icons/Ionicons';
|
||||||
import { responsiveFontSize, responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
import {
|
||||||
|
responsiveFontSize,
|
||||||
|
responsiveHeight,
|
||||||
|
responsiveWidth,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
import HeaderMenu from './HeaderMenu';
|
import HeaderMenu from './HeaderMenu';
|
||||||
import { historiques as histo, first, useraccount, notification, configurations } from './../../route.json';
|
import {
|
||||||
|
historiques as histo,
|
||||||
|
first,
|
||||||
|
useraccount,
|
||||||
|
notification,
|
||||||
|
configurations,
|
||||||
|
} from './../../route.json';
|
||||||
import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
|
import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
|
||||||
import {readUser, disconnect} from './../../webservice/AuthApi';
|
import {readUser, disconnect} from './../../webservice/AuthApi';
|
||||||
import I18n from 'react-native-i18n'
|
import I18n from 'react-native-i18n';
|
||||||
const route = require("./../../route.json")
|
const route = require('./../../route.json');
|
||||||
require('./../../utils/Translations')
|
require('./../../utils/Translations');
|
||||||
var DBEvents = require('react-native-db-models').DBEvents
|
var DBEvents = require('react-native-db-models').DBEvents;
|
||||||
type Props = {};
|
type Props = {};
|
||||||
let theme = require('./../../utils/theme.json')
|
let theme = require('./../../utils/theme.json');
|
||||||
import Button from 'apsl-react-native-button'
|
import Button from 'apsl-react-native-button';
|
||||||
import { IlinkEmitter } from "./../../utils/events"
|
import {IlinkEmitter} from './../../utils/events';;
|
||||||
import {DrawerItems, SafeAreaView} from 'react-navigation';
|
import {DrawerItems, SafeAreaView} from 'react-navigation';
|
||||||
import RNDeviceInformation from "fm-react-native-device-info"
|
import RNDeviceInformation from 'fm-react-native-device-info';;
|
||||||
import AppContainer, { AppNavigator } from "../../App";
|
import AppContainer, {AppNavigator} from '../../App';
|
||||||
import Configuration from "../../webservice/persistences/Configuration";
|
import Configuration from '../../webservice/persistences/Configuration';
|
||||||
|
|
||||||
export default class OptionsMenu extends Component<Props> {
|
export default class OptionsMenu extends Component<Props> {
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
statusBarColor: primaryDarkAdvanced,
|
statusBarColor: primaryDarkAdvanced,
|
||||||
};
|
};
|
||||||
commandeListe
|
commandeListe;
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = this.initState();
|
this.state = this.initState();
|
||||||
IlinkEmitter.on("menuLink", this.onMenuNavigationEvent.bind(this))
|
IlinkEmitter.on('menuLink', this.onMenuNavigationEvent.bind(this));;
|
||||||
IlinkEmitter.on("userconnect", this.onUserConnect.bind(this))
|
IlinkEmitter.on('userconnect', this.onUserConnect.bind(this));;
|
||||||
IlinkEmitter.on("userdisconnect", this.hideSideMenu.bind(this))
|
IlinkEmitter.on('userdisconnect', this.hideSideMenu.bind(this));;
|
||||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
IlinkEmitter.on('langueChange', this.updateLangue.bind(this));;
|
||||||
this.configuration = new Configuration();
|
this.configuration = new Configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveAndroidInformation() {
|
retrieveAndroidInformation() {
|
||||||
this.configuration._getData().then((lang) => {
|
this.configuration
|
||||||
|
._getData()
|
||||||
|
.then(lang => {
|
||||||
if (lang) {
|
if (lang) {
|
||||||
I18n.locale = lang
|
I18n.locale = lang;;
|
||||||
readUser().then((result) => {
|
readUser().then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateUser(result);
|
this.updateUser(result);
|
||||||
}, 3000)
|
}, 3000);;
|
||||||
})
|
});;
|
||||||
} else {
|
} else {
|
||||||
RNDeviceInformation.getDeviceCountryCode().then((code) => {
|
RNDeviceInformation.getDeviceCountryCode().then(code => {
|
||||||
I18n.locale = code.toLowerCase()
|
I18n.locale = code.toLowerCase();;
|
||||||
readUser().then((result) => {
|
readUser()
|
||||||
|
.then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateUser(result);
|
this.updateUser(result);
|
||||||
}, 3000)
|
}, 3000);;
|
||||||
}).catch((e) => {
|
|
||||||
this.props.navigation.navigate("Auth")
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.props.navigation.navigate('Auth');;
|
||||||
|
});
|
||||||
|
});;
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
})
|
||||||
RNDeviceInformation.getDeviceCountryCode().then((code) => {
|
.catch(e => {
|
||||||
I18n.locale = code.toLowerCase()
|
RNDeviceInformation.getDeviceCountryCode().then(code => {
|
||||||
readUser().then((result) => {
|
I18n.locale = code.toLowerCase();;
|
||||||
|
readUser()
|
||||||
|
.then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateUser(result);
|
this.updateUser(result);
|
||||||
}, 3000)
|
}, 3000);;
|
||||||
}).catch((e) => {
|
})
|
||||||
this.props.navigation.navigate("Auth")
|
.catch(e => {
|
||||||
|
this.props.navigation.navigate('Auth');;
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
});;
|
||||||
|
|
||||||
})
|
return '';;
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
||||||
// items.filter((item)=>item.)
|
// items.filter((item)=>item.)
|
||||||
this.setState({ items: items })
|
this.setState({items: items});;
|
||||||
this.retrieveAndroidInformation()
|
this.retrieveAndroidInformation();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
updateLangue() {
|
updateLangue() {
|
||||||
this.setState({ lang: "change" })
|
this.setState({lang: 'change'});;
|
||||||
this.forceUpdate()
|
this.forceUpdate();;
|
||||||
}
|
|
||||||
componentWillUnmount() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
componentWillUnmount() {}
|
||||||
onMenuNavigationEvent(menuOption) {
|
onMenuNavigationEvent(menuOption) {
|
||||||
/* Navigation.mergeOptions(this.props.componentId,{
|
/* Navigation.mergeOptions(this.props.componentId,{
|
||||||
sideMenu: {
|
sideMenu: {
|
||||||
|
@ -116,15 +135,13 @@ export default class OptionsMenu extends Component<Props> {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
onUserConnect() {
|
onUserConnect() {
|
||||||
readUser().then((user) => {
|
readUser().then(user => {
|
||||||
if (user !== null && user !== undefined) {
|
if (user !== null && user !== undefined) {
|
||||||
this.updateUser(user);
|
this.updateUser(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
onNavigatorEvent(event) {
|
onNavigatorEvent(event) {}
|
||||||
|
|
||||||
}
|
|
||||||
hideSideMenu() {
|
hideSideMenu() {
|
||||||
/* Navigation.mergeOptions("drawer", {
|
/* Navigation.mergeOptions("drawer", {
|
||||||
sideMenu: {
|
sideMenu: {
|
||||||
|
@ -140,35 +157,131 @@ export default class OptionsMenu extends Component<Props> {
|
||||||
user: null,
|
user: null,
|
||||||
menu: [],
|
menu: [],
|
||||||
currentId: 0,
|
currentId: 0,
|
||||||
}
|
};;
|
||||||
}
|
}
|
||||||
getGeolocatedUserMenu() {
|
getGeolocatedUserMenu() {
|
||||||
return [
|
return [
|
||||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
{
|
||||||
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false }
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, { title: I18n.t('ADD_NETWORK'), id: 11, key: 11, icon: 'md-people', active: false }
|
id: 1,
|
||||||
, { title: I18n.t('CHANGE_INFORMATION'), id: 13, key: 13, icon: 'md-person', active: false }
|
key: 1,
|
||||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
icon: 'md-person',
|
||||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
id: 2,
|
||||||
|
key: 2,
|
||||||
|
icon: 'md-card',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('ADD_NETWORK'),
|
||||||
|
id: 11,
|
||||||
|
key: 11,
|
||||||
|
icon: 'md-people',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CHANGE_INFORMATION'),
|
||||||
|
id: 13,
|
||||||
|
key: 13,
|
||||||
|
icon: 'md-person',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,;
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
getSuperUserMenu() {
|
getSuperUserMenu() {
|
||||||
return [
|
return [
|
||||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
{
|
||||||
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false }
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, { title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false }
|
id: 1,
|
||||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
key: 1,
|
||||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
icon: 'md-person',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
id: 2,
|
||||||
|
key: 2,
|
||||||
|
icon: 'md-card',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('GROUP_MANAGE'),
|
||||||
|
id: 5,
|
||||||
|
key: 5,
|
||||||
|
icon: 'md-people',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
getHyperUsermenu() {
|
getHyperUsermenu() {
|
||||||
return [
|
return [
|
||||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
{
|
||||||
, { title: I18n.t('CREDIT_MANAGE'), id: 2, key: 2, icon: 'md-card', active: false }
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, { title: I18n.t('GROUP_MANAGE'), id: 5, key: 5, icon: 'md-people', active: false }
|
id: 1,
|
||||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
key: 1,
|
||||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
icon: 'md-person',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
id: 2,
|
||||||
|
key: 2,
|
||||||
|
icon: 'md-card',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('GROUP_MANAGE'),
|
||||||
|
id: 5,
|
||||||
|
key: 5,
|
||||||
|
icon: 'md-people',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,;
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
updateUser(user) {
|
updateUser(user) {
|
||||||
let menu = [];
|
let menu = [];
|
||||||
|
@ -183,73 +296,94 @@ export default class OptionsMenu extends Component<Props> {
|
||||||
});*/
|
});*/
|
||||||
if (user.category !== undefined) {
|
if (user.category !== undefined) {
|
||||||
switch (user.category) {
|
switch (user.category) {
|
||||||
case "geolocated":
|
case 'geolocated':
|
||||||
menu = this.getGeolocatedUserMenu();
|
menu = this.getGeolocatedUserMenu();
|
||||||
break;
|
break;
|
||||||
case "super":
|
case 'super':
|
||||||
menu = this.getSuperUserMenu();
|
menu = this.getSuperUserMenu();
|
||||||
break;
|
break;
|
||||||
case "hyper":
|
case 'hyper':
|
||||||
menu = this.getHyperUsermenu();
|
menu = this.getHyperUsermenu();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu = this.getUserMenu();
|
menu = this.getUserMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.setState({user: user, menu: menu});
|
this.setState({user: user, menu: menu});
|
||||||
}
|
}
|
||||||
getUserMenu() {
|
getUserMenu() {
|
||||||
return [
|
return [
|
||||||
{ title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true }
|
{title: I18n.t('MAP'), id: 0, key: 0, icon: 'md-map', active: true},
|
||||||
, { title: I18n.t('MY_ACCOUNT'), id: 1, key: 1, icon: 'md-person', active: false }
|
{
|
||||||
, { title: I18n.t('NOTIFICATIONS'), id: 3, key: 3, icon: 'md-notifications', active: false }
|
title: I18n.t('MY_ACCOUNT'),
|
||||||
, { title: I18n.t('CONFIGURATIONS'), id: 4, icon: 'md-settings', active: false }]
|
id: 1,
|
||||||
|
key: 1,
|
||||||
|
icon: 'md-person',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('NOTIFICATIONS'),
|
||||||
|
id: 3,
|
||||||
|
key: 3,
|
||||||
|
icon: 'md-notifications',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: I18n.t('CONFIGURATIONS'),
|
||||||
|
id: 4,
|
||||||
|
icon: 'md-settings',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
_renderItem = (item) => {
|
_renderItem = item => {
|
||||||
if (item === "creditrequest" || item === 'historyItemDetails' || item === 'filter' || item === 'networks' || item === 'createIdentification') {
|
if (
|
||||||
return null
|
item === 'creditrequest' ||
|
||||||
|
item === 'historyItemDetails' ||
|
||||||
|
item === 'filter' ||
|
||||||
|
item === 'networks' ||
|
||||||
|
item === 'createIdentification'
|
||||||
|
) {
|
||||||
|
return null;;
|
||||||
} else {
|
} else {
|
||||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
const color = this.state.currentId === item.id ? theme.accent : 'grey';;
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity onPress={() => {
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
this.props.navigation.toggleDrawer();
|
this.props.navigation.toggleDrawer();
|
||||||
this.setState({ currentId: item.id })
|
this.setState({currentId: item.id});;
|
||||||
this.props.navigation.navigate(item)
|
this.props.navigation.navigate(item);;
|
||||||
}}
|
}}>
|
||||||
>
|
<View style={items.content}>
|
||||||
<View
|
<Icon name={this.getIcon(item)} size={32} />
|
||||||
style={items.content}
|
<Text
|
||||||
>
|
style={{
|
||||||
<Icon
|
|
||||||
name={this.getIcon(item)}
|
|
||||||
size={32}
|
|
||||||
/>
|
|
||||||
<Text style={{
|
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
}}>{this.getNameItems(item)}
|
}}>
|
||||||
|
{this.getNameItems(item)}
|
||||||
</Text>
|
</Text>
|
||||||
</View></TouchableOpacity>)
|
</View>
|
||||||
|
</TouchableOpacity>;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_onPress = ((item) => {
|
_onPress = item => {
|
||||||
|
this.setState({currentId: item.id});;
|
||||||
this.setState({ currentId: item.id })
|
let current = this.state.menu.filter(item => {
|
||||||
let current = this.state.menu.filter((item) => { return item.active })[0]
|
return item.active;
|
||||||
|
})[0];;
|
||||||
current.active = false;
|
current.active = false;
|
||||||
item.active = true;
|
item.active = true;
|
||||||
let newMenu = [];
|
let newMenu = [];
|
||||||
this.state.menu.forEach(function (it) {
|
this.state.menu.forEach(function (it) {
|
||||||
if (it.id === current.id) newMenu.push(current)
|
if (it.id === current.id) newMenu.push(current);;
|
||||||
else if (it.id === item.id) newMenu.push(item)
|
else if (it.id === item.id) newMenu.push(item);;
|
||||||
else newMenu.push(it)
|
else newMenu.push(it);;
|
||||||
}
|
});;
|
||||||
)
|
this.setState({menu: newMenu});;
|
||||||
this.setState({ menu: newMenu })
|
|
||||||
/* switch(item.id){
|
/* switch(item.id){
|
||||||
case 2:
|
case 2:
|
||||||
Navigation.push(route.stackRoot,{
|
Navigation.push(route.stackRoot,{
|
||||||
|
@ -393,60 +527,80 @@ export default class OptionsMenu extends Component<Props> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/ });
|
*/
|
||||||
|
};
|
||||||
getNameItems(item) {
|
getNameItems(item) {
|
||||||
|
let icon = item;;
|
||||||
let icon = item
|
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "home": icon = I18n.t('MAP')
|
case 'home':
|
||||||
break
|
icon = I18n.t('MAP');;
|
||||||
case 'useraccount': icon = I18n.t('MY_ACCOUNT')
|
break;;
|
||||||
break
|
case 'useraccount':
|
||||||
case 'Historique': icon = I18n.t('CREDIT_MANAGE')
|
icon = I18n.t('MY_ACCOUNT');;
|
||||||
break
|
break;;
|
||||||
case "superviseurgroup": icon = I18n.t('GROUP_MANAGE')
|
case 'Historique':
|
||||||
break
|
icon = I18n.t('CREDIT_MANAGE');;
|
||||||
case "updateinformation": icon = I18n.t("CHANGE_INFORMATION")
|
break;;
|
||||||
break
|
case 'superviseurgroup':
|
||||||
case 'notificationview': icon = I18n.t('NOTIFICATIONS')
|
icon = I18n.t('GROUP_MANAGE');;
|
||||||
break
|
break;;
|
||||||
case 'configuration': icon = I18n.t('CONFIGURATIONS')
|
case 'updateinformation':
|
||||||
break;
|
icon = I18n.t('CHANGE_INFORMATION');;
|
||||||
case 'addNetwork': icon = I18n.t('ADD_NETWORK')
|
break;;
|
||||||
break
|
case 'notificationview':
|
||||||
case 'about': icon = I18n.t('ABOUT_')
|
icon = I18n.t('NOTIFICATIONS');;
|
||||||
|
break;;
|
||||||
|
case 'configuration':
|
||||||
|
icon = I18n.t('CONFIGURATIONS');;
|
||||||
|
break;;
|
||||||
|
case 'addNetwork':
|
||||||
|
icon = I18n.t('ADD_NETWORK');;
|
||||||
|
break;;
|
||||||
|
case 'about':
|
||||||
|
icon = I18n.t('ABOUT_');;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
getIcon(item) {
|
getIcon(item) {
|
||||||
let icon = "md-map"
|
let icon = 'md-map';;
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "home": icon = "md-map"
|
case 'home':
|
||||||
break
|
icon = 'md-map';;
|
||||||
case 'useraccount': icon = "md-person"
|
break;;
|
||||||
break
|
case 'useraccount':
|
||||||
case 'Historique': icon = "md-card"
|
icon = 'md-person';;
|
||||||
break
|
break;;
|
||||||
case "superviseurgroup": icon = "md-people"
|
case 'Historique':
|
||||||
break
|
icon = 'md-card';;
|
||||||
case 'notificationview': icon = "md-notifications";
|
break;;
|
||||||
break
|
case 'superviseurgroup':
|
||||||
case "updateinformation": icon = "md-people"
|
icon = 'md-people';;
|
||||||
break
|
break;;
|
||||||
case 'configuration': icon = 'md-settings'
|
case 'notificationview':
|
||||||
|
icon = 'md-notifications';
|
||||||
|
break;;
|
||||||
|
case 'updateinformation':
|
||||||
|
icon = 'md-people';;
|
||||||
|
break;;
|
||||||
|
case 'configuration':
|
||||||
|
icon = 'md-settings';;
|
||||||
break;
|
break;
|
||||||
case 'addNetwork': icon = "md-people"
|
case 'addNetwork':
|
||||||
break
|
icon = 'md-people';;
|
||||||
case 'about': icon = 'md-contacts';
|
break;;
|
||||||
|
case 'about':
|
||||||
|
icon = 'md-contacts';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
var name = this.state.user ? this.state.user.firstname : "";
|
var name = this.state.user ? this.state.user.firstname : '';
|
||||||
const surname = this.state.user ? this.state.user.lastname : "";
|
const surname = this.state.user ? this.state.user.lastname : '';
|
||||||
if (!this.state.lang && this.state.lang !== "change")
|
if (!this.state.lang && this.state.lang !== 'change')
|
||||||
return (
|
{return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View
|
<View
|
||||||
style={styles.headercontent}
|
style={styles.headercontent}
|
||||||
|
@ -470,10 +624,10 @@ export default class OptionsMenu extends Component<Props> {
|
||||||
onPress={() => this.userDeconnect()}
|
onPress={() => this.userDeconnect()}
|
||||||
>{I18n.t('DISCONNEXION')}</Button>
|
>{I18n.t('DISCONNEXION')}</Button>
|
||||||
</View>
|
</View>
|
||||||
)
|
)};
|
||||||
else {
|
else {
|
||||||
setTimeout(() => this.setState({ lang: "" }), 500)
|
setTimeout(() => this.setState({lang: ''}), 500);;
|
||||||
return (<View />)
|
return <View />;;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userDeconnect() {
|
userDeconnect() {
|
||||||
|
@ -482,21 +636,26 @@ export default class OptionsMenu extends Component<Props> {
|
||||||
I18n.t('DISCONNEXION_TEXT'),
|
I18n.t('DISCONNEXION_TEXT'),
|
||||||
[
|
[
|
||||||
{},
|
{},
|
||||||
{ text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
|
|
||||||
{
|
{
|
||||||
text: I18n.t('YES'), onPress: () => {
|
text: I18n.t('NO'),
|
||||||
|
onPress: () => console.log('Cancel Pressed'),
|
||||||
|
style: 'cancel',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: I18n.t('YES'),
|
||||||
|
onPress: () => {
|
||||||
disconnect().then(() => {
|
disconnect().then(() => {
|
||||||
IlinkEmitter.emit("userdisconnect");
|
IlinkEmitter.emit('userdisconnect');
|
||||||
this.props.navigation.navigate("Auth")
|
this.props.navigation.navigate('Auth');;
|
||||||
})
|
});;
|
||||||
}
|
},,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
{ cancelable: false }
|
{cancelable: false},
|
||||||
)
|
);;
|
||||||
}
|
}
|
||||||
watchUser() {
|
watchUser() {
|
||||||
readUser().then((user) => {
|
readUser().then(user => {
|
||||||
if (user !== null && user !== undefined) {
|
if (user !== null && user !== undefined) {
|
||||||
this.updateUser(user);
|
this.updateUser(user);
|
||||||
}
|
}
|
||||||
|
@ -510,42 +669,41 @@ const items = StyleSheet.create({
|
||||||
height: 50,
|
height: 50,
|
||||||
paddingLeft: 20,
|
paddingLeft: 20,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center'
|
alignItems: 'center',,
|
||||||
},
|
},
|
||||||
itemText: {
|
itemText: {
|
||||||
color: '#000000',
|
color: '#000000',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
fontSize: responsiveFontSize(2),
|
fontSize: responsiveFontSize(2),
|
||||||
}
|
},,
|
||||||
});
|
});
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: "white",
|
backgroundColor: 'white',
|
||||||
},
|
},
|
||||||
btnDeconnect: {
|
btnDeconnect: {
|
||||||
borderColor: "transparent",
|
borderColor: 'transparent',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
marginRight: 20,
|
marginRight: 20,
|
||||||
backgroundColor: theme.accent
|
backgroundColor: theme.accent,,
|
||||||
},
|
},
|
||||||
btntext: {
|
btntext: {
|
||||||
color: "white",
|
color: 'white',
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
fontWeight: "bold"
|
fontWeight: 'bold',,
|
||||||
},
|
},
|
||||||
headerTitle: {
|
headerTitle: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
color: "white",
|
color: 'white',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
headerPhone: {
|
headerPhone: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
color: "white",
|
color: 'white',
|
||||||
justifyContent: 'flex-end'
|
justifyContent: 'flex-end',
|
||||||
|
|
||||||
},
|
},
|
||||||
listMenu: {
|
listMenu: {
|
||||||
paddingTop: 15,
|
paddingTop: 15,
|
||||||
|
@ -555,14 +713,12 @@ const styles = StyleSheet.create({
|
||||||
backgroundColor: primary,
|
backgroundColor: primary,
|
||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
paddingLeft: 20
|
paddingLeft: 20,
|
||||||
|
|
||||||
},
|
},
|
||||||
backgroundd_drawer: {
|
backgroundd_drawer: {
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
},
|
},
|
||||||
listbackground: {
|
listbackground: {},
|
||||||
},
|
|
||||||
actionButtonIcon: {
|
actionButtonIcon: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
height: 22,
|
height: 22,
|
||||||
|
|
|
@ -1,15 +1,30 @@
|
||||||
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Image, PermissionsAndroid, StatusBar, StyleSheet, View} from 'react-native';
|
import {
|
||||||
import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
|
Image,
|
||||||
import I18n from 'react-native-i18n'
|
PermissionsAndroid,
|
||||||
import {getPasObject, getPubActiveObject, readUser} from '../../webservice/AuthApi';
|
StatusBar,
|
||||||
import Configuration from "../../webservice/persistences/Configuration";
|
StyleSheet,
|
||||||
import '../ads/InterticielAds'
|
View,
|
||||||
|
} from 'react-native';
|
||||||
|
import {
|
||||||
|
responsiveFontSize,
|
||||||
|
responsiveHeight,
|
||||||
|
responsiveWidth,
|
||||||
|
} from 'react-native-responsive-dimensions';
|
||||||
|
import I18n from 'react-native-i18n';
|
||||||
|
import {
|
||||||
|
getPasObject,
|
||||||
|
getPubActiveObject,
|
||||||
|
readUser,
|
||||||
|
} from '../../webservice/AuthApi';
|
||||||
|
import Configuration from '../../webservice/persistences/Configuration';
|
||||||
|
import '../ads/InterticielAds';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import DeviceInfo from 'react-native-device-info';
|
import DeviceInfo from 'react-native-device-info';
|
||||||
import {bindActionCreators} from "redux";
|
import {bindActionCreators} from 'redux';
|
||||||
import getAuthApiKey from "../../webservice/AuthKeyApi";
|
import getAuthApiKey from '../../webservice/AuthKeyApi';
|
||||||
import {connect} from "react-redux";
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
const theme = require('./../../utils/theme.json');
|
const theme = require('./../../utils/theme.json');
|
||||||
const route = require('./../../route.json');
|
const route = require('./../../route.json');
|
||||||
|
@ -27,70 +42,74 @@ class SplashScreen extends Component {
|
||||||
statusBar: {
|
statusBar: {
|
||||||
visible: false,
|
visible: false,
|
||||||
style: 'light' | 'dark',
|
style: 'light' | 'dark',
|
||||||
drawBehind: true
|
drawBehind: true,
|
||||||
},
|
},
|
||||||
topBar: {
|
topBar: {
|
||||||
title: {
|
title: {
|
||||||
text: 'My Screen'
|
text: 'My Screen',
|
||||||
},
|
},
|
||||||
drawBehind: true,
|
drawBehind: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
animate: false
|
animate: false,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {};
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
workUserResult(result) {
|
workUserResult(result) {
|
||||||
console.log("SPLASHSCREEN PROPS", this.props);
|
console.log('SPLASHSCREEN PROPS', this.props);
|
||||||
if (typeof this.props.navigation.state.params !== 'undefined') {
|
if (typeof this.props.navigation.state.params !== 'undefined') {
|
||||||
if (result === null || result === undefined) {
|
if (result === null || result === undefined) {
|
||||||
this.props.navigation.navigate("Auth");
|
this.props.navigation.navigate('Auth');
|
||||||
} else {
|
} else {
|
||||||
switch (this.props.navigation.state.params.routeName) {
|
switch (this.props.navigation.state.params.routeName) {
|
||||||
case 'historyItemDetails':
|
case 'historyItemDetails':
|
||||||
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
|
this.props.navigation.navigate(
|
||||||
item: this.props.navigation.state.params.params
|
this.props.navigation.state.params.routeName,
|
||||||
});
|
{
|
||||||
|
item: this.props.navigation.state.params.params,
|
||||||
|
},
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this.props.navigation.navigate(this.props.navigation.state.params.routeName, {
|
this.props.navigation.navigate(
|
||||||
id: this.props.navigation.state.params.params.id
|
this.props.navigation.state.params.routeName,
|
||||||
});
|
{
|
||||||
|
id: this.props.navigation.state.params.params.id,
|
||||||
|
},
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var way = "";
|
var way = '';
|
||||||
var way2 = "";
|
var way2 = '';
|
||||||
if (result === null || result === undefined) {
|
if (result === null || result === undefined) {
|
||||||
way = "Auth"
|
way = 'Auth';
|
||||||
way2 = route.first
|
way2 = route.first;
|
||||||
|
} else {
|
||||||
|
if (!result.category) {
|
||||||
|
way = 'App';
|
||||||
} else {
|
} else {
|
||||||
if (!result.category)
|
|
||||||
way = "App"
|
|
||||||
else {
|
|
||||||
switch (result.category) {
|
switch (result.category) {
|
||||||
case 'geolocated': way = "AgentApp"
|
case 'geolocated':
|
||||||
|
way = 'AgentApp';
|
||||||
|
break;
|
||||||
|
case 'super':
|
||||||
|
way = 'adminApp';
|
||||||
break;
|
break;
|
||||||
case 'super': way = "adminApp"
|
|
||||||
break
|
|
||||||
default:
|
default:
|
||||||
way = "supAdminApp"
|
way = 'supAdminApp';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
way2 = route.login
|
way2 = route.login;
|
||||||
}
|
}
|
||||||
this.props.navigation.navigate(way)
|
this.props.navigation.navigate(way);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Navigation.setStackRoot(route.stackRoot,
|
/* Navigation.setStackRoot(route.stackRoot,
|
||||||
|
@ -112,145 +131,156 @@ class SplashScreen extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
try {
|
try {
|
||||||
this.requestCameraPermission()
|
this.requestCameraPermission();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e);
|
||||||
}
|
}
|
||||||
this.config = new Configuration();
|
this.config = new Configuration();
|
||||||
this.retrieveAndroidInformation()
|
this.retrieveAndroidInformation();
|
||||||
setTimeout(() => this.bounce(), 500)
|
setTimeout(() => this.bounce(), 500);
|
||||||
this.bounce()
|
this.bounce();
|
||||||
readUser().then(async (user) => {
|
readUser().then(async 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
async requestCameraPermission() {
|
async requestCameraPermission() {
|
||||||
try {
|
try {
|
||||||
const granted = await PermissionsAndroid.request(
|
const granted = await PermissionsAndroid.request(
|
||||||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||||
{
|
{
|
||||||
'title': 'Cool Photo App Camera Permission',
|
title: 'Cool Photo App Camera Permission',
|
||||||
'message': 'Cool Photo App needs access to your camera ' +
|
message:
|
||||||
'so you can take awesome pictures.'
|
'Cool Photo App needs access to your camera ' +
|
||||||
}
|
'so you can take awesome pictures.',
|
||||||
)
|
},
|
||||||
|
);
|
||||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log("try get information else")
|
console.log('try get information else');
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("try get information error")
|
console.log('try get information error');
|
||||||
console.log(err)
|
console.log(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleViewRef = ref => this.view = ref;
|
handleViewRef = ref => (this.view = ref);
|
||||||
|
|
||||||
bounce = () => this.view.transition({translateX: 0}, {translateX: 700}, 5000);
|
bounce = () => this.view.transition({translateX: 0}, {translateX: 700}, 5000);
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<StatusBar
|
<StatusBar translucent={true} />
|
||||||
translucent={true}
|
<Image
|
||||||
|
style={styles.logo}
|
||||||
|
source={require('./../../datas/img/icon3up.png')}
|
||||||
/>
|
/>
|
||||||
<Image style={styles.logo} source={require('./../../datas/img/icon3up.png')} />
|
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={{flexDirection: 'row'}}>
|
||||||
<Image style={styles.logo} source={require('./../../datas/img/iconsub3.png')} />
|
<Image
|
||||||
|
style={styles.logo}
|
||||||
|
source={require('./../../datas/img/iconsub3.png')}
|
||||||
|
/>
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
style={{ width: responsiveWidth(90), height: 92, backgroundColor: theme.primary, position: 'absolute', zIndex: 100 }}
|
style={{
|
||||||
ref={this.handleViewRef}>
|
width: responsiveWidth(90),
|
||||||
</Animatable.View>
|
height: 92,
|
||||||
|
backgroundColor: theme.primary,
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: 100,
|
||||||
|
}}
|
||||||
|
ref={this.handleViewRef}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
retreiveIosInformation() {
|
retreiveIosInformation() {
|
||||||
readUser().then((result) => {
|
readUser()
|
||||||
|
.then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.workUserResult(result)
|
this.workUserResult(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
}).catch((e) => {
|
})
|
||||||
this.props.navigation.navigate("Auth")
|
.catch(e => {
|
||||||
|
this.props.navigation.navigate('Auth');
|
||||||
});
|
});
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveAndroidInformation() {
|
retrieveAndroidInformation() {
|
||||||
getPasObject().then((data) => {
|
getPasObject().then(data => {
|
||||||
console.warn(data);
|
console.warn(data);
|
||||||
this.config.setCurrentPas(data)
|
this.config.setCurrentPas(data);
|
||||||
})
|
});
|
||||||
|
|
||||||
this.config._getData().then((lang) => {
|
this.config
|
||||||
|
._getData()
|
||||||
|
.then(lang => {
|
||||||
if (lang) {
|
if (lang) {
|
||||||
I18n.locale = lang
|
I18n.locale = lang;
|
||||||
readUser().then((result) => {
|
readUser().then(result => {
|
||||||
console.warn(result)
|
console.warn(result);
|
||||||
if (result) {
|
if (result) {
|
||||||
getPubActiveObject(result['country_id']).then((data) => {
|
getPubActiveObject(result.country_id).then(data => {
|
||||||
console.warn(data)
|
console.warn(data);
|
||||||
this.config.setPubActive(data);
|
this.config.setPubActive(data);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.workUserResult(result)
|
this.workUserResult(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
const code = DeviceInfo.getDeviceLocale();
|
const code = DeviceInfo.getDeviceLocale();
|
||||||
console.warn(code)
|
console.warn(code);
|
||||||
I18n.locale = code.toLowerCase()
|
I18n.locale = code.toLowerCase();
|
||||||
readUser().then((result) => {
|
readUser()
|
||||||
console.warn(result)
|
.then(result => {
|
||||||
|
console.warn(result);
|
||||||
if (result) {
|
if (result) {
|
||||||
getPubActiveObject(result['country_id']).then((data) => {
|
getPubActiveObject(result.country_id).then(data => {
|
||||||
console.warn(data)
|
console.warn(data);
|
||||||
this.config.setPubActive(data);
|
this.config.setPubActive(data);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.workUserResult(result)
|
this.workUserResult(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
}).catch((e) => {
|
})
|
||||||
this.setPubActive(data)
|
.catch(e => {
|
||||||
|
this.setPubActive(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
})
|
||||||
console.warn(e.message)
|
.catch(e => {
|
||||||
DeviceInfo.getDeviceLocale().then((code) => {
|
console.warn(e.message);
|
||||||
console.warn(code)
|
DeviceInfo.getDeviceLocale().then(code => {
|
||||||
|
console.warn(code);
|
||||||
|
|
||||||
I18n.locale = code.toLowerCase()
|
I18n.locale = code.toLowerCase();
|
||||||
readUser().then((result) => {
|
readUser()
|
||||||
|
.then(result => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.workUserResult(result)
|
this.workUserResult(result);
|
||||||
}, 3000)
|
}, 3000);
|
||||||
}).catch((e) => {
|
})
|
||||||
this.props.navigation.navigate("Auth")
|
.catch(e => {
|
||||||
|
this.props.navigation.navigate('Auth');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})
|
|
||||||
|
|
||||||
})
|
return '';
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,9 +290,13 @@ const mapStateToProps = state => ({
|
||||||
error: state.authKeyReducer.error,
|
error: state.authKeyReducer.error,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
const mapDispatchToProps = dispatch =>
|
||||||
|
bindActionCreators(
|
||||||
|
{
|
||||||
getAuthApiKey,
|
getAuthApiKey,
|
||||||
}, dispatch);
|
},
|
||||||
|
dispatch,
|
||||||
|
);
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(SplashScreen);
|
export default connect(mapStateToProps, mapDispatchToProps)(SplashScreen);
|
||||||
|
|
||||||
|
@ -274,7 +308,6 @@ const styles = StyleSheet.create({
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
logoContaner: {
|
logoContaner: {
|
||||||
|
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
marginTop: responsiveHeight(20),
|
marginTop: responsiveHeight(20),
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
@ -282,12 +315,11 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
logo: {
|
logo: {
|
||||||
width: responsiveWidth(90),
|
width: responsiveWidth(90),
|
||||||
resizeMode: 'contain'
|
resizeMode: 'contain',
|
||||||
},
|
},
|
||||||
lottie: {
|
lottie: {
|
||||||
width: 48
|
width: 48,
|
||||||
,
|
height: 64,
|
||||||
height: 64
|
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
fontSize: responsiveFontSize(4),
|
fontSize: responsiveFontSize(4),
|
||||||
|
@ -295,4 +327,4 @@ const styles = StyleSheet.create({
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: 'white',
|
color: 'white',
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,7 @@
|
||||||
"debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ ; cd ./android ; sudo ./gradlew clean ; sudo ./gradlew assembleDebug && cd .. && sudo adb install ./android/app/build/outputs/apk/debug/app-debug.apk",
|
"debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/ ; cd ./android ; sudo ./gradlew clean ; sudo ./gradlew assembleDebug && cd .. && sudo adb install ./android/app/build/outputs/apk/debug/app-debug.apk",
|
||||||
"start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8",
|
"start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8",
|
||||||
"start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8",
|
"start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8",
|
||||||
"run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android",
|
"run-debug": "cd android && gradlew clean && cd .. && react-native run-android",
|
||||||
"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": {
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
"react-native-loader": "^1.2.1",
|
"react-native-loader": "^1.2.1",
|
||||||
"react-native-loading-spinner-overlay": "^1.0.1",
|
"react-native-loading-spinner-overlay": "^1.0.1",
|
||||||
"react-native-local-mongodb": "^2.2.9",
|
"react-native-local-mongodb": "^2.2.9",
|
||||||
"react-native-maps": "0.26.1",
|
"react-native-maps": "^1.4.0",
|
||||||
"react-native-maps-directions": "^1.7.0",
|
"react-native-maps-directions": "^1.7.0",
|
||||||
"react-native-material-bottom-navigation": "^1.0.3",
|
"react-native-material-bottom-navigation": "^1.0.3",
|
||||||
"react-native-material-bottom-navigation-performance": "^0.7.8",
|
"react-native-material-bottom-navigation-performance": "^0.7.8",
|
||||||
|
|
129
qApp.android.js
129
qApp.android.js
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable prettier/prettier */
|
||||||
/**
|
/**
|
||||||
* Sample React Native App
|
* Sample React Native App
|
||||||
* https://github.com/facebook/react-native
|
* https://github.com/facebook/react-native
|
||||||
|
@ -13,37 +14,37 @@ import {
|
||||||
createStackNavigator,
|
createStackNavigator,
|
||||||
createDrawerNavigator,
|
createDrawerNavigator,
|
||||||
createAppContainer,
|
createAppContainer,
|
||||||
createBottomTabNavigator
|
createBottomTabNavigator,
|
||||||
} from 'react-navigation';
|
} from 'react-navigation';
|
||||||
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';
|
||||||
import Help from "./screens/help/Help";
|
import Help from './screens/help/Help';
|
||||||
import ForgottenPassword from "./screens/login/ForgottenPassword";
|
import ForgottenPassword from './screens/login/ForgottenPassword';
|
||||||
import TypeChoiser from "./screens/login/TypeChoiser";
|
import TypeChoiser from './screens/login/TypeChoiser';
|
||||||
import CreateUserStep2 from "./screens/login/createUserStep2";
|
import CreateUserStep2 from './screens/login/createUserStep2';
|
||||||
import createAccount from "./screens/login/createAccount";
|
import createAccount from './screens/login/createAccount';
|
||||||
import UpdateInformations from "./screens/account/UpdateInformations";
|
import UpdateInformations from './screens/account/UpdateInformations';
|
||||||
import UserAccount from "./screens/account/UserAccount";
|
import UserAccount from './screens/account/UserAccount';
|
||||||
import ActivateAccount from "./screens/login/ActivateAccount";
|
import ActivateAccount from './screens/login/ActivateAccount';
|
||||||
import Notifications from "./screens/notifications/Notifications";
|
import Notifications from './screens/notifications/Notifications';
|
||||||
import About from "./screens/configurations/About";
|
import About from './screens/configurations/About';
|
||||||
import Configurations from "./screens/configurations/Configurations";
|
import Configurations from './screens/configurations/Configurations';
|
||||||
|
|
||||||
import History from './screens/history-request/History'
|
import History from './screens/history-request/History';
|
||||||
import OptionsMenu from "./screens/optionMenu/OptionsMenu";
|
import OptionsMenu from './screens/optionMenu/OptionsMenu';
|
||||||
import Home from "./screens/home/Home";
|
import Home from './screens/home/Home';
|
||||||
import HistoryItemDetails from "./screens/history-request/HistoryItemDetails";
|
import HistoryItemDetails from './screens/history-request/HistoryItemDetails';
|
||||||
import SuperViseurGroupeHome from "./screens/groupes/SuperViseurGroupeHome";
|
import SuperViseurGroupeHome from './screens/groupes/SuperViseurGroupeHome';
|
||||||
import HistoryRequester from "./screens/history-request/HistoryRequester";
|
import HistoryRequester from './screens/history-request/HistoryRequester';
|
||||||
import AddNetwork from "./screens/account/AddNetwork";
|
import AddNetwork from './screens/account/AddNetwork';
|
||||||
import MyHistory from "./screens/history-request/MyHistory";
|
import MyHistory from './screens/history-request/MyHistory';
|
||||||
import Icon from "react-native-vector-icons/FontAwesome5";
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import {GoogleAnalyticsTracker} from 'react-native-google-analytics-bridge';
|
import {GoogleAnalyticsTracker} from 'react-native-google-analytics-bridge';
|
||||||
import {Appbar} from 'react-native-paper';
|
import {Appbar} from 'react-native-paper';
|
||||||
|
|
||||||
import IconWithBadge from "./screens/IconWithBadge"
|
import IconWithBadge from './screens/IconWithBadge';
|
||||||
import I18n from "react-native-i18n";
|
import I18n from 'react-native-i18n';
|
||||||
import Filter from './screens/home/Filter';
|
import Filter from './screens/home/Filter';
|
||||||
import {createMaterialBottomTabNavigator} from 'react-navigation-material-bottom-tabs';
|
import {createMaterialBottomTabNavigator} from 'react-navigation-material-bottom-tabs';
|
||||||
import Networks from './screens/home/Networks';
|
import Networks from './screens/home/Networks';
|
||||||
|
@ -56,7 +57,7 @@ const instructions = Platform.select({
|
||||||
});
|
});
|
||||||
|
|
||||||
type Props = {};
|
type Props = {};
|
||||||
const theme = require("./utils/theme")
|
const theme = require('./utils/theme');
|
||||||
|
|
||||||
class HomeScreen extends Component<Props> {
|
class HomeScreen extends Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
|
@ -78,11 +79,11 @@ const AuthStack = createStackNavigator({
|
||||||
typeaccountcreate: TypeChoiser,
|
typeaccountcreate: TypeChoiser,
|
||||||
simpleusercreate: createAccount,
|
simpleusercreate: createAccount,
|
||||||
step2: CreateUserStep2,
|
step2: CreateUserStep2,
|
||||||
activateaccout: ActivateAccount
|
activateaccout: ActivateAccount,
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
headerMode: 'none'
|
headerMode: 'none',
|
||||||
})
|
});
|
||||||
const AppStack = createDrawerNavigator({
|
const AppStack = createDrawerNavigator({
|
||||||
sta: createStackNavigator({
|
sta: createStackNavigator({
|
||||||
home: Home,
|
home: Home,
|
||||||
|
@ -94,10 +95,10 @@ const AppStack = createDrawerNavigator({
|
||||||
},
|
},
|
||||||
notificationview: Notifications,
|
notificationview: Notifications,
|
||||||
configuration: Configurations,
|
configuration: Configurations,
|
||||||
about: About
|
about: About,
|
||||||
|
|
||||||
})
|
}),
|
||||||
}, {contentComponent: OptionsMenu, headerMode: 'none', contentOptions: {activeTintColor: theme.accent}})
|
}, {contentComponent: OptionsMenu, headerMode: 'none', contentOptions: {activeTintColor: theme.accent}});
|
||||||
const AppAgentStack = createDrawerNavigator({
|
const AppAgentStack = createDrawerNavigator({
|
||||||
sta: createStackNavigator({
|
sta: createStackNavigator({
|
||||||
home: Home,
|
home: Home,
|
||||||
|
@ -105,16 +106,16 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
Historique:
|
Historique:
|
||||||
{
|
{
|
||||||
screen: createBottomTabNavigator({myDemand: MyHistory}, {
|
screen: createBottomTabNavigator({myDemand: MyHistory}, {
|
||||||
headerMode: "none",
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
headerTitle: I18n.t('CREDIT_MANAGE'),
|
headerTitle: I18n.t('CREDIT_MANAGE'),
|
||||||
tabBarOptions: {
|
tabBarOptions: {
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: "bold"
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
navigationOptions: ({navigation}) => ({
|
navigationOptions: ({navigation}) => ({
|
||||||
header: null,
|
header: null,
|
||||||
|
@ -129,7 +130,7 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
<Icon
|
<Icon
|
||||||
name={'credit-card'}
|
name={'credit-card'}
|
||||||
size={24}
|
size={24}
|
||||||
/>)
|
/>),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -139,23 +140,23 @@ const AppAgentStack = createDrawerNavigator({
|
||||||
updateinformation: UpdateInformations,
|
updateinformation: UpdateInformations,
|
||||||
notificationview: Notifications,
|
notificationview: Notifications,
|
||||||
configuration: Configurations,
|
configuration: Configurations,
|
||||||
about: About
|
about: About,
|
||||||
})
|
}),
|
||||||
}, {
|
}, {
|
||||||
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,
|
||||||
useraccount: UserAccount,
|
useraccount: UserAccount,
|
||||||
Historique: {
|
Historique: {
|
||||||
screen: createBottomTabNavigator({
|
screen: createBottomTabNavigator({
|
||||||
myDemand: MyHistory, OthersDemand: MyHistory
|
myDemand: MyHistory, OthersDemand: MyHistory,
|
||||||
}, {
|
}, {
|
||||||
headerMode: "none",
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
title: I18n.t('CREDIT_MANAGE'),
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
|
@ -163,7 +164,7 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
navigationOptions: ({navigation}) => ({
|
navigationOptions: ({navigation}) => ({
|
||||||
header: null,
|
header: null,
|
||||||
|
@ -178,7 +179,7 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
<Icon
|
<Icon
|
||||||
name={'credit-card'}
|
name={'credit-card'}
|
||||||
size={24}
|
size={24}
|
||||||
/>)
|
/>),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
creditrequest: HistoryRequester,
|
creditrequest: HistoryRequester,
|
||||||
|
@ -187,42 +188,42 @@ const AppAdministratorStack = createDrawerNavigator({
|
||||||
superviseurgroup: SuperViseurGroupeHome,
|
superviseurgroup: SuperViseurGroupeHome,
|
||||||
notificationview: Notifications,
|
notificationview: Notifications,
|
||||||
configuration: Configurations,
|
configuration: Configurations,
|
||||||
about: About
|
about: About,
|
||||||
|
|
||||||
})
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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,
|
||||||
useraccount: UserAccount,
|
useraccount: UserAccount,
|
||||||
Historique: {
|
Historique: {
|
||||||
screen: createBottomTabNavigator({OthersDemand: MyHistory}, {
|
screen: createBottomTabNavigator({OthersDemand: MyHistory}, {
|
||||||
headerMode: "none",
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
title: I18n.t('CREDIT_MANAGE'),
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
tabBarOptions: {
|
tabBarOptions: {
|
||||||
labelStyle: {
|
labelStyle: {
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: "bold"
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
navigationOptions: ({navigation}) => ({
|
navigationOptions: ({navigation}) => ({
|
||||||
title: I18n.t('CREDIT_MANAGE'),
|
title: I18n.t('CREDIT_MANAGE'),
|
||||||
headerMode: "none",
|
headerMode: 'none',
|
||||||
header: null,
|
header: null,
|
||||||
headerTitle: null,
|
headerTitle: null,
|
||||||
drawerIcon: ({tintColor}) => (
|
drawerIcon: ({tintColor}) => (
|
||||||
<Icon
|
<Icon
|
||||||
name={'credit-card'}
|
name={'credit-card'}
|
||||||
size={24}
|
size={24}
|
||||||
/>)
|
/>),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
creditrequest: HistoryRequester,
|
creditrequest: HistoryRequester,
|
||||||
|
@ -230,25 +231,25 @@ const AppSuperAdministrator = createDrawerNavigator({
|
||||||
superviseurgroup: SuperViseurGroupeHome,
|
superviseurgroup: SuperViseurGroupeHome,
|
||||||
notificationview: Notifications,
|
notificationview: Notifications,
|
||||||
configuration: Configurations,
|
configuration: Configurations,
|
||||||
about: About
|
about: About,
|
||||||
|
|
||||||
})
|
}),
|
||||||
}, {
|
}, {
|
||||||
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,
|
||||||
},
|
},
|
||||||
App: AppStack,
|
App: AppStack,
|
||||||
AgentApp: AppAgentStack,
|
AgentApp: AppAgentStack,
|
||||||
adminApp: AppAdministratorStack,
|
adminApp: AppAdministratorStack,
|
||||||
supAdminApp: AppSuperAdministrator,
|
supAdminApp: AppSuperAdministrator,
|
||||||
Auth: AuthStack
|
Auth: AuthStack,
|
||||||
}, {
|
}, {
|
||||||
initialRouteName: 'first'
|
initialRouteName: 'first',
|
||||||
});
|
});
|
||||||
const AppContainer = createAppContainer(AppNavigator);
|
const AppContainer = createAppContainer(AppNavigator);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue