+ Add wallet password menu

This commit is contained in:
DJERY-TOM 2020-05-04 14:18:44 +01:00
parent 1e59fc34b0
commit 3bf4d43457
12 changed files with 877 additions and 42 deletions

View File

@ -103,7 +103,7 @@ $autoload['helper'] = array('url', 'file');
| config files. Otherwise, leave it blank. | config files. Otherwise, leave it blank.
| |
*/ */
$autoload['config'] = array(); $autoload['config'] = array('email');
/* /*
| ------------------------------------------------------------------- | -------------------------------------------------------------------

View File

@ -0,0 +1,14 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
$config = array(
'protocol' => 'smtp', // 'mail', 'sendmail', or 'smtp'
'smtp_host' => 'mail.ilink-app.com',
'smtp_port' => 587,
'smtp_user' => 'noreply@ilink-app.com',
'smtp_pass' => 'ilink2017GA',
'smtp_crypto' => 'tls', //can be 'ssl' or 'tls' for example
'mailtype' => 'text', //plaintext 'text' mails or 'html'
'smtp_timeout' => '5', //in seconds
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);

View File

@ -1550,7 +1550,7 @@ class Gestion extends CI_Controller
$network_id = $this->input->get('id'); $network_id = $this->input->get('id');
if($this->input->get('history')){ if($this->input->get('history')){
$this->historique($network_id,$this->input->get('d'),$this->input->get('f')); $this->historique($network_id,$this->input->get('d'),$this->input->get('f'),$this->input->get('history'));
}else{ }else{
$taux = $this->user_model->getTaux($network_id); $taux = $this->user_model->getTaux($network_id);
if ($taux != null) { if ($taux != null) {
@ -1596,6 +1596,8 @@ class Gestion extends CI_Controller
$data['country'] = $networkDetails->first_row()->country; $data['country'] = $networkDetails->first_row()->country;
} }
// $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($network_id); // $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($network_id);
$res = $this->user_model->getWalletPassword($network_id) ;
$data['walletPassword'] = $res ? $res->first_row() : null ;
$data['active'] = "wallet"; $data['active'] = "wallet";
$data['alert'] = ""; $data['alert'] = "";
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
@ -1713,14 +1715,18 @@ class Gestion extends CI_Controller
await($pool); await($pool);
} }
private function historique($network_id ,$startDate ,$endDate) private function historique($network_id ,$startDate ,$endDate, $type)
{ {
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ; $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ;
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ; $data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ;
$data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ; $data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ;
$endDate = Date('Y-m-d', strtotime($endDate."+1 day")); $endDate = Date('Y-m-d', strtotime($endDate."+1 day"));
$data['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id); if($type == 'transaction')
$data['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id);
else
$data['transactions'] = $this->user_model->getRecharges($startDate , $endDate ,$network_id);
$data['active'] = "wallet"; $data['active'] = "wallet";
$data['alert'] = ""; $data['alert'] = "";
$data['networks'] = $this->user_model->getAllActivatedNetworks(); $data['networks'] = $this->user_model->getAllActivatedNetworks();
@ -1732,9 +1738,149 @@ class Gestion extends CI_Controller
$data['country'] = $networkDetails->first_row()->country; $data['country'] = $networkDetails->first_row()->country;
} }
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('historique_transactions'); if($type == 'transaction')
$this->load->view('historique_transactions');
else
$this->load->view('historique_recharges');
$this->load->view('footer'); $this->load->view('footer');
} }
public function walletPassword(){
if($this->isLogged()){
$data['active'] = "wallet_password";
$data['alert'] = "";
$data['game_pays'] = $this->user_model->getGameCountry();
$data['networks'] = $this->user_model->getAllActivatedWalletNetworks();
$this->load->view('header_gestion', $data);
$this->load->view('wallet_password');
$this->load->view('footer');
}
}
public function generate_wallet_password(){
if($this->isLogged()){
if (isset($_POST)) {
$network_id = isset($_POST['network_id']) ? $_POST['network_id'] : null;
$email = $_POST['email'];
// $size = $_POST['size'];
$wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null ;
$network = $_POST['network'];
$country = $_POST['country'];
$password = $this->generate_string();
$hash = $this->hashSSHA($password);
$encrypted_password = $hash['encrypted'] ;
$salt = $hash['salt'] ;
$this->load->library('email');
$this->email->from('noreply@ilink-app.com', 'iLink World');
$this->email->to($email);
$this->email->subject($this->lang->line('wallet_password').' '.$network . ' - '.$country);
$this->email->message($this->lang->line('mot de passe').' : '.$password);
if ($this->email->send()) {
if($wallet_password_id == null)
$this->user_model->addWalletPassword($network_id,$encrypted_password,$salt,$email);
else
$this->user_model->updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email);
$res = true;
} else {
// show_error($this->email->print_debugger());
$res = false;
}
if ($res) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
private function generate_string($length = 10){
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
'0123456789-=~!@#$%^&*()_+,./<>?;:[]{}\|';
$str = '';
$max = strlen($chars) - 1;
for ($i=0; $i < $length; $i++)
$str .= $chars[mt_rand(0, $max)];
return $str;
}
private function hashSSHA($password) {
$salt = sha1(rand());
$salt = substr($salt, 0, 10);
$encrypted = base64_encode(sha1($password . $salt, true) . $salt);
$hash = array("salt" => $salt, "encrypted" => $encrypted);
return $hash;
}
public function resetWalletPassword(){
if($this->isLogged()){
if (isset($_POST)) {
$email = $_POST['email'];
$wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null ;
$network = $_POST['network'];
$country = $_POST['country'];
$password = $this->generate_string();
$hash = $this->hashSSHA($password);
$encrypted_password = $hash['encrypted'] ;
$salt = $hash['salt'] ;
$this->load->library('email');
$this->email->from('noreply@ilink-app.com', 'iLink World');
$this->email->to($email);
$this->email->subject($this->lang->line('reset_wallet_password').' '.$network . ' - '.$country);
$this->email->message($this->lang->line('mot de passe').' : '.$password);
if ($this->email->send()) {
$this->user_model->updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email);
$res = true;
} else {
// show_error($this->email->print_debugger());
$res = false;
}
if ($res) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
public function recharge_wallet(){
if($this->isLogged()){
if (isset($_POST)) {
$password = $_POST['password'];
$wallet_id = $_POST['wallet_id'];
$salt = $_POST['salt'] ;
$encrypted_password = $_POST['encrypted_password'];
$montant = $_POST['montant'];
$hash = base64_encode(sha1($password . $salt, true) . $salt);
if($encrypted_password == $hash){
$this->user_model->updateWalletBalance($montant,$wallet_id);
$res = $this->user_model->addWalletRecharge($montant,$wallet_id);
$code = $res ? '200' : '500' ;
}else{
$code = '400';
}
echo json_encode($code);
}
}
}
} }

View File

@ -4,8 +4,8 @@
$lang['agent'] = 'agent'; $lang['agent'] = 'agent';
$lang['Membre'] = 'Member'; $lang['Membre'] = 'Member';
$lang['mot de passe oublié'] = 'Forgot your password'; $lang['mot de passe oublié'] = 'Forgot your password';
$lang['identifiant'] = 'login'; $lang['identifiant'] = 'Login';
$lang['mot de passe'] = 'password'; $lang['mot de passe'] = 'Password';
$lang['Choix de la langue'] = 'Choice of language'; $lang['Choix de la langue'] = 'Choice of language';
$lang['Superviseur'] = 'Supervisor'; $lang['Superviseur'] = 'Supervisor';
$lang['Superviseurs'] = 'Supervisors'; $lang['Superviseurs'] = 'Supervisors';
@ -261,4 +261,41 @@ $lang['Solde Principal'] = 'Main Balance';
$lang['Solde Commission'] = 'Commission balance'; $lang['Solde Commission'] = 'Commission balance';
$lang['Commission banque'] = 'Bank commission'; $lang['Commission banque'] = 'Bank commission';
$lang['Total commission de la banque'] = 'Total bank commission'; $lang['Total commission de la banque'] = 'Total bank commission';
// Mot de passe du wallet
$lang['menu_wallet_password'] = 'Wallet Password' ;
$lang['header_wallet_password'] = 'Wallet password management' ;
$lang['activated_wallets'] = 'Wallets actifs' ;
$lang['generated'] = 'Generated';
$lang['not_generated'] = 'Not generated';
$lang['generate'] = 'Generate';
$lang['reset'] = 'Reset';
$lang['no_wallet'] = 'No wallet';
$lang['generate_password'] = 'Generate password';
$lang['email'] = 'Mail address';
$lang['password_generated'] = 'Password generated';
$lang['informations_updated'] = 'Information has been updated';
$lang['request_error'] = 'Request error';
$lang['error_message'] = 'An error has occurred.';
$lang['wallet_password'] = 'Wallet password';
$lang['wallet_update'] = 'Wallet update';
$lang['recharge_hypervisor_account'] = 'Reload virtual currency in the hypervisor account';
$lang['recharge'] = 'Recharge';
$lang['click_here'] = 'Click here';
$lang['no_wallet_password'] = 'No password exists for this wallet, please generate a password! ';
$lang['i_forgot_password'] = 'I forgot my password';
$lang['transactions_historic'] = 'Transaction history';
$lang['recharge_historic'] = 'Recharge history';
$lang['no_recharge'] = 'No recharge';
$lang['reset_wallet_password'] = 'Wallet password reset';
$lang['incorrect_password'] = 'Incorrect password';
$lang['account_recharged'] = 'Account reloaded';
$lang['password_has_been_reset'] = 'Your password has been reset';
$lang['management_rule'] = 'Management rules';
$lang['first_rule'] = 'The sum of the % of the agent and supervisor withdrawals must be less than 100.';
$lang['second_rule'] = 'The sum of the % of agent and supervisor deposits must be less than 100.';
$lang['third_rule'] = 'The sum of the % of withdrawals must be lower than the customer withdrawal rate.';
$lang['fourth_rule'] = 'The sum of the % of deposits must be less than 100.';
$lang['wallet_created'] = 'New wallet created';
$lang['wallet_deleted'] = 'Wallet deleted';
?> ?>

View File

@ -4,8 +4,8 @@
$lang['agent'] = 'agent'; $lang['agent'] = 'agent';
$lang['Membre'] = 'Membre'; $lang['Membre'] = 'Membre';
$lang['mot de passe oublié'] = 'Mot de passe oublié'; $lang['mot de passe oublié'] = 'Mot de passe oublié';
$lang['identifiant'] = 'identifiant'; $lang['identifiant'] = 'Identifiant';
$lang['mot de passe'] = 'mot de passe'; $lang['mot de passe'] = 'Mot de passe';
$lang['Choix de la langue'] = 'Choix de la langue'; $lang['Choix de la langue'] = 'Choix de la langue';
$lang['Superviseur'] = 'Superviseur'; $lang['Superviseur'] = 'Superviseur';
$lang['Superviseurs'] = 'Superviseurs'; $lang['Superviseurs'] = 'Superviseurs';
@ -273,4 +273,41 @@
$lang['Solde Commission'] = 'Solde commission'; $lang['Solde Commission'] = 'Solde commission';
$lang['Commission banque'] = 'Commission de la banque'; $lang['Commission banque'] = 'Commission de la banque';
$lang['Total commission de la banque'] = 'Total commission de la banque'; $lang['Total commission de la banque'] = 'Total commission de la banque';
// Mot de passe du wallet
$lang['menu_wallet_password'] = 'Mot de passe Wallet' ;
$lang['header_wallet_password'] = 'Gestion des mots de passe des wallets' ;
$lang['activated_wallets'] = 'Wallets actifs' ;
$lang['generated'] = 'Généré';
$lang['not_generated'] = 'Non généré';
$lang['generate'] = 'Générer';
$lang['reset'] = 'Réinitialiser';
$lang['no_wallet'] = 'Aucun wallet';
$lang['generate_password'] = 'Générer le mot de passe';
$lang['email'] = 'Adresse mail';
$lang['password_generated'] = 'Mot de passe généré';
$lang['informations_updated'] = 'Les informations ont été mises à jour';
$lang['request_error'] = 'Erreur requete';
$lang['error_message'] = 'Une erreur s\'est produite.';
$lang['wallet_password'] = 'Mot de passe du wallet';
$lang['wallet_update'] = 'Mise à jour du wallet';
$lang['recharge_hypervisor_account'] = 'Recharger de la monnaie virtuelle dans le compte de l\'hyperviseur';
$lang['recharge'] = 'Recharger';
$lang['click_here'] = 'Cliquez ici';
$lang['no_wallet_password'] = 'Aucun mot de passe n\'existe pour ce wallet, veuillez generer un mot de passe ! ';
$lang['i_forgot_password'] = 'J\'ai oublié mon mot de passe';
$lang['transactions_historic'] = 'Historique des transactions';
$lang['recharge_historic'] = 'Historique des recharges';
$lang['no_recharge'] = 'Aucune recharge';
$lang['reset_wallet_password'] = 'Réinitialisation du mot de passe du wallet';
$lang['incorrect_password'] = 'Mot de passe incorrect';
$lang['account_recharged'] = 'Compte rechargé';
$lang['password_has_been_reset'] = 'Votre mot de passe a été réinitialisé';
$lang['management_rule'] = 'Règle de gestion';
$lang['first_rule'] = 'La somme des % des retraits de l\'agent et du superviseur doit être inférieur à 100.';
$lang['second_rule'] = 'La somme des % des dépots de l\'agent et du superviseur doit être inférieur à 100.';
$lang['third_rule'] = 'La somme des % des retraits doit être inférieur au taux client de retrait.';
$lang['fourth_rule'] = 'La somme des % des dépots doit être inférieur à 100.';
$lang['wallet_created'] = 'Nouveau wallet créé';
$lang['wallet_deleted'] = 'Wallet supprimé';
?> ?>

View File

@ -2157,4 +2157,61 @@ class User_model extends CI_Model
return $query; return $query;
} }
// Mot de passe du wallet
public function getAllActivatedWalletNetworks(){
$query = $this->db->query("SELECT n.name AS network,n.status AS status,n.id,c.name AS country, wp.id AS wallet_password FROM networks n
INNER JOIN countries c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id
LEFT JOIN walletsPassword wp ON wp.network_id = n.id WHERE status = 1;");
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
public function addWalletPassword($network_id,$encrypted_password,$salt,$email){
$sql = "INSERT INTO `walletsPassword` (`network_id`, `encrypted_password`, `salt`, `email`) VALUES ( ?, ?, ?, ?);";
$query = $this->db->query($sql , array($network_id,$encrypted_password,$salt,$email));
return $query;
}
public function updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email){
$sql = "UPDATE `walletsPassword` SET `encrypted_password` = ? , `salt` = ? , `email` = ? WHERE (`id` = ?);";
$query = $this->db->query($sql , array($encrypted_password,$salt,$email,$wallet_password_id));
return $query;
}
public function getWalletPassword($network_id){
$sql= "SELECT * FROM walletsPassword WHERE network_id = ?";
$query = $this->db->query($sql , array($network_id));
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
public function getRecharges($debut , $fin , $id_network){
$chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : "";
$query = $this->db->query("SELECT *
FROM infos_recharges
WHERE `network_id`=".$id_network.$chain);
if($query->num_rows()>0){
return $query;
}else{
return false;
}
}
public function addWalletRecharge($montant,$wallet_id){
$sql = "INSERT INTO `wallet_recharge` (`montant`, `wallet_id`) VALUES (?, ?);";
$query = $this->db->query($sql , array($montant,$wallet_id));
return $query;
}
public function updateWalletBalance($montant,$wallet_id){
$sql = "UPDATE `wallets` SET balance_princ = balance_princ + ? WHERE (`id` = ? );";
$query = $this->db->query($sql , array($montant,$wallet_id));
return $query;
}
} }

View File

@ -177,9 +177,11 @@ if ($transactions != false) {
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button> style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
</div> </div>
</div> </div>
<div class="row centered"> <div class="row centered">
<div class="col-lg-2 col-lg-offset-2 col-xs-6"> <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="small-box bg-red-active">
<div class="inner"> <div class="inner">
<h3><?php echo $taux_client_r; ?><sup style="font-size: 20px">%</sup></h3> <h3><?php echo $taux_client_r; ?><sup style="font-size: 20px">%</sup></h3>
@ -305,8 +307,12 @@ if ($transactions != false) {
<h3 class="box-title"> <h3 class="box-title">
<?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3> <?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3>
<div class="box-tools"> <div class="box-tools">
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=true' : '')?>"> <a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=transaction' : '')?>">
<?php echo $this->lang->line('Historique'); ?></a> <?php echo $this->lang->line('transactions_historic'); ?>
</a>
<a class="btn btn-info" href="<?php echo current_url().($network_id ? '?id='.$network_id . '&history=recharge' : '')?>">
<?php echo $this->lang->line('recharge_historic'); ?>
</a>
</div> </div>
</div> </div>
<div class="box-body"> <div class="box-body">
@ -444,6 +450,48 @@ if ($transactions != false) {
</div> </div>
</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>
<div class="form-group">
<label for="password" class="col-form-label"><?php echo $this->lang->line('mot de passe') ?></label>
<input type="password" min="1" required class="form-control" name="password" id="password">
</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/Gestion/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 $walletHyper->first_row()->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>
</div> </div>
</section> </section>
@ -474,12 +522,14 @@ if ($transactions != false) {
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script> <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('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.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>
<script> <script>
$(function () { $(function () {
$('#example1').DataTable(); $('#example1').DataTable();
anElement = new AutoNumeric('#montant', '', {aSep: ' ', decimalPlaces:'0', vMax: '99999999999999999999999999'});
// $('#example1').DataTable({ // $('#example1').DataTable({
// "aLengthMenu": [[5, 10, 15, -1], [5, 10, 5, "All"]], // "aLengthMenu": [[5, 10, 15, -1], [5, 10, 5, "All"]],
// "iDisplayLength": 5 // "iDisplayLength": 5
@ -557,13 +607,13 @@ if ($transactions != false) {
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d; var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d;
if((taux_ag_r + taux_sup_r) > 100){ if((taux_ag_r + taux_sup_r) > 100){
toastr.error("La somme des % des retraits de l'agent et du superviseur doit être inférieur à 100.", 'Règle de gestion'); 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){ }else if((taux_ag_d + taux_sup_d) > 100){
toastr.error("La somme des % des dépots de l'agent et du superviseur doit être inférieur à 100.", 'Règle de gestion'); toastr.error('<?php echo $this->lang->line('second_rule')?>', '<?php echo $this->lang->line('management_rule')?>');
}else if(sommeRetrait >= taux_client_r){ }else if(sommeRetrait >= taux_client_r){
toastr.error('La somme des % des retraits doit être inférieur au taux client de retrait.', 'Règle de gestion') toastr.error('<?php echo $this->lang->line('third_rule')?>', '<?php echo $this->lang->line('management_rule')?>')
}else if(sommeDepot >= 100){ }else if(sommeDepot >= 100){
toastr.error("La somme des % des dépots doit être inférieur à 100.", 'Règle de gestion'); toastr.error('<?php echo $this->lang->line('fourth_rule')?>', '<?php echo $this->lang->line('management_rule')?>');
}else{ }else{
$.ajax({ $.ajax({
url: '<?php echo base_url('index.php/Gestion/config_wallet/update')?>', url: '<?php echo base_url('index.php/Gestion/config_wallet/update')?>',
@ -585,15 +635,15 @@ if ($transactions != false) {
if(data=='200'){ if(data=='200'){
Swal.fire({ Swal.fire({
icon: 'success', icon: 'success',
title: 'Mise à jour du wallet', title: '<?php echo $this->lang->line('wallet_update')?>',
text:'Les informations ont été mises à jour', text:'<?php echo $this->lang->line('informations_updated')?>',
timer: 3000 timer: 3000
}).then(()=>{ }).then(()=>{
location.reload(); location.reload();
}); });
// alert("Les informations ont été mises à jour.") ? "" : // alert("Les informations ont été mises à jour.") ? "" :
}else{ }else{
toastr.error("Une erreur s'est produite." , 'Erreur requete'); toastr.error("<?php echo $this->lang->line('error_message')?>" , '<?php echo $this->lang->line('request_error')?>');
} }
}, },
@ -607,6 +657,93 @@ if ($transactions != false) {
$('#walletForm')[0].reportValidity(); $('#walletForm')[0].reportValidity();
} }
});
$('#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/Gestion/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);
}
});
});
$('#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/Gestion/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);
}
});
} else {
$('#rechargeAccountForm')[0].reportValidity();
}
}); });
</script> </script>

View File

@ -123,11 +123,11 @@
<div class="modal-body"> <div class="modal-body">
<form id="walletForm"> <form id="walletForm">
<div class="form-group"> <div class="form-group">
<label for="nom" class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur retrait').' (%)'; ?></label> <label for="taux_client_r" 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="0"> <input type="number" min="0" step=".01" required class="form-control" id="taux_client_r" name="taux_client_r" value="0">
</div> </div>
<div class="form-group"> <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> <label for="taux_sup_r" 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="0"> <input type="number" min="0" step=".01" required class="form-control" name="taux_ag_r" id="taux_ag_r" value="0">
</div> </div>
<div class="form-group"> <div class="form-group">
@ -135,27 +135,27 @@
<input type="number" min="0" step=".01" required class="form-control" name="taux_sup_r" id="taux_sup_r" value="0"> <input type="number" min="0" step=".01" required class="form-control" name="taux_sup_r" id="taux_sup_r" value="0">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le retrait').' (%)'; ?></label> <label for="taux_bq_r" 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="0"> <input type="number" min="0" step=".01" required class="form-control" id="taux_bq_r" name="taux_bq_r" value="0">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="adresse" class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur dépot') .' (%)'; ?></label> <label for="taux_client_d" 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="0"> <input type="number" min="0" step=".01" required class="form-control" id="taux_client_d" name="taux_client_d" value="0">
</div> </div>
<div class="form-group"> <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').' (FCFA)'; ?></label> <label for="frais_d" class="col-form-label"><?php echo $this->lang->line('Frais minimun de la banque sur le dépot').' (FCFA)'; ?></label>
<input type="number" min="0" required class="form-control" id="frais_d" name="frais_d" value="0"> <input type="number" min="0" required class="form-control" id="frais_d" name="frais_d" value="0">
</div> </div>
<div class="form-group"> <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> <label for="taux_ag_d" 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="0"> <input type="number" min="0" step=".01" required class="form-control" id="taux_ag_d" name="taux_ag_d" value="0">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur dépot').' (%)'; ?></label> <label for="taux_sup_d" 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="0"> <input type="number" min="0" step=".01" required class="form-control" id="taux_sup_d" name="taux_sup_d" value="0">
</div> </div>
<div class="form-group"> <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> <label for="taux_bq_d" 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="0"> <input type="number" min="0" step=".01" required class="form-control" name="taux_bq_d" id="taux_bq_d" value="0">
</div> </div>
</form> </form>
@ -245,14 +245,13 @@
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d ; var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d ;
if((taux_ag_r + taux_sup_r) > 100){ if((taux_ag_r + taux_sup_r) > 100){
toastr.error("La somme des % des retraits de l'agent et du superviseur doit être inférieur à 100.", 'Règle de gestion'); 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){ }else if((taux_ag_d + taux_sup_d) > 100){
toastr.error("La somme des % des dépots de l'agent et du superviseur doit être inférieur à 100.", 'Règle de gestion'); toastr.error('<?php echo $this->lang->line('second_rule')?>', '<?php echo $this->lang->line('management_rule')?>');
}else if(sommeRetrait >= taux_client_r){ }else if(sommeRetrait >= taux_client_r){
// alert("La somme des % des retraits doit être inférieur au taux client de retrait."); toastr.error('<?php echo $this->lang->line('third_rule')?>', '<?php echo $this->lang->line('management_rule')?>')
toastr.error('La somme des % des retraits doit être inférieur au taux client de retrait.', 'Règle de gestion')
}else if(sommeDepot >= 100){ }else if(sommeDepot >= 100){
toastr.error("La somme des % des dépots doit être inférieur à 100.", 'Règle de gestion'); toastr.error('<?php echo $this->lang->line('fourth_rule')?>', '<?php echo $this->lang->line('management_rule')?>');
}else{ }else{
$.ajax({ $.ajax({
url : '<?php echo base_url('index.php/Gestion/config_wallet/create')?>', url : '<?php echo base_url('index.php/Gestion/config_wallet/create')?>',
@ -265,15 +264,15 @@
Swal.fire({ Swal.fire({
icon: 'success', icon: 'success',
title: 'Nouveau wallet', title: '<?php echo $this->lang->line('wallet_created')?>',
text:'Les informations ont été mises à jour', text:'<?php echo $this->lang->line('informations_updated')?>',
timer: 3000 timer: 3000
}).then(()=>{ }).then(()=>{
location.reload(); location.reload();
}); });
// alert("Les informations ont été mises à jour.") ? "" : // alert("Les informations ont été mises à jour.") ? "" :
}else{ }else{
toastr.error("Une erreur s'est produite." , 'Erreur requete'); toastr.error("<?php echo $this->lang->line('error_message')?>" , '<?php echo $this->lang->line('request_error')?>');
} }
}, },
error : function(resultat, statut, error){ error : function(resultat, statut, error){
@ -312,15 +311,15 @@
Swal.fire({ Swal.fire({
icon: 'success', icon: 'success',
title: 'Suppression wallet', title: '<?php echo $this->lang->line('wallet_deleted')?>',
text: 'Les informations ont été mises à jour', text:'<?php echo $this->lang->line('informations_updated')?>',
timer: 3000 timer: 3000
}).then(()=>{ }).then(()=>{
location.reload(); location.reload();
}); });
// alert("Les informations ont été mises à jour.") ? "" : location.reload(); // alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{ }else{
toastr.error("Une erreur s'est produite.", 'Erreur requete'); toastr.error("<?php echo $this->lang->line('error_message')?>" , '<?php echo $this->lang->line('request_error')?>');
} }
}, },

View File

@ -144,9 +144,14 @@
</li> </li>
<li class="<?php if($active=="wallet"){echo "active";} ?>"> <li class="<?php if($active=="wallet"){echo "active";} ?>">
<a href="<?php echo base_url('index.php/Gestion/wallet') ?>"> <a href="<?php echo base_url('index.php/Gestion/wallet') ?>">
<i class="glyphicon glyphicon-credit-card"></i> <span>Wallet<?php //echo $this->lang->line('Game'); ?></span> <i class="glyphicon glyphicon-credit-card"></i> <span>Wallet</span>
</a> </a>
</li> </li>
<li class="<?php if($active=="wallet_password"){echo "active";} ?>">
<a href="<?php echo base_url('index.php/Gestion/walletPassword') ?>">
<i class="glyphicon glyphicon-lock"></i> <span><?php echo $this->lang->line('menu_wallet_password'); ?></span>
</a>
</li>
<!--<li class="<?php //if($active=="map"){echo "active";} ?>"> <!--<li class="<?php //if($active=="map"){echo "active";} ?>">
<a href="<?php //echo base_url('index.php/Gestion/map') ?>"> <a href="<?php //echo base_url('index.php/Gestion/map') ?>">
<i class="glyphicon glyphicon-map-marker"></i> <span>Carte</span> <i class="glyphicon glyphicon-map-marker"></i> <span>Carte</span>

View File

@ -0,0 +1,185 @@
<!-- 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"/>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('Gestion des wallets') . ' '.$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">&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-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%"
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('recharge_historic'); ?></h3>
</div>
<div class="box-body">
<?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>
<th align='center'></th>
<th><?php echo $this->lang->line('Montant') ?></th>
<th align='center'>Date</th>
</tr>
</thead>
<tbody>
<?php
foreach ($transactions->result() as $row) {
$num++;
echo "<tr>
<td align='center' >$num</td>
<td>".$fmt->format($row->montant)."</td>
<td> $row->date</td>
</tr>";
}
?>
</tbody>
<?php
} else {
echo $this->lang->line('no_recharge');
}
}else {
echo $this->lang->line('no_recharge');
}
?>
</table>
</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>
$(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": [[ 2, "desc" ]],
"columnDefs": [ {
targets: 2,
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');
$('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');
window.location = "<?php echo current_url()?>" + "?id=118&history=recharge" + "&d=" + debut + "&f=" + fin;
});
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input
$('#daterange').val('');
window.location = "<?php echo current_url()?>" + "?id=118&history=recharge";
});
});
</script>

View File

@ -182,14 +182,14 @@
}, function (start, end, label) { }, function (start, end, label) {
const debut = start.format('YYYY-MM-DD'); const debut = start.format('YYYY-MM-DD');
const fin = end.format('YYYY-MM-DD'); const fin = end.format('YYYY-MM-DD');
window.location = "<?php echo current_url()?>" + "?id=118&history=true" + "&d=" + debut + "&f=" + fin; window.location = "<?php echo current_url()?>" + "?id=118&history=transaction" + "&d=" + debut + "&f=" + fin;
}); });
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) { $('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input //do something, like clearing an input
$('#daterange').val(''); $('#daterange').val('');
window.location = "<?php echo current_url()?>" + "?id=118&history=true"; window.location = "<?php echo current_url()?>" + "?id=118&history=transaction";
}); });
}); });

View File

@ -0,0 +1,218 @@
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('header_wallet_password'); ?>
<input type="button" class="btn btn-primary pull-right" id="Bactiver" value="Activer/Désactiver le(s) réseau(x)" style="display: none;" />
</h1>
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('activated_wallets'); ?></h3>
</div>
<div class="box-body">
<?php
$sql2 = $networks;
if($sql2!=false){
$numrows=$sql2->num_rows();
$num = 0;
if ($numrows > 0) {
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'></th>
<th><?php echo $this->lang->line('Reseau'); ?></th>
<th><?php echo $this->lang->line('Pays'); ?></th>
<th align='center'> <?php echo $this->lang->line('mot de passe'); ?> </th>
<th align='center'>Action</th>
</tr>
</thead>
<tbody>
<?php
foreach($sql2->result() as $row) {
$num ++;
//$member_code = randomString1(10);
echo "<tr>
<td align='center'>$num</td>
<td >$row->network</td>
<td>$row->country</td>";
?>
<?php
if($row->wallet_password){
?>
<td><span class="label label-success"><?php echo $this->lang->line('generated'); ?></span></td>
<td><button type="button" data-toggle="modal" data-target="#generatePassword" data-country="<?php echo $row->country ?>" data-network="<?php echo $row->network ?>" data-wallet_password_id="<?php echo $row->wallet_password ?>" class="btn btn-warning btn-block openModal"><?php echo $this->lang->line('reset'); ?></button></td>
<?php
}else{
?>
<td><span class="label label-danger"><?php echo $this->lang->line('not_generated'); ?></span></td>
<td><button type="button" data-toggle="modal" data-target="#generatePassword" data-country="<?php echo $row->country ?>" data-network="<?php echo $row->network ?>" data-network-id="<?php echo $row->id ?>" class="btn btn-primary btn-block openModal"><?php echo $this->lang->line('generate'); ?></button></td>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('no_wallet');
}
}else {
echo $this->lang->line('no_wallet');
}
?>
</div>
</div>
</div>
</div>
<div class="modal fade" id="generatePassword" 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('generate_password'); ?></h3>
</div>
<div class="modal-body">
<form id="walletPasswordForm">
<div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('email') ?></label>
<input type="email" min="0" required class="form-control" id="email" name="email" >
</div>
<!-- <div class="form-group">-->
<!-- <label for="size" class="col-form-label">Nombre de caracteres</label>-->
<!-- <input type="number" min="1" required class="form-control" name="size" id="size">-->
<!-- </div>-->
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" class="btn btn-primary" id="addWalletPassword" > <?php echo $this->lang->line('generate'); ?></button>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
<!-- Bootstrap 3.3.7 -->
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
<!-- Slimscroll -->
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script>
$(function() {
$('#validated').DataTable();
})
</script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
var network_id = null;
var wallet_password_id = null;
var network = null;
var country = null;
$(document).on("click", ".openModal", function () {
network_id = $(this).data('network-id');
wallet_password_id = $(this).data('wallet_password_id');
network = $(this).data('network');
country = $(this).data('country');
});
$('#addWalletPassword').click(function(){
if($('#walletPasswordForm')[0].checkValidity()) {
const email = $('#email').val();
// const size = parseInt($('#size').val());
$.ajax({
url : '<?php echo base_url('index.php/Gestion/generate_wallet_password')?>',
type : 'POST',
dataType : 'json',
data: {"network_id": network_id ,"email": email, "wallet_password_id" : wallet_password_id , "network" : network , "country" : country },
success : function(data){
if(data=='200'){
Swal.fire({
icon: 'success',
title: '<?php echo $this->lang->line('password_generated')?>',
text:'<?php echo $this->lang->line('informations_updated')?>',
timer: 3000
}).then(()=>{
location.reload();
});
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , '<?php echo $this->lang->line('request_error')?>');
}
},
error : function(resultat, statut, error){
console.log(resultat+" "+error );
}
});
}else {
$('#walletPasswordForm')[0].reportValidity();
}
});
</script>