From e597ceb6c34e72c0e1d1e22e35ff3a512e33a69b Mon Sep 17 00:00:00 2001 From: Brice Zele Date: Fri, 16 Oct 2020 20:14:18 +0100 Subject: [PATCH] Historique Superviseur OK --- screens/wallet/WalletDetail.js | 304 +++++++++++++++++++++++---- screens/wallet/WalletOptionSelect.js | 10 +- 2 files changed, 265 insertions(+), 49 deletions(-) diff --git a/screens/wallet/WalletDetail.js b/screens/wallet/WalletDetail.js index 436fffb7..48abd43d 100644 --- a/screens/wallet/WalletDetail.js +++ b/screens/wallet/WalletDetail.js @@ -24,7 +24,7 @@ import Dialog from "react-native-dialog"; import { Typography } from '../../config/typography'; import * as Utils from '../../utils/DeviceUtils'; import { IlinkEmitter } from "../../utils/events"; -import { cutString, cutStringWithoutDot, isEmptyObject, transactionHistoryIlinkLabel, isIlinkWorldWallet, optionDepotScreen, optionIdentificationScreen, optionPaiementFacture, optionRetraitScreen, transactionHistoryLabel, optionNanoCreditScreen, optionNanoCreditAgentScreen } from '../../utils/UtilsFunction'; +import { cutString, cutStringWithoutDot, isEmptyObject, transactionHistoryIlinkLabel, isIlinkWorldWallet, optionDepotScreen, optionIdentificationScreen, optionPaiementFacture, optionRetraitScreen, transactionHistoryLabel, optionNanoCreditScreen, optionNanoCreditAgentScreen, displayTransactionType } from '../../utils/UtilsFunction'; import { depositActionReset } from '../../webservice/DepositApi'; import { baseUrl } from '../../webservice/IlinkConstants'; import { getWalletDetailActivated, resetWalletListDetailReducer } from '../../webservice/WalletApi'; @@ -163,7 +163,7 @@ class WalletDetail extends Component { this.props.getHyperSuperTransactionHistoryAction(result.response.id, false); break; case "hyper": - this.props.getHyperSuperTransactionHistoryAction(result.response.id, true); + this.props.getHyperSuperTransactionHistoryAction(user.network_id, true); break; } this.setState({}); @@ -503,7 +503,7 @@ class WalletDetail extends Component { ); - renderModalHistoryDetail = () => { + renderModalHistoryDetail = (wallet) => { const { historyItemDetail } = this.state; return ( @@ -631,7 +631,7 @@ class WalletDetail extends Component { return ( { this.setState({ displaySuperHyperModalHistory: true, historyItemDetail: item }) }} style={[styles.contentService, { borderBottomColor: Color.primaryColor }]}> { - Object.keys(omit(item, ['id', 'id_transaction', 'type_historique', 'frais', 'init_country', 'final_country', 'source', 'emetteur', 'montant_net_final', 'montant_net_init', 'reseau_payeur', 'operation'])).map((element, i) => ( + Object.keys(omit(item, ['id', 'id_transaction', 'date_cassation', 'etat', 'type', 'date_fin', 'duree_mois', 'id_epargne', 'type_historique', 'frais', 'init_country', 'final_country', 'source', 'emetteur', 'montant_net_final', 'montant_net_init', 'reseau_payeur', 'operation', 'retrait_cash', 'type_historique', 'type_caution', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => ( { @@ -652,7 +652,7 @@ class WalletDetail extends Component { } - renderModalSuperHyperHistoryDetail = () => { + renderModalSuperHyperHistoryDetail = (wallet) => { const { historyItemDetail } = this.state; return ( @@ -661,38 +661,166 @@ class WalletDetail extends Component { Détail de l'historique - + {isEqual(historyItemDetail.type_historique, 'N') && + + + + + Type + + + {displayTransactionType(this.state.historyItemDetail.type_historique)} + + + + + {I18n.t('ID_DEMAND')} + + + {this.state.historyItemDetail.id_demande} + + + + + {I18n.t('STATUS')} + + + {this.state.historyItemDetail.etat} + + + + + {I18n.t('DEMAND_DURATION_IN_MONTH')} + + + {this.state.historyItemDetail.duree_mois} + + + + + {I18n.t('AMOUNT')} + + + {this.state.historyItemDetail.montant + ' ' + wallet.currency_code} + + + + + {I18n.t('AMOUNT_REFUND')} + + + {this.state.historyItemDetail.montant_rembourse + ' ' + wallet.currency_code} + + + + + {I18n.t('AMOUNT_PARTIALLY_REFUND')} + + + {this.state.historyItemDetail.partiellement_rembourse + ' ' + wallet.currency_code} + + + + + {I18n.t('TAXES')} + + + {this.state.historyItemDetail.taxe + ' ' + wallet.currency_code} + + + + + {I18n.t('INTERET')} + + + {this.state.historyItemDetail.interet + ' ' + wallet.currency_code} + + + + + {I18n.t('WITHDRAWAL_IN_CASH')} + + + {this.state.historyItemDetail.retrait_cash + ' ' + wallet.currency_code} + + + + + {I18n.t('CREATION_DATE')} + + + {this.state.historyItemDetail.date_creation} + + + + + {I18n.t('DEMAND_DATE')} + + + {this.state.historyItemDetail.date_demande} + + + + + {I18n.t('DATE_REMBOURSEMENT_PREVU')} + + + {this.state.historyItemDetail.date_remboursement_prevu} + + + + + {I18n.t('DATE_REMBOURSEMENT')} + + + {this.state.historyItemDetail.date_remboursement} + + + + + } + + {isEqual(historyItemDetail.type_historique, 'E') && + - {I18n.t('OPERATION')} + Type - {this.state.historyItemDetail.operation} + {displayTransactionType(this.state.historyItemDetail.type_historique)} - {I18n.t('TRANSACTION_ID')} + {I18n.t('ID_DEMAND')} - {this.state.historyItemDetail.id_transaction} + {this.state.historyItemDetail.id_demande} - Date + {I18n.t('STATUS')} - {this.state.historyItemDetail.date_creation} + {this.state.historyItemDetail.etat} - {I18n.t('INIT_COUNTRY')} + {I18n.t('DEMAND_DURATION_IN_MONTH')} - {this.state.historyItemDetail.init_country} + {this.state.historyItemDetail.duree_mois} + + + + + Type + + + {this.state.historyItemDetail.type} @@ -700,69 +828,156 @@ class WalletDetail extends Component { {I18n.t('AMOUNT')} - {this.state.historyItemDetail.montant} + {this.state.historyItemDetail.montant + ' ' + wallet.currency_code} - {I18n.t('FEES_AND_TAXES')} + {I18n.t('TAXES')} - {this.state.historyItemDetail.frais} + {this.state.historyItemDetail.taxe + ' ' + wallet.currency_code} - {I18n.t('NET_AMOUNT')} + {I18n.t('INTERET')} - {this.state.historyItemDetail.montant_net_init} + {this.state.historyItemDetail.interet + ' ' + wallet.currency_code} - {I18n.t('EMETTEUR')} + {I18n.t('CREATION_DATE')} - {this.state.historyItemDetail.emetteur} + {this.state.historyItemDetail.date_creation} - {I18n.t('DESTINATAIRE')} + {I18n.t('FINAL_DATE')} - {this.state.historyItemDetail.destinataire} + {this.state.historyItemDetail.date_fin} - {I18n.t('FINAL_COUNTRY')} + {I18n.t('CASSATION_DATE')} - {this.state.historyItemDetail.final_country} - - - - - {I18n.t('NET_AMOUNT')} - - - {this.state.historyItemDetail.montant_net_final} - - - - - {I18n.t('ACTIVE_WALLET')} - - - {this.state.historyItemDetail.reseau_payeur} + {this.state.historyItemDetail.date_cassation} + } - + {isEqual(historyItemDetail.type_historique, 'T') && + + + + + + {I18n.t('OPERATION')} + + + {this.state.historyItemDetail.operation} + + + + + {I18n.t('TRANSACTION_ID')} + + + {this.state.historyItemDetail.id_transaction} + + + + + Date + + + {this.state.historyItemDetail.date_creation} + + + + + {I18n.t('INIT_COUNTRY')} + + + {this.state.historyItemDetail.init_country} + + + + + {I18n.t('AMOUNT')} + + + {this.state.historyItemDetail.montant} + + + + + {I18n.t('FEES_AND_TAXES')} + + + {this.state.historyItemDetail.frais} + + + + + {I18n.t('NET_AMOUNT')} + + + {this.state.historyItemDetail.montant_net_init} + + + + + {I18n.t('EMETTEUR')} + + + {this.state.historyItemDetail.emetteur} + + + + + {I18n.t('DESTINATAIRE')} + + + {this.state.historyItemDetail.destinataire} + + + + + {I18n.t('FINAL_COUNTRY')} + + + {this.state.historyItemDetail.final_country} + + + + + {I18n.t('NET_AMOUNT')} + + + {this.state.historyItemDetail.montant_net_final} + + + + + {I18n.t('ACTIVE_WALLET')} + + + {this.state.historyItemDetail.reseau_payeur} + + + + + } { this.setState({ displaySuperHyperModalHistory: !this.state.displaySuperHyperModalHistory, @@ -1414,7 +1629,10 @@ class WalletDetail extends Component { return ( <> {this.state.displayModalHistory && this.renderModalHistoryDetail()} - {this.state.displaySuperHyperModalHistory && this.renderModalSuperHyperHistoryDetail()} + {this.props.result !== null && + this.state.displaySuperHyperModalHistory && + this.renderModalSuperHyperHistoryDetail(this.props.result.response)} + { - transactionHistoryNanoCreditLabel().map((item, index) => ( + transactionHistoryIlinkLabel().map((item, index) => ( @@ -418,7 +418,7 @@ class WalletOptionSelect extends Component { { !isNil(this.state.user.category) ? - Object.keys(omit(item, ['id', 'retrait_cash', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => ( + Object.keys(omit(item, ['id', 'retrait_cash', 'type_historique', 'type_caution', 'id_demande', 'montant_rembourse', 'partiellement_rembourse', 'duree_mois', 'etat', 'interet', 'taxe', 'date_validation', 'date_remboursement_prevu', 'date_remboursement', 'id_user', 'id_wallet_agent', 'id_network', 'user', 'user_phone', 'agent', 'codeParrain'])).map((element, i) => ( @@ -426,9 +426,7 @@ class WalletOptionSelect extends Component { isEqual(element, 'montant') ? ` ${thousands(item[element], ' ')} ${this.state.wallet.currency_code}` : isEqual(element, 'date_creation') ? - cutStringWithoutDot(item[element], 16) : - isEqual(element, 'type_historique') ? - displayTransactionType(item[element]) + cutStringWithoutDot(item[element], 16) : item[element] }