backoffice/application/views/gestion_wallet.php

388 lines
16 KiB
PHP
Raw Normal View History

2020-02-06 10:09:39 +00:00
<link rel="stylesheet" href="<?php echo base_url('bower_components/jvectormap/jquery-jvectormap.css') ?>">
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
<link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>">
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script>
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<?php
function convertDate($date){
$month = null;
switch ($date) {
case "Jan":
$month = 1;
break;
case "Feb":
$month = 2;
break;
case "Mar":
$month = 3;
break;
case "Apr":
$month = 4;
break;
case "May":
$month = 5;
break;
case "Jun":
$month = 6;
break;
case "Jul":
$month = 7;
break;
case "Aug":
$month = 8;
break;
case "Sep":
$month = 9;
break;
case "Oct":
$month = 10;
break;
case "Nov":
$month = 11;
break;
case "Dec":
$month = 12;
break;
}
return $month;
}
$month = time();
$months[]=convertDate(date("M"));
$label_months [] = date("M")." ".date("Y");
$years[]= date("Y");
for ($i = 1; $i <= 11; $i++) {
$month = strtotime('last month', $month);
$months [] = convertDate(date("M", $month));
$years[] = date("Y", $month);
$label_months [] = date("M", $month)." ".date("Y", $month);
}
/**
** Retraits
**/
$date = date("Y");
$retraits_data[] = '';
$retraits_data =array();
for ($i = 1; $i <= 12; $i++) {
$retraits_query_mounth = $this->db->query("SELECT id FROM infos_transaction
WHERE network_id='".$network_id."'
AND MONTH(date_created) = '".$months[$i-1]."'
AND YEAR(date_created) = '".$years[$i-1]."'
AND type_transac='debit'");
$retraits_data[] = $retraits_query_mounth->num_rows();
}
/**
** Dépots
**/
$date = date("Y");
$depots_data[] = '';
$depots_data =array();
for ($i = 1; $i <= 12; $i++) {
$depots_query_mounth = $this->db->query("SELECT id FROM infos_transaction
WHERE network_id='".$network_id."'
AND MONTH(date_created) = '".$months[$i-1]."'
AND YEAR(date_created) = '".$years[$i-1]."'
AND type_transac='credit'");
$depots_data[] = $depots_query_mounth->num_rows();
}
if($transactions!=false){
$transac=$transactions->num_rows();
$array_transac = array();
$num = 0;
if ($transac > 0) {
foreach($transactions->result() as $row) {
$num++;
$array_transac[] = $row->type_transac;
}
$vals_transac = array_count_values($array_transac);
$pieChart = array();
foreach(array_keys($vals_transac) as $paramName) {
$color = dechex(rand(0x000000, 0xFFFFFF));
$trash = array("value" => $vals_transac[$paramName],
"color" => "#".$color,
"highlight" => "#".$color,
"label" => $paramName);
$pieChart[]= $trash;
}
}
}else{
$pieChart = array();
}
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Gestion des wallets <?php echo $network; ?>
</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-lg-3 col-xs-6">
<div class="small-box bg-aqua">
<div class="inner">
<h3><?php echo $taux_com_retrait; ?><sup style="font-size: 20px">%</sup></h3>
<p>Taux de commission sur retraits</p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
<a href="#" data-toggle="modal" data-target="#modal-update" data-type="com_ret" class="small-box-footer">Modifier <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green">
<div class="inner">
<h3><?php echo $taux_com_ag_retrait; ?><sup style="font-size: 20px">%</sup></h3>
<p>Comission agent sur retrait</p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
<a href="#" data-toggle="modal" data-target="#modal-update" data-type="com_ag_ret" class="small-box-footer">Modifier <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-yellow">
<div class="inner">
<h3><?php echo $com_depot; ?> <sup style="font-size: 20px">FCFA</sup></h3>
<p>Comission sur dépot</p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<a href="#" data-toggle="modal" data-target="#modal-update" data-type="com_dep" class="small-box-footer">Modifier <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-red">
<div class="inner">
<h3><?php echo $taux_com_ag_depot; ?><sup style="font-size: 20px">%</sup></h3>
<p>Comission agent sur dépot</p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<a href="#" data-toggle="modal" data-target="#modal-update" data-type="com_ag_dep" class="small-box-footer">Modifier <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
<div class="col-xs-12">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Retraits et dépots des 12 derniers mois<?php //echo $this->lang->line('Souscription des 12 derniers mois'); ?></h3>
</div>
<div class="box-body">
<div class="chart" id="chart">
<canvas id="barChart" style="height:230px"></canvas>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Parts dépots & retraits<?php //echo $this->lang->line("Utilisateurs géolocalisés par ville"); ?></h3>
</div>
<div class="box-body" id="chart2">
<canvas id="pieChart" style="height:250px"></canvas>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="box">
<div class="box-header">
<h3 class="box-title">Commissions Superviseurs</h3>
</div>
<div class="box-body">
<table id="example1" class="table table-bordered table-hover">
<thead>
<tr>
<th>Nom</th>
<th>Solde Com.</th>
<th>Dépots</th>
<th>Retraits</th>
</tr>
</thead>
<tbody>
<?php
$data = $agentWalletInfos;
if($data!=false){
$numrows=$data->num_rows();
$num = 0;
if ($numrows > 0) {
foreach($data->result() as $row) {
$num++;
echo "<tr>
<td>".$row->lastname."</td>
<td>".$row->balance_com."</td>
<td> 4</td>
<td>X</td>
</tr>";
}
}
}
?>
<tr>
<td>Trident</td>
<td>Win 7</td>
<td> 4</td>
<td>X</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modal-update">
<div class="modal-dialog">
<div class="modal-content">
<form action="<?php echo base_url('index.php/Gestion/updateTaux')?>" method="post">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">Définissez la nouvelle valeur<?php //echo $this->lang->line('Sélectionnez le pays'); ?></h4>
</div>
<div class="modal-body">
<div class="form-group">
<input class="form-control" type="number" value="" name="taux" id="taux">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="submit" class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
</div>
</form>
</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('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<!-- ChartJS -->
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script>
<script>
$(function () {
$('#example1').DataTable({
"aLengthMenu": [[5, 10, 15, -1], [5, 10, 5, "All"]],
"iDisplayLength": 5
})
$('#example2').DataTable({
'paging' : true,
'lengthChange': false,
'searching' : false,
'ordering' : true,
'info' : true,
'autoWidth' : false
})
})
</script>
<script>
var areaChartData = {
labels : <?php echo json_encode($label_months) ?>,
datasets: [
{
label : 'Electronics',
fillColor : 'rgba(255, 162, 0, 1)',
strokeColor : 'rgba(255, 162, 0, 1)',
pointColor : 'rgba(255, 162, 0, 1)',
pointStrokeColor : '#ffa200',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data: <?php echo json_encode($depots_data) ?>
},
{
label : 'Digital Goods',
fillColor : 'rgba(0, 187, 255, 1)',
strokeColor : 'rgba(0, 187, 255, 1)',
pointColor : '#00bbff',
pointStrokeColor : 'rgba(0, 187, 255, 1)',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(0, 187, 255, 1)',
data : <?php echo json_encode($retraits_data) ?>
}
]
};
var Pie = '<?php echo json_encode($pieChart) ?>';
if(Pie==='[]'){
var select = document.getElementById('chart2');
$(select.children).hide();
$(select).append("<p>Aucune transaction</p>");
}else{
Pie = JSON.parse(Pie);
}
</script>
<!-- Page script -->
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script>