2020-04-24 10:40:34 +00:00
<!-- DataTables -->
< link rel = " stylesheet "
2022-04-18 11:39:19 +00:00
href = " <?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?> " >
2020-04-24 10:40:34 +00:00
< link rel = " stylesheet " type = " text/css " href = " https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css " />
2020-12-17 08:28:53 +00:00
< link rel = " stylesheet " type = " text/css " href = " https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css " >
2022-04-18 11:39:19 +00:00
< link rel = " stylesheet " href = " <?= base_url('bower_components/toastr/toastr.css') ?> " >
2020-04-24 10:40:34 +00:00
< div class = " content-wrapper " >
<!-- Content Header ( Page header ) -->
< section class = " content-header " >
< h1 >
2022-04-18 11:39:19 +00:00
< ? = isset ( $category ) ? 'Wallet' : $this -> lang -> line ( 'Gestion des wallets' ) ; echo ' ' . $network . ' - ' . $country . ( isset ( $parrain ) ? ' :: POS de ' . $parrain -> lastname : '' ); ?>
2020-04-24 10:40:34 +00:00
<!-- < 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 >
2022-04-18 11:39:19 +00:00
< ? = $message ; ?>
2020-04-24 10:40:34 +00:00
</ 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 >
2022-04-18 11:39:19 +00:00
< ? = $message ; ?>
2020-04-24 10:40:34 +00:00
</ div >
< ? php
}
}
?>
</ section >
< section class = " content " >
< div class = " row " >
< div class = " col-md-4 col-sm-6 col-xs-12 " >
< div class = " info-box " >
2020-05-01 09:30:08 +00:00
< span class = " info-box-icon bg-aqua " >< i class = " ion ion-android-time " ></ i ></ span >
2020-04-24 10:40:34 +00:00
< div class = " info-box-content " >
2022-04-18 11:39:19 +00:00
< span class = " info-box-text " >< ? = $this -> lang -> line ( 'Période' ) ?> </span>
2020-04-24 10:40:34 +00:00
< span class = " info-box-number " >
2020-05-02 10:49:34 +00:00
< input id = " picker "
2022-04-18 11:39:19 +00:00
style = " background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100% " data - category = " <?= isset( $category ) ? $category : null ?> "
type = " text " name = " daterange " data - lang = " <?= $this->session ->userdata('site_lang') ?> "
value = " <?= ( $startDate !=null & $endDate != null) ? $startDate . ' - '. $endDate : ''?> " />
2020-04-24 10:40:34 +00:00
</ span >
2022-04-18 11:39:19 +00:00
< span > Format : < ? = $this -> session -> userdata ( 'site_lang' ) === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
2020-04-24 10:40:34 +00:00
</ div >
</ div >
</ div >
2021-09-01 08:25:20 +00:00
< ? php if ( $this -> session -> userdata ( 'category' ) != 'super' ) { ?>
< div class = " col-md-8 " >
< div class = " box box-danger " >
< div class = " box-header with-border " >
2022-04-18 11:39:19 +00:00
< h3 class = " box-title " >< ? = $this -> lang -> line ( 'analysis_by_supervisor' ); ?> </h3>
2021-09-01 08:25:20 +00:00
</ div >
< div class = " box-body " >
2022-04-18 11:39:19 +00:00
< form name = " form_login " action = " <?= base_url('Hyperviseur_dash/wallet') ?> " method = " GET " >
2021-09-01 08:25:20 +00:00
< input type = " hidden " name = " history " value = " transaction " >
< div class = " row " >
< div class = " col-xs-6 " >
< div class = " form-group " id = " grp-agent " >
< ? php
if ( $superviseurs != false ){
$numrows = $superviseurs -> num_rows ();
if ( $numrows > 0 ) { ?>
< select class = " form-control input-lg " name = " parrainId " required >
< ? php foreach ( $superviseurs -> result () as $row ) {
echo " <option value=' " . $row -> agent_id . " ' " . ( $row -> agent_id == $parrain_id ? 'selected' : '' ) . " > " . $row -> lastname . " </option> " ;
} ?>
</ select >
< ? php } else {
echo $this -> lang -> line ( 'Aucun agent' );
}
} else {
echo $this -> lang -> line ( 'Aucun agent' );
}
?>
</ div >
</ div >
< div class = " col-xs-3 " >
< button class = " btn btn-block btn-primary " type = 'submit' > < ? = $this -> lang -> line ( 'show_selection' ); ?> </button>
</ div >
< div class = " col-xs-3 " >
< ? php if ( isset ( $parrain_id )) : ?>
< a class = " btn btn-block btn-danger " href = " <?= current_url().'?history=transaction'?> " >< ? = $this -> lang -> line ( 'cancel_selection' ); ?> </a>
< ? php endif ; ?>
</ div >
</ div >
</ form >
</ div >
</ div >
</ div >
< ? php } ?>
2020-04-24 10:40:34 +00:00
</ div >
2021-09-01 08:25:20 +00:00
2020-04-24 10:40:34 +00:00
< div class = " row " >
< div class = " col-xs-12 " >
< div class = " box " >
< div class = " box-header " >
2021-09-01 08:25:20 +00:00
< h3 class = " box-title " >< ? = $this -> lang -> line ( 'Historique des transactions' ) . ( isset ( $parrain ) ? ' :: POS de ' . $parrain -> lastname : '' ) ?> </h3>
2020-12-17 08:28:53 +00:00
< ? php if ( $this -> session -> userdata ( 'category' ) != 'super' ) { ?>
< div class = " box-tools " >
2021-09-01 08:25:20 +00:00
< ? php if ( isset ( $parrain_id )) : ?>
< button id = " export-grouping " class = " btn btn-info " >
Exporter par groupe
</ button >
< ? php endif ; ?>
2022-04-18 11:39:19 +00:00
< a class = " btn btn-success " href = " <?= current_url().'?history=deleted_transactions'?> " >
< ? = $this -> lang -> line ( 'deleted_transactions' ); ?>
2020-12-17 08:28:53 +00:00
</ a >
</ div >
< ? php } ?>
2020-04-24 10:40:34 +00:00
</ div >
2020-06-05 16:53:04 +00:00
< div class = " box-body " style = " overflow-x:auto; " >
2020-04-28 22:23:15 +00:00
< table id = " transactions " class = " table table-bordered table-striped " >
< thead >
< tr >
< th align = 'center' > ID </ th >
2020-05-02 10:49:34 +00:00
< th align = 'center' > Type </ th >
2022-04-18 11:39:19 +00:00
< th >< ? = $this -> lang -> line ( 'cart_number' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'customer_net_amount' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'bank_deposit_amount' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'Commission de la banque' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'Commission de l\'hyperviseur' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'Commission du superviseur' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'Commission de l\'agent' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'agent_name' ) ?> </th>
< th >< ? = $this -> lang -> line ( 'Superviseur' ) ?> </th>
2020-04-28 22:23:15 +00:00
< th align = 'center' > Date </ th >
2020-06-10 14:20:30 +00:00
< ? php if ( $this -> session -> userdata ( 'category' ) != 'super' ) { ?>
< th align = 'center' > Action </ th >
< ? php } ?>
2020-04-28 22:23:15 +00:00
</ tr >
</ thead >
2020-04-24 10:40:34 +00:00
</ table >
2020-12-17 08:28:53 +00:00
</ 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 " >
2022-04-18 11:39:19 +00:00
< h3 class = " modal-title " >< ? = $this -> lang -> line ( 'delete_transaction' ); ?> </h3>
2020-12-17 08:28:53 +00:00
</ div >
< div class = " modal-body " >
2022-04-18 11:39:19 +00:00
< h4 > < ? = $this -> lang -> line ( 'are_you_sure' ); ?> </h4>
2020-12-17 08:28:53 +00:00
</ div >
< div class = " modal-footer " >
2022-04-18 11:39:19 +00:00
< button type = " button " class = " btn btn-secondary " data - dismiss = " modal " >< ? = $this -> lang -> line ( 'Fermer' ); ?> </button>
< button type = " button " class = " btn btn-primary " id = " delete " > < ? = $this -> lang -> line ( 'Confirmer' ); ?> </button>
2020-04-24 10:40:34 +00:00
</ div >
</ div >
</ div >
</ div >
2021-10-14 14:33:02 +00:00
< ? php $this -> load -> view ( 'include/loader' ) ?>
2020-04-24 10:40:34 +00:00
</ section >
</ div >
<!-- jQuery 3 -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('bower_components/jquery/dist/jquery.min.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
<!-- Bootstrap 3.3 . 7 -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
<!-- DataTables -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?> " ></ script >
< script src = " <?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
<!-- SlimScroll -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
<!-- FastClick -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('bower_components/fastclick/lib/fastclick.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
<!-- AdminLTE App -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('dist/js/adminlte.min.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
<!-- AdminLTE for demo purposes -->
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('dist/js/demo.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
2020-05-02 10:49:34 +00:00
< script type = " text/javascript " src = " https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js " ></ script >
2020-04-24 10:40:34 +00:00
< script type = " text/javascript " src = " https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js " ></ script >
2020-05-02 10:49:34 +00:00
< 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 >
2020-12-17 08:28:53 +00:00
< 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 >
2022-04-18 11:39:19 +00:00
< script src = " <?= base_url('dist/js/sweetalert2.js') ?> " ></ script >
< script src = " <?= base_url('bower_components/toastr/toastr.js') ?> " ></ script >
< script src = " <?= base_url('bower_components/js-xlsx/dist/xlsx.full.min.js') ?> " ></ script >
< script src = " <?= base_url('bower_components/file-saver/dist/FileSaver.js') ?> " ></ script >
2020-04-24 10:40:34 +00:00
< script >
$ ( function () {
2020-05-02 10:49:34 +00:00
const lang = $ ( '#picker' ) . data ( 'lang' );
const format = lang === 'french' ? 'fr' : 'en' ;
moment . updateLocale ( moment . locale ( format ), { invalidDate : " " }); // Blank text when is invalid date
2020-12-17 08:28:53 +00:00
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 " : {
2022-04-18 11:39:19 +00:00
" url " : " <?= base_url('pagination/WalletTransaction/getLists'); ?> " ,
2020-12-17 08:28:53 +00:00
" data " : {
" startDate " : " <?= $startDate ?> " ,
" endDate " : " <?= $endDate ?> " ,
2021-09-01 08:25:20 +00:00
" id_network " : < ? = $id_network ?> ,
" parrain_id " : " <?= $parrain_id ?> "
2020-12-17 08:28:53 +00:00
},
" type " : " POST "
},
2020-05-02 10:49:34 +00:00
" aaSorting " : [[ 0 , " desc " ]],
" columnDefs " : [ {
2021-01-29 08:29:53 +00:00
targets : 11 ,
2020-05-02 10:49:34 +00:00
render : $ . fn . dataTable . render . moment ( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss' , format )
2021-01-29 08:29:53 +00:00
},{
targets : 10 ,
visible : false
}
],
2020-12-17 08:28:53 +00:00
dom : 'Bfrtip' ,
" buttons " : [
'pageLength' ,
{
" extend " : 'excelHtml5' ,
2021-09-01 08:25:20 +00:00
title : " <?= $this->lang ->line('Historique des transactions').(isset( $parrain ) ? ' _ POS de '. $parrain->lastname : '')?> " ,
2021-01-29 08:29:53 +00:00
customizeData : function ( data ) {
for ( var i = 0 ; i < data . body . length ; i ++ ) {
for ( var j = 0 ; j < data . body [ i ] . length ; j ++ ) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([ 3 , 4 , 5 , 6 , 7 , 8 ] . includes ( j )) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data . body [ i ][ j ] . replace ( ',' , " . " )
data . body [ i ][ j ] = Number ( value . replace ( / [ ^ 0 - 9 \ .- ] +/ g , " " ));
}
}
}
},
2020-12-17 08:28:53 +00:00
trim : false ,
" action " : newexportaction
},
{
extend : 'csvHtml5' ,
2021-09-01 08:25:20 +00:00
title : " <?= $this->lang ->line('Historique des transactions').(isset( $parrain ) ? ' _ POS de '. $parrain->lastname : '')?> " ,
2021-01-29 08:29:53 +00:00
customizeData : function ( data ) {
for ( var i = 0 ; i < data . body . length ; i ++ ) {
for ( var j = 0 ; j < data . body [ i ] . length ; j ++ ) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([ 3 , 4 , 5 , 6 , 7 , 8 ] . includes ( j )) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data . body [ i ][ j ] . replace ( ',' , " . " )
data . body [ i ][ j ] = Number ( value . replace ( / [ ^ 0 - 9 \ .- ] +/ g , " " ));
}
}
}
},
2020-12-17 08:28:53 +00:00
trim : false ,
" action " : newexportaction
},
{
extend : 'pdfHtml5' ,
orientation : 'landscape' ,
pageSize : 'LEGAL' ,
2021-09-01 08:25:20 +00:00
title : " <?= $this->lang ->line('Historique des transactions').(isset( $parrain ) ? ' _ POS de '. $parrain->lastname : '')?> " ,
2020-12-17 08:28:53 +00:00
trim : false ,
" action " : newexportaction
},
// 'colvis'
]
2020-05-01 09:30:08 +00:00
});
2020-12-17 08:28:53 +00:00
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 ();
}
2020-04-24 10:40:34 +00:00
});
</ script >
2021-09-01 08:25:20 +00:00
< script >
$ ( " #export-grouping " ) . click ( function (){
let start = " <?= $startDate ?> "
let end = " <?= $endDate ?> "
let parrain_id = " <?= $parrain_id ?> "
let button = $ ( this );
button . prop ( " disabled " , true );
$ . ajax ({
2022-04-18 11:39:19 +00:00
url : '<?= base_url(' / Hyperviseur_dash / export ')?>' ,
2021-09-01 08:25:20 +00:00
type : 'POST' ,
dataType : 'json' ,
data : { " parrain_id " : parrain_id , start : start , end : end },
async : true ,
success : function ( data ){
// Empty workbook object
var wb = XLSX . utils . book_new ();
2021-09-01 08:42:09 +00:00
var title = " <?= $this->lang ->line('Historique des transactions').(isset( $parrain ) ? ' _ POS de '. $parrain->lastname : '')?> "
+ ( start ? ( " _ " + start + " - " + end ) : '' )
2021-09-01 08:25:20 +00:00
wb . Props = {
Title : title ,
Subject : title ,
Author : " iLink World " ,
CreatedDate : new Date ()
};
wb . SheetNames . push ( " sheet " );
//Data
var ws_data = data ; //[['hello' , 'world']]; //a row with 2 columns
// Create the sheet from this array by using aoa_to_sheet()
var ws = XLSX . utils . aoa_to_sheet ( ws_data );
// Assign the sheet object to the workbook Sheets array.
wb . Sheets [ " sheet " ] = ws ;
/* cell width */
var wscols = [];
let cell ;
for ( let i = 0 ; i < ws_data . length ; i ++ ) {
wscols . push ({ wch : 20 }); // wch = character
}
ws [ '!cols' ] = wscols ;
var wbout = XLSX . write ( wb , { bookType : 'xlsx' , type : 'binary' });
function s2ab ( s ) {
var buf = new ArrayBuffer ( s . length ); //convert s to arrayBuffer
var view = new Uint8Array ( buf ); //create uint8array as viewer
for ( var i = 0 ; i < s . length ; i ++ ) view [ i ] = s . charCodeAt ( i ) & 0xFF ; //convert to octet
return buf ;
}
saveAs ( new Blob ([ s2ab ( wbout )],{ type : " application/octet-stream " }), title + '.xlsx' );
},
error : function ( resultat , statut , erreur ){
console . log ( resultat + " " + erreur );
2022-04-18 11:39:19 +00:00
toastr . error ( " <?= $this->lang ->line('error_message')?> " , " <?= $this->lang ->line('request_error')?> " );
2021-09-01 08:25:20 +00:00
},
complete : function (){
button . prop ( " disabled " , false );
}
});
});
</ script >
2020-04-24 10:40:34 +00:00
< script type = " text/javascript " >
var startDate ;
var endDate ;
$ ( function () {
2020-05-01 09:30:08 +00:00
const lang = $ ( '#picker' ) . data ( 'lang' );
2020-05-05 08:25:12 +00:00
const category = $ ( '#picker' ) . data ( 'category' );
2020-10-03 11:14:16 +00:00
const id_network = " <?= $id_network ?> " ;
2020-04-24 10:40:34 +00:00
$ ( 'input[name="daterange"]' ) . daterangepicker ({
opens : 'left' ,
autoUpdateInput : false ,
locale : {
2020-05-01 09:30:08 +00:00
format : lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD' ,
2020-04-24 10:40:34 +00:00
cancelLabel : 'Clear'
}
}, function ( start , end , label ) {
2020-04-28 22:23:15 +00:00
const debut = start . format ( 'YYYY-MM-DD' );
const fin = end . format ( 'YYYY-MM-DD' );
2020-05-05 08:25:12 +00:00
if ( category )
2022-04-18 11:39:19 +00:00
window . location = " <?= current_url()?> " + " ?history=transaction " + " <?= isset( $parrain_id ) ? '&parrainId='. $parrain_id : '' ?> " + " &d= " + debut + " &f= " + fin ;
2020-05-05 08:25:12 +00:00
else
2022-04-18 11:39:19 +00:00
window . location = " <?= current_url()?> " + " ?id= " + id_network + " &history=transaction " + " &d= " + debut + " &f= " + fin ;
2020-04-24 10:40:34 +00:00
});
2020-05-02 10:49:34 +00:00
$ ( 'input[name="daterange"]' ) . on ( 'cancel.daterangepicker' , function ( ev , picker ) {
//do something, like clearing an input
$ ( '#daterange' ) . val ( '' );
2020-05-05 08:25:12 +00:00
if ( category )
2022-04-18 11:39:19 +00:00
window . location = " <?= current_url()?> " + " ?history=transaction " + " <?= isset( $parrain_id ) ? '&parrainId='. $parrain_id : '' ?> " ;
2020-05-05 08:25:12 +00:00
else
2022-04-18 11:39:19 +00:00
window . location = " <?= current_url()?> " + " ?id= " + id_network + " &history=transaction " ;
2020-05-02 10:49:34 +00:00
});
2020-04-24 10:40:34 +00:00
});
</ script >
2020-06-08 18:54:36 +00:00
< script >
2020-12-17 08:28:53 +00:00
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' );
})
2020-06-08 18:54:36 +00:00
$ ( document ) . on ( " click " , " #cancel " , function () {
2021-08-20 16:43:52 +00:00
let button = $ ( this );
button . prop ( " disabled " , true );
2020-06-08 18:54:36 +00:00
const id_transaction = $ ( this ) . data ( 'id-transaction' );
$ . ajax ({
2022-04-18 11:39:19 +00:00
url : '<?= base_url(' Gestion / cancelTransation ')?>' ,
2020-06-08 18:54:36 +00:00
type : 'POST' ,
dataType : 'json' ,
data : { " id_transaction " : id_transaction },
async : true ,
success : function ( data ){
if ( data ){
Swal . fire ({
icon : 'success' ,
2022-04-18 11:39:19 +00:00
title : " <?= $this->lang ->line('canceled_transaction')?> " ,
text : " <?= $this->lang ->line('informations_updated')?> " ,
2020-06-08 18:54:36 +00:00
timer : 3000
}) . then (() => {
location . reload ();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
} else {
2022-04-18 11:39:19 +00:00
toastr . error ( " <?= $this->lang ->line('error_message')?> " , " <?= $this->lang ->line('request_error')?> " );
2020-06-08 18:54:36 +00:00
}
},
error : function ( resultat , statut , erreur ){
console . log ( resultat + " " + erreur );
2022-04-18 11:39:19 +00:00
toastr . error ( " <?= $this->lang ->line('error_message')?> " , " <?= $this->lang ->line('request_error')?> " );
2021-08-20 16:43:52 +00:00
},
complete : function (){
button . prop ( " disabled " , false );
2020-06-08 18:54:36 +00:00
}
});
});
2020-12-17 08:28:53 +00:00
$ ( '#delete' ) . click ( function (){
2021-08-20 16:43:52 +00:00
let button = $ ( this );
button . prop ( 'disabled' , true );
2020-12-17 08:28:53 +00:00
$ . ajax ({
2022-04-18 11:39:19 +00:00
url : '<?= base_url(' Hyperviseur_dash / delete_wallet_transaction ')?>' ,
2020-12-17 08:28:53 +00:00
type : 'POST' ,
dataType : 'json' ,
data : { " id_transaction " : id_transaction },
success : function ( data , statut ){
if ( data == '200' ){
Swal . fire ({
icon : 'success' ,
2022-04-18 11:39:19 +00:00
title : " <?= $this->lang ->line('transaction_deleted')?> " ,
text : " <?= $this->lang ->line('informations_updated')?> " ,
2020-12-17 08:28:53 +00:00
timer : 3000
}) . then (() => {
location . reload ();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
} else {
2022-04-18 11:39:19 +00:00
toastr . error ( " <?= $this->lang ->line('error_message')?> " , " <?= $this->lang ->line('request_error')?> " );
2020-12-17 08:28:53 +00:00
}
},
error : function ( resultat , statut , erreur ){
console . log ( resultat + " " + erreur );
2022-04-18 11:39:19 +00:00
toastr . error ( " <?= $this->lang ->line('error_message')?> " , " <?= $this->lang ->line('request_error')?> " );
2021-08-20 16:43:52 +00:00
},
complete : function (){
button . prop ( 'disabled' , false );
}
2020-12-17 08:28:53 +00:00
});
});
2020-06-08 18:54:36 +00:00
</ script >