+ Regulations limits

+ Users groups details
This commit is contained in:
Djery-Tom 2020-09-28 16:44:45 +01:00
parent ec278d1c49
commit c06baa8011
15 changed files with 1028 additions and 201 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') OR exit('No direct script access allowed');
use Spatie\Async\Pool; use Spatie\Async\Pool;
class Gestion extends CI_Controller class Gestion extends CI_Controller
@ -10,7 +11,8 @@ class Gestion extends CI_Controller
parent::__construct(); parent::__construct();
$this->load->model('wallet_model'); $this->load->model('wallet_model');
$this->load->model('nano_credit_model'); $this->load->model('nano_credit_model');
date_default_timezone_set ($this->session->userdata('timezone')); if($this->session->userdata('timezone'))
date_default_timezone_set ($this->session->userdata('timezone'));
} }
public function index() public function index()
@ -1542,7 +1544,7 @@ class Gestion extends CI_Controller
$this->historique($network_id,$this->input->get('d'),$this->input->get('f'),$this->input->get('history')); $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);
$data['currency'] = $this->user_model->getCurrency($network_id); $data['currency'] = $this->wallet_model->getCurrency($network_id);
if ($taux != null) { if ($taux != null) {
$taux = $taux->first_row(); $taux = $taux->first_row();
$data['idConfig'] = $taux->id; $data['idConfig'] = $taux->id;
@ -1567,17 +1569,17 @@ class Gestion extends CI_Controller
$data['totalCommissionBanque'] = $totalCommissionBanque ; $data['totalCommissionBanque'] = $totalCommissionBanque ;
} elseif ($taux->type == 'ilink'){ } elseif ($taux->type == 'ilink'){
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']); $data['plr_user_wallet_wallet'] = $this->wallet_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']); $data['plr_user_wallet_cash'] = $this->wallet_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
$data['plr_agent_depot_wallet_ilink'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']); $data['plr_agent_depot_wallet_ilink'] = $this->wallet_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']);
$data['plr_agent_depot_autre_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']); $data['plr_agent_depot_autre_wallet'] = $this->wallet_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']);
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']); $data['plr_agent_cash_cash'] = $this->wallet_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']);
$data['plr_user_wallet_wallet_national'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']); $data['plr_user_wallet_wallet_national'] = $this->wallet_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']);
$data['plr_user_wallet_cash_national'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']); $data['plr_user_wallet_cash_national'] = $this->wallet_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']);
$data['plr_agent_depot_wallet_ilink_national'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']); $data['plr_agent_depot_wallet_ilink_national'] = $this->wallet_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']);
$data['plr_agent_depot_autre_wallet_national'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']); $data['plr_agent_depot_autre_wallet_national'] = $this->wallet_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
$data['plr_agent_cash_cash_national'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']); $data['plr_agent_cash_cash_national'] = $this->wallet_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig']); $data['taxes'] = $this->wallet_model->getTaxes($data['idConfig']);
@ -1604,7 +1606,7 @@ class Gestion extends CI_Controller
$data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink; $data['taux_hyp_r_cart_ilink'] = $taux->taux_com_hyp_retrait_carte_cash_ilink;
$data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink; $data['taux_bq_r_cart_ilink'] = $taux->taux_com_banque_retrait_carte_cash_ilink;
$data['transactions'] = $this->user_model->getNetworkIlinTransactions($network_id); $data['transactions'] = $this->wallet_model->getNetworkIlinTransactions($network_id);
$totalCommissionBanque = 0; $totalCommissionBanque = 0;
if ($data['transactions']) { if ($data['transactions']) {
foreach ($data['transactions']->result() as $trans) { foreach ($data['transactions']->result() as $trans) {
@ -1614,15 +1616,15 @@ class Gestion extends CI_Controller
$data["totalCommissionBanque"] = $totalCommissionBanque; $data["totalCommissionBanque"] = $totalCommissionBanque;
}elseif ($taux->type == 'autre') { }elseif ($taux->type == 'autre') {
$res = $this->user_model->getSharingRateByNetwork($network_id); $res = $this->wallet_model->getSharingRateByNetwork($network_id);
$data['commission'] = $res ? $res->first_row()->balance_com : 0 ; $data['commission'] = $res ? $res->first_row()->balance_com : 0 ;
} }
$hyper = $this->user_model->getNetworkHyper($network_id)->first_row(); $hyper = $this->wallet_model->getNetworkHyper($network_id)->first_row();
$data['walletHyper'] = $this->user_model->getWallet($hyper->agent_id); $data['walletHyper'] = $this->wallet_model->getWallet($hyper->agent_id);
$data['network_id'] = $network_id; $data['network_id'] = $network_id;
$networkDetails = $this->user_model->getNetworkDetails($network_id); $networkDetails = $this->user_model->getNetworkDetails($network_id);
if($networkDetails){ if($networkDetails){
@ -1652,7 +1654,7 @@ class Gestion extends CI_Controller
$data['active'] = "wallet"; $data['active'] = "wallet";
$data['alert'] = ""; $data['alert'] = "";
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$data['networks'] = $this->user_model->getAllActivatedNetworks(); $data['networks'] = $this->wallet_model->getAllActivatedNetworks();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_wallets'); $this->load->view('gestion_wallets');
$this->load->view('footer'); $this->load->view('footer');
@ -1669,7 +1671,7 @@ class Gestion extends CI_Controller
$type = $_POST['type']; $type = $_POST['type'];
if($method == 'create') if($method == 'create')
{ {
$res = $this->user_model->addConfigWallet($network_id , $type); $res = $this->wallet_model->addConfigWallet($network_id , $type);
// if($res) // if($res)
// $this->generateAllWallets($network_id); // $this->generateAllWallets($network_id);
@ -1687,7 +1689,7 @@ 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'];
$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->wallet_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);
}else if ($type == 'ilink'){ }else if ($type == 'ilink'){
$idConfig = $_POST['id_config']; $idConfig = $_POST['id_config'];
@ -1717,7 +1719,7 @@ class Gestion extends CI_Controller
$this->insertPalier($plr_user_wallet_wallet_national,"user_wallet_wallet_national", $idConfig); $this->insertPalier($plr_user_wallet_wallet_national,"user_wallet_wallet_national", $idConfig);
break; break;
case 'user_wallet_carte': case 'user_wallet_carte':
$this->user_model->updateConfigWalletIlink_u_w_cart($rows['taux_u_w_cart'],$rows['taux_hyp_s_wallet_cart_ilink'],$rows['taux_bq_s_wallet_cart_ilink'],$idConfig); $this->wallet_model->updateConfigWalletIlink_u_w_cart($rows['taux_u_w_cart'],$rows['taux_hyp_s_wallet_cart_ilink'],$rows['taux_bq_s_wallet_cart_ilink'],$idConfig);
break; break;
case 'user_wallet_cash': case 'user_wallet_cash':
$plr_user_wallet_cash = isset($_POST['plr_user_wallet_cash']) ? $_POST['plr_user_wallet_cash'] : null ; $plr_user_wallet_cash = isset($_POST['plr_user_wallet_cash']) ? $_POST['plr_user_wallet_cash'] : null ;
@ -1726,18 +1728,18 @@ class Gestion extends CI_Controller
$this->insertPalier($plr_user_wallet_cash_national,"user_wallet_cash_national", $idConfig); $this->insertPalier($plr_user_wallet_cash_national,"user_wallet_cash_national", $idConfig);
break; break;
case 'user_carte_wallet': case 'user_carte_wallet':
$this->user_model->updateConfigWalletIlink_u_c_w($rows['taux_u_c_w'],$rows['taux_u_c_c'], $rows['taux_hyp_r_cart_ilink'],$rows['taux_bq_r_cart_ilink'],$idConfig); $this->wallet_model->updateConfigWalletIlink_u_c_w($rows['taux_u_c_w'],$rows['taux_u_c_c'], $rows['taux_hyp_r_cart_ilink'],$rows['taux_bq_r_cart_ilink'],$idConfig);
break; break;
case 'agent_remove_cash': case 'agent_remove_cash':
$this->user_model->updateConfigWalletIlink_a_r_c($rows['taux_ag_r_c'],$rows['taux_sup_r_c'], $this->wallet_model->updateConfigWalletIlink_a_r_c($rows['taux_ag_r_c'],$rows['taux_sup_r_c'],
$rows['taux_hyp_r_c'],$idConfig); $rows['taux_hyp_r_c'],$idConfig);
break; break;
case 'agent_remove_carte_cash': case 'agent_remove_carte_cash':
$this->user_model->updateConfigWalletIlink_a_r_cart($rows['taux_ag_cart_c'], $rows['taux_ag_r_cart'],$rows['taux_sup_r_cart'], $this->wallet_model->updateConfigWalletIlink_a_r_cart($rows['taux_ag_cart_c'], $rows['taux_ag_r_cart'],$rows['taux_sup_r_cart'],
$rows['taux_hyp_r_cart'],$rows['taux_bq_r_cart'],$idConfig); $rows['taux_hyp_r_cart'],$rows['taux_bq_r_cart'],$idConfig);
break; break;
case 'agent_send_cash_carte': case 'agent_send_cash_carte':
$this->user_model->updateConfigWalletIlink_a_s_cc($rows['taux_ag_d_c_c'],$rows['taux_ag_d_c'],$rows['taux_sup_d_c'],$rows['taux_hyp_d_c'],$rows['taux_bq_d_c'],$idConfig); $this->wallet_model->updateConfigWalletIlink_a_s_cc($rows['taux_ag_d_c_c'],$rows['taux_ag_d_c'],$rows['taux_sup_d_c'],$rows['taux_hyp_d_c'],$rows['taux_bq_d_c'],$idConfig);
break; break;
case 'agent_send_cash_canal': case 'agent_send_cash_canal':
$plr_agent_depot_wallet_ilink = isset($_POST['plr_agent_depot_wallet_ilink']) ? $_POST['plr_agent_depot_wallet_ilink'] : null; $plr_agent_depot_wallet_ilink = isset($_POST['plr_agent_depot_wallet_ilink']) ? $_POST['plr_agent_depot_wallet_ilink'] : null;
@ -1756,7 +1758,7 @@ class Gestion extends CI_Controller
$this->insertPalier($plr_agent_depot_autre_wallet_national,"agent_depot_autre_wallet_national", $idConfig); $this->insertPalier($plr_agent_depot_autre_wallet_national,"agent_depot_autre_wallet_national", $idConfig);
$this->insertPalier($plr_agent_cash_cash_national,"agent_cash_cash_national", $idConfig); $this->insertPalier($plr_agent_cash_cash_national,"agent_cash_cash_national", $idConfig);
$this->user_model->updateConfigWalletIlink_a_s_c($rows['taux_ag_s_c'],$rows['taux_sup_s_c'],$rows['taux_hyp_s_c'],$idConfig); $this->wallet_model->updateConfigWalletIlink_a_s_c($rows['taux_ag_s_c'],$rows['taux_sup_s_c'],$rows['taux_hyp_s_c'],$idConfig);
break; break;
} }
@ -1795,9 +1797,9 @@ class Gestion extends CI_Controller
private function insertPalier($palier , $name , $idConfig){ private function insertPalier($palier , $name , $idConfig){
$exist = $this->user_model->getPalierConfigWallet($name , $idConfig); $exist = $this->wallet_model->getPalierConfigWallet($name , $idConfig);
if($exist){ if($exist){
$this->user_model->deletePalierConfigWallet($name , $idConfig); $this->wallet_model->deletePalierConfigWallet($name , $idConfig);
} }
if($palier) { if($palier) {
@ -1807,7 +1809,7 @@ class Gestion extends CI_Controller
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
$row[] = $value; $row[] = $value;
} }
$this->user_model->addPalierConfigWallet($name, $idConfig, $row[0], $row[1], $row[2]); $this->wallet_model->addPalierConfigWallet($name, $idConfig, $row[0], $row[1], $row[2]);
} }
} }
} }
@ -1815,9 +1817,9 @@ class Gestion extends CI_Controller
private function insertTaxes($palier, $idConfig, $categorie) private function insertTaxes($palier, $idConfig, $categorie)
{ {
$exist = $this->user_model->getTaxes($idConfig, $categorie); $exist = $this->wallet_model->getTaxes($idConfig, $categorie);
if ($exist) { if ($exist) {
$this->user_model->deleteTaxes($idConfig, $categorie); $this->wallet_model->deleteTaxes($idConfig, $categorie);
} }
if ($palier) { if ($palier) {
@ -1828,9 +1830,9 @@ class Gestion extends CI_Controller
$row[] = $value; $row[] = $value;
} }
if ($categorie == 'wallet') if ($categorie == 'wallet')
$this->user_model->addTaxe($idConfig, $row[0], $row[1], $row[2], $row[3]); $this->wallet_model->addTaxe($idConfig, $row[0], $row[1], $row[2], $row[3]);
else else
$this->user_model->addTaxe($idConfig, $row[0], $row[1], $row[2], 'national', $categorie); $this->wallet_model->addTaxe($idConfig, $row[0], $row[1], $row[2], 'national', $categorie);
} }
} }
} }
@ -1840,7 +1842,7 @@ class Gestion extends CI_Controller
if($this->isLogged()){ if($this->isLogged()){
if (isset($_POST)) { if (isset($_POST)) {
$network_id = $_POST['network_id']; $network_id = $_POST['network_id'];
$res = $this->user_model->deleteConfigWallet($network_id); $res = $this->wallet_model->deleteConfigWallet($network_id);
if ($res != false) { if ($res != false) {
echo json_encode("200"); echo json_encode("200");
} else { } else {
@ -1874,16 +1876,16 @@ class Gestion extends CI_Controller
$pool = Pool::create(); $pool = Pool::create();
$pool->add(function () use ($network_id) { $pool->add(function () use ($network_id) {
// Fetch all agents , hyperviseur , superviseur // Fetch all agents , hyperviseur , superviseur
$f_agents = $this->user_model->getAllAgentsForNetwork($network_id) ; $f_agents = $this->wallet_model->getAllAgentsForNetwork($network_id) ;
if ($f_agents){ if ($f_agents){
foreach($f_agents->result() AS $row){ foreach($f_agents->result() AS $row){
//Create wallet if it not exist //Create wallet if it not exist
$res = $this->user_model->getWallet($row->agent_id); $res = $this->wallet_model->getWallet($row->agent_id);
if($res){ if($res){
// Reinitialize the wallet // Reinitialize the wallet
// $this->user_model->reinitializeWallet($res->first_row()->wallet_id); // $this->wallet_model->reinitializeWallet($res->first_row()->wallet_id);
}else{ }else{
$this->user_model->addWallet($row->agent_id); $this->wallet_model->addWallet($row->agent_id);
} }
} }
} }
@ -1906,13 +1908,13 @@ class Gestion extends CI_Controller
if ($type == 'transaction') if ($type == 'transaction')
$data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id); $data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
else if ($type == 'transaction_ilink') else if ($type == 'transaction_ilink')
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id); $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id);
else else
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id); $data['transactions'] = $this->wallet_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->wallet_model->getAllActivatedNetworks();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$networkDetails = $this->user_model->getNetworkDetails($network_id); $networkDetails = $this->user_model->getNetworkDetails($network_id);
if($networkDetails){ if($networkDetails){
@ -1950,13 +1952,13 @@ class Gestion extends CI_Controller
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr; $data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en; $data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
$data['currencies'] = $this->user_model->getWalletsCountriesCurrencies($data['currency_code']); $data['currencies'] = $this->wallet_model->getWalletsCountriesCurrencies($data['currency_code']);
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_monnaie'); $this->load->view('gestion_monnaie');
$this->load->view('footer'); $this->load->view('footer');
}else{ }else{
$data['networks'] = $this->user_model->getAllActivatedWalletNetworks(); $data['networks'] = $this->wallet_model->getAllActivatedWalletNetworks();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('gestion_monnaies'); $this->load->view('gestion_monnaies');
@ -1975,10 +1977,10 @@ class Gestion extends CI_Controller
$res= false; $res= false;
foreach ($json['rates'] as $key => $value) { foreach ($json['rates'] as $key => $value) {
if($this->user_model->getExchangeRate($key)) if($this->wallet_model->getExchangeRate($key))
$this->user_model->updateExchangeRate($key , $value); $this->wallet_model->updateExchangeRate($key , $value);
else else
$this->user_model->insertExchangeRate($key , $value); $this->wallet_model->insertExchangeRate($key , $value);
} }
$res = true; $res = true;
if ($res) { if ($res) {
@ -2080,7 +2082,7 @@ class Gestion extends CI_Controller
if ($this->input->get('history')) { if ($this->input->get('history')) {
$this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history')); $this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
} else { } else {
$data['groups'] = $this->user_model->getUsersGroups($data['network_id']); $data['groups'] = $this->nano_credit_model->getUsersGroups($data['network_id']);
$data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row(); $data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row();
$networkDetails = $this->user_model->getNetworkDetails($data['network_id']); $networkDetails = $this->user_model->getNetworkDetails($data['network_id']);
if ($networkDetails) { if ($networkDetails) {
@ -2089,17 +2091,17 @@ class Gestion extends CI_Controller
$data['currency_code'] = $networkDetails->first_row()->currency_code; $data['currency_code'] = $networkDetails->first_row()->currency_code;
} }
$data['rates_nano_credit'] = $this->user_model->getNanoCreditRates($data['configWallet']->id); $data['rates_nano_credit'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id);
$data['taxes_nano_credit'] = $this->user_model->getTaxes($data['configWallet']->id, 'nano_credit'); $data['taxes_nano_credit'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'nano_credit');
$data['rates_epargne'] = $this->user_model->getNanoCreditRates($data['configWallet']->id, 'epargne'); $data['rates_epargne'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id, 'epargne');
$data['taxes_epargne'] = $this->user_model->getTaxes($data['configWallet']->id, 'epargne'); $data['taxes_epargne'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'epargne');
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('nano_credit/gestion_nano_credit_admin'); $this->load->view('nano_credit/gestion_nano_credit_admin');
$this->load->view('footer'); $this->load->view('footer');
} }
} else { } else {
$data['networks'] = $this->user_model->getAllIlinkWorldNetworks(); $data['networks'] = $this->nano_credit_model->getAllIlinkWorldNetworks();
$this->load->view('header_gestion', $data); $this->load->view('header_gestion', $data);
$this->load->view('nano_credit/gestion_nano_credits'); $this->load->view('nano_credit/gestion_nano_credits');
$this->load->view('footer'); $this->load->view('footer');
@ -2118,13 +2120,13 @@ class Gestion extends CI_Controller
$endDate = Date('Y-m-d', strtotime($endDate . "+1 day")); $endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
if ($type == 'nano_credit') { if ($type == 'nano_credit') {
$data['transactions'] = $this->user_model->getUserDemandesCredit($startDate, $endDate, $network_id); $data['transactions'] = $this->nano_credit_model->getUserDemandesCredit($startDate, $endDate, $network_id);
} else if ($type == 'savings') { } else if ($type == 'savings') {
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id); $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id);
} }
$data['active'] = "nano_credit"; $data['active'] = "nano_credit";
$data['alert'] = ""; $data['alert'] = "";
$data['networks'] = $this->user_model->getAllActivatedNetworks(); $data['networks'] = $this->wallet_model->getAllActivatedNetworks();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$networkDetails = $this->user_model->getNetworkDetails($network_id); $networkDetails = $this->user_model->getNetworkDetails($network_id);
if ($networkDetails) { if ($networkDetails) {
@ -2148,7 +2150,7 @@ class Gestion extends CI_Controller
if (isset($_POST)) { if (isset($_POST)) {
$id_network = $_POST['id_network']; $id_network = $_POST['id_network'];
$this->user_model->insertCreditLimit(0, 0, '1', $id_network); $this->nano_credit_model->insertCreditLimit(0, 0, '1', $id_network);
$res = true; $res = true;
if ($res) { if ($res) {
@ -2166,7 +2168,7 @@ class Gestion extends CI_Controller
if (isset($_POST)) { if (isset($_POST)) {
$id_network = $_POST['id_network']; $id_network = $_POST['id_network'];
$this->user_model->insertCreditLimit(0, 0, '0', $id_network); $this->nano_credit_model->insertCreditLimit(0, 0, '0', $id_network);
$res = true; $res = true;
if ($res) { if ($res) {
@ -2178,5 +2180,62 @@ class Gestion extends CI_Controller
} }
} }
public function regulations()
{
if($this->isLogged()){
$data['active'] = "regulations";
$data['alert'] = "";
$data['game_pays'] = $this->user_model->getGameCountry();
if ($this->input->get('id')) {
$network_id = $this->input->get('id');
$networkDetails = $this->user_model->getNetworkDetails($network_id);
$data['network'] = $networkDetails->first_row()->network;
$data['country'] = $networkDetails->first_row()->country;
$data['currency_code'] = $networkDetails->first_row()->currency_code;
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
$data['currencies'] = $this->wallet_model->getWalletsCountriesCurrencies($data['currency_code']);
$this->load->view('header_gestion', $data);
$this->load->view('gestion_monnaie');
$this->load->view('footer');
}else{
$data['countries'] = $this->wallet_model->getRegulationsCountries();
$this->load->view('header_gestion', $data);
$this->load->view('gestion_reglementations');
$this->load->view('footer');
}
}
}
public function setRegulationsLimits(){
if ($this->isLogged()) {
if (isset($_POST)) {
$country_id = $_POST['country_id'];
$max_day = $_POST['max_day'];
$max_week = $_POST['max_week'];
$max_month = $_POST['max_month'];
$limits = $this->wallet_model->getRegulationsLimits($country_id);
if($limits){
$this->wallet_model->updateRegulationsLimits($country_id,$max_day,$max_week,$max_month);
}else{
$this->wallet_model->insertRegulationsLimits($country_id,$max_day,$max_week,$max_month);
}
$res = true;
if ($res) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
} }

View File

@ -1,14 +1,9 @@
<?php <?php
defined('BASEPATH') or exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
use Brick\Money\Context\CustomContext;
use Brick\Money\CurrencyConverter;
use Brick\Money\ExchangeRateProvider\PDOProvider;
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Math\RoundingMode;
use Brick\Money\Money;
use Brick\Money\Context\AutoContext; use Brick\Money\Context\AutoContext;
use Brick\Money\Money;
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: Hanry Nzale * User: Hanry Nzale
@ -22,7 +17,8 @@ class Hyperviseur_dash extends CI_Controller
parent::__construct(); parent::__construct();
$this->load->model('wallet_model'); $this->load->model('wallet_model');
$this->load->model('nano_credit_model'); $this->load->model('nano_credit_model');
date_default_timezone_set($this->session->userdata('timezone')); if($this->session->userdata('timezone'))
date_default_timezone_set($this->session->userdata('timezone'));
} }
public function index() public function index()
@ -54,7 +50,7 @@ class Hyperviseur_dash extends CI_Controller
$data['adresse'] = $this->session->userdata('adresse'); $data['adresse'] = $this->session->userdata('adresse');
$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['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['count_geo'] = $this->user_model->countUserGeoForHyp($this->session->userdata('member_code')); $data['count_geo'] = $this->user_model->countUserGeoForHyp($this->session->userdata('member_code'));
$data['count_sup'] = $this->user_model->countUser("super", 'all', $this->session->userdata('member_code')); $data['count_sup'] = $this->user_model->countUser("super", 'all', $this->session->userdata('member_code'));
@ -101,7 +97,7 @@ class Hyperviseur_dash extends CI_Controller
$data['adresse'] = $this->session->userdata('adresse'); $data['adresse'] = $this->session->userdata('adresse');
$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['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
$data['alert'] = ""; $data['alert'] = "";
@ -157,7 +153,7 @@ 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['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $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['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
$data['alert'] = ""; $data['alert'] = "";
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
@ -220,7 +216,7 @@ 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['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $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['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville')); $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville'));
$data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville')); $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville'));
$data['list'] = $this->user_model->getDemandesBySuper($debut, $fin, $this->session->userdata('member_code')); $data['list'] = $this->user_model->getDemandesBySuper($debut, $fin, $this->session->userdata('member_code'));
@ -285,7 +281,7 @@ class Hyperviseur_dash extends CI_Controller
$data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin, $this->session->userdata('member_code')); $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin, $this->session->userdata('member_code'));
$data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin, $this->session->userdata('member_code')); $data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin, $this->session->userdata('member_code'));
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $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['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
$data['type'] = $this->lang->line('Adhésion'); $data['type'] = $this->lang->line('Adhésion');
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
@ -344,7 +340,7 @@ class Hyperviseur_dash extends CI_Controller
$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->wallet_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) {
@ -361,7 +357,7 @@ class Hyperviseur_dash extends CI_Controller
} elseif ($data['hasWallet']->first_row()->type == 'ilink') { } elseif ($data['hasWallet']->first_row()->type == 'ilink') {
$transactions = $this->user_model->getNetworkIlinTransactions($id_network); $transactions = $this->wallet_model->getNetworkIlinTransactions($id_network);
$data["transactions"] = array(); $data["transactions"] = array();
$totalCommissionBanque = 0; $totalCommissionBanque = 0;
if ($transactions) { if ($transactions) {
@ -375,10 +371,10 @@ class Hyperviseur_dash extends CI_Controller
} }
//Create wallet if it not exist //Create wallet if it not exist
$res = $this->user_model->getWallet($agent_id); $res = $this->wallet_model->getWallet($agent_id);
if ($res == false) { if ($res == false) {
$this->user_model->addWallet($agent_id); $this->user_model->addWallet($agent_id);
$res = $this->user_model->getWallet($agent_id); $res = $this->wallet_model->getWallet($agent_id);
} }
$row = $res->first_row(); $row = $res->first_row();
@ -388,7 +384,7 @@ class Hyperviseur_dash extends CI_Controller
$data['curreny_code'] = $this->session->userdata('currency_code'); $data['curreny_code'] = $this->session->userdata('currency_code');
$res = $this->user_model->getWalletPassword($id_network); $res = $this->wallet_model->getWalletPassword($id_network);
$data['walletPassword'] = $res ? $res->first_row() : null; $data['walletPassword'] = $res ? $res->first_row() : null;
$data['alert'] = ""; $data['alert'] = "";
$data['active'] = "wallet_wallet"; $data['active'] = "wallet_wallet";
@ -445,15 +441,15 @@ class Hyperviseur_dash extends CI_Controller
$networkDetails = $this->user_model->getNetworkDetails($network_id); $networkDetails = $this->user_model->getNetworkDetails($network_id);
$data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr; $data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr;
$data['currency_name_en'] = $networkDetails->first_row()->currency_name_en; $data['currency_name_en'] = $networkDetails->first_row()->currency_name_en;
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id); $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id);
} else if ($type == 'commission_transfer') } else if ($type == 'commission_transfer')
$data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code')); $data['transactions'] = $this->wallet_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
else if ($type == 'balance_statement') else if ($type == 'balance_statement')
$data['wallets'] = $this->user_model->getInfosWalletAgentForHyper($this->session->userdata('network_id')); $data['wallets'] = $this->user_model->getInfosWalletAgentForHyper($this->session->userdata('network_id'));
else if ($type == 'refund_history') else if ($type == 'refund_history')
$data['refunds'] = $this->user_model->getRefunds($startDate, $endDate, $network_id); $data['refunds'] = $this->wallet_model->getRefunds($startDate, $endDate, $network_id);
else else
$data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id); $data['transactions'] = $this->wallet_model->getRecharges($startDate, $endDate, $network_id);
$data['active'] = "wallet_wallet"; $data['active'] = "wallet_wallet";
$data['alert'] = ""; $data['alert'] = "";
@ -463,7 +459,7 @@ class Hyperviseur_dash extends CI_Controller
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
@ -495,11 +491,11 @@ class Hyperviseur_dash extends CI_Controller
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['network_id'] = $this->session->userdata('network_id'); $data['network_id'] = $this->session->userdata('network_id');
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id')); $res = $this->wallet_model->getWalletPassword($this->session->userdata('network_id'));
$data['walletPassword'] = $res ? $res->first_row() : null; $data['walletPassword'] = $res ? $res->first_row() : null;
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('wallet_password'); $this->load->view('wallet_password');
@ -532,9 +528,9 @@ class Hyperviseur_dash extends CI_Controller
if ($this->email->send()) { if ($this->email->send()) {
if ($wallet_password_id == null) if ($wallet_password_id == null)
$this->user_model->addWalletPassword($network_id, $encrypted_password, $salt, $email); $this->wallet_model->addWalletPassword($network_id, $encrypted_password, $salt, $email);
else else
$this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt, $email); $this->wallet_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt, $email);
$res = true; $res = true;
} else { } else {
// show_error($this->email->print_debugger()); // show_error($this->email->print_debugger());
@ -595,7 +591,7 @@ class Hyperviseur_dash extends CI_Controller
$this->email->message($this->lang->line('mot de passe') . ' : ' . $password); $this->email->message($this->lang->line('mot de passe') . ' : ' . $password);
if ($this->email->send()) { if ($this->email->send()) {
$this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt); $this->wallet_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt);
$res = true; $res = true;
} else { } else {
// show_error($this->email->print_debugger()); // show_error($this->email->print_debugger());
@ -624,8 +620,8 @@ class Hyperviseur_dash extends CI_Controller
$hash = base64_encode(sha1($password . $salt, true) . $salt); $hash = base64_encode(sha1($password . $salt, true) . $salt);
if ($encrypted_password == $hash) { if ($encrypted_password == $hash) {
$this->user_model->updateWalletBalance($montant, $wallet_id); $this->wallet_model->updateWalletBalance($montant, $wallet_id);
$res = $this->user_model->addWalletRecharge($montant, $wallet_id); $res = $this->wallet_model->addWalletRecharge($montant, $wallet_id);
$code = $res ? '200' : '500'; $code = $res ? '200' : '500';
} else { } else {
$code = '400'; $code = '400';
@ -651,7 +647,7 @@ class Hyperviseur_dash extends CI_Controller
$hash = base64_encode(sha1($password . $salt, true) . $salt); $hash = base64_encode(sha1($password . $salt, true) . $salt);
if ($encrypted_password == $hash) { if ($encrypted_password == $hash) {
$res = $this->user_model->insertRembourssementCompensation($montant, $id_network, $id_config); $res = $this->wallet_model->insertRembourssementCompensation($montant, $id_network, $id_config);
$code = $res ? '200' : '401'; $code = $res ? '200' : '401';
} else { } else {
$code = '400'; $code = '400';
@ -674,12 +670,12 @@ class Hyperviseur_dash extends CI_Controller
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['idConfig'] = $data['hasWallet']->first_row()->id; $data['idConfig'] = $data['hasWallet']->first_row()->id;
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['network_id'] = $this->session->userdata('network_id'); $data['network_id'] = $this->session->userdata('network_id');
$data['countries'] = $this->user_model->getWalletsCountries(); $data['countries'] = $this->wallet_model->getWalletsCountries();
$showResult = false; $showResult = false;
$frais = 0; $frais = 0;
$taxe = 0; $taxe = 0;
@ -701,19 +697,19 @@ class Hyperviseur_dash extends CI_Controller
$code = $this->input->post('code'); $code = $this->input->post('code');
$taxes = $this->user_model->getTaxes($data['idConfig']); $taxes = $this->wallet_model->getTaxes($data['idConfig']);
$plr_user_wallet_wallet = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']); $plr_user_wallet_wallet = $this->wallet_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
$plr_user_wallet_cash = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']); $plr_user_wallet_cash = $this->wallet_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
$plr_agent_depot_wallet_ilink = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']); $plr_agent_depot_wallet_ilink = $this->wallet_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']);
$plr_agent_depot_autre_wallet = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']); $plr_agent_depot_autre_wallet = $this->wallet_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']);
$plr_agent_cash_cash = $this->user_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']); $plr_agent_cash_cash = $this->wallet_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']);
$plr_user_wallet_wallet_national= $this->user_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']); $plr_user_wallet_wallet_national= $this->wallet_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']);
$plr_user_wallet_cash_national = $this->user_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']); $plr_user_wallet_cash_national = $this->wallet_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']);
$plr_agent_depot_wallet_ilink_national = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']); $plr_agent_depot_wallet_ilink_national = $this->wallet_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']);
$plr_agent_depot_autre_wallet_national = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']); $plr_agent_depot_autre_wallet_national = $this->wallet_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
$plr_agent_cash_cash_national = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']); $plr_agent_cash_cash_national = $this->wallet_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
$plr_user_wallet_wallet = $plr_user_wallet_wallet ? $plr_user_wallet_wallet->result() : []; $plr_user_wallet_wallet = $plr_user_wallet_wallet ? $plr_user_wallet_wallet->result() : [];
$plr_user_wallet_cash = $plr_user_wallet_cash ? $plr_user_wallet_cash->result() : []; $plr_user_wallet_cash = $plr_user_wallet_cash ? $plr_user_wallet_cash->result() : [];
@ -1018,7 +1014,7 @@ class Hyperviseur_dash extends CI_Controller
$data['email'] = $this->session->userdata('email'); $data['email'] = $this->session->userdata('email');
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $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['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
@ -1026,13 +1022,13 @@ class Hyperviseur_dash extends CI_Controller
$data['network_id'] = $this->session->userdata('network_id'); $data['network_id'] = $this->session->userdata('network_id');
if (isset($country)) { if (isset($country)) {
$data['country_id'] = $country; $data['country_id'] = $country;
$data['country'] = $this->user_model->getCountry($country)->first_row(); $data['country'] = $this->wallet_model->getCountry($country)->first_row();
$res = $this->user_model->getActiveNetworksByCountry($country,$this->session->userdata('network_id')); $res = $this->wallet_model->getActiveNetworksByCountry($country,$this->session->userdata('network_id'));
$data['networks'] = []; $data['networks'] = [];
if($res){ if($res){
$result = $res->result(); $result = $res->result();
foreach ($result as $network){ foreach ($result as $network){
$res = $this->user_model->getSharingRate($network->id , $data['idConfig']); $res = $this->wallet_model->getSharingRate($network->id , $data['idConfig']);
if($res){ if($res){
$network->rate = $res->first_row()->taux_partage; $network->rate = $res->first_row()->taux_partage;
$network->url = $res->first_row()->url; $network->url = $res->first_row()->url;
@ -1048,12 +1044,12 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('footer'); $this->load->view('footer');
return; return;
} }
$res = $this->user_model->getWalletsCountries(); $res = $this->wallet_model->getWalletsCountries();
$data['countries'] = []; $data['countries'] = [];
if($res){ if($res){
$result = $res->result(); $result = $res->result();
foreach ($result as $country){ foreach ($result as $country){
$res = $this->user_model->countPayingNetworks($country->id, $data['idConfig']); $res = $this->wallet_model->countPayingNetworks($country->id, $data['idConfig']);
if($res){ if($res){
$country->total = $res->first_row()->total; $country->total = $res->first_row()->total;
}else{ }else{
@ -1069,8 +1065,8 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('gestion_wallet_ilink_config_paying_networks'); $this->load->view('gestion_wallet_ilink_config_paying_networks');
break; break;
case 'user_wallet_wallet': case 'user_wallet_wallet':
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']); $data['plr_user_wallet_wallet'] = $this->wallet_model->getPalierConfigWallet("user_wallet_wallet_international", $data['idConfig']);
$data['plr_user_wallet_wallet_national'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']); $data['plr_user_wallet_wallet_national'] = $this->wallet_model->getPalierConfigWallet("user_wallet_wallet_national", $data['idConfig']);
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('config_wallet_ilink_hyp/user_wallet_wallet'); $this->load->view('config_wallet_ilink_hyp/user_wallet_wallet');
break; break;
@ -1082,8 +1078,8 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('config_wallet_ilink_hyp/user_wallet_carte'); $this->load->view('config_wallet_ilink_hyp/user_wallet_carte');
break; break;
case 'user_wallet_cash': case 'user_wallet_cash':
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']); $data['plr_user_wallet_cash'] = $this->wallet_model->getPalierConfigWallet("user_wallet_cash_international", $data['idConfig']);
$data['plr_user_wallet_cash_national'] = $this->user_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']); $data['plr_user_wallet_cash_national'] = $this->wallet_model->getPalierConfigWallet("user_wallet_cash_national", $data['idConfig']);
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('config_wallet_ilink_hyp/user_wallet_cash'); $this->load->view('config_wallet_ilink_hyp/user_wallet_cash');
break; break;
@ -1125,13 +1121,13 @@ class Hyperviseur_dash extends CI_Controller
$data['taux_sup_s_c'] = $taux->taux_com_sup_envoi_cash; $data['taux_sup_s_c'] = $taux->taux_com_sup_envoi_cash;
$data['taux_hyp_s_c'] = $taux->taux_com_hyp_envoi_cash; $data['taux_hyp_s_c'] = $taux->taux_com_hyp_envoi_cash;
$data['plr_agent_depot_wallet_ilink'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']); $data['plr_agent_depot_wallet_ilink'] = $this->wallet_model->getPalierConfigWallet("agent_depot_wallet_ilink_international" , $data['idConfig']);
$data['plr_agent_depot_autre_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']); $data['plr_agent_depot_autre_wallet'] = $this->wallet_model->getPalierConfigWallet("agent_depot_autre_wallet_international" , $data['idConfig']);
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']); $data['plr_agent_cash_cash'] = $this->wallet_model->getPalierConfigWallet("agent_cash_cash_international", $data['idConfig']);
$data['plr_agent_depot_wallet_ilink_national'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']); $data['plr_agent_depot_wallet_ilink_national'] = $this->wallet_model->getPalierConfigWallet("agent_depot_wallet_ilink_national" , $data['idConfig']);
$data['plr_agent_depot_autre_wallet_national'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']); $data['plr_agent_depot_autre_wallet_national'] = $this->wallet_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
$data['plr_agent_cash_cash_national'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']); $data['plr_agent_cash_cash_national'] = $this->wallet_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('config_wallet_ilink_hyp/agent_send_cash_canal'); $this->load->view('config_wallet_ilink_hyp/agent_send_cash_canal');
break; break;
@ -1154,14 +1150,14 @@ class Hyperviseur_dash extends CI_Controller
$data['email'] = $this->session->userdata('email'); $data['email'] = $this->session->userdata('email');
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $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['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
$data['idConfig'] = $data['hasWallet']->first_row()->id; $data['idConfig'] = $data['hasWallet']->first_row()->id;
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id')); $res = $this->wallet_model->getWalletPassword($this->session->userdata('network_id'));
$data['walletPassword'] = $res ? $res->first_row() : null; $data['walletPassword'] = $res ? $res->first_row() : null;
$data['networks'] = $this->user_model->getPayingNetworksByConfigWallet($data['idConfig']); $data['networks'] = $this->wallet_model->getPayingNetworksByConfigWallet($data['idConfig']);
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('gestion_wallet_ilink_paying_network_account'); $this->load->view('gestion_wallet_ilink_paying_network_account');
@ -1175,7 +1171,7 @@ class Hyperviseur_dash extends CI_Controller
$config_id = $_POST['config_id']; $config_id = $_POST['config_id'];
$rate = $_POST['rate']; $rate = $_POST['rate'];
$url = $_POST['url']; $url = $_POST['url'];
$res = $this->user_model->setSharingRate($network_id, $config_id, $rate, $url); $res = $this->wallet_model->setSharingRate($network_id, $config_id, $rate, $url);
if ($res) { if ($res) {
echo json_encode("200"); echo json_encode("200");
@ -1195,11 +1191,13 @@ class Hyperviseur_dash extends CI_Controller
$this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history')); $this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
} elseif ($this->input->get('config')) { } elseif ($this->input->get('config')) {
$this->config_nano_credit($this->input->get('config')); $this->config_nano_credit($this->input->get('config'));
} elseif ($this->input->get('group')) {
$this->users_group_details($this->input->get('group'));
} else { } else {
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id')); $data['groups'] = $this->nano_credit_model->getUsersGroups($this->session->userdata('network_id'));
$data['idConfig'] = $data['hasWallet']->first_row()->id; $data['idConfig'] = $data['hasWallet']->first_row()->id;
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']); $data['rates'] = $this->nano_credit_model->getNanoCreditRates($data['idConfig']);
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig'], 'nano_credit'); $data['taxes'] = $this->wallet_model->getTaxes($data['idConfig'], 'nano_credit');
$data['active'] = "nano_credit"; $data['active'] = "nano_credit";
$data['alert'] = ""; $data['alert'] = "";
@ -1261,7 +1259,7 @@ class Hyperviseur_dash extends CI_Controller
private function historique_nano_credit($network_id, $startDate, $endDate, $type) private function historique_nano_credit($network_id, $startDate, $endDate, $type)
{ {
$data['configWallet'] = $this->wallet_model->getConfigWallet($network_id); // $data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
$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;
@ -1282,8 +1280,8 @@ class Hyperviseur_dash extends CI_Controller
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); //
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $data['configWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
@ -1375,6 +1373,43 @@ class Hyperviseur_dash extends CI_Controller
} }
} }
} }
private function users_group_details($group_code)
{
$data['active'] = "nano_credit";
$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['currency_code'] = $this->session->userdata('currency_code');
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category');
$data['members'] = $this->nano_credit_model->getGroupMembers($group_code);
$data['group'] = $this->nano_credit_model->getGroup($group_code);
//Calcul de la capacite d'emprunt
$CE = 0;
if($data['members']){
$sommeCredits = 0;
$sommeEpargnes = 0;
foreach ($data['members']->result() as $user){
$sommeCredits += $user->balance_credit;
$sommeEpargnes += $user->balance_epargne;
}
$CE = $sommeEpargnes - $sommeCredits;
}
$data['CE'] = $CE;
$data['group_code'] = $group_code;
$this->load->view('header_hyp', $data);
$this->load->view('nano_credit/users_group_detail');
$this->load->view('footer');
}
} }
class Operation class Operation

View File

@ -3,18 +3,20 @@
use Brick\Money\Context\AutoContext; use Brick\Money\Context\AutoContext;
use Brick\Money\Money; use Brick\Money\Money;
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
class Superviseur_dash extends CI_Controller class Superviseur_dash extends CI_Controller
{ {
public function __construct(){ public function __construct()
{
parent::__construct(); parent::__construct();
$this->load->model('wallet_model'); $this->load->model('wallet_model');
$this->load->model('nano_credit_model'); $this->load->model('nano_credit_model');
$this->load->model('Users_simple'); $this->load->model('Users_simple');
$this->load->model('User_model'); $this->load->model('User_model');
date_default_timezone_set ($this->session->userdata('timezone')); if($this->session->userdata('timezone'))
date_default_timezone_set($this->session->userdata('timezone'));
} }
public function index() public function index()
@ -30,8 +32,8 @@ class Superviseur_dash extends CI_Controller
$count_g = $this->User_model->geolocatedCountByParrain($this->session->userdata('member_code')); $count_g = $this->User_model->geolocatedCountByParrain($this->session->userdata('member_code'));
$count_d = $this->User_model->getCountDemande($this->session->userdata('member_code')); $count_d = $this->User_model->getCountDemande($this->session->userdata('member_code'));
$count_d_traite = $this->User_model->getCountDemandeByStatut($this->session->userdata('member_code'),1); $count_d_traite = $this->User_model->getCountDemandeByStatut($this->session->userdata('member_code'), 1);
$count_d_no_traite = $this->User_model->getCountDemandeByStatut($this->session->userdata('member_code'),0); $count_d_no_traite = $this->User_model->getCountDemandeByStatut($this->session->userdata('member_code'), 0);
$data['list_geolocated_users'] = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code')); $data['list_geolocated_users'] = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code'));
@ -62,7 +64,8 @@ class Superviseur_dash extends CI_Controller
/** /**
* Affiche la table des points agents du superviseur * Affiche la table des points agents du superviseur
*/ */
public function getAllUser_g(){ public function getAllUser_g()
{
if (!$this->session->userdata('email')) { if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first'); $this->session->set_flashdata('error', 'log in first');
@ -72,17 +75,16 @@ class Superviseur_dash extends CI_Controller
redirect('index.php', $data); redirect('index.php', $data);
} } else {
else {
$position = $this->user_model->getAllpositions($this->session->userdata('network'),'geolocated',$this->session->userdata('member_code')); $position = $this->user_model->getAllpositions($this->session->userdata('network'), 'geolocated', $this->session->userdata('member_code'));
$data['active'] = "geolocated"; $data['active'] = "geolocated";
$data['positions']= $position; $data['positions'] = $position;
$numberGeo = $this->user_model->getNumberGeoBySuper($this->session->userdata('member_code')); $numberGeo = $this->user_model->getNumberGeoBySuper($this->session->userdata('member_code'));
if($numberGeo!=false){ if ($numberGeo != false) {
$data['numberGeo'] = $numberGeo; $data['numberGeo'] = $numberGeo;
}else{ } else {
$data['numberGeo'] = ""; $data['numberGeo'] = "";
} }
$data['map_title'] = $this->lang->line('Utilisateurs géolocalisés'); $data['map_title'] = $this->lang->line('Utilisateurs géolocalisés');
@ -111,7 +113,8 @@ class Superviseur_dash extends CI_Controller
/** /**
* Affiche les demandes de credits * Affiche les demandes de credits
*/ */
public function getDemandes(){ public function getDemandes()
{
if (!$this->session->userdata('email')) { if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first'); $this->session->set_flashdata('error', 'log in first');
@ -169,7 +172,8 @@ class Superviseur_dash extends CI_Controller
/** /**
* Afficher les demandes d'adhesion * Afficher les demandes d'adhesion
*/ */
public function getDemandesAd(){ public function getDemandesAd()
{
if (!$this->session->userdata('email')) { if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first'); $this->session->set_flashdata('error', 'log in first');
@ -180,9 +184,9 @@ class Superviseur_dash extends CI_Controller
$network = $this->session->userdata('network'); $network = $this->session->userdata('network');
$debut = $this->input->get("d"); $debut = $this->input->get("d");
$fin = $this->input->get("f"); $fin = $this->input->get("f");
$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['debut'] = $debut ? date($format, strtotime($debut)) : null ; $data['debut'] = $debut ? date($format, strtotime($debut)) : null;
$data['fin'] = $fin ?date($format, strtotime($fin)): null ; $data['fin'] = $fin ? date($format, strtotime($fin)) : null;
$data['active'] = "demandesAd"; $data['active'] = "demandesAd";
$data['alert'] = ""; $data['alert'] = "";
$data['demand_type'] = 'adhesion'; $data['demand_type'] = 'adhesion';
@ -195,11 +199,11 @@ class Superviseur_dash extends CI_Controller
$data['adresse'] = $this->session->userdata('adresse'); $data['adresse'] = $this->session->userdata('adresse');
$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['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($debut, $fin ,$this->session->userdata('member_code')); $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($debut, $fin, $this->session->userdata('member_code'));
$data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($debut, $fin ,$this->session->userdata('member_code')); $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($debut, $fin, $this->session->userdata('member_code'));
$data['mydem'] = $this->user_model->getDemandesHyperForSuper($this->session->userdata('member_code')); $data['mydem'] = $this->user_model->getDemandesHyperForSuper($this->session->userdata('member_code'));
$data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin ,$this->session->userdata('member_code')); $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin, $this->session->userdata('member_code'));
$data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin ,$this->session->userdata('member_code')); $data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin, $this->session->userdata('member_code'));
$data['type'] = $this->lang->line('Adhésion'); $data['type'] = $this->lang->line('Adhésion');
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code')); $data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
@ -210,7 +214,8 @@ class Superviseur_dash extends CI_Controller
} }
// Wallet // Wallet
public function wallet(){ public function wallet()
{
if (!$this->session->userdata('email')) { if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first'); $this->session->set_flashdata('error', 'log in first');
@ -231,42 +236,42 @@ class Superviseur_dash extends CI_Controller
} else { } else {
$context = new AutoContext(); $context = new AutoContext();
//Create wallet if it not exist //Create wallet if it not exist
$res = $this->user_model->getWallet($agent_id ); $res = $this->wallet_model->getWallet($agent_id);
if($res == false){ if ($res == false) {
if($data['hasWallet']){ if ($data['hasWallet']) {
$this->user_model->addWallet($agent_id ); $this->user_model->addWallet($agent_id);
} }
} }
$res = $this->user_model->getWallet($agent_id); $res = $this->wallet_model->getWallet($agent_id);
if ($res!=null){ if ($res != null) {
$row = $res->first_row(); $row = $res->first_row();
$data["commission"] = Money::of(round($row->balance_com,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR'); $data["commission"] = Money::of(round($row->balance_com, 2), $this->session->userdata('currency_code'), $context)->formatTo('fr_FR');
$data["principal"] = Money::of(round($row->balance_princ,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR'); $data["principal"] = Money::of(round($row->balance_princ, 2), $this->session->userdata('currency_code'), $context)->formatTo('fr_FR');
$agents_g = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code')); $agents_g = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code'));
$data['agents_g'] = $agents_g; $data['agents_g'] = $agents_g;
//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();
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->wallet_model->getWallet($row->agent_id);
if($wallet){ if ($wallet) {
if ($data['hasWallet']->first_row()->type == 'visa') { if ($data['hasWallet']->first_row()->type == 'visa') {
$transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id); $transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id);
} elseif ($data['hasWallet']->first_row()->type == 'ilink') { } elseif ($data['hasWallet']->first_row()->type == 'ilink') {
$transactions = $this->user_model->getAgentiLinkTransactions($wallet->first_row()->wallet_id); $transactions = $this->user_model->getAgentiLinkTransactions($wallet->first_row()->wallet_id);
} }
if($transactions){ if ($transactions) {
foreach($transactions->result() AS $trans){ foreach ($transactions->result() as $trans) {
$trans->agent_id = $row->agent_id ; // Add agent id to transaction $trans->agent_id = $row->agent_id; // Add agent id to transaction
array_push( $data['transactions'], $trans); array_push($data['transactions'], $trans);
} }
} }
} }
} }
} }
}else{ } else {
$data["commission"] = "N/A"; $data["commission"] = "N/A";
$data["principal"] = "N/A"; $data["principal"] = "N/A";
$data["totalCommissionBanque"] = "N/A"; $data["totalCommissionBanque"] = "N/A";
@ -287,12 +292,12 @@ class Superviseur_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['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$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);
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code')); // $data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
$this->load->view('header_sup',$data); $this->load->view('header_sup', $data);
if ($data['hasWallet']->first_row()->type == 'visa') if ($data['hasWallet']->first_row()->type == 'visa')
$this->load->view('gestion_wallet_sup'); $this->load->view('gestion_wallet_sup');
elseif ($data['hasWallet']->first_row()->type == 'ilink') elseif ($data['hasWallet']->first_row()->type == 'ilink')
@ -313,9 +318,9 @@ class Superviseur_dash extends CI_Controller
if ($type == 'transaction') if ($type == 'transaction')
$data['transactions'] = $this->user_model->getTransactionsSup($startDate, $endDate, $codeMembre); $data['transactions'] = $this->user_model->getTransactionsSup($startDate, $endDate, $codeMembre);
else if ($type == 'transaction_ilink') else if ($type == 'transaction_ilink')
$data['transactions'] = $this->user_model->getIlinkTransactionsSup($startDate, $endDate, $codeMembre); $data['transactions'] = $this->wallet_model->getIlinkTransactionsSup($startDate, $endDate, $codeMembre);
else if ($type == 'commission_transfer') else if ($type == 'commission_transfer')
$data['transactions'] = $this->user_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code')); $data['transactions'] = $this->wallet_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code'));
else if ($type == 'balance_statement') else if ($type == 'balance_statement')
$data['wallets'] = $this->user_model->getInfosWalletAgentForSuper($codeMembre); $data['wallets'] = $this->user_model->getInfosWalletAgentForSuper($codeMembre);
@ -344,4 +349,54 @@ class Superviseur_dash extends CI_Controller
$this->load->view('config_wallet_ilink_hyp/etat_soldes'); $this->load->view('config_wallet_ilink_hyp/etat_soldes');
$this->load->view('footer'); $this->load->view('footer');
} }
public function nano_credit()
{
if ($this->isLogged()) {
$data['network_id'] = $network_id = $this->session->userdata('network_id');
$startDate = $this->input->get('d');
$endDate = $this->input->get('f');
$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"));
$data['currency_code'] = $this->session->userdata('currency_code');
$data['transactions'] = $this->nano_credit_model->getUserDemandesCreditForSuper($startDate, $endDate, $this->session->userdata('member_code'));
$data['active'] = "nano_credit";
$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->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category');
// $data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
$this->load->view('header_sup', $data);
$this->load->view('nano_credit/historique_nano_credit');
$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;
}
} }

View File

@ -485,4 +485,21 @@ $lang['savings_history'] = 'Savings history';
$lang['export_savings_demands_history'] = "Export savings requests"; $lang['export_savings_demands_history'] = "Export savings requests";
$lang['modify_sharing_rates'] = 'Modify sharing rates'; $lang['modify_sharing_rates'] = 'Modify sharing rates';
$lang['nano_credit_configuration'] = 'Nano Credit configuration'; $lang['nano_credit_configuration'] = 'Nano Credit configuration';
$lang['cassation_date'] = 'Cassation date';
$lang['borrowing_capacity'] = "Borrowing capacity";
$lang['group_members'] = "Members of the group";
$lang['principal_account'] = "Main account";
$lang['credit_account'] = "Credit account";
$lang['savings_account'] = "Savings account";
$lang['subscription_date'] = "Membership date";
$lang['number_of_users'] = "Number of users";
$lang['regulations'] = "Regulations";
$lang['management_regulatory'] = "Regulatory management";
$lang['max_amount_per_day'] = "Maximum amount per day";
$lang['max_amount_per_week'] = "Maximum amount per week";
$lang['max_amount_per_month'] = "Maximum amount per month";
$lang['define_the_limits'] = "Define the limits";
$lang['regulations_updated'] = 'Regulatory limits updated';
$lang['refunded_amount'] = "Amount refunded";
$lang['remains_to_be_reimbursed'] = "Remainder to reimburse"
?> ?>

View File

@ -497,5 +497,21 @@ $lang['savings_history'] = 'Historique des épargnes';
$lang['export_savings_demands_history'] = "Exporter les demandes d'épargne"; $lang['export_savings_demands_history'] = "Exporter les demandes d'épargne";
$lang['modify_sharing_rates'] = 'Modifier les taux de partage'; $lang['modify_sharing_rates'] = 'Modifier les taux de partage';
$lang['nano_credit_configuration'] = 'Configuration du Nano Crédit'; $lang['nano_credit_configuration'] = 'Configuration du Nano Crédit';
$lang['cassation_date'] = 'Date de cassation' $lang['cassation_date'] = 'Date de cassation';
$lang['borrowing_capacity'] = "Capacité d'emprunt";
$lang['group_members'] = "Membres du groupe";
$lang['principal_account'] = "Compte principal";
$lang['credit_account'] = "Compte crédit";
$lang['savings_account'] = "Compte épargne";
$lang['subscription_date'] = "Date d'adhésion";
$lang['number_of_users'] = "Nombre d'utilisateurs";
$lang['regulations'] = "Réglementations";
$lang['management_regulatory'] = "Gestion réglementaire";
$lang['max_amount_per_day'] = "Montant maximum par jour";
$lang['max_amount_per_week'] = "Montant maximum par semaine";
$lang['max_amount_per_month'] = "Montant maximum par mois";
$lang['define_the_limits'] = "Definir les limites";
$lang['regulations_updated'] = 'Limites réglementaires mis à jour';
$lang['refunded_amount'] = "Montant remboursé";
$lang['remains_to_be_reimbursed'] = "Reste à rembourser"
?> ?>

View File

@ -84,6 +84,19 @@ class Nano_Credit_model extends CI_Model
} }
} }
public function getUserDemandesCreditForSuper($debut, $fin, $codeParrain)
{
$chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
$query = $this->db->query("SELECT *
FROM infos_users_demandes_credits
WHERE `codeParrain`='" . $codeParrain . "'" . $chain);
if ($query->num_rows() > 0) {
return $query;
} else {
return false;
}
}
public function getUsersSavings($debut, $fin, $id_network) public function getUsersSavings($debut, $fin, $id_network)
{ {
$chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : ""; $chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
@ -96,4 +109,28 @@ class Nano_Credit_model extends CI_Model
return false; return false;
} }
} }
public function getGroupMembers($group_code){
$query = $this->db->query("SELECT
CASE
WHEN u.id = ug.id_createur THEN 'creator'
WHEN u.id = id_sponsor1 or u.id = id_sponsor2 or u.id = id_sponsor3 THEN 'sponsor'
ELSE 'member'
END as role,
u.* , wu.balance , ug.* FROM users u inner JOIN users_groups ug on u.group_id = ug.id INNER JOIN wallets_users wu ON wu.idUser = u.id where ug.code_groupe = '" . $group_code . "'");
if ($query->num_rows() > 0) {
return $query;
} else {
return false;
}
}
public function getGroup($group_code){
$query = $this->db->query("SELECT * FROM infos_users_groups WHERE code_groupe = '" . $group_code . "'");
if ($query->num_rows() > 0) {
return $query->first_row();
} else {
return false;
}
}
} }

View File

@ -825,4 +825,37 @@ class Wallet_model extends CI_Model
return false; return false;
} }
} }
// Gestion reglementaire
public function getRegulationsCountries(){
$query = $this->db->query("SELECT distinct cc.id , cc.name as country , cc.currency_code, r.id_country, r.montant_max_jour, r.montant_max_hebdo, r.montant_max_mensuel FROM networks n
INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWallet cw ON cw.id_network = n.id LEFT JOIN regulations r ON r.id_country = cc.id;");
if ($query->num_rows() > 0) {
return $query;
} else {
return false;
}
}
public function getRegulationsLimits($id_country){
$query = $this->db->query("SELECT * FROM regulations WHERE id_country ='" . $id_country . "'");
if ($query->num_rows() > 0) {
return $query->first_row();
} else {
return false;
}
}
public function insertRegulationsLimits($id_country, $max_day , $max_week , $max_month){
$sql = "INSERT INTO `regulations` (`id_country`, `montant_max_jour`, `montant_max_hebdo`, `montant_max_mensuel`) VALUES (?,?, ?, ?);";
$query = $this->db->query($sql , array($id_country,$max_day,$max_week,$max_month));
return $query;
}
public function updateRegulationsLimits($id_country, $max_day , $max_week , $max_month){
$sql = "UPDATE `regulations` SET `montant_max_jour` = ? , `montant_max_hebdo` = ? , `montant_max_mensuel` = ? WHERE (`id_country` = ?);";
$query = $this->db->query($sql , array($max_day,$max_week,$max_month,$id_country));
return $query;
}
} }

View File

@ -0,0 +1,240 @@
<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') ?>">
<?php
use Brick\Money\Money;
$context = new \Brick\Money\Context\AutoContext();
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo $this->lang->line('management_regulatory'); ?>
</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_countries'); ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
$sql2 = $countries;
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('Pays'); ?></th>
<th align='center'><?php echo $this->lang->line('max_amount_per_day'); ?></th>
<th align='center'><?php echo $this->lang->line('max_amount_per_week'); ?></th>
<th align='center'><?php echo $this->lang->line('max_amount_per_month'); ?></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->country</td>";
?>
<?php
?>
<td> <?php if($row->id_country) echo Money::of(round($row->montant_max_jour, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_hebdo, 2), $row->currency_code, $context)->formatTo('fr_FR') ?></td>
<td><?php if($row->id_country) echo Money::of(round($row->montant_max_mensuel, 2), $row->currency_code, $context)->formatTo('fr_FR'); ?></td>
<?php
?>
<td>
<button type="button" data-country-id="<?php echo $row->id ?>"
data-num ="<?=$num?>" class="btn btn-primary btn-block openModal"
data-toggle="modal" data-target="<?='#configureLimits'.$num?>" >
<b><?= $this->lang->line('define_the_limits'); ?></b>
</button>
</td>
<div class="modal fade" id="<?='configureLimits'.$num?>" 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('define_the_limits'); ?></h3>
</div>
<div class="modal-body">
<form id="<?='limitsForm'.$num?>">
<div class="form-group">
<label for="rate"
class="col-form-label"><?= $this->lang->line('max_amount_per_day') ?></label>
<input type="number" min="0" step=".01" required class="form-control"
name="max_day" id="<?='max_day'.$num?>" value="<?=$row->montant_max_jour?>">
</div>
<div class="form-group">
<label for="url"
class="col-form-label"><?= $this->lang->line('max_amount_per_week') ?></label>
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_hebdo?>"
id="<?='max_week'.$num?>" name="max_week">
</div>
<div class="form-group">
<label for="url"
class="col-form-label"><?= $this->lang->line('max_amount_per_month') ?></label>
<input type="number" min="0" step=".01" required class="form-control" value="<?=$row->montant_max_mensuel?>"
id="<?='max_month'.$num?>" name="max_month">
</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 setLimits">
<?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
<?php
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('Aucun pays');
}
}else {
echo $this->lang->line('Aucun pays');
}
?>
</div>
</div>
</div>
</div>
<!-- <div class="alert alert-info alert-dismissible" aria-hidden="true">-->
<!-- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>-->
<!-- <h4><i class="icon fa fa-info"></i>Info!</h4>-->
<!-- Data is Saved-->
<!-- </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 country_id = null;
var num = null;
$(document).on("click", ".openModal", function () {
country_id = $(this).data('country-id');
num = $(this).data('num');
})
$(document).on("click", ".setLimits", function () {
if ($('#limitsForm'+num)[0].checkValidity()) {
const max_day = parseFloat($('#max_day'+num).val());
const max_week = parseFloat($('#max_week'+num).val());
const max_month = parseFloat($('#max_month'+num).val());
$.ajax({
url: '<?php echo base_url('index.php/Gestion/setRegulationsLimits')?>',
type: 'POST',
dataType: 'json',
data: {"country_id": country_id, "max_day": max_day, "max_week": max_week,"max_month" : max_month},
success: function (data) {
if (data == '200') {
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('regulations_updated')?>",
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);
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
}
});
} else {
$('#limitsForm'+num)[0].reportValidity();
}
});
</script>

View File

@ -227,7 +227,7 @@
} else { } else {
$('#rateForm'+num)[0].reportValidity(); $('#rateForm'+num)[0].reportValidity();
} }
;
}); });
</script> </script>

