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 { bindActionCreators } from 'redux';
import DemandValidationGroup from './screens/nano-credit/DemandGroupNanoCredit';
import DemandGroupNanoCreditDetail from './screens/nano-credit/DemandGroupNanoCreditDetail';
const instructions = Platform.select({
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 } })
@ -394,6 +396,7 @@ class App extends React.Component {
}
onOpened(openResult) {
let data = openResult.notification.payload.additionalData;
console.log('Message: ', openResult.notification.payload.body);
console.log('Data: ', openResult.notification.payload.additionalData);
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",
"modifyIdentificationUser": "modifyIdentificationUser",
"createGroupNanoCredit": "createGroupNanoCredit",
"groupNanoCredit": "groupNanoCredit"
"groupNanoCredit": "groupNanoCredit",
"demandGroupNanoCreditDetail": "demandeValidationGroupe"
}

View File

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

View File

@ -113,6 +113,7 @@
"SUCCESS_CREATION_GROUP": "Informations sur la création",
"ERROR_CREATION_GROUP": "Erreur de création",
"NOM_GROUP": "Nom du groupe",
"GROUP": "Groupe",
"LIMIT_OF_CREDIT": "Limite du crédit",
"CODE_USER_ILINK_SPONSOR_1": "Code utilisateur iLink Sponsor 1",
"CODE_USER_ILINK_SPONSOR_2": "Code utilisateur iLink Sponsor 2",
@ -160,6 +161,7 @@
"DEPOSIT_TRANSACTION_HISTORY_DESCRIPTION": "Dépôt de",
"NO_WALLET_HISTORY": "Aucune transaction à ce jour",
"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",
"TRANSFER_TO_PRINCIPAL_ACCOUNT": "Transférer commissions",
"PRINCIPAL": "Principal",
@ -171,6 +173,7 @@
"ACTIVATED": "a été activé",
"CREDIT_MANAGE": "Gestion de credit",
"GROUP_MANAGE": "Gestion du groupe",
"CREATOR": "Créateur",
"NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
"CONFIGURATIONS": "Configuration",
@ -331,6 +334,9 @@
"SEND": "Envoyer !",
"CHANGE_INFORMATION": "Modifier mes informations",
"VALIDATE": "Valider",
"NO_VALIDATE": "Non validé",
"VALIDATION": "validation",
"VALIDATIONS": "validations",
"SELECT_YOUR_WALLET": "Selectionner un wallet",
"CONNECT": "Connexion",
"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 = () => ({
type: CREATE_GROUP_PENDING
@ -53,3 +53,21 @@ export const fetchGetUniqueDemandsGroupError = (error) => ({
export const fetchGetUniqueDemandsGroupReset = () => ({
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 GetDemandsGroupReducer from "./GetDemandsGroupReducer";
import GetUniqueDemandsGroupReducer from "./GetUniqueDemandsGroupReducer";
import TreatDemandGroupReducer from "./TreatDemandGroupReducer";
const persistConfig = {
key: 'root',
@ -65,7 +66,9 @@ const rootReducer = persistCombineReducers(persistConfig, {
createGroupReducer: CreateGroupReducer,
saveOnesignalReducer: SaveOnesignalReducer,
getDemandsGroupReducer: GetDemandsGroupReducer,
getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer
getUniqueDemandsGroupReducer: GetUniqueDemandsGroupReducer,
treatDemandGroupReducer: TreatDemandGroupReducer,
});
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_ERROR = 'GET_UNIQUE_DEMAND_GROUP_ERROR';
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",
"createGroupNanoCredit": "createGroupNanoCredit",
"groupNanoCredit": "groupNanoCredit",
"demandGroupNanoCreditDetail": "demandGroupNanoCreditDetail",
"demandGroupDetail": "demandGroupDetail",
"demandGroupNanoCreditDetail": "demandeValidationGroupe"
}

View File

@ -50,6 +50,7 @@ import getAuthApiKey from '../../webservice/AuthKeyApi';
import { connect } from 'react-redux';
import getWalletActivated from '../../webservice/WalletApi';
import { saveOnesignalIdsAction } from '../../webservice/OnesignalApi';
import OneSignal from 'react-native-onesignal';
const slideHeight = responsiveHeight(30) > 270 ? 270 : responsiveHeight(30)
@ -655,8 +656,29 @@ class Home extends BaseScreen {
//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() {
this.props.navigation.setParams({ name: I18n.t('MAP') })
this.forceUpdate();
@ -1424,7 +1446,7 @@ class Home extends BaseScreen {
translucent={true}
/>
{/* Start here to comment */}
{/*
{
(this.state.loadingDialog || this.props.loading) ?
<View
@ -1461,7 +1483,7 @@ class Home extends BaseScreen {
this.setState({ showProgress: false })
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{ text: "Ok", onPress: () => { } }])
}}
/> */}
/>
{this.makeCardSearch()}
{this.makeSlidingUp()}
{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

@ -173,7 +173,7 @@ class DemandValidationGroup extends React.Component {
return (
<TouchableOpacity onPress={() => {
this.props.navigation.push(route.demandGroupDetail, {
this.props.navigation.push(route.demandGroupNanoCreditDetail, {
id: item.id
});
}
@ -333,6 +333,7 @@ class DemandValidationGroup extends React.Component {
this.renderLoader() :
this.rendeGetDemandsGroupResponse()
: null}
{this.state.position === 0 && this.printOptions()}
</View>
</Provider>
);

View File

@ -1,9 +1,9 @@
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 Button from 'apsl-react-native-button'
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 { readUser } from "../../webservice/AuthApi";
let typesta = 0
@ -13,7 +13,6 @@ 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';
@ -24,6 +23,7 @@ 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 } from '../../webservice/user/NanoCreditApi'
class DemandGroupNanoCreditDetail extends Component {
@ -36,13 +36,13 @@ class DemandGroupNanoCreditDetail extends Component {
static navigationOptions = ({ navigation }) => {
return {
drawerLabel: () => null,
title: "Transaction N°" + navigation.getParam("item", { id: "-" }).id
title: I18n.t('GROUP') + ' N°' + navigation.getParam("id", "-")
}
};
constructor(props) {
super(props);
this.item = this.props.navigation.getParam("item", null);
/* this.item = this.props.navigation.getParam("item", null);
let sta = ''
if (this.item.status === '1') {
typesta = 1
@ -57,11 +57,11 @@ class DemandGroupNanoCreditDetail extends Component {
colorback = '#AEAEAE'
typesta = 2
sta = I18n.t('REFUSED')
}
} */
this.state = {
displayAmountModifyDialog: false,
statut: sta,
/* statut: sta, */
user: null,
networks: [],
loadingTreat: false,
@ -70,38 +70,27 @@ class DemandGroupNanoCreditDetail extends Component {
triggerCancelClick: false,
color: colorback,
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";
moment.locale(this.currentLocale);
}
isNormalInteger = (str) => {
return (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(str)) ? false : true;
this.props.getNanoCreditUniqueDemandsReset();
this.props.getNanoCreditUniqueDemandsAction(this.state.id);
}
isMontantValid = () => {
const { montant } = this.state;
if ((parseInt(montant) == 0 || montant < 0))
return false;
componentDidMount() {
else if (!this.isNormalInteger(montant))
return false;
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({ user });
}
}
});
else if (parseInt(montant) > parseInt(this.item.montant))
return false;
else
return true;
}
displayToast = (message) => {
@ -132,16 +121,6 @@ class DemandGroupNanoCreditDetail extends Component {
if (this.item !== "1") {
this.props.creditDemandResetReducer();
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 = () => {
const { errorTreatDemand, resultTreatDemand, resultCancelDemand, errorCancelDemand } = this.props;
@ -282,19 +221,26 @@ 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() {
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') {
const { resultGetUniqueDemand } = this.props
if (resultGetUniqueDemand.response.statut === 1) {
return (<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
backgroundColor: 'gray'
}}
isLoading={this.props.loadingTreatDemand}
onPress={() => {
@ -302,25 +248,25 @@ class DemandGroupNanoCreditDetail extends Component {
disabled={true}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
{this.renderLabelState(resultGetUniqueDemand.response.statut)}
</Button>
)
}
else if (this.item.status === '2') {
else if (resultGetUniqueDemand.response.statut === 2) {
return (<Button
style={{
borderColor: 'transparent',
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
backgroundColor: 'gray'
}}
onPress={() => {
}}
disabled={true}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
{this.renderLabelState(resultGetUniqueDemand.response.statut)}
</Button>
)
}
@ -341,18 +287,18 @@ class DemandGroupNanoCreditDetail extends Component {
borderRadius: 6,
marginLeft: 5,
marginRight: 5,
backgroundColor: this.state.color
backgroundColor: 'green'
}}
isLoading={this.props.loadingTreatDemand}
onPress={() => {
this.setState({
/* this.setState({
triggerTreatmentClick: true
});
this.onTreatDemand()
this.onTreatDemand() */
}}
textStyle={styles.textbtnstyle}
>
{this.state.statut}
{I18n.t('ACTION_TREAT_DEMAND')}
</Button>
</View>
@ -370,10 +316,10 @@ class DemandGroupNanoCreditDetail extends Component {
}}
isLoading={this.props.loadingCancelDemand}
onPress={() => {
this.setState({
/* this.setState({
triggerCancelClick: true
});
this.onCancelDemand();
this.onCancelDemand(); */
}}
textStyle={styles.textbtnstyle}
>
@ -383,55 +329,72 @@ class DemandGroupNanoCreditDetail extends Component {
</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>
)
}
render() {
console.log("CREDIT MANAGE 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()}
renderDetail = () => {
const resultGetUniqueDemand = this.props.resultGetUniqueDemand;
console.log("resultGetUniqueDemand", resultGetUniqueDemand);
return (<View style={styles.container}>
<CardView
style={styles.cardcontainer1}
><Text style={{
>
<Text style={{
fontSize: 17,
fontWeight: 'bold',
color: 'black',
marginLeft: responsiveWidth(5)
}}>{I18n.t('MEMBER_INFO')}</Text>
}}>
{I18n.t('DEMAND_INFO')}
</Text>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-call'
<Icon name='account'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.phone}</Text>
<Text style={styles.simpleuser}>{`${I18n.t('CREATOR')} ${resultGetUniqueDemand.response.createur}`}</Text>
</View>
<View style={{
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-person'
<Icon name='map-marker'
size={28}
color={theme.accent}
style={{
marginLeft: 20
}}
/>
<Text style={styles.simpleuser}>{this.item.code_membre}</Text>
<Text style={styles.simpleuser}>{`${I18n.t('COUNTRY')} ${resultGetUniqueDemand.response.country}`}</Text>
</View>
</CardView>
<CardView
style={styles.cardcontainer}
>
{/* <CardView style={styles.cardcontainer}>
<Text style={{
fontSize: 17,
fontWeight: 'bold',
@ -442,7 +405,7 @@ class DemandGroupNanoCreditDetail extends Component {
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-git-branch'
<Icon name='md-git-branch'
size={28}
color={theme.accent}
style={{
@ -455,7 +418,7 @@ class DemandGroupNanoCreditDetail extends Component {
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-code-working'
<Icon name='md-code-working'
size={28}
color={theme.accent}
style={{
@ -468,7 +431,7 @@ class DemandGroupNanoCreditDetail extends Component {
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-wallet'
<Icon name='md-wallet'
size={28}
color={theme.accent}
style={{
@ -481,7 +444,7 @@ class DemandGroupNanoCreditDetail extends Component {
flexDirection: 'row',
justifyContent: 'flex-start'
}}>
<Icons name='md-calendar'
<Icon name='md-calendar'
size={28}
color={theme.accent}
style={{
@ -496,7 +459,7 @@ class DemandGroupNanoCreditDetail extends Component {
marginRight: 20,
justifyContent: 'flex-start'
}}>
<Icons name='md-time'
<Icon name='md-time'
size={28}
color={theme.accent}
/>
@ -507,25 +470,43 @@ class DemandGroupNanoCreditDetail extends Component {
}}>{ago.fromNow()}</Text>
</View>
</CardView>
{this.state.user ? this.renderBtn() : null}
</View>)
</CardView> */}
{this.renderBtn()}
</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 => ({
loadingTreatDemand: state.creditTreatDemandReducer.loadingTreatDemand,
resultTreatDemand: state.creditTreatDemandReducer.resultTreatDemand,
errorTreatDemand: state.creditTreatDemandReducer.errorTreatDemand,
loadingGetUniqueDemand: state.getUniqueDemandsGroupReducer.loading,
resultGetUniqueDemand: state.getUniqueDemandsGroupReducer.result,
errorGetUniqueDemand: state.getUniqueDemandsGroupReducer.error,
loadingCancelDemand: state.creditCancelDemandReducer.loadingCancelDemand,
resultCancelDemand: state.creditCancelDemandReducer.resultCancelDemand,
errorCancelDemand: state.creditCancelDemandReducer.errorCancelDemand
loadingTreatDemand: state.treatDemandGroupReducer.loading,
resultTreatDemand: state.treatDemandGroupReducer.result,
errorTreatDemand: state.treatDemandGroupReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
getNanoCreditUniqueDemandsAction: getNanoCreditUniqueDemandsAction,
getNanoCreditUniqueDemandsReset: getNanoCreditUniqueDemandsReset,
treatCreditDemand: treatCreditDemand,
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 === 'retraitCarteVersWalletUser' || item === 'retraitEnCashAgent' || item === 'retraitCarteVersCashAgent' || item === 'envoieCashVersWalletAgent'
|| 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
} else {
const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -429,12 +429,13 @@ export const optionNanoCreditScreen = {
screen: "",
icon: 'account-multiple-plus',
title: I18n.t('JOIN_GROUP'),
}, */
},
{
screen: "",
icon: 'account-card-details',
title: I18n.t('OPEN_ACCOUNT'),
},
*/
{
screen: "",
icon: 'cash',

View File

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

View File

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

View File

@ -4,7 +4,7 @@ import I18n from 'react-native-i18n';
import { store } from "../../redux/store";
import { idVerificationUrl, getCreditDemand } from "../IlinkConstants";
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) => {