Group Detail partiellement OK

This commit is contained in:
Brice Zele 2020-08-13 08:23:23 +01:00
parent 2b3d33ef99
commit 1f4f283df8
19 changed files with 627 additions and 1057 deletions

3
App.js
View File

@ -75,6 +75,7 @@ import ModifyIdentificationUser from './screens/identification/ModifyIdentificat
import CreateGroupNanoCredit from './screens/nano-credit/CreateGroupNanoCredit'; import CreateGroupNanoCredit from './screens/nano-credit/CreateGroupNanoCredit';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit'; import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit';
import DemandGroupNanoCreditDetail from './screens/nano-credit/DemandGroupNanoCreditDetail';
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',
@ -159,6 +160,7 @@ const AppStack = createDrawerNavigator({
/>) />)
}), }),
}, },
demandeValidationGroupe: DemandGroupNanoCreditDetail
}) })
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } }) }, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
@ -394,6 +396,7 @@ class App extends React.Component {
} }
onOpened(openResult) { onOpened(openResult) {
let data = openResult.notification.payload.additionalData;
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);

File diff suppressed because one or more lines are too long

View File

@ -54,5 +54,6 @@
"envoiCashVersCashAgent": "envoiCashVersCashAgent", "envoiCashVersCashAgent": "envoiCashVersCashAgent",
"modifyIdentificationUser": "modifyIdentificationUser", "modifyIdentificationUser": "modifyIdentificationUser",
"createGroupNanoCredit": "createGroupNanoCredit", "createGroupNanoCredit": "createGroupNanoCredit",
"groupNanoCredit": "groupNanoCredit" "groupNanoCredit": "groupNanoCredit",
"demandGroupNanoCreditDetail": "demandeValidationGroupe"
} }

View File

@ -109,6 +109,7 @@
"DELETE_DEMAND": "Deletion request", "DELETE_DEMAND": "Deletion request",
"GROUP_INFOS": "Fill in the group information", "GROUP_INFOS": "Fill in the group information",
"NOM_GROUP": "Group name", "NOM_GROUP": "Group name",
"GROUP": "Group",
"LIMIT_OF_CREDIT": "Credit limit", "LIMIT_OF_CREDIT": "Credit limit",
"CODE_USER_ILINK_SPONSOR_1": "iLink user code sponsor 1", "CODE_USER_ILINK_SPONSOR_1": "iLink user code sponsor 1",
"CODE_USER_ILINK_SPONSOR_2": "iLink user code sponsor 2", "CODE_USER_ILINK_SPONSOR_2": "iLink user code sponsor 2",
@ -138,6 +139,7 @@
"NUMERO_ABONNE": "Subscriber number", "NUMERO_ABONNE": "Subscriber number",
"IDENTIFIANT_ETUDIANT": "Student ID", "IDENTIFIANT_ETUDIANT": "Student ID",
"DEMAND_SEND": "Demand send", "DEMAND_SEND": "Demand send",
"NO_DEMAND_CREATION_GROUP": "No group creation request",
"WITHDRAWAL_DESCRIPTION": "Make a withdrawal", "WITHDRAWAL_DESCRIPTION": "Make a withdrawal",
"COMMISSION_ACCOUNT_TITLE": "Commission account", "COMMISSION_ACCOUNT_TITLE": "Commission account",
"COMMISSION_TRANSFER_SUCCESS": "Commissions have been transferred to the main account", "COMMISSION_TRANSFER_SUCCESS": "Commissions have been transferred to the main account",
@ -167,6 +169,7 @@
"ACTIVATED": "has been activated", "ACTIVATED": "has been activated",
"CREDIT_MANAGE": "Credit Management", "CREDIT_MANAGE": "Credit Management",
"GROUP_MANAGE": "Group Management", "GROUP_MANAGE": "Group Management",
"CREATOR": "Creator",
"NOTIFICATIONS": "Notification", "NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "You haven't any notification", "NO_NOTIFICATION": "You haven't any notification",
"CONFIGURATIONS": "Configuration", "CONFIGURATIONS": "Configuration",

View File

@ -113,6 +113,7 @@
"SUCCESS_CREATION_GROUP": "Informations sur la création", "SUCCESS_CREATION_GROUP": "Informations sur la création",
"ERROR_CREATION_GROUP": "Erreur de création", "ERROR_CREATION_GROUP": "Erreur de création",
"NOM_GROUP": "Nom du groupe", "NOM_GROUP": "Nom du groupe",
"GROUP": "Groupe",
"LIMIT_OF_CREDIT": "Limite du crédit", "LIMIT_OF_CREDIT": "Limite du crédit",
"CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1", "CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1",
"CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2", "CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2",
@ -160,6 +161,7 @@
"DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de", "DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de",
"NO_WALLET_HISTORY": "Aucune transaction à ce jour", "NO_WALLET_HISTORY": "Aucune transaction à ce jour",
"DEMAND_SEND": "Demande envoyé", "DEMAND_SEND": "Demande envoyé",
"NO_DEMAND_CREATION_GROUP": "Aucune demande de création de groupe",
"NO_WALLET_ACTIVED": "Aucun wallet n'est activé pour votre compte", "NO_WALLET_ACTIVED": "Aucun wallet n'est activé pour votre compte",
"TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transférer commissions", "TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transférer commissions",
"PRINCIPAL": "Principal", "PRINCIPAL": "Principal",
@ -171,6 +173,7 @@
"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",
"CREATOR": "Créateur",
"NOTIFICATIONS": "Notification", "NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification", "NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
"CONFIGURATIONS": "Configuration", "CONFIGURATIONS": "Configuration",
@ -331,6 +334,9 @@
"SEND": "Envoyer !", "SEND": "Envoyer !",
"CHANGE_INFORMATION": "Modifier mes informations", "CHANGE_INFORMATION": "Modifier mes informations",
"VALIDATE": "Valider", "VALIDATE": "Valider",
"NO_VALIDATE": "Non validé",
"VALIDATION": "validation",
"VALIDATIONS": "validations",
"SELECT_YOUR_WALLET": "Selectionner un wallet", "SELECT_YOUR_WALLET": "Selectionner un wallet",
"CONNECT": "Connexion", "CONNECT": "Connexion",
"TEXT_BIG_CREATE_1": "Inscrivez vous en tant qu'Utilisateur", "TEXT_BIG_CREATE_1": "Inscrivez vous en tant qu'Utilisateur",

