diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php
index f1503c87..cb4c3585 100755
--- a/application/controllers/Gestion.php
+++ b/application/controllers/Gestion.php
@@ -1616,11 +1616,11 @@ class Gestion extends CI_Controller
}elseif ($taux->type == 'autre') {
$res = $this->wallet_model->getSharingRateByNetwork($network_id);
$data['commission'] = $res ? $res->first_row()->balance_com : 0 ;
+ }elseif($taux->type == 'ilink_sante'){
+
}
-
-
$hyper = $this->wallet_model->getNetworkHyper($network_id)->first_row();
$data['walletHyper'] = $this->wallet_model->getWallet($hyper->agent_id);
$data['network_id'] = $network_id;
@@ -1640,6 +1640,8 @@ class Gestion extends CI_Controller
$this->load->view('gestion_wallet');
elseif ($taux->type == 'ilink')
$this->load->view('gestion_wallet_ilink');
+// elseif ($taux->type == 'ilink_sante')
+// $this->load->view('nano_health/admin/gestion_wallet_ilink_sante');
elseif ($taux->type == 'autre')
$this->load->view('gestion_wallet_autre');
$this->load->view('footer');
@@ -1664,18 +1666,21 @@ class Gestion extends CI_Controller
{
if($this->isLogged()){
if (isset($_POST)) {
-
+ $country_id = $_POST['country_id'];
$network_id = $_POST['network_id'];
$type = $_POST['type'];
$res = false;
- if($method == 'create')
- {
- $res = $this->wallet_model->addConfigWallet($network_id , $type);
-// if($res)
-// $this->generateAllWallets($network_id);
+ if($method == 'create') {
+ if($type == 'ilink'){
+ $exist = $this->wallet_model->verifyConfigWalletInCountry($type,$country_id);
+ if($exist){
+ echo json_encode("403");
+ return;
+ }
+ }
+ $res = $this->wallet_model->addConfigWallet($network_id , $type);
- }
- else if($method == 'update'){
+ } else if($method == 'update'){
if($type == 'visa'){
$taux_client_r = $_POST['taux_client_r'];
@@ -1852,6 +1857,22 @@ class Gestion extends CI_Controller
}
+ public function disable_config_wallet()
+ {
+ if($this->isLogged()){
+ if (isset($_POST)) {
+ $network_id = $_POST['network_id'];
+ $res = $this->wallet_model->disableConfigWallet($network_id);
+ if ($res != false) {
+ echo json_encode("200");
+ } else {
+ echo json_encode("500");
+ }
+ }
+ }
+
+ }
+
private function isLogged()
{
@@ -2235,7 +2256,7 @@ class Gestion extends CI_Controller
} elseif ($this->input->get('group')) {
$this->users_group_details($data['network_id'],$this->input->get('group'));
} else {
- $data['groups'] = $this->nano_credit_model->getUsersGroups($data['network_id']);
+ $data['insurances'] = $this->nano_health_model->getAllInsurances($data['network_id']);
$data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row();
$networkDetails = $this->user_model->getNetworkDetails($data['network_id']);
if ($networkDetails) {
@@ -2250,7 +2271,7 @@ class Gestion extends CI_Controller
$data['rates_epargne'] = $this->nano_credit_model->getNanoCreditRates($data['configWallet']->id, 'epargne');
$data['taxes_epargne'] = $this->wallet_model->getTaxes($data['configWallet']->id, 'epargne');
$this->load->view('header_gestion', $data);
- $this->load->view('nano_credit/gestion_nano_credit_admin');
+ $this->load->view('nano_health/config_nano_health');
$this->load->view('footer');
}
} else {
diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php
index cd34795a..48fdcf05 100755
--- a/application/language/english/message_lang.php
+++ b/application/language/english/message_lang.php
@@ -629,4 +629,10 @@ $lang['analysis_by_supervisor'] ="Analysis by supervisor";
$lang['press_here_to_see_selection'] = "Press here to see the selection";
$lang['show_selection'] = "Show selection";
$lang['cancel_selection'] = "Cancel selection";
+$lang['network_already_exist_in_country'] = 'This type of network already exists in this country';
+$lang['nano_health_management'] = 'Nano health management';
+$lang['edit_nano_health'] = 'nano health configuration';
+$lang['insurances_list'] = 'Insurance list';
+$lang['add_insurance'] = 'Add an insurance';
+$lang['wallet_disabled'] = "Wallet disabled"
?>
diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php
index 3853d05b..ff2e47f8 100755
--- a/application/language/french/message_lang.php
+++ b/application/language/french/message_lang.php
@@ -641,4 +641,10 @@ $lang['analysis_by_supervisor'] ="Analyse par superviseur";
$lang['press_here_to_see_selection'] = "Appuyer ici pour voir la sélection";
$lang['show_selection'] = "Afficher la selection";
$lang['cancel_selection'] = "Annuler la selection";
+$lang['network_already_exist_in_country'] = "Ce type de réseau existe deja dans ce pays";
+$lang['nano_health_management'] = 'Gestion du nano santé';
+$lang['edit_nano_health'] = 'Configuration du nano santé';
+$lang['insurances_list'] = 'Liste des assurances';
+$lang['add_insurance'] = "Ajouter une assurance";
+$lang['wallet_disabled'] = "Wallet désactivé"
?>
diff --git a/application/models/Nano_health_model.php b/application/models/Nano_health_model.php
index 53cd223f..e62ac5cc 100644
--- a/application/models/Nano_health_model.php
+++ b/application/models/Nano_health_model.php
@@ -10,6 +10,18 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Nano_health_model extends CI_Model
{
+
+ public function createConfig($id_network){
+ $this->db->query("INSERT INTO nh_networks_configs (network_id) VALUES ($id_network)");
+ return $this->db->insert_id();
+ }
+
+ public function getAllInsurances($id_network)
+ {
+ $query = $this->db->query("SELECT * FROM nh_insurances WHERE network_id = $id_network");
+ return $query->num_rows() > 0 ? $query : false ;
+ }
+
// Nano sante
public function getAllIlinkWorldNetworks()
{
@@ -22,6 +34,4 @@ class Nano_health_model extends CI_Model
return false;
}
}
-
-
}
diff --git a/application/models/Wallet_model.php b/application/models/Wallet_model.php
index 6731ba02..43d7670a 100644
--- a/application/models/Wallet_model.php
+++ b/application/models/Wallet_model.php
@@ -11,7 +11,12 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Wallet_model extends CI_Model
{
- //wallet
+ public function __construct()
+ {
+ $this->load->model('nano_health_model');
+ }
+
+ //wallet
public function getActiveNetwork(){
$query = $this->db->query("SELECT networks.id,networks.name,countries.name AS country
FROM networks
@@ -243,8 +248,9 @@ class Wallet_model extends CI_Model
// Wallet
public function getAllActivatedNetworks(){
- $query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id , configWallet.id_network , configWallet.type FROM `networks`
- INNER JOIN countries ON networks.country_id=countries.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1");
+ $query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id ,
+ configWallet.id_network , configWallet.type , configWallet.enabled FROM `networks`
+ INNER JOIN countries ON networks.country_id=countries.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1");
if($query->num_rows()>0){
return $query;
}else{
@@ -262,10 +268,29 @@ class Wallet_model extends CI_Model
}
}
+ public function verifyConfigWalletInCountry($type, $country_id){
+ $sql='SELECT * FROM `configWallet` cw JOIN networks n ON cw.id_network = n.id
+ WHERE cw.type = ? AND n.country_id = ?;' ;
+ $query = $this->db->query($sql , array($type,$country_id));
+ return $query->num_rows()>0 ;
+ }
+
public function addConfigWallet($network_id , $type){
- $sql='INSERT INTO `configWallet` (`id_network`, `type`) VALUES (?,?);' ;
- $query = $this->db->query($sql , array($network_id, $type));
- return $query;
+ $sql='SELECT * FROM `configWallet` WHERE id_network = ?' ;
+ $existQuery = $this->db->query($sql , array($network_id));
+ if($existQuery->num_rows() > 0){
+ $query = $this->db->query("UPDATE `configWallet` SET enabled = 1 AND type = $type WHERE id_network = '".$network_id."'");
+ return $query;
+ }else{
+ $sql='INSERT INTO `configWallet` (`id_network`, `type`) VALUES (?,?);' ;
+ $query = $this->db->query($sql , array($network_id, $type));
+ if($query && $type == 'ilink_sante'){
+ // Creer la config du nano santé
+ $configID = $this->nano_health_model->createConfig($network_id);
+ $query = $this->db->query("UPDATE `configWallet` SET nh_network_config_id = $configID WHERE id_network = '".$network_id."'");
+ }
+ return $query;
+ }
}
public function 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 ){
@@ -274,6 +299,11 @@ class Wallet_model extends CI_Model
return $query;
}
+ public function disableConfigWallet($network_id){
+ $query = $this->db->query("UPDATE `configWallet` SET enabled = 0 WHERE `configWallet`.`id_network` = '".$network_id."'");
+ return $query;
+ }
+
public function deleteConfigWallet($network_id){
$query = $this->db->query("DELETE FROM `configWallet` WHERE `configWallet`.`id_network` = '".$network_id."'");
return $query;
diff --git a/application/views/gestion_wallets.php b/application/views/gestion_wallets.php
index 7361ebdd..629fcd56 100755
--- a/application/views/gestion_wallets.php
+++ b/application/views/gestion_wallets.php
@@ -1,12 +1,12 @@
-
+
-
+
Success!
-
+ = $message; ?>
@@ -57,10 +57,10 @@
N° |
- lang->line('Reseau'); ?> |
- lang->line('Pays'); ?> |
+ = $this->lang->line('Reseau'); ?> |
+ = $this->lang->line('Pays'); ?> |
Wallet |
- lang->line('Activer/Désactiver'); ?> |
+ = $this->lang->line('Activer/Désactiver'); ?> |
Action |
@@ -75,21 +75,23 @@
$row->country | ";
?>
id_network){
+ if($row->enabled){
?>
-
= strtoupper($row->type) ?> |
-
|
+
= strtoupper(str_replace('_',' ',$row->type)) ?> |
+
|
-
lang->line('Inactif'); ?> |
-
|
+
= $this->lang->line('Inactif'); ?> |
+
|
- id_network) echo "disabled"?> >
- lang->line('Voir plus...'); ?>
+ enabled) echo "disabled"?> >
+ = $this->lang->line('Voir plus...'); ?>
|
Etes vous certain de vouloir ?
@@ -133,20 +135,21 @@
+
@@ -160,23 +163,23 @@
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/nano_health/config_nano_health.php b/application/views/nano_health/config_nano_health.php
new file mode 100755
index 00000000..76765119
--- /dev/null
+++ b/application/views/nano_health/config_nano_health.php
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
= Money::of(round($configWallet->limite_credit_min, 2), $currency_code, $context)->formatTo('fr_FR') ?>
+
= $this->lang->line('minimum_credit_limit') ?>
+
+
+
+
+
+
+
+
+
+
+
= Money::of(round($configWallet->limite_credit_max, 2), $currency_code, $context)->formatTo('fr_FR'); ?>
+
= $this->lang->line('maximum_credit_limit') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = $this->lang->line('interest_rates_period'); ?> |
+ = $this->lang->line('rate') . ' (%)'; ?> |
+
+
+
+ result() as $row) {
+ echo "
+ " . $row->duree_mois . " |
+ " . $row->taux . " | " . '
+
';
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ = $this->lang->line('Nom'); ?> |
+ Type |
+ Valeur |
+
+
+
+ result() as $row) {
+ echo "
+ " . $row->nom . " |
+ " . $row->type . " |
+ " . $row->valeur . " | " . '
+
';
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = $this->lang->line('interest_rates_period'); ?> |
+ = $this->lang->line('rate') . ' (%)'; ?> |
+
+
+
+ result() as $row) {
+ echo "
+ " . $row->duree_mois . " |
+ " . $row->taux . " | " . '
+
';
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ = $this->lang->line('Nom'); ?> |
+ Type |
+ Valeur |
+
+
+
+ result() as $row) {
+ echo "
+ " . $row->nom . " |
+ " . $row->type . " |
+ " . $row->valeur . " | " . '
+
';
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ " . $this->lang->line('Nom') . " |
+ " . $this->lang->line('supervisor') . " |
+ Status |
+ " . $this->lang->line('created_date') . " |
+ Action | ";
+ ?>
+
+
+
+ result() as $i => $row) {
+ echo "
+ " . $i . " |
+ " . $row->name . " |
+ " . $row->supervisor_id . " | ";
+ ?>
+
+ = $this->lang->line( $row->enabled ? 'Actif' : 'Inactif') ?>
+ |
+ = $row->created_at ?> |
+
+ id_network) echo "disabled"?> >
+ = $this->lang->line('Voir plus...'); ?>
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/nano_health/gestion_nano_health.php b/application/views/nano_health/gestion_nano_health.php
index cd75f23e..a45114aa 100755
--- a/application/views/nano_health/gestion_nano_health.php
+++ b/application/views/nano_health/gestion_nano_health.php
@@ -1,14 +1,14 @@
+ href="= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
-
+
Success!
-
+ = $message; ?>