diff --git a/application/config/config.php b/application/config/config.php index 13599c05..813ebb7e 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = 'https://'.$_SERVER['SERVER_NAME'].'/backofficeiLinkTest'; +$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/backofficeiLinkTest'; /* |-------------------------------------------------------------------------- diff --git a/application/config/database.php b/application/config/database.php index b7f94224..f068aad6 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -77,7 +77,7 @@ $db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'root', - 'password' => 'vps@2017GA', + 'password' => '', 'database' => 'iLink_test2', 'dbdriver' => 'mysqli', 'dbprefix' => '', diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index adada400..51770e9d 100644 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -4,1266 +4,1270 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Gestion extends CI_Controller { - public function _contruct() - { - parent::_contruct(); - $this->load->model('user_model'); - - } - - public function index() - { - - - 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); - } else { - - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - $data['list_villes'] = $this->user_model->getAllVilles(); - $data['pays'] = $this->user_model->getAllPays(); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['alert'] = ""; - $data['active'] = "villes"; - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_villes'); - $this->load->view('footer'); - } - - } - - public function activer(){ - 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); - } else { - - if(isset($_POST)) - { - $villes = $this->input->post('villes'); - $max = sizeof($villes); - $number_success = 0; - for ($i = 0; $i < $max; $i++) { - $res = $this->user_model->changeVilleStatut($villes[$i],1); - if ($res==true){ - $number_success++; - } - } - if($number_success==$max){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function update() - { - - 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); - } else { - - if(isset($_POST)) - { - $id_country = $this->input->post('id_country'); - $id_town = $this->input->post('id_town'); - $town = $this->input->post('town'); - - $res = $this->user_model->updateVille($id_country,$id_town,$town); - - if($res==true){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function activer_desactiver(){ - - 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); - } else { - - if(isset($_POST)) - { - $aVilles = $this->input->post('aVilles'); - $maxA = sizeof($aVilles); - $number_successA = 0; - - $dVilles = $this->input->post('dVilles'); - $maxD = sizeof($dVilles); - $number_successD = 0; - - $this->db->trans_begin(); - for ($i = 0; $i < $maxD; $i++) { - $res = $this->user_model->changeVilleStatut($dVilles[$i],0); - if ($res==true){ - $number_successD++; - } - } - for ($i = 0; $i < $maxA; $i++) { - $res = $this->user_model->changeVilleStatut($aVilles[$i],1); - if ($res==true){ - $number_successA++; - } - } - - if($this->db->trans_status() === FALSE){ - $this->db->trans_rollback(); - echo json_encode("error"); - }else{ - $this->db->trans_commit(); - echo json_encode("completed"); - } - } - } - } - - public function desactiver() - { - 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); - } else { - - if(isset($_POST)) - { - $villes = $this->input->post('villes'); - $max = sizeof($villes); - $number_success = 0; - for ($i = 0; $i < $max; $i++) { - $res = $this->user_model->changeVilleStatut($villes[$i],0); - if ($res==true){ - $number_success++; - } - } - if($number_success==$max){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function suppress() - { - 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); - } else { - - if(isset($_POST)) - { - $villes = $this->input->post('ville'); - $res = $this->user_model->deleteVille($villes); - - if($res=true){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function ajout(){ - if ($this->input->post('pays') && $this->input->post('ville')) { - - $ville = $this->input->post('ville'); - $id_pays = $this->input->post('pays'); - $stat = 0; - - - $data = array('name' => $ville, 'country_id' => $id_pays, 'status' => $stat); - - $query = $this->db->insert('towns', $data); - - if ($query) { - - $data['alert'] = "ok"; - $data['success'] = "ok"; - $data['message'] = "La ville ".$ville." a bien été ajouté!"; - $data['active'] = "villes"; - - $data['list_villes'] = $this->user_model->getAllVilles(); - $data['pays'] = $this->user_model->getAllPays(); - $data['game_pays'] = $this->user_model->getGameCountry(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_villes'); - $this->load->view('footer'); - } else { - - $data['alert'] = "ok"; - $data['success'] = "error"; - $data['message'] = "Une erreur s'est produite"; - $data['active'] = "villes"; - $data['game_pays'] = $this->user_model->getGameCountry(); - - $data['list_villes'] = $this->user_model->getAllVilles(); - $data['pays'] = $this->user_model->getAllPays(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_villes'); - $this->load->view('footer'); - } - - } - } - - public function networks(){ - 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); - } else { - - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - - $data['list_villes'] = $this->user_model->getAllVilles(); - $data['pays'] = $this->user_model->getAllCountries(); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['alert'] = ""; - $data['active'] = "networks"; - $data['networks'] = $this->user_model->getAllNetworksNames(); - $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_networks'); - $this->load->view('footer'); - } - } - - public function creat_network(){ - - 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); - } else { - - if(isset($_POST)) - { - $network = $this->input->post('new_network'); - - $data = array('name' => $network); - - $query = $this->db->insert('networks', $data); - - if($query){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function assignation(){ - - 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); - } else { - - if(isset($_POST)) - { - $network = $this->input->post('network'); - $existe = 0; - $this->db->trans_begin(); - foreach ($_POST['id_country'] AS $country){ - $res = $this->user_model->checkIfAssignationExiste($country,$network); - - if($res==false){ - $data = array('country_id' => $country, 'name' => $network); - $this->db->insert('networks', $data); - - }else{ - $existe = $existe+1; - } - - } - if($this->db->trans_status() === FALSE){ - $this->db->trans_rollback(); - echo json_encode("error"); - }elseif ($existe>0){ - $this->db->trans_commit(); - echo json_encode("existe"); - }else{ - $this->db->trans_commit(); - echo json_encode("completed"); - } - - } - } - } - - public function update_network(){ - - 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); - } else { - - if(isset($_POST)) - { - $old_network = $this->input->post('old_name'); - $new_network = $this->input->post('new_network'); - - $res = $this->user_model->updateNetwork($old_network,$new_network); - - if($res==true){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function change_status_network(){ - - 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); - } else { - - if(isset($_POST)) - { - $activations = $this->input->post('activations'); - $desactivation = $this->input->post('desactivations'); - - $this->db->trans_begin(); - if(!empty($_POST['activations'])){ - foreach ($_POST['activations'] AS $network){ - - $data = array('status' => 1); - $this->db->where('id', $network); - $this->db->update('networks', $data); - - } - } - if(!empty($_POST['desactivations'])){ - foreach ($_POST['desactivations'] AS $network){ - - $data = array('status' => 0); - $this->db->where('id', $network); - $this->db->update('networks', $data); - - } - } - if($this->db->trans_status() === FALSE){ - $this->db->trans_rollback(); - echo json_encode("error"); - }else{ - $this->db->trans_commit(); - echo json_encode("completed"); - } - - } - } - } - - public function admin(){ - - 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); - } else { - - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - - $data['list_admin'] = $this->user_model->getAllAdmin(); - $data['list_villes'] = $this->user_model->getAllVilles(); - $data['pays'] = $this->user_model->getAllCountries(); - $data['game_pays'] = $this->user_model->getGameCountry(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - $data['alert'] = ""; - $data['active'] = "admin"; - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_admin'); - $this->load->view('footer'); - } - - } - - public function create_admin(){ - - 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); - } else { - - if(isset($_POST)) - { - $category = 1; - $firstname = $this->input->post('prenom'); - $lastname = $this->input->post('nom'); - $email = $this->input->post('email'); - $emailExist = $this->user_model->isEmailExist($email); - if($emailExist==false){ - $phone = $this->input->post('contact'); - $phoneExist = $this->user_model->isPhoneExist($phone); - if($phoneExist==false){ - $adresse = $this->input->post('adresse'); - $country = $this->input->post('country'); - $token = null; - do { - $token = bin2hex(openssl_random_pseudo_bytes(16)); - $tokenExist = $this->user_model->getToken($token); - } while ($tokenExist==true); - - $data = array('firstname' => $firstname,'lastname' => $lastname,'email' => $email,'phone' => $phone,'adresse' => $adresse,'country' => $country,'category' => $category,'token' => $token); - - $query = $this->db->insert('admin', $data); - - if($query){ - - $link = "https://ilink-app.com/backofficebeta/index.php/Admin_password/?token=".$token; - $this->load->library('email'); - - $this->email->from('noreply@ilink-app.com', 'iLink World'); - $this->email->to($email); - - $this->email->subject($this->lang->line("Confirmation de création d'un compte administrateur")); - $this->email->message($firstname.' '.$lastname.' '.$this->lang->line("votre compte administrateur a bien été créé. Veuillez suivre ce lien pour configurer votre mot de passe.").' '.$link); - - $this->email->send(); - - echo json_encode("completed"); - }else{ - echo json_encode($this->lang->line("Une erreur s'est produite")); - } - }else{ - echo json_encode($this->lang->line("Le numéro de téléphone entré est déjà utilisé")); - } - }else{ - echo json_encode($this->lang->line("L'email entré est déjà utilisé")); - } - } - } - } - - public function modif_admin(){ - - 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); - } else { - - if(isset($_POST)) - { - $id = $this->input->post('id'); - $firstname = $this->input->post('prenom'); - $lastname = $this->input->post('nom'); - $email = $this->input->post('email'); - $phone = $this->input->post('contact'); - $adresse = $this->input->post('adresse'); - $country = $this->input->post('country'); - $category = $this->input->post('category'); - - $res = $this->user_model->updateAdmin($id,$firstname,$lastname,$email,$phone,$adresse,$country,$category); - - if($res){ - echo json_encode("completed"); - }else{ - echo json_encode($this->lang->line("Une erreur s'est produite")); - } - } - } - } - - public function delete_admin(){ - - 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); - } else { - - if(isset($_POST)) - { - $id = $this->input->post('id'); - - $res = $this->user_model->deleteAdmin($id); - - if($res){ - echo json_encode("completed"); - }else{ - echo json_encode($this->lang->line("Une erreur s'est produite")); - } - } - } - } - - public function codes(){ - - 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); - } else { - - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - - $data['list_villes'] = $this->user_model->getAllVilles(); - $data['pays'] = $this->user_model->getAllPays(); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['alert'] = ""; - $data['active'] = "codes-hyper"; - $data['list'] = $this->user_model->getGeneratedHyperCodes(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('codeg'); - $this->load->view('footer'); - } - } - - public function generateCode() - { - - if ($this->input->post('c') && $this->input->post('a')) { - - $number = intval($this->input->post('c')); - $member_code = $this->input->post('a'); - if($number>0){ - for ($i = 0; $i < $number; $i++) { - - - $code = $this->randomString(); - - $data = array('code_parrain' => $member_code, 'code_membre' => $code, 'etat' => 0, 'category' => 'hyper'); - - $query = $this->db->insert('codeGenerer', $data); - - } - } - $data['alert'] = "ok"; - $data['success'] = "ok"; - $data['active'] = "members"; - $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['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['active'] = "codes"; - $data['pays'] = $this->user_model->getAllCountries(); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['email'] = $this->session->userdata('email'); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - $this->load->view('header_gestion', $data); - $this->load->view('codeg'); - $this->load->view('footer'); - - } else { - $data['alert'] = "ok"; - $data['success'] = ""; - $data['active'] = "members"; - $data['message'] = "Can't add codes!"; - - $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['game_pays'] = $this->user_model->getGameCountry(); - $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['active'] = "codes"; - $data['pays'] = $this->user_model->getAllCountries(); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['email'] = $this->session->userdata('email'); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('codeg'); - $this->load->view('footer'); - } - - } - - private function randomString($length = 10) - { - $str = ""; - $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9')); - $max = count($characters) - 1; - for ($i = 0; $i < $length; $i++) { - $rand = mt_rand(0, $max); - $str .= $characters[$rand]; - } - return $str; - - } - - public function geolocalisation(){ - - 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); - } 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['game_pays'] = $this->user_model->getGameCountry(); - $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); - $data['active_ville_name'] = $data['villes']->first_row()->name; - $data['active_ville_id'] = $data['villes']->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['alert'] = ""; - $data['active'] = "geoloc"; - $number_geolocalisation = array(); - $network_geolocalisation = array(); - $count = 0; - - foreach ($data['networks']->result() AS $row){ - $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id,$data['agent']->first_row()->lastname); - $network_geolocalisation[$count] = $row->name; - $count++; - } - $data['current_agent'] = $data['agent']->first_row()->lastname; - $data["number_geolocalisation"] = $number_geolocalisation; - $data["network_geolocalisation"] = $network_geolocalisation; - $data["total"] = $count; - $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_geolocalisation'); - $this->load->view('footer'); - } - } - - public function infos_geolocalisation(){ - - 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); - } else { - - if(isset($_POST)) - { - $pays = $this->input->post('pays'); - $ville = $this->input->post('ville'); - $lastname = $this->input->post('agent'); - - - $data['pays'] = $this->user_model->getAllCountries(); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); - $data['active_ville_name'] = $data['villes']->first_row()->name; - $data['active_ville_id'] = $data['villes']->first_row()->id; - $data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id); - $data['networks'] = $this->user_model->getNetworks($pays); - $data['alert'] = ""; - $data['active'] = "geoloc"; - $number_geolocalisation = array(); - $network_geolocalisation = array(); - $count = 0; - - foreach ($data['networks']->result() AS $row){ - $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id,$lastname); - $network_geolocalisation[$count] = $row->name; - $count++; - } - $data['current_agent'] = $lastname; - $data["number_geolocalisation"] = $number_geolocalisation; - $data["network_geolocalisation"] = $network_geolocalisation; - $data["total"] = $count; - $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_geolocalisation'); - $this->load->view('footer'); - } - } - } - - public function getVilleByPays(){ - - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - - redirect('index.php', $data); - } - else { - - if($this->input->is_ajax_request()) - { - $ajaxhyp = $this->user_model->getVillesByPays($this->input->post('pays')); - echo json_encode($ajaxhyp->result_array()); - } - - } - } - - public function getAgentByVilles(){ - - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - - redirect('index.php', $data); - } - else { - - if($this->input->is_ajax_request()) - { - $ajaxhyp = $this->user_model->getAgentsFromCountry($this->input->post('id_country')); - echo json_encode($ajaxhyp->result_array()); - } - - } - } - - public function campagne(){ - - 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); - } else { - - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - - $debut = date('Y-m-d H:i:s',strtotime($this->user_model->getMostOldDateCreationAgent())); - $fin = date("Y-m-d H:i:s"); - $data['pays'] = $this->user_model->getAllCountries(); - $pays = $data['pays']->first_row()->id; - if(!empty($_POST)) - { - $debut = $this->input->post('date-debut'); - $fin = $this->input->post('date-fin'); - $pays = $this->input->post('pays'); - } - - $data['debut'] = $debut; - $data['fin'] = $fin; - $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); - $data['active_ville_name'] = $data['villes']->first_row()->name; - $data['active_ville_id'] = $data['villes']->first_row()->id; - $data['agent'] = $this->user_model->getAgentsFromCountry($pays); - $data['networks'] = $this->user_model->getNetworks($pays); - $data['alert'] = ""; - $data['active'] = "campagne"; - $agent[][] = null; - $geo_correct[][] = null; - $number_geolocalisation [][] = null; - $network_geolocalisation [][] = null; - $number_correct [][] = null; - $count = 0; - $countA = 0; - $total = 0; - $network_count = 0; - $total_physique = 0; - $contact_correct = 0; - - $networks_compte[] = null; - $networks_name[] = null; - - if($data['agent']!=false){ - foreach ($data['agent']->result() AS $row1){ - if(!strstr($row1->lastname, "Super -") and !strstr($row1->lastname, "Airtel")){ - $totalGeo = 0; - $totalGeoCorrect = 0; - $agent[$countA][0] = $row1->lastname; - foreach ($data['networks']->result() AS $row2){ - $number_geolocalisation [$countA][$count] = $this->user_model->getPointGeolocalisedByDate($row2->id,$row1->lastname,$debut,$fin); - $number_correct [$countA][$count] = $this->user_model->getCorrectPointGeolocalisedByDate($row2->id,$row1->lastname,$debut,$fin); - $network_geolocalisation [$countA][$count] = $row2->name; - $totalGeo = $totalGeo + $number_geolocalisation [$countA][$count]; - $totalGeoCorrect = $totalGeoCorrect + $number_correct [$countA][$count]; - $count++; - } - $agent[$countA][1] = $totalGeo; - $agent[$countA][2] = $this->user_model->getPhysicalPointBySupervisor($debut,$fin,$row1->lastname); - $total_physique = $total_physique + $agent[$countA][2]; - $geo_correct [$countA][1] = $totalGeoCorrect; - $total = $total+$totalGeo; - $contact_correct = $contact_correct+$totalGeoCorrect; - $countA++; - } - } - } - - foreach ($data['networks']->result() AS $row){ - $networks_compte[$network_count] = $this->user_model->getPointGeolocalisedByNetwork($row->id,$debut,$fin); - $networks_name[$network_count] = $row->name; - $network_count++; - } - $data["networks_compte"] = $networks_compte; - $data["networks_name"] = $networks_name; - $data["network_count"] = $network_count; - $data["total_physique"] = $total_physique; - $data['geo_correct'] = $geo_correct; - $data['contact_correct']=$total; - if($pays==78){ - $data['contact_correct']=$contact_correct; - } - $data["agents"] = $agent; - $data["total_points"] = $total; - $data["countA"] = $countA; - $data['current_agent'] = $data['agent']->first_row()->lastname; - $data["number_geolocalisation"] = $number_geolocalisation; - $data["network_geolocalisation"] = $network_geolocalisation; - $data["total"] = $count; - $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); - $data['game_pays'] = $this->user_model->getGameCountry(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_campagne'); - $this->load->view('footer'); - } - } - - public function redirect_info_agent(){ - - 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); - } else { - - if(isset($_GET)) - { - $lastname = $this->input->get('agent'); - $debut = $this->input->get('debut'); - $fin = $this->input->get('fin'); - $id_country = $this->user_model->getAgentNetwork($lastname); - - $data['pays'] = $this->user_model->getAllCountries(); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); - $data['active_ville_name'] = $data['villes']->first_row()->name; - $data['active_ville_id'] = $data['villes']->first_row()->id; - $data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id); - $data['networks'] = $this->user_model->getNetworks($id_country); - $data['alert'] = ""; - $data['active'] = "geoloc"; - $number_geolocalisation = array(); - $network_geolocalisation = array(); - $count = 0; - - foreach ($data['networks']->result() AS $row){ - $number_geolocalisation[$count] = $this->user_model->getPointGeolocalisedByDate($row->id,$lastname,$debut,$fin); - $network_geolocalisation[$count] = $row->name; - $count++; - } - $data['current_agent'] = $lastname; - $data["number_geolocalisation"] = $number_geolocalisation; - $data["network_geolocalisation"] = $network_geolocalisation; - $data["total"] = $count; - $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - - $this->load->view('header_gestion', $data); - $this->load->view('gestion_geolocalisation'); - $this->load->view('footer'); - } - } - } - - public function map(){ - 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); - } else { - $data['positions'] = $this->user_model->getAllpositionsForWorld(); - $data['latitude'] = 0; - $data['longitude'] = 0; - $data['lastname'] = $this->session->userdata('lastname'); - $data['active'] = "map"; - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['alert'] = ""; - $this->load->view('header_gestion', $data); - $this->load->view('gestion_map'); - $this->load->view('footer'); - } - } - - public function game(){ - 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); - } else { - $pays = 1; - if(!empty($_POST)) - { - $pays = $this->input->post('pays'); - $pays_name = $this->user_model->getNameCountry($pays); - $this->session->set_userdata('current_game_country',$pays); - $this->session->set_userdata('current_game_country_name',$pays_name); - }elseif(!empty($this->session->userdata('current_game_country'))){ - $pays = $this->session->userdata('current_game_country'); - $pays_name = $this->session->userdata('current_game_country_name'); - } - $max = 999999; - $data['paliers'] = $this->user_model->getPaliers(); - $data['pays'] = $this->user_model->getAllGameCountries(); - $data['list'] = $this->user_model->getMembers($pays); - $data['game_pays'] = $this->user_model->getGameCountry(); - $data['q1'] = $this->user_model->getQuota(1); - $data['q2'] = $this->user_model->getQuota(2); - $data['q3'] = $this->user_model->getQuota(3); - $data['q4'] = $this->user_model->getQuota(4); - $data['quota1'] = $this->user_model->getCoutForQuota($pays,$data['q1'],$data['q2']); - $data['quota2'] = $this->user_model->getCoutForQuota($pays,$data['q2'],$data['q3']); - $data['quota3'] = $this->user_model->getCoutForQuota($pays,$data['q3'],$data['q4']); - $data['quota4'] = $this->user_model->getCoutForQuota($pays,$data['q4'],$max); - $data['lastname'] = $this->session->userdata('lastname'); - $data['active'] = "game"; - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['alert'] = ""; - //wallet - $data['networks'] = $this->user_model->getActiveNetwork(); - $this->load->view('header_gestion',$data); - $this->load->view('game'); - $this->load->view('footer'); - } - } - - public function activerGame(){ - 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); - } else { - - if(isset($_POST)) - { - $pays = $this->input->post('pays'); - $max = sizeof($pays); - $number_success = 0; - for ($i = 0; $i < $max; $i++) { - $checkContryExist = $this->user_model->checkCountryGameExist($pays[$i]); - if($checkContryExist==true){ - $res = $this->user_model->activeGameOnCountry($pays[$i],1); - }else{ - $add = $this->user_model->addContryToGame($pays[$i]); - if($add==true){ - $res = $this->user_model->activeGameOnCountry($pays[$i],1); - }else{ - echo json_encode("error"); - } - } - if ($res==true){ - $number_success++; - } - } - if($number_success==$max){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function desactiverGame(){ - 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); - } else { - - if(isset($_POST)) - { - $pays = $this->input->post('pays'); - $max = sizeof($pays); - $number_success = 0; - for ($i = 0; $i < $max; $i++) { - $res = $this->user_model->activeGameOnCountry($pays[$i],0); - if ($res==true){ - $number_success++; - } - } - if($number_success==$max){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - - public function activer_desactiverGame(){ - - 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); - } else { - - if(isset($_POST)) - { - $apays = $this->input->post('apays'); - $maxA = sizeof($apays); - $number_successA = 0; - - $dpays = $this->input->post('dpays'); - $maxD = sizeof($dpays); - $number_successD = 0; - - $this->db->trans_begin(); - for ($i = 0; $i < $maxD; $i++) { - $res = $this->user_model->activeGameOnCountry($dpays[$i],0); - if ($res==true){ - $number_successD++; - } - } - for ($i = 0; $i < $maxA; $i++) { - - $checkContryExist = $this->user_model->checkCountryGameExist($apays[$i]); - if($checkContryExist==true){ - $res = $this->user_model->activeGameOnCountry($apays[$i],1); - }else{ - $add = $this->user_model->addContryToGame($apays[$i]); - if($add==true){ - $res = $this->user_model->activeGameOnCountry($apays[$i],1); - }else{ - echo json_encode("error"); - } - } - if ($res==true){ - $number_successA++; - } - } - - if($this->db->trans_status() === FALSE){ - $this->db->trans_rollback(); - echo json_encode("error"); - }else{ - $this->db->trans_commit(); - echo json_encode("completed"); - } - } - } - } - - public function modifierPalier(){ - 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); - } else { - - if(isset($_POST)) - { - $n1 = $this->input->post('n1'); - $n2 = $this->input->post('n2'); - $n3 = $this->input->post('n3'); - $n4 = $this->input->post('n4'); - $max = 4; - $number_success = 0; - - $res1 = $this->user_model->modifPalier($n1,1); - if ($res1==true){ - $number_success++; - $res2 = $this->user_model->modifPalier($n2,2); - if($res2==true){ - $number_success++; - $res3 = $this->user_model->modifPalier($n3,3); - if($res3){ - $number_success++; - $res4 = $this->user_model->modifPalier($n4,4); - if($res4==true){ - $number_success++; - }else{ - echo json_encode("error"); - } - }else{ - echo json_encode("error"); - } - }else{ - echo json_encode("error"); - } - }else{ - echo json_encode("error"); - } - - if($number_success==$max){ - echo json_encode("completed"); - }else{ - echo json_encode("error"); - } - } - } - } - public function change_country(){ - 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); - } else { - - if(isset($_POST)) - { - $pays = $this->input->post('pays'); - $pays_name = $this->user_model->getNameCountry($pays); - if($pays_name!=false){ - $this->session->set_userdata('current_game_country',$pays); - $this->session->set_userdata('current_game_country_name',$pays_name); - echo 1; - }else{ - echo 0; - } - }else{ - echo 0; - } - } - } - - public function recherche(){ + public function _contruct() + { + parent::_contruct(); + $this->load->model('user_model'); + } + + public function index() + { + + + 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); + } else { + + $ville = $this->session->userdata('current_ville'); + $hyper = $this->session->userdata('current_hyper'); + $pays = $this->session->userdata('current_pays'); + + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + $data['list_villes'] = $this->user_model->getAllVilles(); + $data['pays'] = $this->user_model->getAllPays(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['alert'] = ""; + $data['active'] = "villes"; + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_villes'); + $this->load->view('footer'); + } + + } + + public function activer() + { + 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); + } else { + + if (isset($_POST)) { + $villes = $this->input->post('villes'); + $max = sizeof($villes); + $number_success = 0; + for ($i = 0; $i < $max; $i++) { + $res = $this->user_model->changeVilleStatut($villes[$i], 1); + if ($res == true) { + $number_success++; + } + } + if ($number_success == $max) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function update() + { + + 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); + } else { + + if (isset($_POST)) { + $id_country = $this->input->post('id_country'); + $id_town = $this->input->post('id_town'); + $town = $this->input->post('town'); + + $res = $this->user_model->updateVille($id_country, $id_town, $town); + + if ($res == true) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function activer_desactiver() + { + + 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); + } else { + + if (isset($_POST)) { + $aVilles = $this->input->post('aVilles'); + $maxA = sizeof($aVilles); + $number_successA = 0; + + $dVilles = $this->input->post('dVilles'); + $maxD = sizeof($dVilles); + $number_successD = 0; + + $this->db->trans_begin(); + for ($i = 0; $i < $maxD; $i++) { + $res = $this->user_model->changeVilleStatut($dVilles[$i], 0); + if ($res == true) { + $number_successD++; + } + } + for ($i = 0; $i < $maxA; $i++) { + $res = $this->user_model->changeVilleStatut($aVilles[$i], 1); + if ($res == true) { + $number_successA++; + } + } + + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + echo json_encode("error"); + } else { + $this->db->trans_commit(); + echo json_encode("completed"); + } + } + } + } + + public function desactiver() + { + 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); + } else { + + if (isset($_POST)) { + $villes = $this->input->post('villes'); + $max = sizeof($villes); + $number_success = 0; + for ($i = 0; $i < $max; $i++) { + $res = $this->user_model->changeVilleStatut($villes[$i], 0); + if ($res == true) { + $number_success++; + } + } + if ($number_success == $max) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function suppress() + { + 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); + } else { + + if (isset($_POST)) { + $villes = $this->input->post('ville'); + $res = $this->user_model->deleteVille($villes); + + if ($res = true) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function ajout() + { + if ($this->input->post('pays') && $this->input->post('ville')) { + + $ville = $this->input->post('ville'); + $id_pays = $this->input->post('pays'); + $stat = 0; + + + $data = array('name' => $ville, 'country_id' => $id_pays, 'status' => $stat); + + $query = $this->db->insert('towns', $data); + + if ($query) { + + $data['alert'] = "ok"; + $data['success'] = "ok"; + $data['message'] = "La ville " . $ville . " a bien été ajouté!"; + $data['active'] = "villes"; + + $data['list_villes'] = $this->user_model->getAllVilles(); + $data['pays'] = $this->user_model->getAllPays(); + $data['game_pays'] = $this->user_model->getGameCountry(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_villes'); + $this->load->view('footer'); + } else { + + $data['alert'] = "ok"; + $data['success'] = "error"; + $data['message'] = "Une erreur s'est produite"; + $data['active'] = "villes"; + $data['game_pays'] = $this->user_model->getGameCountry(); + + $data['list_villes'] = $this->user_model->getAllVilles(); + $data['pays'] = $this->user_model->getAllPays(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_villes'); + $this->load->view('footer'); + } + + } + } + + public function networks() + { + 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); + } else { + + $ville = $this->session->userdata('current_ville'); + $hyper = $this->session->userdata('current_hyper'); + $pays = $this->session->userdata('current_pays'); + + $data['list_villes'] = $this->user_model->getAllVilles(); + $data['pays'] = $this->user_model->getAllCountries(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['alert'] = ""; + $data['active'] = "networks"; + $data['networks'] = $this->user_model->getAllNetworksNames(); + $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_networks'); + $this->load->view('footer'); + } + } + + public function creat_network() + { + + 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); + } else { + + if (isset($_POST)) { + $network = $this->input->post('new_network'); + + $data = array('name' => $network); + + $query = $this->db->insert('networks', $data); + + if ($query) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function assignation() + { + + 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); + } else { + + if (isset($_POST)) { + $network = $this->input->post('network'); + $existe = 0; + $this->db->trans_begin(); + foreach ($_POST['id_country'] AS $country) { + $res = $this->user_model->checkIfAssignationExiste($country, $network); + + if ($res == false) { + $data = array('country_id' => $country, 'name' => $network); + $this->db->insert('networks', $data); + + } else { + $existe = $existe + 1; + } + + } + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + echo json_encode("error"); + } elseif ($existe > 0) { + $this->db->trans_commit(); + echo json_encode("existe"); + } else { + $this->db->trans_commit(); + echo json_encode("completed"); + } + + } + } + } + + public function update_network() + { + + 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); + } else { + + if (isset($_POST)) { + $old_network = $this->input->post('old_name'); + $new_network = $this->input->post('new_network'); + + $res = $this->user_model->updateNetwork($old_network, $new_network); + + if ($res == true) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function change_status_network() + { + + 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); + } else { + + if (isset($_POST)) { + $activations = $this->input->post('activations'); + $desactivation = $this->input->post('desactivations'); + + $this->db->trans_begin(); + if (!empty($_POST['activations'])) { + foreach ($_POST['activations'] AS $network) { + + $data = array('status' => 1); + $this->db->where('id', $network); + $this->db->update('networks', $data); + + } + } + if (!empty($_POST['desactivations'])) { + foreach ($_POST['desactivations'] AS $network) { + + $data = array('status' => 0); + $this->db->where('id', $network); + $this->db->update('networks', $data); + + } + } + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + echo json_encode("error"); + } else { + $this->db->trans_commit(); + echo json_encode("completed"); + } + + } + } + } + + public function admin() + { + + 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); + } else { + + $ville = $this->session->userdata('current_ville'); + $hyper = $this->session->userdata('current_hyper'); + $pays = $this->session->userdata('current_pays'); + + $data['list_admin'] = $this->user_model->getAllAdmin(); + $data['list_villes'] = $this->user_model->getAllVilles(); + $data['pays'] = $this->user_model->getAllCountries(); + $data['game_pays'] = $this->user_model->getGameCountry(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + $data['alert'] = ""; + $data['active'] = "admin"; + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_admin'); + $this->load->view('footer'); + } + + } + + public function create_admin() + { + + 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); + } else { + + if (isset($_POST)) { + $category = 1; + $firstname = $this->input->post('prenom'); + $lastname = $this->input->post('nom'); + $email = $this->input->post('email'); + $emailExist = $this->user_model->isEmailExist($email); + if ($emailExist == false) { + $phone = $this->input->post('contact'); + $phoneExist = $this->user_model->isPhoneExist($phone); + if ($phoneExist == false) { + $adresse = $this->input->post('adresse'); + $country = $this->input->post('country'); + $token = null; + do { + $token = bin2hex(openssl_random_pseudo_bytes(16)); + $tokenExist = $this->user_model->getToken($token); + } while ($tokenExist == true); + + $data = array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'phone' => $phone, 'adresse' => $adresse, 'country' => $country, 'category' => $category, 'token' => $token); + + $query = $this->db->insert('admin', $data); + + if ($query) { + + $link = "https://ilink-app.com/backofficebeta/index.php/Admin_password/?token=" . $token; + $this->load->library('email'); + + $this->email->from('noreply@ilink-app.com', 'iLink World'); + $this->email->to($email); + + $this->email->subject($this->lang->line("Confirmation de création d'un compte administrateur")); + $this->email->message($firstname . ' ' . $lastname . ' ' . $this->lang->line("votre compte administrateur a bien été créé. Veuillez suivre ce lien pour configurer votre mot de passe.") . ' ' . $link); + + $this->email->send(); + + echo json_encode("completed"); + } else { + echo json_encode($this->lang->line("Une erreur s'est produite")); + } + } else { + echo json_encode($this->lang->line("Le numéro de téléphone entré est déjà utilisé")); + } + } else { + echo json_encode($this->lang->line("L'email entré est déjà utilisé")); + } + } + } + } + + public function modif_admin() + { + + 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); + } else { + + if (isset($_POST)) { + $id = $this->input->post('id'); + $firstname = $this->input->post('prenom'); + $lastname = $this->input->post('nom'); + $email = $this->input->post('email'); + $phone = $this->input->post('contact'); + $adresse = $this->input->post('adresse'); + $country = $this->input->post('country'); + $category = $this->input->post('category'); + + $res = $this->user_model->updateAdmin($id, $firstname, $lastname, $email, $phone, $adresse, $country, $category); + + if ($res) { + echo json_encode("completed"); + } else { + echo json_encode($this->lang->line("Une erreur s'est produite")); + } + } + } + } + + public function delete_admin() + { + + 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); + } else { + + if (isset($_POST)) { + $id = $this->input->post('id'); + + $res = $this->user_model->deleteAdmin($id); + + if ($res) { + echo json_encode("completed"); + } else { + echo json_encode($this->lang->line("Une erreur s'est produite")); + } + } + } + } + + public function codes() + { + + 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); + } else { + + $ville = $this->session->userdata('current_ville'); + $hyper = $this->session->userdata('current_hyper'); + $pays = $this->session->userdata('current_pays'); + + $data['list_villes'] = $this->user_model->getAllVilles(); + $data['pays'] = $this->user_model->getAllPays(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['alert'] = ""; + $data['active'] = "codes-hyper"; + $data['list'] = $this->user_model->getGeneratedHyperCodes(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('codeg'); + $this->load->view('footer'); + } + } + + public function generateCode() + { + + if ($this->input->post('c') && $this->input->post('a')) { + + $number = intval($this->input->post('c')); + $member_code = $this->input->post('a'); + if ($number > 0) { + for ($i = 0; $i < $number; $i++) { + + + $code = $this->randomString(); + +// $data = array('code_parrain' => $member_code, 'code_membre' => $code, 'etat' => 0, 'category' => 'hyper'); + $data = array('code_parrain' => $code, 'code_membre' => $code, 'etat' => 0, 'category' => 'hyper'); + + + $query = $this->db->insert('codeGenerer', $data); + + } + } + $data['alert'] = "ok"; + $data['success'] = "ok"; + $data['active'] = "members"; + $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['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['active'] = "codes"; + $data['pays'] = $this->user_model->getAllCountries(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['email'] = $this->session->userdata('email'); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + $this->load->view('header_gestion', $data); + $this->load->view('codeg'); + $this->load->view('footer'); + + } else { + $data['alert'] = "ok"; + $data['success'] = ""; + $data['active'] = "members"; + $data['message'] = "Can't add codes!"; + + $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['game_pays'] = $this->user_model->getGameCountry(); + $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['active'] = "codes"; + $data['pays'] = $this->user_model->getAllCountries(); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['email'] = $this->session->userdata('email'); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('codeg'); + $this->load->view('footer'); + } + + } + + private function randomString($length = 10) + { + $str = ""; + $characters = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9')); + $max = count($characters) - 1; + for ($i = 0; $i < $length; $i++) { + $rand = mt_rand(0, $max); + $str .= $characters[$rand]; + } + return $str; + + } + + public function geolocalisation() + { + + 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); + } 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['game_pays'] = $this->user_model->getGameCountry(); + $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); + $data['active_ville_name'] = $data['villes']->first_row()->name; + $data['active_ville_id'] = $data['villes']->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['alert'] = ""; + $data['active'] = "geoloc"; + $number_geolocalisation = array(); + $network_geolocalisation = array(); + $count = 0; + + foreach ($data['networks']->result() AS $row) { + $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $data['agent']->first_row()->lastname); + $network_geolocalisation[$count] = $row->name; + $count++; + } + $data['current_agent'] = $data['agent']->first_row()->lastname; + $data["number_geolocalisation"] = $number_geolocalisation; + $data["network_geolocalisation"] = $network_geolocalisation; + $data["total"] = $count; + $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_geolocalisation'); + $this->load->view('footer'); + } + } + + public function infos_geolocalisation() + { + + 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); + } else { + + if (isset($_POST)) { + $pays = $this->input->post('pays'); + $ville = $this->input->post('ville'); + $lastname = $this->input->post('agent'); + + + $data['pays'] = $this->user_model->getAllCountries(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); + $data['active_ville_name'] = $data['villes']->first_row()->name; + $data['active_ville_id'] = $data['villes']->first_row()->id; + $data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id); + $data['networks'] = $this->user_model->getNetworks($pays); + $data['alert'] = ""; + $data['active'] = "geoloc"; + $number_geolocalisation = array(); + $network_geolocalisation = array(); + $count = 0; + + foreach ($data['networks']->result() AS $row) { + $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $lastname); + $network_geolocalisation[$count] = $row->name; + $count++; + } + $data['current_agent'] = $lastname; + $data["number_geolocalisation"] = $number_geolocalisation; + $data["network_geolocalisation"] = $network_geolocalisation; + $data["total"] = $count; + $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_geolocalisation'); + $this->load->view('footer'); + } + } + } + + public function getVilleByPays() + { + + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + + redirect('index.php', $data); + } else { + + if ($this->input->is_ajax_request()) { + $ajaxhyp = $this->user_model->getVillesByPays($this->input->post('pays')); + echo json_encode($ajaxhyp->result_array()); + } + + } + } + + public function getAgentByVilles() + { + + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + + redirect('index.php', $data); + } else { + + if ($this->input->is_ajax_request()) { + $ajaxhyp = $this->user_model->getAgentsFromCountry($this->input->post('id_country')); + echo json_encode($ajaxhyp->result_array()); + } + + } + } + + public function campagne() + { + + 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); + } else { + + $ville = $this->session->userdata('current_ville'); + $hyper = $this->session->userdata('current_hyper'); + $pays = $this->session->userdata('current_pays'); + + $debut = date('Y-m-d H:i:s', strtotime($this->user_model->getMostOldDateCreationAgent())); + $fin = date("Y-m-d H:i:s"); + $data['pays'] = $this->user_model->getAllCountries(); + $pays = $data['pays']->first_row()->id; + if (!empty($_POST)) { + $debut = $this->input->post('date-debut'); + $fin = $this->input->post('date-fin'); + $pays = $this->input->post('pays'); + } + + $data['debut'] = $debut; + $data['fin'] = $fin; + $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); + $data['active_ville_name'] = $data['villes']->first_row()->name; + $data['active_ville_id'] = $data['villes']->first_row()->id; + $data['agent'] = $this->user_model->getAgentsFromCountry($pays); + $data['networks'] = $this->user_model->getNetworks($pays); + $data['alert'] = ""; + $data['active'] = "campagne"; + $agent[][] = null; + $geo_correct[][] = null; + $number_geolocalisation [][] = null; + $network_geolocalisation [][] = null; + $number_correct [][] = null; + $count = 0; + $countA = 0; + $total = 0; + $network_count = 0; + $total_physique = 0; + $contact_correct = 0; + + $networks_compte[] = null; + $networks_name[] = null; + + if ($data['agent'] != false) { + foreach ($data['agent']->result() AS $row1) { + if (!strstr($row1->lastname, "Super -") and !strstr($row1->lastname, "Airtel")) { + $totalGeo = 0; + $totalGeoCorrect = 0; + $agent[$countA][0] = $row1->lastname; + foreach ($data['networks']->result() AS $row2) { + $number_geolocalisation [$countA][$count] = $this->user_model->getPointGeolocalisedByDate($row2->id, $row1->lastname, $debut, $fin); + $number_correct [$countA][$count] = $this->user_model->getCorrectPointGeolocalisedByDate($row2->id, $row1->lastname, $debut, $fin); + $network_geolocalisation [$countA][$count] = $row2->name; + $totalGeo = $totalGeo + $number_geolocalisation [$countA][$count]; + $totalGeoCorrect = $totalGeoCorrect + $number_correct [$countA][$count]; + $count++; + } + $agent[$countA][1] = $totalGeo; + $agent[$countA][2] = $this->user_model->getPhysicalPointBySupervisor($debut, $fin, $row1->lastname); + $total_physique = $total_physique + $agent[$countA][2]; + $geo_correct [$countA][1] = $totalGeoCorrect; + $total = $total + $totalGeo; + $contact_correct = $contact_correct + $totalGeoCorrect; + $countA++; + } + } + } + + foreach ($data['networks']->result() AS $row) { + $networks_compte[$network_count] = $this->user_model->getPointGeolocalisedByNetwork($row->id, $debut, $fin); + $networks_name[$network_count] = $row->name; + $network_count++; + } + $data["networks_compte"] = $networks_compte; + $data["networks_name"] = $networks_name; + $data["network_count"] = $network_count; + $data["total_physique"] = $total_physique; + $data['geo_correct'] = $geo_correct; + $data['contact_correct'] = $total; + if ($pays == 78) { + $data['contact_correct'] = $contact_correct; + } + $data["agents"] = $agent; + $data["total_points"] = $total; + $data["countA"] = $countA; + $data['current_agent'] = $data['agent']->first_row()->lastname; + $data["number_geolocalisation"] = $number_geolocalisation; + $data["network_geolocalisation"] = $network_geolocalisation; + $data["total"] = $count; + $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); + $data['game_pays'] = $this->user_model->getGameCountry(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_campagne'); + $this->load->view('footer'); + } + } + + public function redirect_info_agent() + { + + 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); + } else { + + if (isset($_GET)) { + $lastname = $this->input->get('agent'); + $debut = $this->input->get('debut'); + $fin = $this->input->get('fin'); + $id_country = $this->user_model->getAgentNetwork($lastname); + + $data['pays'] = $this->user_model->getAllCountries(); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); + $data['active_ville_name'] = $data['villes']->first_row()->name; + $data['active_ville_id'] = $data['villes']->first_row()->id; + $data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id); + $data['networks'] = $this->user_model->getNetworks($id_country); + $data['alert'] = ""; + $data['active'] = "geoloc"; + $number_geolocalisation = array(); + $network_geolocalisation = array(); + $count = 0; + + foreach ($data['networks']->result() AS $row) { + $number_geolocalisation[$count] = $this->user_model->getPointGeolocalisedByDate($row->id, $lastname, $debut, $fin); + $network_geolocalisation[$count] = $row->name; + $count++; + } + $data['current_agent'] = $lastname; + $data["number_geolocalisation"] = $number_geolocalisation; + $data["network_geolocalisation"] = $network_geolocalisation; + $data["total"] = $count; + $data['assigned_networks'] = $this->user_model->getAllAssignedNetworks(); + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_geolocalisation'); + $this->load->view('footer'); + } + } + } + + public function map() + { + 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); + } else { + $data['positions'] = $this->user_model->getAllpositionsForWorld(); + $data['latitude'] = 0; + $data['longitude'] = 0; + $data['lastname'] = $this->session->userdata('lastname'); + $data['active'] = "map"; + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['alert'] = ""; + $this->load->view('header_gestion', $data); + $this->load->view('gestion_map'); + $this->load->view('footer'); + } + } + + public function game() + { + 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); + } else { + $pays = 1; + if (!empty($_POST)) { + $pays = $this->input->post('pays'); + $pays_name = $this->user_model->getNameCountry($pays); + $this->session->set_userdata('current_game_country', $pays); + $this->session->set_userdata('current_game_country_name', $pays_name); + } elseif (!empty($this->session->userdata('current_game_country'))) { + $pays = $this->session->userdata('current_game_country'); + $pays_name = $this->session->userdata('current_game_country_name'); + } + $max = 999999; + $data['paliers'] = $this->user_model->getPaliers(); + $data['pays'] = $this->user_model->getAllGameCountries(); + $data['list'] = $this->user_model->getMembers($pays); + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['q1'] = $this->user_model->getQuota(1); + $data['q2'] = $this->user_model->getQuota(2); + $data['q3'] = $this->user_model->getQuota(3); + $data['q4'] = $this->user_model->getQuota(4); + $data['quota1'] = $this->user_model->getCoutForQuota($pays, $data['q1'], $data['q2']); + $data['quota2'] = $this->user_model->getCoutForQuota($pays, $data['q2'], $data['q3']); + $data['quota3'] = $this->user_model->getCoutForQuota($pays, $data['q3'], $data['q4']); + $data['quota4'] = $this->user_model->getCoutForQuota($pays, $data['q4'], $max); + $data['lastname'] = $this->session->userdata('lastname'); + $data['active'] = "game"; + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['alert'] = ""; + //wallet + $data['networks'] = $this->user_model->getActiveNetwork(); + $this->load->view('header_gestion', $data); + $this->load->view('game'); + $this->load->view('footer'); + } + } + + public function activerGame() + { + 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); + } else { + + if (isset($_POST)) { + $pays = $this->input->post('pays'); + $max = sizeof($pays); + $number_success = 0; + for ($i = 0; $i < $max; $i++) { + $checkContryExist = $this->user_model->checkCountryGameExist($pays[$i]); + if ($checkContryExist == true) { + $res = $this->user_model->activeGameOnCountry($pays[$i], 1); + } else { + $add = $this->user_model->addContryToGame($pays[$i]); + if ($add == true) { + $res = $this->user_model->activeGameOnCountry($pays[$i], 1); + } else { + echo json_encode("error"); + } + } + if ($res == true) { + $number_success++; + } + } + if ($number_success == $max) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function desactiverGame() + { + 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); + } else { + + if (isset($_POST)) { + $pays = $this->input->post('pays'); + $max = sizeof($pays); + $number_success = 0; + for ($i = 0; $i < $max; $i++) { + $res = $this->user_model->activeGameOnCountry($pays[$i], 0); + if ($res == true) { + $number_success++; + } + } + if ($number_success == $max) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function activer_desactiverGame() + { + + 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); + } else { + + if (isset($_POST)) { + $apays = $this->input->post('apays'); + $maxA = sizeof($apays); + $number_successA = 0; + + $dpays = $this->input->post('dpays'); + $maxD = sizeof($dpays); + $number_successD = 0; + + $this->db->trans_begin(); + for ($i = 0; $i < $maxD; $i++) { + $res = $this->user_model->activeGameOnCountry($dpays[$i], 0); + if ($res == true) { + $number_successD++; + } + } + for ($i = 0; $i < $maxA; $i++) { + + $checkContryExist = $this->user_model->checkCountryGameExist($apays[$i]); + if ($checkContryExist == true) { + $res = $this->user_model->activeGameOnCountry($apays[$i], 1); + } else { + $add = $this->user_model->addContryToGame($apays[$i]); + if ($add == true) { + $res = $this->user_model->activeGameOnCountry($apays[$i], 1); + } else { + echo json_encode("error"); + } + } + if ($res == true) { + $number_successA++; + } + } + + if ($this->db->trans_status() === FALSE) { + $this->db->trans_rollback(); + echo json_encode("error"); + } else { + $this->db->trans_commit(); + echo json_encode("completed"); + } + } + } + } + + public function modifierPalier() + { + 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); + } else { + + if (isset($_POST)) { + $n1 = $this->input->post('n1'); + $n2 = $this->input->post('n2'); + $n3 = $this->input->post('n3'); + $n4 = $this->input->post('n4'); + $max = 4; + $number_success = 0; + + $res1 = $this->user_model->modifPalier($n1, 1); + if ($res1 == true) { + $number_success++; + $res2 = $this->user_model->modifPalier($n2, 2); + if ($res2 == true) { + $number_success++; + $res3 = $this->user_model->modifPalier($n3, 3); + if ($res3) { + $number_success++; + $res4 = $this->user_model->modifPalier($n4, 4); + if ($res4 == true) { + $number_success++; + } else { + echo json_encode("error"); + } + } else { + echo json_encode("error"); + } + } else { + echo json_encode("error"); + } + } else { + echo json_encode("error"); + } + + if ($number_success == $max) { + echo json_encode("completed"); + } else { + echo json_encode("error"); + } + } + } + } + + public function change_country() + { + 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); + } else { + + if (isset($_POST)) { + $pays = $this->input->post('pays'); + $pays_name = $this->user_model->getNameCountry($pays); + if ($pays_name != false) { + $this->session->set_userdata('current_game_country', $pays); + $this->session->set_userdata('current_game_country_name', $pays_name); + echo 1; + } else { + echo 0; + } + } else { + echo 0; + } + } + } + + public function recherche() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1293,7 +1297,8 @@ class Gestion extends CI_Controller } } - public function get_user(){ + public function get_user() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1304,53 +1309,52 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - if(isset($_POST)) - { + if (isset($_POST)) { $nom = $this->input->post('nom'); $phone = $this->input->post('phone'); $simple_users = null; - if($phone!='' && $nom!=''){ - $phone_condition = "phone LIKE '".$phone."%'"; - $nom_condition = "AND lastname LIKE '%".$nom."%'"; - $simple_users = $this->user_model->get_simple_user($phone,$nom); - }elseif ($phone!='' && $nom=='') { - $phone_condition = "phone LIKE '".$phone."%'"; + if ($phone != '' && $nom != '') { + $phone_condition = "phone LIKE '" . $phone . "%'"; + $nom_condition = "AND lastname LIKE '%" . $nom . "%'"; + $simple_users = $this->user_model->get_simple_user($phone, $nom); + } elseif ($phone != '' && $nom == '') { + $phone_condition = "phone LIKE '" . $phone . "%'"; $nom_condition = 'AND lastname IS NOT NULL'; - $simple_users = $this->user_model->get_simple_user($phone,'%'); - }elseif ($phone=='' && $nom!='') { + $simple_users = $this->user_model->get_simple_user($phone, '%'); + } elseif ($phone == '' && $nom != '') { $phone_condition = 'phone IS NOT NULL'; - $nom_condition = "AND lastname LIKE '%".$nom."%'"; - $simple_users = $this->user_model->get_simple_user('%',$nom); - }elseif ($phone=='' && $nom=='') { + $nom_condition = "AND lastname LIKE '%" . $nom . "%'"; + $simple_users = $this->user_model->get_simple_user('%', $nom); + } elseif ($phone == '' && $nom == '') { $phone_condition = 'phone IS NOT NULL'; $nom_condition = 'AND lastname IS NOT NULL'; } $transac = $this->input->post('transac'); - if($transac!=''){ - $transac_condition = "AND transactionNumber LIKE'".$transac."%'"; - }else{ + if ($transac != '') { + $transac_condition = "AND transactionNumber LIKE'" . $transac . "%'"; + } else { $transac_condition = 'AND transactionNumber IS NOT NULL'; } $code = $this->input->post('code'); - if($code!=''){ - $code_condition = "AND code_membre = '".$code."'"; - }else{ + if ($code != '') { + $code_condition = "AND code_membre = '" . $code . "'"; + } else { $code_condition = 'AND code_membre IS NOT NULL'; } - $where_clause = "WHERE ".$phone_condition.' '.$transac_condition.' '.$code_condition.' '.$nom_condition; + $where_clause = "WHERE " . $phone_condition . ' ' . $transac_condition . ' ' . $code_condition . ' ' . $nom_condition; $res = $this->user_model->get_user($where_clause); - if($res!=false){ + if ($res != false) { $ville = $this->session->userdata('current_ville'); $hyper = $this->session->userdata('current_hyper'); $pays = $this->session->userdata('current_pays'); $count_users = $res->num_rows(); - if($simple_users != null){ - $count_users = $res->num_rows()+$simple_users->num_rows(); + if ($simple_users != null) { + $count_users = $res->num_rows() + $simple_users->num_rows(); } $data['alert'] = ""; @@ -1369,7 +1373,7 @@ class Gestion extends CI_Controller $this->load->view('header_gestion', $data); $this->load->view('gestion_recherche'); $this->load->view('footer'); - }else{ + } else { $ville = $this->session->userdata('current_ville'); $hyper = $this->session->userdata('current_hyper'); $pays = $this->session->userdata('current_pays'); @@ -1393,7 +1397,8 @@ class Gestion extends CI_Controller } } - public function update_info_user(){ + public function update_info_user() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1403,25 +1408,26 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - if(isset($_POST)){ - $id= $_POST['user_id']; + if (isset($_POST)) { + $id = $_POST['user_id']; $phone = $_POST['contact']; $adresse = $_POST['adresse']; $email = $_POST['email']; $nom = $_POST['nom']; - $res = $this->user_model->update_user_infos($nom,$adresse,$email,$phone,$id); - if($res!=false){ + $res = $this->user_model->update_user_infos($nom, $adresse, $email, $phone, $id); + if ($res != false) { echo json_encode("200"); - }else{ + } else { echo json_encode("500"); } - }else{ + } else { } } } - public function update_info_geolocated(){ + public function update_info_geolocated() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1431,27 +1437,28 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - if(isset($_POST)){ - $id_agent= $_POST['user_id']; - $id_netAg= $_POST['id_netAg']; + if (isset($_POST)) { + $id_agent = $_POST['user_id']; + $id_netAg = $_POST['id_netAg']; $phone = $_POST['contact']; $transac = $_POST['transac']; $adresse = $_POST['adresse']; $email = $_POST['email']; $nom = $_POST['nom']; - $res = $this->user_model->update_geolocated_infos($nom,$adresse,$email,$id_agent,$transac,$phone,$id_netAg); - if($res!=false){ + $res = $this->user_model->update_geolocated_infos($nom, $adresse, $email, $id_agent, $transac, $phone, $id_netAg); + if ($res != false) { echo json_encode("200"); - }else{ + } else { echo json_encode("500"); } - }else{ + } else { } } } - public function pub(){ + public function pub() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1461,7 +1468,7 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - $data['countries_list'] =$this->user_model->getPubCountries(); + $data['countries_list'] = $this->user_model->getPubCountries(); $data['active'] = "pub"; $data['alert'] = ""; $data['game_pays'] = $this->user_model->getGameCountry(); @@ -1473,7 +1480,8 @@ class Gestion extends CI_Controller } } - public function changePubState(){ + public function changePubState() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1483,26 +1491,27 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - if(isset($_POST)){ - $id_pub= $_POST['pub_id']; - $etat= $_POST['etat']; - if($etat == 0){ - $res = $this->user_model->updateStatePub($id_pub,1); - }elseif($etat == 1){ - $res = $this->user_model->updateStatePub($id_pub,0); + if (isset($_POST)) { + $id_pub = $_POST['pub_id']; + $etat = $_POST['etat']; + if ($etat == 0) { + $res = $this->user_model->updateStatePub($id_pub, 1); + } elseif ($etat == 1) { + $res = $this->user_model->updateStatePub($id_pub, 0); } - if($res!=false){ + if ($res != false) { echo json_encode("200"); - }else{ + } else { echo json_encode("500"); } - }else{ + } else { } } } - public function addPubRow(){ + public function addPubRow() + { if (!$this->session->userdata('email')) { $this->session->set_flashdata('error', 'log in first'); @@ -1511,17 +1520,175 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - if(isset($_POST)){ - $id_country= $_POST['country_id']; + if (isset($_POST)) { + $id_country = $_POST['country_id']; $res = $this->user_model->createPubRow($id_country); - if($res!=false){ + if ($res != false) { echo json_encode("200"); - }else{ + } else { echo json_encode("500"); } } } } - + //Wallet + + public function wallet() + { + + 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); + } else { + + if ($this->input->get('id')) { + $network_id = $this->input->get('id'); + $taux = $this->user_model->getTaux($network_id); + if ($taux != null) { + $taux = $this->user_model->getTaux($network_id)->first_row(); + $data['taux_client_r'] = $taux->taux_com_client_retrait; + $data['taux_client_d'] = $taux->taux_com_client_depot; + $data['taux_ag_r'] = $taux->taux_com_ag_retrait; + $data['taux_ag_d'] = $taux->taux_com_ag_depot; + $data['taux_sup_r'] = $taux->taux_com_sup_retrait; + $data['taux_sup_d'] = $taux->taux_com_sup_depot; + $data['taux_bq_d'] = $taux->part_banque_depot; + $data['taux_bq_r'] = $taux->part_banque_retrait; + $data['frais_d'] = $taux->frais_min_banque_depot; + $data['transactions'] = $this->user_model->getTransactions($network_id); + } else { + + $data["taux_client_r"] = "N/A"; + $data["taux_client_d"] = "N/A"; + $data["taux_ag_r"] = "N/A"; + $data["taux_ag_d"] = "N/A"; + $data["taux_sup_r"] = "N/A"; + $data["taux_sup_d"] = "N/A"; + $data['taux_bq_d'] = "N/A"; + $data['taux_bq_r'] = "N/A"; + $data['frais_d'] = "N/A"; + $data["transactions"] = false; + } + + $hyper = $this->user_model->getNetworkHyper($network_id)->first_row(); + $data['walletHyper'] = $this->user_model->getWallet($hyper->agent_id); + $data['network_id'] = $network_id; + $data['network'] = $this->user_model->getNetworkName($network_id); +// $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($network_id); + $data['active'] = "wallet"; + $data['alert'] = ""; + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['networks'] = $this->user_model->getActiveNetwork(); + + $this->load->view('header_gestion', $data); + $this->load->view('gestion_wallet'); + $this->load->view('footer'); + } else { + + $data['active'] = "wallet"; + $data['alert'] = ""; + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['networks'] = $this->user_model->getAllActivatedNetworks(); + $this->load->view('header_gestion', $data); + $this->load->view('gestion_wallets'); + $this->load->view('footer'); + } + + } + } + + public function config_wallet($method = 'create') + { + if($this->isLogged()){ + if (isset($_POST)) { + + $network_id = $_POST['network_id']; + $taux_client_r = $_POST['taux_client_r']; + $taux_client_d = $_POST['taux_client_d']; + $taux_ag_d = $_POST['taux_ag_d']; + $taux_ag_r = $_POST['taux_ag_r']; + $taux_sup_d = $_POST['taux_sup_d']; + $taux_sup_r = $_POST['taux_sup_r']; + $taux_bq_d = $_POST['taux_bq_d']; + $taux_bq_r = $_POST['taux_bq_r']; + $frais_d = $_POST['frais_d']; + + if($method == 'create') + { + $res = $this->user_model->addConfigWallet($network_id , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d); + + } + else if($method = 'update'){ + $res = $this->user_model->updateConfigWallet($network_id , $taux_client_r , $taux_client_d , $taux_ag_r ,$taux_ag_d , $taux_sup_r , $taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d); + + } + if ($res != false) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } + } + } + + } + + public function delete_config_wallet() + { + if($this->isLogged()){ + if (isset($_POST)) { + $network_id = $_POST['network_id']; + $res = $this->user_model->deleteConfigWallet($network_id); + if ($res != false) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } + } + } + + } + + + 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; + } + + public function generateAllWallets(){ + if($this->isLogged()) { + if (isset($_POST)) { + + $network_id = $_POST['network_id']; + // Fetch all agents , hyperviseur , superviseur + $f_agents = $this->user_model->getAllAgentsForNetwork($network_id) ; + if ($f_agents){ + foreach($f_agents->result() AS $row){ + //Create wallet if it not exist + $res = $this->user_model->getWallet($row->agent_id); + if($res){ + // Reinitialize the wallet + $this->user_model->reinitializeWallet($res->id_wallet); + }else{ + $this->user_model->addWallet($row->agent_id); + } + } + } + + } + } + + } + } diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 149db48f..d1689016 100644 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -1,329 +1,346 @@ -load->model('user_model'); - - } - - public function index() - { - - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - redirect('index.php', $data); - } else { - - $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 = $this->user_model->getCountDemande($this->session->userdata('member_code')); - - $data['active'] = "dash"; - $data['list_geolocated_users'] = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code')); - $data['listdem'] = $this->user_model->getDemandes($this->session->userdata('member_code')); - $data['allGeo'] = $this->user_model->getAllUserGeoForHyp($this->session->userdata('member_code')); - $data['allDem'] = $this->user_model->getDemandes($this->session->userdata('member_code')); - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['member_code'] = $this->session->userdata('member_code'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $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['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_d_traite'] = $count_d_traite; - $data['count_d_no_traite'] = $count_d_no_traite; - $data['count_d_users'] = $count_d; - $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); - $this->load->view('header_hyp', $data); - $this->load->view('hyperviseur_dash'); - $this->load->view('footer'); - } - } - - public function getAllUser_g(){ - - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - redirect('index.php', $data); - } - else { - - if($this->input->post('ville')) - { - $this->session->set_userdata('current_ville', $this->input->post('ville')); - } - - $data['active'] = "geolocated"; - $data['total_points'] = $this->user_model->getCoutGeolocatedUsersForHyper($this->session->userdata('member_code'),$this->session->userdata('current_ville')); - $data['map_title'] = $this->lang->line('utilisateurs géolocalisés à')." ".$this->session->userdata('current_ville'); - $data['tab'] = $this->user_model->getUsersGeolocatedByVilleForHyp($this->session->userdata('current_ville'),$this->session->userdata('member_code')); - $data['positions'] = $this->user_model->getUsersGeolocatedPositionByVilleForHyp($this->session->userdata('current_ville'),$this->session->userdata('member_code')); - $data['latitude'] = $this->session->userdata('latitude'); - $data['longitude'] = $this->session->userdata('longitude'); - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $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['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); - $data['alert'] = ""; - $this->load->view('header_hyp', $data); - $this->load->view('listeadmin'); - $this->load->view('footer'); - } - - } - - public function getAllSupervisor(){ - - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - - redirect('index.php', $data); - } - else { - - /*$this->db->select('*'); - $this->db->from('users'); - $this->db->where('category','super'); - $this->db->where('network',$this->session->userdata('network')); - $this->db->where('code_parrain',$this->session->userdata('code_parrain'));*/ - $query = $this->user_model->getSupervisorsForHyp($this->session->userdata('member_code')); - - $network = $this->session->userdata('network'); - $category = 'super'; - $position = $this->user_model->getAllpositions($network,$category,$this->session->userdata('member_code')); - if($position!=null){ - //var_dump($position); - //echo json_encode($position); - } - $data['total_points'] = $this->user_model->getCoutSuperForHyper($this->session->userdata('member_code')); - $data['positions'] = $position; - $data['active'] = "super"; - $data['map_title'] = $this->lang->line('Superviseurs'); - $data['tab'] = $query; - $data['latitude'] = $this->session->userdata('latitude'); - $data['longitude'] = $this->session->userdata('longitude'); - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $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['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); - $data['alert'] = ""; - $this->load->view('header_hyp', $data); - $this->load->view('listeadmin'); - $this->load->view('footer'); - } - } - - public function getAllSupervisorPositions(){ - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - - redirect('index.php', $data); - } - else { - $network = $this->session->userdata('network'); - $category = 'super'; - - $position = $this->user_model->getAllpositions($network,$category,$this->session->userdata('member_code')); - if($position!=null){ - return $position; - } - } - } - - public function getDemandes(){ - - 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); - } else { - if($this->input->post('super')) - { - //$this->session->set_userdata('current_demande_ville', $this->input->post('ville')); - - $ville = $this->session->userdata('ville'); - $data['active'] = "demandes"; - $data['type'] = $this->lang->line('crédits'); - $data['alert'] = ""; - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $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['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($this->session->userdata('member_code'),$this->session->userdata('current_demande_ville'),$this->input->post('super')); - $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($this->session->userdata('member_code'),$this->session->userdata('current_demande_ville'),$this->input->post('super')); - $data['list'] = $this->user_model->getDemandesBySuper($this->session->userdata('member_code'),$this->input->post('super')); - $data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'),$this->input->post('super')); - $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); - $this->load->view('header_hyp', $data); - $this->load->view('demande'); - $this->load->view('footer'); - } - } - } - - public function addvilles(){ - $id = 1; - $date = "2018-08-29"; - for ($i = 1; $i <= 267; $i++) { - $newdate = date("Y-m-d", strtotime($date." + 1 day + 1 hour")); - $data = array( - 'dateAjout' => $date, - 'dateModif' => $newdate, - ); - - - $newdate = date("Y-m-d", strtotime($date." + 1 day + 3 hour")); - $date = $newdate; - - $this->db->update('demande_superviseur', $data); - } - } - - public function getDemandesAd(){ - - 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); - } else { - $network = $this->session->userdata('network'); - - $data['active'] = "demandesAd"; - $data['alert'] = ""; - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($this->session->userdata('member_code')); - $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($this->session->userdata('member_code')); - $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($this->session->userdata('member_code')); - $data['list'] = $this->user_model->getDemandesAdForSuper($this->session->userdata('member_code')); - $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['type'] = $this->lang->line('Adhésion'); - $this->load->view('header_hyp', $data); - $this->load->view('demande'); - $this->load->view('footer'); - } - } - - public function wallet(){ - 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); - } else { - if(!empty($_GET)) - { // - $id_network = $this->input->get('r'); - $data["taux_com_retrait"] = ""; - $data["taux_com_ag_retrait"] = ""; - $data["taux_com_ag_depot"] = ""; - $data["com_depot"] = ""; - $data["transactions"] = ""; - $res = $this->user_model->getTaux($id_network); - if ($res!=null){ - foreach ($res->result() AS $row){ - $data["taux_com_retrait"] = $row->taux_r; - $data["taux_com_ag_depot"] = $row->taux_ag_d; - $data["taux_com_ag_retrait"] = $row->taux_ag_r; - $data["com_depot"] = $row->taux_d; - } - $data["transactions"] = $this->user_model->getTransactions($id_network); - }else{ - $data["taux_com_retrait"] = "N/A"; - $data["taux_com_ag_retrait"] = "N/A"; - $data["taux_com_ag_depot"] = "N/A"; - $data["com_depot"] = "N/A"; - $data["transactions"] = false; - } - - $data['alert'] = ""; - $data['active'] = "wallet"; - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['network_id'] = $id_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['pays'] = $this->user_model->getAllGameCountries(); - $data['networks'] = $this->user_model->getActiveNetwork(); - $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network); - $this->load->view('header_hyp',$data); - $this->load->view('gestion_wallet'); - $this->load->view('footer'); - } - } - } -} +load->model('user_model'); + } + + public function index() + { + + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + redirect('index.php', $data); + } else { + $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 = $this->user_model->getCountDemande($this->session->userdata('member_code')); + + $data['active'] = "dash"; + $data['list_geolocated_users'] = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code')); + $data['listdem'] = $this->user_model->getDemandes($this->session->userdata('member_code')); + $data['allGeo'] = $this->user_model->getAllUserGeoForHyp($this->session->userdata('member_code')); + $data['allDem'] = $this->user_model->getDemandes($this->session->userdata('member_code')); + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['member_code'] = $this->session->userdata('member_code'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $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['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_d_traite'] = $count_d_traite; + $data['count_d_no_traite'] = $count_d_no_traite; + $data['count_d_users'] = $count_d; + $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_hyp', $data); + $this->load->view('hyperviseur_dash'); + $this->load->view('footer'); + } + } + + public function getAllUser_g(){ + + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + redirect('index.php', $data); + } + else { + + if($this->input->post('ville')) + { + $this->session->set_userdata('current_ville', $this->input->post('ville')); + } + + $data['active'] = "geolocated"; + $data['total_points'] = $this->user_model->getCoutGeolocatedUsersForHyper($this->session->userdata('member_code'),$this->session->userdata('current_ville')); + $data['map_title'] = $this->lang->line('utilisateurs géolocalisés à')." ".$this->session->userdata('current_ville'); + $data['tab'] = $this->user_model->getUsersGeolocatedByVilleForHyp($this->session->userdata('current_ville'),$this->session->userdata('member_code')); + $data['positions'] = $this->user_model->getUsersGeolocatedPositionByVilleForHyp($this->session->userdata('current_ville'),$this->session->userdata('member_code')); + $data['latitude'] = $this->session->userdata('latitude'); + $data['longitude'] = $this->session->userdata('longitude'); + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $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['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); + $data['alert'] = ""; + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_hyp', $data); + $this->load->view('listeadmin'); + $this->load->view('footer'); + } + + } + + public function getAllSupervisor(){ + + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + + redirect('index.php', $data); + } + else { + + /*$this->db->select('*'); + $this->db->from('users'); + $this->db->where('category','super'); + $this->db->where('network',$this->session->userdata('network')); + $this->db->where('code_parrain',$this->session->userdata('code_parrain'));*/ + $query = $this->user_model->getSupervisorsForHyp($this->session->userdata('member_code')); + + $network = $this->session->userdata('network'); + $category = 'super'; + $position = $this->user_model->getAllpositions($network,$category,$this->session->userdata('member_code')); + if($position!=null){ + //var_dump($position); + //echo json_encode($position); + } + $data['total_points'] = $this->user_model->getCoutSuperForHyper($this->session->userdata('member_code')); + $data['positions'] = $position; + $data['active'] = "super"; + $data['map_title'] = $this->lang->line('Superviseurs'); + $data['tab'] = $query; + $data['latitude'] = $this->session->userdata('latitude'); + $data['longitude'] = $this->session->userdata('longitude'); + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $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['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); + $data['alert'] = ""; + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_hyp', $data); + $this->load->view('listeadmin'); + $this->load->view('footer'); + } + } + + public function getAllSupervisorPositions(){ + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + + redirect('index.php', $data); + } + else { + $network = $this->session->userdata('network'); + $category = 'super'; + + $position = $this->user_model->getAllpositions($network,$category,$this->session->userdata('member_code')); + if($position!=null){ + return $position; + } + } + } + + public function getDemandes(){ + + 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); + } else { + if($this->input->post('super')) + { + //$this->session->set_userdata('current_demande_ville', $this->input->post('ville')); + + $ville = $this->session->userdata('ville'); + $data['active'] = "demandes"; + $data['type'] = $this->lang->line('crédits'); + $data['alert'] = ""; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $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['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($this->session->userdata('member_code'),$this->session->userdata('current_demande_ville'),$this->input->post('super')); + $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($this->session->userdata('member_code'),$this->session->userdata('current_demande_ville'),$this->input->post('super')); + $data['list'] = $this->user_model->getDemandesBySuper($this->session->userdata('member_code'),$this->input->post('super')); + $data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'),$this->input->post('super')); + $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_hyp', $data); + $this->load->view('demande'); + $this->load->view('footer'); + } + } + } + + public function addvilles(){ + $id = 1; + $date = "2018-08-29"; + for ($i = 1; $i <= 267; $i++) { + $newdate = date("Y-m-d", strtotime($date." + 1 day + 1 hour")); + $data = array( + 'dateAjout' => $date, + 'dateModif' => $newdate, + ); + + + $newdate = date("Y-m-d", strtotime($date." + 1 day + 3 hour")); + $date = $newdate; + + $this->db->update('demande_superviseur', $data); + } + } + + public function getDemandesAd(){ + + 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); + } else { + $network = $this->session->userdata('network'); + + $data['active'] = "demandesAd"; + $data['alert'] = ""; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($this->session->userdata('member_code')); + $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($this->session->userdata('member_code')); + $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($this->session->userdata('member_code')); + $data['list'] = $this->user_model->getDemandesAdForSuper($this->session->userdata('member_code')); + $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['type'] = $this->lang->line('Adhésion'); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_hyp', $data); + $this->load->view('demande'); + $this->load->view('footer'); + } + } + + // Wallet + public function wallet(){ + 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); + } else { + $id_network = $this->session->userdata('network_id'); + $data["commission"] = ""; + $data["principal"] = ""; + $data["transactions"] = ""; + $agent_id = $this->session->userdata('agent_id'); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + + $res = $this->user_model->getWallet($agent_id); + if ($res!=null){ + $row = $res->first_row(); + $data["commission"] = $row->balance_com; + $data["principal"] = $row->balance_princ; + $agents_g = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code')); + + //Fetch all transactions of any geolocated agent of the network + $data["transactions"] = array(); + if($agents_g){ + foreach($agents_g->result() AS $row){ + $wallet = $this->user_model->getWallet($row->agent_id); + if($wallet){ + $transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id); + if($transactions){ + foreach($transactions->result() AS $trans){ + $trans->code_parrain = $row->code_parrain ; // Add code parrain to transaction + array_push( $data['transactions'], $trans); + } + } + } + } + } + + }else{ + $data["commission"] = "N/A"; + $data["principal"] = "N/A"; + $data["transactions"] = false; + } + + + $data['alert'] = ""; + $data['active'] = "wallet"; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['network_id'] = $id_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['pays'] = $this->user_model->getAllGameCountries(); + $data['networks'] = $this->user_model->getActiveNetwork(); + $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network); + $this->load->view('header_hyp',$data); + $this->load->view('gestion_wallet_hyp'); + $this->load->view('footer'); + + } + } +} diff --git a/application/controllers/Superviseur_dash.php b/application/controllers/Superviseur_dash.php index 8977f750..8c0b5566 100644 --- a/application/controllers/Superviseur_dash.php +++ b/application/controllers/Superviseur_dash.php @@ -1,165 +1,240 @@ -load->model('Users_simple'); - $this->load->model('User_model'); - } - - public function index() - { - if (!$this->session->userdata('email')) { - - $this->session->set_flashdata('error', 'log in first'); - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - redirect('index.php', $data); - - } else { - - $count_g = $this->User_model->geolocatedCountByParrain($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_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['active'] = "dash"; - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['member_code'] = $this->session->userdata('member_code'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['code_parrain'] = $this->session->userdata('parrain'); - $data['listdem'] = $this->user_model->getDemandesForSuper($this->session->userdata('member_code')); - $data['count_g_users'] = $count_g; - $data['count_d_users'] = $count_d; - $data['count_d_traite'] = $count_d_traite; - $data['count_d_no_traite'] = $count_d_no_traite; - $this->load->view('header_sup', $data); - $this->load->view('superviseur_dash'); - $this->load->view('footer'); - } - } - - public function getAllUser_g(){ - - if (!$this->session->userdata('email')) { - $this->session->set_flashdata('error', 'log in first'); - - $data['alert'] = "ok"; - $data['message'] = "Login first!"; - - - redirect('index.php', $data); - } - else { - - $position = $this->user_model->getAllpositions($this->session->userdata('network'),'geolocated',$this->session->userdata('member_code')); - - $data['active'] = "geolocated"; - $data['positions']= $position; - $numberGeo = $this->user_model->getNumberGeoBySuper($this->session->userdata('member_code')); - if($numberGeo!=false){ - $data['numberGeo'] = $numberGeo; - }else{ - $data['numberGeo'] = ""; - } - $data['map_title'] = $this->lang->line('Utilisateurs géolocalisés'); - $data['total_points'] = $this->user_model->getCoutGeolocatedUsersForSuper($this->session->userdata('member_code')); - $data['tab'] = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code')); - $data['latitude'] = $this->session->userdata('latitude'); - $data['longitude'] = $this->session->userdata('longitude'); - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['alert'] = ""; - $this->load->view('header_sup', $data); - $this->load->view('listeadmin'); - $this->load->view('footer'); - } - } - - public function getDemandes(){ - - 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); - } else { - $network = $this->session->userdata('network'); - - $data['active'] = "demandes"; - $data['type'] = $this->lang->line('crédits'); - $data['alert'] = ""; - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandes($this->session->userdata('member_code')); - $data['tab_fastDemande_s'] = $this->user_model->getRangeASCDemandesOut($this->session->userdata('member_code')); - $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandes($this->session->userdata('member_code')); - $data['tab_slowDemande_s'] = $this->user_model->getRangeDESCDemandesOut($this->session->userdata('member_code')); - $data['mydem'] = $this->user_model->getDemandesHyperForSuper($this->session->userdata('member_code')); - $data['temp_moyen'] = $this->user_model->getTempsMoyen($this->session->userdata('member_code')); - $data['temp_moyen_mine'] = $this->user_model->getTempsMoyenDemandeSup($this->session->userdata('member_code')); - $data['list'] = $this->user_model->getDemandesForSuper($this->session->userdata('member_code')); - $this->load->view('header_sup', $data); - $this->load->view('demande'); - $this->load->view('footer'); - } - } - - public function getDemandesAd(){ - - 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); - } else { - $network = $this->session->userdata('network'); - - $data['active'] = "demandesAd"; - $data['alert'] = ""; - $data['token'] = $this->session->userdata('token'); - $data['email'] = $this->session->userdata('email'); - $data['firstname'] = $this->session->userdata('firstname'); - $data['lastname'] = $this->session->userdata('lastname'); - $data['code_parrain'] = $this->session->userdata('code_parrain'); - $data['phone'] = $this->session->userdata('phone'); - $data['adresse'] = $this->session->userdata('adresse'); - $data['category'] = $this->session->userdata('category'); - $data['network'] = $this->session->userdata('network'); - $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($this->session->userdata('member_code')); - $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($this->session->userdata('member_code')); - $data['mydem'] = $this->user_model->getDemandesHyperForSuper($this->session->userdata('member_code')); - $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($this->session->userdata('member_code')); - $data['list'] = $this->user_model->getDemandesAdForSuper($this->session->userdata('member_code')); - $data['type'] = 'adhésions'; - $this->load->view('header_sup', $data); - $this->load->view('demande'); - $this->load->view('footer'); - } - } -} +load->model('Users_simple'); + $this->load->model('User_model'); + } + + public function index() + { + if (!$this->session->userdata('email')) { + + $this->session->set_flashdata('error', 'log in first'); + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + redirect('index.php', $data); + + } else { + + $count_g = $this->User_model->geolocatedCountByParrain($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_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['active'] = "dash"; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['member_code'] = $this->session->userdata('member_code'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['code_parrain'] = $this->session->userdata('parrain'); + $data['listdem'] = $this->user_model->getDemandesForSuper($this->session->userdata('member_code')); + $data['count_g_users'] = $count_g; + $data['count_d_users'] = $count_d; + $data['count_d_traite'] = $count_d_traite; + $data['count_d_no_traite'] = $count_d_no_traite; + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_sup', $data); + $this->load->view('superviseur_dash'); + $this->load->view('footer'); + } + } + + public function getAllUser_g(){ + + if (!$this->session->userdata('email')) { + $this->session->set_flashdata('error', 'log in first'); + + $data['alert'] = "ok"; + $data['message'] = "Login first!"; + + + redirect('index.php', $data); + } + else { + + $position = $this->user_model->getAllpositions($this->session->userdata('network'),'geolocated',$this->session->userdata('member_code')); + + $data['active'] = "geolocated"; + $data['positions']= $position; + $numberGeo = $this->user_model->getNumberGeoBySuper($this->session->userdata('member_code')); + if($numberGeo!=false){ + $data['numberGeo'] = $numberGeo; + }else{ + $data['numberGeo'] = ""; + } + $data['map_title'] = $this->lang->line('Utilisateurs géolocalisés'); + $data['total_points'] = $this->user_model->getCoutGeolocatedUsersForSuper($this->session->userdata('member_code')); + $data['tab'] = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code')); + $data['latitude'] = $this->session->userdata('latitude'); + $data['longitude'] = $this->session->userdata('longitude'); + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['alert'] = ""; + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_sup', $data); + $this->load->view('listeadmin'); + $this->load->view('footer'); + } + } + + public function getDemandes(){ + + 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); + } else { + $network = $this->session->userdata('network'); + + $data['active'] = "demandes"; + $data['type'] = $this->lang->line('crédits'); + $data['alert'] = ""; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandes($this->session->userdata('member_code')); + $data['tab_fastDemande_s'] = $this->user_model->getRangeASCDemandesOut($this->session->userdata('member_code')); + $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandes($this->session->userdata('member_code')); + $data['tab_slowDemande_s'] = $this->user_model->getRangeDESCDemandesOut($this->session->userdata('member_code')); + $data['mydem'] = $this->user_model->getDemandesHyperForSuper($this->session->userdata('member_code')); + $data['temp_moyen'] = $this->user_model->getTempsMoyen($this->session->userdata('member_code')); + $data['temp_moyen_mine'] = $this->user_model->getTempsMoyenDemandeSup($this->session->userdata('member_code')); + $data['list'] = $this->user_model->getDemandesForSuper($this->session->userdata('member_code')); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_sup', $data); + $this->load->view('demande'); + $this->load->view('footer'); + } + } + + public function getDemandesAd(){ + + 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); + } else { + $network = $this->session->userdata('network'); + + $data['active'] = "demandesAd"; + $data['alert'] = ""; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($this->session->userdata('member_code')); + $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($this->session->userdata('member_code')); + $data['mydem'] = $this->user_model->getDemandesHyperForSuper($this->session->userdata('member_code')); + $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($this->session->userdata('member_code')); + $data['list'] = $this->user_model->getDemandesAdForSuper($this->session->userdata('member_code')); + $data['type'] = 'adhésions'; + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $this->load->view('header_sup', $data); + $this->load->view('demande'); + $this->load->view('footer'); + } + } + + // Wallet + public function wallet(){ + 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); + } else { + $id_network = $this->session->userdata('network_id'); + $data["commission"] = ""; + $data["principal"] = ""; + $data["transactions"] = ""; + $agent_id = $this->session->userdata('agent_id'); + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + + $res = $this->user_model->getWallet($agent_id); + if ($res!=null){ + $row = $res->first_row(); + $data["commission"] = $row->balance_com; + $data["principal"] = $row->balance_princ; + $agents_g = $this->user_model->getUsersGeolocatedForSup($this->session->userdata('member_code')); + $data['agents_g'] = $agents_g; + + //Fetch all transactions of any geolocated agent of the network + $data["transactions"] = array(); + if($agents_g){ + foreach($agents_g->result() AS $row){ + $wallet = $this->user_model->getWallet($row->agent_id); + if($wallet){ + $transactions = $this->user_model->getAgentTransactions($wallet->first_row()->wallet_id); + if($transactions){ + foreach($transactions->result() AS $trans){ + $trans->agent_id = $row->agent_id ; // Add agent id to transaction + array_push( $data['transactions'], $trans); + } + } + } + } + } + + }else{ + $data["commission"] = "N/A"; + $data["principal"] = "N/A"; + $data["transactions"] = false; + } + + + $data['alert'] = ""; + $data['active'] = "wallet"; + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['code_parrain'] = $this->session->userdata('code_parrain'); + $data['phone'] = $this->session->userdata('phone'); + $data['adresse'] = $this->session->userdata('adresse'); + $data['category'] = $this->session->userdata('category'); + $data['network'] = $this->session->userdata('network'); + $data['network_id'] = $id_network; + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'],$this->session->userdata('current_pays')); + $data['pays'] = $this->user_model->getAllGameCountries(); + $data['networks'] = $this->user_model->getActiveNetwork(); + $data['agentWalletInfos'] = $this->user_model->getInfosWalletAgentForHyper($id_network); + $this->load->view('header_sup',$data); + $this->load->view('gestion_wallet_sup'); + $this->load->view('footer'); + + } + } +} diff --git a/application/controllers/Users.php b/application/controllers/Users.php index 941877d1..11748100 100644 --- a/application/controllers/Users.php +++ b/application/controllers/Users.php @@ -86,6 +86,7 @@ $this->session->set_userdata('firstname', $data->firstname); $this->session->set_userdata('lastname', $data->lastname); $this->session->set_userdata('adresse', $data->adresse); + $this->session->set_userdata('agent_id', $data->agent_id); if($user_login['user_role']==1){ $this->session->set_userdata('country', $data->country); diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 1a1d5fc7..45a755f0 100644 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -219,4 +219,16 @@ $lang['Utilisateur simple'] = 'Simple user'; $lang['Statut du compte'] = 'Account status'; $lang['Publicité'] = 'Publicity'; $lang['Gestion de la publicité'] = 'Advertising Management'; + +//Wallet +$lang['Gestion des wallets'] = 'Wallet Management'; +$lang['Réseaux activés'] = 'Activated networks'; +$lang['Configuration du wallet'] = 'Wallet configuration'; +$lang['Taux de commission client sur retrait'] = 'Customer commission rate on withdrawal'; +$lang['Taux de commission client sur dépot'] = 'Client commission rate on deposit'; +$lang['Taux de commission agent géolocalisé sur retrait'] = 'Geolocated agent commission rate on withdrawal'; +$lang['Taux de commission agent géolocalisé sur dépot'] = 'Geolocated agent commission rate on deposit'; +$lang['Taux de commission superviseur sur retrait'] = 'Supervisor commission rate on withdrawal'; +$lang['Taux de commission superviseur sur dépot'] = 'Supervisor commission rate on deposit'; +$lang['Suppression du wallet'] = 'Removal of the wallet'; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 965afb6b..5099da22 100644 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -235,4 +235,23 @@ $lang[''] = ''; $lang[''] = ''; $lang[''] = ''; + + //Wallet + $lang['Gestion des wallets'] = 'Gestion des wallets'; + $lang['Réseaux activés'] = 'Réseaux activés'; + $lang['Configuration du wallet'] = 'Configuration du wallet'; + $lang['Taux de commission client sur retrait'] = 'Taux de commission client sur retrait'; + $lang['Taux de commission client sur dépot'] = 'Taux de commission client sur dépot'; + $lang['Taux de commission agent géolocalisé sur retrait'] = 'Taux de commission agent géolocalisé sur retrait'; + $lang['Taux de commission agent géolocalisé sur dépot'] = 'Taux de commission agent géolocalisé sur dépot'; + $lang['Taux de commission superviseur sur retrait'] = 'Taux de commission superviseur sur retrait'; + $lang['Taux de commission superviseur sur dépot'] = 'Taux de commission superviseur sur dépot'; + $lang['Part de la banque sur le retrait'] = 'Part de la banque partenaire sur le retrait'; + $lang['Part de la banque sur le dépot'] = 'Part de la banque partenaire sur le dépot'; + $lang['Frais minimun de la banque sur le dépot'] = 'Frais minimun de la banque sur le dépot du client'; + $lang['Suppression du wallet'] = 'Suppression du wallet'; + $lang['Modifier la configuration'] = 'Modifier la configuration'; + $lang['Commissions Hyperviseur'] = 'Commissions Hyperviseur'; + $lang['Commissions Superviseurs'] = 'Commissions Superviseurs'; + $lang['Commissions Agents']= 'Commissions Agents'; ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index e5b7231f..9c8eb59e 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -198,7 +198,7 @@ class User_model extends CI_Model public function getUsersGeolocatedByVilleForHyp($ville,$codeHyp){ - $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname,child.solde AS solde, + $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname, child.latitude AS latitude, child.longitude AS longitude, child.etat AS active, child.code_parrain AS code_parrain,child.code_membre AS member_code, child.network AS network, child.phone AS phone, child.email AS email,dad.adresse AS supadresse, @@ -332,7 +332,7 @@ class User_model extends CI_Model public function getSupervisorsForHyp($codeHyp){ - $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname,child.solde AS solde, + $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname, child.etat AS active, child.code_parrain AS code_parrain,child.code_membre AS member_code, child.network AS network, child.phone AS phone, child.email AS email,dad.adresse AS supadresse, dad.lastname AS suplastname, dad.code_membre AS sup_code_membre,dad.code_membre AS sup_code_parrain, @@ -352,7 +352,7 @@ class User_model extends CI_Model public function getUsersGeolocatedForSup($codeSup){ - $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname,child.solde AS solde, + $query = $this->db->query("SELECT child.adresse AS adresse,child.category AS childcat,child.lastname AS lastname,child.agent_id, child.etat AS active, child.code_parrain AS code_parrain,child.code_membre AS member_code, child.network AS network, child.phone AS phone, child.email AS email,dad.adresse AS supadresse, dad.lastname AS suplastname, dad.code_membre AS sup_code_membre,dad.code_parrain AS sup_code_parrain, @@ -1652,7 +1652,7 @@ class User_model extends CI_Model public function getSuperNameAndCodeForHyp($codeHyp){ - $query = $this->db->query("SELECT child.lastname AS lastname, child.code_membre AS member_code + $query = $this->db->query("SELECT child.lastname AS lastname, child.code_membre AS member_code, child.agent_id FROM super_infos AS child INNER JOIN hyper_infos AS dad ON child.code_parrain='".$codeHyp."' @@ -1827,11 +1827,7 @@ class User_model extends CI_Model } } public function getTaux($id_network){ - $query = $this->db->query("SELECT configWallet.id, - taux_com_retrait AS taux_r, - taux_com_ag_retrait AS taux_ag_r, - com_depot AS taux_d, - taux_com_ag_depot AS taux_ag_d + $query = $this->db->query("SELECT * FROM configWallet WHERE `id_network`=".$id_network); if($query->num_rows()>0){ @@ -2010,4 +2006,106 @@ class User_model extends CI_Model $query = $this->db->query("INSERT INTO publiciteConfig(id_config,id_country, valeur_bool) VALUE (2,".$id_country.",1)"); return $query; } + + // 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 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{ + return false; + } + } + + public function getConfigWallet($id_network){ + $sql = "SELECT * FROM `configWallet` WHERE id_network = ?"; + $query = $this->db->query($sql , array($id_network)); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function addConfigWallet($network_id , $taux_client_r , $taux_client_d, $taux_ag_r , $taux_ag_d , $taux_sup_r , $taux_sup_d , $taux_bq_r , $taux_bq_d , $frais_d ){ + $sql='INSERT INTO `configWallet` (`taux_com_client_retrait`, `taux_com_client_depot`, `taux_com_ag_retrait`, `taux_com_ag_depot`, `taux_com_sup_depot`, `taux_com_sup_retrait`, `part_banque_retrait`, `part_banque_depot`, `frais_min_banque_depot`, `id_network`) VALUES ( ?, ?, ?, ?, ?, ?, ? , ? , ? ,?);' ; + $query = $this->db->query($sql , array($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 , $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 ){ + $sql= 'UPDATE `configWallet` SET `taux_com_client_retrait` = ?, `taux_com_client_depot` = ?, `taux_com_ag_retrait` = ?, `taux_com_ag_depot` = ?, `taux_com_sup_retrait` = ? , `taux_com_sup_depot` = ?, `part_banque_retrait` = ?, `part_banque_depot` = ?, `frais_min_banque_depot` = ? WHERE (`id_network` = ?);'; + $query = $this->db->query($sql , array($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 , $network_id)); + return $query; + } + + public function deleteConfigWallet($network_id){ + $query = $this->db->query("DELETE FROM `configWallet` WHERE `configWallet`.`id_network` = '".$network_id."'"); + return $query; + } + + public function getWallet($id_agent){ + $sql = "SELECT * FROM `wallet_agent` WHERE agent_id = ?"; + $query = $this->db->query($sql , array($id_agent)); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function addWallet($id_agent){ + + $sql = "SELECT * FROM `networks_agents` WHERE agent_id = ?"; + $query = $this->db->query($sql , array($id_agent)); + if($query->num_rows()>0){ + $id_networkAgent = $query->first_row()->id; + $sql = "INSERT INTO `wallets` (`id_networkAgent`) VALUES (?);"; + $query = $this->db->query($sql , array($id_networkAgent)); + return $query; + }else{ + return false; + } + + } + + public function getAgentTransactions($id_wallet){ + $query = $this->db->query("SELECT * + FROM wallet_transaction + WHERE `id_wallet`= '".$id_wallet."'"); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function getNetworkHyper($id_network){ + $sql = "SELECT * FROM `hyper_infos` WHERE network_id = ?"; + $query = $this->db->query($sql , array($id_network)); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function getAllAgentsForNetwork($id_network){ + $sql = "SELECT * FROM super_infos WHERE network_id = ?"; + $query = $this->db->query($sql , array($id_network)); + if($query->num_rows()>0){ + return $query; + }else{ + return false; + } + } + + public function reinitializeWallet($id_wallet){ + $sql = "UPDATE `wallets` SET `balance_princ` = '0', `balance_com` = '0', `created_date` = ? WHERE (`id` = ?)"; + $query = $this->db->query($sql , array(new DateTime(),$id_wallet)); + return $query; + } + } diff --git a/application/views/gestion_wallet.php b/application/views/gestion_wallet.php index 537d0430..90ada2c9 100644 --- a/application/views/gestion_wallet.php +++ b/application/views/gestion_wallet.php @@ -1,387 +1,605 @@ - - - - - - - -db->query("SELECT id FROM infos_transaction - WHERE network_id='".$network_id."' - AND MONTH(date_created) = '".$months[$i-1]."' - AND YEAR(date_created) = '".$years[$i-1]."' - AND type_transac='debit'"); - $retraits_data[] = $retraits_query_mounth->num_rows(); - } - /** - ** Dépots - **/ - $date = date("Y"); - - $depots_data[] = ''; - $depots_data =array(); - for ($i = 1; $i <= 12; $i++) { - $depots_query_mounth = $this->db->query("SELECT id FROM infos_transaction - WHERE network_id='".$network_id."' - AND MONTH(date_created) = '".$months[$i-1]."' - AND YEAR(date_created) = '".$years[$i-1]."' - AND type_transac='credit'"); - $depots_data[] = $depots_query_mounth->num_rows(); - } - - if($transactions!=false){ - $transac=$transactions->num_rows(); - $array_transac = array(); - $num = 0; - if ($transac > 0) { - foreach($transactions->result() as $row) { - $num++; - $array_transac[] = $row->type_transac; - } - $vals_transac = array_count_values($array_transac); - $pieChart = array(); - foreach(array_keys($vals_transac) as $paramName) { - $color = dechex(rand(0x000000, 0xFFFFFF)); - $trash = array("value" => $vals_transac[$paramName], - "color" => "#".$color, - "highlight" => "#".$color, - "label" => $paramName); - - $pieChart[]= $trash; - } - } - }else{ - $pieChart = array(); - } - -?> - -
- -
- -

- Gestion des wallets -

- -
- -

Erreur!

- -
- - -
- -

Success!

- -
- - -
- -
-
-
-
-
-

%

-

Taux de commission sur retraits

-
-
- -
- Modifier -
-
- -
-
-
-

%

-

Comission agent sur retrait

-
-
- -
- Modifier -
-
- -
-
-
-

FCFA

-

Comission sur dépot

-
-
- -
- Modifier -
-
- -
-
-
-

%

-

Comission agent sur dépot

-
-
- -
- Modifier -
-
- -
-
-
-

Retraits et dépots des 12 derniers moislang->line('Souscription des 12 derniers mois'); ?>

-
-
-
- -
-
-
-
-
-
-
-

Parts dépots & retraitslang->line("Utilisateurs géolocalisés par ville"); ?>

-
-
- -
-
-
- -
-
-
-

Commissions Superviseurs

-
-
- - - - - - - - - - - num_rows(); - $num = 0; - if ($numrows > 0) { - foreach($data->result() as $row) { - $num++; - echo " - - - - - "; - } - } - } - ?> - - - - - - - - -
NomSolde Com.DépotsRetraits
".$row->lastname."".$row->balance_com." 4X
TridentWin 7 4X
-
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + +db->query("SELECT id FROM infos_transaction + WHERE network_id='" . $network_id . "' + AND MONTH(date_created) = '" . $months[$i - 1] . "' + AND YEAR(date_created) = '" . $years[$i - 1] . "' + AND type_transac='debit'"); + $retraits_data[] = $retraits_query_mounth->num_rows(); +} + +$startDate = (new DateTime('01-' . $months[11] . '-' . $years[11]))->format('Y-m-d H:i:s'); +$endDate = date_create_from_format('m/Y', $months[0] . '/' . $years[0])->format('Y-m-d H:i:s'); + +$retraits = $this->db->query("SELECT * FROM infos_transaction + WHERE network_id='" . $network_id . "' + AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "' + AND type_transac='debit'"); + +/** + ** Dépots + **/ +$date = date("Y"); + +$depots_data[] = ''; +$depots_data = array(); +for ($i = 1; $i <= 12; $i++) { + $depots_query_mounth = $this->db->query("SELECT id FROM infos_transaction + WHERE network_id='" . $network_id . "' + AND MONTH(date_created) = '" . $months[$i - 1] . "' + AND YEAR(date_created) = '" . $years[$i - 1] . "' + AND type_transac='credit'"); + $depots_data[] = $depots_query_mounth->num_rows(); +} +$depots = $this->db->query("SELECT * FROM infos_transaction + WHERE network_id='" . $network_id . "' + AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "' + AND type_transac='credit'"); + +if ($transactions != false) { + $transac = $transactions->num_rows(); + $array_transac = array(); + $num = 0; + if ($transac > 0) { + foreach ($transactions->result() as $row) { + $num++; + $array_transac[] = $row->type_transac; + } + $vals_transac = array_count_values($array_transac); + $pieChart = array(); + foreach (array_keys($vals_transac) as $paramName) { + $color = dechex(rand(0x000000, 0xFFFFFF)); + $trash = array("value" => $vals_transac[$paramName], + "color" => "#" . $color, + "highlight" => "#" . $color, + "label" => $paramName); + + $pieChart[] = $trash; + } + } +} else { + $pieChart = array(); +} + +?> + +
+ +
+ +

+ Gestion des wallets +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

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

%

+

lang->line('Taux de commission client sur retrait') ?>

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

%

+

lang->line('Taux de commission agent géolocalisé sur retrait') ?>

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

%

+

lang->line('Taux de commission superviseur sur retrait') ?>

+
+
+ +
+ +
+
+
+
+
+

%

+

lang->line('Part de la banque sur le retrait') ?>

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

%

+

lang->line('Taux de commission client sur dépot') ?>

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

FCFA

+

lang->line('Frais minimun de la banque sur le dépot') ?>

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

%

+

lang->line('Taux de commission agent géolocalisé sur dépot') ?>

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

%

+

lang->line('Taux de commission superviseur sur dépot') ?>

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

%

+

lang->line('Part de la banque sur le dépot') ?>

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

Retraits et dépots des 12 derniers + moislang->line('Souscription des 12 derniers mois'); ?>

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

Parts dépots & + retraitslang->line("Utilisateurs géolocalisés par ville"); ?>

+
+
+ +
+
+
+ +
+
+
+

lang->line('Commissions Hyperviseur') ?>

+
+
+ + + + + + + + + + + + + + + "; + + echo " + + "; + + } + ?> + +
NomSolde Princ.Solde Com.DépotsRetraits
" . $walletHyper->first_row()->lastname . "" . $walletHyper->first_row()->balance_princ . "" . $walletHyper->first_row()->balance_com . "" . $depots->num_rows() . "" . $retraits->num_rows() . "
+
+
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/gestion_wallet_hyp.php b/application/views/gestion_wallet_hyp.php new file mode 100644 index 00000000..21ba4681 --- /dev/null +++ b/application/views/gestion_wallet_hyp.php @@ -0,0 +1,373 @@ + + + + + + + +date)); + $year = date("Y",strtotime($trans->date)); + return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'debit' ; + }); + $retraits_data[] = sizeof($retraits_query_mounth); + } + + $startDate = (new DateTime('01-'.$months[11].'-'.$years[11]))-> format('Y-m-d H:i:s'); + $endDate = date_create_from_format ('m/Y',$months[0].'/'.$years[0])-> format('Y-m-d H:i:s'); + + $retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ + $date = strtotime($trans->date); + return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'debit' ; + }); + + /** + ** Dépots + **/ + $date = date("Y"); + + $depots_data[] = ''; + $depots_data =array(); + for ($i = 1; $i <= 12; $i++) { + $depots_query_mounth= array_filter($transactions, function ($trans) use ($i, $months ,$years){ + $month = date("m",strtotime($trans->date)); + $year = date("Y",strtotime($trans->date)); + return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'credit' ; + }); + $depots_data[] = sizeof($depots_query_mounth); + } + $depots = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ + $date = strtotime($trans->date); + return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ; + }); + + if($transactions!=false){ + $transac=sizeof($transactions); + $array_transac = array(); + $num = 0; + if ($transac > 0) { + foreach($transactions as $row) { + $num++; + $array_transac[] = $row->type; + } + $vals_transac = array_count_values($array_transac); + $pieChart = array(); + foreach(array_keys($vals_transac) as $paramName) { + $color = dechex(rand(0x000000, 0xFFFFFF)); + $trash = array("value" => $vals_transac[$paramName], + "color" => "#".$color, + "highlight" => "#".$color, + "label" => $paramName); + + $pieChart[]= $trash; + } + } + }else{ + $pieChart = array(); + } + +?> + +
+ +
+ +

+ Wallet +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

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

FCFA

+

Solde principal

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

FCFA

+

Solde commission

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

Retraits et dépots des 12 derniers moislang->line('Souscription des 12 derniers mois'); ?>

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

Parts dépots & retraitslang->line("Utilisateurs géolocalisés par ville"); ?>

+
+
+ +
+
+
+ +
+
+
+

lang->line('Commissions Superviseurs') ?>

+
+
+ + + + + + + + + + + + result() as $row) { + $wallet = null; + foreach ($agentWalletInfos->result() as $value) { + if ($value->agent_id == $row->agent_id) { + $wallet = $value; + break; + } + } + $com = 0; + $princ = 0; + if($wallet) { + $com = $wallet->balance_com; + $princ = $wallet->balance_princ; + } + echo " + + + "; + $nb_depots = 0; + $nb_retraits = 0; + foreach($depots as $depot){ + if($depot->code_parrain == $row->member_code) { + $nb_depots ++; + } + } + foreach($retraits as $retrait){ + if($retrait->code_parrain == $row->member_code) { + $nb_retraits ++; + } + } + echo " + + "; + } + + } + ?> + +
NomSolde Princ.Solde Com.DépotsRetraits
".$row->lastname."".$princ."".$com."".$nb_depots."".$nb_retraits."
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/gestion_wallet_sup.php b/application/views/gestion_wallet_sup.php new file mode 100644 index 00000000..b84f3c51 --- /dev/null +++ b/application/views/gestion_wallet_sup.php @@ -0,0 +1,371 @@ + + + + + + + +date)); + $year = date("Y",strtotime($trans->date)); + return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'debit' ; + }); + $retraits_data[] = sizeof($retraits_query_mounth); + } + + $startDate = (new DateTime('01-'.$months[11].'-'.$years[11]))-> format('Y-m-d H:i:s'); + $endDate = date_create_from_format ('m/Y',$months[0].'/'.$years[0])-> format('Y-m-d H:i:s'); + + $retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ + $date = strtotime($trans->date); + return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'debit' ; + }); + + /** + ** Dépots + **/ + $date = date("Y"); + + $depots_data[] = ''; + $depots_data =array(); + for ($i = 1; $i <= 12; $i++) { + $depots_query_mounth= array_filter($transactions, function ($trans) use ($i, $months ,$years){ + $month = date("m",strtotime($trans->date)); + $year = date("Y",strtotime($trans->date)); + return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type == 'credit' ; + }); + $depots_data[] = sizeof($depots_query_mounth); + } + $depots = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){ + $date = strtotime($trans->date); + return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ; + }); + + if($transactions!=false){ + $transac=sizeof($transactions); + $array_transac = array(); + $num = 0; + if ($transac > 0) { + foreach($transactions as $row) { + $num++; + $array_transac[] = $row->type; + } + $vals_transac = array_count_values($array_transac); + $pieChart = array(); + foreach(array_keys($vals_transac) as $paramName) { + $color = dechex(rand(0x000000, 0xFFFFFF)); + $trash = array("value" => $vals_transac[$paramName], + "color" => "#".$color, + "highlight" => "#".$color, + "label" => $paramName); + + $pieChart[]= $trash; + } + } + }else{ + $pieChart = array(); + } + +?> + +
+ +
+ +