View File

@ -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 } 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 } from "../types/NanoCreditType";
export const fetchCreateGroupPending = () => ({ export const fetchCreateGroupPending = () => ({
type: CREATE_GROUP_PENDING type: CREATE_GROUP_PENDING
@ -52,4 +52,22 @@ export const fetchGetUniqueDemandsGroupError = (error) => ({
export const fetchGetUniqueDemandsGroupReset = () => ({ export const fetchGetUniqueDemandsGroupReset = () => ({
type: GET_UNIQUE_DEMAND_GROUP_RESET type: GET_UNIQUE_DEMAND_GROUP_RESET
});
export const fetchTreatDemandsGroupPending = () => ({
type: TREAT_DEMAND_GROUP_PENDING
});
export const fetchTreatDemandsGroupSuccess = (res) => ({
type: TREAT_DEMAND_GROUP_SUCCESS,
result: res,
});
export const fetchTreatDemandsGroupError = (error) => ({
type: TREAT_DEMAND_GROUP_ERROR,
result: error
});
export const fetchTreatDemandsGroupReset = () => ({
type: TREAT_DEMAND_GROUP_RESET
}); });

View File

@ -0,0 +1,33 @@
import { TREAT_DEMAND_GROUP_PENDING, TREAT_DEMAND_GROUP_SUCCESS, TREAT_DEMAND_GROUP_ERROR, TREAT_DEMAND_GROUP_RESET } from "../types/NanoCreditType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case TREAT_DEMAND_GROUP_PENDING: return {
...state,
loading: true
}
case TREAT_DEMAND_GROUP_SUCCESS: return {
...state,
loading: false,
result: action.result.data,
error: null
}
case TREAT_DEMAND_GROUP_ERROR: return {
...state,
loading: false,
result: null,
error: action.result
}
case TREAT_DEMAND_GROUP_RESET: return initialState;
default: {
return state;
}
}
};

View File

@ -28,6 +28,7 @@ import CreateGroupReducer from "./CreateGroupReducer";
import SaveOnesignalReducer from "./SaveOnesignalReducer"; import SaveOnesignalReducer from "./SaveOnesignalReducer";
import GetDemandsGroupReducer from "./GetDemandsGroupReducer"; import GetDemandsGroupReducer from "./GetDemandsGroupReducer";
import GetUniqueDemandsGroupReducer from "./GetUniqueDemandsGroupReducer"; import GetUniqueDemandsGroupReducer from "./GetUniqueDemandsGroupReducer";
import TreatDemandGroupReducer from "./TreatDemandGroupReducer";
const persistConfig = { const persistConfig = {
key: 'root', key: 'root',
@ -65,7 +66,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
createGroupReducer: CreateGroupReducer, createGroupReducer: CreateGroupReducer,
saveOnesignalReducer: SaveOnesignalReducer, saveOnesignalReducer: SaveOnesignalReducer,
getDemandsGroupReducer: GetDemandsGroupReducer, getDemandsGroupReducer: GetDemandsGroupReducer,
getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer,
treatDemandGroupReducer: TreatDemandGroupReducer,
}); });
export default rootReducer; export default rootReducer;

View File

@ -12,3 +12,8 @@ export const GET_UNIQUE_DEMAND_GROUP_PENDING = 'GET_UNIQUE_DEMAND_GROUP_PENDING'
export const GET_UNIQUE_DEMAND_GROUP_SUCCESS = 'GET_UNIQUE_DEMAND_GROUP_SUCCESS'; export const GET_UNIQUE_DEMAND_GROUP_SUCCESS = 'GET_UNIQUE_DEMAND_GROUP_SUCCESS';
export const GET_UNIQUE_DEMAND_GROUP_ERROR = 'GET_UNIQUE_DEMAND_GROUP_ERROR'; export const GET_UNIQUE_DEMAND_GROUP_ERROR = 'GET_UNIQUE_DEMAND_GROUP_ERROR';
export const GET_UNIQUE_DEMAND_GROUP_RESET = 'GET_UNIQUE_DEMAND_GROUP_RESET'; export const GET_UNIQUE_DEMAND_GROUP_RESET = 'GET_UNIQUE_DEMAND_GROUP_RESET';
export const TREAT_DEMAND_GROUP_PENDING = 'TREAT_DEMAND_GROUP_PENDING';
export const TREAT_DEMAND_GROUP_SUCCESS = 'TREAT_DEMAND_GROUP_SUCCESS';
export const TREAT_DEMAND_GROUP_ERROR = 'TREAT_DEMAND_GROUP_ERROR';
export const TREAT_DEMAND_GROUP_RESET = 'TREAT_DEMAND_GROUP_RESET';

View File

@ -55,6 +55,5 @@
"modifyIdentificationUser": "modifyIdentificationUser", "modifyIdentificationUser": "modifyIdentificationUser",
"createGroupNanoCredit": "createGroupNanoCredit", "createGroupNanoCredit": "createGroupNanoCredit",
"groupNanoCredit": "groupNanoCredit", "groupNanoCredit": "groupNanoCredit",
"demandGroupNanoCreditDetail": "demandGroupNanoCreditDetail", "demandGroupNanoCreditDetail": "demandeValidationGroupe"
"demandGroupDetail": "demandGroupDetail",
} }

