backoffice/application/views/gestion_wallet_hyp.php

807 lines
33 KiB
PHP
Raw Normal View History

2020-04-17 15:28:27 +00:00
<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') ?>">
<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') ?>">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
2020-04-17 15:28:27 +00:00
<?php
use Brick\Money\Context\AutoContext;
use Brick\Money\Money;
2020-04-17 15:28:27 +00:00
$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 = array_filter($transactions, function ($trans) use ($i, $months ,$years){
$month = date("m",strtotime($trans->date));
$year = date("Y",strtotime($trans->date));
return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'debit' ;
});
$retraits_data[] = sizeof($retraits_query_mounth);
}
$startDate = (new DateTime('01-'.$months[11].'-'.$years[11]))-> format('Y-m-d H:i:s');
$endDate = date_create_from_format ('m/Y',$months[0].'/'.$years[0])-> format('Y-m-d H:i:s');
$retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){
$date = strtotime($trans->date);
2020-04-19 08:51:28 +00:00
// return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'debit' ;
return $trans->type == 'debit' ;
2020-04-17 15:28:27 +00:00
});
/**
** Dépots
**/
$date = date("Y");
$depots_data[] = '';
$depots_data =array();
for ($i = 1; $i <= 12; $i++) {
$depots_query_mounth= array_filter($transactions, function ($trans) use ($i, $months ,$years){
$month = date("m",strtotime($trans->date));
$year = date("Y",strtotime($trans->date));
return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'credit' ;
});
$depots_data[] = sizeof($depots_query_mounth);
}
$depots = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){
$date = strtotime($trans->date);
2020-04-19 08:51:28 +00:00
// return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ;
return $trans->type == 'credit' ;
2020-04-17 15:28:27 +00:00
});
if($transactions!=false){
$transac=sizeof($transactions);
$array_transac = array();
$num = 0;
if ($transac > 0) {
foreach($transactions as $row) {
$num++;
$array_transac[] = $row->type;
}
$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();
}
2020-04-25 11:57:19 +00:00
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
2021-01-25 16:15:53 +00:00
$context = new \Brick\Money\Context\AutoContext();
2020-04-17 15:28:27 +00:00
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Wallet <?php echo $network . ' - ' .$country; ?>
2020-04-17 15:28:27 +00:00
</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-4 col-xs-6">
<div class="small-box bg-aqua">
<div class="inner">
<h3><?php echo $principal ?></h3>
2020-05-02 17:50:55 +00:00
<p><?php echo $this->lang->line('Solde Principal') ?></p>
2020-04-17 15:28:27 +00:00
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-green">
<div class="inner">
<h3><?php echo $commission ?></h3>
2020-05-02 17:50:55 +00:00
<p><?php echo $this->lang->line('Solde Commission') ?></p>
2020-04-17 15:28:27 +00:00
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
2020-04-19 08:51:28 +00:00
</div>
2020-04-17 15:28:27 +00:00
</div>
2020-04-19 08:51:28 +00:00
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-yellow">
<div class="inner">
<h3><?php echo $totalCommissionBanque ?></h3>
2020-05-02 17:50:55 +00:00
<p><?php echo $this->lang->line('Total commission de la banque') ?></p>
2020-04-19 08:51:28 +00:00
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
</div>
<div class="row">
<div class="margin">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
</div>
</div>
<div class="row centered">
<div class="col-lg-2 col-xs-6">
<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#rechargeAccount" style="white-space: normal;"><?php echo $this->lang->line('recharge_hypervisor_account') ?> </button>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-red-active">
<div class="inner">
<h3><?php echo $taux_client_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission client 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="taux_client_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
2020-04-19 08:51:28 +00:00
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_ag_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission agent géolocalisé 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="taux_ag_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_sup_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission superviseur 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="taux_sup_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_bq_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Part de la banque sur le 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="taux_bq_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
</div>
<div class="row">
<div class="col-lg-2 col-lg-offset-1 col-xs-6">
<div class="small-box bg-green-active">
<div class="inner">
<h3><?php echo $taux_client_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission client 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="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-green-active">
<div class="inner">
<h3><?php echo $frais_d; ?><sup style="font-size: 20px"><?= $this->session->userdata('currency_code') ?></sup></h3>
<p><?php echo $this->lang->line('Frais minimun de la banque sur le 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="frais_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-yellow-active">
<div class="inner">
<h3><?php echo $taux_ag_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission agent géolocalisé 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="taux_ag_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-yellow-active">
<div class="inner">
<h3><?php echo $taux_sup_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission superviseur 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="taux_sup_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-yellow-active">
<div class="inner">
<h3><?php echo $taux_bq_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Part de la banque sur le 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="taux_bq_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
</div>
<div class="row">
2020-04-17 15:28:27 +00:00
<div class="col-xs-12">
<div class="box box-success">
<div class="box-header with-border">
2020-05-02 17:50:55 +00:00
<h3 class="box-title"><?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3>
<div class="box-tools">
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=transaction' : '')?>">
<?php echo $this->lang->line('transactions_historic'); ?>
</a>
<a class="btn btn-info" href="<?php echo current_url().($network_id ? '?history=recharge' : '')?>">
<?php echo $this->lang->line('recharge_historic'); ?>
</a>
</div>
2020-04-17 15:28:27 +00:00
</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">
2020-05-02 17:50:55 +00:00
<h3 class="box-title"><?php echo $this->lang->line("Parts dépots & retraits"); ?></h3>
2020-04-17 15:28:27 +00:00
</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"><?php echo $this->lang->line('Commissions Superviseurs') ?></h3>
2021-01-25 16:15:53 +00:00
<div class="box-tools">
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=commission_transfer' : '')?>">
<?php echo $this->lang->line('commission_transfer_historic'); ?>
</a>
<a class="btn btn-success" href="<?php echo current_url().($network_id ? '?history=balance_statement' : '')?>">
<?php echo $this->lang->line('balance_statement'); ?>
</a>
</div>
2020-04-17 15:28:27 +00:00
</div>
<div class="box-body" style="overflow-x:auto;">
2020-04-17 15:28:27 +00:00
<table id="example1" class="table table-bordered table-hover">
<thead>
<tr>
2020-05-02 17:50:55 +00:00
<?php
echo "<th>".$this->lang->line('Nom')."</th>
<th>".$this->lang->line('Solde Principal')."</th>
<th>".$this->lang->line('Solde Commission')."</th>
<th>".$this->lang->line('Commission banque')."</th>
<th>".$this->lang->line('DEPOT'). 's'."</th>
<th>".$this->lang->line('RETRAIT').'s'."</th>";
?>
2020-04-17 15:28:27 +00:00
</tr>
</thead>
<tbody>
<?php
if($superviseurs!=false){
foreach($superviseurs->result() as $row) {
$wallet = null;
foreach ($agentWalletInfos->result() as $value) {
if ($value->agent_id == $row->agent_id) {
$wallet = $value;
break;
}
}
$com = 0;
$princ = 0;
if($wallet) {
$com = $wallet->balance_com;
$princ = $wallet->balance_princ;
}
echo "<tr>
<td>".$row->lastname."</td>
2021-01-25 16:15:53 +00:00
<td>".Money::of(round($princ,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR')."</td>
<td>".Money::of(round($com,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR')."</td>";
2020-04-17 15:28:27 +00:00
$nb_depots = 0;
$nb_retraits = 0;
2020-04-19 08:51:28 +00:00
$commission_banque = 0;
2020-04-17 15:28:27 +00:00
foreach($depots as $depot){
if($depot->code_parrain == $row->member_code) {
$nb_depots ++;
2020-04-19 08:51:28 +00:00
$commission_banque+= $depot->commission_banque;
2020-04-17 15:28:27 +00:00
}
}
foreach($retraits as $retrait){
if($retrait->code_parrain == $row->member_code) {
$nb_retraits ++;
2020-04-19 08:51:28 +00:00
$commission_banque+= $retrait->commission_banque;
2020-04-17 15:28:27 +00:00
}
}
2021-01-25 16:15:53 +00:00
echo "<td>".Money::of(round($commission_banque,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR')."</td>
2020-04-19 08:51:28 +00:00
<td>".$nb_depots."</td>
2020-04-17 15:28:27 +00:00
<td>".$nb_retraits."</td>
</tr>";
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="modal-update">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h3 class="modal-title"><?php echo $this->lang->line('Configuration du wallet'); ?></h3>
</div>
<div class="modal-body">
<form id="walletForm">
<div class="form-group">
<label for="nom"
class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_client_r" name="taux_client_r" value="<?= $taux_client_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission agent géolocalisé sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_ag_r" id="taux_ag_r" value="<?= $taux_ag_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_sup_r" id="taux_sup_r" value="<?= $taux_sup_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" id="taux_bq_r"
name="taux_bq_r" value="<?= $taux_bq_r ?>">
</div>
<div class="form-group">
<label for="adresse"
class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_client_d" name="taux_client_d" value="<?= $taux_client_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Frais minimun de la banque sur le dépot') . ' ('. $this->session->userdata('currency_code').')'; ?></label>
<input type="number" min="0" required class="form-control" id="frais_d"
name="frais_d" value="<?= $frais_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission agent géolocalisé sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" id="taux_ag_d"
name="taux_ag_d" value="<?= $taux_ag_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_sup_d" name="taux_sup_d" value="<?= $taux_sup_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_bq_d" id="taux_bq_d" value="<?= $taux_bq_d ?>">
</div>
</form>
</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="button" id="updateWallet" data-config-id="<?= $idConfig ?>"
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="rechargeAccount" 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('recharge_hypervisor_account'); ?></h3>
</div>
<div class="modal-body">
<?php if ($walletPassword != null) { ?>
<form id="rechargeAccountForm">
<div class="form-group">
<label for="montant" class="col-form-label"><?php echo $this->lang->line('Montant') ?></label>
<input type="text" required class="form-control" id="montant" name="montant" >
</div>
2020-05-19 16:32:41 +00:00
<!-- <div class="form-group">-->
<!-- <label for="password" class="col-form-label">--><?php //echo $this->lang->line('mot de passe') ?><!--</label>-->
<!-- <input type="password" required class="form-control" name="password" id="password">-->
<!-- </div>-->
<div class="form-group">
2020-05-19 16:32:41 +00:00
<label><?php echo $this->lang->line('mot de passe') ?></label>
<div class="input-group" id="show_hide_password">
<input class="form-control" name="password" id="password" type="password">
<div class="input-group-addon">
<a href=""><i class="fa fa-eye-slash" aria-hidden="true"></i></a>
</div>
</div>
</div>
<div class="clearfix">
<a href="#" id="resetPassword" class="pull-right forgot-password" data-wallet_password_id="<?php echo $walletPassword->id ?>" data-network="<?php echo $network ?>" data-country="<?php echo $country ?>"
data-email="<?php echo $walletPassword->email ?>">
<?php echo $this->lang->line('i_forgot_password') ?>
</a>
</div>
</form>
<?php }else{ ?>
<div class="text-center">
<h4> <?php echo $this->lang->line('no_wallet_password') ?></h4>
<a href="<?php echo base_url('index.php/Hyperviseur_dash/walletPassword') ?>" alt="" class="btn btn-primary"><?php echo $this->lang->line('click_here') ?></a>
</div>
<?php } ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<?php if ($walletPassword != null) { ?>
<button type="button" class="btn btn-primary" data-wallet_id="<?php echo $wallet_id ?>" data-salt="<?php echo $walletPassword->salt ?>" data-encrypted_password="<?php echo $walletPassword->encrypted_password ?>" id="rechargeWallet" >
<?php echo $this->lang->line('recharge'); ?>
</button>
<?php }?>
</div>
</div>
</div>
</div>
2020-04-17 15:28:27 +00:00
</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 src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.5.4"></script>
2020-04-17 15:28:27 +00:00
<script>
$(function () {
$('#example1').DataTable();
anElement = new AutoNumeric('#montant', '', {digitGroupSeparator: ' ', decimalPlaces:'0', minimumValue : '1' , maximumValue: '99999999999999999999999999'});
2020-05-19 16:32:41 +00:00
$("#show_hide_password a").on('click', function(event) {
event.preventDefault();
if($('#show_hide_password input').attr("type") == "text"){
$('#show_hide_password input').attr('type', 'password');
$('#show_hide_password i').addClass( "fa-eye-slash" );
$('#show_hide_password i').removeClass( "fa-eye" );
}else if($('#show_hide_password input').attr("type") == "password"){
$('#show_hide_password input').attr('type', 'text');
$('#show_hide_password i').removeClass( "fa-eye-slash" );
$('#show_hide_password i').addClass( "fa-eye" );
}
});
// $('#example1').DataTable({
2020-04-17 15:28:27 +00:00
// "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>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
$('#updateWallet').click(function () {
var id_config = $(this).data('config-id');
if ($('#walletForm')[0].checkValidity()) {
var taux_client_r = parseFloat($('#taux_client_r').val());
var taux_client_d = parseFloat($('#taux_client_d').val());
var taux_ag_r = parseFloat($('#taux_ag_r').val());
var taux_ag_d = parseFloat($('#taux_ag_d').val());
var taux_sup_r = parseFloat($('#taux_sup_r').val());
var taux_sup_d = parseFloat($('#taux_sup_d').val());
var taux_bq_d = parseFloat($('#taux_bq_d').val());
var taux_bq_r = parseFloat($('#taux_bq_r').val());
var frais_d = $('#frais_d').val();
var sommeRetrait = taux_ag_r + taux_sup_r + taux_bq_r;
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d;
if((taux_ag_r + taux_sup_r) > 100){
toastr.error("<?php echo $this->lang->line('first_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if((taux_ag_d + taux_sup_d) > 100){
toastr.error("<?php echo $this->lang->line('second_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if(sommeRetrait >= taux_client_r){
toastr.error("<?php echo $this->lang->line('third_rule')?>", "<?php echo $this->lang->line('management_rule')?>")
}else if(sommeDepot >= 100){
toastr.error("<?php echo $this->lang->line('fourth_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else{
$.ajax({
url: '<?php echo base_url('index.php/Gestion/config_wallet/update')?>',
type: 'POST',
dataType: 'json',
data: {
"id_config": id_config,
"taux_client_r": taux_client_r,
"taux_client_d": taux_client_d,
"taux_ag_r": taux_ag_r,
"taux_ag_d": taux_ag_d,
"taux_sup_r": taux_sup_r,
"taux_sup_d": taux_sup_d,
"taux_bq_r": taux_bq_r,
"taux_bq_d": taux_bq_d,
2021-05-25 10:55:59 +00:00
"frais_d": frais_d,
"type" : "visa"
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('wallet_update')?>",
text:"<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}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 {
$('#walletForm')[0].reportValidity();
}
});
2020-04-17 15:28:27 +00:00
$('#resetPassword').click(function () {
const wallet_password_id = $(this).data('wallet_password_id');
const network = $(this).data('network');
const country = $(this).data('country');
const email = $(this).data('email');
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/resetWalletPassword')?>',
type: 'POST',
dataType: 'json',
data: {
"wallet_password_id": wallet_password_id,
"email": email,
"network" : network ,
"country" : country
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('password_has_been_reset')?>",
text:"<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}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')?>");
}
});
});
$('#rechargeWallet').click(function () {
const wallet_id = $(this).data('wallet_id');
const salt = $(this).data('salt');
const encrypted_password = $(this).data('encrypted_password');
if ($('#rechargeAccountForm')[0].checkValidity()) {
const montant = anElement.getNumber(); //parseFloat($('#montant').val());
const password = $('#password').val();
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/recharge_wallet')?>',
type: 'POST',
dataType: 'json',
data: {
"wallet_id": wallet_id,
"montant": montant ,
"password": password,
"salt" : salt,
"encrypted_password" : encrypted_password
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('account_recharged')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else if(data == '400'){
toastr.error("<?php echo $this->lang->line('incorrect_password')?>" , "<?php echo $this->lang->line('request_error')?>");
}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 {
$('#rechargeAccountForm')[0].reportValidity();
}
});
2020-04-17 15:28:27 +00:00
</script>
<!-- Page script -->
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script>