+ Wallet +

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

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

FCFA

+

Solde principal

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

FCFA

+

Solde commission

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

Retraits et dépots des 12 derniers moislang->line('Souscription des 12 derniers mois'); ?>

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

Parts dépots & retraitslang->line("Utilisateurs géolocalisés par ville"); ?>

+
+
+ +
+
+
+ +
+
+
+

lang->line('Commissions Agents') ?>

+
+
+ + + + + + + + + + + + result() as $row) { + $wallet = null; + foreach ($agentWalletInfos->result() as $value) { + if ($value->agent_id == $row->agent_id) { + $wallet = $value; + break; + } + } + $com = 0; + $princ = 0; + if($wallet) { + $com = $wallet->balance_com; + $princ = $wallet->balance_princ; + } + echo " + + + "; + $nb_depots = 0; + $nb_retraits = 0; + foreach($depots as $depot){ + if($depot->agent_id == $row->agent_id) { + $nb_depots ++; + } + } + foreach($retraits as $retrait){ + if($retrait->agent_id == $row->agent_id) { + $nb_retraits ++; + } + } + echo " + + "; + } + + } + ?> + +
NomSolde Princ.Solde Com.DépotsRetraits
".$row->lastname."".$princ."".$com."".$nb_depots."".$nb_retraits."
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/gestion_wallets.php b/application/views/gestion_wallets.php new file mode 100755 index 00000000..689db51f --- /dev/null +++ b/application/views/gestion_wallets.php @@ -0,0 +1,335 @@ + + + +
+ +
+ +

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

