+ Deleting wallet transactions
This commit is contained in:
parent
eb17b9605f
commit
75f13c8af0
|
@ -1903,11 +1903,7 @@ class Gestion extends CI_Controller
|
|||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ;
|
||||
$data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ;
|
||||
$endDate = Date('Y-m-d', strtotime($endDate."+1 day"));
|
||||
if ($type == 'transaction')
|
||||
$data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
|
||||
else if ($type == 'transaction_ilink')
|
||||
$data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
||||
else
|
||||
if ($type == 'recharge')
|
||||
$data['transactions'] = $this->wallet_model->getRecharges($startDate, $endDate, $network_id);
|
||||
|
||||
$data['active'] = "wallet";
|
||||
|
@ -1926,6 +1922,8 @@ class Gestion extends CI_Controller
|
|||
$this->load->view('header_gestion', $data);
|
||||
if ($type == 'transaction')
|
||||
$this->load->view('historique_transactions');
|
||||
else if ($type == 'deleted_transactions')
|
||||
$this->load->view('historique_transactions_deleted');
|
||||
else if ($type == 'transaction_ilink')
|
||||
$this->load->view('historique_transactions_ilink');
|
||||
else
|
||||
|
|
|
@ -527,14 +527,13 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
|
||||
if ($type == 'transaction')
|
||||
$data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
|
||||
else if ($type == 'transaction_ilink') {
|
||||
if ($type == 'transaction_ilink') {
|
||||
$networkDetails = $this->user_model->getNetworkDetails($network_id);
|
||||
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
|
||||
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
|
||||
// $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
||||
} else if ($type == 'commission_transfer')
|
||||
}else if ($type == 'deleted_transactions')
|
||||
$data['transactions'] = $this->user_model->getDeletedTransactions($startDate, $endDate, $this->session->userdata('network_id'));
|
||||
else if ($type == 'commission_transfer')
|
||||
$data['transactions'] = $this->wallet_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
|
||||
else if ($type == 'balance_statement')
|
||||
$data['wallets'] = $this->user_model->getInfosWalletAgentForHyper($this->session->userdata('network_id'));
|
||||
|
@ -562,6 +561,8 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$this->load->view('historique_transactions');
|
||||
else if ($type == 'transaction_ilink')
|
||||
$this->load->view('historique_transactions_ilink');
|
||||
else if ($type == 'deleted_transactions')
|
||||
$this->load->view('historique_transactions_deleted');
|
||||
else if ($type == 'commission_transfer')
|
||||
$this->load->view('historique_transferts_commission');
|
||||
else if ($type == 'balance_statement')
|
||||
|
@ -573,6 +574,27 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$this->load->view('footer');
|
||||
}
|
||||
|
||||
public function delete_wallet_transaction(){
|
||||
if ($this->isLogged()) {
|
||||
$datetime = $this->user_model->getCurrentTimeByNetworkID($this->session->userdata('network_id'));
|
||||
$id = $this->input->post('id_transaction');
|
||||
|
||||
$data = array(
|
||||
'deleted' => 1 ,
|
||||
'deleted_at' => $datetime
|
||||
);
|
||||
|
||||
$this->db->where('id',$id);
|
||||
$query = $this->db->update('wallet_transaction',$data);
|
||||
|
||||
if ($query) {
|
||||
echo json_encode("200");
|
||||
} else {
|
||||
echo json_encode("500");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function walletPassword()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\CurrencyConverter;
|
||||
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||
use Brick\Money\Money;
|
||||
|
||||
class WalletTransaction extends CI_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load member model
|
||||
$this->load->model('pagination/WalletTransaction_model', 'wt_model');
|
||||
$this->load->model('wallet_model');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getLists()
|
||||
{
|
||||
$data = $row = array();
|
||||
|
||||
// Fetch member's records
|
||||
$wtData = $this->wt_model->getRows($_POST);
|
||||
|
||||
$i = $_POST['start'];
|
||||
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
||||
$config = $this->wallet_model->getConfigWallet($_POST['id_network'])->first_row();
|
||||
foreach ($wtData as $row) {
|
||||
|
||||
$type = $row->type_transac == 'credit' ? $this->lang->line('DEPOT') : $this->lang->line('RETRAIT');
|
||||
|
||||
$banque = 0;
|
||||
if($row->type_transac == 'credit'){
|
||||
if($row->montant < 0){
|
||||
$commission = (-$row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot;
|
||||
$net = $row->montant + $commission;
|
||||
}else{
|
||||
$commission = ( $row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot;
|
||||
$net = $row->montant - $commission;
|
||||
}
|
||||
$banque = $row->montant * (1 - ($config->taux_com_client_depot / 100));
|
||||
}else{
|
||||
$net = $row->montant ;
|
||||
}
|
||||
|
||||
$disabled = $row->canceled ? "disabled" : "";
|
||||
$disabled1 = $row->deleted ? "disabled" : "";
|
||||
|
||||
$data[] = array($row->id,strtoupper($type), join(" ", str_split($row->numCarte, 4)), $fmt->format($net), ($row->type_transac == 'credit' ? $fmt->format($banque) : ""),
|
||||
$fmt->format( $row->commission_banque), $fmt->format( $row->commission_hyp), $fmt->format( $row->commission_sup), $fmt->format( $row->commission_ag), $row->agent , $row->date_created,
|
||||
'<button data-id-transaction="'.$row->id.'" id="cancel" class="btn btn-danger btn-block" '.$disabled.' >
|
||||
'.$this->lang->line('cancel').'
|
||||
</button>
|
||||
<button data-toggle="modal" data-target="#deleteTransaction" data-id-transaction="'.$row->id.'" class="btn btn-danger btn-block openModal" '.$disabled1.' >
|
||||
'.$this->lang->line('Supprimer').'
|
||||
</button>');
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => $_POST['draw'],
|
||||
"recordsTotal" => $this->wt_model->countAll($_POST),
|
||||
"recordsFiltered" => $this->wt_model->countFiltered($_POST),
|
||||
"data" => $data,
|
||||
);
|
||||
|
||||
// Output to JSON format
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
}
|
|
@ -598,5 +598,10 @@ $lang['cancellation_date'] = "Cancellation date";
|
|||
$lang['receiver'] = "Receiver";
|
||||
$lang['loading'] = "Loading ...";
|
||||
$lang['credit_request_canceled_by_hypervisor'] = "Credit request canceled by hypervisor";
|
||||
$lang['credit_request_canceled_by_hypervisor_message'] = "Credit request number %s of %s has been canceled."
|
||||
$lang['credit_request_canceled_by_hypervisor_message'] = "Credit request number %s of %s has been canceled.";
|
||||
$lang['transaction_deleted'] = "Transaction deleted";
|
||||
$lang['delete_transaction'] = "Delete a transaction";
|
||||
$lang['are_you_sure'] = "Are you sure what you are doing?";
|
||||
$lang['deleted_transactions'] = "Deleted Transactions";
|
||||
$lang['deletion_date'] = "Date of deletion";
|
||||
?>
|
||||
|
|
|
@ -610,5 +610,10 @@ $lang['cancellation_date'] = "Date d'annulation";
|
|||
$lang['receiver'] = "Destinataire";
|
||||
$lang['loading'] = "Chargement en cours ...";
|
||||
$lang['credit_request_canceled_by_hypervisor'] = "Demande de crédit annulée par l'hyperviseur";
|
||||
$lang['credit_request_canceled_by_hypervisor_message'] = "La demande de credit numéro %s de %s a été annulée."
|
||||
$lang['credit_request_canceled_by_hypervisor_message'] = "La demande de credit numéro %s de %s a été annulée.";
|
||||
$lang['transaction_deleted'] = "Transaction supprimée";
|
||||
$lang['delete_transaction'] = "Supprimer une transaction";
|
||||
$lang['are_you_sure'] = "Êtes vous sûr de ce que vous faites ?";
|
||||
$lang['deleted_transactions'] = "Transactions supprimées";
|
||||
$lang['deletion_date'] = "Date de suppression";
|
||||
?>
|
||||
|
|
|
@ -1854,6 +1854,18 @@ class User_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getDeletedTransactions($debut , $fin , $id_network){
|
||||
$chain = $debut ? " AND deleted_at BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||
$query = $this->db->query("SELECT *
|
||||
FROM infos_transaction
|
||||
WHERE deleted = 1 AND `network_id`=".$id_network.$chain);
|
||||
if($query->num_rows()>0){
|
||||
return $query;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTransactionsSup($debut , $fin , $codeMembre){
|
||||
$chain = $debut ? " AND date_created BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||
$query = $this->db->query("SELECT *
|
||||
|
|
|
@ -727,19 +727,6 @@ class Wallet_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getIlinkTransactions($debut , $fin , $id_network){
|
||||
$chain = $debut ? " AND date BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||
$query = $this->db->query("SELECT *
|
||||
FROM infos_ilink_transaction
|
||||
WHERE `network_emetteur`=" . $id_network . $chain);
|
||||
//var_dump($query->result_array());
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNetworkIlinTransactions($id_network){
|
||||
$query = $this->db->query("SELECT *
|
||||
FROM infos_ilink_transaction
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class WalletTransaction_model extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
// Set table name
|
||||
$this->table = 'infos_transaction';
|
||||
// Set orderable column fields
|
||||
$this->column_order = array('id', 'type_transac', 'numCarte', 'montant', 'commission_banque', 'commission_hyp', 'commission_sup', 'commission_ag',
|
||||
'agent','date_created', null);
|
||||
// Set searchable column fields
|
||||
$this->column_search = array('id', 'type_transac', 'numCarte', 'montant', 'commission_banque', 'commission_hyp', 'commission_sup', 'commission_ag',
|
||||
'agent','date_created');
|
||||
// Set default order
|
||||
$this->order = array('date_created' => 'desc');
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch members data from the database
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
public function getRows($postData)
|
||||
{
|
||||
$this->_get_datatables_query($postData);
|
||||
if ($postData['length'] != -1) {
|
||||
$this->db->limit($postData['length'], $postData['start']);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
/*
|
||||
* Count all records
|
||||
*/
|
||||
public function countAll($postData)
|
||||
{
|
||||
$this->db->from($this->table);
|
||||
$this->db->where('network_id', $postData['id_network']);
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
/*
|
||||
* Count records based on the filter params
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
public function countFiltered($postData)
|
||||
{
|
||||
$this->_get_datatables_query($postData);
|
||||
$query = $this->db->get();
|
||||
return $query->num_rows();
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform the SQL queries needed for an server-side processing requested
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
private function _get_datatables_query($postData)
|
||||
{
|
||||
|
||||
$this->db->from($this->table);
|
||||
$this->db->where('deleted', 0);
|
||||
$this->db->where('network_id', $postData['id_network']);
|
||||
if (strlen($postData['startDate']) > 0 && strlen($postData['endDate']) > 0) {
|
||||
$this->db->where('date_created >=', date('Y-m-d', strtotime($postData['startDate'])));
|
||||
$this->db->where('date_created <', date('Y-m-d', strtotime($postData['endDate']. "+1 day")));
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
// loop searchable columns
|
||||
foreach ($this->column_search as $item) {
|
||||
// if datatable send POST for search
|
||||
if ($postData['search']['value']) {
|
||||
// first loop
|
||||
if ($i === 0) {
|
||||
// open bracket
|
||||
$this->db->group_start();
|
||||
$this->db->like($item, $postData['search']['value']);
|
||||
} else {
|
||||
$this->db->or_like($item, $postData['search']['value']);
|
||||
}
|
||||
|
||||
// last loop
|
||||
if (count($this->column_search) - 1 == $i) {
|
||||
// close bracket
|
||||
$this->db->group_end();
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (isset($postData['order'])) {
|
||||
$this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']);
|
||||
} else if (isset($this->order)) {
|
||||
$order = $this->order;
|
||||
$this->db->order_by(key($order), $order[key($order)]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -162,37 +162,6 @@
|
|||
const format = lang === 'french' ? 'fr' : 'en';
|
||||
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
|
||||
|
||||
//$('#listeMembres1').DataTable({
|
||||
// "aaSorting": [[4, "desc"]],
|
||||
// "columnDefs": [{
|
||||
// targets: [4, 5],
|
||||
// render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format),
|
||||
// },
|
||||
// {
|
||||
// "targets": [ 7 ],
|
||||
// "visible": false
|
||||
// }
|
||||
// ],
|
||||
// dom: 'Bfrtip',
|
||||
// "buttons": [
|
||||
// 'pageLength',
|
||||
// {
|
||||
// extend: 'excelHtml5',
|
||||
// title: "<?//=$this->lang->line('incoming_credits_requests_accepted')?>//"
|
||||
// },
|
||||
// {
|
||||
// extend: 'csvHtml5',
|
||||
// title: "<?//=$this->lang->line('incoming_credits_requests_accepted')?>//"
|
||||
// },
|
||||
// {
|
||||
// extend: 'pdfHtml5',
|
||||
// orientation: 'landscape',
|
||||
// pageSize: 'LEGAL',
|
||||
// title: "<?//=$this->lang->line('incoming_credits_requests_accepted')?>//"
|
||||
// }
|
||||
// ]
|
||||
//});
|
||||
|
||||
var table = $('#listeMembres1').DataTable({
|
||||
// Processing indicator
|
||||
"processing": true,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<link rel="stylesheet"
|
||||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
@ -65,16 +66,15 @@
|
|||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('Historique des transactions') ?></h3>
|
||||
<?php if ($this->session->userdata('category') != 'super') { ?>
|
||||
<div class="box-tools">
|
||||
<a class="btn btn-success" href="<?php echo current_url().'?history=deleted_transactions'?>">
|
||||
<?php echo $this->lang->line('deleted_transactions'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<?php
|
||||
if($transactions){
|
||||
$numrows = $transactions->num_rows();
|
||||
$num = 0;
|
||||
if ($numrows > 0) {
|
||||
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
||||
?>
|
||||
|
||||
<table id="transactions" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -94,66 +94,23 @@
|
|||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
$config = $configWallet->first_row();
|
||||
foreach ($transactions->result() as $row) {
|
||||
$num++;
|
||||
$type = $row->type_transac == 'credit' ? $this->lang->line('DEPOT') : $this->lang->line('RETRAIT');
|
||||
|
||||
$net = 0;
|
||||
$banque = 0;
|
||||
if($row->type_transac == 'credit'){
|
||||
if($row->montant < 0){
|
||||
$commission = (-$row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot;
|
||||
$net = $row->montant + $commission;
|
||||
}else{
|
||||
$commission = ( $row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot;
|
||||
$net = $row->montant - $commission;
|
||||
}
|
||||
$banque = $row->montant * (1 - ($config->taux_com_client_depot / 100));
|
||||
}else{
|
||||
$net = $row->montant ;
|
||||
}
|
||||
echo "<tr>
|
||||
<td align='center' >$row->id</td>
|
||||
<td>".strtoupper($type)."</td>
|
||||
<td>".join(" ", str_split($row->numCarte, 4))."</td>
|
||||
<td>".$fmt->format($net)."</td>
|
||||
<td>".($row->type_transac == 'credit' ? $fmt->format($banque) : "")."</td>
|
||||
<td>".$fmt->format( $row->commission_banque)."</td>
|
||||
<td>".$fmt->format( $row->commission_hyp)."</td>
|
||||
<td>".$fmt->format( $row->commission_sup)."</td>
|
||||
<td>".$fmt->format( $row->commission_ag)."</td>
|
||||
<td>".$row->agent."</td>
|
||||
<td>".$row->date_created."</td>";
|
||||
?>
|
||||
<?php if ($this->session->userdata('category') != 'super') { ?>
|
||||
<td>
|
||||
<button data-id-transaction="<?= $row->id ?>" id="cancel" class="btn btn-danger btn-block" <?php if($row->canceled) echo "disabled"?> >
|
||||
<b><?php echo $this->lang->line('cancel')?></b>
|
||||
</button>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo $this->lang->line('Aucune transaction');
|
||||
}
|
||||
}else {
|
||||
echo $this->lang->line('Aucune transaction');
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="deleteTransaction" 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('delete_transaction'); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h4> <?php echo $this->lang->line('are_you_sure'); ?> </h4>
|
||||
</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="delete" > <?php echo $this->lang->line('Confirmer'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -182,6 +139,13 @@
|
|||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
|
||||
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
|
||||
|
@ -191,13 +155,103 @@
|
|||
const lang = $('#picker').data('lang');
|
||||
const format = lang === 'french' ? 'fr' : 'en';
|
||||
moment.updateLocale(moment.locale(format), { invalidDate: "" }); // Blank text when is invalid date
|
||||
$('#transactions').DataTable({
|
||||
var table = $('#transactions').DataTable({
|
||||
// Processing indicator
|
||||
"processing": true,
|
||||
"language": {
|
||||
"processing": "<?= $this->lang->line('loading') ?>",
|
||||
"emptyTable" : "<?= $this->lang->line('Aucune transaction') ?>"
|
||||
},
|
||||
// DataTables server-side processing mode
|
||||
"serverSide": true,
|
||||
// Initial no order.
|
||||
"order": [],
|
||||
// Load data from an Ajax source
|
||||
"ajax": {
|
||||
"url": "<?php echo base_url('pagination/WalletTransaction/getLists'); ?>",
|
||||
"data":{
|
||||
"startDate" : "<?= $startDate?>",
|
||||
"endDate" : "<?= $endDate?>",
|
||||
"id_network" : <?= $id_network ?>
|
||||
},
|
||||
"type": "POST"
|
||||
},
|
||||
"aaSorting": [[ 0, "desc" ]],
|
||||
"columnDefs": [ {
|
||||
targets: 10,
|
||||
render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format)
|
||||
}]
|
||||
}],
|
||||
dom: 'Bfrtip',
|
||||
"buttons": [
|
||||
'pageLength',
|
||||
{
|
||||
"extend": 'excelHtml5',
|
||||
title: "<?= $this->lang->line('Historique des transactions') ?>",
|
||||
trim: false,
|
||||
"action": newexportaction
|
||||
},
|
||||
{
|
||||
extend: 'csvHtml5',
|
||||
title: "<?= $this->lang->line('Historique des transactions') ?>",
|
||||
trim: false,
|
||||
"action": newexportaction
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'LEGAL',
|
||||
title: "<?= $this->lang->line('Historique des transactions') ?>",
|
||||
trim: false,
|
||||
"action": newexportaction
|
||||
},
|
||||
// 'colvis'
|
||||
]
|
||||
});
|
||||
|
||||
table.buttons().container()
|
||||
.appendTo('#example_wrapper .col-sm-6:eq(0)');
|
||||
|
||||
function newexportaction(e, dt, button, config) {
|
||||
var self = this;
|
||||
var oldStart = dt.settings()[0]._iDisplayStart;
|
||||
dt.one('preXhr', function (e, s, data) {
|
||||
// Just this once, load all data from the server...
|
||||
data.start = 0;
|
||||
data.length = 2147483647;
|
||||
dt.one('preDraw', function (e, settings) {
|
||||
// Call the original action function
|
||||
if (button[0].className.indexOf('buttons-copy') >= 0) {
|
||||
$.fn.dataTable.ext.buttons.copyHtml5.action.call(self, e, dt, button, config);
|
||||
} else if (button[0].className.indexOf('buttons-excel') >= 0) {
|
||||
$.fn.dataTable.ext.buttons.excelHtml5.available(dt, config) ?
|
||||
$.fn.dataTable.ext.buttons.excelHtml5.action.call(self, e, dt, button, config) :
|
||||
$.fn.dataTable.ext.buttons.excelFlash.action.call(self, e, dt, button, config);
|
||||
} else if (button[0].className.indexOf('buttons-csv') >= 0) {
|
||||
$.fn.dataTable.ext.buttons.csvHtml5.available(dt, config) ?
|
||||
$.fn.dataTable.ext.buttons.csvHtml5.action.call(self, e, dt, button, config) :
|
||||
$.fn.dataTable.ext.buttons.csvFlash.action.call(self, e, dt, button, config);
|
||||
} else if (button[0].className.indexOf('buttons-pdf') >= 0) {
|
||||
$.fn.dataTable.ext.buttons.pdfHtml5.available(dt, config) ?
|
||||
$.fn.dataTable.ext.buttons.pdfHtml5.action.call(self, e, dt, button, config) :
|
||||
$.fn.dataTable.ext.buttons.pdfFlash.action.call(self, e, dt, button, config);
|
||||
} else if (button[0].className.indexOf('buttons-print') >= 0) {
|
||||
$.fn.dataTable.ext.buttons.print.action(e, dt, button, config);
|
||||
}
|
||||
dt.one('preXhr', function (e, s, data) {
|
||||
// DataTables thinks the first item displayed is index 0, but we're not drawing that.
|
||||
// Set the property to what it was before exporting.
|
||||
settings._iDisplayStart = oldStart;
|
||||
data.start = oldStart;
|
||||
});
|
||||
// Reload the grid with the original page. Otherwise, API functions like table.cell(this) don't work properly.
|
||||
setTimeout(dt.ajax.reload, 0);
|
||||
// Prevent rendering of the full data to the DOM
|
||||
return false;
|
||||
});
|
||||
});
|
||||
// Requery the server with the new one-time export settings
|
||||
dt.ajax.reload();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -238,6 +292,17 @@
|
|||
|
||||
</script>
|
||||
<script>
|
||||
toastr.options.closeButton = true;
|
||||
toastr.options.closeMethod = 'fadeOut';
|
||||
toastr.options.closeDuration = 5000;
|
||||
toastr.options.closeEasing = 'swing';
|
||||
|
||||
var id_transaction = null;
|
||||
|
||||
$(document).on("click", ".openModal", function () {
|
||||
id_transaction = $(this).data('id-transaction');
|
||||
})
|
||||
|
||||
$(document).on("click", "#cancel", function () {
|
||||
const id_transaction = $(this).data('id-transaction');
|
||||
$.ajax({
|
||||
|
@ -268,4 +333,33 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#delete').click(function(){
|
||||
$.ajax({
|
||||
url : '<?php echo base_url('index.php/Hyperviseur_dash/delete_wallet_transaction')?>',
|
||||
type : 'POST',
|
||||
dataType : 'json',
|
||||
data: {"id_transaction": id_transaction},
|
||||
success : function(data, statut){
|
||||
if(data=='200'){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('transaction_deleted')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
|
||||
}else{
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
|
||||
error : function(resultat, statut, erreur){
|
||||
console.log(resultat+" "+erreur);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,311 @@
|
|||
<!-- DataTables -->
|
||||
<link rel="stylesheet"
|
||||
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.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 isset($category) ? 'Wallet' : $this->lang->line('Gestion des wallets') ; echo ' '.$network.' - '.$country; ?>
|
||||
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
|
||||
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
|
||||
</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">×</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-md-4 col-sm-6 col-xs-12">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
|
||||
<span class="info-box-number">
|
||||
<input id="picker"
|
||||
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%" data-category="<?php echo isset($category) ? $category : null ?>"
|
||||
type="text" name="daterange" data-lang="<?php echo $this->session->userdata('site_lang') ?>"
|
||||
value="<?php echo ($startDate!=null & $endDate != null) ? $startDate. ' - '.$endDate : ''?>"/>
|
||||
|
||||
</span>
|
||||
<span> Format : <?php echo $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day'?> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('deleted_transactions') ?></h3>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<table id="transactions" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='center'>ID</th>
|
||||
<th align='center'>Type</th>
|
||||
<th><?php echo $this->lang->line('cart_number') ?></th>
|
||||
<th><?php echo $this->lang->line('customer_net_amount') ?></th>
|
||||
<th><?php echo $this->lang->line('bank_deposit_amount') ?></th>
|
||||
<th><?php echo $this->lang->line('Commission de la banque') ?></th>
|
||||
<th><?php echo $this->lang->line('Commission de l\'hyperviseur') ?></th>
|
||||
<th><?php echo $this->lang->line('Commission du superviseur') ?></th>
|
||||
<th><?php echo $this->lang->line('Commission de l\'agent') ?></th>
|
||||
<th><?php echo $this->lang->line('agent_name') ?></th>
|
||||
<th align='center'>Date</th>
|
||||
<th align='center'><?php echo $this->lang->line('deletion_date') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
if($transactions){
|
||||
$config = $configWallet->first_row();
|
||||
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
||||
foreach ($transactions->result() as $row) {
|
||||
|
||||
$type = $row->type_transac == 'credit' ? $this->lang->line('DEPOT') : $this->lang->line('RETRAIT');
|
||||
|
||||
$net = 0;
|
||||
$banque = 0;
|
||||
if($row->type_transac == 'credit'){
|
||||
if($row->montant < 0){
|
||||
$commission = (-$row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot;
|
||||
$net = $row->montant + $commission;
|
||||
}else{
|
||||
$commission = ( $row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot;
|
||||
$net = $row->montant - $commission;
|
||||
}
|
||||
$banque = $row->montant * (1 - ($config->taux_com_client_depot / 100));
|
||||
}else{
|
||||
$net = $row->montant ;
|
||||
}
|
||||
echo "<tr>
|
||||
<td align='center' >$row->id</td>
|
||||
<td>".strtoupper($type)."</td>
|
||||
<td>".join(" ", str_split($row->numCarte, 4))."</td>
|
||||
<td>".$fmt->format($net)."</td>
|
||||
<td>".($row->type_transac == 'credit' ? $fmt->format($banque) : "")."</td>
|
||||
<td>".$fmt->format( $row->commission_banque)."</td>
|
||||
<td>".$fmt->format( $row->commission_hyp)."</td>
|
||||
<td>".$fmt->format( $row->commission_sup)."</td>
|
||||
<td>".$fmt->format( $row->commission_ag)."</td>
|
||||
<td>".$row->agent."</td>
|
||||
<td>".$row->date_created."</td>
|
||||
<td>".$row->deleted_at."</td>";
|
||||
?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="deleteTransaction" 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('delete_transaction'); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h4> <?php echo $this->lang->line('are_you_sure'); ?> </h4>
|
||||
</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="delete" > <?php echo $this->lang->line('Confirmer'); ?></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 type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
|
||||
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
const lang = $('#picker').data('lang');
|
||||
const format = lang === 'french' ? 'fr' : 'en';
|
||||
moment.updateLocale(moment.locale(format), { invalidDate: "" }); // Blank text when is invalid date
|
||||
$('#transactions').DataTable({
|
||||
"aaSorting": [[ 11, "desc" ]],
|
||||
"columnDefs": [ {
|
||||
targets: [10,11],
|
||||
render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format)
|
||||
}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var startDate;
|
||||
var endDate;
|
||||
|
||||
$(function () {
|
||||
const lang = $('#picker').data('lang');
|
||||
const category = $('#picker').data('category');
|
||||
const id_network = "<?= $id_network?>";
|
||||
$('input[name="daterange"]').daterangepicker({
|
||||
opens: 'left',
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
|
||||
cancelLabel: 'Clear'
|
||||
}
|
||||
}, function (start, end, label) {
|
||||
const debut = start.format('YYYY-MM-DD');
|
||||
const fin = end.format('YYYY-MM-DD');
|
||||
if(category)
|
||||
window.location = "<?php echo current_url()?>" + "?history=deleted_transactions" + "&d=" + debut + "&f=" + fin;
|
||||
else
|
||||
window.location = "<?php echo current_url()?>" + "?id="+id_network+"&history=deleted_transactions" + "&d=" + debut + "&f=" + fin;
|
||||
|
||||
});
|
||||
|
||||
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
|
||||
//do something, like clearing an input
|
||||
$('#daterange').val('');
|
||||
if(category)
|
||||
window.location = "<?php echo current_url()?>" + "?history=deleted_transactions";
|
||||
else
|
||||
window.location = "<?php echo current_url()?>" + "?id="+id_network+"&history=deleted_transactions";
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
toastr.options.closeButton = true;
|
||||
toastr.options.closeMethod = 'fadeOut';
|
||||
toastr.options.closeDuration = 5000;
|
||||
toastr.options.closeEasing = 'swing';
|
||||
|
||||
var id_transaction = null;
|
||||
|
||||
$(document).on("click", ".openModal", function () {
|
||||
id_transaction = $(this).data('id-transaction');
|
||||
})
|
||||
|
||||
$(document).on("click", "#cancel", function () {
|
||||
const id_transaction = $(this).data('id-transaction');
|
||||
$.ajax({
|
||||
url : '<?php echo base_url('index.php/Gestion/cancelTransation')?>',
|
||||
type : 'POST',
|
||||
dataType : 'json',
|
||||
data: {"id_transaction": id_transaction},
|
||||
async:true,
|
||||
success : function(data){
|
||||
if(data){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('canceled_transaction')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
|
||||
}else{
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
|
||||
error : function(resultat, statut, erreur){
|
||||
console.log(resultat+" "+erreur);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#delete').click(function(){
|
||||
$.ajax({
|
||||
url : '<?php echo base_url('index.php/Hyperviseur_dash/delete_wallet_transaction')?>',
|
||||
type : 'POST',
|
||||
dataType : 'json',
|
||||
data: {"id_transaction": id_transaction},
|
||||
success : function(data, statut){
|
||||
if(data=='200'){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('transaction_deleted')?>",
|
||||
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
|
||||
}else{
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
|
||||
error : function(resultat, statut, erreur){
|
||||
console.log(resultat+" "+erreur);
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -189,7 +189,8 @@ use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
|||
// Processing indicator
|
||||
"processing": true,
|
||||
"language": {
|
||||
"processing": "<?= $this->lang->line('loading') ?>"
|
||||
"processing": "<?= $this->lang->line('loading') ?>",
|
||||
"emptyTable" : "<?= $this->lang->line('Aucune transaction') ?>"
|
||||
},
|
||||
// DataTables server-side processing mode
|
||||
"serverSide": true,
|
||||
|
|
Loading…
Reference in New Issue