Correction des bugs

This commit is contained in:
Brice 2020-11-18 12:22:53 +01:00
parent f3148ea78f
commit 0a1c1f896a
27 changed files with 2282 additions and 1574 deletions

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
"start-emulator": "emulator -avd Nexus_5X_API_29 -dns-server 8.8.8.8",
"start-emulator-pixel": "emulator -avd Pixel_2_API_29 -dns-server 8.8.8.8",
"run-debug": "cd android && ./gradlew clean && cd .. && react-native run-android",
"run-release": "cd android && ./gradlew clean && cd .. && react-native run-android --variant=release"
"run-release": "cd android && ./gradlew clean && cd h.. && react-native run-android --variant=release"
},
"dependencies": {
"@expo/react-native-action-sheet": "^3.8.0",

View File

@ -1,176 +1,176 @@
import {
WALLET_LIST_PENDING,
WALLET_LIST_SUCCESS,
WALLET_LIST_ERROR,
WALLET_HISTORY_PENDING,
WALLET_HISTORY_SUCCESS,
WALLET_HISTORY_ERROR,
WALLET_TRANSFER_COMMISSION_PENDING,
WALLET_TRANSFER_COMMISSION_SUCCESS,
WALLET_TRANSFER_COMMISSION_ERROR,
WALLET_TRANSFER_COMMISSION_RESET,
WALLET_HISTORY_RESET,
WALLET_LIST_DETAIL_RESET,
WALLET_LIST_DETAIL_ERROR,
WALLET_LIST_DETAIL_PENDING,
WALLET_LIST_DETAIL_SUCCESS,
WALLET_GET_COMMISSION_PENDING,
WALLET_GET_COMMISSION_SUCCESS,
WALLET_GET_COMMISSION_ERROR,
WALLET_GET_COMMISSION_RESET,
WALLET_GET_RETREAIT_COMMISSION_PENDING,
WALLET_GET_RETREAIT_COMMISSION_SUCCESS,
WALLET_GET_RETREAIT_COMMISSION_ERROR,
WALLET_GET_RETREAIT_COMMISSION_RESET,
LINK_CARD_PENDING,
LINK_CARD_RESET,
LINK_CARD_SUCCESS,
LINK_CARD_ERROR,
WALLET_HISTORY_HYPER_SUPER_PENDING,
WALLET_HISTORY_HYPER_SUPER__SUCCESS,
WALLET_HISTORY_HYPER_SUPER__ERROR,
WALLET_HISTORY_HYPER_SUPER__RESET
GET_OPERATOR_LIST_ERROR,
GET_OPERATOR_LIST_PENDING,
GET_OPERATOR_LIST_RESET,
GET_OPERATOR_LIST_SUCCESS,
LINK_CARD_ERROR,
LINK_CARD_PENDING,
LINK_CARD_RESET,
LINK_CARD_SUCCESS,
WALLET_GET_COMMISSION_ERROR,
WALLET_GET_COMMISSION_PENDING,
WALLET_GET_COMMISSION_RESET,
WALLET_GET_COMMISSION_SUCCESS,
WALLET_HISTORY_ERROR,
WALLET_HISTORY_HYPER_SUPER__ERROR,
WALLET_HISTORY_HYPER_SUPER__RESET,
WALLET_HISTORY_HYPER_SUPER__SUCCESS,
WALLET_HISTORY_HYPER_SUPER_PENDING,
WALLET_HISTORY_PENDING,
WALLET_HISTORY_RESET,
WALLET_HISTORY_SUCCESS,
WALLET_LIST_DETAIL_ERROR,
WALLET_LIST_DETAIL_PENDING,
WALLET_LIST_DETAIL_RESET,
WALLET_LIST_DETAIL_SUCCESS,
WALLET_LIST_ERROR,
WALLET_LIST_PENDING,
WALLET_LIST_SUCCESS,
WALLET_TRANSFER_COMMISSION_ERROR,
WALLET_TRANSFER_COMMISSION_PENDING,
WALLET_TRANSFER_COMMISSION_RESET,
WALLET_TRANSFER_COMMISSION_SUCCESS
} from "../types/WalletType";
export const fetchWalletListPending = () => ({
type: WALLET_LIST_PENDING
type: WALLET_LIST_PENDING
});
export const fetchWalletListSuccess = (res) => ({
type: WALLET_LIST_SUCCESS,
result: res,
type: WALLET_LIST_SUCCESS,
result: res,
});
export const fetchWalletListError = (error) => ({
type: WALLET_LIST_ERROR,
result: error
type: WALLET_LIST_ERROR,
result: error
});
export const fetchWalletListReset = (error) => ({
type: WALLET_LIST_RESET,
result: error
type: WALLET_LIST_RESET,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchWalletListDetailPending = () => ({
type: WALLET_LIST_DETAIL_PENDING
type: WALLET_LIST_DETAIL_PENDING
});
export const fetchWalletListDetailSuccess = (res) => ({
type: WALLET_LIST_DETAIL_SUCCESS,
result: res,
type: WALLET_LIST_DETAIL_SUCCESS,
result: res,
});
export const fetchWalletListDetailError = (error) => ({
type: WALLET_LIST_DETAIL_ERROR,
result: error
type: WALLET_LIST_DETAIL_ERROR,
result: error
});
export const fetchWalletListDetailReset = (error) => ({
type: WALLET_LIST_DETAIL_RESET,
result: error
type: WALLET_LIST_DETAIL_RESET,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchWalletHistoryPending = () => ({
type: WALLET_HISTORY_PENDING
type: WALLET_HISTORY_PENDING
});
export const fetchWalletHistoryReset = () => ({
type: WALLET_HISTORY_RESET
type: WALLET_HISTORY_RESET
});
export const fetchWalletHistorySuccess = (res) => ({
type: WALLET_HISTORY_SUCCESS,
result: res,
type: WALLET_HISTORY_SUCCESS,
result: res,
});
export const fetchWalletHistoryError = (error) => ({
type: WALLET_HISTORY_ERROR,
result: error
type: WALLET_HISTORY_ERROR,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchWalletHistoryHyperSuperPending = () => ({
type: WALLET_HISTORY_HYPER_SUPER_PENDING
type: WALLET_HISTORY_HYPER_SUPER_PENDING
});
export const fetchWalletHistoryHyperSuperReset = () => ({
type: WALLET_HISTORY_HYPER_SUPER__RESET
type: WALLET_HISTORY_HYPER_SUPER__RESET
});
export const fetchWalletHistoryHyperSuperSuccess = (res) => ({
type: WALLET_HISTORY_HYPER_SUPER__SUCCESS,
result: res,
type: WALLET_HISTORY_HYPER_SUPER__SUCCESS,
result: res,
});
export const fetchWalletHistoryHyperSuperError = (error) => ({
type: WALLET_HISTORY_HYPER_SUPER__ERROR,
result: error
type: WALLET_HISTORY_HYPER_SUPER__ERROR,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchWalletTransferCommissionPending = () => ({
type: WALLET_TRANSFER_COMMISSION_PENDING
type: WALLET_TRANSFER_COMMISSION_PENDING
});
export const walletTransferCommissionReset = () => ({
type: WALLET_TRANSFER_COMMISSION_RESET
type: WALLET_TRANSFER_COMMISSION_RESET
});
export const fetchWalletTransferCommissionSuccess = (res) => ({
type: WALLET_TRANSFER_COMMISSION_SUCCESS,
result: res,
type: WALLET_TRANSFER_COMMISSION_SUCCESS,
result: res,
});
export const fetchWalletTransferCommssionError = (error) => ({
type: WALLET_TRANSFER_COMMISSION_ERROR,
result: error
type: WALLET_TRANSFER_COMMISSION_ERROR,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchWalletGetCommissionPending = () => ({
type: WALLET_GET_COMMISSION_PENDING
type: WALLET_GET_COMMISSION_PENDING
});
export const walletGetCommissionReset = () => ({
type: WALLET_GET_COMMISSION_RESET
type: WALLET_GET_COMMISSION_RESET
});
export const fetchWalletGetCommissionSuccess = (res) => ({
type: WALLET_GET_COMMISSION_SUCCESS,
result: res,
type: WALLET_GET_COMMISSION_SUCCESS,
result: res,
});
export const fetchWalleGetCommissionError = (error) => ({
type: WALLET_GET_COMMISSION_ERROR,
result: error
type: WALLET_GET_COMMISSION_ERROR,
result: error
});
/**
* ---------------------------------------------------
*/
export const fetchLinkCardPending = () => ({
type: LINK_CARD_PENDING
type: LINK_CARD_PENDING
});
export const fetchLinkCardReset = () => ({
type: LINK_CARD_RESET
type: LINK_CARD_RESET
});
export const fetchLinkCardSuccess = (res) => ({
type: LINK_CARD_SUCCESS,
result: res,
type: LINK_CARD_SUCCESS,
result: res,
});
export const fetchLinkCardError = (error) => ({
type: LINK_CARD_ERROR,
result: error
type: LINK_CARD_ERROR,
result: error
});
/* export const fetchWalletGetRetraitCommissionPending = () => ({
@ -189,4 +189,25 @@ export const fetchWalletGetRetraitCommissionSuccess = (res) => ({
export const fetchWalleGetRetraitCommissionError = (error) => ({
type: WALLET_GET_RETREAIT_COMMISSION_ERROR,
result: error
}); */
}); */
/**
* ---------------------------------------------------
*/
export const fetchGetListOperatorPending = () => ({
type: GET_OPERATOR_LIST_PENDING
});
export const fetchGetListOperatorReset = () => ({
type: GET_OPERATOR_LIST_RESET
});
export const fetchGetListOperatorSuccess = (res) => ({
type: GET_OPERATOR_LIST_SUCCESS,
result: res,
});
export const fetchGetListOperatorError = (error) => ({
type: GET_OPERATOR_LIST_ERROR,
result: error
});

View File

@ -0,0 +1,42 @@
import {
GET_OPERATOR_LIST_ERROR,
GET_OPERATOR_LIST_PENDING,
GET_OPERATOR_LIST_RESET,
GET_OPERATOR_LIST_SUCCESS
} from "../types/WalletType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_OPERATOR_LIST_PENDING:
return {
...state,
loading: true
}
case GET_OPERATOR_LIST_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case GET_OPERATOR_LIST_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case GET_OPERATOR_LIST_RESET:
return initialState;
default: {
return state;
}
}
};

View File

@ -46,6 +46,7 @@ import GetBankListReducer from "./GetBankListReducer";
import EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer";
import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer";
import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer";
import GetListOperatorReducer from "./GetListOperatorReducer";
const persistConfig = {
key: 'root',
@ -100,7 +101,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
getBankListReducer: GetBankListReducer,
envoieUserWalletToBank: EnvoieUserWalletToBank,
getEpargneInProgressReducer: GetEpargneInProgressReducer,
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer,
getListOperatorReducer: GetListOperatorReducer
});
export default rootReducer;

View File

@ -36,4 +36,9 @@ export const WALLET_TRANSFER_COMMISSION_RESET = 'WALLET_TRANSFER_COMMISSION_RESE
export const LINK_CARD_PENDING = 'LINK_CARD_PENDING';
export const LINK_CARD_SUCCESS = 'LINK_CARD_SUCCESS';
export const LINK_CARD_ERROR = 'LINK_CARD_ERROR';
export const LINK_CARD_RESET = 'LINK_CARD_RESET';
export const LINK_CARD_RESET = 'LINK_CARD_RESET';
export const GET_OPERATOR_LIST_PENDING = 'GET_OPERATOR_LIST_PENDING';
export const GET_OPERATOR_LIST_SUCCESS = 'GET_OPERATOR_LIST_SUCCESS';
export const GET_OPERATOR_LIST_ERROR = 'GET_OPERATOR_LIST_ERROR';
export const GET_OPERATOR_LIST_RESET = 'GET_OPERATOR_LIST_RESET';

View File

@ -268,7 +268,7 @@ export default class SuperViseurGroupeHome extends BaseScreen {
renderMembers(item) {
var re = moment.tz(item.created_at, 'Etc/GMT+0').format();
var re = moment.tz(item.created_at, moment.tz.guess()).format();
re = moment(re).fromNow();
if (true) {
return (

View File

@ -1,11 +1,7 @@
import React, { Component, PureComponent } from 'react';
import PropTypes from 'prop-types';
import { StyleSheet, Text, View, FlatList, TouchableOpacity, SectionList, RefreshControl } from 'react-native';
import { responsiveFontSize, responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions';
import { convertDateToHumanText } from './../../utils/DateUtils';
import React, {PureComponent} from 'react';
import {FlatList, RefreshControl, SectionList, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import {responsiveFontSize, responsiveWidth} from 'react-native-responsive-dimensions';
import Icon from 'react-native-vector-icons/FontAwesome5';
var moment = require('moment-timezone')
const momentJS = require('moment')
import I18n from "react-native-i18n"
import 'moment/locale/fr'
@ -18,276 +14,316 @@ import 'moment/locale/en-nz'
import 'moment/locale/en-gb'
import DeviceInfo from 'react-native-device-info'
import { Color } from '../../config/Color';
import {Color} from '../../config/Color';
var moment = require('moment-timezone')
const momentJS = require('moment')
let route = require('./../../route.json');
var theme = require('./../../utils/theme.json');
export class HistoryItem extends React.Component {
constructor(props) {
super(props);
this.state = this.initState();
}
constructor(props) {
super(props);
this.state = this.initState();
}
statusLabel = (status) => {
switch (status) {
case '0': return I18n.t('NO_TREAT');
case '1': return I18n.t('TREAT');
case '2': return I18n.t('REFUSED');
}
}
statusLabel = (status) => {
switch (status) {
case '0':
return I18n.t('NO_TREAT');
case '1':
return I18n.t('TREAT');
case '2':
return I18n.t('REFUSED');
}
}
colorLabel = (status) => {
switch (status) {
case '0': return Color.accentColor;
case '1': return Color.greenColor;
case '2': return Color.redColor;
}
}
colorLabel = (status) => {
switch (status) {
case '0':
return Color.accentColor;
case '1':
return Color.greenColor;
case '2':
return Color.redColor;
}
}
descriptionLabelUserType = (user) => {
console.log("USER")
let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau;
descriptionLabelUserType = (user) => {
let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau;
switch (user.category) {
case 'geolocated': return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`;
case 'super': return this.props.isDemandSend ?
switch (user.category) {
case 'geolocated':
return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`;
case 'super':
return this.props.isDemandSend ?
`${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`
:
`${I18n.t('THE_AGENT')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
case 'hyper': return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
}
}
case 'hyper':
return `${I18n.t('THE_SUPERVISOR')} ${this.props.selfData.lastname} (${this.props.selfData.phone}) ${I18n.t('DEMAND_TEXT_FIRST_PART')} ${textDescription}`;
}
}
initState() {
var textTitle = ' Transaction ' + this.props.selfData.id;
var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ';
textDescription += this.props.selfData.reseau;
var today = new Date();
var l = this.props.selfData.date_creation;
let t = this.props.selfData.status;
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format();
re = moment(re)
return {
title: textTitle,
description: this.descriptionLabelUserType(this.props.user),
status: this.statusLabel(this.props.selfData.status),
time: re.fromNow(),
navigator: this.props.navigator,
type: t,
colorstate: this.colorLabel(t)
}
};
initState() {
var textTitle = ' Transaction ' + this.props.selfData.id;
var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ';
textDescription += this.props.selfData.reseau;
var today = new Date();
var l = this.props.selfData.date_creation;
let t = this.props.selfData.status;
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format();
re = moment(re)
return {
title: textTitle,
description: this.descriptionLabelUserType(this.props.user),
status: this.statusLabel(this.props.selfData.status),
time: re.fromNow(),
navigator: this.props.navigator,
type: t,
colorstate: this.colorLabel(t)
}
};
render() {
console.log("ITEM RENDER", this.props.selfData)
return (
<TouchableOpacity onPress={() =>
this.props.navigator.navigate(route.historyItemDetails, {
item: this.props.selfData,
onGoBack: () => this.props.refresh(),
render() {
console.log("ITEM RENDER", this.props.selfData)
return (
<TouchableOpacity onPress={() =>
this.props.navigator.navigate(route.historyItemDetails, {
item: this.props.selfData,
onGoBack: () => this.props.refresh(),
}
)}>
<View style={style.content}>
<Text style={style.title}>{this.state.title}</Text>
<Text style={style.description}>{this.state.description}</Text>
<View style={style.timeContent}>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
marginBottom: 10,
color: this.state.colorstate,
)}>
<View style={style.content}>
<Text style={style.title}>{this.state.title}</Text>
<Text style={style.description}>{this.state.description}</Text>
<View style={style.timeContent}>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
marginBottom: 10,
color: this.state.colorstate,
}}>{this.props.selfData.nombre_validation}</Text>
<Text style={style.time}>{this.state.time}</Text>
</View>
<View style={style.bottomSeparator} />
}}>{this.statusLabel(this.props.selfData.status)}</Text>
<Text style={style.time}>{this.state.time}</Text>
</View>
</TouchableOpacity>
)
<View style={style.bottomSeparator}/>
}
</View>
</TouchableOpacity>
)
}
}
export class HistoryItemSectionned extends PureComponent {
_keyExtractor = (item, index) => item.id;
_renderItem = ({ item }) => (
<HistoryItem
navigator={this.props.navigator}
selfData={item}
/>
);
constructor(props) {
super(props);
this.state = this.initState();
}
render() {
return (
_keyExtractor = (item, index) => item.id;
_renderItem = ({item}) => (
<HistoryItem
navigator={this.props.navigator}
selfData={item}
/>
);
<SectionList
sections={[
{ title: 'Demande traité', type: 0, data: this.state.treat, size: this.state.conservetreat.length, expandState: this.state.istreatexpand },
{ title: 'Demande non traité', type: 1, data: this.state.untreat, size: this.state.conserveuntreat.length, expandState: this.state.isuntreatexpand }
]}
renderSectionHeader={({ section: { title, type, data, size, expandState } }) => (
<TouchableOpacity onPress={() => this.onPressedHeader(type)} style={{
backgroundColor: theme.accent,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100)
}}>
<View style={{
height: 70,
justifyContent: 'center',
flex: 1,
width: responsiveWidth(100),
}}>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
fontSize: 20,
color: 'white'
}}>{title}</Text>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
fontSize: 16,
color: 'white'
}}>{size} demande(s)</Text>
</View>
<Icon name={expandState ? 'sort-up' : 'sort-down'} size={30} color={'white'} style={{ marginRight: 20 }} />
</TouchableOpacity>
)}
style={style.listStyle}
extraData={this.state}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem}
/>
);
}
onPressedHeader(type) {
if (type === 0) {
this.setState({ istreatexpand: !this.state.istreatexpand, treat: this.state.istreatexpand ? [] : this.state.conservetreat })
} else {
this.setState({ isuntreatexpand: !this.state.isuntreatexpand, untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat })
constructor(props) {
super(props);
this.state = this.initState();
}
}
}
initState() {
let data = this.props.list
render() {
return (
return {
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
treat: data.filter(item => item.statut === I18n.t('TREAT')),
istreatexpand: true,
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
isuntreatexpand: true
}
}
}
export class HistoryListItem extends React.Component {
_keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => {
};
_renderItem = ({ item }) => {
console.log('ITEM ', item);
return (
<HistoryItem
isDemandSend={this.props.isDemandSend}
user={this.props.user}
refresh={this.props.refresh}
navigator={this.props.navigator}
selfData={item}
refresh={this.props.refresh}
/>
)};
constructor(props) {
super(props);
this.state = this.initState();
}
initState() {
return {
refreshing: false,
}
}
render() {
return (
<FlatList
style={style.listStyle}
data={this.props.list}
extraData={this.state}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem}
refreshControl={
<RefreshControl
refreshing={this.props.isRefreshing}
colors={[theme.primary, theme.purpleLight, theme.reddeconnect, theme.accentLight]}
onRefresh={this.props.refreshing}
/>
<SectionList
sections={[
{
title: 'Demande traité',
type: 0,
data: this.state.treat,
size: this.state.conservetreat.length,
expandState: this.state.istreatexpand
},
{
title: 'Demande non traité',
type: 1,
data: this.state.untreat,
size: this.state.conserveuntreat.length,
expandState: this.state.isuntreatexpand
}
/>
);
}
]}
renderSectionHeader={({section: {title, type, data, size, expandState}}) => (
<TouchableOpacity onPress={() => this.onPressedHeader(type)} style={{
backgroundColor: theme.accent,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row', flex: 1, height: 70, width: responsiveWidth(100)
}}>
<View style={{
height: 70,
justifyContent: 'center',
flex: 1,
width: responsiveWidth(100),
}}>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
fontSize: 20,
color: 'white'
}}>{title}</Text>
<Text style={{
fontWeight: 'bold',
marginLeft: 20,
fontSize: 16,
color: 'white'
}}>{size} demande(s)</Text>
</View>
<Icon name={expandState ? 'sort-up' : 'sort-down'} size={30} color={'white'}
style={{marginRight: 20}}/>
</TouchableOpacity>
)}
style={style.listStyle}
extraData={this.state}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem}
/>
);
}
_onRefresh() {
this.setState({ refreshing: true })
setTimeout(() => { this.setState({ refreshing: false }) }, 5000);
}
onPressedHeader(type) {
if (type === 0) {
this.setState({
istreatexpand: !this.state.istreatexpand,
treat: this.state.istreatexpand ? [] : this.state.conservetreat
})
} else {
this.setState({
isuntreatexpand: !this.state.isuntreatexpand,
untreat: this.state.isuntreatexpand ? [] : this.state.conserveuntreat
})
}
}
initState() {
let data = this.props.list
return {
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')),
treat: data.filter(item => item.statut === I18n.t('TREAT')),
istreatexpand: true,
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')),
untreat: data.filter(item => item.statut !== I18n.t('TREAT')),
isuntreatexpand: true
}
}
}
export class HistoryListItem extends React.Component {
_keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => {
};
_renderItem = ({item}) => {
console.log('ITEM ', item);
return (
<HistoryItem
isDemandSend={this.props.isDemandSend}
user={this.props.user}
refresh={this.props.refresh}
navigator={this.props.navigator}
selfData={item}
refresh={this.props.refresh}
/>
)
};
constructor(props) {
super(props);
this.state = this.initState();
}
initState() {
return {
refreshing: false,
}
}
render() {
return (
<FlatList
style={style.listStyle}
data={this.props.list}
extraData={this.state}
keyExtractor={this._keyExtractor}
renderItem={this._renderItem}
refreshControl={
<RefreshControl
refreshing={this.props.isRefreshing}
colors={[theme.primary, theme.purpleLight, theme.reddeconnect, theme.accentLight]}
onRefresh={this.props.refreshing}
/>
}
/>
);
}
_onRefresh() {
this.setState({refreshing: true})
setTimeout(() => {
this.setState({refreshing: false})
}, 5000);
}
}
const style = StyleSheet.create({
content: {
width: responsiveWidth(100),
borderBottomColor: '#FFFFFF',
flex: 1,
flexDirection: 'column',
paddingTop: 10,
content: {
width: responsiveWidth(100),
borderBottomColor: '#FFFFFF',
flex: 1,
flexDirection: 'column',
paddingTop: 10,
},
listStyle: {
backgroundColor: 'white'
},
bottomSeparator: {
width: responsiveWidth(100),
height: 5,
justifyContent: 'center',
alignSelf: 'center',
backgroundColor: '#EEE',
},
title: {
color: '#000',
paddingLeft: 10,
fontSize: responsiveFontSize(2.2)
},
description: {
fontSize: responsiveFontSize(1.8),
color: '#4f5b62',
paddingLeft: 10,
},
listStyle: {
backgroundColor: 'white'
},
bottomSeparator: {
width: responsiveWidth(100),
height: 5,
justifyContent: 'center',
alignSelf: 'center',
backgroundColor: '#EEE',
},
title: {
color: '#000',
paddingLeft: 10,
fontSize: responsiveFontSize(2.2)
},
description: {
fontSize: responsiveFontSize(1.8),
color: '#4f5b62',
paddingLeft: 10,
},
timeContent: {
justifyContent: 'space-between',
flex: 1,
marginTop: 10,
marginBottom: 5,
flexDirection: 'row',
},
time: {
fontWeight: 'bold',
marginRight: 20,
marginBottom: 10,
color: theme.accent,
},
treat: {
},
},
timeContent: {
justifyContent: 'space-between',
flex: 1,
marginTop: 10,
marginBottom: 5,
flexDirection: 'row',
},
time: {
fontWeight: 'bold',
marginRight: 20,
marginBottom: 10,
color: theme.accent,
},
treat: {},
});

File diff suppressed because it is too large Load Diff

View File

@ -176,8 +176,8 @@ class Home extends BaseScreen {
AsyncStorage.getAllKeys((err, keys) => {
AsyncStorage.multiGet(keys, (err, stores) => {
stores.map(async (result, i, store) => {
/* console.warn("KEY MAP", store);
console.log("KEY SAVE " + store[i][0]); */
console.warn("KEY MAP", store);
console.log("KEY SAVE " + store[i][0]);
let key = store[i][0];
if (i === 0) {
if (!_.isEqual(key, '@config:onesignalIds')) {
@ -778,9 +778,8 @@ class Home extends BaseScreen {
this.makeMarkerInformation = this.makeMarkerInformation.bind(this);
//IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
OneSignal.addEventListener('ids', this.onIds);
global.appHasLoaded = true;
};
/* updateLangue() {
@ -1656,7 +1655,7 @@ class Home extends BaseScreen {
translucent={true}
/>
{/* Start here to comment */}
{/*{
{
(this.state.loadingDialog || this.props.loading) ?
<View
style={{
@ -1708,7 +1707,7 @@ class Home extends BaseScreen {
}
}])
}}
/>*/}
/>
{this.makeCardSearch()}
{this.makeSlidingUp()}
{this.makeDialogLoader()}

View File

@ -1,24 +1,35 @@
import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil';
import React, { Component } from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native';
import * as Animatable from 'react-native-animatable';
import React, {Component} from 'react';
import {
ActivityIndicator,
Alert,
ProgressBarAndroid,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
import I18n from 'react-native-i18n';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs';
import { Fumi } from 'react-native-textinput-effects';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Color } from '../../config/Color';
import { FontWeight, Typography } from '../../config/typography';
import { store } from "../../redux/store";
import { IlinkEmitter } from '../../utils/events';
import { readUser } from '../../webservice/AuthApi';
import { createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi';
import { isNormalInteger } from '../../utils/UtilsFunction';
import { casserEpargneUserAction, casserEpargneUserReset } from '../../webservice/user/NanoCreditApi';
import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import {ProgressDialog} from 'react-native-simple-dialogs';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import omit from 'lodash/omit';
import {Color} from '../../config/Color';
import {Typography} from '../../config/typography';
import {IlinkEmitter} from '../../utils/events';
import {readUser} from '../../webservice/AuthApi';
import {getEpargneInProgressAction, getEpargneInProgressReset} from '../../webservice/NanoCreditApi';
import {casserEpargneUserAction, casserEpargneUserReset} from '../../webservice/user/NanoCreditApi';
import {cutStringWithoutDot, displayTransactionType, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
import * as Utils from "../../utils/DeviceUtils";
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import thousands from "thousands";
import Dialog from "react-native-dialog";
let theme = require('../../utils/theme.json');
let route = require('../../route.json');
@ -26,154 +37,472 @@ let route = require('../../route.json');
class CasserEpargneUser extends Component {
constructor(props) {
super(props);
this.state = {
password: null,
idEpargne: null,
codeGroup: null,
loading: false,
user: null,
triggerSubmitClick: false,
isSubmitClick: false,
isDataSubmit: false,
isModalConfirmVisible: false,
isGroupToModify: false,
};
constructor(props) {
super(props);
this.state = {
password: null,
idEpargne: null,
codeGroup: null,
loading: false,
user: null,
triggerSubmitClick: false,
isSubmitClick: false,
isDataSubmit: false,
isModalConfirmVisible: false,
isGroupToModify: false,
displayModalHistory: false,
historyItemDetail: null,
isDataHasLoaded: false,
displayPasswordModal: false,
wallet: this.props.navigation.state.params.wallet,
};
this.props.getEpargneInProgressReset();
}
}
static navigatorStyle = {
navBarBackgroundColor: Color.primaryColor,
statusBarColor: Color.primaryDarkColor,
navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF'
static navigatorStyle = {
navBarBackgroundColor: Color.primaryColor,
statusBarColor: Color.primaryDarkColor,
navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF'
};
};
static navigationOptions = () => {
return {
drawerLabel: () => null,
headerTitle: I18n.t('BREAK_EPARGNE'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
marginTop: 0,
color: 'white'
},
headerTitleStyle: {
color: "white"
},
title: I18n.t('BREAK_EPARGNE')
}
};
static navigationOptions = () => {
return {
drawerLabel: () => null,
headerTitle: I18n.t('BREAK_EPARGNE'),
headerTintColor: 'white',
headerStyle: {
backgroundColor: Color.primaryColor,
marginTop: 0,
color: 'white'
},
headerTitleStyle: {
color: "white"
},
title: I18n.t('BREAK_EPARGNE')
}
};
componentDidMount() {
componentDidMount() {
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({ user });
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getEpargneInProgressAction(user.id);
}
}
});
}
ckeckIfFieldIsOK(champ) {
return (isNil(champ) || isEqual(champ.length, 0));
}
renderBreakEpargneRespons = () => {
const {result, error} = this.props;
if (error !== null) {
if (typeof error.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_LABLE"),
error.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.casserEpargneUserReset();
}
}
],
{cancelable: false}
)
}
}
if (result !== null) {
if (result.response !== null) {
Alert.alert(
I18n.t("BREAK_EPARGNE_DONE"),
result.response,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.casserEpargneUserReset();
IlinkEmitter.emit("refreshWallet");
this.props.navigation.pop();
}
}
],
{cancelable: false}
)
}
}
}
updateLangue() {
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
this.forceUpdate()
}
ckeckIfFieldIsOK(champ) {
return (isNil(champ) || isEqual(champ.length, 0));
}
onSubmitCasserEpargne = () => {
const {idEpargne, password} = this.state;
if (this.ckeckIfFieldIsOK(idEpargne))
this.idEpargneAnim.shake(800);
else if (this.ckeckIfFieldIsOK(password))
this.passwordAnim.shake(800);
else {
this.props.casserEpargneUserAction({
id_user: this.state.user.id,
id_epargne: this.state.idEpargne,
password: this.state.password
}, 0);
}
this.setState({
isDataSubmit: true
});
}
renderLoader = () => {
return (
<ProgressDialog
visible={this.props.loading || this.props.loadingGetCommission || this.props.loadingNanoCreditHistory}
title={I18n.t('LOADING')}
message={I18n.t('LOADING_INFO')}
/>
)
}
renderModalHistoryDetail = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayModalHistory}>
<Dialog.Title>{I18n.t('DEMAND_DETAIL')}</Dialog.Title>
{
<ScrollView>
<View style={[styles.blockView, {borderBottomColor: Color.borderColor}]}>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{I18n.t(displayTransactionType(this.state.historyItemDetail.type_historique))}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('ID_DEMAND')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.id_epargne}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('STATUS')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.etat}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('DEMAND_DURATION_IN_MONTH')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.duree_mois}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>Type</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.type}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('AMOUNT_WITHDRAWAL')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.montant_retire + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('TAXES')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.taxe + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('INTERET')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.interet + ' ' + this.state.wallet.currency_code}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text style={[styles.body2]}>{I18n.t('CREATION_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_creation}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('FINAL_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_fin}</Text>
</View>
</View>
<View style={{flexDirection: 'row', marginTop: 10}}>
<View style={{flex: 1}}>
<Text tyle={[Typography.body2]}>{I18n.t('CASSATION_DATE')}</Text>
</View>
<View style={{flex: 1, alignItems: 'flex-end'}}>
<Text
style={[Typography.caption1, Color.grayColor]}>{this.state.historyItemDetail.date_cassation}</Text>
</View>
</View>
</View>
</ScrollView>
}
<Dialog.Button bold={true} label={I18n.t('CANCEL_LABEL')} onPress={() => {
this.setState({
displayModalHistory: !this.state.displayModalHistory,
});
}}/>
<Dialog.Button bold={true} label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({
displayPasswordModal: !this.state.displayPasswordModal,
});
}}/>
</Dialog.Container>
);
}
renderPasswordDialog = () => {
return (
<Dialog.Container useNativeDriver={true} visible={this.state.displayPasswordModal}>
<Dialog.Title>{I18n.t('PASSWORD')}</Dialog.Title>
<Dialog.Input placeholder={I18n.t('PLEASE_ENTER_THE_PASSWORD')}
style={{borderBottomWidth: 1, borderBottomColor: Color.borderColor}}
showSoftInputOnFocus={true}
onChangeText={(password) => {
this.setState({password})
}}
secureTextEntry={true}
value={this.state.password}
onSubmitEditing={() => {
this.setState({
displayPasswordModal: false,
displayModalHistory: false,
isDataSubmit: true
});
this.props.refundCreditDemandUserAction({
id_user: this.state.user.id,
id_epargne: this.state.historyItemDetail.id_epargne,
password: this.state.password
});
}}/>
<Dialog.Button label={I18n.t('CANCEL_LABEL')} onPress={() => {
this.setState({displayPasswordModal: !this.state.displayPasswordModal});
}}/>
<Dialog.Button label={I18n.t('SUBMIT_LABEL')} onPress={() => {
this.setState({
displayPasswordModal: false,
displayModalHistory: false,
isDataSubmit: true
})
this.props.casserEpargneUserAction({
id_user: this.state.user.id,
id_epargne: this.state.historyItemDetail.id_epargne,
password: this.state.password
});
}}/>
</Dialog.Container>
);
}
renderNanoCreditItem = (item, index) => {
return (
<TouchableOpacity onPress={() => {
this.setState({displayModalHistory: true, historyItemDetail: item})
}} style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
Object.keys(omit(item, ['id', 'id_epargne', 'date_demande', 'date_fin', 'date_remboursement_prevu', 'date_validation', 'date_cassation', 'date_remboursement', 'id_demande', 'duree_mois', 'taxe', '', 'date_fin', 'date_cassation', 'id_user', 'id_network', 'user', 'partiellement_rembourse', 'user_phone', 'interet', 'date_remboursement_prevu', 'date_remboursement', 'id_wallet_agent', 'retrait_cash', 'codeParrain', 'agent', 'montant_rembourse', ''])).map((element, i) => (
<View style={{alignItems: 'center'}} key={i}>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{
isEqual(element, 'montant') ?
` ${thousands(item[element], ' ')}`
: isEqual(element, 'date_creation') ?
cutStringWithoutDot(item[element], 16)
: item[element]
}
</Text>
</View>
))
}
</TouchableOpacity>
);
}
renderNanoCreditList = () => {
const {errorNanoCreditHistory, resultNanoCreditHistory} = this.props;
if (errorNanoCreditHistory !== null) {
if (typeof errorNanoCreditHistory.data !== 'undefined') {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorNanoCreditHistory.data.error}</Text>
</View>
)
} else {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{errorNanoCreditHistory}</Text>
</View>
)
}
}
if (resultNanoCreditHistory !== null) {
if (resultNanoCreditHistory.response !== null) {
return (
Array.isArray(resultNanoCreditHistory.response) && (resultNanoCreditHistory.response.length) > 0 ?
(
<>
<View style={[styles.contentService, {borderBottomColor: Color.primaryColor}]}>
{
nanoCreditHistoryLabel().map((item, index) => (
<View style={{alignItems: 'center'}} key={index}>
<Icon name={item.icon} size={24} color={Color.primaryColor}/>
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{I18n.t(item.label)}
</Text>
</View>
))
}
</View>
{
resultNanoCreditHistory.response.map((item, index) => (
this.renderNanoCreditItem(item, index)
))
}
</>
) :
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'flex-start'}}>
<Text style={Typography.body1}>{I18n.t('NO_NANO_CREDIT')}</Text>
</View>
)
)
}
}
}
renderNanoCreditHistory = () => {
return (
<View style={{backgroundColor: Color.containerBackgroundColor, flex: 1}}>
{
this.props.loadingNanoCreditHistory ?
(
<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>
) : this.renderNanoCreditList()
}
</View>
);
}
render() {
return (
<>
{(this.props.loading || this.props.loadingGetCommission || this.props.loadingNanoCreditHistory) && this.renderLoader()}
{this.state.isDataSubmit && this.renderBreakEpargneRespons()}
{this.state.displayModalHistory && this.renderModalHistoryDetail()}
{this.state.displayPasswordModal && this.renderPasswordDialog()}
<ScrollView style={styles.container}>
<View style={[styles.checkDefault, {borderBottomColor: Color.borderColor}]}>
<Text
style={[Typography.title3, Typography.semibold]}>
{I18n.t('SAVINGS_LIST')}
</Text>
</View>
{
this.renderNanoCreditHistory()
}
}
});
}
ckeckIfFieldIsOK(champ) {
return (isNil(champ) || isEqual(champ.length, 0));
}
renderBreakEpargneRespons = () => {
const { result, error } = this.props;
if (error !== null) {
if (typeof error.data !== 'undefined') {
Alert.alert(
I18n.t("ERROR_LABLE"),
error.data.error,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.casserEpargneUserReset();
}
}
],
{ cancelable: false }
)
}
}
if (result !== null) {
if (result.response !== null) {
Alert.alert(
I18n.t("BREAK_EPARGNE_DONE"),
result.response,
[
{
text: I18n.t("OK"), onPress: () => {
this.props.casserEpargneUserReset();
IlinkEmitter.emit("refreshWallet");
this.props.navigation.pop();
}
}
],
{ cancelable: false }
)
}
}
}
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('REFUND_NANO_CREDIT') })
this.forceUpdate()
}
ckeckIfFieldIsOK(champ) {
return (isNil(champ) || isEqual(champ.length, 0));
}
onSubmitCasserEpargne = () => {
const { idEpargne, password } = this.state;
if (this.ckeckIfFieldIsOK(idEpargne))
this.idEpargneAnim.shake(800);
else if (this.ckeckIfFieldIsOK(password))
this.passwordAnim.shake(800);
else {
this.props.casserEpargneUserAction({
id_user: this.state.user.id,
id_epargne: this.state.idEpargne,
password: this.state.password
}, 0);
}
this.setState({
isDataSubmit: true
});
}
renderLoader = () => {
return (
<ProgressDialog
visible={this.props.loading || this.props.loadingGetCommission}
title={I18n.t('LOADING')}
message={I18n.t('LOADING_INFO')}
/>
)
}
render() {
return (
<>
{(this.props.loading || this.props.loadingGetCommission) && this.renderLoader()}
{this.state.isDataSubmit && this.renderBreakEpargneRespons()}
<ScrollView style={styles.container}>
<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
{/*<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
<Animatable.View ref={(comp) => { idEpargneAnim = comp }}>
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
@ -209,78 +538,178 @@ class CasserEpargneUser extends Component {
<Button style={styles.btnvalide}
textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitCasserEpargne(); }}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>
</ScrollView>
</>
)
}
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
</ScrollView>
</>
)
}
}
const maptStateToProps = state => ({
loading: state.casserEpargneUserReducer.loading,
result: state.casserEpargneUserReducer.result,
error: state.casserEpargneUserReducer.error,
loading: state.casserEpargneUserReducer.loading,
result: state.casserEpargneUserReducer.result,
error: state.casserEpargneUserReducer.error,
errorNanoCreditHistory: state.getEpargneInProgressReducer.error,
resultNanoCreditHistory: state.getEpargneInProgressReducer.result,
loadingNanoCreditHistory: state.getEpargneInProgressReducer.loading,
});
const mapDispatchToProps = dispatch => bindActionCreators({
casserEpargneUserAction,
casserEpargneUserReset,
casserEpargneUserAction,
casserEpargneUserReset,
getEpargneInProgressAction,
getEpargneInProgressReset
}, dispatch);
export default connect(maptStateToProps, mapDispatchToProps)(CasserEpargneUser);
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Color.primaryDarkColor,
},
textbtnvalide: {
color: 'white',
fontWeight: 'bold'
},
bigtitle: {
color: 'white',
fontSize: 20,
flex: 1,
fontWeight: 'bold',
textAlign: 'center',
margin: 20,
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 1
},
subbigtitle: {
color: 'white',
fontSize: 17,
textAlign: 'center',
margin: 5,
},
btnvalide: {
marginTop: 20,
marginLeft: 20,
marginRight: 20,
borderColor: 'transparent',
backgroundColor: Color.accentLightColor,
height: 52
},
btnSubmit: {
marginTop: 20,
borderColor: 'transparent',
backgroundColor: Color.accentLightColor,
height: 52,
width: "30%",
marginLeft: 20,
marginRight: 20,
},
input: {
height: 60,
marginTop: responsiveHeight(2),
marginLeft: responsiveWidth(5),
marginRight: responsiveWidth(5),
borderRadius: 5,
}
container: {
flex: 1,
backgroundColor: Color.containerBackgroundColor,
paddingHorizontal: 20
},
textbtnvalide: {
color: 'white',
fontWeight: 'bold'
},
bigtitle: {
color: 'white',
fontSize: 20,
flex: 1,
fontWeight: 'bold',
textAlign: 'center',
margin: 20,
},
blockView: {
paddingVertical: 10,
borderBottomWidth: 1
},
subbigtitle: {
color: 'white',
fontSize: 17,
textAlign: 'center',
margin: 5,
},
btnvalide: {
marginTop: 20,
marginLeft: 20,
marginRight: 20,
borderColor: 'transparent',
backgroundColor: Color.accentLightColor,
height: 52
},
btnSubmit: {
marginTop: 20,
borderColor: 'transparent',
backgroundColor: Color.accentLightColor,
height: 52,
width: "30%",
marginLeft: 20,
marginRight: 20,
},
input: {
height: 60,
marginTop: responsiveHeight(2),
marginLeft: responsiveWidth(5),
marginRight: responsiveWidth(5),
borderRadius: 5,
},
circlePoint: {
width: 50,
height: 50,
borderRadius: 25,
marginRight: 5,
alignItems: 'center',
justifyContent: 'center',
},
checkDefault: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
borderBottomWidth: 1,
paddingVertical: 10,
marginTop: 5
},
transactionContainer: {
flexDirection: 'row',
paddingTop: 10,
},
containerTouch: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
shadowColor: Color.borderColor,
borderColor: Color.borderColor,
borderWidth: 0.5,
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(65),
paddingHorizontal: 10,
justifyContent: 'space-between',
alignItems: 'flex-start',
flex: 1,
},
contentTitle: {
paddingTop: 12,
},
contentService: {
paddingVertical: 10,
borderBottomWidth: 0.5,
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-between',
},
containField: {
padding: 10,
marginBottom: 20,
borderWidth: 0.5,
shadowOffset: {width: 1.5, height: 1.5},
shadowOpacity: 1.0,
elevation: 5,
flexDirection: "row",
height: 140,
borderRadius: 10
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
borderBottomWidth: 1,
paddingVertical: 5,
width: responsiveWidth(100),
marginBottom: 15
},
iconContent: {
width: 60,
marginRight: 10,
alignItems: "center"
},
contentLeftItem: {
flex: 1,
paddingTop: 40,
paddingLeft: 10,
paddingRight: 10,
alignItems: "center"
},
});

View File

@ -174,7 +174,7 @@ class DemandValidationGroup extends React.Component {
}
renderDemandItem = (item) => {
let dateFormat = moment.tz(item.date_creation_demande, 'Etc/GMT+0').format();
let dateFormat = moment.tz(item.date_creation_demande, moment.tz.guess()).format();
dateFormat = moment(dateFormat).fromNow();
return (

View File

@ -312,8 +312,8 @@ class DemandGroupNanoCreditDetail extends Component {
renderDetail = () => {
const { resultGetUniqueDemand } = this.props;
let ago = moment.tz(resultGetUniqueDemand.response.date_creation_groupe, 'Etc/GMT+0').format();
let dateDemand = moment.tz(resultGetUniqueDemand.response.date_creation_demande, 'Etc/GMT+0').format();
let ago = moment.tz(resultGetUniqueDemand.response.date_creation_groupe, moment.tz.guess()).format();
let dateDemand = moment.tz(resultGetUniqueDemand.response.date_creation_demande, moment.tz.guess()).format();
ago = moment(ago);
dateDemand = moment(dateDemand);

View File

@ -268,7 +268,7 @@ class MyNanoCreditGroup extends Component {
renderDetail = () => {
const { resultGetUniqueDemand } = this.props;
let ago = moment.tz(resultGetUniqueDemand.response.date_creation, 'Etc/GMT+0').format();
let ago = moment.tz(resultGetUniqueDemand.response.date_creation, moment.tz.guess()).format();
ago = moment(ago)
return (<View style={styles.container}>
<CardView

View File

@ -39,7 +39,6 @@ let route = require('../../route.json');
class RefundNanoCreditUser extends Component {
constructor(props) {
super(props);
this.state = {

View File

@ -8,261 +8,280 @@ import 'moment/locale/en-nz';
import 'moment/locale/es-us';
import 'moment/locale/fr';
import React from 'react';
import { Platform, ProgressBarAndroid, ScrollView, StatusBar, StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import {
Platform,
ProgressBarAndroid,
ScrollView,
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
import DeviceInfo from 'react-native-device-info';
import I18n from "react-native-i18n";
import Icon from 'react-native-vector-icons/MaterialIcons';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Color } from '../../config/Color';
import { Typography } from '../../config/typography';
import { readUser } from '../../webservice/AuthApi';
import { getNotificationAction, getNotificationReset } from '../../webservice/OnesignalApi';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {Color} from '../../config/Color';
import {Typography} from '../../config/typography';
import {readUser} from '../../webservice/AuthApi';
import {getNotificationAction, getNotificationReset} from '../../webservice/OnesignalApi';
import BaseScreen from './../BaseScreen';
const theme = require('./../../utils/theme.json');
let moment = require('moment-timezone');
class Notifications extends BaseScreen {
static navigatorStyle = {
navBarBackgroundColor: theme.primaryDark,
navBarTextColor: 'white',
statusBarBackgroundColor: theme.primaryDarkAdvanced,
navBarButtonColor: 'white',
statusBarTextColorScheme: 'light',
};
static navigationOptions = {
headerTitle: I18n.t('NOTIFICATIONS'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'notifications-active'}
size={24}
/>
),
};
constructor(props) {
super(props);
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
static navigatorStyle = {
navBarBackgroundColor: theme.primaryDark,
navBarTextColor: 'white',
statusBarBackgroundColor: theme.primaryDarkAdvanced,
navBarButtonColor: 'white',
statusBarTextColorScheme: 'light',
};
static navigationOptions = {
headerTitle: I18n.t('NOTIFICATIONS'),
drawerIcon: ({tintColor}) => (
<Icon
name={'notifications-active'}
size={24}
/>
),
};
}
constructor(props) {
super(props);
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale);
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') })
this.forceUpdate()
}
}
componentDidMount() {
updateLangue() {
this.props.navigation.setParams({name: I18n.t('WALLET')})
this.forceUpdate()
}
readUser().then((user) => {
if (user) {
if (user !== undefined) {
if (user.category !== undefined) {
if (user.category === "super" || user.category === "geolocated" || user.category === "hyper") {
this.props.getNotificationAction({
agent_code: user.code_membre
});
}
}
else {
this.props.getNotificationAction({
user_code: user.user_code
});
}
componentDidMount() {
readUser().then((user) => {
if (user) {
if (user !== undefined) {
if (user.category !== undefined) {
if (user.category === "super" || user.category === "geolocated" || user.category === "hyper") {
this.props.getNotificationAction({
agent_code: user.code_membre
});
}
} else {
this.props.getNotificationAction({
user_code: user.user_code
});
}
}
});
}
}
});
}
}
getCreationDateToHumanFormat = (date) => {
let re = moment.tz(date, 'Etc/GMT+0').format();
return moment(re).fromNow();
}
getCreationDateToHumanFormat = (date) => {
let re = moment.tz(date, moment.tz.guess()).format();
console.log("Human date", moment(re).fromNow());
return moment(re).fromNow();
}
getNotificationTypeIcon = (notification) => {
switch (notification) {
case 'creation': return 'account-multiple-plus';
case 'demandeSuppressionGroupe': return 'account-multiple-minus';
case 'adhesion': return 'account-multiple-check'
case 'nano_credit': return 'cash'
default: return 'account-multiple'
}
}
getNotificationTypeIcon = (notification) => {
switch (notification) {
case 'creation':
return 'account-multiple-plus';
case 'demandeSuppressionGroupe':
return 'account-multiple-minus';
case 'adhesion':
return 'account-multiple-check'
case 'nano_credit':
return 'cash'
default:
return 'account-multiple'
}
}
getDemandTypeColor = (type) => {
switch (type) {
case 'creation': return 'green';
case 'suppression': return 'red';
case 'adhesion': return Color.primaryColor
case 'nano_credit': return Color.primaryColor
default:
return Color.primaryColor
}
}
getDemandTypeColor = (type) => {
switch (type) {
case 'creation':
return 'green';
case 'suppression':
return 'red';
case 'adhesion':
return Color.primaryColor
case 'nano_credit':
return Color.primaryColor
default:
return Color.primaryColor
}
}
renderNotificationItem = (item) => {
return (
renderNotificationItem = (item) => {
return (
<TouchableOpacity
key={item.id}
style={[styles.paymentItem, { borderBottomColor: Color.borderColor }]}
onPress={() => {
switch (item.data.screen) {
case 'historyItemDetails':
this.props.navigation.navigate(item.data.screen, {
item: item.data.data
});
break;
default:
this.props.navigation.navigate(item.data.screen, {
id: item.data.data.id
});
break;
}
<TouchableOpacity
key={item.id}
style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]}
onPress={() => {
switch (item.data.screen) {
case 'historyItemDetails':
this.props.navigation.navigate(item.data.screen, {
item: item.data.data
});
break;
}}>
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
{/* <View style={styles.iconContent}>
default:
this.props.navigation.navigate(item.data.screen, {
id: item.data.data.id
});
break;
}
}}>
<View style={{flexDirection: 'row', alignItems: 'center'}}>
{/* <View style={styles.iconContent}>
<Image style={{ width: 48, height: 48 }} source={{ uri: icon }} />
</View> */}
<View>
<Text style={Typography.body1}>{item.message}</Text>
<Text style={[Typography.footnote, Color.grayColor]} style={{ marginTop: 5 }}>
{this.getCreationDateToHumanFormat(item.date)}
</Text>
</View>
<View>
<Text style={Typography.body1}>{item.message}</Text>
<Text style={[Typography.footnote, Color.grayColor]} style={{marginTop: 5}}>
{this.getCreationDateToHumanFormat(item.date)}
</Text>
</View>
</TouchableOpacity>
)
}
</View>
</TouchableOpacity>
)
}
renderNotificationList = () => {
renderNotificationList = () => {
const { result, error } = this.props;
if (error !== null) {
if (typeof error.data !== 'undefined') {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={Typography.body1}>{error.data.error}</Text>
</View>
)
}
else {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={Typography.body1}>{error}</Text>
</View>
)
}
}
if (result !== null) {
if (result.response !== null) {
return (
Array.isArray(result.response) && (result.response.length) > 0 ?
(<ScrollView style={{ flex: 1, padding: 20 }}>
{
result.response.map((item) => (
this.renderNotificationItem(item)
))
}
</ScrollView>) :
(
<View style={{ justifyContent: "center", alignItems: 'center', marginTop: 100 }}>
const {result, error} = this.props;
if (error !== null) {
if (typeof error.data !== 'undefined') {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{error.data.error}</Text>
</View>
)
} else {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{error}</Text>
</View>
)
}
}
if (result !== null) {
if (result.response !== null) {
return (
Array.isArray(result.response) && (result.response.length) > 0 ?
(<ScrollView style={{flex: 1, padding: 20}}>
{
result.response.map((item) => (
this.renderNotificationItem(item)
))
}
</ScrollView>) :
(
<View style={{justifyContent: "center", alignItems: 'center', marginTop: 100}}>
<LottieView
style={styles.lottie}
source={require("./../../datas/json/781-no-notifications.json")}
autoPlay
loop
/>
<Text style={styles.text}>{I18n.t('NO_NOTIFICATION')}</Text>
</View>
)
)
}
}
<LottieView
style={styles.lottie}
source={require("./../../datas/json/781-no-notifications.json")}
autoPlay
loop
/>
<Text style={styles.text}>{I18n.t('NO_NOTIFICATION')}</Text>
</View>
)
)
}
}
}
}
renderLoader = () => {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
{Platform.OS === 'android'
?
(
<>
<ProgressBarAndroid />
<Text>{I18n.t('LOADING_DOTS')}</Text>
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>
)
}
</>
) :
<>
<ActivityIndicator size="large" color={'#ccc'}/>
<Text>{I18n.t('LOADING_DOTS')}</Text>
</>
}
</View>
)
}
render() {
return (
<View style={styles.container}>
<StatusBar
backgroundColor="#00000030"
barStyle="light-content"
translucent={false}
/>
render() {
return (
<View style={styles.container}>
<StatusBar
backgroundColor="#00000030"
barStyle="light-content"
translucent={false}
/>
{this.props.loading ?
this.renderLoader() :
this.renderNotificationList()
}
{this.props.loading ?
this.renderLoader() :
this.renderNotificationList()
}
</View>)
}
</View>)
}
}
const mapStateToProps = state => ({
loading: state.getNotificationReducer.loading,
result: state.getNotificationReducer.result,
error: state.getNotificationReducer.error
loading: state.getNotificationReducer.loading,
result: state.getNotificationReducer.result,
error: state.getNotificationReducer.error
});
const mapDispatchToProps = dispatch => bindActionCreators({
getNotificationAction: getNotificationAction,
getNotificationReset: getNotificationReset
getNotificationAction: getNotificationAction,
getNotificationReset: getNotificationReset
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(Notifications);
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white'
},
text: {
fontSize: 17,
fontWeight: 'bold',
},
lottie: {
width: 248,
height: 248
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
borderBottomWidth: 1,
paddingVertical: 5,
width: "100%",
marginBottom: 15
},
iconContent: {
width: 60,
marginRight: 10,
alignItems: "center"
}
container: {
flex: 1,
backgroundColor: 'white'
},
text: {
fontSize: 17,
fontWeight: 'bold',
},
lottie: {
width: 248,
height: 248
},
paymentItem: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
borderBottomWidth: 1,
paddingVertical: 5,
width: "100%",
marginBottom: 15
},
iconContent: {
width: 60,
marginRight: 10,
alignItems: "center"
}
})

View File

@ -8,7 +8,7 @@
import React, {Component} from 'react';
import {Alert, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import {Alert, AsyncStorage, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import {responsiveFontSize, responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import {primary, primaryDarkAdvanced} from './../../utils/theme.json';
@ -582,7 +582,7 @@ export default class OptionsMenu extends Component {
text: I18n.t('YES'), onPress: () => {
disconnect().then(() => {
IlinkEmitter.emit("userdisconnect");
//AsyncStorage.clear();
AsyncStorage.removeItem('@config:onesignalIds');
this.props.navigation.navigate("Auth");
})
}

View File

@ -23,6 +23,7 @@ import {bindActionCreators} from "redux";
import {getBankListAction, getBankListReset} from "../../webservice/BankApi";
import {store} from "../../redux/store";
import {readUser} from "../../webservice/AuthApi";
import {getOperatorListAction, getOperatorListReset} from "../../webservice/WalletApi";
const route = require('../../route.json');
let slugify = require('slugify');
@ -37,19 +38,32 @@ class OperateurOptionSelect extends Component {
options: this.props.navigation.state.params.optionSelect.options,
title: this.props.navigation.state.params.optionSelect.title,
subTitle: this.props.navigation.state.params.optionSelect.subTitle,
operatorType: this.props.navigation.state.params.optionSelect.operatorType,
wallet: store.getState().walletDetailReducer.result.response
}
this.props.getBankListReset();
this.props.getOperatorListReset();
readUser().then((user) => {
if (user) {
if (user !== undefined) {
if (user.category === undefined) {
this.props.getBankListAction(this.state.wallet.id_wallet_network);
if (this.state.options.length > 0) {
if (user.category === undefined)
this.props.getOperatorListAction(this.state.operatorType, this.state.wallet.id_wallet_network)
else {
if (user.category === 'geolocated')
this.props.getOperatorListAction(this.state.operatorType, this.state.wallet.id_network)
}
} else {
if (user.category === 'geolocated')
this.props.getBankListAction(this.state.wallet.id_network);
if (user.category === undefined) {
this.props.getOperatorListAction('bank', this.state.wallet.id_wallet_network)
} else {
if (user.category === 'geolocated')
this.props.getOperatorListAction('bank', this.state.wallet.id_network)
}
}
this.setState({user});
}
}
@ -78,11 +92,20 @@ class OperateurOptionSelect extends Component {
});
redirectToRoute = (item) => {
this.props.navigation.push(item.screen, {
title: item.title,
type: item.type
});
console.log("Redirection");
if (this.state.options.length > 0) {
this.props.navigation.push(this.state.options[0].screen, {
title: this.state.options[0].title,
type: this.state.options[0].type
});
} else {
if (this.state.user.category === 'geolocated')
this.props.navigation.navigate(route.envoieWalletToBankAgent, {bank: item});
else
this.props.navigation.navigate(route.envoieWalletToBankUser, {bank: item});
}
}
renderLoader = () => {
@ -113,10 +136,7 @@ class OperateurOptionSelect extends Component {
key={index}
style={[styles.paymentItem, {borderBottomColor: Color.borderColor}]}
onPress={() => {
if (this.state.user.category === 'geolocated')
this.props.navigation.navigate(route.envoieWalletToBankAgent, {bank: item});
else
this.props.navigation.navigate(route.envoieWalletToBankUser, {bank: item});
this.redirectToRoute(item);
}}>
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<View>
@ -161,7 +181,7 @@ class OperateurOptionSelect extends Component {
</ScrollView>) :
(
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text style={Typography.body1}>{I18n.t('NO_BANK_AVAILABLE')}</Text>
<Text style={Typography.body1}>{I18n.t('NO_OPERATOR_AVAILABLE')}</Text>
</View>
)
)
@ -240,14 +260,11 @@ class OperateurOptionSelect extends Component {
<View style={styles.container}>
{
this.state.options.length > 0 ?
this.renderList()
:
this.props.loading ?
this.renderLoader() :
this.props.result != null ?
this.renderBankList() :
null
this.props.loading ?
this.renderLoader() :
this.props.result != null ?
this.renderBankList() :
null
}
</View>
@ -259,14 +276,18 @@ class OperateurOptionSelect extends Component {
}
const mapStateToProps = state => ({
loading: state.getBankListReducer.loading,
result: state.getBankListReducer.result,
error: state.getBankListReducer.error,
loading: state.getListOperatorReducer.loading,
result: state.getListOperatorReducer.result,
error: state.getListOperatorReducer.error,
});
const mapDispatchToProps = dispatch => bindActionCreators({
getBankListAction,
getBankListReset
getBankListReset,
getOperatorListAction,
getOperatorListReset
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(OperateurOptionSelect);

View File

@ -1,133 +1,139 @@
import React, { Component } from 'react';
import { StatusBar, StyleSheet, View } from 'react-native';
import React, {Component} from 'react';
import {StatusBar, StyleSheet, View} from 'react-native';
import I18n from 'react-native-i18n';
import { Appbar, Provider } from 'react-native-paper';
import {Appbar, Provider} from 'react-native-paper';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { Color } from '../../config/Color';
import { IlinkEmitter } from "../../utils/events";
import {Color} from '../../config/Color';
import {IlinkEmitter} from "../../utils/events";
import OutlineTextInput from '../../components/OutlineTextInput';
import CustomButton from '../../components/CustomButton';
import { ScrollView } from 'react-native-gesture-handler';
import {ScrollView} from 'react-native-gesture-handler';
const route = require('../../route.json');
let slugify = require('slugify');
export default class PaiementFacture extends Component {
constructor(props) {
super(props);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = {
title: this.props.navigation.state.params.title,
type: this.props.navigation.state.params.type,
}
console.log("Paiement facture props", this.props);
constructor(props) {
super(props);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this));
this.state = {
title: this.props.navigation.state.params.title,
type: this.props.navigation.state.params.type,
}
console.log("Paiement facture props", this.props);
}
}
updateLangue() {
this.props.navigation.setParams({ name: I18n.t('WALLET') })
this.forceUpdate();
}
updateLangue() {
this.props.navigation.setParams({name: I18n.t('WALLET')})
this.forceUpdate();
}
static navigationOptions = ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
});
static navigationOptions = ({navigation}) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({tintColor}) => (
<Icon
name={'credit-card'}
size={24}
/>)
});
renderLabel = () => {
const { type } = this.state;
renderLabel = () => {
const {type} = this.state;
switch (type) {
case 'PAIEMENT_ECOLE':
return I18n.t('IDENTIFIANT_ETUDIANT')
case 'PAIEMENT_EAU_ELECTRICITE':
return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_CREDIT_TELEPHONE':
return I18n.t('PHONE_NUMBER')
case 'PAIEMENT_ABONNEMENT_TV':
return I18n.t('NUMERO_ABONNE')
switch (type) {
case 'PAIEMENT_ECOLE':
return I18n.t('IDENTIFIANT_ETUDIANT')
case 'PAIEMENT_EAU':
return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_ELECTRICITE':
return I18n.t('NUMERO_ABONNE')
case 'PAIEMENT_CREDIT_TELEPHONE':
return I18n.t('PHONE_NUMBER')
case 'PAIEMENT_ABONNEMENT_TV':
return I18n.t('NUMERO_ABONNE')
default:
break;
}
}
default:
break;
}
}
render() {
return (
<Provider>
<View style={{ flex: 1 }}>
render() {
return (
<Provider>
<View style={{flex: 1}}>
<StatusBar
backgroundColor={Color.primaryDarkColor}
barStyle="light-content"
translucent={false}
/>
<StatusBar
backgroundColor={Color.primaryDarkColor}
barStyle="light-content"
translucent={false}
/>
<Appbar.Header dark={true} style={{ backgroundColor: Color.primaryColor }}>
<Appbar.BackAction
onPress={() => { this.props.navigation.pop() }}
/>
<Appbar.Content
title={this.state.title}
/>
</Appbar.Header>
<Appbar.Header dark={true} style={{backgroundColor: Color.primaryColor}}>
<Appbar.BackAction
onPress={() => {
this.props.navigation.pop()
}}
/>
<Appbar.Content
title={this.state.title}
/>
</Appbar.Header>
<View style={styles.container}>
<View style={styles.container}>
<ScrollView style={{ padding: 20 }}>
<ScrollView style={{padding: 20}}>
<View style={{ marginTop: 10, marginRight: 20, marginLeft: 20 }}>
<OutlineTextInput
borderBottomColor={'black'}
keyboardType="numeric"
label={this.renderLabel()}
style={{ marginTop: 10 }}
placeholder={this.renderLabel()}
/>
</View>
<View style={{marginTop: 10, marginRight: 20, marginLeft: 20}}>
<OutlineTextInput
borderBottomColor={'black'}
keyboardType="numeric"
label={this.renderLabel()}
style={{marginTop: 10}}
placeholder={this.renderLabel()}
/>
</View>
<View style={{ marginTop: 10, marginRight: 20, marginLeft: 20, marginBottom: 10 }}>
<OutlineTextInput
borderBottomColor={'black'}
keyboardType="numeric"
label={I18n.t('AMOUNT')}
style={{ marginTop: 10 }}
placeholder={I18n.t('AMOUNT_LABEL_DESCRIPTION')}
/>
</View>
<View style={{marginTop: 10, marginRight: 20, marginLeft: 20, marginBottom: 10}}>
<OutlineTextInput
borderBottomColor={'black'}
keyboardType="numeric"
label={I18n.t('AMOUNT')}
style={{marginTop: 10}}
placeholder={I18n.t('AMOUNT_LABEL_DESCRIPTION')}
/>
</View>
<View style={{ margin: 10 }}>
<CustomButton outline onPress={() => { }}>
{I18n.t('VALIDATE')}
</CustomButton>
</View>
<View style={{margin: 10}}>
<CustomButton outline onPress={() => {
}}>
{I18n.t('VALIDATE')}
</CustomButton>
</View>
</ScrollView>
</ScrollView>
</View>
</View>
</Provider>
);
}
</View>
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Color.containerBackgroundColor
},
container: {
flex: 1,
backgroundColor: Color.containerBackgroundColor
},
});

View File

@ -252,7 +252,7 @@ class WalletDetail extends Component {
}
getCreationDateToHumanFormat = (date) => {
let re = moment.tz(date, 'Etc/GMT+0').format();
let re = moment.tz(date, moment.tz.guess()).format();
return moment(re).fromNow();
}

View File

@ -106,14 +106,25 @@ class WalletDetailUser extends Component {
this.props.getWalletDetailActivated(this.props.navigation.state.params.userId, null);
this.props.getUserIdentificationResetAction();
readUser().then((user) => {
console.log("WIIL FOCUS CALL 1");
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getUserIdentificationAction(user.phone);
this.props.getWalletTransactionHistoryUser(user.id);
}
}
});
this.willFocus = this.props.navigation.addListener(
'willFocus',
payload => {
console.log("WIIL FOCUS CALL 2");
readUser().then((user) => {
if (user) {
if (user !== undefined) {
this.setState({user});
this.props.getUserIdentificationAction(user.phone);
this.props.getWalletTransactionHistoryUser(user.id);
}
}
@ -191,7 +202,7 @@ class WalletDetailUser extends Component {
}
getCreationDateToHumanFormat = (date) => {
let re = moment.tz(date, 'Etc/GMT+0').format();
let re = moment.tz(date, moment.tz.guess()).format();
return moment(re).fromNow();
}

View File

@ -369,11 +369,11 @@ export const optionRetraitUserScreen = {
screen: route.retraitCarteVersWalletUser,
icon: 'credit-card',
title: 'WITHDRAWAL_CARD_TO_WALLET',
}, {
}, {
screen: '',
icon: 'credit-card',
title: 'WITHDRAWAL_BANK_TO_WALLET',
}, {
}, {
screen: '',
icon: 'credit-card',
title: 'WITHDRAWAL_BANK_TO_CASH',
@ -401,13 +401,13 @@ export const optionDepotUserScreen = {
icon: 'credit-card',
title: 'DEPOSIT_TO_CARD',
},
{
type: 'WALLET_TO_BANK',
screen: route.operateurOptionSelect,
icon: 'bank-transfer-in',
title: 'DEPOSIT_TO_BANK',
subScreenOption: optionWalletToBank
},
{
type: 'WALLET_TO_BANK',
screen: route.operateurOptionSelect,
icon: 'bank-transfer-in',
title: 'DEPOSIT_TO_BANK',
subScreenOption: optionWalletToBank
},
]
}
@ -515,9 +515,54 @@ export const optionNanoCreditAgentScreen = {
]
}
export const optionPaiementEauElectricite = {
export const optionPaiementEau = {
title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR',
operatorType: 'water',
options: [
{
type: 'PAIEMENT_EAU',
screen: route.paiementFacture,
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur eau-électricité 1',
},
{
type: 'PAIEMENT_EAU',
screen: route.paiementFacture,
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur eau-électricité 2',
},
{
type: 'PAIEMENT_EAU',
screen: route.paiementFacture,
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur eau-électricité 3',
},
{
type: 'PAIEMENT_EAU',
screen: route.paiementFacture,
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur eau-électricité 4',
},
{
type: 'PAIEMENT_EAU',
screen: route.paiementFacture,
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur eau-électricité 5',
},
{
type: 'PAIEMENT_EAU',
screen: route.paiementFacture,
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
title: 'Opérateur eau-électricité 6',
},
]
}
export const optionPaiementElectricite = {
title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR',
operatorType: 'electricity',
options: [
{
type: 'PAIEMENT_EAU_ELECTRICITE',
@ -561,6 +606,7 @@ export const optionPaiementEauElectricite = {
export const optionPaiementCreditTelephonique = {
title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR',
operatorType: 'phone',
options: [
{
type: 'PAIEMENT_CREDIT_TELEPHONE',
@ -604,6 +650,7 @@ export const optionPaiementCreditTelephonique = {
export const optionPaiementAbonnementTV = {
title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR',
operatorType: 'tv',
options: [
{
type: 'PAIEMENT_ABONNEMENT_TV',
@ -647,6 +694,7 @@ export const optionPaiementAbonnementTV = {
export const optionPaiementEcole = {
title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR',
operatorType: 'school',
options: [
{
type: 'PAIEMENT_ECOLE',
@ -695,9 +743,16 @@ export const optionPaiementFacture = {
{
type: 'FACTURE_WATER_ELECTRICITY',
icon: 'water',
title: 'PAIEMENT_EAU_ELECTRICITY',
title: 'PAIEMENT_EAU',
screen: route.operateurOptionSelect,
subScreenOption: optionPaiementEauElectricite
subScreenOption: optionPaiementEau
},
{
type: 'FACTURE_ELECTRICITY',
icon: 'water',
title: 'PAIEMENT_ELECTRICITY',
screen: route.operateurOptionSelect,
subScreenOption: optionPaiementElectricite
},
{
type: 'FACTURE_SCHOOL',

View File

@ -36,6 +36,7 @@
"MY_ACCOUNT": "My account",
"WALLET": "Wallet",
"NO_BANK_AVAILABLE": "No bank available",
"NO_OPERATOR_AVAILABLE": "No operator available",
"ENTER_VALID_AMOUNT": "Enter a valid amount",
"ENTER_AMOUNT_SUPERIOR_ZEROR": "Enter amount superior to zero",
"AMOUNT_SUPERIOR_TO_PRINCIPAL_ACCOUNT": "Amount greater than that of the agent's main account",
@ -158,6 +159,7 @@
"DEPOSIT_TO_BANK": "Your Wallet to bank",
"NANO_CREDIT": "Nano credit",
"NANO_CREDIT_LIST": "Nano credit list",
"SAVINGS_LIST": "Savings list",
"NO_NANO_CREDIT": "No nano credit demand",
"NANO_CREDIT_DESCRIPTION": "Nano credit description",
"NANO_SANTE": "Nano health",
@ -172,7 +174,8 @@
"CAUTIONNEMENT_DONE": "Caution done",
"ID_DEMAND": "Demand ID",
"DATE": "Date",
"PAIEMENT_EAU_ELECTRICITY": "Water/electricity bill",
"PAIEMENT_EAU_ELECTRICITY": "Water bill",
"PAIEMENT_ELECTRICITY": "Electricity bill",
"PAIEMENT_ECOLE": "School fees",
"PAIEMENT_CREDIT_TELEPHONIQUE": "Phone credit bills",
"PAIEMENT_ABONNEMENT_TV": "TV subscription",
@ -180,6 +183,7 @@
"DATE_REMBOURSEMENT_PREVU": "Expected refund date",
"DATE_REMBOURSEMENT": "Refund date",
"AMOUNT_REFUND": "Amount reimbursed",
"AMOUNT_WITHDRAWAL": "Amount withdrawal",
"AMOUNT_PARTIALLY_REFUND": "Amount partially refunded",
"FINAL_DATE": "End date",
"CASSATION_DATE": "Cassation date",

View File

@ -39,6 +39,7 @@
"DESTINATAIRE": "Destinataire",
"ERROR_LABEL": "Erreur",
"NO_BANK_AVAILABLE": "Aucune banque disponible",
"NO_OPERATOR_AVAILABLE": "Aucun opérateur disponible",
"DEPOSIT_SUCCESS": "Dépôt effectué avec succès",
"SUCCESS": "Succès",
"ETAT": "Etat",
@ -165,6 +166,7 @@
"DEPOSIT_TO_BANK": "Votre Wallet vers banque",
"NANO_CREDIT": "Nano crédit",
"NANO_CREDIT_LIST": "Liste des nano crédit",
"SAVINGS_LIST": "Liste des épargnes",
"NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
"NANO_SANTE": "Nano santé",
@ -178,7 +180,8 @@
"CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande",
"PAIEMENT_EAU_ELECTRICITY": "Paiement eau/électricité",
"PAIEMENT_EAU": "Paiement eau",
"PAIEMENT_ELECTRICITY": "Paiement électricité",
"PAIEMENT_ECOLE": "Paiement école",
"PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique",
"PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV",
@ -187,6 +190,7 @@
"DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu",
"DATE_REMBOURSEMENT": "Date de remboursement",
"AMOUNT_REFUND": "Montant remboursé",
"AMOUNT_WITHDRAWAL": "Montant retiré",
"AMOUNT_PARTIALLY_REFUND": "Montant partiellement remboursé",
"FINAL_DATE": "Date de fin",
"CASSATION_DATE": "Date de cassation",

View File

@ -72,6 +72,7 @@ export const getHyperviseurHistoriqueUrl = testBaseUrl + '/walletService/wallets
export const getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank';
export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress';
export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/demands_in_progress';
export const getOperatorListUrl = testBaseUrl + '/walletService/wallets/users/operators';
export const authKeyUrl = testBaseUrl + '/oauth/token';
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";

View File

@ -33,7 +33,7 @@ import {
import {store} from "../redux/store";
import {
askNanoCreditUrl,
cancelDemandUrl,
cancelDemandUrl, getHistoryEpargnePendingUrl,
getHistoryNanoPendingCreditUrl,
getNanoCreditDemandDureationUrl,
groupUrl,
@ -282,9 +282,8 @@ export const getEpargneInProgressAction = (data) => {
dispatch(fetchGetEpargneInProgressPending());
axios({
url: `${getHistoryNanoPendingCreditUrl}`,
method: 'POST',
data,
url: `${getHistoryEpargnePendingUrl}/${data}`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()

View File

@ -1,169 +1,228 @@
import { walletActionUrl, commissionAmount, walletDetailUrl, walletUserSimpleActionUrl, linkCardUrl } from "./IlinkConstants";
import {
fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError, fetchWalletListReset,
fetchWalletListDetailPending, fetchWalletListDetailSuccess, fetchWalletListDetailError, fetchWalletListDetailReset,
fetchWalletGetCommissionPending, fetchWalletGetCommissionSuccess, fetchWalleGetCommissionError, walletGetCommissionReset,
fetchLinkCardPending, fetchLinkCardSuccess, fetchLinkCardError, fetchLinkCardReset
commissionAmount,
getOperatorListUrl,
linkCardUrl,
walletActionUrl,
walletDetailUrl,
walletUserSimpleActionUrl
} from "./IlinkConstants";
import {
fetchGetListOperatorError,
fetchGetListOperatorPending,
fetchGetListOperatorReset,
fetchGetListOperatorSuccess,
fetchLinkCardError,
fetchLinkCardPending,
fetchLinkCardReset,
fetchLinkCardSuccess,
fetchWalleGetCommissionError,
fetchWalletGetCommissionPending,
fetchWalletGetCommissionSuccess,
fetchWalletListDetailError,
fetchWalletListDetailPending,
fetchWalletListDetailReset,
fetchWalletListDetailSuccess,
fetchWalletListError,
fetchWalletListPending,
fetchWalletListReset,
fetchWalletListSuccess,
walletGetCommissionReset
} from "../redux/actions/WalletActions";
import { store } from "../redux/store";
import {store} from "../redux/store";
import axios from "axios";
import I18n from 'react-native-i18n'
export const getWalletActivated = (userID) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchWalletListPending());
return dispatch => {
dispatch(fetchWalletListPending());
axios({
url: `${walletActionUrl}/${userID}/activated`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchWalletListSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchWalletListError(error.response));
else if (error.request)
dispatch(fetchWalletListError(error.request))
else
dispatch(fetchWalletListError(error.message))
});
}
axios({
url: `${walletActionUrl}/${userID}/activated`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchWalletListSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchWalletListError(error.response));
else if (error.request)
dispatch(fetchWalletListError(error.request))
else
dispatch(fetchWalletListError(error.message))
});
}
}
export const resetWalletListReducer = () => {
return dispatch => {
dispatch(fetchWalletListReset());
}
return dispatch => {
dispatch(fetchWalletListReset());
}
}
export const getWalletDetailActivated = (id, isAgentCall) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
console.log("isAgentCall", isAgentCall);
let url = null;
if (isAgentCall === null)
url = `${walletUserSimpleActionUrl}/${id}`;
else if (isAgentCall === false)
url = `${walletDetailUrl}/${id}`;
else
url = `${walletActionUrl}/${id}/activated`;
console.log("isAgentCall", isAgentCall);
let url = null;
if (isAgentCall === null)
url = `${walletUserSimpleActionUrl}/${id}`;
else if (isAgentCall === false)
url = `${walletDetailUrl}/${id}`;
else
url = `${walletActionUrl}/${id}/activated`;
return dispatch => {
dispatch(fetchWalletListDetailPending());
return dispatch => {
dispatch(fetchWalletListDetailPending());
axios({
url,
method: 'GET',
headers: {
'Authorization': authKey
}
})
.then(response => {
console.log("RESPONSE", response);
dispatch(fetchWalletListDetailSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchWalletListDetailError(error.response));
else if (error.request)
dispatch(fetchWalletListDetailError(error.request))
else
dispatch(fetchWalletListDetailError(error.message))
});
}
axios({
url,
method: 'GET',
headers: {
'Authorization': authKey
}
})
.then(response => {
console.log("RESPONSE", response);
dispatch(fetchWalletListDetailSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchWalletListDetailError(error.response));
else if (error.request)
dispatch(fetchWalletListDetailError(error.request))
else
dispatch(fetchWalletListDetailError(error.message))
});
}
}
export const resetWalletListDetailReducer = () => {
return dispatch => {
dispatch(fetchWalletListDetailReset());
}
return dispatch => {
dispatch(fetchWalletListDetailReset());
}
}
export const getWalletCommissionAmount = (data) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchWalletGetCommissionPending());
return dispatch => {
dispatch(fetchWalletGetCommissionPending());
axios({
url: `${commissionAmount}`,
method: 'POST',
headers: {
'Authorization': authKey
},
data
})
.then(response => {
console.log(response);
dispatch(fetchWalletGetCommissionSuccess(response));
})
.catch(error => {
console.log(error);
dispatch(fetchWalleGetCommissionError(error.message));
if (error.response)
dispatch(fetchWalleGetCommissionError(error.response));
else if (error.request)
dispatch(fetchWalleGetCommissionError(error.request))
else
dispatch(fetchWalleGetCommissionError(error.message))
});
}
axios({
url: `${commissionAmount}`,
method: 'POST',
headers: {
'Authorization': authKey
},
data
})
.then(response => {
console.log(response);
dispatch(fetchWalletGetCommissionSuccess(response));
})
.catch(error => {
console.log(error);
dispatch(fetchWalleGetCommissionError(error.message));
if (error.response)
dispatch(fetchWalleGetCommissionError(error.response));
else if (error.request)
dispatch(fetchWalleGetCommissionError(error.request))
else
dispatch(fetchWalleGetCommissionError(error.message))
});
}
}
export const walletCommissionAmountReset = () => {
return dispatch => {
dispatch(walletGetCommissionReset());
}
return dispatch => {
dispatch(walletGetCommissionReset());
}
}
export const linkCardAction = (data, userID) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchLinkCardPending());
return dispatch => {
dispatch(fetchLinkCardPending());
axios({
url: `${linkCardUrl}/${userID}`,
data,
method: 'POST',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchLinkCardSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchLinkCardError(error.response));
else if (error.request)
dispatch(fetchLinkCardError(error.request))
else
dispatch(fetchLinkCardError(error.message))
});
}
axios({
url: `${linkCardUrl}/${userID}`,
data,
method: 'POST',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchLinkCardSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchLinkCardError(error.response));
else if (error.request)
dispatch(fetchLinkCardError(error.request))
else
dispatch(fetchLinkCardError(error.message))
});
}
}
export const linkCardReset = () => {
return dispatch => {
dispatch(fetchLinkCardReset());
}
return dispatch => {
dispatch(fetchLinkCardReset());
}
}
export const getOperatorListAction = (typeOperator, idNetworkWallet) => {
const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
return dispatch => {
dispatch(fetchGetListOperatorPending());
axios({
url: `${getOperatorListUrl}/${typeOperator}/${idNetworkWallet}`,
method: 'GET',
headers: {
'Authorization': authKey,
'X-Localization': I18n.currentLocale()
}
})
.then(response => {
console.log(response);
dispatch(fetchGetListOperatorSuccess(response));
})
.catch(error => {
if (error.response)
dispatch(fetchGetListOperatorError(error.response));
else if (error.request)
dispatch(fetchGetListOperatorError(error.request))
else
dispatch(fetchGetListOperatorError(error.message))
});
}
}
export const getOperatorListReset = () => {
return dispatch => {
dispatch(fetchGetListOperatorReset());
}
}