+ Migrate wallet management to Hyperviseur_dash

This commit is contained in:
DJERY-TOM 2020-05-05 09:25:12 +01:00
parent fa58820bef
commit af5e23faa1
12 changed files with 884 additions and 765 deletions

View File

@ -27,8 +27,7 @@ class Gestion extends CI_Controller
$hyper = $this->session->userdata('current_hyper'); $hyper = $this->session->userdata('current_hyper');
$pays = $this->session->userdata('current_pays'); $pays = $this->session->userdata('current_pays');
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$data['list_villes'] = $this->user_model->getAllVilles(); $data['list_villes'] = $this->user_model->getAllVilles();
$data['pays'] = $this->user_model->getAllPays(); $data['pays'] = $this->user_model->getAllPays();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
@ -223,8 +222,7 @@ class Gestion extends CI_Controller
$data['list_villes'] = $this->user_model->getAllVilles(); $data['list_villes'] = $this->user_model->getAllVilles();
$data['pays'] = $this->user_model->getAllPays(); $data['pays'] = $this->user_model->getAllPays();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_villes'); $this->load->view('gestion_villes');
@ -239,8 +237,7 @@ class Gestion extends CI_Controller
$data['list_villes'] = $this->user_model->getAllVilles(); $data['list_villes'] = $this->user_model->getAllVilles();
$data['pays'] = $this->user_model->getAllPays(); $data['pays'] = $this->user_model->getAllPays();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_villes'); $this->load->view('gestion_villes');
@ -272,7 +269,7 @@ class Gestion extends CI_Controller
$data['networks'] = $this->user_model->getAllNetworksNames(); $data['networks'] = $this->user_model->getAllNetworksNames();
$data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks();
//wallet //wallet
$data['networks'] = $this->user_model->getActiveNetwork(); // $data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_networks'); $this->load->view('gestion_networks');
@ -444,8 +441,6 @@ class Gestion extends CI_Controller
$data['list_villes'] = $this->user_model->getAllVilles(); $data['list_villes'] = $this->user_model->getAllVilles();
$data['pays'] = $this->user_model->getAllCountries(); $data['pays'] = $this->user_model->getAllCountries();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$data['alert'] = ""; $data['alert'] = "";
$data['active'] = "admin"; $data['active'] = "admin";
@ -597,8 +592,7 @@ class Gestion extends CI_Controller
$data['alert'] = ""; $data['alert'] = "";
$data['active'] = "codes-hyper"; $data['active'] = "codes-hyper";
$data['list'] = $this->user_model->getGeneratedHyperCodes(); $data['list'] = $this->user_model->getGeneratedHyperCodes();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('codeg'); $this->load->view('codeg');
@ -647,8 +641,7 @@ class Gestion extends CI_Controller
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname'); $data['lastname'] = $this->session->userdata('lastname');
$data['email'] = $this->session->userdata('email'); $data['email'] = $this->session->userdata('email');
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('codeg'); $this->load->view('codeg');
$this->load->view('footer'); $this->load->view('footer');
@ -673,8 +666,7 @@ class Gestion extends CI_Controller
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname'); $data['lastname'] = $this->session->userdata('lastname');
$data['email'] = $this->session->userdata('email'); $data['email'] = $this->session->userdata('email');
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('codeg'); $this->load->view('codeg');
@ -735,8 +727,7 @@ class Gestion extends CI_Controller
$data["network_geolocalisation"] = $network_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation;
$data["total"] = $count; $data["total"] = $count;
$data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_geolocalisation'); $this->load->view('gestion_geolocalisation');
@ -785,8 +776,7 @@ class Gestion extends CI_Controller
$data["network_geolocalisation"] = $network_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation;
$data["total"] = $count; $data["total"] = $count;
$data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_geolocalisation'); $this->load->view('gestion_geolocalisation');
@ -934,8 +924,7 @@ class Gestion extends CI_Controller
$data["total"] = $count; $data["total"] = $count;
$data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_campagne'); $this->load->view('gestion_campagne');
@ -984,8 +973,7 @@ class Gestion extends CI_Controller
$data["network_geolocalisation"] = $network_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation;
$data["total"] = $count; $data["total"] = $count;
$data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks();
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_geolocalisation'); $this->load->view('gestion_geolocalisation');
@ -1052,8 +1040,7 @@ class Gestion extends CI_Controller
$data['active'] = "game"; $data['active'] = "game";
$data['code_parrain'] = $this->session->userdata('code_parrain'); $data['code_parrain'] = $this->session->userdata('code_parrain');
$data['alert'] = ""; $data['alert'] = "";
//wallet
$data['networks'] = $this->user_model->getActiveNetwork();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('game'); $this->load->view('game');
$this->load->view('footer'); $this->load->view('footer');
@ -1554,7 +1541,7 @@ class Gestion extends CI_Controller
}else{ }else{
$taux = $this->user_model->getTaux($network_id); $taux = $this->user_model->getTaux($network_id);
if ($taux != null) { if ($taux != null) {
$taux = $this->user_model->getTaux($network_id)->first_row(); $taux = $taux->first_row();
$data['taux_client_r'] = $taux->taux_com_client_retrait; $data['taux_client_r'] = $taux->taux_com_client_retrait;
$data['taux_client_d'] = $taux->taux_com_client_depot; $data['taux_client_d'] = $taux->taux_com_client_depot;
$data['taux_ag_r'] = $taux->taux_com_ag_retrait; $data['taux_ag_r'] = $taux->taux_com_ag_retrait;
@ -1596,8 +1583,6 @@ 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();
@ -1628,6 +1613,15 @@ class Gestion extends CI_Controller
if (isset($_POST)) { if (isset($_POST)) {
$network_id = $_POST['network_id']; $network_id = $_POST['network_id'];
if($method == 'create')
{
$res = $this->user_model->addConfigWallet($network_id , 0 , 0, 0 ,0 , 0, 0, 0 , 0 , 0);
// if($res)
// $this->generateAllWallets($network_id);
}
else if($method = 'update'){
$taux_client_r = $_POST['taux_client_r']; $taux_client_r = $_POST['taux_client_r'];
$taux_client_d = $_POST['taux_client_d']; $taux_client_d = $_POST['taux_client_d'];
$taux_ag_d = $_POST['taux_ag_d']; $taux_ag_d = $_POST['taux_ag_d'];
@ -1638,14 +1632,6 @@ class Gestion extends CI_Controller
$taux_bq_r = $_POST['taux_bq_r']; $taux_bq_r = $_POST['taux_bq_r'];
$frais_d = $_POST['frais_d']; $frais_d = $_POST['frais_d'];
if($method == 'create')
{
$res = $this->user_model->addConfigWallet($network_id , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d);
// if($res)
// $this->generateAllWallets($network_id);
}
else if($method = 'update'){
$res = $this->user_model->updateConfigWallet($network_id , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d); $res = $this->user_model->updateConfigWallet($network_id , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d);
} }
@ -1731,7 +1717,6 @@ class Gestion extends CI_Controller
$data['alert'] = ""; $data['alert'] = "";
$data['networks'] = $this->user_model->getAllActivatedNetworks(); $data['networks'] = $this->user_model->getAllActivatedNetworks();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$data['networks'] = $this->user_model->getAllActivatedNetworks();
$networkDetails = $this->user_model->getNetworkDetails($network_id); $networkDetails = $this->user_model->getNetworkDetails($network_id);
if($networkDetails){ if($networkDetails){
$data['network'] = $networkDetails->first_row()->network; $data['network'] = $networkDetails->first_row()->network;
@ -1745,142 +1730,7 @@ class Gestion extends CI_Controller
$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

@ -304,54 +304,78 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('login', $data); $this->load->view('login', $data);
} else { } else {
$id_network = $this->session->userdata('network_id'); $id_network = $this->session->userdata('network_id');
if($this->input->get('history')){
$this->historique($id_network,$this->input->get('d'),$this->input->get('f'),$this->input->get('history'));
}else {
$data["commission"] = ""; $data["commission"] = "";
$data["principal"] = ""; $data["principal"] = "";
$data["transactions"] = ""; $data["transactions"] = "";
$agent_id = $this->session->userdata('agent_id'); $agent_id = $this->session->userdata('agent_id');
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
if ($data['hasWallet']) {
$taux = $data['hasWallet']->first_row();
$data['taux_client_r'] = $taux->taux_com_client_retrait;
$data['taux_client_d'] = $taux->taux_com_client_depot;
$data['taux_ag_r'] = $taux->taux_com_ag_retrait;
$data['taux_ag_d'] = $taux->taux_com_ag_depot;
$data['taux_sup_r'] = $taux->taux_com_sup_retrait;
$data['taux_sup_d'] = $taux->taux_com_sup_depot;
$data['taux_bq_d'] = $taux->part_banque_depot;
$data['taux_bq_r'] = $taux->part_banque_retrait;
$data['frais_d'] = $taux->frais_min_banque_depot;
//Create wallet if it not exist //Create wallet if it not exist
$res = $this->user_model->getWallet($agent_id ); $res = $this->user_model->getWallet($agent_id);
if($res == false){ if ($res == false) {
if($data['hasWallet']){ $this->user_model->addWallet($agent_id);
$this->user_model->addWallet($agent_id ); $res = $this->user_model->getWallet($agent_id);
}
} }
$res = $this->user_model->getWallet($agent_id);
if ($res!=null){
$row = $res->first_row(); $row = $res->first_row();
$data["commission"] = $row->balance_com; $data["commission"] = $row->balance_com;
$data["principal"] = $row->balance_princ; $data["principal"] = $row->balance_princ;
$data['wallet_id'] = $row->wallet_id;
$agents_g = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code')); $agents_g = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code'));
//Fetch all transactions of any geolocated agent of the network //Fetch all transactions of any geolocated agent of the network
$data["transactions"] = array(); $data["transactions"] = array();
$totalCommissionBanque = 0; $totalCommissionBanque = 0;
if($agents_g){ if ($agents_g) {
foreach($agents_g->result() AS $row){ foreach ($agents_g->result() as $row) {
$wallet = $this->user_model->getWallet($row->agent_id); $wallet = $this->user_model->getWallet($row->agent_id);
if($wallet){ if ($wallet) {
$transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id); $transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id);
if($transactions){ if ($transactions) {
foreach($transactions->result() AS $trans){ foreach ($transactions->result() as $trans) {
$totalCommissionBanque += $trans->commission_banque; $totalCommissionBanque += $trans->commission_banque;
$trans->code_parrain = $row->code_parrain ; // Add code parrain to transaction $trans->code_parrain = $row->code_parrain; // Add code parrain to transaction
array_push( $data['transactions'], $trans); array_push($data['transactions'], $trans);
} }
} }
} }
} }
} }
$data["totalCommissionBanque"] = $totalCommissionBanque; $data["totalCommissionBanque"] = $totalCommissionBanque;
}else{ } else {
$data["taux_client_r"] = "N/A";
$data["taux_client_d"] = "N/A";
$data["taux_ag_r"] = "N/A";
$data["taux_ag_d"] = "N/A";
$data["taux_sup_r"] = "N/A";
$data["taux_sup_d"] = "N/A";
$data['taux_bq_d'] = "N/A";
$data['taux_bq_r'] = "N/A";
$data['frais_d'] = "N/A";
$data["commission"] = "N/A"; $data["commission"] = "N/A";
$data["principal"] = "N/A"; $data["principal"] = "N/A";
$data["totalCommissionBanque"] = "N/A"; $data["totalCommissionBanque"] = "N/A";
$data["transactions"] = false; $data["transactions"] = false;
} }
$res = $this->user_model->getWalletPassword($id_network);
$data['walletPassword'] = $res ? $res->first_row() : null;
$data['alert'] = ""; $data['alert'] = "";
$data['active'] = "wallet"; $data['active'] = "wallet";
$data['token'] = $this->session->userdata('token'); $data['token'] = $this->session->userdata('token');
@ -364,15 +388,211 @@ class Hyperviseur_dash extends CI_Controller
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['network_id'] = $id_network; $data['network_id'] = $id_network;
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'],$this->session->userdata('current_pays')); $data['country'] = $this->session->userdata('current_pays');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['pays'] = $this->user_model->getAllGameCountries(); $data['pays'] = $this->user_model->getAllGameCountries();
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network); $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network);
$this->load->view('header_hyp',$data); $this->load->view('header_hyp', $data);
$this->load->view('gestion_wallet_hyp'); $this->load->view('gestion_wallet_hyp');
$this->load->view('footer'); $this->load->view('footer');
}
} }
} }
private function isLogged()
{
if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first');
$data['alert'] = "ok";
$data['message'] = "Login first!";
$this->load->view('login', $data);
return false;
}
return true;
}
private function historique($network_id ,$startDate ,$endDate, $type)
{
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ;
$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
$data['transactions'] = $this->user_model->getRecharges($startDate , $endDate ,$network_id);
$data['active'] = "wallet";
$data['alert'] = "";
$data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname');
$data['email'] = $this->session->userdata('email');
$data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category');
$this->load->view('header_hyp', $data);
if($type == 'transaction')
$this->load->view('historique_transactions');
else
$this->load->view('historique_recharges');
$this->load->view('footer');
}
public function walletPassword(){
if($this->isLogged()){
$data['active'] = "wallet_password";
$data['alert'] = "";
$data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname');
$data['email'] = $this->session->userdata('email');
$data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays');
$data['network_id'] = $this->session->userdata('network_id');
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
$data['walletPassword'] = $res ? $res->first_row() : null;
$this->load->view('header_hyp', $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 = 'abcdefghjkmnpqrstuvwxyz'.
'23456789';
$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

@ -279,7 +279,7 @@ $lang['request_error'] = 'Request error';
$lang['error_message'] = 'An error has occurred.'; $lang['error_message'] = 'An error has occurred.';
$lang['wallet_password'] = 'Wallet password'; $lang['wallet_password'] = 'Wallet password';
$lang['wallet_update'] = 'Wallet update'; $lang['wallet_update'] = 'Wallet update';
$lang['recharge_hypervisor_account'] = 'Reload virtual currency in the hypervisor account'; $lang['recharge_hypervisor_account'] = 'Reload virtual currency in my account';
$lang['recharge'] = 'Recharge'; $lang['recharge'] = 'Recharge';
$lang['click_here'] = 'Click here'; $lang['click_here'] = 'Click here';
$lang['no_wallet_password'] = 'No password exists for this wallet, please generate a password! '; $lang['no_wallet_password'] = 'No password exists for this wallet, please generate a password! ';

View File

@ -276,7 +276,7 @@
// Mot de passe du wallet // Mot de passe du wallet
$lang['menu_wallet_password'] = 'Mot de passe Wallet' ; $lang['menu_wallet_password'] = 'Mot de passe Wallet' ;
$lang['header_wallet_password'] = 'Gestion des mots de passe des wallets' ; $lang['header_wallet_password'] = 'Gestion du mot de passe du wallet' ;
$lang['activated_wallets'] = 'Wallets actifs' ; $lang['activated_wallets'] = 'Wallets actifs' ;
$lang['generated'] = 'Généré'; $lang['generated'] = 'Généré';
$lang['not_generated'] = 'Non généré'; $lang['not_generated'] = 'Non généré';
@ -291,7 +291,7 @@
$lang['error_message'] = 'Une erreur s\'est produite.'; $lang['error_message'] = 'Une erreur s\'est produite.';
$lang['wallet_password'] = 'Mot de passe du wallet'; $lang['wallet_password'] = 'Mot de passe du wallet';
$lang['wallet_update'] = 'Mise à jour 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_hypervisor_account'] = 'Recharger de la monnaie virtuelle dans mon compte';
$lang['recharge'] = 'Recharger'; $lang['recharge'] = 'Recharger';
$lang['click_here'] = 'Cliquez ici'; $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['no_wallet_password'] = 'Aucun mot de passe n\'existe pour ce wallet, veuillez generer un mot de passe ! ';

View File

@ -5,7 +5,6 @@
<link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>"> <link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>">
<link rel="stylesheet" <link rel="stylesheet"
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>"> href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<?php <?php
function convertDate($date) function convertDate($date)
@ -171,17 +170,8 @@ if ($transactions != false) {
</section> </section>
<section class="content"> <section class="content">
<div class="row">
<div class="margin">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
</div>
</div>
<div class="row centered"> <div class="row centered">
<div class="col-lg-2 col-xs-6"> <div class="col-lg-2 col-lg-offset-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>
@ -374,124 +364,7 @@ if ($transactions != false) {
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="modal-update">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h3 class="modal-title"><?php echo $this->lang->line('Configuration du wallet'); ?></h3>
</div>
<div class="modal-body">
<form id="walletForm">
<div class="form-group">
<label for="nom"
class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_client_r" name="taux_client_r" value="<?= $taux_client_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission agent géolocalisé sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_ag_r" id="taux_ag_r" value="<?= $taux_ag_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_sup_r" id="taux_sup_r" value="<?= $taux_sup_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" id="taux_bq_r"
name="taux_bq_r" value="<?= $taux_bq_r ?>">
</div>
<div class="form-group">
<label for="adresse"
class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_client_d" name="taux_client_d" value="<?= $taux_client_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Frais minimun de la banque sur le dépot') . ' (FCFA)'; ?></label>
<input type="number" min="0" required class="form-control" id="frais_d"
name="frais_d" value="<?= $frais_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission agent géolocalisé sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" id="taux_ag_d"
name="taux_ag_d" value="<?= $taux_ag_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_sup_d" name="taux_sup_d" value="<?= $taux_sup_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_bq_d" id="taux_bq_d" value="<?= $taux_bq_d ?>">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left"
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" id="updateWallet" data-network-id="<?= $network_id ?>"
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="rechargeAccount" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('recharge_hypervisor_account'); ?></h3>
</div>
<div class="modal-body">
<?php if ($walletPassword != null) { ?>
<form id="rechargeAccountForm">
<div class="form-group">
<label for="montant" class="col-form-label"><?php echo $this->lang->line('Montant') ?></label>
<input type="text" required class="form-control" id="montant" name="montant" >
</div>
<div class="form-group">
<label for="password" class="col-form-label"><?php echo $this->lang->line('mot de passe') ?></label>
<input type="password" required class="form-control" name="password" id="password">
</div>
<div class="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>
@ -520,16 +393,13 @@ if ($transactions != false) {
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></scriptf> src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></scriptf>
<!-- ChartJS --> <!-- ChartJS -->
<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('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', '', {digitGroupSeparator: ' ', decimalPlaces:'0', maximumValue: '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
@ -582,174 +452,5 @@ if ($transactions != false) {
Pie = JSON.parse(Pie); Pie = JSON.parse(Pie);
} }
</script> </script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
$('#updateWallet').click(function () {
var network_id = $(this).data('network-id');
if ($('#walletForm')[0].checkValidity()) {
var taux_client_r = parseFloat($('#taux_client_r').val());
var taux_client_d = parseFloat($('#taux_client_d').val());
var taux_ag_r = parseFloat($('#taux_ag_r').val());
var taux_ag_d = parseFloat($('#taux_ag_d').val());
var taux_sup_r = parseFloat($('#taux_sup_r').val());
var taux_sup_d = parseFloat($('#taux_sup_d').val());
var taux_bq_d = parseFloat($('#taux_bq_d').val());
var taux_bq_r = parseFloat($('#taux_bq_r').val());
var frais_d = $('#frais_d').val();
var sommeRetrait = taux_ag_r + taux_sup_r + taux_bq_r;
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d;
if((taux_ag_r + taux_sup_r) > 100){
toastr.error("<?php echo $this->lang->line('first_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if((taux_ag_d + taux_sup_d) > 100){
toastr.error("<?php echo $this->lang->line('second_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if(sommeRetrait >= taux_client_r){
toastr.error("<?php echo $this->lang->line('third_rule')?>", "<?php echo $this->lang->line('management_rule')?>")
}else if(sommeDepot >= 100){
toastr.error("<?php echo $this->lang->line('fourth_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else{
$.ajax({
url: '<?php echo base_url('index.php/Gestion/config_wallet/update')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id": network_id,
"taux_client_r": taux_client_r,
"taux_client_d": taux_client_d,
"taux_ag_r": taux_ag_r,
"taux_ag_d": taux_ag_d,
"taux_sup_r": taux_sup_r,
"taux_sup_d": taux_sup_d,
"taux_bq_r": taux_bq_r,
"taux_bq_d": taux_bq_d,
"frais_d": frais_d
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('wallet_update')?>",
text:"<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
}
} else {
$('#walletForm')[0].reportValidity();
}
});
$('#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);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
$('#rechargeWallet').click(function () {
const wallet_id = $(this).data('wallet_id');
const salt = $(this).data('salt');
const encrypted_password = $(this).data('encrypted_password');
if ($('#rechargeAccountForm')[0].checkValidity()) {
const montant = anElement.getNumber(); //parseFloat($('#montant').val());
const password = $('#password').val();
$.ajax({
url: '<?php echo base_url('index.php/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('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
} else {
$('#rechargeAccountForm')[0].reportValidity();
}
});
</script>
<!-- Page script --> <!-- Page script -->
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script> <script src="<?php echo base_url('dist/js/custom.js') ?>"></script>

View File

@ -4,6 +4,7 @@
<link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>"> <link rel="stylesheet" href="<?php echo base_url('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') ?>">
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script> <script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script>
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>"> <link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<?php <?php
function convertDate($date){ function convertDate($date){
@ -139,7 +140,7 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
Wallet <?php echo $network; ?> Wallet <?php echo $network . ' - ' .$country; ?>
</h1> </h1>
<?php <?php
$site_url = base_url(); $site_url = base_url();
@ -172,7 +173,6 @@
<section class="content"> <section class="content">
<div class="row"> <div class="row">
<div class="col-lg-4 col-xs-6"> <div class="col-lg-4 col-xs-6">
<div class="small-box bg-aqua"> <div class="small-box bg-aqua">
<div class="inner"> <div class="inner">
@ -185,7 +185,6 @@
</div> </div>
</div> </div>
<div class="col-lg-4 col-xs-6"> <div class="col-lg-4 col-xs-6">
<div class="small-box bg-green"> <div class="small-box bg-green">
<div class="inner"> <div class="inner">
@ -209,11 +208,149 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="margin">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
style="width: 100%"><?php echo $this->lang->line('Modifier la configuration') ?></button>
</div>
</div>
<div class="row centered">
<div class="col-lg-2 col-xs-6">
<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#rechargeAccount" style="white-space: normal;"><?php echo $this->lang->line('recharge_hypervisor_account') ?> </button>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-red-active">
<div class="inner">
<h3><?php echo $taux_client_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission client sur retrait') ?></p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_ag_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission agent géolocalisé sur retrait') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_ag_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_sup_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission superviseur sur retrait') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_sup_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active">
<div class="inner">
<h3><?php echo $taux_bq_r; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Part de la banque sur le retrait') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-up"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_bq_r" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
</div>
<div class="row">
<div class="col-lg-2 col-lg-offset-1 col-xs-6">
<div class="small-box bg-green-active">
<div class="inner">
<h3><?php echo $taux_client_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission client sur dépot') ?></p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-green-active">
<div class="inner">
<h3><?php echo $frais_d; ?><sup style="font-size: 20px">FCFA</sup></h3>
<p><?php echo $this->lang->line('Frais minimun de la banque sur le dépot') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="frais_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-yellow-active">
<div class="inner">
<h3><?php echo $taux_ag_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission agent géolocalisé sur dépot') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_ag_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-yellow-active">
<div class="inner">
<h3><?php echo $taux_sup_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Taux de commission superviseur sur dépot') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_sup_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-yellow-active">
<div class="inner">
<h3><?php echo $taux_bq_d; ?><sup style="font-size: 20px">%</sup></h3>
<p><?php echo $this->lang->line('Part de la banque sur le dépot') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-arrow-down"></i>
</div>
<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_bq_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>-->
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="box box-success"> <div class="box box-success">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"><?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3> <h3 class="box-title"><?php echo $this->lang->line('Historique des 12 derniers mois'); ?></h3>
<div class="box-tools">
<a class="btn btn-primary" href="<?php echo current_url().($network_id ? '?history=transaction' : '')?>">
<?php echo $this->lang->line('transactions_historic'); ?>
</a>
<a class="btn btn-info" href="<?php echo current_url().($network_id ? '?history=recharge' : '')?>">
<?php echo $this->lang->line('recharge_historic'); ?>
</a>
</div>
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="chart" id="chart"> <div class="chart" id="chart">
@ -302,6 +439,124 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="modal-update">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h3 class="modal-title"><?php echo $this->lang->line('Configuration du wallet'); ?></h3>
</div>
<div class="modal-body">
<form id="walletForm">
<div class="form-group">
<label for="nom"
class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_client_r" name="taux_client_r" value="<?= $taux_client_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission agent géolocalisé sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_ag_r" id="taux_ag_r" value="<?= $taux_ag_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_sup_r" id="taux_sup_r" value="<?= $taux_sup_r ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le retrait') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" id="taux_bq_r"
name="taux_bq_r" value="<?= $taux_bq_r ?>">
</div>
<div class="form-group">
<label for="adresse"
class="col-form-label"><?php echo $this->lang->line('Taux de commission client sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_client_d" name="taux_client_d" value="<?= $taux_client_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Frais minimun de la banque sur le dépot') . ' (FCFA)'; ?></label>
<input type="number" min="0" required class="form-control" id="frais_d"
name="frais_d" value="<?= $frais_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission agent géolocalisé sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" id="taux_ag_d"
name="taux_ag_d" value="<?= $taux_ag_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
id="taux_sup_d" name="taux_sup_d" value="<?= $taux_sup_d ?>">
</div>
<div class="form-group">
<label for="email"
class="col-form-label"><?php echo $this->lang->line('Part de la banque sur le dépot') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="taux_bq_d" id="taux_bq_d" value="<?= $taux_bq_d ?>">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left"
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" id="updateWallet" data-network-id="<?= $network_id ?>"
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="rechargeAccount" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('recharge_hypervisor_account'); ?></h3>
</div>
<div class="modal-body">
<?php if ($walletPassword != null) { ?>
<form id="rechargeAccountForm">
<div class="form-group">
<label for="montant" class="col-form-label"><?php echo $this->lang->line('Montant') ?></label>
<input type="text" required class="form-control" id="montant" name="montant" >
</div>
<div class="form-group">
<label for="password" class="col-form-label"><?php echo $this->lang->line('mot de passe') ?></label>
<input type="password" required class="form-control" name="password" id="password">
</div>
<div class="clearfix">
<a href="#" id="resetPassword" class="pull-right forgot-password" data-wallet_password_id="<?php echo $walletPassword->id ?>" data-network="<?php echo $network ?>" data-country="<?php echo $country ?>"
data-email="<?php echo $walletPassword->email ?>">
<?php echo $this->lang->line('i_forgot_password') ?>
</a>
</div>
</form>
<?php }else{ ?>
<div class="text-center">
<h4> <?php echo $this->lang->line('no_wallet_password') ?></h4>
<a href="<?php echo base_url('index.php/Hyperviseur_dash/walletPassword') ?>" alt="" class="btn btn-primary"><?php echo $this->lang->line('click_here') ?></a>
</div>
<?php } ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<?php if ($walletPassword != null) { ?>
<button type="button" class="btn btn-primary" data-wallet_id="<?php echo $wallet_id ?>" data-salt="<?php echo $walletPassword->salt ?>" data-encrypted_password="<?php echo $walletPassword->encrypted_password ?>" id="rechargeWallet" >
<?php echo $this->lang->line('recharge'); ?>
</button>
<?php }?>
</div>
</div>
</div>
</div>
</div> </div>
</section> </section>
@ -330,10 +585,14 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<!-- ChartJS --> <!-- ChartJS -->
<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('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', '', {digitGroupSeparator: ' ', decimalPlaces:'0', minimumValue : '1' , maximumValue: '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
@ -387,7 +646,173 @@
} }
</script> </script>
<script> <script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
$('#updateWallet').click(function () {
var network_id = $(this).data('network-id');
if ($('#walletForm')[0].checkValidity()) {
var taux_client_r = parseFloat($('#taux_client_r').val());
var taux_client_d = parseFloat($('#taux_client_d').val());
var taux_ag_r = parseFloat($('#taux_ag_r').val());
var taux_ag_d = parseFloat($('#taux_ag_d').val());
var taux_sup_r = parseFloat($('#taux_sup_r').val());
var taux_sup_d = parseFloat($('#taux_sup_d').val());
var taux_bq_d = parseFloat($('#taux_bq_d').val());
var taux_bq_r = parseFloat($('#taux_bq_r').val());
var frais_d = $('#frais_d').val();
var sommeRetrait = taux_ag_r + taux_sup_r + taux_bq_r;
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d;
if((taux_ag_r + taux_sup_r) > 100){
toastr.error("<?php echo $this->lang->line('first_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if((taux_ag_d + taux_sup_d) > 100){
toastr.error("<?php echo $this->lang->line('second_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if(sommeRetrait >= taux_client_r){
toastr.error("<?php echo $this->lang->line('third_rule')?>", "<?php echo $this->lang->line('management_rule')?>")
}else if(sommeDepot >= 100){
toastr.error("<?php echo $this->lang->line('fourth_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else{
$.ajax({
url: '<?php echo base_url('index.php/Gestion/config_wallet/update')?>',
type: 'POST',
dataType: 'json',
data: {
"network_id": network_id,
"taux_client_r": taux_client_r,
"taux_client_d": taux_client_d,
"taux_ag_r": taux_ag_r,
"taux_ag_d": taux_ag_d,
"taux_sup_r": taux_sup_r,
"taux_sup_d": taux_sup_d,
"taux_bq_r": taux_bq_r,
"taux_bq_d": taux_bq_d,
"frais_d": frais_d
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('wallet_update')?>",
text:"<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
}
} else {
$('#walletForm')[0].reportValidity();
}
});
$('#resetPassword').click(function () {
const wallet_password_id = $(this).data('wallet_password_id');
const network = $(this).data('network');
const country = $(this).data('country');
const email = $(this).data('email');
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/resetWalletPassword')?>',
type: 'POST',
dataType: 'json',
data: {
"wallet_password_id": wallet_password_id,
"email": email,
"network" : network ,
"country" : country
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('password_has_been_reset')?>",
text:"<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
$('#rechargeWallet').click(function () {
const wallet_id = $(this).data('wallet_id');
const salt = $(this).data('salt');
const encrypted_password = $(this).data('encrypted_password');
if ($('#rechargeAccountForm')[0].checkValidity()) {
const montant = anElement.getNumber(); //parseFloat($('#montant').val());
const password = $('#password').val();
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/recharge_wallet')?>',
type: 'POST',
dataType: 'json',
data: {
"wallet_id": wallet_id,
"montant": montant ,
"password": password,
"salt" : salt,
"encrypted_password" : encrypted_password
},
success: function (data) {
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('account_recharged')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else if(data == '400'){
toastr.error("<?php echo $this->lang->line('incorrect_password')?>" , "<?php echo $this->lang->line('request_error')?>");
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
} else {
$('#rechargeAccountForm')[0].reportValidity();
}
});
</script> </script>
<!-- Page script --> <!-- Page script -->
<script src="<?php echo base_url('dist/js/custom.js') ?>"></script> <script src="<?php echo base_url('dist/js/custom.js') ?>"></script>

View File

@ -84,7 +84,7 @@
}else{ }else{
?> ?>
<td><span class="label label-danger"><?php echo $this->lang->line('Inactif'); ?></span></td> <td><span class="label label-danger"><?php echo $this->lang->line('Inactif'); ?></span></td>
<td><button type="button" data-toggle="modal" data-target="#enableWallet" data-network-id="<?php echo $row->id ?>" class="btn btn-primary openModal"><?php echo $this->lang->line('Activer'); ?></button></td> <td><button type="button" data-network-id="<?php echo $row->id ?>" class="btn btn-primary enableWallet" ><?php echo $this->lang->line('Activer'); ?></button></td>
<?php <?php
} }
?> ?>
@ -114,59 +114,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="enableWallet" 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('Configuration du wallet'); ?></h3>
</div>
<div class="modal-body">
<form id="walletForm">
<div class="form-group">
<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">
</div>
<div class="form-group">
<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">
</div>
<div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('Taux de commission superviseur sur retrait').' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" name="taux_sup_r" id="taux_sup_r" value="0">
</div>
<div class="form-group">
<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">
</div>
<div class="form-group">
<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">
</div>
<div class="form-group">
<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">
</div>
<div class="form-group">
<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">
</div>
<div class="form-group">
<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">
</div>
<div class="form-group">
<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">
</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="addWallet" > <?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="disableWallet" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade" id="disableWallet" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@ -226,39 +174,15 @@
$(document).on("click", ".openModal", function () { $(document).on("click", ".openModal", function () {
network_id = $(this).data('network-id'); network_id = $(this).data('network-id');
}); })
$('#addWallet').click(function(){ $(document).on("click", ".enableWallet", function () {
const network_id = $(this).data('network-id');
if($('#walletForm')[0].checkValidity()) {
var taux_client_r = parseFloat($('#taux_client_r').val());
var taux_client_d = parseFloat($('#taux_client_d').val());
var taux_ag_r = parseFloat($('#taux_ag_r').val());
var taux_ag_d = parseFloat($('#taux_ag_d').val());
var taux_sup_r = parseFloat($('#taux_sup_r').val());
var taux_sup_d = parseFloat($('#taux_sup_d').val());
var taux_bq_d = parseFloat($('#taux_bq_d').val());
var taux_bq_r = parseFloat($('#taux_bq_r').val());
var frais_d =$('#frais_d').val();
var sommeRetrait = taux_ag_r + taux_sup_r +taux_bq_r ;
var sommeDepot = taux_ag_d + taux_sup_d + taux_bq_d ;
if((taux_ag_r + taux_sup_r) > 100){
toastr.error("<?php echo $this->lang->line('first_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if((taux_ag_d + taux_sup_d) > 100){
toastr.error("<?php echo $this->lang->line('second_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else if(sommeRetrait >= taux_client_r){
toastr.error("<?php echo $this->lang->line('third_rule')?>", "<?php echo $this->lang->line('management_rule')?>")
}else if(sommeDepot >= 100){
toastr.error("<?php echo $this->lang->line('fourth_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
}else{
$.ajax({ $.ajax({
url : '<?php echo base_url('index.php/Gestion/config_wallet/create')?>', url : '<?php echo base_url('index.php/Gestion/config_wallet/create')?>',
type : 'POST', type : 'POST',
dataType : 'json', dataType : 'json',
data: {"network_id": network_id ,"taux_client_r": taux_client_r, "taux_client_d": taux_client_d,"taux_ag_r": taux_ag_r, "taux_ag_d": taux_ag_d , "taux_sup_r": taux_sup_r , "taux_sup_d": taux_sup_d, data: {"network_id": network_id},
"taux_bq_r": taux_bq_r, "taux_bq_d":taux_bq_d, "frais_d": frais_d},
success : function(data){ success : function(data){
if(data=='200'){ if(data=='200'){
@ -292,13 +216,6 @@
} }
}); });
}); });
}
}else {
$('#walletForm')[0].reportValidity();
}
}); });
$('#deleteWallet').click(function(){ $('#deleteWallet').click(function(){

View File

@ -147,11 +147,6 @@
<i class="glyphicon glyphicon-credit-card"></i> <span>Wallet</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

@ -149,6 +149,11 @@
<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<?php //echo $this->lang->line('Game'); ?></span>
</a> </a>
</li> </li>
<li class="<?php if($active=="wallet_password"){echo "active";} ?>">
<a href="<?php echo base_url('index.php/Hyperviseur_dash/walletPassword') ?>">
<i class="glyphicon glyphicon-lock"></i> <span><?php echo $this->lang->line('menu_wallet_password'); ?></span>
</a>
</li>
<?php } ?> <?php } ?>
</ul> </ul>
@ -258,6 +263,7 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" /> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<script type="text/javascript"> <script type="text/javascript">
var startDate; var startDate;
var endDate; var endDate;

View File

@ -9,7 +9,7 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
<?php echo $this->lang->line('Gestion des wallets') . ' '.$network.' - '.$country; ?> <?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"--> <!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
<!-- value="Activer/Désactiver le(s) réseau(x)" />--> <!-- value="Activer/Désactiver le(s) réseau(x)" />-->
</h1> </h1>
@ -49,7 +49,7 @@
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span> <span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
<span class="info-box-number"> <span class="info-box-number">
<input id="picker" <input id="picker"
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%" 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') ?>" type="text" name="daterange" data-lang="<?php echo $this->session->userdata('site_lang') ?>"
value="<?php echo ($startDate!=null & $endDate != null) ? $startDate. ' - '.$endDate : ''?>"/> value="<?php echo ($startDate!=null & $endDate != null) ? $startDate. ' - '.$endDate : ''?>"/>
@ -160,6 +160,7 @@
$(function () { $(function () {
const lang = $('#picker').data('lang'); const lang = $('#picker').data('lang');
const category = $('#picker').data('category');
$('input[name="daterange"]').daterangepicker({ $('input[name="daterange"]').daterangepicker({
opens: 'left', opens: 'left',
autoUpdateInput: false, autoUpdateInput: false,
@ -170,6 +171,9 @@
}, 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');
if(category)
window.location = "<?php echo current_url()?>" + "?history=recharge" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?php echo current_url()?>" + "?id=118&history=recharge" + "&d=" + debut + "&f=" + fin; window.location = "<?php echo current_url()?>" + "?id=118&history=recharge" + "&d=" + debut + "&f=" + fin;
}); });
@ -177,6 +181,9 @@
$('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('');
if(category)
window.location = "<?php echo current_url()?>" + "?history=recharge";
else
window.location = "<?php echo current_url()?>" + "?id=118&history=recharge"; window.location = "<?php echo current_url()?>" + "?id=118&history=recharge";
}); });
}); });

View File

@ -9,7 +9,7 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
<?php echo $this->lang->line('Gestion des wallets') . ' '.$network.' - '.$country; ?> <?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"--> <!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
<!-- value="Activer/Désactiver le(s) réseau(x)" />--> <!-- value="Activer/Désactiver le(s) réseau(x)" />-->
</h1> </h1>
@ -49,7 +49,7 @@
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span> <span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
<span class="info-box-number"> <span class="info-box-number">
<input id="picker" <input id="picker"
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%" 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') ?>" type="text" name="daterange" data-lang="<?php echo $this->session->userdata('site_lang') ?>"
value="<?php echo ($startDate!=null & $endDate != null) ? $startDate. ' - '.$endDate : ''?>"/> value="<?php echo ($startDate!=null & $endDate != null) ? $startDate. ' - '.$endDate : ''?>"/>
@ -172,6 +172,7 @@
$(function () { $(function () {
const lang = $('#picker').data('lang'); const lang = $('#picker').data('lang');
const category = $('#picker').data('category');
$('input[name="daterange"]').daterangepicker({ $('input[name="daterange"]').daterangepicker({
opens: 'left', opens: 'left',
autoUpdateInput: false, autoUpdateInput: false,
@ -182,6 +183,9 @@
}, 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');
if(category)
window.location = "<?php echo current_url()?>" + "?history=transaction" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?php echo current_url()?>" + "?id=118&history=transaction" + "&d=" + debut + "&f=" + fin; window.location = "<?php echo current_url()?>" + "?id=118&history=transaction" + "&d=" + debut + "&f=" + fin;
}); });
@ -189,6 +193,9 @@
$('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('');
if(category)
window.location = "<?php echo current_url()?>" + "?history=transaction";
else
window.location = "<?php echo current_url()?>" + "?id=118&history=transaction"; window.location = "<?php echo current_url()?>" + "?id=118&history=transaction";
}); });
}); });

View File

@ -1,5 +1,7 @@
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>"> <link rel="stylesheet"
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css"> 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') ?>"> <link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
@ -7,14 +9,15 @@
<h1> <h1>
<?php echo $this->lang->line('header_wallet_password'); ?> <?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;" /> <input type="button" class="btn btn-primary pull-right" id="Bactiver"
value="Activer/Désactiver le(s) réseau(x)" style="display: none;"/>
</h1> </h1>
<?php <?php
$site_url = base_url(); $site_url = base_url();
if($alert=="ok") { if ($alert == "ok") {
if(!$success=="ok"){ if (!$success == "ok") {
?> ?>
<div class='alert alert-danger alert-dismissible col-xs-6'> <div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
@ -41,69 +44,46 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="box"> <div class="box">
<div class="box-header"> <!-- <div class="box-header">-->
<h3 class="box-title"><?php echo $this->lang->line('activated_wallets'); ?></h3> <!---->
</div> <!-- </div>-->
<div class="box-body"> <div class="box-body">
<div class="login-box">
<div class="login-box-body">
<?php
if(isset($walletPassword)){
?>
<!-- <p>-->
<!-- <span class="label label-success" style="width: 100% ; font-size: 100% ; display: block">--><?php //echo $this->lang->line('generated'); ?><!--</span>-->
<!-- </p>-->
<?php <button type="button" data-toggle="modal" data-target="#generatePassword"
data-country="<?php echo $country ?>"
$sql2 = $networks; data-network="<?php echo $network ?>"
if($sql2!=false){ data-wallet_password_id="<?php echo $walletPassword->id ?>"
$numrows=$sql2->num_rows(); class="btn btn-warning btn-block openModal"><?php echo $this->lang->line('reset'); ?></button>
$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 <?php
}else{ }else{
?> ?>
<td><span class="label label-danger"><?php echo $this->lang->line('not_generated'); ?></span></td> <!-- <p>-->
<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> <!-- <span class="label label-danger" style="width: 100% ; font-size: 100% ; display: block">--><?php //echo $this->lang->line('not_generated'); ?><!--</span>-->
<!-- </p>-->
<button type="button" data-toggle="modal" data-target="#generatePassword"
data-country="<?php echo $country ?>"
data-network="<?php echo $network ?>"
data-network-id="<?php echo $network_id?>"
class="btn btn-primary btn-block openModal"><?php echo $this->lang->line('generate'); ?></button>
<?php <?php
} }
?> ?>
<?php
}
?>
</tbody>
</table>
<?php </div>
</div>
}
else {
echo $this->lang->line('no_wallet');
}
}else {
echo $this->lang->line('no_wallet');
}
?>
</div> </div>
</div> </div>
</div> </div>
@ -117,18 +97,21 @@
<div class="modal-body"> <div class="modal-body">
<form id="walletPasswordForm"> <form id="walletPasswordForm">
<div class="form-group"> <div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('email') ?></label> <label for="email"
<input type="email" min="0" required class="form-control" id="email" name="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>
<!-- <div class="form-group">--> <!-- <div class="form-group">-->
<!-- <label for="size" class="col-form-label">Nombre de caracteres</label>--> <!-- <label for="size" class="col-form-label">Nombre de caracteres</label>-->
<!-- <input type="number" min="1" required class="form-control" name="size" id="size">--> <!-- <input type="number" min="1" required class="form-control" name="size" id="size">-->
<!-- </div>--> <!-- </div>-->
</form> </form>
</div> </div>
<div class="modal-footer"> <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-secondary"
<button type="button" class="btn btn-primary" id="addWalletPassword" > <?php echo $this->lang->line('generate'); ?></button> 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>
</div> </div>
@ -154,9 +137,11 @@
<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="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.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 src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script> <script>
$(function() { $(function () {
$('#validated').DataTable(); $('#validated').DataTable();
}) })
</script> </script>
@ -179,38 +164,44 @@
country = $(this).data('country'); country = $(this).data('country');
}); });
$('#addWalletPassword').click(function(){ $('#addWalletPassword').click(function () {
if($('#walletPasswordForm')[0].checkValidity()) { if ($('#walletPasswordForm')[0].checkValidity()) {
const email = $('#email').val(); const email = $('#email').val();
// const size = parseInt($('#size').val()); // const size = parseInt($('#size').val());
$.ajax({ $.ajax({
url : '<?php echo base_url('index.php/Gestion/generate_wallet_password')?>', url: '<?php echo base_url('index.php/Hyperviseur_dash/generate_wallet_password')?>',
type : 'POST', type: 'POST',
dataType : 'json', dataType: 'json',
data: {"network_id": network_id ,"email": email, "wallet_password_id" : wallet_password_id , "network" : network , "country" : country }, data: {
success : function(data){ "network_id": network_id,
if(data=='200'){ "email": email,
"wallet_password_id": wallet_password_id,
"network": network,
"country": country
},
success: function (data) {
if (data == '200') {
Swal.fire({ Swal.fire({
icon: 'success', icon: 'success',
title: "<?php echo $this->lang->line('password_generated')?>", title: "<?php echo $this->lang->line('password_generated')?>",
text:"<?php echo $this->lang->line('informations_updated')?>", text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000 timer: 3000
}).then(()=>{ }).then(() => {
location.reload(); location.reload();
}); });
}else{ } else {
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>"); 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) {
console.log(resultat+" "+error ); console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>"); toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
} }
}); });
}else { } else {
$('#walletPasswordForm')[0].reportValidity(); $('#walletPasswordForm')[0].reportValidity();
} }
}); });