diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 2fb8ec89..ce69da76 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -313,7 +313,9 @@ class Hyperviseur_dash extends CI_Controller if ($this->input->get('history')) { $this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history')); - } else { + } elseif ($this->input->get('config')) { + $this->config_wallet($this->input->get('config'), $this->input->get('country')); + }else { $data["commission"] = ""; $data["principal"] = ""; @@ -966,6 +968,84 @@ class Hyperviseur_dash extends CI_Controller shuffle($temp_array); return implode('', $temp_array); } + + private function config_wallet($config , $country) + { +// $data['configWallet'] = $this->user_model->getConfigWallet($network_id); + $data['active'] = "wallet"; + $data['alert'] = ""; + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['email'] = $this->session->userdata('email'); + $data['network'] = $this->session->userdata('network'); + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); + $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $data['country'] = $this->session->userdata('current_pays'); + $data['category'] = $this->session->userdata('category'); + $data['idConfig'] = $data['hasWallet']->first_row()->id; + if (isset($country)) { + $data['country_id'] = $country; + $data['country'] = $this->user_model->getCountry($country)->first_row(); + $res = $this->user_model->getActiveNetworks($country); + $data['networks'] = []; + if($res){ + $result = $res->result(); + foreach ($result as $network){ + $res = $this->user_model->getSharingRate($network->id , $data['idConfig']); + if($res){ + $network->rate = $res->first_row()->taux_partage; + }else{ + $network->rate = null; + } + $data['networks'][] = $network; + } + } + $this->load->view('header_hyp', $data); + $this->load->view('gestion_wallet_ilink_config_paying_network'); + $this->load->view('footer'); + return; + } + $res = $this->user_model->getActiveCountries(); + $data['countries'] = []; + if($res){ + $result = $res->result(); + foreach ($result as $country){ + $res = $this->user_model->countPayingNetworks($country->id, $data['idConfig']); + if($res){ + $country->total = $res->first_row()->total; + }else{ + $country->total = null; + } + $data['countries'][] = $country; + } + } + $this->load->view('header_hyp', $data); +// if ($type == 'transaction') +// $this->load->view('historique_transactions'); +// else + $this->load->view('gestion_wallet_ilink_config_paying_networks'); + $this->load->view('footer'); + } + + public function config_sharing_rate(){ + if ($this->isLogged()) { + if (isset($_POST)) { + $network_id = $_POST['network_id']; + $config_id = $_POST['config_id']; + $rate = $_POST['rate']; + + $res = $this->user_model->setSharingRate($network_id,$config_id,$rate); + + if ($res) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } + + } + } + } } class Operation diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 0fa6d0b7..61b5ba7c 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -388,4 +388,12 @@ $lang['ilink_second_rule'] = 'The sum of the commission distributions on the wit $lang['ilink_third_rule'] = 'The sum of the distribution of commission on cash deposit to card operation must be equal to 100%'; $lang['ilink_fourth_rule'] = 'The sum of the distribution of commission on withdrawal operation in the card must be equal to 100%'; $lang['ilink_fifth_rule'] = 'The sum of the distribution of commission on withdrawal operation in the card for iLink user must be equal to 100%'; +$lang['edit_paying_networks'] = 'Configuration of paying networks'; +$lang['configure'] = 'Configure'; +$lang['configure_share_rate'] = 'Configure the sharing rate'; +$lang['share_rate'] = 'Sharing rate'; +$lang ['sharing_updated'] = 'Sharing rate updated'; +$lang ['not_defined'] = 'Not defined'; +$lang ['no_network'] = 'No network'; +$lang ['activated_countries'] = 'Countries activated'; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index d7f84544..67c520fa 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -400,4 +400,12 @@ $lang['ilink_second_rule'] = 'La somme des répartitions de commission sur opér $lang['ilink_third_rule'] = 'La somme des répartitions de commission sur opération de depot cash vers carte doit etre égale à 100 %'; $lang['ilink_fourth_rule'] = 'La somme des répartitions de commission sur opération de retrait dans la carte doit etre égale à 100 %'; $lang['ilink_fifth_rule'] = 'La somme des répartitions de commission sur opération de retrait dans la carte pour utilisateur iLink doit etre égale à 100 %'; +$lang['edit_paying_networks'] = 'Configuration des réseaux payeurs'; +$lang['configure'] = 'Configurer'; +$lang['configure_share_rate'] = 'Configurer le taux de partage'; +$lang['share_rate'] = 'Taux de partage'; +$lang['sharing_updated'] = 'Taux de partage mis à jour'; +$lang['not_defined'] ='Non défini'; +$lang['no_network'] = 'Aucun réseau'; +$lang['activated_countries'] = 'Pays activés'; ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 8439be05..8fe7b7f9 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -1440,6 +1440,15 @@ class User_model extends CI_Model } } + public function getActiveNetworks($country_id){ + $query = $this->db->query("SELECT id,name FROM networks WHERE country_id ='".$country_id."' AND status = 1"); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + public function get_current_page_records($limit, $start,$pays,$hyper,$ville) { $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname, @@ -2364,6 +2373,28 @@ class User_model extends CI_Model } } + public function getActiveCountries(){ + $sql= "SELECT id , name FROM countries WHERE id IN ( + SELECT distinct n.country_id FROM networks n WHERE n.status = 1 + );"; + $query = $this->db->query($sql); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function getCountry($id){ + $sql= "SELECT name FROM countries WHERE id = $id"; + $query = $this->db->query($sql); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + public function cancelCreditRequest($id_demand){ $sql = "SELECT * FROM `info_demandeCredits` WHERE `demande_id` = ?;"; $query = $this->db->query($sql , array($id_demand)); @@ -2410,4 +2441,39 @@ class User_model extends CI_Model return false; } } + + public function setSharingRate($network_id,$config_id,$rate){ + $sql = "SELECT * FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;"; + $query = $this->db->query($sql , array($network_id,$config_id)); + if($query->num_rows()>0){ + $sql = "UPDATE `paying_networks` SET `taux_partage` = ? WHERE `id_network` = ? AND id_configWallet = ? ;"; + $this->db->query($sql , array($rate,$network_id,$config_id)); + }else{ + $sql = "INSERT INTO `paying_networks` (`id_network`, `taux_partage`, `id_configWallet`) VALUES ( ?, ? ,?); ;"; + $this->db->query($sql , array($network_id,$rate,$config_id)); + } + return true; + } + + public function getSharingRate($id_network ,$idConfig){ + $sql = "SELECT taux_partage FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;"; + $query = $this->db->query($sql , array($id_network,$idConfig)); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function countPayingNetworks($id_country ,$idConfig){ + $sql = "SELECT count(id) as total FROM `paying_networks` WHERE `id_network` IN (SELECT distinct n.id FROM countries c INNER JOIN + networks n ON n.country_id = c.id WHERE n.status = 1 AND c.id = ? + ) AND id_configWallet = ? ;"; + $query = $this->db->query($sql , array($id_country, $idConfig)); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } } diff --git a/application/views/gestion_wallet_ilink_config_paying_network.php b/application/views/gestion_wallet_ilink_config_paying_network.php new file mode 100755 index 00000000..c9bae56c --- /dev/null +++ b/application/views/gestion_wallet_ilink_config_paying_network.php @@ -0,0 +1,217 @@ + + + +
+ +
+ +

+ lang->line('edit_paying_networks') . ' - ' . $country->name; ?> +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + +
+ +
+
+
+
+
+

lang->line('Réseaux activés'); ?>

+
+
+ + 0) { + ?> + + + + + + + + + + + + + "; + ?> + rate != null ) { + ?> + + + + + + + +
lang->line('Nom'); ?> lang->line('share_rate')?> Action
$num$row->name + rate . ' %'?> + + lang->line('not_defined'); ?> + + +
+ + lang->line('Aucun réseau'); + } + } else { + echo $this->lang->line('Aucun réseau'); + } + ?> +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/gestion_wallet_ilink_config_paying_networks.php b/application/views/gestion_wallet_ilink_config_paying_networks.php new file mode 100755 index 00000000..e2b411ed --- /dev/null +++ b/application/views/gestion_wallet_ilink_config_paying_networks.php @@ -0,0 +1,264 @@ + + + +
+ +
+ +

+ lang->line('edit_paying_networks'); ?> +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

+ +
+ + +
+ +
+
+
+
+
+

lang->line('activated_countries'); ?>

+
+
+ + 0) { + ?> + + + + + + + + + + + + + "; + ?> + total > 0){ + ?> + + + + + + + +
lang->line('Nom'); ?> Status Action
$num$row->nametotal.' réseaux' ?>lang->line('no_network'); ?> + + lang->line('Voir plus...'); ?> + +
+ + lang->line('Aucun réseau'); + } + }else { + echo $this->lang->line('Aucun réseau'); + } + ?> +
+
+
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/gestion_wallet_ilink_hyp.php b/application/views/gestion_wallet_ilink_hyp.php index 7d0dab7e..641fc9b7 100755 --- a/application/views/gestion_wallet_ilink_hyp.php +++ b/application/views/gestion_wallet_ilink_hyp.php @@ -295,18 +295,24 @@
-
+
-
+
+
diff --git a/application/views/gestion_wallets.php b/application/views/gestion_wallets.php index c2c8f107..99a568c7 100755 --- a/application/views/gestion_wallets.php +++ b/application/views/gestion_wallets.php @@ -7,7 +7,6 @@

lang->line('Gestion des wallets'); ?> -