View File

@ -170,6 +170,14 @@
<i class="ion ion-cash"></i> <span><?php echo $this->lang->line('currency'); ?></span> <i class="ion ion-cash"></i> <span><?php echo $this->lang->line('currency'); ?></span>
</a> </a>
</li> </li>
<li class="<?php if ($active == "regulations") {
echo "active";
} ?>">
<a href="<?php echo base_url('index.php/Gestion/regulations') ?>">
<i class="fa fa-bank"></i> <span><?php echo $this->lang->line('regulations'); ?></span>
</a>
</li>
</ul> </ul>
</section> </section>
<!-- /.sidebar --> <!-- /.sidebar -->

View File

@ -159,6 +159,16 @@
<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>
<?php if ($hasWallet->first_row()->type == 'ilink') { ?>
<li class="<?php if ($active == "nano_credit") {
echo "active";
} ?>">
<a href="<?php echo base_url('index.php/Superviseur_dash/nano_credit') ?>">
<i class="fa fa-money"></i> <span>Nano credit</span>
</a>
</li>
<?php }?>
<?php } ?> <?php } ?>
</ul> </ul>
</section> </section>

View File

@ -8,15 +8,14 @@
<?php <?php
use Brick\Money\Context\AutoContext; use Brick\Money\Context\AutoContext;
use Carbon\Carbon;
use Brick\Money\CurrencyConverter; use Brick\Money\CurrencyConverter;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Money\ExchangeRateProvider\PDOProvider; use Brick\Money\ExchangeRateProvider\PDOProvider;
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration; use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Math\RoundingMode;
use Brick\Money\Money; use Brick\Money\Money;
use Carbon\Carbon;
function toLocateDate($date , $timezone){ function toLocateDate($date , $timezone){
if($date){ if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC'); $carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone); $carbon->setTimezone($timezone);
@ -155,7 +154,7 @@ use Brick\Money\Money;
<th><?php echo $this->lang->line('recipient_id')?></th> <th><?php echo $this->lang->line('recipient_id')?></th>
<th align='center'>Date</th> <th align='center'>Date</th>
<?php if ($this->session->userdata('category') != 'super') { ?> <?php if ($this->session->userdata('category') != 'super') { ?>
<th align='center'>Action</th> <!-- <th align='center'>Action</th>-->
<?php } ?> <?php } ?>
</tr> </tr>
</thead> </thead>
@ -203,12 +202,12 @@ use Brick\Money\Money;
<td>".toLocateDate($row->date,$this->session->userdata('timezone'))."</td>"; <td>".toLocateDate($row->date,$this->session->userdata('timezone'))."</td>";
?> ?>
<?php if ($this->session->userdata('category') != 'super') { ?> <?php if ($this->session->userdata('category') != 'super') { ?>
<td> <!-- <td>-->
<button data-id-transaction="<?= $row->id_transaction ?>" id="cancel" <!-- <button data-id-transaction="--><?php //echo $row->id_transaction ?><!--" id="cancel"-->
class="btn btn-danger btn-block" <?php if ($row->canceled) echo "disabled" ?> > <!-- class="btn btn-danger btn-block" --><?php //if ($row->canceled) echo "disabled" ?><!-- >-->
<b><?php echo $this->lang->line('cancel') ?></b> <!-- <b>--><?php //echo $this->lang->line('cancel') ?><!--</b>-->
</button> <!-- </button>-->
</td> <!-- </td>-->
<?php } ?> <?php } ?>
</tr> </tr>

View File

@ -128,11 +128,10 @@ $context = new \Brick\Money\Context\AutoContext();
<th>" . $this->lang->line('Nom') . "</th> <th>" . $this->lang->line('Nom') . "</th>
<th>" . $this->lang->line('creator') . "</th> <th>" . $this->lang->line('creator') . "</th>
<th>" . $this->lang->line('credit_limit') . "</th> <th>" . $this->lang->line('credit_limit') . "</th>
<th> Sponsor 1</th>
<th> Sponsor 2</th>
<th> Sponsor 3</th>
<th> Status</th> <th> Status</th>
<th>" . $this->lang->line('created_date') . "</th>"; <th>" . $this->lang->line('number_of_users') . "</th>
<th>" . $this->lang->line('created_date') . "</th>
<th> Action </th>";
?> ?>
</tr> </tr>
</thead> </thead>
@ -145,9 +144,7 @@ $context = new \Brick\Money\Context\AutoContext();
<td>" . $row->nom . "</td> <td>" . $row->nom . "</td>
<td>" . $row->createur . "</td> <td>" . $row->createur . "</td>
<td>" . Money::of(round($row->limite_credit, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td> <td>" . Money::of(round($row->limite_credit, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . $row->sponsor1 . "</td> ";
<td>" . $row->sponsor2 . "</td>
<td>" . $row->sponsor3 . "</td>";
?> ?>
<?php <?php
if ($row->actif) { if ($row->actif) {
@ -164,7 +161,14 @@ $context = new \Brick\Money\Context\AutoContext();
<?php <?php
} }
?> ?>
<td> <?= $row->nombre_utilisateurs?> </td>
<td> <?= $row->date_creation ?> </td> <td> <?= $row->date_creation ?> </td>
<td>
<a href="<?php echo current_url().('?group='.$row->code_groupe)?>" class="btn btn-primary btn-block" <?php if(!$row->id_network) echo "disabled"?> >
<b><?php echo $this->lang->line('Voir plus...'); ?></b>
</a>
</td>
</tr> </tr>
<?php <?php
} }
@ -262,9 +266,9 @@ $context = new \Brick\Money\Context\AutoContext();
moment.updateLocale(moment.locale(format), {invalidDate: ""}); moment.updateLocale(moment.locale(format), {invalidDate: ""});
$('#example1').DataTable({ $('#example1').DataTable({
"aaSorting": [[8, "desc"]], "aaSorting": [[6, "desc"]],
"columnDefs": [{ "columnDefs": [{
targets: 8, targets: 6,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format) render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}] }]
}); });

View File

@ -8,13 +8,12 @@
<?php <?php
use Brick\Money\Context\AutoContext; use Brick\Money\Context\AutoContext;
use Carbon\Carbon;
use Brick\Money\CurrencyConverter; use Brick\Money\CurrencyConverter;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Money\ExchangeRateProvider\PDOProvider; use Brick\Money\ExchangeRateProvider\PDOProvider;
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration; use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
use Brick\Math\RoundingMode;
use Brick\Money\Money; use Brick\Money\Money;
use Carbon\Carbon;
function toLocateDate($date, $timezone) function toLocateDate($date, $timezone)
{ {
@ -130,7 +129,8 @@
<th align='center'><?php echo $this->lang->line('state') ?></th> <th align='center'><?php echo $this->lang->line('state') ?></th>
<th align='center'><?php echo $this->lang->line('caution_type') ?></th> <th align='center'><?php echo $this->lang->line('caution_type') ?></th>
<th align='center'><?php echo $this->lang->line('duration') ?></th> <th align='center'><?php echo $this->lang->line('duration') ?></th>
<th><?php echo $this->lang->line('Montant') ?></th> <th><?php echo $this->lang->line('refunded_amount') ?></th>
<th><?php echo $this->lang->line('remains_to_be_reimbursed') ?></th>
<th><?php echo $this->lang->line('interest') ?></th> <th><?php echo $this->lang->line('interest') ?></th>
<th><?php echo $this->lang->line('tax') ?></th> <th><?php echo $this->lang->line('tax') ?></th>
<th><?php echo $this->lang->line('agent_name') ?></th> <th><?php echo $this->lang->line('agent_name') ?></th>
@ -162,6 +162,7 @@
<td>" . strtoupper($row->etat) . "</td> <td>" . strtoupper($row->etat) . "</td>
<td>" . strtoupper($row->type_caution) . "</td> <td>" . strtoupper($row->type_caution) . "</td>
<td>" . strtoupper($row->duree_mois) . "</td> <td>" . strtoupper($row->duree_mois) . "</td>
<td>" . Money::of(round($row->montant_rembourse, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . $moneyNet->formatTo('fr_FR') . "</td> <td>" . $moneyNet->formatTo('fr_FR') . "</td>
<td>" . Money::of(round($row->interet, 2), $currency_code, $context)->formatTo('fr_FR') . "</td> <td>" . Money::of(round($row->interet, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "</td> <td>" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
@ -235,9 +236,9 @@
const format = lang === 'french' ? 'fr' : 'en'; const format = lang === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
var table = $('#transactions').DataTable({ var table = $('#transactions').DataTable({
"aaSorting": [[12, "desc"]], "aaSorting": [[13, "desc"]],
"columnDefs": [{ "columnDefs": [{
targets: [10, 11, 12], targets: [11, 12, 13],
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format) render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}], }],
dom: 'Bfrtip', dom: 'Bfrtip',
@ -299,8 +300,13 @@
}, 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) if (category){
window.location = "<?php echo current_url()?>" + "?history=nano_credit" + "&d=" + debut + "&f=" + fin; if(category == 'super')
window.location = "<?php echo current_url()?>" + "?d=" + debut + "&f=" + fin;
else
window.location = "<?php echo current_url()?>" + "?history=nano_credit" + "&d=" + debut + "&f=" + fin;
}
else else
window.location = "<?php echo current_url()?>" + "?id=118&history=nano_credit" + "&d=" + debut + "&f=" + fin; window.location = "<?php echo current_url()?>" + "?id=118&history=nano_credit" + "&d=" + debut + "&f=" + fin;
@ -309,8 +315,12 @@
$('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) if (category){
window.location = "<?php echo current_url()?>" + "?history=nano_credit"; if(category == 'super')
window.location = "<?php echo current_url()?>";
else
window.location = "<?php echo current_url()?>" + "?history=nano_credit";
}
else else
window.location = "<?php echo current_url()?>" + "?id=118&history=nano_credit"; window.location = "<?php echo current_url()?>" + "?id=118&history=nano_credit";
}); });

View File

@ -0,0 +1,304 @@
<!-- DataTables -->
<link rel="stylesheet"
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<?php
use Brick\Money\Money;
$context = new \Brick\Money\Context\AutoContext();
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Nano crédit <?php echo $network . ' - ' . $country; ?>
</h1>
<?php
$site_url = base_url();
if ($alert == "ok") {
if (!$success == "ok") {
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-green-active">
<div class="inner">
<h3><?php echo Money::of(round($CE, 2), $currency_code, $context)->formatTo('fr_FR') ?></h3>
<p><?php echo $this->lang->line('borrowing_capacity') ?></p>
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-red">
<div class="inner">
<h3><?php echo Money::of(round($group->limite_credit, 2), $currency_code, $context)->formatTo('fr_FR') ?></h3>
<p><?php echo $this->lang->line('credit_limit') ?></p>
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-xs-6">
<div class="small-box bg-blue-active">
<div class="inner">
<h3><?php echo $group->nombre_utilisateurs ?></h3>
<p><?php echo $this->lang->line('number_of_users') ?></p>
</div>
<div class="icon">
<i class="fa fa-group"></i>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green">
<div class="inner">
<h4><strong><?=$group->createur ?></strong></h4>
<p><?php echo $this->lang->line('creator') ?></p>
</div>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-blue">
<div class="inner">
<h4><strong><?=$group->sponsor1 ?></strong></h4>
<p>Sponsor 1</p>
</div>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-blue">
<div class="inner">
<h4><strong><?=$group->sponsor2 ?></strong></h4>
<p>Sponsor 2</p>
</div>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-blue">
<div class="inner">
<h4><strong><?=$group->sponsor3 ?></strong></h4>
<p>Sponsor 3</p>
</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('group_members') . ' - ' . $group->nom?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<?php
echo "<th>" . 'Role' . "</th>
<th>" . $this->lang->line('Nom') . "</th>
<th>" . $this->lang->line('Téléphone') . "</th>
<th>" . $this->lang->line('Adresse') . "</th>
<th>" . $this->lang->line('principal_account') . "</th>
<th>" . $this->lang->line('credit_account') . "</th>
<th>" . $this->lang->line('savings_account') . "</th>
<th>" . $this->lang->line('subscription_date') . "</th>";
?>
</tr>
</thead>
<tbody>
<?php
if ($members != false) {
foreach ($members->result() as $row) { ?>
<tr>
<?php
if ($row->role == 'creator') {
?>
<td>
<span class="label label-success"><?php echo $this->lang->line('creator') ?></span>
</td>
<?php
} else if ($row->role == 'sponsor') {
?>
<td>
<span class="label label-primary">Sponsor</span>
</td>
<?php
} else {
?>
<td>
<span class="label label-info"><?php echo $this->lang->line('Membre') ?></span>
</td>
<?php
}
?>
<?php
echo "
<td>" . $row->lastname . ' ' . $row->firstname . "</td>
<td>" . $row->phone . "</td>
<td>" . $row->adresse . "</td>
<td>" . Money::of(round($row->balance, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . Money::of(round($row->balance_credit, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . Money::of(round($row->balance_epargne, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
<td>" . $row->date_adhesion . "</td>
</tr>";
?>
<?php
}
?>
<?php
}
?>
</tbody>
</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 src="<?php echo base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<!-- ChartJS -->
<script src="<?php echo base_url('bower_components/chart.js/Chart.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
<script>
$(function () {
const lang = "<?php echo $this->session->userdata('site_lang') ?>";
const format = lang === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""});
var table = $('#example1').DataTable({
"aaSorting": [[7, "desc"]],
"columnDefs": [{
targets: [7],
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}],
dom: 'Bfrtip',
"buttons": [
'pageLength',
{
extend: 'excelHtml5',
title: "<?php echo $this->lang->line('group_members') . ' - ' . $group->nom?>",
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([4, 5, 6].includes(j)) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data.body[i][j].replace(',', ".")
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
}
}
}
},
trim: false
},
{
extend: 'csvHtml5',
title: "<?php echo $this->lang->line('group_members') . ' - ' . $group->nom?>",
trim: false
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
title: "<?php echo $this->lang->line('group_members') . ' - ' . $group->nom?>",
trim: false
},
// 'colvis'
]
});
})
</script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
</script>
<!-- Page script -->
<!--<script src="--><?php //echo base_url('dist/js/custom.js') ?><!--"></script>-->