+ +
+ +

Erreur!

+ +
+ + +
+ +

Success!

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

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

+
+
+ + num_rows(); + $num = 0; + if ($numrows > 0) { + ?> + + + + + + + + + + + + + result() as $row) { + $num ++; + //$member_code = randomString1(10); + echo " + + + "; + ?> + id_network){ + ?> + + + + + + + + + +
lang->line('Reseau'); ?>lang->line('Pays'); ?> Wallet lang->line('Activer/Désactiver'); ?> Action
$num$row->network$row->countrylang->line('Actif'); ?>lang->line('Inactif'); ?> + id_network) echo "disabled"?> > + lang->line('Voir plus...'); ?> + +
+ + lang->line('Aucun réseau'); + } + }else { + echo $this->lang->line('Aucun réseau'); + } + ?> +
+
+
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/header_gestion.php b/application/views/header_gestion.php index c9561968..98fb685c 100644 --- a/application/views/header_gestion.php +++ b/application/views/header_gestion.php @@ -143,7 +143,7 @@
  • "> - + Walletlang->line('Game'); ?>
  • @@ -199,47 +199,47 @@ - + + + + + + + + +lang->line('Sélectionnez le pays'); ?> + + + + + +num_rows(); +// +// if ($numrows > 0) { ?> + +result() as $row) { +// +// echo ""; +// } ?> + + + + + + + +lang->line('Fermer'); ?> +lang->line('Continuer'); ?> + + + + + diff --git a/application/views/header_hyp.php b/application/views/header_hyp.php index 892aae48..d85330d7 100644 --- a/application/views/header_hyp.php +++ b/application/views/header_hyp.php @@ -1,245 +1,245 @@ - - - - - - - - iLink | Hyperviseur - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - - - - -
    - - - - - - - + + + + + + + + iLink | Hyperviseur + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + +
    + + + + + + + diff --git a/application/views/header_sup.php b/application/views/header_sup.php index c8f8c4f8..66943bdf 100644 --- a/application/views/header_sup.php +++ b/application/views/header_sup.php @@ -1,128 +1,136 @@ - - - - - - - iLink | Superviseur - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - - + + + + + + + iLink | Superviseur + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + + diff --git a/composer.json b/composer.json index 6cff218e..26a974aa 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "source": "https://github.com/bcit-ci/CodeIgniter" }, "require": { - "php": ">=5.3.7" + "php": ">=5.4" }, "suggest": { "paragonie/random_compat": "Provides better randomness in PHP 5.x" diff --git a/dist/js/sweetalert2.js b/dist/js/sweetalert2.js new file mode 100644 index 00000000..1536b5b9 --- /dev/null +++ b/dist/js/sweetalert2.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sweetalert2=e()}(this,function(){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;nt.clientHeight)}function it(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return 0\n
    \n
      \n
      \n
      \n
      \n
      \n
      \n \n

      \n \n
      \n
      \n
      \n \n \n
      \n \n \n
      \n \n
      \n \n \n
      \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n').replace(/(^|\n)\s*/g,""),gt=function(t){var e,n=!!(e=K())&&(e.parentNode.removeChild(e),pt([document.documentElement,document.body],[z["no-backdrop"],z["toast-shown"],z["has-column"]]),!0);if(at())v("SweetAlert2 requires document to initialize");else{var o=document.createElement("div");o.className=z.container,n&&dt(o,z["no-transition"]),V(o,ht);var i,r,a,c,s,u,l,d,p,f,m,h,g="string"==typeof(i=t.target)?document.querySelector(i):i;g.appendChild(o),r=t,(a=Y()).setAttribute("role",r.toast?"alert":"dialog"),a.setAttribute("aria-live",r.toast?"polite":"assertive"),r.toast||a.setAttribute("aria-modal","true"),c=g,"rtl"===window.getComputedStyle(c).direction&&dt(K(),z.rtl),s=x(),u=ft(s,z.input),l=ft(s,z.file),d=s.querySelector(".".concat(z.range," input")),p=s.querySelector(".".concat(z.range," output")),f=ft(s,z.select),m=s.querySelector(".".concat(z.checkbox," input")),h=ft(s,z.textarea),u.oninput=ct,l.onchange=ct,f.onchange=ct,m.onchange=ct,h.oninput=ct,d.oninput=function(t){ct(t),p.value=d.value},d.onchange=function(t){ct(t),d.nextSibling.value=d.value}}},vt=function(t,e){t.jquery?bt(e,t):V(e,t.toString())},bt=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},yt=function(){if(at())return!1;var t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&void 0!==t.style[n])return e[n];return!1}();function wt(t,e,n){var o;nt(t,n["show".concat((o=e).charAt(0).toUpperCase()+o.slice(1),"Button")],"inline-block"),V(t,n["".concat(e,"ButtonText")]),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]),t.className=z[e],H(t,n,"".concat(e,"Button")),dt(t,n["".concat(e,"ButtonClass")])}function Ct(t,e){var n=K();if(n){var o,i,r,a;o=n,"string"==typeof(i=e.backdrop)?o.style.background=i:i||dt([document.documentElement,document.body],z["no-backdrop"]),!e.backdrop&&e.allowOutsideClick&&N('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),r=n,(a=e.position)in z?dt(r,z[a]):(N('The "position" parameter is not valid, defaulting to "center"'),dt(r,z.center)),function(t,e){if(e&&"string"==typeof e){var n="grow-".concat(e);n in z&&dt(t,z[n])}}(n,e.grow),H(n,e,"container");var c=document.body.getAttribute("data-swal2-queue-step");c&&(n.setAttribute("data-queue-step",c),document.body.removeAttribute("data-swal2-queue-step"))}}function kt(t,e){t.placeholder&&!e.inputPlaceholder||(t.placeholder=e.inputPlaceholder)}var xt={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},Pt=["input","file","range","select","radio","checkbox","textarea"],At=function(t){if(!Ot[t.input])return v('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(t.input,'"'));var e=Et(t.input),n=Ot[t.input](e,t);tt(n),setTimeout(function(){J(n)})},Bt=function(t,e){var n=$(x(),t);if(n)for(var o in!function(t){for(var e=0;e=s.progressSteps.length&&N("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),s.progressSteps.forEach(function(t,e){var n,o,i,r,a=(n=t,o=document.createElement("li"),dt(o,z["progress-step"]),V(o,n),o);if(u.appendChild(a),e===l&&dt(a,z["active-progress-step"]),e!==s.progressSteps.length-1){var c=(i=t,r=document.createElement("li"),dt(r,z["progress-step-line"]),i.progressStepsDistance&&(r.style.width=i.progressStepsDistance),r);u.appendChild(c)}})}function It(t,e){var n,o,i,r,a=T();H(a,e,"header"),qt(0,e),function(t,e){var n=xt.innerParams.get(t);if(n&&e.icon===n.icon&&C())H(C(),e,"icon");else if(Vt(),e.icon)if(-1!==Object.keys(W).indexOf(e.icon)){var o=w(".".concat(z.icon,".").concat(W[e.icon]));tt(o),Ht(o,e),Rt(),H(o,e,"icon"),dt(o,e.showClass.icon)}else v('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"'))}(t,e),function(t){var e=P();if(!t.imageUrl)return et(e);tt(e),e.setAttribute("src",t.imageUrl),e.setAttribute("alt",t.imageAlt),G(e,"width",t.imageWidth),G(e,"height",t.imageHeight),e.className=z.image,H(e,t,"image")}(e),n=e,o=k(),nt(o,n.title||n.titleText),n.title&&st(n.title,o),n.titleText&&(o.innerText=n.titleText),H(o,n,"title"),i=e,r=I(),V(r,i.closeButtonHtml),H(r,i,"closeButton"),nt(r,i.showCloseButton),r.setAttribute("aria-label",i.closeButtonAriaLabel)}function jt(t,e){var n,o,i,r;n=e,o=Y(),G(o,"width",n.width),G(o,"padding",n.padding),n.background&&(o.style.background=n.background),Ut(o,n),Ct(0,e),It(t,e),Tt(t,e),ut(0,e),i=e,r=L(),nt(r,i.footer),i.footer&&st(i.footer,r),H(r,i,"footer"),"function"==typeof e.onRender&&e.onRender(Y())}function Mt(){return S()&&S().click()}var Vt=function(){for(var t=n(),e=0;e
      \n \n
      \n
      \n ');else if("error"===e.icon)V(t,'\n \n \n \n \n ');else{V(t,Dt({question:"?",warning:"!",info:"i"}[e.icon]))}},Dt=function(t){return'
      ').concat(t,"
      ")},Nt=[],Ut=function(t,e){t.className="".concat(z.popup," ").concat(mt(t)?e.showClass.popup:""),e.toast?(dt([document.documentElement,document.body],z["toast-shown"]),dt(t,z.toast)):dt(t,z.modal),H(t,e,"popup"),"string"==typeof e.customClass&&dt(t,e.customClass),e.icon&&dt(t,z["icon-".concat(e.icon)])};function _t(){var t=Y();t||nn.fire(),t=Y();var e=O(),n=S();tt(e),tt(n,"inline-block"),dt([t,e],z.loading),n.disabled=!0,t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()}function Ft(){return new Promise(function(t){var e=window.scrollX,n=window.scrollY;Zt.restoreFocusTimeout=setTimeout(function(){Zt.previousActiveElement&&Zt.previousActiveElement.focus?(Zt.previousActiveElement.focus(),Zt.previousActiveElement=null):document.body&&document.body.focus(),t()},100),void 0!==e&&void 0!==n&&window.scrollTo(e,n)})}function zt(){if(Zt.timeout)return function(){var t=q(),e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";var n=parseInt(window.getComputedStyle(t).width),o=parseInt(e/n*100);t.style.removeProperty("transition"),t.style.width="".concat(o,"%")}(),Zt.timeout.stop()}function Wt(){if(Zt.timeout){var t=Zt.timeout.start();return rt(t),t}}function Kt(t){return Object.prototype.hasOwnProperty.call(Qt,t)}function Yt(t){return Jt[t]}var Zt={},Qt={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconHtml:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:void 0,target:"body",backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,onBeforeOpen:void 0,onOpen:void 0,onRender:void 0,onClose:void 0,onAfterClose:void 0,onDestroy:void 0,scrollbarPadding:!0},$t=["title","titleText","text","html","icon","hideClass","customClass","allowOutsideClick","allowEscapeKey","showConfirmButton","showCancelButton","confirmButtonText","confirmButtonAriaLabel","confirmButtonColor","cancelButtonText","cancelButtonAriaLabel","cancelButtonColor","buttonsStyling","reverseButtons","imageUrl","imageWidth","imageHeight","imageAlt","progressSteps","currentProgressStep"],Jt={animation:'showClass" and "hideClass'},Xt=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusCancel","heightAuto","keydownListenerCapture"],Gt=Object.freeze({isValidParameter:Kt,isUpdatableParameter:function(t){return-1!==$t.indexOf(t)},isDeprecatedParameter:Yt,argsToParams:function(o){var i={};return"object"!==r(o[0])||y(o[0])?["title","html","icon"].forEach(function(t,e){var n=o[e];"string"==typeof n||y(n)?i[t]=n:void 0!==n&&v("Unexpected type of ".concat(t,'! Expected "string" or "Element", got ').concat(r(n)))}):s(i,o[0]),i},isVisible:function(){return mt(Y())},clickConfirm:Mt,clickCancel:function(){return E()&&E().click()},getContainer:K,getPopup:Y,getTitle:k,getContent:x,getHtmlContainer:function(){return e(z["html-container"])},getImage:P,getIcon:C,getIcons:n,getCloseButton:I,getActions:O,getConfirmButton:S,getCancelButton:E,getHeader:T,getFooter:L,getTimerProgressBar:q,getFocusableElements:j,getValidationMessage:B,isLoading:function(){return Y().hasAttribute("data-loading")},fire:function(){for(var t=arguments.length,e=new Array(t),n=0;nwindow.innerHeight&&(Q.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Q.previousBodyPadding+function(){var t=document.createElement("div");t.className=z["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))}function ne(){return!!window.MSInputMethodContext&&!!document.documentMode}function oe(){var t=K(),e=Y();t.style.removeProperty("align-items"),e.offsetTop<0&&(t.style.alignItems="flex-start")}var ie=function(){var e,t=K();t.ontouchstart=function(t){e=re(t.target)},t.ontouchmove=function(t){e&&(t.preventDefault(),t.stopPropagation())}},re=function(t){var e=K();return t===e||!(ot(e)||"INPUT"===t.tagName||ot(x())&&x().contains(t))},ae={swalPromiseResolve:new WeakMap};function ce(t,e,n,o){n?le(t,o):(Ft().then(function(){return le(t,o)}),Zt.keydownTarget.removeEventListener("keydown",Zt.keydownHandler,{capture:Zt.keydownListenerCapture}),Zt.keydownHandlerAdded=!1),e.parentNode&&!document.body.getAttribute("data-swal2-queue-step")&&e.parentNode.removeChild(e),M()&&(null!==Q.previousBodyPadding&&(document.body.style.paddingRight="".concat(Q.previousBodyPadding,"px"),Q.previousBodyPadding=null),function(){if(R(document.body,z.iosfix)){var t=parseInt(document.body.style.top,10);pt(document.body,z.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}}(),"undefined"!=typeof window&&ne()&&window.removeEventListener("resize",oe),h(document.body.children).forEach(function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})),pt([document.documentElement,document.body],[z.shown,z["height-auto"],z["no-backdrop"],z["toast-shown"],z["toast-column"]])}function se(t){var e=Y();if(e){var n=xt.innerParams.get(this);if(n&&!R(e,n.hideClass.popup)){var o=ae.swalPromiseResolve.get(this);pt(e,n.showClass.popup),dt(e,n.hideClass.popup);var i=K();pt(i,n.showClass.backdrop),dt(i,n.hideClass.backdrop),function(t,e,n){var o=K(),i=yt&&it(e),r=n.onClose,a=n.onAfterClose;if(r!==null&&typeof r==="function"){r(e)}if(i){ue(t,e,o,a)}else{ce(t,o,Z(),a)}}(this,e,n),o(t||{})}}}var ue=function(t,e,n,o){Zt.swalCloseEventFinishedCallback=ce.bind(null,t,n,Z(),o),e.addEventListener(yt,function(t){t.target===e&&(Zt.swalCloseEventFinishedCallback(),delete Zt.swalCloseEventFinishedCallback)})},le=function(t,e){setTimeout(function(){"function"==typeof e&&e(),t._destroy()})};function de(t,e,n){var o=xt.domCache.get(t);e.forEach(function(t){o[t].disabled=n})}function pe(t,e){if(!t)return!1;if("radio"===t.type)for(var n=t.parentNode.parentNode.querySelectorAll("input"),o=0;o")),gt(t)}function ge(t){var e=K(),n=Y();"function"==typeof t.onBeforeOpen&&t.onBeforeOpen(n),Se(e,n,t),Ae(e,n),M()&&Be(e,t.scrollbarPadding),Z()||Zt.previousActiveElement||(Zt.previousActiveElement=document.activeElement),"function"==typeof t.onOpen&&setTimeout(function(){return t.onOpen(n)}),pt(e,z["no-transition"])}function ve(t){var e=Y();if(t.target===e){var n=K();e.removeEventListener(yt,ve),n.style.overflowY="auto"}}function be(t,e){"select"===e.input||"radio"===e.input?Le(t,e):-1!==["text","email","number","tel","textarea"].indexOf(e.input)&&b(e.inputValue)&&qe(t,e)}function ye(t,e){t.disableButtons(),e.input?Me(t,e):Ve(t,e,!0)}function we(t,e){t.disableButtons(),e(F.cancel)}function Ce(t,e){t.closePopup({value:e})}function ke(e,t,n,o){t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1),n.toast||(t.keydownHandler=function(t){return De(e,t,o)},t.keydownTarget=n.keydownListenerCapture?window:Y(),t.keydownListenerCapture=n.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)}function xe(t,e,n){var o=j(),i=0;if(i:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-no-transition{transition:none!important}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent!important;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:\"\";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;height:.25em;overflow:hidden;border-bottom-right-radius:.3125em;border-bottom-left-radius:.3125em}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;align-items:center;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close::-moz-focus-inner{border:0}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent!important}body.swal2-no-backdrop .swal2-container>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-container.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-top-left,body.swal2-no-backdrop .swal2-container.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-top-end,body.swal2-no-backdrop .swal2-container.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-container.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-left,body.swal2-no-backdrop .swal2-container.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-end,body.swal2-no-backdrop .swal2-container.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom-left,body.swal2-no-backdrop .swal2-container.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-bottom-end,body.swal2-no-backdrop .swal2-container.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}"); \ No newline at end of file