notification working
This commit is contained in:
parent
5e0d806967
commit
04c20dd6f8
31
App.js
31
App.js
|
@ -134,9 +134,34 @@ const AppStack = createDrawerNavigator({
|
||||||
createGroupNanoCredit: CreateGroupNanoCredit,
|
createGroupNanoCredit: CreateGroupNanoCredit,
|
||||||
groupNanoCredit: {
|
groupNanoCredit: {
|
||||||
screen: createBottomTabNavigator({
|
screen: createBottomTabNavigator({
|
||||||
demandeValidationGroupe: DemandValidationGroup,
|
demandeValidationGroupe: {
|
||||||
myNanoCreditGroup: MyNanoCreditGroup,
|
screen: DemandValidationGroup,
|
||||||
OthersDemand: UserAccount
|
navigationOptions: {
|
||||||
|
tabBarLabel: I18n.t('DEMAND_VALIDATION_GROUP_RECEIVE'),
|
||||||
|
tabBarIcon: ({ focused, horizontal, tintColor }) => {
|
||||||
|
return (<IconWithBadge
|
||||||
|
badgeCount={0}
|
||||||
|
size={20}
|
||||||
|
name={"account-multiple-plus"}
|
||||||
|
color={focused ? tintColor : "grey"}
|
||||||
|
/>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
myNanoCreditGroup: {
|
||||||
|
screen: MyNanoCreditGroup,
|
||||||
|
navigationOptions: {
|
||||||
|
tabBarLabel: I18n.t('MY_GROUP'),
|
||||||
|
tabBarIcon: ({ focused, horizontal, tintColor }) => {
|
||||||
|
return (<IconWithBadge
|
||||||
|
badgeCount={0}
|
||||||
|
size={20}
|
||||||
|
name={"account-multiple"}
|
||||||
|
color={focused ? tintColor : "grey"}
|
||||||
|
/>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
headerMode: "none",
|
headerMode: "none",
|
||||||
header: null,
|
header: null,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -56,5 +56,6 @@
|
||||||
"createGroupNanoCredit": "createGroupNanoCredit",
|
"createGroupNanoCredit": "createGroupNanoCredit",
|
||||||
"groupNanoCredit": "groupNanoCredit",
|
"groupNanoCredit": "groupNanoCredit",
|
||||||
"demandGroupNanoCreditDetail": "demandeValidationGroupe",
|
"demandGroupNanoCreditDetail": "demandeValidationGroupe",
|
||||||
"adhererGroupNanoCredit": "adhererGroupNanoCredit"
|
"adhererGroupNanoCredit": "adhererGroupNanoCredit",
|
||||||
|
"myNanoCreditGroup": "myNanoCreditGroup"
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,8 @@
|
||||||
"ACTIVATED": "has been activated",
|
"ACTIVATED": "has been activated",
|
||||||
"CREDIT_MANAGE": "Credit Management",
|
"CREDIT_MANAGE": "Credit Management",
|
||||||
"GROUP_MANAGE": "Group Management",
|
"GROUP_MANAGE": "Group Management",
|
||||||
|
"MODIFY_GROUP": "Modify group",
|
||||||
|
"DELETE_GROUP": "Delete group",
|
||||||
"CREATOR": "Creator",
|
"CREATOR": "Creator",
|
||||||
"NOTIFICATIONS": "Notification",
|
"NOTIFICATIONS": "Notification",
|
||||||
"NO_NOTIFICATION": "You haven't any notification",
|
"NO_NOTIFICATION": "You haven't any notification",
|
||||||
|
@ -416,6 +418,8 @@
|
||||||
"DEMAND_TEXT_FIRST_PART_YOU": "You made a request for ",
|
"DEMAND_TEXT_FIRST_PART_YOU": "You made a request for ",
|
||||||
"REQUEST_SEND": "Request Sent",
|
"REQUEST_SEND": "Request Sent",
|
||||||
"DEMAND_RECEIVE": "Requests received",
|
"DEMAND_RECEIVE": "Requests received",
|
||||||
|
"DEMAND_VALIDATION_GROUP_RECEIVE": "Validation requests",
|
||||||
|
"DEMAND_DELETE_GROUP_RECEIVE": "Removal requests",
|
||||||
"TO_": "credit to",
|
"TO_": "credit to",
|
||||||
"DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!",
|
"DEMAND_SEND_SUCCESFUL": "Your request has been sent successfully!",
|
||||||
"SAVE_HISTORY": "Save history",
|
"SAVE_HISTORY": "Save history",
|
||||||
|
|
|
@ -176,6 +176,8 @@
|
||||||
"ACTIVATED": "a été activé",
|
"ACTIVATED": "a été activé",
|
||||||
"CREDIT_MANAGE": "Gestion de credit",
|
"CREDIT_MANAGE": "Gestion de credit",
|
||||||
"GROUP_MANAGE": "Gestion du groupe",
|
"GROUP_MANAGE": "Gestion du groupe",
|
||||||
|
"MODIFY_GROUP": "Modifier le groupe",
|
||||||
|
"DELETE_GROUP": "Supprimer le groupe",
|
||||||
"CREATOR": "Créateur",
|
"CREATOR": "Créateur",
|
||||||
"NOTIFICATIONS": "Notification",
|
"NOTIFICATIONS": "Notification",
|
||||||
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
|
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
|
||||||
|
@ -421,6 +423,8 @@
|
||||||
"DEMAND_TEXT_FIRST_PART_YOU": "Vous avez effectué une demande de ",
|
"DEMAND_TEXT_FIRST_PART_YOU": "Vous avez effectué une demande de ",
|
||||||
"DEMANDE_SEND": " Demande Envoyée",
|
"DEMANDE_SEND": " Demande Envoyée",
|
||||||
"DEMAND_RECEIVE": "Demandes reçues",
|
"DEMAND_RECEIVE": "Demandes reçues",
|
||||||
|
"DEMAND_VALIDATION_GROUP_RECEIVE": "Demandes de validation",
|
||||||
|
"DEMAND_DELETE_GROUP_RECEIVE": "Demandes de suppression",
|
||||||
"TO_": " crédit auprès de ",
|
"TO_": " crédit auprès de ",
|
||||||
"DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !",
|
"DEMAND_SEND_SUCCESFUL": "Votre demande a été envoyée avec succès !",
|
||||||
"SAVE_HISTORY": "Enregistrer l'historique",
|
"SAVE_HISTORY": "Enregistrer l'historique",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { CREATE_GROUP_PENDING, CREATE_GROUP_SUCCESS, CREATE_GROUP_ERROR, CREATE_GROUP_RESET, GET_DEMAND_GROUP_PENDING, GET_DEMAND_GROUP_SUCCESS, GET_DEMAND_GROUP_ERROR, GET_DEMAND_GROUP_RESET, GET_UNIQUE_DEMAND_GROUP_PENDING, GET_UNIQUE_DEMAND_GROUP_RESET, GET_UNIQUE_DEMAND_GROUP_ERROR, GET_UNIQUE_DEMAND_GROUP_SUCCESS, TREAT_DEMAND_GROUP_PENDING, TREAT_DEMAND_GROUP_SUCCESS, TREAT_DEMAND_GROUP_ERROR, TREAT_DEMAND_GROUP_RESET, JOIN_GROUP_PENDING, JOIN_GROUP_SUCCESS, JOIN_GROUP_RESET, JOIN_GROUP_ERROR, GET_USER_GROUP_DETAIL_PENDING, GET_USER_GROUP_DETAIL_SUCCESS, GET_USER_GROUP_DETAIL_RESET } from "../types/NanoCreditType";
|
import { CREATE_GROUP_PENDING, CREATE_GROUP_SUCCESS, CREATE_GROUP_ERROR, CREATE_GROUP_RESET, GET_DEMAND_GROUP_PENDING, GET_DEMAND_GROUP_SUCCESS, GET_DEMAND_GROUP_ERROR, GET_DEMAND_GROUP_RESET, GET_UNIQUE_DEMAND_GROUP_PENDING, GET_UNIQUE_DEMAND_GROUP_RESET, GET_UNIQUE_DEMAND_GROUP_ERROR, GET_UNIQUE_DEMAND_GROUP_SUCCESS, TREAT_DEMAND_GROUP_PENDING, TREAT_DEMAND_GROUP_SUCCESS, TREAT_DEMAND_GROUP_ERROR, TREAT_DEMAND_GROUP_RESET, JOIN_GROUP_PENDING, JOIN_GROUP_SUCCESS, JOIN_GROUP_RESET, JOIN_GROUP_ERROR, GET_USER_GROUP_DETAIL_PENDING, GET_USER_GROUP_DETAIL_SUCCESS, GET_USER_GROUP_DETAIL_RESET, GET_USER_GROUP_DETAIL_ERROR, GET_NOTIFICATIONS_ERROR, GET_NOTIFICATIONS_RESET, GET_NOTIFICATIONS_PENDING } from "../types/NanoCreditType";
|
||||||
|
|
||||||
export const fetchCreateGroupPending = () => ({
|
export const fetchCreateGroupPending = () => ({
|
||||||
type: CREATE_GROUP_PENDING
|
type: CREATE_GROUP_PENDING
|
||||||
|
@ -109,3 +109,22 @@ export const fetchGetUserGroupDetailError = (error) => ({
|
||||||
export const fetchGetUserGroupDetailReset = () => ({
|
export const fetchGetUserGroupDetailReset = () => ({
|
||||||
type: GET_USER_GROUP_DETAIL_RESET
|
type: GET_USER_GROUP_DETAIL_RESET
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export const fetchGetNotificationPending = () => ({
|
||||||
|
type: GET_NOTIFICATIONS_PENDING
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetNotificationSuccess = (res) => ({
|
||||||
|
type: GET_NOTIFICATIONS_SUCCESS,
|
||||||
|
result: res,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetNotificationError = (error) => ({
|
||||||
|
type: GET_NOTIFICATIONS_ERROR,
|
||||||
|
result: error
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchGetNotificationReset = () => ({
|
||||||
|
type: GET_NOTIFICATIONS_RESET
|
||||||
|
});
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { GET_NOTIFICATIONS_SUCCESS, GET_NOTIFICATIONS_ERROR, GET_NOTIFICATIONS_RESET, GET_NOTIFICATIONS_PENDING } from "../types/NanoCreditType";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case GET_NOTIFICATIONS_PENDING: return {
|
||||||
|
...state,
|
||||||
|
loading: true
|
||||||
|
}
|
||||||
|
case GET_NOTIFICATIONS_SUCCESS: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: action.result.data,
|
||||||
|
error: null
|
||||||
|
}
|
||||||
|
case GET_NOTIFICATIONS_ERROR: return {
|
||||||
|
...state,
|
||||||
|
loading: false,
|
||||||
|
result: null,
|
||||||
|
error: action.result
|
||||||
|
}
|
||||||
|
case GET_NOTIFICATIONS_RESET: return initialState;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -31,6 +31,7 @@ import GetUniqueDemandsGroupReducer from "./GetUniqueDemandsGroupReducer";
|
||||||
import TreatDemandGroupReducer from "./TreatDemandGroupReducer";
|
import TreatDemandGroupReducer from "./TreatDemandGroupReducer";
|
||||||
import JoinGroupReducer from "./JoinGroupReducer";
|
import JoinGroupReducer from "./JoinGroupReducer";
|
||||||
import GetUserGroupDetailReducer from "./GetUserGroupDetailReducer";
|
import GetUserGroupDetailReducer from "./GetUserGroupDetailReducer";
|
||||||
|
import GetNotificationReducer from "./GetNotificationReducer";
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
key: 'root',
|
key: 'root',
|
||||||
|
@ -71,7 +72,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
|
||||||
getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer,
|
getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer,
|
||||||
treatDemandGroupReducer: TreatDemandGroupReducer,
|
treatDemandGroupReducer: TreatDemandGroupReducer,
|
||||||
joinGroupReducer: JoinGroupReducer,
|
joinGroupReducer: JoinGroupReducer,
|
||||||
getUserGroupDetailReducer: GetUserGroupDetailReducer
|
getUserGroupDetailReducer: GetUserGroupDetailReducer,
|
||||||
|
getNotificationReducer: GetNotificationReducer
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,3 +27,8 @@ export const GET_USER_GROUP_DETAIL_PENDING = 'GET_USER_GROUP_DETAIL_PENDING';
|
||||||
export const GET_USER_GROUP_DETAIL_SUCCESS = 'GET_USER_GROUP_DETAIL_SUCCESS';
|
export const GET_USER_GROUP_DETAIL_SUCCESS = 'GET_USER_GROUP_DETAIL_SUCCESS';
|
||||||
export const GET_USER_GROUP_DETAIL_ERROR = 'GET_USER_GROUP_DETAIL_ERROR';
|
export const GET_USER_GROUP_DETAIL_ERROR = 'GET_USER_GROUP_DETAIL_ERROR';
|
||||||
export const GET_USER_GROUP_DETAIL_RESET = 'GET_USER_GROUP_DETAIL_RESET';
|
export const GET_USER_GROUP_DETAIL_RESET = 'GET_USER_GROUP_DETAIL_RESET';
|
||||||
|
|
||||||
|
export const GET_NOTIFICATIONS_PENDING = 'GET_NOTIFICATIONS_PENDING';
|
||||||
|
export const GET_NOTIFICATIONS_SUCCESS = 'GET_NOTIFICATIONS_SUCCESS';
|
||||||
|
export const GET_NOTIFICATIONS_ERROR = 'GET_NOTIFICATIONS_ERROR';
|
||||||
|
export const GET_NOTIFICATIONS_RESET = 'GET_NOTIFICATIONS_RESET';
|
||||||
|
|
|
@ -24,6 +24,30 @@ let route = require('../../route.json');
|
||||||
|
|
||||||
class CreateGroupNanoCredit extends Component {
|
class CreateGroupNanoCredit extends Component {
|
||||||
|
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
montant: null,
|
||||||
|
password: null,
|
||||||
|
nomGroupe: null,
|
||||||
|
limitCredit: null,
|
||||||
|
codeSponsor1: null,
|
||||||
|
codeSponsor2: null,
|
||||||
|
codeSponsor3: null,
|
||||||
|
codeGroup: null,
|
||||||
|
loading: false,
|
||||||
|
user: null,
|
||||||
|
triggerSubmitClick: false,
|
||||||
|
isSubmitClick: false,
|
||||||
|
isDataSubmit: false,
|
||||||
|
isModalConfirmVisible: false,
|
||||||
|
isGroupToModify: false,
|
||||||
|
wallet: store.getState().walletDetailReducer.result.response
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarBackgroundColor: Color.primaryColor,
|
navBarBackgroundColor: Color.primaryColor,
|
||||||
statusBarColor: Color.primaryDarkColor,
|
statusBarColor: Color.primaryDarkColor,
|
||||||
|
@ -35,7 +59,7 @@ class CreateGroupNanoCredit extends Component {
|
||||||
static navigationOptions = () => {
|
static navigationOptions = () => {
|
||||||
return {
|
return {
|
||||||
drawerLabel: () => null,
|
drawerLabel: () => null,
|
||||||
headerTitle: I18n.t('CREATE_GROUP'),
|
headerTitle: I18n.t('MANAGE_GROUP'),
|
||||||
headerTintColor: 'white',
|
headerTintColor: 'white',
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
backgroundColor: Color.primaryColor,
|
backgroundColor: Color.primaryColor,
|
||||||
|
@ -49,32 +73,23 @@ class CreateGroupNanoCredit extends Component {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
montant: null,
|
|
||||||
password: null,
|
|
||||||
nomGroupe: null,
|
|
||||||
limitCredit: null,
|
|
||||||
codeSponsor1: null,
|
|
||||||
codeSponsor2: null,
|
|
||||||
codeSponsor3: null,
|
|
||||||
loading: false,
|
|
||||||
user: null,
|
|
||||||
triggerSubmitClick: false,
|
|
||||||
isSubmitClick: false,
|
|
||||||
isDataSubmit: false,
|
|
||||||
isModalConfirmVisible: false,
|
|
||||||
wallet: store.getState().walletDetailReducer.result.response
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
readUser().then((user) => {
|
readUser().then((user) => {
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user !== undefined) {
|
if (user !== undefined) {
|
||||||
|
const groupToModify = this.props.navigation.getParam('group', null);
|
||||||
|
if (!isNil(groupToModify)) {
|
||||||
|
this.setState({
|
||||||
|
limitCredit: groupToModify.limite_credit,
|
||||||
|
nomGroupe: groupToModify.nom,
|
||||||
|
codeSponsor1: groupToModify.codeSponsor1,
|
||||||
|
codeSponsor2: groupToModify.codeSponsor2,
|
||||||
|
codeSponsor3: groupToModify.codeSponsor3,
|
||||||
|
codeGroup: groupToModify.code_groupe,
|
||||||
|
isGroupToModify: true
|
||||||
|
});
|
||||||
|
}
|
||||||
this.setState({ user });
|
this.setState({ user });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,6 +197,21 @@ class CreateGroupNanoCredit extends Component {
|
||||||
this.passwordAnim.shake(800);
|
this.passwordAnim.shake(800);
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
if (this.state.isGroupToModify) {
|
||||||
|
|
||||||
|
this.props.createGroupAction({
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
nom: this.state.nomGroupe,
|
||||||
|
code_group: this.state.codeGroup,
|
||||||
|
code_sponsor1: this.state.codeSponsor1,
|
||||||
|
code_sponsor2: this.state.codeSponsor2,
|
||||||
|
code_sponsor3: this.state.codeSponsor3,
|
||||||
|
password: this.state.password,
|
||||||
|
limite_credit: this.state.limitCredit,
|
||||||
|
code_groupe: this.state.codeGroup
|
||||||
|
}, 1);
|
||||||
|
} else {
|
||||||
|
|
||||||
this.props.createGroupAction({
|
this.props.createGroupAction({
|
||||||
id_user: this.state.user.id,
|
id_user: this.state.user.id,
|
||||||
nom: this.state.nomGroupe,
|
nom: this.state.nomGroupe,
|
||||||
|
@ -190,8 +220,8 @@ class CreateGroupNanoCredit extends Component {
|
||||||
code_sponsor3: this.state.codeSponsor3,
|
code_sponsor3: this.state.codeSponsor3,
|
||||||
password: this.state.password,
|
password: this.state.password,
|
||||||
limite_credit: this.state.limitCredit
|
limite_credit: this.state.limitCredit
|
||||||
});
|
}, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
isDataSubmit: true
|
isDataSubmit: true
|
||||||
|
@ -330,7 +360,7 @@ class CreateGroupNanoCredit extends Component {
|
||||||
<Button style={styles.btnvalide}
|
<Button style={styles.btnvalide}
|
||||||
textStyle={styles.textbtnvalide}
|
textStyle={styles.textbtnvalide}
|
||||||
onPress={() => { this.onSubmitSendWalletToCard(); }}>
|
onPress={() => { this.onSubmitSendWalletToCard(); }}>
|
||||||
{I18n.t('SUBMIT_LABEL')}</Button>
|
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
@ -59,44 +59,6 @@ import { Color } from '../../config/Color';
|
||||||
|
|
||||||
class DemandValidationGroup extends React.Component {
|
class DemandValidationGroup extends React.Component {
|
||||||
|
|
||||||
static navigatorStyle = {
|
|
||||||
navBarBackgroundColor: primary,
|
|
||||||
statusBarColor: primaryDark,
|
|
||||||
navBarTextColor: '#FFFFFF',
|
|
||||||
navBarButtonColor: '#FFFFFF',
|
|
||||||
contextualMenuStatusBarColor: theme.accent,
|
|
||||||
contextualMenuBackgroundColor: theme.accentLight,
|
|
||||||
contextualMenuButtonsColor: '#ffffff'
|
|
||||||
|
|
||||||
};
|
|
||||||
static navigationOptions = ({ navigation }) => {
|
|
||||||
const { routeName } = navigation.state
|
|
||||||
return {
|
|
||||||
|
|
||||||
tabBarLabel: routeName === "demandeValidationGroupe" ? I18n.t('DEMAND_VALIDATION_GROUP_RECEIVE')
|
|
||||||
: routeName === "myNanoCreditGroup" ? I18n.t('My_GROUP')
|
|
||||||
: I18n.t('DEMAND_DELETE_GROUP_RECEIVE'),
|
|
||||||
tabBarIcon: ({ focused, horizontal, tintColor }) => {
|
|
||||||
return (<IconWithBadge
|
|
||||||
badgeCount={navigation.getParam("count", 0)}
|
|
||||||
size={20}
|
|
||||||
name={routeName === "demandeValidationGroupe" ? "account-multiple-plus"
|
|
||||||
: routeName === "myNanoCreditGroup" ? "account-multiple"
|
|
||||||
: "account-multiple-minus"}
|
|
||||||
color={focused ? tintColor : "grey"}
|
|
||||||
/>)
|
|
||||||
},
|
|
||||||
|
|
||||||
drawerLabel: I18n.t('MANAGE_GROUP'),
|
|
||||||
drawerIcon: ({ tintColor }) => (
|
|
||||||
<Icon
|
|
||||||
name={'credit-card'}
|
|
||||||
size={24}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props, true);
|
super(props, true);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -132,10 +94,24 @@ class DemandValidationGroup extends React.Component {
|
||||||
//IlinkEmitter.on('treatNanoGroupDemand', this.refreshData);
|
//IlinkEmitter.on('treatNanoGroupDemand', this.refreshData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static navigatorStyle = {
|
||||||
|
navBarBackgroundColor: primary,
|
||||||
|
statusBarColor: primaryDark,
|
||||||
|
navBarTextColor: '#FFFFFF',
|
||||||
|
navBarButtonColor: '#FFFFFF',
|
||||||
|
contextualMenuStatusBarColor: theme.accent,
|
||||||
|
contextualMenuBackgroundColor: theme.accentLight,
|
||||||
|
contextualMenuButtonsColor: '#ffffff'
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { routeName } = this.navigation.state
|
const { routeName } = this.navigation.state
|
||||||
this.setState({ position: routeName === "demandeValidationGroupe" ? 0 : 1,
|
this.setState({
|
||||||
isDataSubmit: true });
|
position: routeName === "demandeValidationGroupe" ? 0
|
||||||
|
: routeName === "myNanoCreditGroup" ? 1
|
||||||
|
: 2
|
||||||
|
});
|
||||||
this.animateSlidingUp(false)
|
this.animateSlidingUp(false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -328,6 +304,7 @@ class DemandValidationGroup extends React.Component {
|
||||||
<Appbar.Action icon="refresh" onPress={() => { this.refreshData() }} />
|
<Appbar.Action icon="refresh" onPress={() => { this.refreshData() }} />
|
||||||
{/* <Appbar.Action icon="more-vert" onPress={() => { this._openMenu(); this.renderSliding(); }} /> */}
|
{/* <Appbar.Action icon="more-vert" onPress={() => { this._openMenu(); this.renderSliding(); }} /> */}
|
||||||
</Appbar.Header>
|
</Appbar.Header>
|
||||||
|
|
||||||
{this.state.position === 0 ?
|
{this.state.position === 0 ?
|
||||||
this.props.loadingGetDemandsGroup ?
|
this.props.loadingGetDemandsGroup ?
|
||||||
this.renderLoader() :
|
this.renderLoader() :
|
||||||
|
|
|
@ -24,7 +24,7 @@ import Dialog from "react-native-dialog";
|
||||||
import { FontWeight } from '../../config/typography'
|
import { FontWeight } from '../../config/typography'
|
||||||
import DeviceInfo from 'react-native-device-info'
|
import DeviceInfo from 'react-native-device-info'
|
||||||
import { getNanoCreditUniqueDemandsAction, getNanoCreditUniqueDemandsReset } from '../../webservice/user/NanoCreditApi'
|
import { getNanoCreditUniqueDemandsAction, getNanoCreditUniqueDemandsReset } from '../../webservice/user/NanoCreditApi'
|
||||||
import { treatDemandGroupAction, treatDemandGroupReset } from '../../webservice/NanoCreditApi'
|
import { treatDemandGroupAction, treatDemandGroupReset, cancelDemandGroupAction } from '../../webservice/NanoCreditApi'
|
||||||
import { IlinkEmitter } from '../../utils/events';
|
import { IlinkEmitter } from '../../utils/events';
|
||||||
|
|
||||||
class DemandGroupNanoCreditDetail extends Component {
|
class DemandGroupNanoCreditDetail extends Component {
|
||||||
|
@ -123,17 +123,15 @@ class DemandGroupNanoCreditDetail extends Component {
|
||||||
this.props.treatDemandGroupReset();
|
this.props.treatDemandGroupReset();
|
||||||
this.props.treatDemandGroupAction({
|
this.props.treatDemandGroupAction({
|
||||||
id_demande: this.props.resultGetUniqueDemand.response.id,
|
id_demande: this.props.resultGetUniqueDemand.response.id,
|
||||||
id_user: this.state.user.id,
|
id_user: this.state.user.id
|
||||||
type: "creation"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancelDemand = () => {
|
onCancelDemand = () => {
|
||||||
this.props.treatDemandGroupReset();
|
this.props.treatDemandGroupReset();
|
||||||
this.props.treatDemandGroupAction({
|
this.props.cancelDemandGroupAction({
|
||||||
id_demande: this.props.resultGetUniqueDemand.response.id,
|
id_demande: this.props.resultGetUniqueDemand.response.id,
|
||||||
id_user: this.state.user.id,
|
id_user: this.state.user.id
|
||||||
type: "suppression"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,6 +504,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
|
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
|
||||||
|
|
||||||
treatDemandGroupAction: treatDemandGroupAction,
|
treatDemandGroupAction: treatDemandGroupAction,
|
||||||
|
cancelDemandGroupAction: cancelDemandGroupAction,
|
||||||
treatDemandGroupReset: treatDemandGroupReset,
|
treatDemandGroupReset: treatDemandGroupReset,
|
||||||
|
|
||||||
treatCreditDemand: treatCreditDemand,
|
treatCreditDemand: treatCreditDemand,
|
||||||
|
|
|
@ -1,443 +1,549 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react'
|
||||||
import { StyleSheet, View, Text, Image, StatusBar, TouchableOpacity, ScrollView, ProgressBarAndroid, Alert } from 'react-native';
|
import { StyleSheet, View, Text, Alert, Platform, ScrollView, ProgressBarAndroid, StatusBar } from 'react-native'
|
||||||
let theme = require('./../../utils/theme.json');
|
import CardView from 'react-native-cardview'
|
||||||
|
import Button from 'apsl-react-native-button'
|
||||||
|
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { readUser, deleteUser } from './../../webservice/AuthApi';
|
import { updateCreditDemand } from "../../webservice/HistoryRequestApi";
|
||||||
import { getAgentNetworksList } from './../../webservice/NetworkApi'
|
import { readUser } from "../../webservice/AuthApi";
|
||||||
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
|
let typesta = 0
|
||||||
import MapView, { Marker } from 'react-native-maps';
|
let moment = require('moment-timezone')
|
||||||
import * as Utils from '../../utils/DeviceUtils';
|
var colorback = 'white'
|
||||||
import Button from 'apsl-react-native-button';
|
import I18n from "react-native-i18n";
|
||||||
import { Typography, FontWeight } from '../../config/typography';
|
import { treatCreditDemand, creditDemandResetReducer } from '../../webservice/CreditTreatDemandApi';
|
||||||
import CardView from "react-native-cardview";
|
import { treatCancelDemand, creditCancelResetReducer } from '../../webservice/CreditCancelDemandeApi';
|
||||||
import I18n from 'react-native-i18n'
|
import { getAgentNetworksList } from "../../webservice/NetworkApi";
|
||||||
import { Header } from 'react-native-elements'
|
import { Header } from "react-native-elements";
|
||||||
import { IlinkEmitter } from "../../utils/events";
|
let theme = require('./../../utils/theme.json');
|
||||||
import { Card, CardTitle, CardContent, CardAction, CardButton, CardImage } from 'react-native-material-cards'
|
import { connect } from 'react-redux';
|
||||||
import { Color } from '../../config/Color';
|
import { bindActionCreators } from 'redux';
|
||||||
let route = require('../../route.json');
|
import Toast from 'react-native-root-toast';
|
||||||
|
import { Color } from '../../config/Color'
|
||||||
|
const route = require("./../../route.json");
|
||||||
|
import Dialog from "react-native-dialog";
|
||||||
|
import { FontWeight } from '../../config/typography'
|
||||||
|
import DeviceInfo from 'react-native-device-info'
|
||||||
|
import { getNanoCreditUniqueDemandsAction, getNanoCreditUniqueDemandsReset, getUserGroupDetailAction, getUserGroupDetailReset } from '../../webservice/user/NanoCreditApi'
|
||||||
|
import { treatDemandGroupAction, treatDemandGroupReset, createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi'
|
||||||
|
import { IlinkEmitter } from '../../utils/events';
|
||||||
|
|
||||||
|
import { Appbar, Paragraph, Menu, Divider, Provider } from 'react-native-paper';
|
||||||
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');
|
||||||
var { Crashlytics } = Fabric;*/
|
var { Crashlytics } = Fabric;*/
|
||||||
export default class MyNanoCreditGroup extends Component {
|
class MyNanoCreditGroup extends Component {
|
||||||
|
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarHidden: false,
|
navBarBackgroundColor: theme.accentLight,
|
||||||
navBarBackgroundColor: theme.primaryDark,
|
statusBarColor: theme.accent,
|
||||||
navBarTextColor: 'white',
|
navBarTextColor: '#FFFFFF',
|
||||||
navBarButtonColor: 'white',
|
navBarButtonColor: '#FFFFFF',
|
||||||
drawUnderStatusBar: false,
|
|
||||||
statusBarColor: theme.primaryDarkAdvanced,
|
|
||||||
statusBarTextColorScheme: 'light',
|
|
||||||
};
|
};
|
||||||
static navigationOptions = ({ navigation }) => {
|
static navigationOptions = ({ navigation }) => {
|
||||||
return {
|
return {
|
||||||
headerTitle: I18n.t('USER_ACCOUNT'),
|
drawerLabel: () => null,
|
||||||
headerStyle: {
|
title: I18n.t('GROUP') + ' N°' + navigation.getParam("id", "-")
|
||||||
backgroundColor: theme.primary,
|
|
||||||
paddingTop: 10
|
|
||||||
},
|
|
||||||
headerTitleStyle: {
|
|
||||||
color: "white"
|
|
||||||
},
|
|
||||||
drawerIcon: ({ tintColor }) => (
|
|
||||||
<Icon
|
|
||||||
name={'person'}
|
|
||||||
size={24}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static options(passProps) {
|
|
||||||
return {
|
|
||||||
topBar: {
|
|
||||||
drawBehind: false,
|
|
||||||
visible: true,
|
|
||||||
animate: true,
|
|
||||||
buttonColor: 'white',
|
|
||||||
background: {
|
|
||||||
color: theme.primaryDark,
|
|
||||||
},
|
|
||||||
rightButtons: []
|
|
||||||
},
|
|
||||||
backButton: {
|
|
||||||
visible: true,
|
|
||||||
color: "white"
|
|
||||||
},
|
|
||||||
buttonColor: "white",
|
|
||||||
background: {
|
|
||||||
color: theme.primaryDark
|
|
||||||
},
|
|
||||||
statusBar: {
|
|
||||||
drawBehind: false,
|
|
||||||
visible: true,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
constructor(props) {
|
|
||||||
super(props)
|
|
||||||
this.state = this.initState();
|
|
||||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
|
||||||
readUser().then((user) => {
|
|
||||||
if (user !== null) {
|
|
||||||
this.setState({ user: user })
|
|
||||||
|
|
||||||
this.updateContent(user)
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
/* this.item = this.props.navigation.getParam("item", null);
|
||||||
|
let sta = ''
|
||||||
|
if (this.item.status === '1') {
|
||||||
|
typesta = 1
|
||||||
|
colorback = '#AEAEAE'
|
||||||
|
sta = I18n.t('TREAT_DEMAND')
|
||||||
|
} else if (this.item.status === '0') {
|
||||||
|
colorback = 'green'
|
||||||
|
typesta = 2
|
||||||
|
sta = I18n.t('ACCEPTER_DEMANDE')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
colorback = '#AEAEAE'
|
||||||
|
typesta = 2
|
||||||
|
sta = I18n.t('REFUSED')
|
||||||
|
} */
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
displayAmountModifyDialog: false,
|
||||||
|
/* statut: sta, */
|
||||||
|
user: null,
|
||||||
|
networks: [],
|
||||||
|
loadingTreat: false,
|
||||||
|
loadingCancel: false,
|
||||||
|
triggerTreatmentClick: false,
|
||||||
|
triggerCancelClick: false,
|
||||||
|
color: colorback,
|
||||||
|
montant: null,
|
||||||
|
isBtnModifyAmountEnabled: false,
|
||||||
|
id: this.props.navigation.getParam("id", null)
|
||||||
|
}
|
||||||
|
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
|
||||||
|
moment.locale(this.currentLocale);
|
||||||
|
|
||||||
|
this.props.getUserGroupDetailAction();
|
||||||
|
this.props.createGroupReset();
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.props.getUserGroupDetailAction(user.user_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
updateLangue() {
|
|
||||||
|
|
||||||
this.props.navigation.setParams({ name: I18n.t('USER_ACCOUNT') })
|
|
||||||
this.forceUpdate()
|
|
||||||
}
|
|
||||||
updateContent(user) {
|
|
||||||
getAgentNetworksList(user.agentId).then((networks) => {
|
|
||||||
if (networks['success'] !== undefined) {
|
|
||||||
this.setState({ mynetworks: networks.networks })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
this.setState({ user });
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.setState({ user: user });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initState() {
|
displayToast = (message) => {
|
||||||
return {
|
Toast.show(message, {
|
||||||
user: {},
|
duration: Toast.durations.SHORT,
|
||||||
mynetworks: []
|
position: Toast.positions.BOTTOM,
|
||||||
|
backgroundColor: Color.primaryColor,
|
||||||
|
shadow: true,
|
||||||
|
animation: true,
|
||||||
|
hideOnPress: true,
|
||||||
|
delay: 0,
|
||||||
|
onShow: () => {
|
||||||
|
// calls on toast\`s appear animation start
|
||||||
|
},
|
||||||
|
onShown: () => {
|
||||||
|
// calls on toast\`s appear animation end.
|
||||||
|
},
|
||||||
|
onHide: () => {
|
||||||
|
// calls on toast\`s hide animation start.
|
||||||
|
},
|
||||||
|
onHidden: () => {
|
||||||
|
// calls on toast\`s hide animation end.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onCancelDemand = () => {
|
||||||
|
this.props.createGroupReset();
|
||||||
|
this.props.createGroupAction({
|
||||||
|
id_demande: this.props.resultGetUniqueDemand.response.id,
|
||||||
|
id_user: this.state.user.id,
|
||||||
|
code_groupe: this.props.resultGetUniqueDemand.response.code_groupe
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
renderAlertErrorDeleteDemand = () => {
|
||||||
|
const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props;
|
||||||
|
|
||||||
|
if (errorTreatDemand !== null) {
|
||||||
|
if (typeof errorTreatDemand.data !== 'undefined') {
|
||||||
|
Alert.alert(
|
||||||
|
I18n.t("ERROR_TREATMENT_DEMAND"),
|
||||||
|
errorTreatDemand.data.error,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
text: I18n.t("OK"), onPress: () => {
|
||||||
|
this.props.createGroupReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{ cancelable: false }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultTreatDemand !== null) {
|
||||||
|
console.log("resultTreatDemand", resultTreatDemand);
|
||||||
|
if (resultTreatDemand.status === 200) {
|
||||||
|
this.displayToast(resultTreatDemand.response);
|
||||||
|
this.props.navigation.goBack();
|
||||||
|
//IlinkEmitter.emit('treatNanoGroupDemand');
|
||||||
|
this.props.createGroupReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLabelState = (state) => {
|
||||||
|
if (state === 0)
|
||||||
|
return I18n.t('NO_TREAT')
|
||||||
|
else if (state === 1)
|
||||||
|
return I18n.t('TREAT')
|
||||||
|
else
|
||||||
|
return I18n.t('REFUSED')
|
||||||
|
}
|
||||||
|
|
||||||
|
renderBtn() {
|
||||||
|
const { resultGetUniqueDemand } = this.props
|
||||||
|
return (
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
paddingTop: 10
|
||||||
|
}}>
|
||||||
|
|
||||||
|
<View style={{
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center'
|
||||||
|
}}>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
borderColor: 'transparent',
|
||||||
|
borderRadius: 6,
|
||||||
|
marginLeft: 5,
|
||||||
|
marginRight: 5,
|
||||||
|
backgroundColor: 'green'
|
||||||
|
}}
|
||||||
|
onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
triggerTreatmentClick: true
|
||||||
|
});
|
||||||
|
this.props.navigation.push(route.createGroupNanoCredit, { group: resultGetUniqueDemand.response })
|
||||||
|
}}
|
||||||
|
textStyle={styles.textbtnstyle}
|
||||||
|
>
|
||||||
|
{I18n.t('MODIFY_GROUP')}
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={{
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center'
|
||||||
|
}}>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
borderColor: 'transparent',
|
||||||
|
borderRadius: 6,
|
||||||
|
marginLeft: 5,
|
||||||
|
marginRight: 5,
|
||||||
|
backgroundColor: Color.redColor
|
||||||
|
}}
|
||||||
|
isLoading={this.props.loadingTreatDemand}
|
||||||
|
onPress={() => {
|
||||||
|
this.setState({
|
||||||
|
triggerCancelClick: true
|
||||||
|
});
|
||||||
|
this.onCancelDemand();
|
||||||
|
}}
|
||||||
|
textStyle={styles.textbtnstyle}
|
||||||
|
>
|
||||||
|
{I18n.t('DELETE_GROUP')}
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
||||||
|
{Platform.OS === 'android'
|
||||||
|
?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
<>
|
||||||
|
<ActivityIndicator size="large" color={'#ccc'} />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderDetail = () => {
|
||||||
|
|
||||||
|
const { resultGetUniqueDemand } = this.props;
|
||||||
|
let ago = moment.tz(resultGetUniqueDemand.response.date_creation, 'Etc/GMT+0').format();
|
||||||
|
ago = moment(ago)
|
||||||
|
return (<View style={styles.container}>
|
||||||
|
<CardView
|
||||||
|
style={styles.cardcontainer1}
|
||||||
|
>
|
||||||
|
<Text style={{
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: 'black',
|
||||||
|
marginLeft: responsiveWidth(5)
|
||||||
|
}}>
|
||||||
|
{resultGetUniqueDemand.response.nom}
|
||||||
|
</Text>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='account'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`${I18n.t('CREATOR')}: ${resultGetUniqueDemand.response.createur}`}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='map-marker'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`${I18n.t('COUNTRY')}: ${resultGetUniqueDemand.response.country}`}</Text>
|
||||||
|
</View>
|
||||||
|
</CardView>
|
||||||
|
|
||||||
|
<CardView
|
||||||
|
style={styles.cardcontainer}
|
||||||
|
>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='account-multiple'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`SPONSOR 1: ${resultGetUniqueDemand.response.sponsor1}`}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='account-multiple'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`SPONSOR 2: ${resultGetUniqueDemand.response.sponsor2}`}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='account-multiple'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`SPONSOR 3: ${resultGetUniqueDemand.response.sponsor3}`}</Text>
|
||||||
|
</View>
|
||||||
|
</CardView>
|
||||||
|
|
||||||
|
<CardView style={styles.cardcontainer}>
|
||||||
|
{/* <Text style={{
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: 'black',
|
||||||
|
marginLeft: responsiveWidth(5)
|
||||||
|
}}>{I18n.t('DEMAND_INFO')}</Text>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='md-git-branch'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{this.item.code_parrain}</Text>
|
||||||
|
</View> */}
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='code-tags'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{resultGetUniqueDemand.response.code_groupe}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='cash'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`${I18n.t('LIMITE_GROUP')}: ${resultGetUniqueDemand.response.limite_credit} ${resultGetUniqueDemand.response.currency_code}`}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='calendar'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
style={{
|
||||||
|
marginLeft: 20
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={styles.simpleuser}>{`${I18n.t('CREATION_DATE')}: ${ago.format(" Do MMMM YYYY à HH:mm")}`}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignSelf: 'flex-end',
|
||||||
|
marginRight: 20,
|
||||||
|
justifyContent: 'flex-start'
|
||||||
|
}}>
|
||||||
|
<Icon name='update'
|
||||||
|
size={28}
|
||||||
|
color={theme.accent}
|
||||||
|
/>
|
||||||
|
<Text style={{
|
||||||
|
marginLeft: responsiveWidth(2),
|
||||||
|
fontSize: 16,
|
||||||
|
color: theme.accent
|
||||||
|
|
||||||
|
}}>{ago.fromNow()}</Text>
|
||||||
|
</View>
|
||||||
|
</CardView>
|
||||||
|
|
||||||
|
{this.renderBtn()}
|
||||||
|
</View>);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
console.log('MY PROPS', this.props);
|
||||||
let cat = "";
|
|
||||||
|
|
||||||
const { user } = this.state
|
|
||||||
|
|
||||||
if (user.category !== undefined || user.category !== null)
|
|
||||||
cat = user.category === 'super' ? I18n.t("ADMIN") : user.category === 'hyper' ?
|
|
||||||
I18n.t("SUPER_ADMIN") : user.category === 'geolocated' ?
|
|
||||||
I18n.t("GEOLOCATED") : I18n.t("SIMPLE_USER")
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<Provider>
|
||||||
|
<View style={{ flex: 1 }}
|
||||||
|
>
|
||||||
<StatusBar
|
<StatusBar
|
||||||
backgroundColor={theme.primaryDark}
|
backgroundColor={theme.primaryDark}
|
||||||
barStyle="light-content"
|
barStyle="light-content"
|
||||||
translucent={false}
|
translucent={false}
|
||||||
/>
|
/>
|
||||||
<ScrollView style={{
|
|
||||||
flex: 1,
|
|
||||||
marginTop: -5
|
|
||||||
}}>
|
|
||||||
<View style={styles.userInformation}>
|
|
||||||
<ScrollView>
|
|
||||||
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
||||||
<Image source={require('./../../datas/img/users/man.png')} style={{ width: 92, height: 92 }} />
|
|
||||||
</View>
|
|
||||||
<View style={{ flex: 1, flexDirection: 'row' }}>
|
|
||||||
{user.category === undefined || user.category === null ?
|
|
||||||
this.getHeaderLeftProfil(user) : this.getHeaderLeftAgentProfil(user)
|
|
||||||
}
|
|
||||||
<View style={{ flex: user.category === undefined || user.category === null ? 2 : 2 }}>
|
|
||||||
<Text style={styles.textInformation} >{this.state.user.firstname}</Text>
|
|
||||||
<Text style={styles.textInformation} >{this.state.user.lastname}</Text>
|
|
||||||
{<Text style={{ color: 'white', fontSize: 17, fontWeight: 'bold', textAlign: 'center' }}>{cat}</Text>
|
|
||||||
}
|
|
||||||
|
|
||||||
</View>
|
<Appbar.Header dark={true} style={{ backgroundColor: theme.primary }}>
|
||||||
{user.category === undefined || user.category === null ?
|
<Appbar.BackAction
|
||||||
this.getHeaderRight(user)
|
onPress={() => { this.props.navigation.pop() }}
|
||||||
: this.getHeaderRightAgent(user)}
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
<View style={styles.networkInformation}>
|
|
||||||
|
|
||||||
<Text style={{
|
|
||||||
marginLeft: 10, marginRight: 10, marginTop: 15, marginBottom: 5, fontSize: 17,
|
|
||||||
fontWeight: 'bold', color: 'black'
|
|
||||||
}}>{I18n.t("ACCOUNT_INFO")}</Text>
|
|
||||||
<CardView style={{ marginLeft: 10, marginRight: 10, paddingBottom: 20 }}>
|
|
||||||
<ScrollView>
|
|
||||||
{user.category !== undefined && user.category !== null ? this
|
|
||||||
.addAgentInformation(user) : null}
|
|
||||||
<Text style={styles.textInformation2}>
|
|
||||||
<Icon name={"location-on"} size={18} />{" " + this.state.user.country}</Text>
|
|
||||||
|
|
||||||
{user.balance !== undefined && user.balance !== null ? this.showBalance(user) : null}
|
|
||||||
<Text style={styles.textInformation2}>
|
|
||||||
<Icon name={"mail"} size={18} />{" " + this.state.user.email}</Text>
|
|
||||||
|
|
||||||
|
|
||||||
<Text style={styles.textInformation2}>
|
|
||||||
|
|
||||||
<Icon name={"phone"} size={18} />
|
|
||||||
{" " + this.state.user.phone}</Text>
|
|
||||||
{this.showPhoneSup()}
|
|
||||||
<Text style={styles.textInformation2}>
|
|
||||||
|
|
||||||
<Icon name={"signal-cellular-4-bar"} size={18} />
|
|
||||||
{" " + this.state.user.network}</Text>
|
|
||||||
</ScrollView>
|
|
||||||
</CardView>
|
|
||||||
|
|
||||||
{user.category === 'geolocated' ?
|
|
||||||
(<Text style={{ marginLeft: 10, marginRight: 10, marginTop: 15, marginBottom: 5, fontSize: 17, fontWeight: 'bold', color: 'black' }}>{I18n.t("MY_NETWORK")}</Text>)
|
|
||||||
|
|
||||||
: null}
|
|
||||||
{user.category === 'geolocated' ? (this.state.mynetworks.length > 0 ? this.state.mynetworks.map(item => this.generateItemNetwork(item)) : this.showLoader()) : null}
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
showPhoneSup() {
|
|
||||||
if (this.state.user.phoneTransaction != undefined && this.state.user.phoneTransaction != null) {
|
|
||||||
|
|
||||||
return (<Text style={styles.textInformation2}>
|
|
||||||
|
|
||||||
<Icon name={"phone"} size={18} />
|
|
||||||
{" " + this.state.user.phoneTransaction}</Text>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getHeaderLeftProfil(user) {
|
|
||||||
return (<View style={{ flex: 2 }}>
|
|
||||||
<Text style={{ color: 'white', fontSize: 15, fontWeight: 'bold', textAlign: 'center' }}>{I18n.t("NETWORK")}</Text>
|
|
||||||
<Text style={{ color: 'white', fontSize: 15, textAlign: 'center' }}>{user.network}</Text>
|
|
||||||
</View>)
|
|
||||||
}
|
|
||||||
|
|
||||||
getHeaderRight(user) {
|
|
||||||
return (<View style={{ flex: 0 }}>
|
|
||||||
</View>)
|
|
||||||
}
|
|
||||||
|
|
||||||
getHeaderRightAgent(user) {
|
|
||||||
|
|
||||||
return (<View style={{ flex: 2 }}>
|
|
||||||
<Text style={{ color: 'white', fontSize: 15, textAlign: 'center', fontWeight: 'bold' }}>{I18n.t("MEMBER_CODE")}</Text>
|
|
||||||
<Text style={{ color: 'white', fontSize: 13, textAlign: 'center' }}>{user.code_membre}</Text>
|
|
||||||
</View>)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getHeaderLeftAgentProfil(user) {
|
|
||||||
return (<View style={{ flex: 2 }}>
|
|
||||||
<Text style={{ color: 'white', fontSize: 15, fontWeight: 'bold', textAlign: 'center' }}>{I18n.t("NETWORK")}</Text>
|
|
||||||
<Text style={{ color: 'white', fontSize: 13, textAlign: 'center' }}>{user.network}</Text>
|
|
||||||
</View>)
|
|
||||||
}
|
|
||||||
|
|
||||||
addAgentInformation(user) {
|
|
||||||
console.log(user)
|
|
||||||
if (user.category === "geolocated") {
|
|
||||||
(<View>
|
|
||||||
<Text style={{ marginLeft: 10, marginTop: 10, color: theme.primaryDark }}>
|
|
||||||
<Icon name={'code'} size={18} color={theme.primaryDark} style={{ paddingRight: 10 }} />
|
|
||||||
{" " + user.code_parrain}</Text>
|
|
||||||
</View>)
|
|
||||||
|
|
||||||
} else
|
|
||||||
return (<View>
|
|
||||||
|
|
||||||
<Text style={{ marginLeft: 10, marginTop: 10, color: theme.primaryDark }}>
|
|
||||||
<Icon name={'code'} size={18} color={theme.primaryDark} style={{ paddingRight: 10 }} />
|
|
||||||
{" " + user.code_parrain}</Text>
|
|
||||||
<View style={{ flexDirection: 'row', justifyContent: 'space-between', width: responsiveWidth(90), marginRight: 50 }}>
|
|
||||||
<Text style={{ marginLeft: 12, marginTop: 10, color: theme.primaryDark }}>
|
|
||||||
<Icon name={"group-work"} color={theme.primaryDark} size={18} />
|
|
||||||
{" " + ((user.nbre_reseau === null || user.nbre_reseau === undefined) ? 0 : user.nbre_reseau) + " " + I18n.t("FREE")}</Text>
|
|
||||||
<Text style={{ marginLeft: 12, marginTop: 10, 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")}</Text>
|
|
||||||
</View>
|
|
||||||
</View>)
|
|
||||||
}
|
|
||||||
|
|
||||||
mapUser(user) {
|
|
||||||
const myPosition = { latitude: parseFloat(user.latitude), longitude: parseFloat(user.longitude) }
|
|
||||||
|
|
||||||
return (<MapView
|
|
||||||
liteMode
|
|
||||||
ref={(ref) => { this.mapRef = ref }}
|
|
||||||
style={styles.map}
|
|
||||||
>
|
|
||||||
{this.state.myPosition !== undefined ?
|
|
||||||
<Marker
|
|
||||||
title={"Vous êtes ici"}
|
|
||||||
minZoomLevel={10}
|
|
||||||
coordinate={{ longitude: myPosition.longitude, latitude: myPosition.latitude }}
|
|
||||||
/> :
|
|
||||||
null}
|
|
||||||
</MapView>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
showBalance(user) {
|
|
||||||
return <Text style={styles.textInformation2}>
|
|
||||||
<Icon name={"folder"} size={18} />{" " + this.state.user.balance + " "}</Text>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
makeGeolocatedNetworkList() {
|
|
||||||
|
|
||||||
return (<View>
|
|
||||||
<Text style={{ marginLeft: 10, marginRight: 10, marginTop: 15, marginBottom: 5, fontSize: 17, fontWeight: 'bold', color: 'black' }}>Mes reseaux</Text>
|
|
||||||
|
|
||||||
</View>)
|
|
||||||
}
|
|
||||||
|
|
||||||
generateItemNetwork(item) {
|
|
||||||
return (
|
|
||||||
|
|
||||||
<Card >
|
|
||||||
|
|
||||||
<CardTitle
|
|
||||||
title={item.name}
|
|
||||||
subtitle={item.phone}
|
|
||||||
/>
|
/>
|
||||||
<CardContent>
|
<Appbar.Content
|
||||||
<View Style={{ flex: 1 }}>
|
title={I18n.t('MY_GROUP')}
|
||||||
<Text style={styles.textInformation2}>
|
/>
|
||||||
<Icon name={"code"} size={18} />{" " + item.code_membre + " "}</Text>
|
</Appbar.Header>
|
||||||
<Text style={styles.textInformation2}>
|
|
||||||
<Icon name={"people"} size={18} />{" " + item.code_parrain + " "}</Text>
|
|
||||||
|
|
||||||
</View>
|
<>
|
||||||
</CardContent>
|
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorDeleteDemand()}
|
||||||
<CardAction
|
|
||||||
separator={true}
|
|
||||||
inColumn={false}>
|
|
||||||
<CardButton
|
|
||||||
onPress={() => {
|
|
||||||
Alert.alert(
|
|
||||||
I18n.t("TITLE_SUPPRESS_CONFIRM"),
|
|
||||||
I18n.t("TEXT_SUPPRESS_CONFIRM"),
|
|
||||||
[
|
|
||||||
{ text: I18n.t('NO'), onPress: () => { } },
|
|
||||||
{
|
{
|
||||||
text: I18n.t("YES"), onPress: () => {
|
this.props.loadingGetUniqueDemand ?
|
||||||
deleteUser(item).then(() => {
|
this.renderLoader() :
|
||||||
this.setState({ isLoading: true })
|
this.props.resultGetUniqueDemand != null ?
|
||||||
this.updateContent(this.state.user)
|
this.renderDetail() :
|
||||||
})
|
null
|
||||||
},
|
}
|
||||||
style: 'cancel'
|
</>
|
||||||
},
|
</View>
|
||||||
],
|
</Provider>
|
||||||
)
|
)
|
||||||
}}
|
|
||||||
title={I18n.t('DELETE_GEOLOCATED_USER')}
|
|
||||||
color="crimson"
|
|
||||||
/>
|
|
||||||
</CardAction>
|
|
||||||
</Card>)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showLoader() {
|
|
||||||
return (<View style={{ height: responsiveHeight(20) }}><ProgressBarAndroid
|
|
||||||
|
|
||||||
style={{ justifyContent: "center", alignItems: "center" }}
|
|
||||||
/></View>)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
loadingGetUniqueDemand: state.getUserGroupDetailReducer.loading,
|
||||||
|
resultGetUniqueDemand: state.getUserGroupDetailReducer.result,
|
||||||
|
errorGetUniqueDemand: state.getUserGroupDetailReducer.error,
|
||||||
|
|
||||||
|
loadingTreatDemand: state.createGroupReducer.loading,
|
||||||
|
resultTreatDemand: state.createGroupReducer.result,
|
||||||
|
errorTreatDemand: state.createGroupReducer.error,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
|
||||||
|
getUserGroupDetailAction: getUserGroupDetailAction,
|
||||||
|
getUserGroupDetailReset: getUserGroupDetailReset,
|
||||||
|
createGroupAction: createGroupAction,
|
||||||
|
createGroupReset: createGroupReset,
|
||||||
|
|
||||||
|
getNanoCreditUniqueDemandsAction: getNanoCreditUniqueDemandsAction,
|
||||||
|
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
|
||||||
|
|
||||||
|
treatDemandGroupAction: treatDemandGroupAction,
|
||||||
|
treatDemandGroupReset: treatDemandGroupReset,
|
||||||
|
|
||||||
|
treatCreditDemand: treatCreditDemand,
|
||||||
|
creditDemandResetReducer: creditDemandResetReducer,
|
||||||
|
|
||||||
|
treatCancelDemand: treatCancelDemand,
|
||||||
|
creditCancelResetReducer: creditCancelResetReducer
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(MyNanoCreditGroup);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
userInformation: {
|
|
||||||
backgroundColor: theme.primary,
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
paddingTop: responsiveHeight(2),
|
|
||||||
paddingBottom: responsiveHeight(5)
|
|
||||||
},
|
|
||||||
map: {
|
|
||||||
height: 200,
|
|
||||||
marginRight: responsiveWidth(5),
|
|
||||||
marginLeft: responsiveWidth(5),
|
|
||||||
marginVertical: 10,
|
|
||||||
},
|
|
||||||
networkInformation: {
|
|
||||||
width: responsiveWidth(100),
|
|
||||||
backgroundColor: '#EEEEEE',
|
|
||||||
flex: 1
|
|
||||||
},
|
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#EEEEEE',
|
|
||||||
},
|
},
|
||||||
contain: {
|
btnstyle: {
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
identificationOptionMenuContainer: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
paddingTop: 10,
|
|
||||||
paddingLeft: 10,
|
|
||||||
paddingRight: 10,
|
|
||||||
},
|
|
||||||
containerTouch: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginRight: 2.5,
|
|
||||||
alignItems: 'center',
|
|
||||||
shadowColor: Color.borderColor,
|
|
||||||
borderColor: Color.borderColor,
|
|
||||||
shadowOffset: { width: 1.5, height: 1.5 },
|
|
||||||
shadowOpacity: 1.0,
|
|
||||||
elevation: 5,
|
|
||||||
borderRadius: 10,
|
|
||||||
backgroundColor: Color.cardBackgroundColor
|
|
||||||
},
|
|
||||||
contain: {
|
|
||||||
flexDirection: 'row',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
|
||||||
imageBanner: {
|
|
||||||
marginTop: 15,
|
|
||||||
marginLeft: 5,
|
|
||||||
width: Utils.scaleWithPixel(30),
|
|
||||||
height: Utils.scaleWithPixel(30)
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
height: Utils.scaleWithPixel(60),
|
|
||||||
paddingHorizontal: 10,
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'flex-start',
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
contentTitle: {
|
|
||||||
paddingTop: 5,
|
|
||||||
},
|
|
||||||
textInformation: {
|
|
||||||
fontSize: 16,
|
|
||||||
color: 'white',
|
|
||||||
textAlign: 'center'
|
|
||||||
},
|
|
||||||
textInformation2: {
|
|
||||||
fontSize: 15,
|
|
||||||
marginTop: 7,
|
|
||||||
color: theme.primaryDark,
|
|
||||||
marginLeft: 10,
|
|
||||||
},
|
|
||||||
textTitle: {
|
|
||||||
fontSize: 25,
|
|
||||||
color: 'white',
|
|
||||||
fontWeight: 'bold'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
textTitle2: {
|
inputAmountText: {
|
||||||
fontSize: 25,
|
...Platform.select({
|
||||||
color: theme.primaryDark,
|
android: {
|
||||||
fontWeight: 'bold'
|
borderBottomColor: Color.borderColor,
|
||||||
|
borderBottomWidth: 0.5,
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
},
|
||||||
|
simpleuser: {
|
||||||
|
marginLeft: responsiveWidth(2),
|
||||||
|
fontSize: 16,
|
||||||
|
color: '#3E3E3E'
|
||||||
|
},
|
||||||
|
textbtnstyle: {
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: 18
|
||||||
|
},
|
||||||
|
cardcontainer1: {
|
||||||
|
justifyContent: 'space-evenly',
|
||||||
|
flex: 2,
|
||||||
|
marginRight: 3,
|
||||||
|
marginLeft: 3,
|
||||||
|
|
||||||
|
},
|
||||||
|
cardcontainer: {
|
||||||
|
justifyContent: 'space-evenly',
|
||||||
|
flex: 3,
|
||||||
|
margin: 3,
|
||||||
|
}
|
||||||
|
})
|
|
@ -1,12 +1,15 @@
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import {StyleSheet,Text,View,StatusBar} from 'react-native'
|
import { StyleSheet, Text, View, StatusBar, Platform, ProgressBarAndroid } from 'react-native'
|
||||||
import BaseScreen from './../BaseScreen'
|
import BaseScreen from './../BaseScreen'
|
||||||
import I18n from "react-native-i18n";
|
import I18n from "react-native-i18n";
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons'
|
import Icon from 'react-native-vector-icons/MaterialIcons'
|
||||||
import LottieView from 'lottie-react-native'; // if you have "esModuleInterop": true
|
import LottieView from 'lottie-react-native'; // if you have "esModuleInterop": true
|
||||||
import { Header } from "react-native-elements";
|
import { Header } from "react-native-elements";
|
||||||
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { getNotificationAction, getNotificationReset } from '../../webservice/OnesignalApi';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
const theme = require('./../../utils/theme.json')
|
const theme = require('./../../utils/theme.json')
|
||||||
export default class Notifications extends BaseScreen{
|
class Notifications extends BaseScreen {
|
||||||
static navigatorStyle = {
|
static navigatorStyle = {
|
||||||
navBarBackgroundColor: theme.primaryDark,
|
navBarBackgroundColor: theme.primaryDark,
|
||||||
navBarTextColor: 'white',
|
navBarTextColor: 'white',
|
||||||
|
@ -24,7 +27,47 @@ export default class Notifications extends BaseScreen{
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props,true)
|
super(props);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLangue() {
|
||||||
|
this.props.navigation.setParams({ name: I18n.t('WALLET') })
|
||||||
|
this.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
renderLoader = () => {
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
||||||
|
{Platform.OS === 'android'
|
||||||
|
?
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<ProgressBarAndroid />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
|
||||||
|
</>
|
||||||
|
) :
|
||||||
|
<>
|
||||||
|
<ActivityIndicator size="large" color={'#ccc'} />
|
||||||
|
<Text>{I18n.t('LOADING_DOTS')}</Text>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
readUser().then((user) => {
|
||||||
|
if (user) {
|
||||||
|
if (user !== undefined) {
|
||||||
|
if (user.phone !== undefined) {
|
||||||
|
this.props.getNotificationAction(user.user_code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
|
@ -49,6 +92,19 @@ export default class Notifications extends BaseScreen{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
loading: state.getNotificationReducer.loading,
|
||||||
|
result: state.getNotificationReducer.result,
|
||||||
|
error: state.getNotificationReducer.error
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||||
|
getNotificationAction: getNotificationAction,
|
||||||
|
getNotificationReset: getNotificationReset
|
||||||
|
}, dispatch);
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(Notifications);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|
|
@ -171,6 +171,8 @@
|
||||||
"ACTIVATED": "has been activated",
|
"ACTIVATED": "has been activated",
|
||||||
"CREDIT_MANAGE": "Credit Management",
|
"CREDIT_MANAGE": "Credit Management",
|
||||||
"GROUP_MANAGE": "Group Management",
|
"GROUP_MANAGE": "Group Management",
|
||||||
|
"MODIFY_GROUP": "Modify group",
|
||||||
|
"DELETE_GROUP": "Delete group",
|
||||||
"CREATOR": "Creator",
|
"CREATOR": "Creator",
|
||||||
"NOTIFICATIONS": "Notification",
|
"NOTIFICATIONS": "Notification",
|
||||||
"NO_NOTIFICATION": "You haven't any notification",
|
"NO_NOTIFICATION": "You haven't any notification",
|
||||||
|
|
|
@ -176,6 +176,8 @@
|
||||||
"ACTIVATED": "a été activé",
|
"ACTIVATED": "a été activé",
|
||||||
"CREDIT_MANAGE": "Gestion de credit",
|
"CREDIT_MANAGE": "Gestion de credit",
|
||||||
"GROUP_MANAGE": "Gestion du groupe",
|
"GROUP_MANAGE": "Gestion du groupe",
|
||||||
|
"MODIFY_GROUP": "Modifier le groupe",
|
||||||
|
"DELETE_GROUP": "Supprimer le groupe",
|
||||||
"CREATOR": "Créateur",
|
"CREATOR": "Créateur",
|
||||||
"NOTIFICATIONS": "Notification",
|
"NOTIFICATIONS": "Notification",
|
||||||
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
|
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
|
||||||
|
|
|
@ -54,8 +54,10 @@ export const getCreditDemand = testBaseUrl + '/walletService/groups/demands';
|
||||||
export const linkCardUrl = testBaseUrl + '/walletService/identifications/rattach_card';
|
export const linkCardUrl = testBaseUrl + '/walletService/identifications/rattach_card';
|
||||||
export const groupUrl = testBaseUrl + '/walletService/groups';
|
export const groupUrl = testBaseUrl + '/walletService/groups';
|
||||||
export const treatDemandUrl = testBaseUrl + '/walletService/groups/demands/validate';
|
export const treatDemandUrl = testBaseUrl + '/walletService/groups/demands/validate';
|
||||||
|
export const cancelDemandUrl = testBaseUrl + '/walletService/groups/demands/cancel';
|
||||||
export const joinGroupUrl = testBaseUrl + '/walletService/groups/join';
|
export const joinGroupUrl = testBaseUrl + '/walletService/groups/join';
|
||||||
export const saveOnesignalIds = testBaseUrl + '/notificationService/onesignal';
|
export const saveOnesignalIds = testBaseUrl + '/notificationService/onesignal';
|
||||||
|
export const getNotificationUrl = testBaseUrl + '/notificationService/notifications';
|
||||||
|
|
||||||
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
export const authKeyUrl = testBaseUrl + '/oauth/token';
|
||||||
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
|
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";
|
||||||
|
|
|
@ -3,9 +3,15 @@ import axios from "axios";
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { fetchCreateGroupError, fetchCreateGroupPending, fetchCreateGroupReset, fetchCreateGroupSuccess, fetchTreatDemandsGroupPending, fetchTreatDemandsGroupSuccess, fetchTreatDemandsGroupError, fetchTreatDemandsGroupReset, fetchJoinGroupPending, fetchJoinGroupSuccess, fetchJoinGroupError, fetchJoinGroupReset } from "../redux/actions/NanoCreditAction";
|
import { fetchCreateGroupError, fetchCreateGroupPending, fetchCreateGroupReset, fetchCreateGroupSuccess, fetchTreatDemandsGroupPending, fetchTreatDemandsGroupSuccess, fetchTreatDemandsGroupError, fetchTreatDemandsGroupReset, fetchJoinGroupPending, fetchJoinGroupSuccess, fetchJoinGroupError, fetchJoinGroupReset } from "../redux/actions/NanoCreditAction";
|
||||||
import { store } from "../redux/store";
|
import { store } from "../redux/store";
|
||||||
import { groupUrl, treatDemandUrl, joinGroupUrl } from "./IlinkConstants";
|
import { groupUrl, treatDemandUrl, joinGroupUrl, cancelDemandUrl } from "./IlinkConstants";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} data
|
||||||
|
* @param {*} isToMofidy | 0-> CREATE 1->MODIFY 2->DELETE
|
||||||
|
*/
|
||||||
|
export const createGroupAction = (data, isToMofidy) => {
|
||||||
|
|
||||||
export const createGroupAction = (data) => {
|
|
||||||
|
|
||||||
const auth = store.getState().authKeyReducer;
|
const auth = store.getState().authKeyReducer;
|
||||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
@ -15,7 +21,9 @@ export const createGroupAction = (data) => {
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
url: `${groupUrl}`,
|
url: `${groupUrl}`,
|
||||||
method: 'POST',
|
method: isToMofidy === 0 ?
|
||||||
|
'POST' :
|
||||||
|
isToMofidy === 1 ? 'PUT' : 'DELETE',
|
||||||
data,
|
data,
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': authKey,
|
'Authorization': authKey,
|
||||||
|
@ -75,6 +83,38 @@ export const treatDemandGroupAction = (data) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const cancelDemandGroupAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchTreatDemandsGroupPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `${cancelDemandUrl}`,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchTreatDemandsGroupSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchTreatDemandsGroupError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchTreatDemandsGroupError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchTreatDemandsGroupError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const treatDemandGroupReset = () => {
|
export const treatDemandGroupReset = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(fetchTreatDemandsGroupReset());
|
dispatch(fetchTreatDemandsGroupReset());
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import I18n from 'react-native-i18n';
|
import I18n from 'react-native-i18n';
|
||||||
import { store } from "../redux/store";
|
import { store } from "../redux/store";
|
||||||
import { saveOnesignalIds } from "./IlinkConstants";
|
import { saveOnesignalIds, getNotificationUrl } from "./IlinkConstants";
|
||||||
import { fetchSaveOnesignalPlayerIdsPending, fetchSaveOnesignalPlayerIdsSuccess, fetchSaveOnesignalPlayerIdsError, fetchSaveOnesignalPlayerIdsReset } from "../redux/actions/NotificationAction";
|
import { fetchSaveOnesignalPlayerIdsPending, fetchSaveOnesignalPlayerIdsSuccess, fetchSaveOnesignalPlayerIdsError, fetchSaveOnesignalPlayerIdsReset } from "../redux/actions/NotificationAction";
|
||||||
|
import { fetchGetNotificationSuccess } from "../redux/actions/NanoCreditAction";
|
||||||
|
|
||||||
export const saveOnesignalIdsAction = (isUser, data) => {
|
export const saveOnesignalIdsAction = (isUser, data) => {
|
||||||
|
|
||||||
|
@ -42,3 +43,42 @@ export const saveOnesignalIdsReset = () => {
|
||||||
dispatch(fetchSaveOnesignalPlayerIdsReset());
|
dispatch(fetchSaveOnesignalPlayerIdsReset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getNotificationAction = (data) => {
|
||||||
|
|
||||||
|
const auth = store.getState().authKeyReducer;
|
||||||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||||
|
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchGetNotificationPending());
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: getNotificationUrl,
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authKey,
|
||||||
|
'X-Localization': I18n.currentLocale()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log(response);
|
||||||
|
dispatch(fetchGetNotificationSuccess(response));
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (error.response)
|
||||||
|
dispatch(fetchGetNotificationError(error.response));
|
||||||
|
else if (error.request)
|
||||||
|
dispatch(fetchGetNotificationError(error.request))
|
||||||
|
else
|
||||||
|
dispatch(fetchGetNotificationError(error.message))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getNotificationReset = () => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(fetchGetNotificationReset());
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import I18n from 'react-native-i18n';
|
||||||
import { store } from "../../redux/store";
|
import { store } from "../../redux/store";
|
||||||
import { idVerificationUrl, getCreditDemand, groupUrl } from "../IlinkConstants";
|
import { idVerificationUrl, getCreditDemand, groupUrl } from "../IlinkConstants";
|
||||||
import { fetchRetraitCashAgentIdVerificationPending, fetchRetraitCashAgentIdVerificationSuccess, fetchRetraitCashAgentIdVerificationError, fetchRetraitCashAgentIdVerificationReset } from "../../redux/actions/EnvoieAgentAction";
|
import { fetchRetraitCashAgentIdVerificationPending, fetchRetraitCashAgentIdVerificationSuccess, fetchRetraitCashAgentIdVerificationError, fetchRetraitCashAgentIdVerificationReset } from "../../redux/actions/EnvoieAgentAction";
|
||||||
import { fetchGetDemandsGroupSuccess, fetchGetDemandsGroupPending, fetchGetDemandsGroupError, fetchGetDemandsGroupReset, fetchGetUniqueDemandsGroupPending, fetchGetUniqueDemandsGroupSuccess, fetchGetUniqueDemandsGroupReset, fetchGetUniqueDemandsGroupError, fetchGetUserGroupDetailPending, fetchGetUserGroupDetailSuccess, fetchGetUserGroupDetailReset } from "../../redux/actions/NanoCreditAction";
|
import { fetchGetDemandsGroupSuccess, fetchGetDemandsGroupPending, fetchGetDemandsGroupError, fetchGetDemandsGroupReset, fetchGetUniqueDemandsGroupPending, fetchGetUniqueDemandsGroupSuccess, fetchGetUniqueDemandsGroupReset, fetchGetUniqueDemandsGroupError, fetchGetUserGroupDetailPending, fetchGetUserGroupDetailSuccess, fetchGetUserGroupDetailReset, fetchGetUserGroupDetailError } from "../../redux/actions/NanoCreditAction";
|
||||||
|
|
||||||
export const getNanoCreditDemandsAction = (id) => {
|
export const getNanoCreditDemandsAction = (id) => {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue