Correction de bugs

This commit is contained in:
Brice 2020-11-30 18:25:24 +01:00
parent 2ecdc04ada
commit 67d72b36ec
5 changed files with 108 additions and 90 deletions

File diff suppressed because one or more lines are too long

View File

@ -1653,7 +1653,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={{
@ -1705,7 +1705,7 @@ class Home extends BaseScreen {
} }
}]) }])
}} }}
/> />*/}
{this.makeCardSearch()} {this.makeCardSearch()}
{this.makeSlidingUp()} {this.makeSlidingUp()}
{this.makeDialogLoader()} {this.makeDialogLoader()}

View File

@ -54,6 +54,7 @@ class CautionNanoCreditAgent extends Component {
withdrawalInCash: true, withdrawalInCash: true,
wallet: store.getState().walletDetailReducer.result.response wallet: store.getState().walletDetailReducer.result.response
}; };
console.log("Wallet", this.state.wallet);
this.props.getNanoCreditDemandDetailReset(); this.props.getNanoCreditDemandDetailReset();
this.props.cautionCreditDemandAgentReset(); this.props.cautionCreditDemandAgentReset();
@ -240,6 +241,7 @@ class CautionNanoCreditAgent extends Component {
const {result, error} = this.props; const {result, error} = this.props;
if (error !== null) { if (error !== null) {
console.log(error);
if (typeof error.data !== 'undefined') { if (typeof error.data !== 'undefined') {
Alert.alert( Alert.alert(
I18n.t("ERROR_LABLE"), I18n.t("ERROR_LABLE"),
@ -255,6 +257,7 @@ class CautionNanoCreditAgent extends Component {
{cancelable: false} {cancelable: false}
) )
} }
} }
if (result !== null) { if (result !== null) {
@ -276,7 +279,7 @@ class CautionNanoCreditAgent extends Component {
) )
} }
} }
} };
updateLangue() { updateLangue() {
this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')}) this.props.navigation.setParams({name: I18n.t('REFUND_NANO_CREDIT')})
@ -357,6 +360,7 @@ class CautionNanoCreditAgent extends Component {
<> <>
{(this.props.loading || this.props.loadingGetNanoCreditDemandDetail) && this.renderLoader()} {(this.props.loading || this.props.loadingGetNanoCreditDemandDetail) && this.renderLoader()}
{this.state.isDataSubmit && this.renderRefundNanoCreditResponse()} {this.state.isDataSubmit && this.renderRefundNanoCreditResponse()}
{this.state.triggerSubmitClick && this.renderGetNanoCreditDemandDetailResponse()}
{ {
(resultGetNanoCreditDemandDetail !== null) && (resultGetNanoCreditDemandDetail !== null) &&
(typeof resultGetNanoCreditDemandDetail.response !== 'undefined') && (typeof resultGetNanoCreditDemandDetail.response !== 'undefined') &&

View File

@ -59,6 +59,7 @@ import {
} from '../../webservice/WalletTransactionHistoryApi'; } from '../../webservice/WalletTransactionHistoryApi';
import {resetCommissionReducer, transferCommissionAction} from '../../webservice/WalletTransferCommission'; import {resetCommissionReducer, transferCommissionAction} from '../../webservice/WalletTransferCommission';
import {readUser} from '../../webservice/AuthApi'; import {readUser} from '../../webservice/AuthApi';
import {store} from "../../redux/store";
let moment = require('moment-timezone'); let moment = require('moment-timezone');
const thousands = require('thousands'); const thousands = require('thousands');
@ -86,7 +87,7 @@ class WalletDetail extends Component {
scrollHeaderY: 0, scrollHeaderY: 0,
displayModalHistory: false, displayModalHistory: false,
displaySuperHyperModalHistory: false, displaySuperHyperModalHistory: false,
historyItemDetail: null historyItemDetail: null,
}; };
this.renderContent = null; this.renderContent = null;
@ -142,30 +143,34 @@ class WalletDetail extends Component {
payload => { payload => {
const {result} = this.props; const {result} = this.props;
console.log("will focus"); console.log("will focus");
if (result !== null) { this.setState({
if (typeof result.response !== 'undefined') { wallet: {currency_code: ''}
const wallet = result.response[0]; }, ()=>{
readUser().then((user) => { if (result !== null) {
if (user !== null && user !== undefined) { if (typeof result.response !== 'undefined') {
if (user.category !== undefined) { const wallet = result.response[0];
switch (user.category) { readUser().then((user) => {
case "super": if (user !== null && user !== undefined) {
this.props.getHyperSuperTransactionHistoryAction(user.code_membre, false); if (user.category !== undefined) {
break; switch (user.category) {
case "hyper": case "super":
this.props.getHyperSuperTransactionHistoryAction(user.network_id, true); this.props.getHyperSuperTransactionHistoryAction(user.code_membre, false);
break; break;
case "hyper":
this.props.getHyperSuperTransactionHistoryAction(user.network_id, true);
break;
}
this.setState({});
} }
this.setState({});
} }
} });
}); this.setState({
this.setState({ wallet: wallet,
wallet: wallet, isTriggerRefresh: false
isTriggerRefresh: false })
}) }
} }
} })
}); });
} }
@ -735,7 +740,7 @@ class WalletDetail extends Component {
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{ {
isEqual(element, 'montant') ? isEqual(element, 'montant') ?
` ${item[element].length > 8 ? cutString(thousands(item[element], ' '), 6) : thousands(item[element], ' ')} ${this.state.wallet.currency_code}` ` ${item[element].length > 8 ? cutString(thousands(item[element], ' '), 6) : thousands(item[element], ' ')} ${this.state.wallet !== undefined ? this.state.wallet.currency_code : ""}`
: isEqual(element, 'destinataire') ? : isEqual(element, 'destinataire') ?
item[element].length > 13 ? cutString(item[element], 13) : item[element] item[element].length > 13 ? cutString(item[element], 13) : item[element]
: isEqual(element, 'date_creation') ? : isEqual(element, 'date_creation') ?
@ -1584,7 +1589,7 @@ class WalletDetail extends Component {
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{ {
isEqual(element, 'montant') ? isEqual(element, 'montant') ?
` ${item[element].length > 8 ? cutString(thousands(item[element], ' '), 6) : thousands(item[element], ' ')} ${this.state.wallet.currency_code}` ` ${item[element].length > 8 ? cutString(thousands(item[element], ' '), 6) : thousands(item[element], ' ')} ${this.state.wallet !== undefined ? this.state.wallet.currency_code : ""}`
: isEqual(element, 'destinataire') ? : isEqual(element, 'destinataire') ?
item[element].length > 13 ? cutString(item[element], 13) : item[element] item[element].length > 13 ? cutString(item[element], 13) : item[element]
: isEqual(element, 'date') ? : isEqual(element, 'date') ?
@ -1599,7 +1604,7 @@ class WalletDetail extends Component {
<Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}> <Text style={[Typography.overline, Color.grayColor], {marginTop: 4}}>
{ {
isEqual(element, 'montant') ? isEqual(element, 'montant') ?
` ${item[element].length > 8 ? cutString(thousands(item[element], ' '), 6) : thousands(item[element], ' ')} ${this.state.wallet.currency_code}` ` ${item[element].length > 8 ? cutString(thousands(item[element], ' '), 6) : thousands(item[element], ' ')} ${this.state.wallet !== undefined ? this.state.wallet.currency_code : ""}`
: isEqual(element, 'destinataire') ? : isEqual(element, 'destinataire') ?
item[element].length > 13 ? cutString(item[element], 13) : item[element] item[element].length > 13 ? cutString(item[element], 13) : item[element]
: isEqual(element, 'date') ? : isEqual(element, 'date') ?

View File

@ -1,80 +1,89 @@
import { cautionCreditDemandtUrl, getNanoCreditDemandUrl } from "../IlinkConstants"; import {cautionCreditDemandtUrl, getNanoCreditDemandUrl} from "../IlinkConstants";
import axios from "axios"; import axios from "axios";
import I18n from 'react-native-i18n'; import I18n from 'react-native-i18n';
import { store } from "../../redux/store"; import {store} from "../../redux/store";
import { fetchCautionCreditDemandAgentPending, fetchCautionCreditDemandAgentSuccess, fetchCautionCreditDemandAgentError, fetchCautionCreditDemandAgentReset, fetchGetNanoCreditDemandDetailPending, fetchGetNanoCreditDemandDetailSuccess, fetchGetNanoCreditDemandDetailReset } from "../../redux/actions/NanoCreditAction"; import {
fetchCautionCreditDemandAgentError,
fetchCautionCreditDemandAgentPending,
fetchCautionCreditDemandAgentReset,
fetchCautionCreditDemandAgentSuccess,
fetchGetNanoCreditDemandDetailError,
fetchGetNanoCreditDemandDetailPending,
fetchGetNanoCreditDemandDetailReset,
fetchGetNanoCreditDemandDetailSuccess
} from "../../redux/actions/NanoCreditAction";
export const cautionCreditDemandAgentAction = (data) => { export const cautionCreditDemandAgentAction = (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(fetchCautionCreditDemandAgentPending()); dispatch(fetchCautionCreditDemandAgentPending());
axios({ axios({
url: cautionCreditDemandtUrl, url: cautionCreditDemandtUrl,
method: 'POST', method: 'POST',
data, data,
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(fetchCautionCreditDemandAgentSuccess(response)); dispatch(fetchCautionCreditDemandAgentSuccess(response));
}) })
.catch(error => { .catch(error => {
if (error.response) if (error.response)
dispatch(fetchCautionCreditDemandAgentError(error.response)); dispatch(fetchCautionCreditDemandAgentError(error.response));
else if (error.request) else if (error.request)
dispatch(fetchCautionCreditDemandAgentError(error.request)) dispatch(fetchCautionCreditDemandAgentError(error.request))
else else
dispatch(fetchCautionCreditDemandAgentError(error.message)) dispatch(fetchCautionCreditDemandAgentError(error.message))
}); });
} }
} }
export const cautionCreditDemandAgentReset = () => { export const cautionCreditDemandAgentReset = () => {
return dispatch => { return dispatch => {
dispatch(fetchCautionCreditDemandAgentReset()); dispatch(fetchCautionCreditDemandAgentReset());
} }
} }
export const getNanoCreditDemandDetailAction = (idDemand) => { export const getNanoCreditDemandDetailAction = (idDemand) => {
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(fetchGetNanoCreditDemandDetailPending()); dispatch(fetchGetNanoCreditDemandDetailPending());
axios({ axios({
url: `${getNanoCreditDemandUrl}/${idDemand}`, url: `${getNanoCreditDemandUrl}/${idDemand}`,
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(fetchGetNanoCreditDemandDetailSuccess(response)); dispatch(fetchGetNanoCreditDemandDetailSuccess(response));
}) })
.catch(error => { .catch(error => {
if (error.response) if (error.response)
dispatch(fetchGetNanoCreditDemandDetailError(error.response)); dispatch(fetchGetNanoCreditDemandDetailError(error.response));
else if (error.request) else if (error.request)
dispatch(fetchGetNanoCreditDemandDetailError(error.request)) dispatch(fetchGetNanoCreditDemandDetailError(error.request));
else else
dispatch(fetchGetNanoCreditDemandDetailError(error.message)) dispatch(fetchGetNanoCreditDemandDetailError(error.message));
}); });
} }
} }
export const getNanoCreditDemandDetailReset = () => { export const getNanoCreditDemandDetailReset = () => {
return dispatch => { return dispatch => {
dispatch(fetchGetNanoCreditDemandDetailReset()); dispatch(fetchGetNanoCreditDemandDetailReset());
} }
} }