View File

@ -50,6 +50,7 @@ import getAuthApiKey from '../../webservice/AuthKeyApi';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import getWalletActivated from '../../webservice/WalletApi'; import getWalletActivated from '../../webservice/WalletApi';
import { saveOnesignalIdsAction } from '../../webservice/OnesignalApi'; import { saveOnesignalIdsAction } from '../../webservice/OnesignalApi';
import OneSignal from 'react-native-onesignal';
const slideHeight = responsiveHeight(30) > 270 ? 270 : responsiveHeight(30) const slideHeight = responsiveHeight(30) > 270 ? 270 : responsiveHeight(30)
@ -655,8 +656,29 @@ class Home extends BaseScreen {
//IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) //IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('ids', this.onIds);
}; };
componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('ids', this.onIds);
}
onReceived(notification) {
console.log("Notification received: ", notification);
}
onOpened(openResult) {
let data = openResult.notification.payload.additionalData;
this.props.navigation.navigate(data.screen, {
id: data.data.id
});
}
/* updateLangue() { /* updateLangue() {
this.props.navigation.setParams({ name: I18n.t('MAP') }) this.props.navigation.setParams({ name: I18n.t('MAP') })
this.forceUpdate(); this.forceUpdate();
@ -1424,7 +1446,7 @@ class Home extends BaseScreen {
translucent={true} translucent={true}
/> />
{/* Start here to comment */} {/* Start here to comment */}
{/*
{ {
(this.state.loadingDialog || this.props.loading) ? (this.state.loadingDialog || this.props.loading) ?
<View <View
@ -1461,7 +1483,7 @@ class Home extends BaseScreen {
this.setState({ showProgress: false }) this.setState({ showProgress: false })
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }]) Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
}} }}
/> */} />
{this.makeCardSearch()} {this.makeCardSearch()}
{this.makeSlidingUp()} {this.makeSlidingUp()}
{this.makeDialogLoader()} {this.makeDialogLoader()}

View File

