+ Cancel transaction

This commit is contained in:
Djery-Tom 2020-06-08 19:54:36 +01:00
parent 60a1f1149d
commit 14d096a559
7 changed files with 483 additions and 305 deletions

View File

@ -1879,5 +1879,43 @@ class Gestion extends CI_Controller
} }
} }
public function cancelTransation()
{
if($this->isLogged()) {
if (isset($_POST)) {
$id_transacton = $_POST['id_transaction'];
/* API URL */
$url = 'http://localhost:8081/transactions/'.$id_transacton;
/* Init cURL resource */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
/* set the content type json */
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization: yhSTSSqIO1uSE1icu09edPOeSFGxIDjo'
));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* execute request */
$result = curl_exec($ch);
/* close cURL resource */
curl_close($ch);
if ($result) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
} }

View File

@ -1,211 +1,210 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: Hanry Nzale * User: Hanry Nzale
* Date: 03/08/2018 * Date: 03/08/2018
* Time: 02:03 * Time: 02:03
*/ */
class Hyperviseur_dash extends CI_Controller class Hyperviseur_dash extends CI_Controller
{ {
public function _contruct() public function _contruct()
{ {
parent::_contruct(); parent::_contruct();
$this->load->model('user_model'); $this->load->model('user_model');
date_default_timezone_set ($this->session->userdata('timezone')); date_default_timezone_set($this->session->userdata('timezone'));
} }
public function index() public function index()
{ {
if (!$this->session->userdata('email')) { if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first'); $this->session->set_flashdata('error', 'log in first');
$data['alert'] = "ok"; $data['alert'] = "ok";
$data['message'] = "Login first!"; $data['message'] = "Login first!";
redirect('index.php', $data); redirect('index.php', $data);
} else { } else {
$count_d_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'),1); $count_d_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), 1);
$count_d_no_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'),0); $count_d_no_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), 0);
$count_d = $this->user_model->getCountDemande($this->session->userdata('member_code')); $count_d = $this->user_model->getCountDemande($this->session->userdata('member_code'));
$data['active'] = "dash"; $data['active'] = "dash";
$data['list_geolocated_users'] = $this->user_model->getAllGeolocatedUsersForHyp($this->session->userdata('member_code')); $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['listdem'] = $this->user_model->getDemandes($this->session->userdata('member_code'));
$data['allGeo'] = $this->user_model->getAllUserGeoForHyp($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['allDem'] = $this->user_model->getDemandes($this->session->userdata('member_code'));
$data['token'] = $this->session->userdata('token'); $data['token'] = $this->session->userdata('token');
$data['email'] = $this->session->userdata('email'); $data['email'] = $this->session->userdata('email');
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname'); $data['lastname'] = $this->session->userdata('lastname');
$data['member_code'] = $this->session->userdata('member_code'); $data['member_code'] = $this->session->userdata('member_code');
$data['phone'] = $this->session->userdata('phone'); $data['phone'] = $this->session->userdata('phone');
$data['adresse'] = $this->session->userdata('adresse'); $data['adresse'] = $this->session->userdata('adresse');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'],$this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['count_geo'] = $this->user_model->countUserGeoForHyp($this->session->userdata('member_code')); $data['count_geo'] = $this->user_model->countUserGeoForHyp($this->session->userdata('member_code'));
$data['count_sup'] = $this->user_model->countUser("super",'all',$this->session->userdata('member_code')); $data['count_sup'] = $this->user_model->countUser("super", 'all', $this->session->userdata('member_code'));
$data['count_d_traite'] = $count_d_traite; $data['count_d_traite'] = $count_d_traite;
$data['count_d_no_traite'] = $count_d_no_traite; $data['count_d_no_traite'] = $count_d_no_traite;
$data['count_d_users'] = $count_d; $data['count_d_users'] = $count_d;
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); $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')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('listeadmin'); $this->load->view('hyperviseur_dash');
$this->load->view('footer'); $this->load->view('footer');
} }
}
} public function getAllUser_g()
{
public function getAllSupervisor(){ if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first');
if (!$this->session->userdata('email')) { $data['alert'] = "ok";
$this->session->set_flashdata('error', 'log in first'); $data['message'] = "Login first!";
$data['alert'] = "ok"; redirect('index.php', $data);
$data['message'] = "Login first!"; } else {
if ($this->input->post('ville')) {
$this->session->set_userdata('current_ville', $this->input->post('ville'));
}
redirect('index.php', $data); $data['active'] = "geolocated";
} $data['total_points'] = $this->user_model->getCoutGeolocatedUsersForHyper($this->session->userdata('member_code'), $this->session->userdata('current_ville'));
else { $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'));
/*$this->db->select('*'); $data['positions'] = $this->user_model->getUsersGeolocatedPositionByVilleForHyp($this->session->userdata('current_ville'), $this->session->userdata('member_code'));
$this->db->from('users'); $data['latitude'] = $this->session->userdata('latitude');
$this->db->where('category','super'); $data['longitude'] = $this->session->userdata('longitude');
$this->db->where('network',$this->session->userdata('network')); $data['token'] = $this->session->userdata('token');
$this->db->where('code_parrain',$this->session->userdata('code_parrain'));*/ $data['email'] = $this->session->userdata('email');
$query = $this->user_model->getSupervisorsForHyp($this->session->userdata('member_code')); $data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname');
$network = $this->session->userdata('network'); $data['code_parrain'] = $this->session->userdata('code_parrain');
$category = 'super'; $data['phone'] = $this->session->userdata('phone');
$position = $this->user_model->getAllpositions($network,$category,$this->session->userdata('member_code')); $data['adresse'] = $this->session->userdata('adresse');
if($position!=null){ $data['category'] = $this->session->userdata('category');
//var_dump($position); $data['network'] = $this->session->userdata('network');
//echo json_encode($position); $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['total_points'] = $this->user_model->getCoutSuperForHyper($this->session->userdata('member_code')); $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
$data['positions'] = $position; $data['alert'] = "";
$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')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('listeadmin'); $this->load->view('listeadmin');
$this->load->view('footer'); $this->load->view('footer');
} }
}
public function getAllSupervisorPositions(){ }
if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first');
$data['alert'] = "ok"; public function getAllSupervisor()
$data['message'] = "Login first!"; {
if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first');
$data['alert'] = "ok";
$data['message'] = "Login first!";
redirect('index.php', $data); redirect('index.php', $data);
} } else {
else {
$network = $this->session->userdata('network');
$category = 'super';
$position = $this->user_model->getAllpositions($network,$category,$this->session->userdata('member_code')); /*$this->db->select('*');
if($position!=null){ $this->db->from('users');
return $position; $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'));
public function getDemandes(){ $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');
}
}
if (!$this->session->userdata('email')) { public function getAllSupervisorPositions()
$this->session->set_flashdata('error', 'log in first'); {
$data['alert'] = "ok"; if (!$this->session->userdata('email')) {
$data['message'] = "Login first!"; $this->session->set_flashdata('error', 'log in first');
$this->load->view('login', $data);
} else { $data['alert'] = "ok";
if($this->input->get("u") !== null) $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->get("u") !== null) {
$super = $this->input->get("u"); $super = $this->input->get("u");
$this->session->set_userdata("current_super_demande", $super); $this->session->set_userdata("current_super_demande", $super);
$debut =""; $debut = "";
$fin = ""; $fin = "";
if($this->input->get("d") !== null){ if ($this->input->get("d") !== null) {
$debut = $this->input->get("d"); $debut = $this->input->get("d");
$fin = $this->input->get("f"); $fin = $this->input->get("f");
}else{ } else {
$fin = date('Y-m-d'); $fin = date('Y-m-d');
$debut = Date('Y-m-d', strtotime("-5 days")); $debut = Date('Y-m-d', strtotime("-5 days"));
} }
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ; $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
$data['debut'] = $debut ? date($format, strtotime($debut)) : null ; $data['debut'] = $debut ? date($format, strtotime($debut)) : null;
$data['fin'] = $fin ?date($format, strtotime($fin)): null ; $data['fin'] = $fin ? date($format, strtotime($fin)) : null;
$fin = Date('Y-m-d', strtotime($fin."+1 day")); $fin = Date('Y-m-d', strtotime($fin . "+1 day"));
$ville = $this->session->userdata('ville'); $ville = $this->session->userdata('ville');
$data['active'] = "demandes"; $data['active'] = "demandes";
@ -221,12 +220,12 @@ class Hyperviseur_dash extends CI_Controller
$data['adresse'] = $this->session->userdata('adresse'); $data['adresse'] = $this->session->userdata('adresse');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'],$this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($debut,$fin,$this->session->userdata('member_code'),$this->session->userdata('current_demande_ville'),$super); $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville'), $super);
$data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($debut,$fin,$this->session->userdata('member_code'),$this->session->userdata('current_demande_ville'),$super); $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesByNetwork($debut, $fin, $this->session->userdata('member_code'), $this->session->userdata('current_demande_ville'), $super);
$data['list'] = $this->user_model->getDemandesBySuper($this->session->userdata('member_code'),$super); $data['list'] = $this->user_model->getDemandesBySuper($this->session->userdata('member_code'), $super);
$data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'),$super,$this->session->userdata('network')); $data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'), $super, $this->session->userdata('network'));
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['nameOfcurentGeolocatedUser'] = $this->user_model->nameOfCurrentGeolocatedUser_forSuper($super); $data['nameOfcurentGeolocatedUser'] = $this->user_model->nameOfCurrentGeolocatedUser_forSuper($super);
@ -235,83 +234,86 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('footer'); $this->load->view('footer');
} }
} }
} }
public function addvilles(){ public function addvilles()
$id = 1; {
$date = "2018-08-29"; $id = 1;
for ($i = 1; $i <= 267; $i++) { $date = "2018-08-29";
$newdate = date("Y-m-d", strtotime($date." + 1 day + 1 hour")); for ($i = 1; $i <= 267; $i++) {
$data = array( $newdate = date("Y-m-d", strtotime($date . " + 1 day + 1 hour"));
'dateAjout' => $date, $data = array(
'dateModif' => $newdate, 'dateAjout' => $date,
); 'dateModif' => $newdate,
);
$newdate = date("Y-m-d", strtotime($date." + 1 day + 3 hour")); $newdate = date("Y-m-d", strtotime($date . " + 1 day + 3 hour"));
$date = $newdate; $date = $newdate;
$this->db->update('demande_superviseur', $data); $this->db->update('demande_superviseur', $data);
} }
} }
public function getDemandesAd(){ public function getDemandesAd()
{
if (!$this->session->userdata('email')) { if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first'); $this->session->set_flashdata('error', 'log in first');
$data['alert'] = "ok"; $data['alert'] = "ok";
$data['message'] = "Login first!"; $data['message'] = "Login first!";
$this->load->view('login', $data); $this->load->view('login', $data);
} else { } else {
$network = $this->session->userdata('network'); $network = $this->session->userdata('network');
$debut = $this->input->get("d"); $debut = $this->input->get("d");
$fin = $this->input->get("f"); $fin = $this->input->get("f");
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ; $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
$data['debut'] = $debut ? date($format, strtotime($debut)) : null ; $data['debut'] = $debut ? date($format, strtotime($debut)) : null;
$data['fin'] = $fin ?date($format, strtotime($fin)): null ; $data['fin'] = $fin ? date($format, strtotime($fin)) : null;
$data['demand_type'] = 'adhesion'; $data['demand_type'] = 'adhesion';
$data['active'] = "demandesAd"; $data['active'] = "demandesAd";
$data['alert'] = ""; $data['alert'] = "";
$data['token'] = $this->session->userdata('token'); $data['token'] = $this->session->userdata('token');
$data['email'] = $this->session->userdata('email'); $data['email'] = $this->session->userdata('email');
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
$data['lastname'] = $this->session->userdata('lastname'); $data['lastname'] = $this->session->userdata('lastname');
$data['code_parrain'] = $this->session->userdata('code_parrain'); $data['code_parrain'] = $this->session->userdata('code_parrain');
$data['phone'] = $this->session->userdata('phone'); $data['phone'] = $this->session->userdata('phone');
$data['adresse'] = $this->session->userdata('adresse'); $data['adresse'] = $this->session->userdata('adresse');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
$data['network'] = $this->session->userdata('network'); $data['network'] = $this->session->userdata('network');
$data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($debut, $fin ,$this->session->userdata('member_code')); $data['tab_fastDemande'] = $this->user_model->getRangeASCDemandesAd($debut, $fin, $this->session->userdata('member_code'));
$data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($debut, $fin ,$this->session->userdata('member_code')); $data['tab_slowDemande'] = $this->user_model->getRangeDESCDemandesAd($debut, $fin, $this->session->userdata('member_code'));
$data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin ,$this->session->userdata('member_code')); $data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin, $this->session->userdata('member_code'));
$data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin , $this->session->userdata('member_code')); $data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin, $this->session->userdata('member_code'));
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'],$this->session->userdata('current_pays')); $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code')); $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
$data['type'] = $this->lang->line('Adhésion'); $data['type'] = $this->lang->line('Adhésion');
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('demande_adhesion'); $this->load->view('demande_adhesion');
$this->load->view('footer'); $this->load->view('footer');
} }
} }
// Wallet // Wallet
public function wallet(){ public function wallet()
if (!$this->session->userdata('email')) { {
$this->session->set_flashdata('error', 'log in first'); if (!$this->session->userdata('email')) {
$this->session->set_flashdata('error', 'log in first');
$data['alert'] = "ok"; $data['alert'] = "ok";
$data['message'] = "Login first!"; $data['message'] = "Login first!";
$this->load->view('login', $data); $this->load->view('login', $data);
} else { } else {
$id_network = $this->session->userdata('network_id'); $id_network = $this->session->userdata('network_id');
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
if ($data['hasWallet']) { if ($data['hasWallet']) {
if($this->input->get('history')){ if ($this->input->get('history')) {
$this->historique($id_network,$this->input->get('d'),$this->input->get('f'),$this->input->get('history')); $this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
}else { } else {
$data["commission"] = ""; $data["commission"] = "";
$data["principal"] = ""; $data["principal"] = "";
@ -321,7 +323,7 @@ class Hyperviseur_dash extends CI_Controller
$taux = $data['hasWallet']->first_row(); $taux = $data['hasWallet']->first_row();
$data['idConfig'] = $taux->id; $data['idConfig'] = $taux->id;
if ($data['hasWallet']->first_row()->type == 'visa'){ if ($data['hasWallet']->first_row()->type == 'visa') {
$data['taux_client_r'] = $taux->taux_com_client_retrait; $data['taux_client_r'] = $taux->taux_com_client_retrait;
$data['taux_client_d'] = $taux->taux_com_client_depot; $data['taux_client_d'] = $taux->taux_com_client_depot;
$data['taux_ag_r'] = $taux->taux_com_ag_retrait; $data['taux_ag_r'] = $taux->taux_com_ag_retrait;
@ -331,11 +333,11 @@ class Hyperviseur_dash extends CI_Controller
$data['taux_bq_d'] = $taux->part_banque_depot; $data['taux_bq_d'] = $taux->part_banque_depot;
$data['taux_bq_r'] = $taux->part_banque_retrait; $data['taux_bq_r'] = $taux->part_banque_retrait;
$data['frais_d'] = $taux->frais_min_banque_depot; $data['frais_d'] = $taux->frais_min_banque_depot;
} elseif ($data['hasWallet']->first_row()->type == 'ilink'){ } elseif ($data['hasWallet']->first_row()->type == 'ilink') {
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet" , $data['idConfig']); $data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet", $data['idConfig']);
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash" , $data['idConfig']); $data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash", $data['idConfig']);
$data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet" , $data['idConfig']); $data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet", $data['idConfig']);
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash" , $data['idConfig']); $data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash", $data['idConfig']);
$data['u_w_w_min'] = $taux->taux_com_user_wallet_wallet_min; $data['u_w_w_min'] = $taux->taux_com_user_wallet_wallet_min;
$data['u_w_w_max'] = $taux->taux_com_user_wallet_wallet_max; $data['u_w_w_max'] = $taux->taux_com_user_wallet_wallet_max;
$data['taux_u_w_w'] = $taux->taux_com_user_wallet_wallet; $data['taux_u_w_w'] = $taux->taux_com_user_wallet_wallet;
@ -429,10 +431,10 @@ class Hyperviseur_dash extends CI_Controller
elseif ($data['hasWallet']->first_row()->type == 'ilink') elseif ($data['hasWallet']->first_row()->type == 'ilink')
$this->load->view('gestion_wallet_ilink_hyp'); $this->load->view('gestion_wallet_ilink_hyp');
$this->load->view('footer'); $this->load->view('footer');
}
} }
} }
} }
}
private function isLogged() private function isLogged()
{ {
@ -447,17 +449,17 @@ class Hyperviseur_dash extends CI_Controller
return true; return true;
} }
private function historique($network_id ,$startDate ,$endDate, $type) private function historique($network_id, $startDate, $endDate, $type)
{ {
$data['configWallet'] = $this->user_model->getConfigWallet($network_id); $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ; $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ; $data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
$data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ; $data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
$endDate = Date('Y-m-d', strtotime($endDate."+1 day")); $endDate = Date('Y-m-d', strtotime($endDate . "+1 day"));
if($type == 'transaction') if ($type == 'transaction')
$data['transactions'] = $this->user_model->getTransactions($startDate , $endDate ,$network_id); $data['transactions'] = $this->user_model->getTransactions($startDate, $endDate, $network_id);
else else
$data['transactions'] = $this->user_model->getRecharges($startDate , $endDate ,$network_id); $data['transactions'] = $this->user_model->getRecharges($startDate, $endDate, $network_id);
$data['active'] = "wallet"; $data['active'] = "wallet";
$data['alert'] = ""; $data['alert'] = "";
@ -469,19 +471,20 @@ class Hyperviseur_dash extends CI_Controller
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['category'] = $this->session->userdata('category'); $data['category'] = $this->session->userdata('category');
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
if($type == 'transaction') if ($type == 'transaction')
$this->load->view('historique_transactions'); $this->load->view('historique_transactions');
else else
$this->load->view('historique_recharges'); $this->load->view('historique_recharges');
$this->load->view('footer'); $this->load->view('footer');
} }
public function walletPassword(){ public function walletPassword()
if($this->isLogged()){ {
if ($this->isLogged()) {
$data['active'] = "wallet_password"; $data['active'] = "wallet_password";
$data['alert'] = ""; $data['alert'] = "";
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
@ -492,7 +495,7 @@ class Hyperviseur_dash extends CI_Controller
$data['networks'] = $this->user_model->getActiveNetwork(); $data['networks'] = $this->user_model->getActiveNetwork();
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['network_id'] = $this->session->userdata('network_id'); $data['network_id'] = $this->session->userdata('network_id');
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id')); $res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
$data['walletPassword'] = $res ? $res->first_row() : null; $data['walletPassword'] = $res ? $res->first_row() : null;
@ -502,33 +505,34 @@ class Hyperviseur_dash extends CI_Controller
} }
} }
public function generate_wallet_password(){ public function generate_wallet_password()
if($this->isLogged()){ {
if ($this->isLogged()) {
if (isset($_POST)) { if (isset($_POST)) {
$network_id = isset($_POST['network_id']) ? $_POST['network_id'] : null; $network_id = isset($_POST['network_id']) ? $_POST['network_id'] : null;
$email = $_POST['email']; $email = $_POST['email'];
// $size = $_POST['size']; // $size = $_POST['size'];
$wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null ; $wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null;
$network = $_POST['network']; $network = $_POST['network'];
$country = $_POST['country']; $country = $_POST['country'];
$password = $this->generate_string(); $password = $this->generate_string();
$hash = $this->hashSSHA($password); $hash = $this->hashSSHA($password);
$encrypted_password = $hash['encrypted'] ; $encrypted_password = $hash['encrypted'];
$salt = $hash['salt'] ; $salt = $hash['salt'];
$this->load->library('email'); $this->load->library('email');
$this->email->from('noreply@ilink-app.com', 'iLink World'); $this->email->from('noreply@ilink-app.com', 'iLink World');
$this->email->to($email); $this->email->to($email);
$this->email->subject($this->lang->line('wallet_password').' '.$network . ' - '.$country); $this->email->subject($this->lang->line('wallet_password') . ' ' . $network . ' - ' . $country);
$this->email->message($this->lang->line('mot de passe').' : '.$password); $this->email->message($this->lang->line('mot de passe') . ' : ' . $password);
if ($this->email->send()) { if ($this->email->send()) {
if($wallet_password_id == null) if ($wallet_password_id == null)
$this->user_model->addWalletPassword($network_id,$encrypted_password,$salt,$email); $this->user_model->addWalletPassword($network_id, $encrypted_password, $salt, $email);
else else
$this->user_model->updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email); $this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt, $email);
$res = true; $res = true;
} else { } else {
// show_error($this->email->print_debugger()); // show_error($this->email->print_debugger());
@ -544,20 +548,22 @@ class Hyperviseur_dash extends CI_Controller
} }
} }
private function generate_string($length = 10){ private function generate_string($length = 10)
$chars = 'abcdefghjkmnpqrstuvwxyz'. {
$chars = 'abcdefghjkmnpqrstuvwxyz' .
'23456789'; '23456789';
$str = ''; $str = '';
$max = strlen($chars) - 1; $max = strlen($chars) - 1;
for ($i=0; $i < $length; $i++) for ($i = 0; $i < $length; $i++)
$str .= $chars[mt_rand(0, $max)]; $str .= $chars[mt_rand(0, $max)];
return $str; return $str;
} }
private function hashSSHA($password) { private function hashSSHA($password)
{
$salt = sha1(rand()); $salt = sha1(rand());
$salt = substr($salt, 0, 10); $salt = substr($salt, 0, 10);
$encrypted = base64_encode(sha1($password . $salt, true) . $salt); $encrypted = base64_encode(sha1($password . $salt, true) . $salt);
@ -565,28 +571,29 @@ class Hyperviseur_dash extends CI_Controller
return $hash; return $hash;
} }
public function resetWalletPassword(){ public function resetWalletPassword()
if($this->isLogged()){ {
if ($this->isLogged()) {
if (isset($_POST)) { if (isset($_POST)) {
$email = $_POST['email']; $email = $_POST['email'];
$wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null ; $wallet_password_id = isset($_POST['wallet_password_id']) ? $_POST['wallet_password_id'] : null;
$network = $_POST['network']; $network = $_POST['network'];
$country = $_POST['country']; $country = $_POST['country'];
$password = $this->generate_string(); $password = $this->generate_string();
$hash = $this->hashSSHA($password); $hash = $this->hashSSHA($password);
$encrypted_password = $hash['encrypted'] ; $encrypted_password = $hash['encrypted'];
$salt = $hash['salt'] ; $salt = $hash['salt'];
$this->load->library('email'); $this->load->library('email');
$this->email->from('noreply@ilink-app.com', 'iLink World'); $this->email->from('noreply@ilink-app.com', 'iLink World');
$this->email->to($email); $this->email->to($email);
$this->email->subject($this->lang->line('reset_wallet_password').' '.$network . ' - '.$country); $this->email->subject($this->lang->line('reset_wallet_password') . ' ' . $network . ' - ' . $country);
$this->email->message($this->lang->line('mot de passe').' : '.$password); $this->email->message($this->lang->line('mot de passe') . ' : ' . $password);
if ($this->email->send()) { if ($this->email->send()) {
$this->user_model->updateWalletPassword($wallet_password_id,$encrypted_password,$salt,$email); $this->user_model->updateWalletPassword($wallet_password_id, $encrypted_password, $salt, $email);
$res = true; $res = true;
} else { } else {
// show_error($this->email->print_debugger()); // show_error($this->email->print_debugger());
@ -602,22 +609,23 @@ class Hyperviseur_dash extends CI_Controller
} }
} }
public function recharge_wallet(){ public function recharge_wallet()
if($this->isLogged()){ {
if ($this->isLogged()) {
if (isset($_POST)) { if (isset($_POST)) {
$password = $_POST['password']; $password = $_POST['password'];
$wallet_id = $_POST['wallet_id']; $wallet_id = $_POST['wallet_id'];
$salt = $_POST['salt'] ; $salt = $_POST['salt'];
$encrypted_password = $_POST['encrypted_password']; $encrypted_password = $_POST['encrypted_password'];
$montant = $_POST['montant']; $montant = $_POST['montant'];
$hash = base64_encode(sha1($password . $salt, true) . $salt); $hash = base64_encode(sha1($password . $salt, true) . $salt);
if($encrypted_password == $hash){ if ($encrypted_password == $hash) {
$this->user_model->updateWalletBalance($montant,$wallet_id); $this->user_model->updateWalletBalance($montant, $wallet_id);
$res = $this->user_model->addWalletRecharge($montant,$wallet_id); $res = $this->user_model->addWalletRecharge($montant, $wallet_id);
$code = $res ? '200' : '500' ; $code = $res ? '200' : '500';
}else{ } else {
$code = '400'; $code = '400';
} }
@ -627,8 +635,9 @@ class Hyperviseur_dash extends CI_Controller
} }
} }
public function calculator(){ public function calculator()
if($this->isLogged()){ {
if ($this->isLogged()) {
$data['active'] = "calculator"; $data['active'] = "calculator";
$data['alert'] = ""; $data['alert'] = "";
$data['firstname'] = $this->session->userdata('firstname'); $data['firstname'] = $this->session->userdata('firstname');
@ -640,16 +649,16 @@ class Hyperviseur_dash extends CI_Controller
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['idConfig'] = $data['hasWallet']->first_row()->id; $data['idConfig'] = $data['hasWallet']->first_row()->id;
$data['country'] = $this->session->userdata('current_pays'); $data['country'] = $this->session->userdata('current_pays');
$data['network_id'] = $this->session->userdata('network_id'); $data['network_id'] = $this->session->userdata('network_id');
$data['countries'] = $this->user_model->getWalletsCountries(); $data['countries'] = $this->user_model->getWalletsCountries();
$data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet" , $data['idConfig'])->result(); $data['plr_user_wallet_wallet'] = $this->user_model->getPalierConfigWallet("user_wallet_wallet", $data['idConfig']);
$data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash" , $data['idConfig']); $data['plr_user_wallet_cash'] = $this->user_model->getPalierConfigWallet("user_wallet_cash", $data['idConfig']);
$data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet" , $data['idConfig']); $data['plr_agent_depot_wallet'] = $this->user_model->getPalierConfigWallet("agent_depot_wallet", $data['idConfig']);
$data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash" , $data['idConfig']); $data['plr_agent_cash_cash'] = $this->user_model->getPalierConfigWallet("agent_cash_cash", $data['idConfig']);
$operations = [ $operations = [
new Operation(1,$this->lang->line('op1')), new Operation(1, $this->lang->line('op1')),
new Operation(2,"Retrait d'argent") new Operation(2, "Retrait d'argent")
]; ];
$data['operations'] = $operations; $data['operations'] = $operations;
// if (isset($_POST)) { // if (isset($_POST)) {
@ -661,13 +670,30 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('footer'); $this->load->view('footer');
} }
} }
public function cancelCreditRequest()
{
if ($this->isLogged()) {
if (isset($_POST)) {
$id_demand = $_POST['id_demand'];
$res = $this->user_model->cancelCreditRequest($id_demand);
if ($res) {
echo json_encode("200");
} else {
echo json_encode("500");
}
}
}
}
} }
class Operation { class Operation
public $name ; {
public $name;
public $id; public $id;
public function __construct($id , $name) public function __construct($id, $name)
{ {
$this->name = $name; $this->name = $name;
$this->id = $id; $this->id = $id;

View File

@ -366,5 +366,8 @@ $lang['amount_departure_country'] = 'Montant du pays de départ';
$lang['amount_country_of_destination'] = 'Montant du pays de destination'; $lang['amount_country_of_destination'] = 'Montant du pays de destination';
$lang['no_operation'] = 'Aucune opération'; $lang['no_operation'] = 'Aucune opération';
$lang['agent_name'] = 'Nom de l\'agent'; $lang['agent_name'] = 'Nom de l\'agent';
$lang['cancel'] = 'Annuler';
$lang['canceled_transaction'] = 'Transaction annulée';
$lang['canceled_credit_request'] = 'Demande de crédit annulée';
$lang['op1'] = 'Envoi de wallet à wallet'; $lang['op1'] = 'Envoi de wallet à wallet';
?> ?>

View File

@ -2333,4 +2333,35 @@ class User_model extends CI_Model
} }
} }
public function cancelCreditRequest($id_demand){
$sql = "SELECT * FROM `info_demandeCredits` WHERE `demande_id` = ?;";
$query = $this->db->query($sql , array($id_demand));
if($query->num_rows()>0){
$demand = $query->first_row();
$sql = "SELECT * FROM `wallet_agent` WHERE `codeMembre` = ?;";
$query = $this->db->query($sql , array($demand->codeMembre));
$query2 = $this->db->query($sql , array($demand->codeParrain));
$result = $query->num_rows()>0;
if($result){
$result =$query2->num_rows()>0;
if($result){
$sql = "UPDATE wallets SET balance_princ = ? WHERE (`id` = ?);";
$montant = $demand->montant;
$montantAgent = $query->first_row()->balance_princ - $montant;
$montantParrain = $query->first_row()->balance_princ + $montant;
$this->db->query($sql , $montantAgent , $query->first_row()->wallet_id );
$this->db->query($sql , $montantParrain , $query2->first_row()->wallet_id);
$sql = "UPDATE `demandeCredits` SET `status` = '2' WHERE (`id` = ?);";
$this->db->query($sql , $demand->demande_id);
return true;
}
}
return false;
}else{
return false;
}
}
} }

View File

@ -1,7 +1,7 @@
<!-- DataTables --> <!-- DataTables -->
<link rel="stylesheet" <link rel="stylesheet"
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>"> href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper"> <div class="content-wrapper">
<?php <?php
@ -730,6 +730,7 @@
<th>" . $this->lang->line('Date de traitement') . "</th> <th>" . $this->lang->line('Date de traitement') . "</th>
<th>" . $this->lang->line('Statut') . "</th> <th>" . $this->lang->line('Statut') . "</th>
<th>" . $this->lang->line('Délai de traitement') . "</th> <th>" . $this->lang->line('Délai de traitement') . "</th>
<th>Action</th>
</tr>"; </tr>";
?> ?>
</thead> </thead>
@ -766,7 +767,11 @@
<td> ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td> <td> ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td>
<td>$etat</td> <td>$etat</td>
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td> <td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
<td>
<button data-id-demand=\"$row->demande_id\" id=\"cancel\" class=\"btn btn-danger btn-block\" <?php if($row->statut == 1) echo \"disabled\"?>
<b>".$this->lang->line('cancel')."</b>
</button>
</td>
</tr>"; </tr>";
} }
@ -972,6 +977,8 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script> <script>
$(function () { $(function () {
@ -1207,3 +1214,35 @@
}); });
}); });
</script> </script>
<script>
$(document).on("click", "#cancel", function () {
const id_demand = $(this).data('id-demand');
$.ajax({
url : '<?php echo base_url('index.php/Hyperviseur_dash/cancelCreditRequest')?>',
type : 'POST',
data: {"id_demand": id_demand},
async:true,
success : function(data){
console.log('rep',data);
if(data == 200){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('canceled_credit_request')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
</script>

View File

@ -247,7 +247,6 @@
data: {"network_id": network_id }, data: {"network_id": network_id },
success : function(data, statut){ success : function(data, statut){
if(data=='200'){ if(data=='200'){
Swal.fire({ Swal.fire({
icon: 'success', icon: 'success',
title: "<?php echo $this->lang->line('wallet_deleted')?>", title: "<?php echo $this->lang->line('wallet_deleted')?>",

View File

@ -2,6 +2,7 @@
<link rel="stylesheet" <link rel="stylesheet"
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>"> href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper"> <div class="content-wrapper">
<?php <?php
@ -99,6 +100,7 @@
<th><?php echo $this->lang->line('Commission de l\'agent') ?></th> <th><?php echo $this->lang->line('Commission de l\'agent') ?></th>
<th><?php echo $this->lang->line('agent_name') ?></th> <th><?php echo $this->lang->line('agent_name') ?></th>
<th align='center'>Date</th> <th align='center'>Date</th>
<th align='center'>Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -129,10 +131,17 @@
<td>".$fmt->format( $row->commission_sup)."</td> <td>".$fmt->format( $row->commission_sup)."</td>
<td>".$fmt->format( $row->commission_ag)."</td> <td>".$fmt->format( $row->commission_ag)."</td>
<td>".$row->agent."</td> <td>".$row->agent."</td>
<td>".toLocateDate($row->date_created,$this->session->userdata('timezone'))."</td> <td>".toLocateDate($row->date_created,$this->session->userdata('timezone'))."</td>";
</tr>"; ?>
<td>
<button data-id-transaction="<?= $row->id ?>" id="cancel" class="btn btn-danger btn-block" <?php if($row->canceled) echo "disabled"?> >
<b><?php echo $this->lang->line('cancel')?></b>
</button>
</td>
</tr>
} <?php
}
?> ?>
</tbody> </tbody>
@ -175,6 +184,8 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
<script> <script>
@ -227,4 +238,35 @@
}); });
</script> </script>
<script>
$(document).on("click", "#cancel", function () {
const id_transaction = $(this).data('id-transaction');
$.ajax({
url : '<?php echo base_url('index.php/Gestion/cancelTransation')?>',
type : 'POST',
dataType : 'json',
data: {"id_transaction": id_transaction},
async:true,
success : function(data){
if(data){
Swal.fire({
icon: 'success',
title: "<?php echo $this->lang->line('canceled_transaction')?>",
text: "<?php echo $this->lang->line('informations_updated')?>",
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
});
});
</script>