+ Add list of all paying networks

This commit is contained in:
Djery-Tom 2020-06-23 16:49:59 +01:00
parent 99316612d9
commit 888c17ba8e
7 changed files with 350 additions and 81 deletions

View File

@ -1591,6 +1591,9 @@ class Gestion extends CI_Controller
$data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash; $data['taux_bq_r_cart'] = $taux->taux_com_banque_retrait_carte_cash;
$data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink; $data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink;
$data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink; $data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink;
}elseif ($taux->type == 'autre') {
$res = $this->user_model->getSharingRateByNetwork($network_id);
$data['commission'] = $res ? $res->first_row()->balance_com : 0 ;
} }
$data['transactions'] = $this->user_model->getTransactions(null,null,$network_id); $data['transactions'] = $this->user_model->getTransactions(null,null,$network_id);

View File

@ -315,6 +315,8 @@ class Hyperviseur_dash extends CI_Controller
$this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history')); $this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
} elseif ($this->input->get('config')) { } elseif ($this->input->get('config')) {
$this->config_wallet($this->input->get('config'), $this->input->get('country')); $this->config_wallet($this->input->get('config'), $this->input->get('country'));
} elseif ($this->input->get('show')) {
$this->show_config_infos($this->input->get('show'));
}else { }else {
$data["commission"] = ""; $data["commission"] = "";
@ -1028,6 +1030,28 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('footer'); $this->load->view('footer');
} }
private function show_config_infos($type)
{
$data['active'] = "wallet";
$data['alert'] = "";
$data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname');
$data['email'] = $this->session->userdata('email');
$data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category');
$data['idConfig'] = $data['hasWallet']->first_row()->id;
$data['networks'] = $this->user_model->getPayingNetworksByConfigWallet($data['idConfig']);
$this->load->view('header_hyp', $data);
$this->load->view('gestion_wallet_ilink_paying_network_account');
$this->load->view('footer');
}
public function config_sharing_rate(){ public function config_sharing_rate(){
if ($this->isLogged()) { if ($this->isLogged()) {
if (isset($_POST)) { if (isset($_POST)) {

View File

@ -408,4 +408,5 @@ $lang['sharing_updated'] = 'Taux de partage mis à jour';
$lang['not_defined'] ='Non défini'; $lang['not_defined'] ='Non défini';
$lang['no_network'] = 'Aucun réseau'; $lang['no_network'] = 'Aucun réseau';
$lang['activated_countries'] = 'Pays activés'; $lang['activated_countries'] = 'Pays activés';
$lang['paying_networks_accounts'] = 'Comptes des reseaux payeurs'
?> ?>

View File

@ -2465,6 +2465,16 @@ class User_model extends CI_Model
} }
} }
public function getSharingRateByNetwork($id_network){
$sql = "SELECT balance_com FROM `paying_networks` WHERE `id_network` = ? ;";
$query = $this->db->query($sql , array($id_network));
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
public function countPayingNetworks($id_country ,$idConfig){ public function countPayingNetworks($id_country ,$idConfig){
$sql = "SELECT count(id) as total FROM `paying_networks` WHERE `id_network` IN (SELECT distinct n.id FROM countries c INNER JOIN $sql = "SELECT count(id) as total FROM `paying_networks` WHERE `id_network` IN (SELECT distinct n.id FROM countries c INNER JOIN
networks n ON n.country_id = c.id WHERE n.status = 1 AND c.id = ? networks n ON n.country_id = c.id WHERE n.status = 1 AND c.id = ?
@ -2486,4 +2496,14 @@ class User_model extends CI_Model
return false; return false;
} }
} }
public function getPayingNetworksByConfigWallet($id_config){
$query = $this->db->query("SELECT n.name , n.id , cw.type , c.name as country , pw.taux_partage as rate , pw.balance_com FROM networks n INNER JOIN countries c ON n.country_id=c.id
INNER JOIN configWallet cw ON cw.id_network = n.id INNER JOIN paying_networks pw ON pw.id_network = n.id WHERE n.id IN ( SELECT id_network FROM paying_networks pw WHERE id_configWallet = $id_config )");
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
} }

View File

@ -171,94 +171,94 @@ $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
<section class="content"> <section class="content">
<div class="row centered"> <div class="row centered">
<div class="col-lg-2 col-lg-offset-2 col-xs-6"> <div class="col-lg-4 col-xs-6">
<div class="small-box bg-aqua-active"> <div class="small-box bg-green">
<div class="inner"> <div class="inner">
<h3><?php echo $taux_u_w_cart; ?><sup style="font-size: 20px">%</sup></h3> <h3><?php echo $fmt->format($commission); ?><sup style="font-size: 20px">FCFA</sup></h3>
<p><?php echo $this->lang->line('rate_com_user_wallet_cart') ?> </p> <p><?php echo $this->lang->line('Solde Commission') ?></p>
</div> </div>
<div class="icon"> <div class="icon">
<i class="ion ion-android-arrow-up"></i> <i class="ion ion-cash"></i>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <!-- <div class="row">-->
<div class="col-xs-12"> <!-- <div class="col-xs-12">-->
<div class="box box-success"> <!-- <div class="box box-success">-->
<div class="box-header with-border"> <!-- <div class="box-header with-border">-->
<h3 class="box-title"> <!-- <h3 class="box-title">-->
<?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3> <!-- --><?php //echo $this->lang->line('Historique des 12 derniers mois'); ?><!--</h3>-->
<div class="box-tools"> <!-- <div class="box-tools">-->
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=transaction' : '')?>"> <!-- <a class="btn btn-primary" href="--><?php //echo current_url().($network_id ? '?id='.$network_id . '&history=transaction' : '')?><!--">-->
<?php echo $this->lang->line('transactions_historic'); ?> <!-- --><?php //echo $this->lang->line('transactions_historic'); ?>
</a> <!-- </a>-->
<a class="btn btn-info" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=recharge' : '')?>"> <!-- <a class="btn btn-info" href="--><?php //echo current_url().($network_id ? '?id='.$network_id . '&history=recharge' : '')?><!--">-->
<?php echo $this->lang->line('recharge_historic'); ?> <!-- --><?php //echo $this->lang->line('recharge_historic'); ?>
</a> <!-- </a>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="box-body"> <!-- <div class="box-body">-->
<div class="chart" id="chart"> <!-- <div class="chart" id="chart">-->
<canvas id="barChart" style="height:230px"></canvas> <!-- <canvas id="barChart" style="height:230px"></canvas>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="col-xs-6"> <!-- <div class="col-xs-6">-->
<div class="box box-danger"> <!-- <div class="box box-danger">-->
<div class="box-header with-border"> <!-- <div class="box-header with-border">-->
<h3 class="box-title"> <!-- <h3 class="box-title">-->
<?php echo $this->lang->line("Parts dépots & retraits"); ?></h3> <!-- --><?php //echo $this->lang->line("Parts dépots & retraits"); ?><!--</h3>-->
</div> <!-- </div>-->
<div class="box-body" id="chart2"> <!-- <div class="box-body" id="chart2">-->
<canvas id="pieChart" style="height:250px"></canvas> <!-- <canvas id="pieChart" style="height:250px"></canvas>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<!---->
<div class="col-xs-6"> <!-- <div class="col-xs-6">-->
<div class="box"> <!-- <div class="box">-->
<div class="box-header"> <!-- <div class="box-header">-->
<h3 class="box-title"><?php echo $this->lang->line('Commission Hyperviseur') ?></h3> <!-- <h3 class="box-title">--><?php //echo $this->lang->line('Commission Hyperviseur') ?><!--</h3>-->
</div> <!-- </div>-->
<div class="box-body" style="overflow-x:auto;"> <!-- <div class="box-body" style="overflow-x:auto;">-->
<table id="example1" class="table table-bordered table-hover"> <!-- <table id="example1" class="table table-bordered table-hover">-->
<thead> <!-- <thead>-->
<tr> <!-- <tr>-->
<?php <!-- --><?php
echo "<th>".$this->lang->line('Nom')."</th> // echo "<th>".$this->lang->line('Nom')."</th>
<th>".$this->lang->line('Solde Principal')."</th> // <th>".$this->lang->line('Solde Principal')."</th>
<th>".$this->lang->line('Solde Commission')."</th> // <th>".$this->lang->line('Solde Commission')."</th>
<th>".$this->lang->line('Commission banque')."</th> // <th>".$this->lang->line('Commission banque')."</th>
<th>".$this->lang->line('DEPOT'). 's'."</th> // <th>".$this->lang->line('DEPOT'). 's'."</th>
<th>".$this->lang->line('RETRAIT').'s'."</th>"; // <th>".$this->lang->line('RETRAIT').'s'."</th>";
?> // ?>
</tr> <!-- </tr>-->
</thead> <!-- </thead>-->
<tbody> <!-- <tbody>-->
<?php <!-- --><?php
if ($walletHyper) { // if ($walletHyper) {
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL ); // $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
echo "<tr> // echo "<tr>
<td>" . $walletHyper->first_row()->lastname . "</td> // <td>" . $walletHyper->first_row()->lastname . "</td>
<td>" . $fmt->format($walletHyper->first_row()->balance_princ) . "</td> // <td>" . $fmt->format($walletHyper->first_row()->balance_princ) . "</td>
<td>" . $fmt->format($walletHyper->first_row()->balance_com) . "</td> // <td>" . $fmt->format($walletHyper->first_row()->balance_com) . "</td>
<td>" . $fmt->format($totalCommissionBanque) . "</td>"; // <td>" . $fmt->format($totalCommissionBanque) . "</td>";
//
echo "<td>" . $depots->num_rows() . "</td> // echo "<td>" . $depots->num_rows() . "</td>
<td>" . $retraits->num_rows() . "</td> // <td>" . $retraits->num_rows() . "</td>
</tr>"; // </tr>";
//
} // }
?> // ?>
</tbody> <!-- </tbody>-->
</table> <!-- </table>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<!---->
</div> <!-- </div>-->
</section> </section>
</div> </div>

View File

@ -943,6 +943,9 @@
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"><?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3> <h3 class="box-title"><?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3>
<div class="box-tools"> <div class="box-tools">
<a class="btn btn-success" href="<?php echo current_url().($network_id ? '?show=paying_networks' : '')?>">
<?php echo $this->lang->line('paying_networks_accounts'); ?>
</a>
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=transaction' : '')?>"> <a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=transaction' : '')?>">
<?php echo $this->lang->line('transactions_historic'); ?> <?php echo $this->lang->line('transactions_historic'); ?>
</a> </a>

