Implements drugs and devices module
This commit is contained in:
parent
112d1080f6
commit
667224294a
|
@ -285,11 +285,12 @@ class Admin extends CI_Controller
|
|||
$lastname = $this->input->post('nom');
|
||||
$email = $this->input->post('email');
|
||||
$phone = $this->input->post('contact');
|
||||
$provider_class_id = $this->input->post('provider_class_id');
|
||||
|
||||
$id = $this->user_model->getIdAgentByMemberCode($code,$cat);
|
||||
|
||||
if($id!=false){
|
||||
$update_info = $this->user_model->updateGeolocatedUser($id,$adresse,$lastname,$email);
|
||||
$update_info = $this->user_model->updateGeolocatedUser($id,$adresse,$lastname,$email,$provider_class_id);
|
||||
if($update_info){
|
||||
$res = $this->user_model->updatePhoneAgent($id,$phone);
|
||||
if($res){
|
||||
|
|
|
@ -56,31 +56,55 @@ class Hyperviseur_dash extends CI_Controller
|
|||
|
||||
if ($this->isLogged()) {
|
||||
if ($this->input->post('ville')) {
|
||||
$this->session->set_userdata('current_ville', $this->input->post('ville'));
|
||||
$town = $this->db->get_where('towns',['id' => $this->input->post('ville')])->first_row();
|
||||
$this->session->set_userdata('current_ville', $town->name);
|
||||
}
|
||||
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||
|
||||
$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['map_title'] = $this->lang->line($data['hasWallet']->first_row()->type == 'ilink_sante' ? 'service_providers_to' :'utilisateurs géolocalisés à') . " " . $this->session->userdata('current_ville');
|
||||
$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['code_parrain'] = $this->session->userdata('code_parrain');
|
||||
$data['category'] = $this->session->userdata('category');
|
||||
$data['category'] = 'geolocated';
|
||||
$data['network'] = $this->session->userdata('network');
|
||||
$data['network_id'] = $this->session->userdata('network_id');
|
||||
$data['town_id'] = isset($town) ? $town->id : null;
|
||||
|
||||
$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->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||
$this->load->view('header_hyp', $data);
|
||||
|
||||
|
||||
if($data['hasWallet']->first_row()->type == 'ilink_sante'){
|
||||
$nh_config = $this->nano_health_model->getConfig($data['network_id']);
|
||||
$data['nh_config'] = $nh_config ? $nh_config->first_row() : null ;
|
||||
$data['provider_classes'] = $this->nano_health_model->getProviderClasses($data['nh_config'] ? $data['nh_config']->id : null);
|
||||
|
||||
$this->load->view('header_hyp', $data);
|
||||
$this->load->view('nano_health/hyper/listeadmin');
|
||||
}else{
|
||||
|
||||
$data['tab'] = $this->user_model->getUsersGeolocatedByVilleForHyp($this->session->userdata('current_ville'), $this->session->userdata('member_code'));
|
||||
$this->load->view('header_hyp', $data);
|
||||
$this->load->view('listeadmin');
|
||||
}
|
||||
$this->load->view('listeadmin');
|
||||
$this->load->view('footer');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function fetchSuper(){
|
||||
if ($this->isLogged()) {
|
||||
$code_membre = $this->input->post('code_membre');
|
||||
$super = $this->db->get_where('agent_plus',['code_membre' => $code_membre])->first_row();
|
||||
echo json_encode($super);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllSupervisor()
|
||||
{
|
||||
if ($this->isLogged()) {
|
||||
|
@ -1977,6 +2001,25 @@ class Hyperviseur_dash extends CI_Controller
|
|||
$this->load->view('footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function drugs_and_devices(){
|
||||
if ($this->isLogged()) {
|
||||
$data['active'] = "wallet_drugs_and_devices";
|
||||
$data['network'] = $this->session->userdata('network');
|
||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||
|
||||
$data['currency_code'] = $this->session->userdata('currency_code');
|
||||
$data['category'] = $this->session->userdata('category');
|
||||
$data['network_id'] = $this->session->userdata('network_id');
|
||||
|
||||
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||
$data['types'] = $this->user_model->getEnumValues('nh_drugs_and_devices','type');
|
||||
|
||||
$this->load->view('header_hyp', $data);
|
||||
$this->load->view('nano_health/hyper/drugs_and_devices');
|
||||
$this->load->view('footer');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Operation
|
||||
|
|
|
@ -45,18 +45,23 @@ class NanoHealthController extends CI_Controller
|
|||
public function storeAct(){
|
||||
if($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$id = $_POST['id'];
|
||||
$id = $_POST['id'] ?? null;
|
||||
$_POST['nh_network_config_id'] = $_POST['config_id'];
|
||||
unset($_POST['config_id']);
|
||||
|
||||
if(!empty($id)){
|
||||
$this->db->where('id',$id);
|
||||
$this->db->update('nh_acts',$_POST);
|
||||
}else{
|
||||
$this->db->insert('nh_acts',$_POST);
|
||||
}
|
||||
$exist = $this->db->get_where('nh_acts', ['id !=' => $id , 'nh_network_config_id' => $_POST['nh_network_config_id'] , 'code' => $_POST['code']]);
|
||||
if ($exist->num_rows() == 0) {
|
||||
if(!empty($id)){
|
||||
$this->db->where('id',$id);
|
||||
$this->db->update('nh_acts',$_POST);
|
||||
}else{
|
||||
$this->db->insert('nh_acts',$_POST);
|
||||
}
|
||||
echo json_encode(['code' => 200]);
|
||||
|
||||
echo json_encode("200");
|
||||
}else{
|
||||
echo json_encode(['code'=> 419 , 'message' => $this->lang->line("code_already_used")]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -233,6 +238,39 @@ class NanoHealthController extends CI_Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public function storeDrugAndDevice(){
|
||||
if($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$id = $_POST['id'] ?? null ;
|
||||
|
||||
$exist = $this->db->get_where('nh_drugs_and_devices', ['id !=' => $id ,'network_id' => $_POST['network_id'] , 'code' => $_POST['code']]);
|
||||
if ($exist->num_rows() == 0) {
|
||||
if(!empty($id)){
|
||||
$this->db->where('id',$id);
|
||||
$this->db->update('nh_drugs_and_devices',$_POST);
|
||||
}else{
|
||||
$this->db->insert('nh_drugs_and_devices',$_POST);
|
||||
}
|
||||
echo json_encode(['code' => 200]);
|
||||
|
||||
}else{
|
||||
echo json_encode(['code'=> 419 , 'message' => $this->lang->line("code_already_used")]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteDrugAndDevice(){
|
||||
if($this->isLogged()) {
|
||||
if (isset($_POST)) {
|
||||
$this->db->delete('nh_drugs_and_devices', ['id' => $_POST['id']]);
|
||||
echo json_encode(['code' => 200]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function isLogged()
|
||||
{
|
||||
if (!$this->session->userdata('email')) {
|
||||
|
|
|
@ -33,7 +33,7 @@ class ValidatingAgent extends CI_Controller
|
|||
if ($this->input->get('id') !== null) {
|
||||
$data['insurance_subscription_id'] = $this->input->get('id');
|
||||
$data['subscription'] = $this->nano_health_model->getInfosInsuranceSubscriptionById($this->input->get('id'));
|
||||
$data['beneficiaries'] = $this->db->get_where('nh_insurances_having_rights', ['insurance_subscription_id' => $data['insurance_subscription_id']]);
|
||||
$data['beneficiaries'] = $this->nano_health_model->getSubscriptionBeneficiaries($data['subscription']->id ?? null);
|
||||
$data['user'] = $this->db->get_where('user_infos', ['user_id' => $data['subscription']->user_id ?? null])->first_row();
|
||||
$this->load->view('nano_health/validating_agent/header', $data);
|
||||
$this->load->view('nano_health/hyper/infos_insurance_subscription');
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\CurrencyConverter;
|
||||
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||
use Brick\Money\Money;
|
||||
|
||||
class DrugAndDevices extends CI_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load member model
|
||||
$this->load->model('pagination/DrugAndDevices_model', 'model');
|
||||
}
|
||||
|
||||
|
||||
function getLists()
|
||||
{
|
||||
$data = $row = array();
|
||||
|
||||
// Fetch member's records
|
||||
$witData = $this->model->getRows($_POST);
|
||||
|
||||
$i = $_POST['start'];
|
||||
|
||||
foreach ($witData as $index => $row) {
|
||||
|
||||
$data[] = array($index+1, $row->code, $row->name,$this->lang->line($row->type), $this->lang->line($row->on_prescription ? 'Oui' : 'Non'),
|
||||
'<button class="btn btn-success edit" data-id="'.$row->id.'" data-name="'.$row->name.'" data-code="'.$row->code.'"
|
||||
data-type="'.$row->type.'" data-on_prescription="'.$row->on_prescription.'">
|
||||
<i class="fa fa-edit"></i>
|
||||
</button>
|
||||
<button data-toggle="modal" class="btn btn-danger delete" data-id="'.$row->id.'">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>');
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => $_POST['draw'],
|
||||
"recordsTotal" => $this->model->countAll($_POST),
|
||||
"recordsFiltered" => $this->model->countFiltered($_POST),
|
||||
"data" => $data,
|
||||
);
|
||||
|
||||
// Output to JSON format
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class GeolocatedUsers extends CI_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load member model
|
||||
$this->load->model('pagination/GeolocatedUsers_model', 'gu_model');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getLists()
|
||||
{
|
||||
$list = array();
|
||||
|
||||
// Fetch member's records
|
||||
$datas = $this->gu_model->getRows($_POST);
|
||||
|
||||
foreach ($datas as $row) {
|
||||
|
||||
$status = $this->lang->line($row->active==1 ? 'Oui' : 'Non');
|
||||
|
||||
$code_parrain = $row->code_parrain;
|
||||
if($row->code_parrain==$this->session->userdata('member_code')){
|
||||
$code_parrain = $this->lang->line("Vous");
|
||||
}
|
||||
|
||||
$data = array("<button class='btn btn-default btn-center openSupervisorModal' data-code_parrain='$row->code_parrain'>$code_parrain</button>",
|
||||
$row->lastname,$row->adresse, $row->code_membre , $row->email, $row->phone , $row->provider_class ,$status);
|
||||
|
||||
// if($_POST['category'] == 'geolocated'){
|
||||
// if($row->has_qr_code)
|
||||
// array_push($data,"<a href='".WALLET_SERVICE_URL."/qrcodes/".$row->id.".pdf' class='btn btn-success btn-center' target='_blank'>".$this->lang->line('display')."</a>");
|
||||
// else
|
||||
// array_push($data,"<button class='btn btn-primary btn-center generateQRCode' data-id_agent='$row->id'>".$this->lang->line('generate')."</button>");
|
||||
// }
|
||||
|
||||
if ($this->session->userdata("category") == "0" or $this->session->userdata("category") == "hyper")
|
||||
array_push($data, "<button data-toggle='modal' data-category='$row->category' data-lastname='$row->lastname' data-adresse='$row->adresse' data-provider_class_id='$row->provider_class_id'
|
||||
data-network='$row->network' data-member_code='$row->code_membre' data-email='$row->email' data-phone='$row->phone' class='open-modal modif btn btn-success' data-target='#editModal'><i class='fa fa-edit'></i></button>");
|
||||
|
||||
|
||||
array_push($list,$data);
|
||||
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => $_POST['draw'],
|
||||
"recordsTotal" => $this->gu_model->countAll($_POST),
|
||||
"recordsFiltered" => $this->gu_model->countFiltered($_POST),
|
||||
"data" => $list,
|
||||
);
|
||||
|
||||
// Output to JSON format
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
}
|
|
@ -763,4 +763,22 @@ $lang['reason'] = "Reason";
|
|||
$lang['ADDITION_OF_BENEFICIARY'] = "Addition of beneficiary";
|
||||
$lang['DELETION_OF_BENEFICIARY'] = "Deletion of beneficiary";
|
||||
$lang['ACTIVATION'] = "Insurance activation";
|
||||
$lang['drugs_and_devices'] = "Drugs / Devices";
|
||||
$lang['manage_drugs_and_devices'] = "Manage drugs / devices";
|
||||
$lang['add_drug_and_device'] = "Add a drug / device";
|
||||
$lang['drug_and_device_created'] = "Drug / Device created";
|
||||
$lang['drug_and_device_updated'] = "Drug / Device modified";
|
||||
$lang['drug_and_device_deleted'] = "Drug / Device deleted";
|
||||
$lang['code_already_used'] = "The code entered is already in use";
|
||||
$lang['no_drug_and_device'] = "No drug / device";
|
||||
$lang['delete_drug_and_device'] = "Delete drug/device";
|
||||
$lang['service_providers'] = "Providers";
|
||||
$lang['service_providers_to'] = "providers to";
|
||||
$lang['on_prescription'] = "Under prescription";
|
||||
$lang['COMPRESSED'] = "Compressed";
|
||||
$lang['SYRUP'] = "Syrup";
|
||||
$lang['SOLUTION'] = "Solution";
|
||||
$lang['SUPPOSITORY'] = "Suppository";
|
||||
$lang['DEVICE'] = "Apparatus";
|
||||
$lang['provider_class'] = "Provider class";
|
||||
?>
|
||||
|
|
|
@ -774,4 +774,22 @@ $lang['reason'] = "Motif";
|
|||
$lang['ADDITION_OF_BENEFICIARY'] = "Ajout d'ayant droit";
|
||||
$lang['DELETION_OF_BENEFICIARY'] = "Suppression d'ayant droit";
|
||||
$lang['ACTIVATION'] = "Activation de l'assurance";
|
||||
$lang['drugs_and_devices'] = "Médicaments / Appareillages";
|
||||
$lang['manage_drugs_and_devices'] = "Gestion des médicaments / appareillages";
|
||||
$lang['add_drug_and_device'] = "Ajouter un médicament / appareillage";
|
||||
$lang['drug_and_device_created'] = "Médicament / Appareillage crée";
|
||||
$lang['drug_and_device_updated'] = "Médicament / Appareillage modifié";
|
||||
$lang['drug_and_device_deleted'] = "Médicament / Appareillage supprimé";
|
||||
$lang['code_already_used'] = "Le code entré est déjà utilisé";
|
||||
$lang['no_drug_and_device'] = "Aucun médicament / appareillage";
|
||||
$lang['delete_drug_and_device'] = "Suppression du médicament / appareillage";
|
||||
$lang['service_providers'] = "Prestataires";
|
||||
$lang['service_providers_to'] = "prestataires à";
|
||||
$lang['on_prescription'] = "Sous ordonnance";
|
||||
$lang['COMPRESSED'] = "Comprimé";
|
||||
$lang['SYRUP'] = "Sirop";
|
||||
$lang['SOLUTION'] = "Solution";
|
||||
$lang['SUPPOSITORY'] = "Suppositoire";
|
||||
$lang['DEVICE'] = "Appareillage";
|
||||
$lang['provider_class'] = "Classe de prestataire";
|
||||
?>
|
||||
|
|
|
@ -174,7 +174,7 @@ class User_model extends CI_Model
|
|||
public function getVilleByUserGeo($network,$country){
|
||||
|
||||
$this->db->distinct('ville');
|
||||
$this->db->select('town AS ville','town_id AS id');
|
||||
$this->db->select('town AS ville , town_id AS id');
|
||||
$this->db->from('super_infos');
|
||||
$this->db->where('category','geolocated');
|
||||
$this->db->where('network',$network);
|
||||
|
@ -1168,8 +1168,8 @@ class User_model extends CI_Model
|
|||
}
|
||||
}
|
||||
|
||||
public function updateGeolocatedUser($id,$adresse,$lastname,$email){
|
||||
$query = $this->db->query("UPDATE agents SET firstname='".$adresse."',lastname='".$lastname."',email='".$email."' WHERE id ='".$id."'");
|
||||
public function updateGeolocatedUser($id,$adresse,$lastname,$email, $providerClassId = null){
|
||||
$query = $this->db->query("UPDATE agents SET firstname='".$adresse."',lastname='".$lastname."',email='".$email."', nh_provider_class_id = $providerClassId WHERE id ='".$id."'");
|
||||
return $query;
|
||||
}
|
||||
public function updatePhoneAgent($id,$phone){
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class DrugAndDevices_model extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
// Set table name
|
||||
$this->table = 'nh_drugs_and_devices';
|
||||
// Set orderable column fields
|
||||
$this->column_order = array(null,'code','name','type','on_prescription', null);
|
||||
// Set searchable column fields
|
||||
$this->column_search = array('code','name','type','on_prescription');
|
||||
// Set default order
|
||||
$this->order = array('created_at' => 'desc');
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch members data from the database
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
public function getRows($postData)
|
||||
{
|
||||
$this->_get_datatables_query($postData);
|
||||
if ($postData['length'] != -1) {
|
||||
$this->db->limit($postData['length'], $postData['start']);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
/*
|
||||
* Count all records
|
||||
*/
|
||||
public function countAll($postData)
|
||||
{
|
||||
$this->db->from($this->table);
|
||||
$this->db->where('network_id', $postData['id_network']);
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
/*
|
||||
* Count records based on the filter params
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
public function countFiltered($postData)
|
||||
{
|
||||
$this->_get_datatables_query($postData);
|
||||
$query = $this->db->get();
|
||||
return $query->num_rows();
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform the SQL queries needed for an server-side processing requested
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
private function _get_datatables_query($postData)
|
||||
{
|
||||
|
||||
$this->db->from($this->table);
|
||||
$this->db->where('network_id', $postData['id_network']);
|
||||
// if (strlen($postData['startDate']) > 0 && strlen($postData['endDate']) > 0) {
|
||||
// $this->db->where('created_at >=', date('Y-m-d', strtotime($postData['startDate'])));
|
||||
// $this->db->where('created_at <', date('Y-m-d', strtotime($postData['endDate']. "+1 day")));
|
||||
// }
|
||||
|
||||
$i = 0;
|
||||
// loop searchable columns
|
||||
foreach ($this->column_search as $item) {
|
||||
// if datatable send POST for search
|
||||
if ($postData['search']['value']) {
|
||||
// first loop
|
||||
if ($i === 0) {
|
||||
// open bracket
|
||||
$this->db->group_start();
|
||||
$this->db->like($item, $postData['search']['value']);
|
||||
} else {
|
||||
$this->db->or_like($item, $postData['search']['value']);
|
||||
}
|
||||
|
||||
// last loop
|
||||
if (count($this->column_search) - 1 == $i) {
|
||||
// close bracket
|
||||
$this->db->group_end();
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (isset($postData['order'])) {
|
||||
$this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']);
|
||||
} else if (isset($this->order)) {
|
||||
$order = $this->order;
|
||||
$this->db->order_by(key($order), $order[key($order)]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class GeolocatedUsers_model extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// Set table name
|
||||
$this->table = 'agent_plus';
|
||||
// Set orderable column fields
|
||||
$this->column_order = array('code_parrain','lastname', 'adresse', 'code_membre', 'email' , 'phone', 'active', 'provider_class',null);
|
||||
// Set searchable column fields
|
||||
$this->column_search = array('code_parrain','lastname', 'adresse', 'code_membre', 'email' , 'phone','provider_class');
|
||||
// Set default order
|
||||
$this->order = array('created' => 'desc');
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch members data from the database
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
public function getRows($postData)
|
||||
{
|
||||
$this->_get_datatables_query($postData);
|
||||
if ($postData['length'] != -1) {
|
||||
$this->db->limit($postData['length'], $postData['start']);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
/*
|
||||
* Count all records
|
||||
*/
|
||||
public function countAll($postData)
|
||||
{
|
||||
$this->db->from($this->table);
|
||||
|
||||
if(!empty($postData['category'])){
|
||||
$this->db->where('category', $postData['category']);
|
||||
}
|
||||
if(!empty($postData['network_id'])){
|
||||
$this->db->where('network_id', $postData['network_id']);
|
||||
}
|
||||
if(!empty($postData['code_parrain'])){
|
||||
$this->db->where('code_parrain', $postData['code_parrain']);
|
||||
}
|
||||
if(!empty($postData['town_id'])){
|
||||
$this->db->where('town_id', $postData['town_id']);
|
||||
}
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
/*
|
||||
* Count records based on the filter params
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
public function countFiltered($postData)
|
||||
{
|
||||
$this->_get_datatables_query($postData);
|
||||
$query = $this->db->get();
|
||||
return $query->num_rows();
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform the SQL queries needed for an server-side processing requested
|
||||
* @param $_POST filter data based on the posted parameters
|
||||
*/
|
||||
private function _get_datatables_query($postData)
|
||||
{
|
||||
|
||||
$this->db->from($this->table);
|
||||
|
||||
if(!empty($postData['category'])){
|
||||
$this->db->where('category', $postData['category']);
|
||||
}
|
||||
if(!empty($postData['network_id'])){
|
||||
$this->db->where('network_id', $postData['network_id']);
|
||||
}
|
||||
if(!empty($postData['code_parrain'])){
|
||||
$this->db->where('code_parrain', $postData['code_parrain']);
|
||||
}
|
||||
if(!empty($postData['town_id'])){
|
||||
$this->db->where('town_id', $postData['town_id']);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
// loop searchable columns
|
||||
foreach ($this->column_search as $item) {
|
||||
// if datatable send POST for search
|
||||
if ($postData['search']['value']) {
|
||||
// first loop
|
||||
if ($i === 0) {
|
||||
// open bracket
|
||||
$this->db->group_start();
|
||||
$this->db->like($item, $postData['search']['value']);
|
||||
} else {
|
||||
$this->db->or_like($item, $postData['search']['value']);
|
||||
}
|
||||
|
||||
// last loop
|
||||
if (count($this->column_search) - 1 == $i) {
|
||||
// close bracket
|
||||
$this->db->group_end();
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!empty($postData['order'])) {
|
||||
$this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']);
|
||||
} else if (!empty($this->order)) {
|
||||
$order = $this->order;
|
||||
$this->db->order_by(key($order), $order[key($order)]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -122,7 +122,7 @@
|
|||
<li class="<?php if($active=="geolocated"){echo "active ";} ?>">
|
||||
<a href="#" data-toggle="modal" data-target="#modal-default">
|
||||
<i class="fa fa-users"></i>
|
||||
<span><?= $this->lang->line('Utilisateurs géolocalisés'); ?></span>
|
||||
<span><?= $this->lang->line($hasWallet->first_row()->type == 'ilink_sante' ? 'service_providers' : 'Utilisateurs géolocalisés' ); ?></span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
@ -191,6 +191,12 @@
|
|||
</a>
|
||||
</li>
|
||||
<?php if ($hasWallet->first_row()->type == 'ilink_sante') { ?>
|
||||
<li class="<?php if ($active == "wallet_drugs_and_devices") {echo "active";} ?>">
|
||||
<a href="<?php echo base_url('Hyperviseur_dash/drugs_and_devices') ?>">
|
||||
<i class="fa fa-ambulance"></i>
|
||||
<span><?php echo $this->lang->line('drugs_and_devices'); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="<?php if ($active == "wallet_validating_doctors") {echo "active";} ?>">
|
||||
<a href="<?php echo base_url('Hyperviseur_dash/validating_agents/doctors') ?>">
|
||||
<i class="fa fa-stethoscope"></i>
|
||||
|
@ -274,14 +280,13 @@
|
|||
|
||||
<?php
|
||||
$result=$villes;
|
||||
|
||||
$numrows=$result->num_rows();
|
||||
|
||||
if ($numrows > 0) { ?>
|
||||
<select class="form-control input-lg" name="ville" required>
|
||||
<?php foreach($result->result() as $row) {
|
||||
|
||||
echo "<option>".$row->ville."</option>";
|
||||
echo "<option value='$row->id'>".$row->ville."</option>";
|
||||
} ?>
|
||||
</select>
|
||||
<?php }else{
|
||||
|
|
|
@ -29,31 +29,30 @@
|
|||
|
||||
<section class="content-header">
|
||||
|
||||
<?php
|
||||
<?php
|
||||
if ($alert == "ok") {
|
||||
|
||||
if($alert=="ok") {
|
||||
if (!$success == "ok") {
|
||||
?>
|
||||
<div class='alert alert-danger alert-dismissible'>
|
||||
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
|
||||
<h4><i class='icon fa fa-ban'></i> Error!</h4>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
|
||||
if(!$success=="ok"){
|
||||
?>
|
||||
<div class='alert alert-danger alert-dismissible'>
|
||||
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
|
||||
<h4><i class='icon fa fa-ban'></i> Error!</h4>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h1>
|
||||
<?php echo $this->lang->line('Carte des'); ?> <?php echo $map_title ?>
|
||||
<small><?php echo $this->lang->line('zoom'); ?> <?php echo $map_title ?></small>
|
||||
|
|
|
@ -0,0 +1,290 @@
|
|||
<link rel="stylesheet"
|
||||
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">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<?= $this->lang->line('manage_drugs_and_devices')?>
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line( 'drugs_and_devices') ?></h3>
|
||||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<table id="institutions" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='center'>#</th>
|
||||
<th>Code</th>
|
||||
<th><?php echo $this->lang->line('Nom'); ?></th>
|
||||
<th>Type</th>
|
||||
<th><?php echo $this->lang->line('on_prescription'); ?></th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php echo $this->lang->line('add_drug_and_device'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<form id="create-form" class="bottom-75 center-block">
|
||||
<div class="form-group">
|
||||
<label>Code</label>
|
||||
<input type="text" class="form-control input-lg" name="code" >
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="firstname"><?php echo $this->lang->line('Nom'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Type</label>
|
||||
<select class="form-control input-lg" name="provider_billing_period" required>
|
||||
<?php $array = array_values($types);
|
||||
foreach ($array as $value) { ?>
|
||||
<option value="<?=$value?>"> <?=$this->lang->line($value)?> </option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="on_prescription">
|
||||
<label ><?php echo $this->lang->line('on_prescription'); ?></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit"
|
||||
value="<?php echo $this->lang->line('save'); ?>"
|
||||
class="btn btn-primary">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="editModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title"><?php echo $this->lang->line('Mettre à jour des informations'); ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="update-form" method="post" class="bottom-75 center-block">
|
||||
<div class="form-group">
|
||||
<label>Code</label>
|
||||
<input type="text" class="form-control input-lg" name="code" >
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><?php echo $this->lang->line('Nom'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="name" >
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Type</label>
|
||||
<select class="form-control input-lg" name="provider_billing_period" required>
|
||||
<?php $array = array_values($types);
|
||||
foreach ($array as $value) { ?>
|
||||
<option value="<?=$value?>"> <?=$this->lang->line($value)?> </option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="on_prescription">
|
||||
<label ><?php echo $this->lang->line('on_prescription'); ?></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="btn-update" type="submit"
|
||||
value="<?php echo $this->lang->line('save'); ?>" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-default pull-right"
|
||||
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('include/delete_modal',['title' => $this->lang->line('delete_drug_and_device')]) ?>
|
||||
<?php $this->load->view('include/loader') ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- jQuery 3 -->
|
||||
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||||
<!-- DataTables -->
|
||||
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
|
||||
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
|
||||
<!-- Slimscroll -->
|
||||
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
|
||||
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
|
||||
<script>
|
||||
|
||||
toastr.options.closeButton = true;
|
||||
toastr.options.closeMethod = 'fadeOut';
|
||||
toastr.options.closeDuration = 5000;
|
||||
toastr.options.closeEasing = 'swing';
|
||||
|
||||
$(function () {
|
||||
$('#institutions').DataTable({
|
||||
// Processing indicator
|
||||
"processing": true,
|
||||
"language": {
|
||||
"processing": "<?= $this->lang->line('loading') ?>",
|
||||
"emptyTable" : "<?= $this->lang->line('no_drug_and_device') ?>"
|
||||
},
|
||||
// DataTables server-side processing mode
|
||||
"serverSide": true,
|
||||
// Initial no order.
|
||||
"order": [],
|
||||
// Load data from an Ajax source
|
||||
"ajax": {
|
||||
"url": "<?= base_url('pagination/DrugAndDevices/getLists'); ?>",
|
||||
"data":{
|
||||
"id_network" : "<?= $network_id ?>",
|
||||
},
|
||||
"type": "POST"
|
||||
},
|
||||
"aaSorting": [],
|
||||
dom: 'Bfrtip',
|
||||
});
|
||||
})
|
||||
|
||||
var networkId = <?= $network_id ?>;
|
||||
var selectedId = null
|
||||
|
||||
$(document).on("click", ".edit", function () {
|
||||
selectedId = $(this).data('id');
|
||||
$("#update-form input[name='code']").val($(this).data('code'));
|
||||
$("#update-form input[name='name']").val($(this).data('name'));
|
||||
$("#update-form input[name='type']").val($(this).data('type'));
|
||||
$("#update-form input[name='on_prescription']").prop('checked', $(this).data('on_prescription'));
|
||||
$('#editModal').modal('show');
|
||||
|
||||
});
|
||||
|
||||
$(document).on("click", ".delete", function () {
|
||||
selectedId = $(this).data('id');
|
||||
$('#delete-modal').modal('show');
|
||||
});
|
||||
|
||||
$("#update-form").submit(function () {
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('NanoHealthController/storeDrugAndDevice')?>',
|
||||
type: 'post',
|
||||
data: {
|
||||
id: selectedId,
|
||||
network_id : networkId,
|
||||
code: $("input[name=code]",this).val(),
|
||||
name: $("input[name=name]",this).val(),
|
||||
type: $("input[name=type]",this).val(),
|
||||
on_prescription : $("input[name=on_prescription]",this).is(':checked') ? 1 : 0
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if(data.code === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('drug_and_device_updated')?>",
|
||||
text:"<?= $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$("#create-form").submit(function (event) {
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('NanoHealthController/storeDrugAndDevice')?>',
|
||||
type: 'post',
|
||||
data: {
|
||||
network_id : networkId,
|
||||
code: $("input[name=code]",this).val(),
|
||||
name: $("input[name=name]",this).val(),
|
||||
type: $("input[name=type]",this).val(),
|
||||
on_prescription : $("input[name=on_prescription]",this).is(':checked') ? 1 : 0
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if(data.code === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('drug_and_device_created')?>",
|
||||
text:"<?= $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
$("#delete-btn").click(function () {
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('NanoHealthController/deleteDrugAndDevice')?>',
|
||||
type: 'post',
|
||||
data: {id: selectedId},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if(data.code === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('drug_and_device_deleted')?>",
|
||||
text:"<?= $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(()=>{
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
toastr.error(data.message , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
console.log(resultat + " " + error);
|
||||
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
</script>
|
|
@ -339,6 +339,7 @@ $careRequests = [];
|
|||
<tr>
|
||||
<?php
|
||||
echo "<th width='5'>#</th>
|
||||
<th>Code</th>
|
||||
<th>".$this->lang->line('Nom')."</th>
|
||||
<th>".$this->lang->line('billing_type')."</th>
|
||||
<th>".$this->lang->line('authorization_type')."</th>
|
||||
|
@ -352,12 +353,13 @@ $careRequests = [];
|
|||
foreach($acts->result() as $i => $row) { ?>
|
||||
<tr>
|
||||
<td><?= $i+1 ?></td>
|
||||
<td><?= $row->code ?></td>
|
||||
<td><?= $row->name ?></td>
|
||||
<td><?= $this->lang->line($row->billing_type); ?></td>
|
||||
<td><?= $this->lang->line($row->authorization_type); ?></td>
|
||||
<td>
|
||||
<button class='btn btn-success editAct' data-id="<?=$row->id?>" data-name="<?=$row->name?>" data-billing_type="<?=$row->billing_type?>"
|
||||
data-authorization_type="<?=$row->authorization_type?>" >
|
||||
data-authorization_type="<?=$row->authorization_type?>" data-code="<?=$row->code?>" >
|
||||
<i class='fa fa-edit'></i>
|
||||
</button>
|
||||
<button data-toggle='modal' class='btn btn-danger deleteAct' data-id="<?=$row->id?>" >
|
||||
|
@ -653,6 +655,10 @@ $careRequests = [];
|
|||
</div>
|
||||
<form id="actForm">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="col-form-label">Code</label>
|
||||
<input type="text" required class="form-control input-lg" name="code">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label"><?= $this->lang->line('Nom'); ?></label>
|
||||
<input type="text" required class="form-control input-lg" name="name">
|
||||
|
@ -976,12 +982,13 @@ $careRequests = [];
|
|||
data: {
|
||||
"config_id": config_id,
|
||||
"id" : selectedActId,
|
||||
"code": $("input[name='code']",this).val(),
|
||||
"name": $("input[name='name']",this).val(),
|
||||
"billing_type": $("select[name='billing_type'] :selected",this).val(),
|
||||
"authorization_type": $("select[name='authorization_type'] :selected",this).val(),
|
||||
},
|
||||
success: function (data) {
|
||||
if (data === '200') {
|
||||
if (data.code === 200) {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?php echo $this->lang->line('wallet_update')?>",
|
||||
|
@ -991,7 +998,7 @@ $careRequests = [];
|
|||
location.reload();
|
||||
});
|
||||
} else {
|
||||
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||
toastr.error(data.message , "<?php echo $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (resultat, statut, error) {
|
||||
|
@ -1005,6 +1012,7 @@ $careRequests = [];
|
|||
$('.editAct').click(function (){
|
||||
selectedActId = $(this).data('id');
|
||||
$("#modal-act h3").html("<?=$this->lang->line('edit_act')?>");
|
||||
$("#actForm input[name='code']").val($(this).data('code'));
|
||||
$("#actForm input[name='name']").val($(this).data('name'));
|
||||
$("#actForm select[name='billing_type']").val($(this).data('billing_type'));
|
||||
$("#actForm select[name='authorization_type']").val($(this).data('authorization_type'));
|
||||
|
@ -1014,6 +1022,7 @@ $careRequests = [];
|
|||
$('#addAct').click(function (){
|
||||
selectedActId = null;
|
||||
$("#modal-act h3").html("<?=$this->lang->line('add_act')?>");
|
||||
$("#actForm input[name='code']").val(null);
|
||||
$("#actForm input[name='name']").val(null);
|
||||
$("#actForm select[name='billing_type']").prop('selectedIndex',0);
|
||||
$("#actForm select[name='authorization_type']").prop('selectedIndex',0);
|
||||
|
|
|
@ -0,0 +1,501 @@
|
|||
<style>
|
||||
|
||||
#map {
|
||||
min-height: 250px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.btn-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.img-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
/*width: 65%;*/
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
|
||||
<div class="content-wrapper">
|
||||
|
||||
<section class="content-header">
|
||||
|
||||
<?php
|
||||
|
||||
if ($alert == "ok") {
|
||||
|
||||
if (!$success == "ok") {
|
||||
?>
|
||||
<div class='alert alert-danger alert-dismissible'>
|
||||
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
|
||||
<h4><i class='icon fa fa-ban'></i> Error!</h4>
|
||||
<?= $message; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
<?= $message; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h1>
|
||||
<?= $this->lang->line('Carte des'); ?> <?= $map_title ?>
|
||||
<small><?= $this->lang->line('zoom'); ?><?= $map_title ?></small>
|
||||
</h1>
|
||||
<section class="content">
|
||||
<div id="map" style="width:100%;height:400px;"></div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><?= $this->lang->line('Tous les').' '.$map_title ?><?php //if($this->session->userdata('category')=='super'){ echo "(".$numberGeo." ".$this->lang->line('Restant').")";} ?></h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<table id="liste_users" class="table table-bordered table-striped table-modified">
|
||||
<thead>
|
||||
<tr class="label-primary">
|
||||
<th><?= $this->lang->line('Parrain'); ?></th>
|
||||
<th><?= $this->lang->line('Nom'); ?></th>
|
||||
<th><?= $this->lang->line('Adresse'); ?></th>
|
||||
<th><?= $this->lang->line('code membre'); ?></th>
|
||||
<th><?= $this->lang->line('Email'); ?></th>
|
||||
<th><?= $this->lang->line('Contact'); ?></th>
|
||||
<th><?= $this->lang->line('provider_class'); ?></th>
|
||||
<th><?= $this->lang->line('Active'); ?></th>
|
||||
<?php if($category == 'geolocated') { ?>
|
||||
<!-- <th>QR Code</th>-->
|
||||
<?php } ?>
|
||||
<?php if ($this->session->userdata("category") == "0" or $this->session->userdata("category") == "hyper") {
|
||||
echo "<th> Action </th>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div class="modal fade" id="supervisorModal" role="dialog"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content box box-widget widget-user">
|
||||
<div class="widget-user-header label-primary">
|
||||
<h3 class="widget-user-username btn-center"><?= $this->lang->line("Parrain") ?></h3>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 border-right">
|
||||
<div class="description-block">
|
||||
<h5 class="description-header">
|
||||
<strong><?= $this->lang->line("Catégorie") ?>: </strong>
|
||||
</h5>
|
||||
<span class="description-text" id="super_cateogy"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 border-right">
|
||||
<div class="description-block">
|
||||
<h5 class="description-header">
|
||||
<strong><?= $this->lang->line("Nom") ?>: </strong></h5>
|
||||
<span class="description-text" id="super_lastname"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 ">
|
||||
<div class="description-block">
|
||||
<h5 class="description-header">
|
||||
<strong><?= $this->lang->line("Reseau") ?> :</strong></h5>
|
||||
<span class="description-text" id="super_network"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 border-right">
|
||||
<div class="description-block">
|
||||
<h5 class="description-header">
|
||||
<strong><?= $this->lang->line("code membre") ?> : </strong>
|
||||
</h5>
|
||||
<span id="super_code_membre"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 ">
|
||||
<div class="description-block">
|
||||
<h5 class="description-header">
|
||||
<strong><?= $this->lang->line("Code parrain") ?> : </strong>
|
||||
</h5>
|
||||
<span id="super_code_parrain"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-lg btn-default pull-left"
|
||||
data-dismiss="modal"><?= $this->lang->line("Fermer") ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="editModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title"><?= $this->lang->line('Mettre à jour des informations'); ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="update-form" method="post" class="bottom-75 center-block">
|
||||
<div class="form-group">
|
||||
<label for="code"><?= $this->lang->line('code membre'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="code"
|
||||
readonly id="code">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="categorie"><?= $this->lang->line('Catégorie'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="categorie"
|
||||
readonly id="categorie">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nom"><?= $this->lang->line('Nom'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="nom" required
|
||||
id="nom">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adresse"><?= $this->lang->line('Adresse'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="adresse"
|
||||
required id="adresse">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email"><?= $this->lang->line('Email'); ?></label>
|
||||
<input type="email" class="form-control input-lg" name="email"
|
||||
required id="email">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="contact"><?= $this->lang->line('Contact'); ?></label>
|
||||
<input type="text" class="form-control input-lg" name="contact"
|
||||
required id="contact">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-form-label"><?= $this->lang->line('provider_class'); ?></label>
|
||||
<select class="form-control input-lg" name="provider_class_id" required id="provider_class_id">
|
||||
<?php
|
||||
foreach ($provider_classes->result() as $value) { ?>
|
||||
<option value="<?=$value->id?>"> <?=$value->name?> </option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input id="btn-update" type="submit" value="Confirmer"
|
||||
class="btn btn-primary">
|
||||
<button type="button" class="btn btn-default pull-right"
|
||||
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="suppreModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title"><?= $this->lang->line('Suppression'); ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="message"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-danger pull-left" id="delete">Confirmer</button>
|
||||
<button type="button" class="btn btn-default pull-right"
|
||||
data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div id='loader' class="center-div loader">
|
||||
<div class="center-div">
|
||||
<img style="text-align: center" class="img-center"
|
||||
src="<?= base_url('dist/img/loading.gif') ?>" alt="Loading" height="50" width="50">
|
||||
<p style="text-align: center">Chargement</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
<!-- jQuery 3 -->
|
||||
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
||||
<!-- Bootstrap 3.3.7 -->
|
||||
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||||
<!-- DataTables -->
|
||||
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
|
||||
<script src="<?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
|
||||
<!-- SlimScroll -->
|
||||
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
|
||||
<script src="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
|
||||
<script src="<?= base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
|
||||
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(window).on('load', function () {
|
||||
$(".loader").fadeOut("1000");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
var table = $('#liste_users').DataTable({
|
||||
// Processing indicator
|
||||
"processing": true,
|
||||
"language": {
|
||||
"processing": "<?= $this->lang->line('loading') ?>"
|
||||
},
|
||||
// DataTables server-side processing mode
|
||||
"serverSide": true,
|
||||
// Initial no order.
|
||||
"order": [],
|
||||
// Load data from an Ajax source
|
||||
"ajax": {
|
||||
"url": "<?= base_url('pagination/GeolocatedUsers/getLists'); ?>",
|
||||
"data": {
|
||||
"code_parrain": "<?= $code_parrain ?? null ?>",
|
||||
"category": "<?= $category ?? null ?>",
|
||||
"town_id": "<?= $town_id ?? null ?>",
|
||||
"network_id": "<?= $network_id ?? null?>"
|
||||
},
|
||||
"type": "POST"
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var member_code = null;
|
||||
var categorie = null;
|
||||
$(document).on("click", ".open-modal", function () {
|
||||
|
||||
member_code = $(this).data('member_code');
|
||||
categorie = $(this).data('category');
|
||||
var nom = $(this).data('lastname');
|
||||
var adresse = $(this).data('adresse');
|
||||
var email = $(this).data('email');
|
||||
var contact = $(this).data('phone');
|
||||
var provider_class_id = $(this).data('provider_class_id');
|
||||
|
||||
$(".modal-body #nom").val(nom);
|
||||
$(".modal-body #adresse").val(adresse);
|
||||
$(".modal-body #email").val(email);
|
||||
$(".modal-body #contact").val(contact);
|
||||
$(".modal-body #categorie").val(categorie);
|
||||
$(".modal-body #code").val(member_code);
|
||||
$(".modal-body #provider_class_id").val(provider_class_id);
|
||||
});
|
||||
|
||||
$("#update-form").submit(function (event) {
|
||||
|
||||
var m_nom = $('#update-form #nom').val();
|
||||
var m_adresse = $('#update-form #adresse').val();
|
||||
var m_email = $('#update-form #email').val();
|
||||
var m_contact = $('#update-form #contact').val();
|
||||
var m_code = $(".modal-body #code").val();
|
||||
var m_cat = $(".modal-body #categorie").val();
|
||||
var m_provider_class_id = $(".modal-body #provider_class_id").val();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('index.php/Admin/updateUser')?>',
|
||||
type: 'post',
|
||||
data: {code: m_code, nom: m_nom, adresse: m_adresse, email: m_email, contact: m_contact, cat: m_cat, provider_class_id : m_provider_class_id},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data === 'completed') {
|
||||
alert("Les informations ont été mises à jours");
|
||||
location.reload(true);
|
||||
} else {
|
||||
alert(data);
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$(document).on("click", ".supre-modal", function () {
|
||||
|
||||
member_code = $(this).data('member_code');
|
||||
categorie = $(this).data('category');
|
||||
var nom = $(this).data('lastname');
|
||||
|
||||
var message = "Voulez-vous vraiment retirer " + nom + " (code membre " + member_code + ") ?";
|
||||
|
||||
$(".modal-body #message").text(message);
|
||||
|
||||
});
|
||||
|
||||
$("#delete").click(function () {
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('index.php/Admin/deleteUser')?>',
|
||||
type: 'post',
|
||||
data: {code: member_code, cat: categorie},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data === 'completed') {
|
||||
alert("L'utilisateur a été retiré");
|
||||
location.reload(true);
|
||||
} else {
|
||||
alert(data);
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$(document).on("click", ".openSupervisorModal", function () {
|
||||
let code_parrain = $(this).data('code_parrain');
|
||||
$.ajax({
|
||||
url: '<?= base_url('index.php/Hyperviseur_dash/fetchSuper')?>',
|
||||
type: 'post',
|
||||
data: {code_membre: code_parrain},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$('#super_cateogy').html(data.category);
|
||||
$('#super_network').html(data.network);
|
||||
$('#super_lastname').html(data.lastname);
|
||||
$('#super_code_membre').html(data.code_membre);
|
||||
$('#super_code_parrain').html(data.code_parrain);
|
||||
$('#supervisorModal').modal('show')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", ".generateQRCode", function () {
|
||||
let id_agent = $(this).data('id_agent');
|
||||
$.ajax({
|
||||
url: '<?= base_url('index.php/Hyperviseur_dash/generateQRCode')?>',
|
||||
type: 'POST',
|
||||
data: {id_agent: id_agent},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
data = JSON.parse(data)
|
||||
if(data.status === 200){
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: "<?= $this->lang->line('qr_code_generated')?>",
|
||||
text: "<?= $this->lang->line('informations_updated')?>",
|
||||
timer: 3000
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error.responseText);
|
||||
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function myMap() {
|
||||
|
||||
var mapProp= {
|
||||
center:new google.maps.LatLng(<?= $latitude; ?>,<?= $longitude; ?>),
|
||||
<?php
|
||||
if($this->session->userdata('category')!='admin'){
|
||||
echo "zoom:10";
|
||||
}else{
|
||||
echo "zoom:1";
|
||||
}
|
||||
?>
|
||||
};
|
||||
var myLatLng = {lat: <?= $latitude; ?>, lng: <?= $longitude; ?>};
|
||||
var map=new google.maps.Map(document.getElementById("map"),mapProp);
|
||||
|
||||
<?php
|
||||
if($this->session->userdata('category')!='admin'){
|
||||
echo "var myPosition = new google.maps.Marker({
|
||||
position: myLatLng,
|
||||
map: map,
|
||||
title: '".$this->lang->line('Vous')."'
|
||||
});";
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$result=$positions;
|
||||
|
||||
if($result!=false){
|
||||
$numrows=$result->num_rows();
|
||||
$num = 0;
|
||||
if ($numrows > 0) {
|
||||
|
||||
$site_url = base_url();
|
||||
// output data of each row
|
||||
foreach ($result->result() as $row) {
|
||||
$num++;
|
||||
$mlat = (float)$row->latitude;
|
||||
//echo $mlat.' '.gettype($mlat).' ';
|
||||
$mlng = (float)$row->longitude;
|
||||
echo "var marker = new google.maps.Marker({
|
||||
position: {lat:" .$mlat.", lng: ".$mlng."},
|
||||
map: map,
|
||||
title: '".addslashes($row->lastname)."'
|
||||
});";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script>
|
||||
<script async defer
|
||||
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDwljY6bNBeL6ZsY-1Lz9imVCAshEXVkNc&callback=myMap"></script>
|
|
@ -45,7 +45,6 @@
|
|||
<td align='center'><?=$row->email?></td>
|
||||
<td align='center'><?=$row->phone ?></td>
|
||||
<td align='center'><?=$statut?></td>
|
||||
<td id='edition' align='center'>
|
||||
<td>
|
||||
<button class='btn btn-success edit' data-id="<?=$row->id?>" data-firstname="<?=$row->firstname?>" data-lastname="<?=$row->lastname?>"
|
||||
data-email="<?=$row->email?>" data-phone="<?=$row->phone?>" >
|
||||
|
|
Loading…
Reference in New Issue