@ -1,513 +0,0 @@
import React, { Component } from 'react'
import { StyleSheet, View, Text, Alert, Platform } from 'react-native'
import CardView from 'react-native-cardview'
import Button from 'apsl-react-native-button'
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'
import Icons from 'react-native-vector-icons/Ionicons'
import { updateCreditDemand } from "../../webservice/HistoryRequestApi";
import { readUser } from "../../webservice/AuthApi";
let typesta = 0
let moment = require('moment-timezone')
var colorback = 'white'
import I18n from "react-native-i18n";
import { treatCreditDemand, creditDemandResetReducer } from '../../webservice/CreditTreatDemandApi';
import { treatCancelDemand, creditCancelResetReducer } from '../../webservice/CreditCancelDemandeApi';
import { getAgentNetworksList } from "../../webservice/NetworkApi";
import Icon from "./History";
import { Header } from "react-native-elements";
let theme = require('./../../utils/theme.json');
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
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 { getNanoCreditUniqueDemandsReset, getNanoCreditUniqueDemandsAction } from '../../webservice/user/NanoCreditApi'
class DemandGroupDetail extends Component {
static navigatorStyle = {
navBarBackgroundColor: theme.accentLight,
statusBarColor: theme.accent,
navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF',
};
static navigationOptions = ({ navigation }) => {
return {
drawerLabel: () => null,
title: "Transaction N°" + navigation.getParam("item", { id: "-" }).id
}
};
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.props.getNanoCreditUniqueDemandsReset();
this.props.getNanoCreditUniqueDemandsAction(this.state.id);
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
}
displayToast = (message) => {
Toast.show(message, {
duration: Toast.durations.SHORT,
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.
}
});
}
onTreatDemand() {
if (this.item !== "1") {
this.props.creditDemandResetReducer();
this.props.treatCreditDemand(this.item.id);
}
}
onCancelDemand = () => {
if (this.item !== "1") {
this.props.treatCancelDemand(this.item.id);
}
}
renderAlertErrorTreatOrCancelDemand = () => {
const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props;
if (errorTreatDemand !== null) {
if (typeof errorTreatDemand.data !== 'undefined') {
if (errorTreatDemand.status === 426) {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
errorTreatDemand.data.error,
[{
text: I18n.t('CANCEL_LABEL'),
onPress: () => { },
style: 'cancel'
},
{
text: I18n.t("OK"), onPress: () => {
setTimeout(() => {
this.setState({
displayAmountModifyDialog: true
});
}, 10);
this.props.creditDemandResetReducer();
this.props.creditCancelResetReducer();
}
}],
{ cancelable: false }
);
}
else {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
errorTreatDemand.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.creditDemandResetReducer();
this.props.creditCancelResetReducer();
}
}
],
{ cancelable: false }
);
}
}
}
if (errorCancelDemand !== null) {
if (typeof errorCancelDemand.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_TREATMENT_DEMAND"),
errorCancelDemand.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
}
}
],
{ cancelable: false }
)
}
}
if (resultTreatDemand !== null) {
console.log("resultTreatDemand", resultTreatDemand);
if (resultTreatDemand.status === 200) {
this.displayToast(resultTreatDemand.response);
this.props.navigation.goBack();
this.props.navigation.state.params.onGoBack();
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
}
}
if (resultCancelDemand !== null) {
console.log("resultCancelDemand", resultCancelDemand);
if (resultCancelDemand.status === 200) {
this.displayToast(resultCancelDemand.response);
this.props.navigation.goBack();
this.props.navigation.state.params.onGoBack();
this.props.creditCancelResetReducer();
this.props.creditDemandResetReducer();
}
}
}
renderBtn() {
const { user } = this.state
console.warn("ITEM ITEM", this.item);
if (user) {
if (this.item.code_parrain === user.code_membre) {
if (this.item.status === '1') {
return (<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
}}
isLoading={this.props.loadingTreatDemand}
onPress={() => {
}}
disabled={true}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
</Button>
)
}
else if (this.item.status === '2') {
return (<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
}}
onPress={() => {
}}
disabled={true}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
</Button>
)
}
else {
return (<View style={{
flexDirection: 'row',
paddingTop: 10
}}>
<View style={{
flex: 1,
alignItems: 'center'
}}>
<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
}}
isLoading={this.props.loadingTreatDemand}
onPress={() => {
this.setState({
triggerTreatmentClick: true
});
this.onTreatDemand()
}}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
</Button>
</View>
<View style={{
flex: 1,
alignItems: 'center'
}}>
<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: Color.redColor
}}
isLoading={this.props.loadingCancelDemand}
onPress={() => {
this.setState({
triggerCancelClick: true
});
this.onCancelDemand();
}}
textStyle={styles.textbtnstyle}
>
{I18n.t('REFUSER_DEMANDE')}
</Button>
</View>
</View>)
}
}
}
}
render() {
console.log("DEMAND GROUP PROPS", this.props);
let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format();
ago = moment(ago)
return (
<View style={styles.container}>
{this.renderPromptModifyAmountToSend()}
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()}
<CardView
style={styles.cardcontainer1}
><Text style={{
fontSize: 17,
fontWeight: 'bold',
color: 'black',
marginLeft: responsiveWidth(5)
}}>{I18n.t('MEMBER_INFO')}</Text>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-call'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.phone}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-person'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.code_membre}</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'
}}>
<Icons 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'
}}>
<Icons name='md-code-working'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-wallet'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.montant}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-calendar'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{ago.format(" Do MMMM YYYY à HH:mm")}</Text>
</View>
<View style={{
flexDirection: 'row',
alignSelf: 'flex-end',
marginRight: 20,
justifyContent: 'flex-start'
}}>
<Icons name='md-time'
size={28}
color={theme.accent}
/>
<Text style={{
marginLeft: responsiveWidth(2),
fontSize: 16,
color: theme.accent
}}>{ago.fromNow()}</Text>
</View>
</CardView>
{this.state.user ? this.renderBtn() : null}
</View>)
}
}
const mapStateToProps = state => ({
loadingGetUniqueDemand: state.getUniqueDemandsGroupReducer.loading,
resultGetUniqueDemand: state.getUniqueDemandsGroupReducer.result,
errorGetUniqueDemand: state.getUniqueDemandsGroupReducer.error,
loadingTreatDemand: state.creditTreatDemandReducer.loadingTreatDemand,
resultTreatDemand: state.creditTreatDemandReducer.resultTreatDemand,
errorTreatDemand: state.creditTreatDemandReducer.errorTreatDemand,
loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand,
resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand,
errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand
});
const mapDispatchToProps = dispatch => bindActionCreators({
getNanoCreditUniqueDemandsAction: getNanoCreditUniqueDemandsAction,
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
treatCreditDemand: treatCreditDemand,
creditDemandResetReducer: creditDemandResetReducer,
treatCancelDemand: treatCancelDemand,
creditCancelResetReducer: creditCancelResetReducer
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(DemandGroupDetail);
const styles = StyleSheet.create({
container: {
flex: 1,
},
btnstyle: {
},
inputAmountText: {
...Platform.select({
android: {
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,
}
})

View File

@ -50,7 +50,7 @@ import { Appbar, Paragraph, Menu, Divider, Provider } from 'react-native-paper';
import DeviceInfo from 'react-native-device-info' import DeviceInfo from 'react-native-device-info'
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import {getNanoCreditDemandsAction, getNanoCreditDemandsReset} from '../../webservice/user/NanoCreditApi'; import { getNanoCreditDemandsAction, getNanoCreditDemandsReset } from '../../webservice/user/NanoCreditApi';
import { IlinkEmitter } from '../../utils/events'; import { IlinkEmitter } from '../../utils/events';
import { Typography } from '../../config/typography'; import { Typography } from '../../config/typography';
import { ScrollView } from 'react-native-gesture-handler'; import { ScrollView } from 'react-native-gesture-handler';
@ -116,9 +116,9 @@ class DemandValidationGroup extends React.Component {
isDateEndTimePickerVisible: false, isDateEndTimePickerVisible: false,
isDataSubmit: false isDataSubmit: false
}; };
readUser().then((user) => { readUser().then((user) => {
this.setState({ user: user }); this.setState({ user: user });
this.props.getNanoCreditDemandsAction(user.id); this.props.getNanoCreditDemandsAction(user.id);
}); });
this.props.getNanoCreditDemandsReset(); this.props.getNanoCreditDemandsReset();
@ -130,7 +130,7 @@ class DemandValidationGroup extends React.Component {
componentDidMount() { componentDidMount() {
const { routeName } = this.navigation.state const { routeName } = this.navigation.state
this.setState({ position: routeName === "demandeValidationGroupe" ? 0 : 1, isDataSubmit: true }); this.setState({ position: routeName === "demandeValidationGroupe" ? 0 : 1, isDataSubmit: true });
this.refreshData(); this.refreshData();
this.animateSlidingUp(false) this.animateSlidingUp(false)
this.props.navigation.addListener("didFocus", () => { this.props.navigation.addListener("didFocus", () => {
@ -173,10 +173,10 @@ class DemandValidationGroup extends React.Component {
return ( return (
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.props.navigation.push(route.demandGroupDetail, { this.props.navigation.push(route.demandGroupNanoCreditDetail, {
id: item.id id: item.id
}); });
} }
}> }>
<View style={styles.content}> <View style={styles.content}>
@ -191,23 +191,23 @@ class DemandValidationGroup extends React.Component {
<Text style={styles.description}>{`Sponsor 3: ${item.sponsor3}`}</Text> */} <Text style={styles.description}>{`Sponsor 3: ${item.sponsor3}`}</Text> */}
<View style={styles.timeContent}> <View style={styles.timeContent}>
<View style={{alignContent: 'flex-start', flex: 1, flexDirection: 'row'}}> <View style={{ alignContent: 'flex-start', flex: 1, flexDirection: 'row' }}>
<Text style={{ <Text style={{
fontWeight: 'bold', fontWeight: 'bold',
marginLeft: 20, marginLeft: 20,
marginBottom: 10, marginBottom: 10,
color: item.nombre_validation === 3 ? 'green' : 'red', color: item.nombre_validation === 3 ? 'green' : 'red',
}}> }}>
{item.nombre_validation === 3 ? I18n.t('VALIDATE') : I18n.t('NO_VALIDATE')} {item.nombre_validation === 3 ? I18n.t('VALIDATE') : I18n.t('NO_VALIDATE')}
{` (${item.nombre_validation} ${item.nombre_validation > 1 ? I18n.t('VALIDATIONS') : I18n.t('VALIDATION')})`} {` (${item.nombre_validation} ${item.nombre_validation > 1 ? I18n.t('VALIDATIONS') : I18n.t('VALIDATION')})`}
</Text> </Text>
</View> </View>
<View style={{alignContent: 'flex-end', flex: 1, flexDirection: 'row'}}> <View style={{ alignContent: 'flex-end', flex: 1, flexDirection: 'row' }}>
<Icon name="map-marker" style={[styles.descriptionIcon], {color: Color.accentColor, marginTop: 5}} /> <Icon name="map-marker" style={[styles.descriptionIcon], { color: Color.accentColor, marginTop: 5 }} />
<Text style={styles.time}>{ item.country}</Text> <Text style={styles.time}>{item.country}</Text>
<Icon name="clock" style={[styles.descriptionIcon], {color: Color.accentColor, marginTop: 5}} /> <Icon name="clock" style={[styles.descriptionIcon], { color: Color.accentColor, marginTop: 5 }} />
<Text style={styles.time}> {dateFormat}</Text> <Text style={styles.time}> {dateFormat}</Text>
</View> </View>
@ -244,11 +244,11 @@ class DemandValidationGroup extends React.Component {
if (resultGetDemandsGroup.response !== null) { if (resultGetDemandsGroup.response !== null) {
return ( return (
Array.isArray(resultGetDemandsGroup.response) && (resultGetDemandsGroup.response.length) > 0 ? Array.isArray(resultGetDemandsGroup.response) && (resultGetDemandsGroup.response.length) > 0 ?
(<ScrollView style={{ flex: 1}}> (<ScrollView style={{ flex: 1 }}>
{ {
resultGetDemandsGroup.response.map((item) => ( resultGetDemandsGroup.response.map((item) => (
this.renderDemandItem(item) this.renderDemandItem(item)
)) ))
} }
</ScrollView>) : </ScrollView>) :
( (
@ -292,7 +292,7 @@ class DemandValidationGroup extends React.Component {
> >
<Icon name="account-multiple-plus" style={styles.actionButtonIcon} /> <Icon name="account-multiple-plus" style={styles.actionButtonIcon} />
</ActionButton.Item> </ActionButton.Item>
<ActionButton.Item buttonColor={purpleLight} title={I18n.t('JOIN_GROUP')} <ActionButton.Item buttonColor={purpleLight} title={I18n.t('JOIN_GROUP')}
onPress={() => { onPress={() => {
}} }}
@ -328,11 +328,12 @@ 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() :
this.rendeGetDemandsGroupResponse() this.rendeGetDemandsGroupResponse()
: null} : null}
{this.state.position === 0 && this.printOptions()}
</View> </View>
</Provider> </Provider>
); );

View File

@ -1,9 +1,9 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { StyleSheet, View, Text, Alert, Platform } from 'react-native' import { StyleSheet, View, Text, Alert, Platform, ProgressBarAndroid } from 'react-native'
import CardView from 'react-native-cardview' import CardView from 'react-native-cardview'
import Button from 'apsl-react-native-button' import Button from 'apsl-react-native-button'
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions' import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'
import Icons from 'react-native-vector-icons/Ionicons' import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { updateCreditDemand } from "../../webservice/HistoryRequestApi"; import { updateCreditDemand } from "../../webservice/HistoryRequestApi";
import { readUser } from "../../webservice/AuthApi"; import { readUser } from "../../webservice/AuthApi";
let typesta = 0 let typesta = 0
@ -13,7 +13,6 @@ import I18n from "react-native-i18n";
import { treatCreditDemand, creditDemandResetReducer } from '../../webservice/CreditTreatDemandApi'; import { treatCreditDemand, creditDemandResetReducer } from '../../webservice/CreditTreatDemandApi';
import { treatCancelDemand, creditCancelResetReducer } from '../../webservice/CreditCancelDemandeApi'; import { treatCancelDemand, creditCancelResetReducer } from '../../webservice/CreditCancelDemandeApi';
import { getAgentNetworksList } from "../../webservice/NetworkApi"; import { getAgentNetworksList } from "../../webservice/NetworkApi";
import Icon from "./History";
import { Header } from "react-native-elements"; import { Header } from "react-native-elements";
let theme = require('./../../utils/theme.json'); let theme = require('./../../utils/theme.json');
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -24,6 +23,7 @@ const route = require("./../../route.json");
import Dialog from "react-native-dialog"; 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'
class DemandGroupNanoCreditDetail extends Component { class DemandGroupNanoCreditDetail extends Component {
@ -36,32 +36,32 @@ class DemandGroupNanoCreditDetail extends Component {
static navigationOptions = ({ navigation }) => { static navigationOptions = ({ navigation }) => {
return { return {
drawerLabel: () => null, drawerLabel: () => null,
title: "Transaction N°" + navigation.getParam("item", { id: "-" }).id title: I18n.t('GROUP') + ' N°' + navigation.getParam("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);
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 = {
displayAmountModifyDialog: false, displayAmountModifyDialog: false,
statut: sta, /* statut: sta, */
user: null, user: null,
networks: [], networks: [],
loadingTreat: false, loadingTreat: false,
@ -70,38 +70,27 @@ class DemandGroupNanoCreditDetail extends Component {
triggerCancelClick: false, triggerCancelClick: false,
color: colorback, color: colorback,
montant: null, montant: null,
isBtnModifyAmountEnabled: false isBtnModifyAmountEnabled: false,
id: this.props.navigation.getParam("id", null)
} }
readUser().then(async (user) => {
let networks = []
networks = await getAgentNetworksList(user.agentId);
this.setState({ user: user, networks: networks.networks })
});
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
} this.props.getNanoCreditUniqueDemandsReset();
this.props.getNanoCreditUniqueDemandsAction(this.state.id);
isNormalInteger = (str) => {
return (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str)) ? false : true;
} }
isMontantValid = () => { componentDidMount() {
const { montant } = this.state;
if ((parseInt(montant) == 0 || montant < 0))
return false;
else if (!this.isNormalInteger(montant)) readUser().then((user) => {
return false; if (user) {
if (user !== undefined) {
this.setState({ user });
}
}
});
else if (parseInt(montant) > parseInt(this.item.montant))
return false;
else
return true;
} }
displayToast = (message) => { displayToast = (message) => {
@ -132,16 +121,6 @@ class DemandGroupNanoCreditDetail extends Component {
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) => {
this.setState({ loadingTreat: false })
console.log(data);
if (data.success === 1) {
this.setState({ statut: I18n.t('TREAT_DEMAND'), color: "#AEAEAE" })
} else {
console.log(data);
}
}) */
} }
} }
@ -151,46 +130,6 @@ class DemandGroupNanoCreditDetail extends Component {
} }
} }
renderPromptModifyAmountToSend = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayAmountModifyDialog}>
<Dialog.Title>{I18n.t('MODIFY_AMOUNT')}</Dialog.Title>
<Dialog.Description style={[FontWeight.bold]}>
{I18n.t('ENTER_NEW_AMOUNT_TO_SEND')}
</Dialog.Description>
<Dialog.Input style={styles.inputAmountText}
value={this.state.montant}
keyboardType="numeric"
onChangeText={(montant) => {
this.setState({ montant }, () => {
if (this.isMontantValid(montant)) {
this.setState({
isBtnModifyAmountEnabled: true
})
}
else
this.setState({
isBtnModifyAmountEnabled: false
});
console.log("this.isMontantValid().isValid", this.isMontantValid());
console.log("isBtnModifyAmountEnabled", this.state.isBtnModifyAmountEnabled);
});
}} />
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => this.setState({ displayAmountModifyDialog: false })} />
<Dialog.Button bold={true} label={I18n.t('SEND')} disable={this.state.isBtnModifyAmountEnabled} onPress={() => {
this.props.creditDemandResetReducer();
this.props.treatCreditDemand(this.item.id, this.state.montant);
}} />
</Dialog.Container>
)
}
renderAlertErrorTreatOrCancelDemand = () => { renderAlertErrorTreatOrCancelDemand = () => {
const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props; const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props;
@ -282,250 +221,292 @@ class DemandGroupNanoCreditDetail extends Component {
} }
renderLabelState = (state) => {
if (state === 0)
return I18n.t('NO_TREAT')
else if (statut === 1)
return I18n.t('TREAT')
else
return I18n.t('REFUSED')
}
renderBtn() { renderBtn() {
const { user } = this.state const { resultGetUniqueDemand } = this.props
console.warn("ITEM ITEM", this.item);
if (user) { if (resultGetUniqueDemand.response.statut === 1) {
if (this.item.code_parrain === user.code_membre) { return (<Button
if (this.item.status === '1') { style={{
return (<Button borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: 'gray'
}}
isLoading={this.props.loadingTreatDemand}
onPress={() => {
}}
disabled={true}
textStyle={styles.textbtnstyle}
>
{this.renderLabelState(resultGetUniqueDemand.response.statut)}
</Button>
)
}
else if (resultGetUniqueDemand.response.statut === 2) {
return (<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: 'gray'
}}
onPress={() => {
}}
disabled={true}
textStyle={styles.textbtnstyle}
>
{this.renderLabelState(resultGetUniqueDemand.response.statut)}
</Button>
)
}
else {
return (<View style={{
flexDirection: 'row',
paddingTop: 10
}}>
<View style={{
flex: 1,
alignItems: 'center'
}}>
<Button
style={{ style={{
borderColor: 'transparent', borderColor: 'transparent',
borderRadius: 6, borderRadius: 6,
marginLeft: 5, marginLeft: 5,
marginRight: 5, marginRight: 5,
backgroundColor: this.state.color backgroundColor: 'green'
}} }}
isLoading={this.props.loadingTreatDemand} isLoading={this.props.loadingTreatDemand}
onPress={() => { onPress={() => {
/* this.setState({
triggerTreatmentClick: true
});
this.onTreatDemand() */
}} }}
disabled={true}
textStyle={styles.textbtnstyle} textStyle={styles.textbtnstyle}
> >
{this.state.statut} {I18n.t('ACTION_TREAT_DEMAND')}
</Button> </Button>
) </View>
}
else if (this.item.status === '2') { <View style={{
return (<Button flex: 1,
alignItems: 'center'
}}>
<Button
style={{ style={{
borderColor: 'transparent', borderColor: 'transparent',
borderRadius: 6, borderRadius: 6,
marginLeft: 5, marginLeft: 5,
marginRight: 5, marginRight: 5,
backgroundColor: this.state.color backgroundColor: Color.redColor
}} }}
isLoading={this.props.loadingCancelDemand}
onPress={() => { onPress={() => {
/* this.setState({
triggerCancelClick: true
});
this.onCancelDemand(); */
}} }}
disabled={true}
textStyle={styles.textbtnstyle} textStyle={styles.textbtnstyle}
> >
{this.state.statut} {I18n.t('REFUSER_DEMANDE')}
</Button> </Button>
) </View>
} </View>)
else {
return (<View style={{
flexDirection: 'row',
paddingTop: 10
}}>
<View style={{
flex: 1,
alignItems: 'center'
}}>
<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
}}
isLoading={this.props.loadingTreatDemand}
onPress={() => {
this.setState({
triggerTreatmentClick: true
});
this.onTreatDemand()
}}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
</Button>
</View>
<View style={{
flex: 1,
alignItems: 'center'
}}>
<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: Color.redColor
}}
isLoading={this.props.loadingCancelDemand}
onPress={() => {
this.setState({
triggerCancelClick: true
});
this.onCancelDemand();
}}
textStyle={styles.textbtnstyle}
>
{I18n.t('REFUSER_DEMANDE')}
</Button>
</View>
</View>)
}
}
} }
} }
render() { renderLoader = () => {
console.log("CREDIT MANAGE PROPS", this.props);
let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format();
ago = moment(ago)
return ( return (
<View style={styles.container}> <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
{this.renderPromptModifyAmountToSend()} {Platform.OS === 'android'
{(this.state.triggerTreatmentClick || this.state.triggerCancelClick) && this.renderAlertErrorTreatOrCancelDemand()} ?
<CardView (
style={styles.cardcontainer1} <>
><Text style={{ <ProgressBarAndroid />
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'} />
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
)
}
renderDetail = () => {
const resultGetUniqueDemand = this.props.resultGetUniqueDemand;
console.log("resultGetUniqueDemand", resultGetUniqueDemand);
return (<View style={styles.container}>
<CardView
style={styles.cardcontainer1}
>
<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={{ {I18n.t('DEMAND_INFO')}
flexDirection: 'row', </Text>
justifyContent: 'flex-start' <View style={{
}}> flexDirection: 'row',
<Icons name='md-call' justifyContent: 'flex-start'
size={28} }}>
color={theme.accent} <Icon name='account'
style={{ size={28}
marginLeft: 20 color={theme.accent}
}} style={{
/> marginLeft: 20
<Text style={styles.simpleuser}>{this.item.phone}</Text> }}
</View> />
<View style={{ <Text style={styles.simpleuser}>{`${I18n.t('CREATOR')} ${resultGetUniqueDemand.response.createur}`}</Text>
flexDirection: 'row', </View>
justifyContent: 'flex-start' <View style={{
}}> flexDirection: 'row',
<Icons name='md-person' justifyContent: 'flex-start'
size={28} }}>
color={theme.accent} <Icon name='map-marker'
style={{ size={28}
marginLeft: 20 color={theme.accent}
}} style={{
/> marginLeft: 20
<Text style={styles.simpleuser}>{this.item.code_membre}</Text> }}
</View> />
</CardView> <Text style={styles.simpleuser}>{`${I18n.t('COUNTRY')} ${resultGetUniqueDemand.response.country}`}</Text>
<CardView </View>
style={styles.cardcontainer} </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='md-code-working'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='md-wallet'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.montant}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icon name='md-calendar'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{ago.format(" Do MMMM YYYY à HH:mm")}</Text>
</View>
<View style={{
flexDirection: 'row',
alignSelf: 'flex-end',
marginRight: 20,
justifyContent: 'flex-start'
}}>
<Icon name='md-time'
size={28}
color={theme.accent}
/>
<Text style={{ <Text style={{
fontSize: 17, marginLeft: responsiveWidth(2),
fontWeight: 'bold', fontSize: 16,
color: 'black', color: theme.accent
marginLeft: responsiveWidth(5)
}}>{I18n.t('DEMAND_INFO')}</Text>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons 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'
}}>
<Icons name='md-code-working'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.reseau}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-wallet'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.montant}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-calendar'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{ago.format(" Do MMMM YYYY à HH:mm")}</Text>
</View>
<View style={{
flexDirection: 'row',
alignSelf: 'flex-end',
marginRight: 20,
justifyContent: 'flex-start'
}}>
<Icons name='md-time'
size={28}
color={theme.accent}
/>
<Text style={{
marginLeft: responsiveWidth(2),
fontSize: 16,
color: theme.accent
}}>{ago.fromNow()}</Text> }}>{ago.fromNow()}</Text>
</View> </View>
</CardView> </CardView> */}
{this.state.user ? this.renderBtn() : null} {this.renderBtn()}
</View>) </View>);
}
render() {
console.log("DEMAND GROUP PROPS", this.props);
//let ago = moment.tz(this.item.date_creation, 'Etc/GMT+0').format();
//ago = moment(ago)
return (
<>
{
this.props.loadingGetUniqueDemand ?
this.renderLoader() :
this.renderDetail()
}
</>
);
} }
} }
const mapStateToProps = state => ({ const mapStateToProps = state => ({
loadingTreatDemand: state.creditTreatDemandReducer.loadingTreatDemand, loadingGetUniqueDemand: state.getUniqueDemandsGroupReducer.loading,
resultTreatDemand: state.creditTreatDemandReducer.resultTreatDemand, resultGetUniqueDemand: state.getUniqueDemandsGroupReducer.result,
errorTreatDemand: state.creditTreatDemandReducer.errorTreatDemand, errorGetUniqueDemand: state.getUniqueDemandsGroupReducer.error,
loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand, loadingTreatDemand: state.treatDemandGroupReducer.loading,
resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand, resultTreatDemand: state.treatDemandGroupReducer.result,
errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand errorTreatDemand: state.treatDemandGroupReducer.error,
}); });
const mapDispatchToProps = dispatch => bindActionCreators({ const mapDispatchToProps = dispatch => bindActionCreators({
getNanoCreditUniqueDemandsAction: getNanoCreditUniqueDemandsAction,
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
treatCreditDemand: treatCreditDemand, treatCreditDemand: treatCreditDemand,
creditDemandResetReducer: creditDemandResetReducer, creditDemandResetReducer: creditDemandResetReducer,

View File

@ -258,7 +258,7 @@ export default class OptionsMenu extends Component {
|| item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser' || item === 'envoieWalletToCashUser' || item === 'linkCard' || item === 'envoieWalletToCardUser' || item === 'envoieWalletToBankUser' || item === 'retraitWalletVersCashUser'
|| item === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent' || item === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent'
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent' || item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandGroupNanoCreditDetail') { || item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe') {
return null return null
} else { } else {
const color = this.state.currentId === item.id ? theme.accent : "grey" const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -405,36 +405,37 @@ export const optionNanoCreditScreen = {
icon: 'account-multiple', icon: 'account-multiple',
title: I18n.t('MANAGE_GROUP'), title: I18n.t('MANAGE_GROUP'),
screen: route.groupNanoCredit screen: route.groupNanoCredit
/* hasSubMenu: true, /* hasSubMenu: true,
subMenuOption: [ subMenuOption: [
{ {
title: I18n.t('DELETE'), title: I18n.t('DELETE'),
screen: "" screen: ""
}, },
{ {
title: I18n.t('CREATE'), title: I18n.t('CREATE'),
screen: route.createGroupNanoCredit screen: route.createGroupNanoCredit
}, },
{ {
title: I18n.t('JOIN'), title: I18n.t('JOIN'),
screen: "" screen: ""
}, },
{ {
title: I18n.t('VALIDATE'), title: I18n.t('VALIDATE'),
screen: route.groupNanoCredit screen: route.groupNanoCredit
}, },
], */ ], */
}, },
/* { /* {
screen: "", screen: "",
icon: 'account-multiple-plus', icon: 'account-multiple-plus',
title: I18n.t('JOIN_GROUP'), title: I18n.t('JOIN_GROUP'),
}, */ },
{ {
screen: "", screen: "",
icon: 'account-card-details', icon: 'account-card-details',
title: I18n.t('OPEN_ACCOUNT'), title: I18n.t('OPEN_ACCOUNT'),
}, },
*/
{ {
screen: "", screen: "",
icon: 'cash', icon: 'cash',

View File

@ -109,6 +109,7 @@
"DELETE_DEMAND": "Deletion request", "DELETE_DEMAND": "Deletion request",
"GROUP_INFOS": "Fill in the group information", "GROUP_INFOS": "Fill in the group information",
"NOM_GROUP": "Group name", "NOM_GROUP": "Group name",
"GROUP": "Group",
"LIMIT_OF_CREDIT": "Credit limit", "LIMIT_OF_CREDIT": "Credit limit",
"CODE_USER_ILINK_SPONSOR_1": "iLink user code sponsor 1", "CODE_USER_ILINK_SPONSOR_1": "iLink user code sponsor 1",
"CODE_USER_ILINK_SPONSOR_2": "iLink user code sponsor 2", "CODE_USER_ILINK_SPONSOR_2": "iLink user code sponsor 2",

View File

@ -113,6 +113,7 @@
"SUCCESS_CREATION_GROUP": "Informations sur la création", "SUCCESS_CREATION_GROUP": "Informations sur la création",
"ERROR_CREATION_GROUP": "Erreur de création", "ERROR_CREATION_GROUP": "Erreur de création",
"NOM_GROUP": "Nom du groupe", "NOM_GROUP": "Nom du groupe",
"GROUP": "Groupe",
"LIMIT_OF_CREDIT": "Limite du crédit", "LIMIT_OF_CREDIT": "Limite du crédit",
"CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1", "CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1",
"CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2", "CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2",

View File

@ -4,7 +4,7 @@ import I18n from 'react-native-i18n';
import { store } from "../../redux/store"; import { store } from "../../redux/store";
import { idVerificationUrl, getCreditDemand } from "../IlinkConstants"; import { idVerificationUrl, getCreditDemand } 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 } from "../../redux/actions/NanoCreditAction"; import { fetchGetDemandsGroupSuccess, fetchGetDemandsGroupPending, fetchGetDemandsGroupError, fetchGetDemandsGroupReset, fetchGetUniqueDemandsGroupPending, fetchGetUniqueDemandsGroupSuccess, fetchGetUniqueDemandsGroupReset, fetchGetUniqueDemandsGroupError } from "../../redux/actions/NanoCreditAction";
export const getNanoCreditDemandsAction = (id) => { export const getNanoCreditDemandsAction = (id) => {