+ Fix some bug

This commit is contained in:
Djery-Tom 2021-01-25 10:51:05 +01:00
parent 6c37804153
commit 0df17bafc2
3 changed files with 16 additions and 98 deletions

View File

@ -625,19 +625,11 @@ class Gestion extends CI_Controller
} }
$data['alert'] = "ok"; $data['alert'] = "ok";
$data['success'] = "ok"; $data['success'] = "ok";
$data['active'] = "members";
$data['message'] = "$number codes have been added!"; $data['message'] = "$number codes have been added!";
$ville = $this->session->userdata('current_ville');
$hyper = $this->session->userdata('current_hyper');
$pays = $this->session->userdata('current_pays');
$data['pays'] = $this->user_model->getAllCountries(); $data['pays'] = $this->user_model->getAllCountries();
$data['hyper'] = $this->user_model->getAllHyper($data['pays']->first_row()->id);
$data['ville'] = $this->user_model->getVilleNetworkByHyper($data['hyper']->first_row()->code_membre);
$data['list'] = $this->user_model->getGeneratedHyperCodes(); $data['list'] = $this->user_model->getGeneratedHyperCodes();
$data['active'] = "codes"; $data['active'] = "codes-hyper";
$data['pays'] = $this->user_model->getAllCountries(); $data['pays'] = $this->user_model->getAllCountries();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
@ -701,11 +693,6 @@ class Gestion extends CI_Controller
$this->load->view('login', $data); $this->load->view('login', $data);
} else { } else {
$ville = $this->session->userdata('current_ville');
$hyper = $this->session->userdata('current_hyper');
$pays = $this->session->userdata('current_pays');
$data['pays'] = $this->user_model->getAllCountries(); $data['pays'] = $this->user_model->getAllCountries();
$data['game_pays'] = $this->user_model->getGameCountry(); $data['game_pays'] = $this->user_model->getGameCountry();
$data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id);
@ -713,18 +700,20 @@ class Gestion extends CI_Controller
$data['active_ville_id'] = $data['villes']->first_row()->id; $data['active_ville_id'] = $data['villes']->first_row()->id;
$data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id); $data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id);
$data['networks'] = $this->user_model->getNetworks($data['pays']->first_row()->id); $data['networks'] = $this->user_model->getNetworks($data['pays']->first_row()->id);
$data['current_agent'] = $data['agent'] ? $data['agent']->first_row()->lastname : null;
$data['alert'] = ""; $data['alert'] = "";
$data['active'] = "geoloc"; $data['active'] = "geoloc";
$number_geolocalisation = array(); $number_geolocalisation = array();
$network_geolocalisation = array(); $network_geolocalisation = array();
$count = 0; $count = 0;
foreach ($data['networks']->result() AS $row) { if($data['networks']) {
$number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $data['agent']->first_row()->lastname); foreach ($data['networks']->result() as $row) {
$number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $data['current_agent']);
$network_geolocalisation[$count] = $row->name; $network_geolocalisation[$count] = $row->name;
$count++; $count++;
} }
$data['current_agent'] = $data['agent']->first_row()->lastname; }
$data["number_geolocalisation"] = $number_geolocalisation; $data["number_geolocalisation"] = $number_geolocalisation;
$data["network_geolocalisation"] = $network_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation;
$data["total"] = $count; $data["total"] = $count;
@ -768,11 +757,13 @@ class Gestion extends CI_Controller
$network_geolocalisation = array(); $network_geolocalisation = array();
$count = 0; $count = 0;
foreach ($data['networks']->result() AS $row) { if($data['networks']) {
foreach ($data['networks']->result() as $row) {
$number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $lastname); $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $lastname);
$network_geolocalisation[$count] = $row->name; $network_geolocalisation[$count] = $row->name;
$count++; $count++;
} }
}
$data['current_agent'] = $lastname; $data['current_agent'] = $lastname;
$data["number_geolocalisation"] = $number_geolocalisation; $data["number_geolocalisation"] = $number_geolocalisation;
$data["network_geolocalisation"] = $network_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation;
@ -920,7 +911,7 @@ class Gestion extends CI_Controller
$data["agents"] = $agent; $data["agents"] = $agent;
$data["total_points"] = $total; $data["total_points"] = $total;
$data["countA"] = $countA; $data["countA"] = $countA;
$data['current_agent'] = $data['agent']->first_row()->lastname; $data['current_agent'] = $data['agent'] ? $data['agent']->first_row()->lastname : null;
$data["number_geolocalisation"] = $number_geolocalisation; $data["number_geolocalisation"] = $number_geolocalisation;
$data["network_geolocalisation"] = $network_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation;
$data["total"] = $count; $data["total"] = $count;

View File

@ -780,7 +780,6 @@ class User_model extends CI_Model
$query=$this->db->query("SELECT countries.id,countries.name,countries.code_country,countries.code_dial $query=$this->db->query("SELECT countries.id,countries.name,countries.code_country,countries.code_dial
FROM countries FROM countries
INNER JOIN towns t on countries.id = t.country_id and t.status=1 INNER JOIN towns t on countries.id = t.country_id and t.status=1
WHERE countries.id IN (SELECT country_id FROM networks INNER JOIN networks_agents ON networks.id=networks_agents.network_id GROUP BY networks.country_id)
GROUP BY countries.id"); GROUP BY countries.id");
return $query; return $query;
} }

View File

@ -237,75 +237,3 @@
}); });
</script> </script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
var id_transaction = null;
$(document).on("click", ".openModal", function () {
id_transaction = $(this).data('id-transaction');
})
$(document).on("click", "#cancel", function () {
const id_transaction = $(this).data('id-transaction');
$.ajax({
url : '<?php echo base_url('index.php/Gestion/cancelTransation')?>',
type : 'POST',
dataType : 'json',
data: {"id_transaction": id_transaction},
async:true,
success : function(data){
if(data){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('canceled_transaction')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
$('#delete').click(function(){
$.ajax({
url : '<?php echo base_url('index.php/Hyperviseur_dash/delete_wallet_transaction')?>',
type : 'POST',
dataType : 'json',
data: {"id_transaction": id_transaction},
success : function(data, statut){
if(data=='200'){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('transaction_deleted')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
</script>