View File

@ -0,0 +1,218 @@
<link rel="stylesheet"
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('paying_networks_accounts')?>
</h1>
<?php
$site_url = base_url();
if ($alert == "ok") {
if (!$success == "ok") {
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('paying_networks'); ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
$sql2 = $networks;
if ($sql2 != false) {
$numrows = $networks->num_rows();
$num = 0;
if ($numrows > 0) {
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'></th>
<th><?php echo $this->lang->line('Nom'); ?></th>
<th><?php echo $this->lang->line('Pays'); ?></th>
<th align='center'>Wallet</th>
<th align='center'> <?php echo $this->lang->line('share_rate')?></th>
<th><?=$this->lang->line('Solde Commission')?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($sql2->result() as $row) {
$num++;
//$member_code = randomString1(10);
echo "<tr>
<td align='center'>$num</td>
<td>$row->name</td>
<td>$row->country</td>
<td><span class='label label-success'>".strtoupper($row->type)."</span></td>";
?>
<?php
if ($row->rate != null ) {
?>
<td>
<span class="label label-success" style="font-size: 1.1em;"><?= $row->rate . ' %'?></span>
</td>
<?php
} else {
?>
<td>
<span class="label label-danger" style="font-size: 1em;" ><?php echo $this->lang->line('not_defined'); ?></span>
</td>
<?php
}
?>
<td>
<?= $fmt->format($row->balance_com)?>
</td>
<?php
}
?>
</tbody>
</table>
<?php
} else {
echo $this->lang->line('Aucun réseau');
}
} else {
echo $this->lang->line('Aucun réseau');
}
?>
</div>
</div>
</div>
</div>
<div class="modal fade" id="configureRate" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('configure_share_rate'); ?></h3>
</div>
<div class="modal-body">
<form id="rateForm">
<div class="form-group">
<label for="rate"
class="col-form-label"><?php echo $this->lang->line('share_rate') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" max="100" required class="form-control"
name="rate" id="rate" value="0">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" class="btn btn-primary"
id="enableRate"> <?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script>
$(function () {
$('#validated').DataTable();
})
</script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
var network_id = null;
var config_id = null;
$(document).on("click", ".openModal", function () {
network_id = $(this).data('network-id');
config_id = $(this).data('config-id');
})
$(document).on("click", "#enableRate", function () {
// const network_id = $(this).data('network-id');
if ($('#rateForm')[0].checkValidity()) {
const rate = parseFloat($('#rate').val());
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/config_sharing_rate')?>',
type: 'POST',
dataType: 'json',
data: {"network_id": network_id, "rate": rate , "config_id" : config_id},
success: function (data) {
if (data == '200') {
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('sharing_updated')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(() => {
location.reload();
});
} else {
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
}
});
} else {
$('#rateForm')[0].reportValidity();
};
});
</script>