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

View File

@ -1,176 +1,176 @@
import { import {
WALLET_LIST_PENDING, GET_OPERATOR_LIST_ERROR,
WALLET_LIST_SUCCESS, GET_OPERATOR_LIST_PENDING,
WALLET_LIST_ERROR, GET_OPERATOR_LIST_RESET,
WALLET_HISTORY_PENDING, GET_OPERATOR_LIST_SUCCESS,
WALLET_HISTORY_SUCCESS, LINK_CARD_ERROR,
WALLET_HISTORY_ERROR, LINK_CARD_PENDING,
WALLET_TRANSFER_COMMISSION_PENDING, LINK_CARD_RESET,
WALLET_TRANSFER_COMMISSION_SUCCESS, LINK_CARD_SUCCESS,
WALLET_TRANSFER_COMMISSION_ERROR, WALLET_GET_COMMISSION_ERROR,
WALLET_TRANSFER_COMMISSION_RESET, WALLET_GET_COMMISSION_PENDING,
WALLET_HISTORY_RESET, WALLET_GET_COMMISSION_RESET,
WALLET_LIST_DETAIL_RESET, WALLET_GET_COMMISSION_SUCCESS,
WALLET_LIST_DETAIL_ERROR, WALLET_HISTORY_ERROR,
WALLET_LIST_DETAIL_PENDING, WALLET_HISTORY_HYPER_SUPER__ERROR,
WALLET_LIST_DETAIL_SUCCESS, WALLET_HISTORY_HYPER_SUPER__RESET,
WALLET_GET_COMMISSION_PENDING, WALLET_HISTORY_HYPER_SUPER__SUCCESS,
WALLET_GET_COMMISSION_SUCCESS, WALLET_HISTORY_HYPER_SUPER_PENDING,
WALLET_GET_COMMISSION_ERROR, WALLET_HISTORY_PENDING,
WALLET_GET_COMMISSION_RESET, WALLET_HISTORY_RESET,
WALLET_GET_RETREAIT_COMMISSION_PENDING, WALLET_HISTORY_SUCCESS,
WALLET_GET_RETREAIT_COMMISSION_SUCCESS, WALLET_LIST_DETAIL_ERROR,
WALLET_GET_RETREAIT_COMMISSION_ERROR, WALLET_LIST_DETAIL_PENDING,
WALLET_GET_RETREAIT_COMMISSION_RESET, WALLET_LIST_DETAIL_RESET,
LINK_CARD_PENDING, WALLET_LIST_DETAIL_SUCCESS,
LINK_CARD_RESET, WALLET_LIST_ERROR,
LINK_CARD_SUCCESS, WALLET_LIST_PENDING,
LINK_CARD_ERROR, WALLET_LIST_SUCCESS,
WALLET_HISTORY_HYPER_SUPER_PENDING, WALLET_TRANSFER_COMMISSION_ERROR,
WALLET_HISTORY_HYPER_SUPER__SUCCESS, WALLET_TRANSFER_COMMISSION_PENDING,
WALLET_HISTORY_HYPER_SUPER__ERROR, WALLET_TRANSFER_COMMISSION_RESET,
WALLET_HISTORY_HYPER_SUPER__RESET WALLET_TRANSFER_COMMISSION_SUCCESS
} from "../types/WalletType"; } from "../types/WalletType";
export const fetchWalletListPending = () => ({ export const fetchWalletListPending = () => ({
type: WALLET_LIST_PENDING type: WALLET_LIST_PENDING
}); });
export const fetchWalletListSuccess = (res) => ({ export const fetchWalletListSuccess = (res) => ({
type: WALLET_LIST_SUCCESS, type: WALLET_LIST_SUCCESS,
result: res, result: res,
}); });
export const fetchWalletListError = (error) => ({ export const fetchWalletListError = (error) => ({
type: WALLET_LIST_ERROR, type: WALLET_LIST_ERROR,
result: error result: error
}); });
export const fetchWalletListReset = (error) => ({ export const fetchWalletListReset = (error) => ({
type: WALLET_LIST_RESET, type: WALLET_LIST_RESET,
result: error result: error
}); });
/** /**
* --------------------------------------------------- * ---------------------------------------------------
*/ */
export const fetchWalletListDetailPending = () => ({ export const fetchWalletListDetailPending = () => ({
type: WALLET_LIST_DETAIL_PENDING type: WALLET_LIST_DETAIL_PENDING
}); });
export const fetchWalletListDetailSuccess = (res) => ({ export const fetchWalletListDetailSuccess = (res) => ({
type: WALLET_LIST_DETAIL_SUCCESS, type: WALLET_LIST_DETAIL_SUCCESS,
result: res, result: res,
}); });
export const fetchWalletListDetailError = (error) => ({ export const fetchWalletListDetailError = (error) => ({
type: WALLET_LIST_DETAIL_ERROR, type: WALLET_LIST_DETAIL_ERROR,
result: error result: error
}); });
export const fetchWalletListDetailReset = (error) => ({ export const fetchWalletListDetailReset = (error) => ({
type: WALLET_LIST_DETAIL_RESET, type: WALLET_LIST_DETAIL_RESET,
result: error result: error
}); });
/** /**
* --------------------------------------------------- * ---------------------------------------------------
*/ */
export const fetchWalletHistoryPending = () => ({ export const fetchWalletHistoryPending = () => ({
type: WALLET_HISTORY_PENDING type: WALLET_HISTORY_PENDING
}); });
export const fetchWalletHistoryReset = () => ({ export const fetchWalletHistoryReset = () => ({
type: WALLET_HISTORY_RESET type: WALLET_HISTORY_RESET
}); });
export const fetchWalletHistorySuccess = (res) => ({ export const fetchWalletHistorySuccess = (res) => ({
type: WALLET_HISTORY_SUCCESS, type: WALLET_HISTORY_SUCCESS,
result: res, result: res,
}); });
export const fetchWalletHistoryError = (error) => ({ export const fetchWalletHistoryError = (error) => ({
type: WALLET_HISTORY_ERROR, type: WALLET_HISTORY_ERROR,
result: error result: error
}); });
/** /**
* --------------------------------------------------- * ---------------------------------------------------
*/ */
export const fetchWalletHistoryHyperSuperPending = () => ({ export const fetchWalletHistoryHyperSuperPending = () => ({
type: WALLET_HISTORY_HYPER_SUPER_PENDING type: WALLET_HISTORY_HYPER_SUPER_PENDING
}); });
export const fetchWalletHistoryHyperSuperReset = () => ({ export const fetchWalletHistoryHyperSuperReset = () => ({
type: WALLET_HISTORY_HYPER_SUPER__RESET type: WALLET_HISTORY_HYPER_SUPER__RESET
}); });
export const fetchWalletHistoryHyperSuperSuccess = (res) => ({ export const fetchWalletHistoryHyperSuperSuccess = (res) => ({
type: WALLET_HISTORY_HYPER_SUPER__SUCCESS, type: WALLET_HISTORY_HYPER_SUPER__SUCCESS,
result: res, result: res,
}); });
export const fetchWalletHistoryHyperSuperError = (error) => ({ export const fetchWalletHistoryHyperSuperError = (error) => ({
type: WALLET_HISTORY_HYPER_SUPER__ERROR, type: WALLET_HISTORY_HYPER_SUPER__ERROR,
result: error result: error
}); });
/** /**
* --------------------------------------------------- * ---------------------------------------------------
*/ */
export const fetchWalletTransferCommissionPending = () => ({ export const fetchWalletTransferCommissionPending = () => ({
type: WALLET_TRANSFER_COMMISSION_PENDING type: WALLET_TRANSFER_COMMISSION_PENDING
}); });
export const walletTransferCommissionReset = () => ({ export const walletTransferCommissionReset = () => ({
type: WALLET_TRANSFER_COMMISSION_RESET type: WALLET_TRANSFER_COMMISSION_RESET
}); });
export const fetchWalletTransferCommissionSuccess = (res) => ({ export const fetchWalletTransferCommissionSuccess = (res) => ({
type: WALLET_TRANSFER_COMMISSION_SUCCESS, type: WALLET_TRANSFER_COMMISSION_SUCCESS,
result: res, result: res,
}); });
export const fetchWalletTransferCommssionError = (error) => ({ export const fetchWalletTransferCommssionError = (error) => ({
type: WALLET_TRANSFER_COMMISSION_ERROR, type: WALLET_TRANSFER_COMMISSION_ERROR,
result: error result: error
}); });
/** /**
* --------------------------------------------------- * ---------------------------------------------------
*/ */
export const fetchWalletGetCommissionPending = () => ({ export const fetchWalletGetCommissionPending = () => ({
type: WALLET_GET_COMMISSION_PENDING type: WALLET_GET_COMMISSION_PENDING
}); });
export const walletGetCommissionReset = () => ({ export const walletGetCommissionReset = () => ({
type: WALLET_GET_COMMISSION_RESET type: WALLET_GET_COMMISSION_RESET
}); });
export const fetchWalletGetCommissionSuccess = (res) => ({ export const fetchWalletGetCommissionSuccess = (res) => ({
type: WALLET_GET_COMMISSION_SUCCESS, type: WALLET_GET_COMMISSION_SUCCESS,
result: res, result: res,
}); });
export const fetchWalleGetCommissionError = (error) => ({ export const fetchWalleGetCommissionError = (error) => ({
type: WALLET_GET_COMMISSION_ERROR, type: WALLET_GET_COMMISSION_ERROR,
result: error result: error
}); });
/** /**
* --------------------------------------------------- * ---------------------------------------------------
*/ */
export const fetchLinkCardPending = () => ({ export const fetchLinkCardPending = () => ({
type: LINK_CARD_PENDING type: LINK_CARD_PENDING
}); });
export const fetchLinkCardReset = () => ({ export const fetchLinkCardReset = () => ({
type: LINK_CARD_RESET type: LINK_CARD_RESET
}); });
export const fetchLinkCardSuccess = (res) => ({ export const fetchLinkCardSuccess = (res) => ({
type: LINK_CARD_SUCCESS, type: LINK_CARD_SUCCESS,
result: res, result: res,
}); });
export const fetchLinkCardError = (error) => ({ export const fetchLinkCardError = (error) => ({
type: LINK_CARD_ERROR, type: LINK_CARD_ERROR,
result: error result: error
}); });
/* export const fetchWalletGetRetraitCommissionPending = () => ({ /* export const fetchWalletGetRetraitCommissionPending = () => ({
@ -189,4 +189,25 @@ export const fetchWalletGetRetraitCommissionSuccess = (res) => ({
export const fetchWalleGetRetraitCommissionError = (error) => ({ export const fetchWalleGetRetraitCommissionError = (error) => ({
type: WALLET_GET_RETREAIT_COMMISSION_ERROR, type: WALLET_GET_RETREAIT_COMMISSION_ERROR,
result: 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 EnvoieUserWalletToBank from "./EnvoieUserWalletToBankReducer";
import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer"; import GetEpargneInProgressReducer from "./GetEpargneInProgressReducer";
import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer"; import GetNanoCreditUserHistoryInProgressReducer from "./GetNanoCreditUserHistoryInProgressReducer";
import GetListOperatorReducer from "./GetListOperatorReducer";
const persistConfig = { const persistConfig = {
key: 'root', key: 'root',
@ -100,7 +101,8 @@ const rootReducer = persistCombineReducers(persistConfig, {
getBankListReducer: GetBankListReducer, getBankListReducer: GetBankListReducer,
envoieUserWalletToBank: EnvoieUserWalletToBank, envoieUserWalletToBank: EnvoieUserWalletToBank,
getEpargneInProgressReducer: GetEpargneInProgressReducer, getEpargneInProgressReducer: GetEpargneInProgressReducer,
getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer getNanoCreditUserHistoryInProgressReducer: GetNanoCreditUserHistoryInProgressReducer,
getListOperatorReducer: GetListOperatorReducer
}); });
export default rootReducer; 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_PENDING = 'LINK_CARD_PENDING';
export const LINK_CARD_SUCCESS = 'LINK_CARD_SUCCESS'; export const LINK_CARD_SUCCESS = 'LINK_CARD_SUCCESS';
export const LINK_CARD_ERROR = 'LINK_CARD_ERROR'; 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) { 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(); re = moment(re).fromNow();
if (true) { if (true) {
return ( return (

View File

@ -1,11 +1,7 @@
import React, { Component, PureComponent } from 'react'; import React, {PureComponent} from 'react';
import PropTypes from 'prop-types'; import {FlatList, RefreshControl, SectionList, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import { StyleSheet, Text, View, FlatList, TouchableOpacity, SectionList, RefreshControl } from 'react-native'; import {responsiveFontSize, responsiveWidth} from 'react-native-responsive-dimensions';
import { responsiveFontSize, responsiveWidth, responsiveHeight } from 'react-native-responsive-dimensions';
import { convertDateToHumanText } from './../../utils/DateUtils';
import Icon from 'react-native-vector-icons/FontAwesome5'; import Icon from 'react-native-vector-icons/FontAwesome5';
var moment = require('moment-timezone')
const momentJS = require('moment')
import I18n from "react-native-i18n" import I18n from "react-native-i18n"
import 'moment/locale/fr' import 'moment/locale/fr'
@ -18,276 +14,316 @@ import 'moment/locale/en-nz'
import 'moment/locale/en-gb' import 'moment/locale/en-gb'
import DeviceInfo from 'react-native-device-info' 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'); let route = require('./../../route.json');
var theme = require('./../../utils/theme.json'); var theme = require('./../../utils/theme.json');
export class HistoryItem extends React.Component { export class HistoryItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = this.initState(); this.state = this.initState();
} }
statusLabel = (status) => { statusLabel = (status) => {
switch (status) { switch (status) {
case '0': return I18n.t('NO_TREAT'); case '0':
case '1': return I18n.t('TREAT'); return I18n.t('NO_TREAT');
case '2': return I18n.t('REFUSED'); case '1':
} return I18n.t('TREAT');
} case '2':
return I18n.t('REFUSED');
}
}
colorLabel = (status) => { colorLabel = (status) => {
switch (status) { switch (status) {
case '0': return Color.accentColor; case '0':
case '1': return Color.greenColor; return Color.accentColor;
case '2': return Color.redColor; case '1':
} return Color.greenColor;
} case '2':
return Color.redColor;
}
}
descriptionLabelUserType = (user) => { descriptionLabelUserType = (user) => {
console.log("USER") let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau;
let textDescription = (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ' + this.props.selfData.reseau;
switch (user.category) { switch (user.category) {
case 'geolocated': return `${I18n.t('DEMAND_TEXT_FIRST_PART_YOU')} ${textDescription}`; case 'geolocated':
case 'super': return this.props.isDemandSend ? 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('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}`; `${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() { initState() {
var textTitle = ' Transaction ' + this.props.selfData.id; var textTitle = ' Transaction ' + this.props.selfData.id;
var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' '; var textDescription = I18n.t('PHONE') + ' ' + this.props.selfData.phone + " " + I18n.t('DEMAND_TEXT_FIRST_PART') + ' ' + (this.props.selfData.montant) + ' ' + I18n.t('TO_') + ' ';
textDescription += this.props.selfData.reseau; textDescription += this.props.selfData.reseau;
var today = new Date(); var today = new Date();
var l = this.props.selfData.date_creation; var l = this.props.selfData.date_creation;
let t = this.props.selfData.status; let t = this.props.selfData.status;
this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb"; this.currentLocale = DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : "en-gb";
moment.locale(this.currentLocale); moment.locale(this.currentLocale);
var re = moment.tz(this.props.selfData.date_creation, 'Etc/GMT+0').format(); var re = moment.tz(this.props.selfData.date_creation, moment.tz.guess()).format();
re = moment(re) re = moment(re)
return { return {
title: textTitle, title: textTitle,
description: this.descriptionLabelUserType(this.props.user), description: this.descriptionLabelUserType(this.props.user),
status: this.statusLabel(this.props.selfData.status), status: this.statusLabel(this.props.selfData.status),
time: re.fromNow(), time: re.fromNow(),
navigator: this.props.navigator, navigator: this.props.navigator,
type: t, type: t,
colorstate: this.colorLabel(t) colorstate: this.colorLabel(t)
} }
}; };
render() { render() {
console.log("ITEM RENDER", this.props.selfData) console.log("ITEM RENDER", this.props.selfData)
return ( return (
<TouchableOpacity onPress={() => <TouchableOpacity onPress={() =>
this.props.navigator.navigate(route.historyItemDetails, { this.props.navigator.navigate(route.historyItemDetails, {
item: this.props.selfData, item: this.props.selfData,
onGoBack: () => this.props.refresh(), onGoBack: () => this.props.refresh(),
} }
)}>
<View style={style.content}>
<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.statusLabel(this.props.selfData.status)}</Text>
<View style={style.content}> <Text style={style.time}>{this.state.time}</Text>
<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} />
</View> </View>
</TouchableOpacity> <View style={style.bottomSeparator}/>
)
} </View>
</TouchableOpacity>
)
}
} }
export class HistoryItemSectionned extends PureComponent { export class HistoryItemSectionned extends PureComponent {
_keyExtractor = (item, index) => item.id; _keyExtractor = (item, index) => item.id;
_renderItem = ({ item }) => ( _renderItem = ({item}) => (
<HistoryItem <HistoryItem
navigator={this.props.navigator} navigator={this.props.navigator}
selfData={item} selfData={item}
/> />
); );
constructor(props) {
super(props);
this.state = this.initState();
}
render() {
return (
<SectionList constructor(props) {
sections={[ super(props);
{ title: 'Demande traité', type: 0, data: this.state.treat, size: this.state.conservetreat.length, expandState: this.state.istreatexpand }, this.state = this.initState();
{ 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 })
} render() {
} return (
initState() {
let data = this.props.list
return { <SectionList
conservetreat: data.filter(item => item.statut === I18n.t('TREAT')), sections={[
treat: data.filter(item => item.statut === I18n.t('TREAT')), {
istreatexpand: true, title: 'Demande traité',
conserveuntreat: data.filter(item => item.statut !== I18n.t('TREAT')), type: 0,
untreat: data.filter(item => item.statut !== I18n.t('TREAT')), data: this.state.treat,
isuntreatexpand: true size: this.state.conservetreat.length,
} expandState: this.state.istreatexpand
} },
} {
export class HistoryListItem extends React.Component { title: 'Demande non traité',
_keyExtractor = (item, index) => item.id; type: 1,
data: this.state.untreat,
_onPressItem = (id: string) => { size: this.state.conserveuntreat.length,
expandState: this.state.isuntreatexpand
};
_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}
/>
} }
/> ]}
); 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() { onPressedHeader(type) {
this.setState({ refreshing: true }) if (type === 0) {
setTimeout(() => { this.setState({ refreshing: false }) }, 5000); 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({ const style = StyleSheet.create({
content: { content: {
width: responsiveWidth(100), width: responsiveWidth(100),
borderBottomColor: '#FFFFFF', borderBottomColor: '#FFFFFF',
flex: 1, flex: 1,
flexDirection: 'column', flexDirection: 'column',
paddingTop: 10, paddingTop: 10,
}, },
listStyle: { listStyle: {
backgroundColor: 'white' backgroundColor: 'white'
}, },
bottomSeparator: { bottomSeparator: {
width: responsiveWidth(100), width: responsiveWidth(100),
height: 5, height: 5,
justifyContent: 'center', justifyContent: 'center',
alignSelf: 'center', alignSelf: 'center',
backgroundColor: '#EEE', backgroundColor: '#EEE',
}, },
title: { title: {
color: '#000', color: '#000',
paddingLeft: 10, paddingLeft: 10,
fontSize: responsiveFontSize(2.2) fontSize: responsiveFontSize(2.2)
}, },
description: { description: {
fontSize: responsiveFontSize(1.8), fontSize: responsiveFontSize(1.8),
color: '#4f5b62', color: '#4f5b62',
paddingLeft: 10, paddingLeft: 10,
}, },
timeContent: { timeContent: {
justifyContent: 'space-between', justifyContent: 'space-between',
flex: 1, flex: 1,
marginTop: 10, marginTop: 10,
marginBottom: 5, marginBottom: 5,
flexDirection: 'row', flexDirection: 'row',
}, },
time: { time: {
fontWeight: 'bold', fontWeight: 'bold',
marginRight: 20, marginRight: 20,
marginBottom: 10, marginBottom: 10,
color: theme.accent, color: theme.accent,
}, },
treat: { 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.getAllKeys((err, keys) => {
AsyncStorage.multiGet(keys, (err, stores) => { AsyncStorage.multiGet(keys, (err, stores) => {
stores.map(async (result, i, store) => { stores.map(async (result, i, store) => {
/* console.warn("KEY MAP", store); console.warn("KEY MAP", store);
console.log("KEY SAVE " + store[i][0]); */ console.log("KEY SAVE " + store[i][0]);
let key = store[i][0]; let key = store[i][0];
if (i === 0) { if (i === 0) {
if (!_.isEqual(key, '@config:onesignalIds')) { if (!_.isEqual(key, '@config:onesignalIds')) {
@ -778,9 +778,8 @@ class Home extends BaseScreen {
this.makeMarkerInformation = this.makeMarkerInformation.bind(this); this.makeMarkerInformation = this.makeMarkerInformation.bind(this);
//IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) //IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
OneSignal.addEventListener('ids', this.onIds); OneSignal.addEventListener('ids', this.onIds);
global.appHasLoaded = true;
}; };
/* updateLangue() { /* updateLangue() {
@ -1656,7 +1655,7 @@ class Home extends BaseScreen {
translucent={true} translucent={true}
/> />
{/* Start here to comment */} {/* Start here to comment */}
{/*{ {
(this.state.loadingDialog || this.props.loading) ? (this.state.loadingDialog || this.props.loading) ?
<View <View
style={{ style={{
@ -1708,7 +1707,7 @@ class Home extends BaseScreen {
} }
}]) }])
}} }}
/>*/} />
{this.makeCardSearch()} {this.makeCardSearch()}
{this.makeSlidingUp()} {this.makeSlidingUp()}
{this.makeDialogLoader()} {this.makeDialogLoader()}

View File

@ -1,24 +1,35 @@
import Button from 'apsl-react-native-button';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isNil from 'lodash/isNil'; import isNil from 'lodash/isNil';
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Alert, ScrollView, StyleSheet, Text, View } from 'react-native'; import {
import * as Animatable from 'react-native-animatable'; ActivityIndicator,
Alert,
ProgressBarAndroid,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View
} from 'react-native';
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions'; import {responsiveHeight, responsiveWidth} from 'react-native-responsive-dimensions';
import { ProgressDialog } from 'react-native-simple-dialogs'; import {ProgressDialog} from 'react-native-simple-dialogs';
import { Fumi } from 'react-native-textinput-effects'; import {connect} from 'react-redux';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import {bindActionCreators} from 'redux';
import { connect } from 'react-redux'; import omit from 'lodash/omit';
import { bindActionCreators } from 'redux'; import {Color} from '../../config/Color';
import { Color } from '../../config/Color'; import {Typography} from '../../config/typography';
import { FontWeight, Typography } from '../../config/typography'; import {IlinkEmitter} from '../../utils/events';
import { store } from "../../redux/store"; import {readUser} from '../../webservice/AuthApi';
import { IlinkEmitter } from '../../utils/events'; import {getEpargneInProgressAction, getEpargneInProgressReset} from '../../webservice/NanoCreditApi';
import { readUser } from '../../webservice/AuthApi'; import {casserEpargneUserAction, casserEpargneUserReset} from '../../webservice/user/NanoCreditApi';
import { createGroupAction, createGroupReset } from '../../webservice/NanoCreditApi'; import {cutStringWithoutDot, displayTransactionType, nanoCreditHistoryLabel} from "../../utils/UtilsFunction";
import { isNormalInteger } from '../../utils/UtilsFunction'; import * as Utils from "../../utils/DeviceUtils";
import { casserEpargneUserAction, casserEpargneUserReset } from '../../webservice/user/NanoCreditApi'; 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 theme = require('../../utils/theme.json');
let route = require('../../route.json'); let route = require('../../route.json');
@ -26,154 +37,472 @@ let route = require('../../route.json');
class CasserEpargneUser extends Component { class CasserEpargneUser extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
password: null, password: null,
idEpargne: null, idEpargne: null,
codeGroup: null, codeGroup: null,
loading: false, loading: false,
user: null, user: null,
triggerSubmitClick: false, triggerSubmitClick: false,
isSubmitClick: false, isSubmitClick: false,
isDataSubmit: false, isDataSubmit: false,
isModalConfirmVisible: false, isModalConfirmVisible: false,
isGroupToModify: false, isGroupToModify: false,
}; displayModalHistory: false,
historyItemDetail: null,
isDataHasLoaded: false,
displayPasswordModal: false,
wallet: this.props.navigation.state.params.wallet,
};
this.props.getEpargneInProgressReset();
} }
static navigatorStyle = { static navigatorStyle = {
navBarBackgroundColor: Color.primaryColor, navBarBackgroundColor: Color.primaryColor,
statusBarColor: Color.primaryDarkColor, statusBarColor: Color.primaryDarkColor,
navBarTextColor: '#FFFFFF', navBarTextColor: '#FFFFFF',
navBarButtonColor: '#FFFFFF' navBarButtonColor: '#FFFFFF'
}; };
static navigationOptions = () => { static navigationOptions = () => {
return { return {
drawerLabel: () => null, drawerLabel: () => null,
headerTitle: I18n.t('BREAK_EPARGNE'), headerTitle: I18n.t('BREAK_EPARGNE'),
headerTintColor: 'white', headerTintColor: 'white',
headerStyle: { headerStyle: {
backgroundColor: Color.primaryColor, backgroundColor: Color.primaryColor,
marginTop: 0, marginTop: 0,
color: 'white' color: 'white'
}, },
headerTitleStyle: { headerTitleStyle: {
color: "white" color: "white"
}, },
title: I18n.t('BREAK_EPARGNE') title: I18n.t('BREAK_EPARGNE')
} }
}; };
componentDidMount() { componentDidMount() {
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
if (user !== undefined) { if (user !== undefined) {
this.setState({ user }); 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()
} }
}
});
} {/*<Text style={styles.subbigtitle}>{I18n.t('DEMAND_INFO')}</Text>
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>
<Animatable.View ref={(comp) => { idEpargneAnim = comp }}> <Animatable.View ref={(comp) => { idEpargneAnim = comp }}>
<Fumi iconClass={FontAwesomeIcon} iconName={'id-card'} <Fumi iconClass={FontAwesomeIcon} iconName={'id-card'}
@ -209,78 +538,178 @@ class CasserEpargneUser extends Component {
<Button style={styles.btnvalide} <Button style={styles.btnvalide}
textStyle={styles.textbtnvalide} textStyle={styles.textbtnvalide}
onPress={() => { this.onSubmitCasserEpargne(); }}> onPress={() => { this.onSubmitCasserEpargne(); }}>
{this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button> {this.state.isGroupToModify ? I18n.t('MODIFY') : I18n.t('SUBMIT_LABEL')}</Button>*/}
</ScrollView> </ScrollView>
</> </>
) )
} }
} }
const maptStateToProps = state => ({ const maptStateToProps = state => ({
loading: state.casserEpargneUserReducer.loading, loading: state.casserEpargneUserReducer.loading,
result: state.casserEpargneUserReducer.result, result: state.casserEpargneUserReducer.result,
error: state.casserEpargneUserReducer.error, error: state.casserEpargneUserReducer.error,
errorNanoCreditHistory: state.getEpargneInProgressReducer.error,
resultNanoCreditHistory: state.getEpargneInProgressReducer.result,
loadingNanoCreditHistory: state.getEpargneInProgressReducer.loading,
}); });
const mapDispatchToProps = dispatch => bindActionCreators({ const mapDispatchToProps = dispatch => bindActionCreators({
casserEpargneUserAction, casserEpargneUserAction,
casserEpargneUserReset, casserEpargneUserReset,
getEpargneInProgressAction,
getEpargneInProgressReset
}, dispatch); }, dispatch);
export default connect(maptStateToProps, mapDispatchToProps)(CasserEpargneUser); export default connect(maptStateToProps, mapDispatchToProps)(CasserEpargneUser);
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
backgroundColor: Color.primaryDarkColor, backgroundColor: Color.containerBackgroundColor,
}, paddingHorizontal: 20
textbtnvalide: { },
color: 'white', textbtnvalide: {
fontWeight: 'bold' color: 'white',
}, fontWeight: 'bold'
bigtitle: { },
color: 'white', bigtitle: {
fontSize: 20, color: 'white',
flex: 1, fontSize: 20,
fontWeight: 'bold', flex: 1,
textAlign: 'center', fontWeight: 'bold',
margin: 20, textAlign: 'center',
}, margin: 20,
blockView: { },
paddingVertical: 10, blockView: {
borderBottomWidth: 1 paddingVertical: 10,
}, borderBottomWidth: 1
subbigtitle: { },
color: 'white', subbigtitle: {
fontSize: 17, color: 'white',
textAlign: 'center', fontSize: 17,
margin: 5, textAlign: 'center',
}, margin: 5,
btnvalide: { },
marginTop: 20, btnvalide: {
marginLeft: 20, marginTop: 20,
marginRight: 20, marginLeft: 20,
borderColor: 'transparent', marginRight: 20,
backgroundColor: Color.accentLightColor, borderColor: 'transparent',
height: 52 backgroundColor: Color.accentLightColor,
}, height: 52
btnSubmit: { },
marginTop: 20, btnSubmit: {
borderColor: 'transparent', marginTop: 20,
backgroundColor: Color.accentLightColor, borderColor: 'transparent',
height: 52, backgroundColor: Color.accentLightColor,
width: "30%", height: 52,
marginLeft: 20, width: "30%",
marginRight: 20, marginLeft: 20,
}, marginRight: 20,
input: { },
height: 60, input: {
marginTop: responsiveHeight(2), height: 60,
marginLeft: responsiveWidth(5), marginTop: responsiveHeight(2),
marginRight: responsiveWidth(5), marginLeft: responsiveWidth(5),
borderRadius: 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) => { 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(); dateFormat = moment(dateFormat).fromNow();
return ( return (

View File

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

View File

@ -268,7 +268,7 @@ class MyNanoCreditGroup extends Component {
renderDetail = () => { renderDetail = () => {
const { resultGetUniqueDemand } = this.props; 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) ago = moment(ago)
return (<View style={styles.container}> return (<View style={styles.container}>
<CardView <CardView

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -369,11 +369,11 @@ export const optionRetraitUserScreen = {
screen: route.retraitCarteVersWalletUser, screen: route.retraitCarteVersWalletUser,
icon: 'credit-card', icon: 'credit-card',
title: 'WITHDRAWAL_CARD_TO_WALLET', title: 'WITHDRAWAL_CARD_TO_WALLET',
}, { }, {
screen: '', screen: '',
icon: 'credit-card', icon: 'credit-card',
title: 'WITHDRAWAL_BANK_TO_WALLET', title: 'WITHDRAWAL_BANK_TO_WALLET',
}, { }, {
screen: '', screen: '',
icon: 'credit-card', icon: 'credit-card',
title: 'WITHDRAWAL_BANK_TO_CASH', title: 'WITHDRAWAL_BANK_TO_CASH',
@ -401,13 +401,13 @@ export const optionDepotUserScreen = {
icon: 'credit-card', icon: 'credit-card',
title: 'DEPOSIT_TO_CARD', title: 'DEPOSIT_TO_CARD',
}, },
{ {
type: 'WALLET_TO_BANK', type: 'WALLET_TO_BANK',
screen: route.operateurOptionSelect, screen: route.operateurOptionSelect,
icon: 'bank-transfer-in', icon: 'bank-transfer-in',
title: 'DEPOSIT_TO_BANK', title: 'DEPOSIT_TO_BANK',
subScreenOption: optionWalletToBank subScreenOption: optionWalletToBank
}, },
] ]
} }
@ -515,9 +515,54 @@ export const optionNanoCreditAgentScreen = {
] ]
} }
export const optionPaiementEauElectricite = { export const optionPaiementEau = {
title: 'PAIEMENT_FACTURE', title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR', 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: [ options: [
{ {
type: 'PAIEMENT_EAU_ELECTRICITE', type: 'PAIEMENT_EAU_ELECTRICITE',
@ -561,6 +606,7 @@ export const optionPaiementEauElectricite = {
export const optionPaiementCreditTelephonique = { export const optionPaiementCreditTelephonique = {
title: 'PAIEMENT_FACTURE', title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR', subTitle: 'CHOOSE_OPERATOR',
operatorType: 'phone',
options: [ options: [
{ {
type: 'PAIEMENT_CREDIT_TELEPHONE', type: 'PAIEMENT_CREDIT_TELEPHONE',
@ -604,6 +650,7 @@ export const optionPaiementCreditTelephonique = {
export const optionPaiementAbonnementTV = { export const optionPaiementAbonnementTV = {
title: 'PAIEMENT_FACTURE', title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR', subTitle: 'CHOOSE_OPERATOR',
operatorType: 'tv',
options: [ options: [
{ {
type: 'PAIEMENT_ABONNEMENT_TV', type: 'PAIEMENT_ABONNEMENT_TV',
@ -647,6 +694,7 @@ export const optionPaiementAbonnementTV = {
export const optionPaiementEcole = { export const optionPaiementEcole = {
title: 'PAIEMENT_FACTURE', title: 'PAIEMENT_FACTURE',
subTitle: 'CHOOSE_OPERATOR', subTitle: 'CHOOSE_OPERATOR',
operatorType: 'school',
options: [ options: [
{ {
type: 'PAIEMENT_ECOLE', type: 'PAIEMENT_ECOLE',
@ -695,9 +743,16 @@ export const optionPaiementFacture = {
{ {
type: 'FACTURE_WATER_ELECTRICITY', type: 'FACTURE_WATER_ELECTRICITY',
icon: 'water', icon: 'water',
title: 'PAIEMENT_EAU_ELECTRICITY', title: 'PAIEMENT_EAU',
screen: route.operateurOptionSelect, screen: route.operateurOptionSelect,
subScreenOption: optionPaiementEauElectricite subScreenOption: optionPaiementEau
},
{
type: 'FACTURE_ELECTRICITY',
icon: 'water',
title: 'PAIEMENT_ELECTRICITY',
screen: route.operateurOptionSelect,
subScreenOption: optionPaiementElectricite
}, },
{ {
type: 'FACTURE_SCHOOL', type: 'FACTURE_SCHOOL',

View File

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

View File

@ -39,6 +39,7 @@
"DESTINATAIRE": "Destinataire", "DESTINATAIRE": "Destinataire",
"ERROR_LABEL": "Erreur", "ERROR_LABEL": "Erreur",
"NO_BANK_AVAILABLE": "Aucune banque disponible", "NO_BANK_AVAILABLE": "Aucune banque disponible",
"NO_OPERATOR_AVAILABLE": "Aucun opérateur disponible",
"DEPOSIT_SUCCESS": "Dépôt effectué avec succès", "DEPOSIT_SUCCESS": "Dépôt effectué avec succès",
"SUCCESS": "Succès", "SUCCESS": "Succès",
"ETAT": "Etat", "ETAT": "Etat",
@ -165,6 +166,7 @@
"DEPOSIT_TO_BANK": "Votre Wallet vers banque", "DEPOSIT_TO_BANK": "Votre Wallet vers banque",
"NANO_CREDIT": "Nano crédit", "NANO_CREDIT": "Nano crédit",
"NANO_CREDIT_LIST": "Liste des 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", "NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NANO_CREDIT_DESCRIPTION": "Nano crédit iLink", "NANO_CREDIT_DESCRIPTION": "Nano crédit iLink",
"NANO_SANTE": "Nano santé", "NANO_SANTE": "Nano santé",
@ -178,7 +180,8 @@
"CAUTION_CREDIT": "Cautionner une demande de crédit", "CAUTION_CREDIT": "Cautionner une demande de crédit",
"CAUTIONNEMENT_DONE": "Cautionnement effectué", "CAUTIONNEMENT_DONE": "Cautionnement effectué",
"ID_DEMAND": "Identifiant de la demande", "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_ECOLE": "Paiement école",
"PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique", "PAIEMENT_CREDIT_TELEPHONIQUE": "Paiement crédit téléphonique",
"PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV", "PAIEMENT_ABONNEMENT_TV": "Paiement abonnement TV",
@ -187,6 +190,7 @@
"DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu", "DATE_REMBOURSEMENT_PREVU": "Date de remboursement prévu",
"DATE_REMBOURSEMENT": "Date de remboursement", "DATE_REMBOURSEMENT": "Date de remboursement",
"AMOUNT_REFUND": "Montant remboursé", "AMOUNT_REFUND": "Montant remboursé",
"AMOUNT_WITHDRAWAL": "Montant retiré",
"AMOUNT_PARTIALLY_REFUND": "Montant partiellement remboursé", "AMOUNT_PARTIALLY_REFUND": "Montant partiellement remboursé",
"FINAL_DATE": "Date de fin", "FINAL_DATE": "Date de fin",
"CASSATION_DATE": "Date de cassation", "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 getBankUrl = testBaseUrl + '/walletService/wallets/users/operators/bank';
export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress'; export const getHistoryNanoPendingCreditUrl = testBaseUrl + '/walletService/groups/nanoCredit/demands_in_progress';
export const getHistoryEpargnePendingUrl = testBaseUrl + '/walletService/groups/nanoCredit/savings/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 authKeyUrl = testBaseUrl + '/oauth/token';
export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY"; export const videoUrl = "https://www.youtube.com/watch?v=wwGPDPsSLWY";

View File

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

View File

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