Implemtation of insurance subscription details

This commit is contained in:
Djery-Tom 2021-10-26 15:37:13 +01:00
parent 2a1d4f05f0
commit 8008eed20f
21 changed files with 1242 additions and 693 deletions

View File

@ -93,4 +93,5 @@ define('WALLET_SERVICE_EXTERNE_URL','https://ilink-app.com:8085');
define('WALLET_SERVICE_EXTERNE_TOKEN','JeJMx6KNW1qo2h01rCVOLfX3f1nmcF2I'); define('WALLET_SERVICE_EXTERNE_TOKEN','JeJMx6KNW1qo2h01rCVOLfX3f1nmcF2I');
define('NOTIFICATION_SERVICE_URL','https://ilink-app.com:8083'); define('NOTIFICATION_SERVICE_URL','https://ilink-app.com:8083');
define('NOTIFICATION_SERVICE_TOKEN','RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg'); define('NOTIFICATION_SERVICE_TOKEN','RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg');
define('NANO_SANTE_SERVICE_URL','https://ilink-app.com:8086');
define('NANO_SANTE_SERVICE_TOKEN','eStSQIoAfnTJ9nkCs0IJkJiKACxYVcQm');

View File

@ -359,10 +359,33 @@ class Hyperviseur_dash extends CI_Controller
if ($this->isLogged()) { if ($this->isLogged()) {
$id_network = $this->session->userdata('network_id'); $id_network = $this->session->userdata('network_id');
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
$res = $this->wallet_model->getWalletPassword($id_network);
$data['walletPassword'] = $res ? $res->first_row() : null;
$data['alert'] = "";
$data['active'] = "wallet_wallet";
$data['code_parrain'] = $this->session->userdata('code_parrain');
$data['category'] = $this->session->userdata('category');
$data['network'] = $this->session->userdata('network');
$data['network_id'] = $id_network;
$data['country'] = $this->session->userdata('current_pays');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
if ($data['hasWallet']) { if ($data['hasWallet']) {
if ($this->input->get('history')) { if ($this->input->get('history')) {
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['user'] = $this->db->get_where('user_infos',['user_id' => $data['subscription']->user_id ?? null])->first_row();
$this->load->view('header_hyp', $data);
$this->load->view('nano_health/hyper/infos_insurance_subscription');
$this->load->view('footer');
return;
}else{
$this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'), $this->input->get('parrainId')); $this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->input->get('history'), $this->input->get('parrainId'));
}
} elseif ($this->input->get('config')) { } elseif ($this->input->get('config')) {
$this->config_wallet($this->input->get('config'), $this->input->get('country')); $this->config_wallet($this->input->get('config'), $this->input->get('country'));
} elseif ($this->input->get('show')) { } elseif ($this->input->get('show')) {
@ -456,18 +479,6 @@ class Hyperviseur_dash extends CI_Controller
$data['wallet_id'] = $row->wallet_id; $data['wallet_id'] = $row->wallet_id;
$data['curreny_code'] = $this->session->userdata('currency_code'); $data['curreny_code'] = $this->session->userdata('currency_code');
$res = $this->wallet_model->getWalletPassword($id_network);
$data['walletPassword'] = $res ? $res->first_row() : null;
$data['alert'] = "";
$data['active'] = "wallet_wallet";
$data['code_parrain'] = $this->session->userdata('code_parrain');
$data['category'] = $this->session->userdata('category');
$data['network'] = $this->session->userdata('network');
$data['network_id'] = $id_network;
$data['country'] = $this->session->userdata('current_pays');
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
if ($data['hasWallet']->first_row()->type == 'visa') if ($data['hasWallet']->first_row()->type == 'visa')
$this->load->view('gestion_wallet_hyp'); $this->load->view('gestion_wallet_hyp');
@ -519,6 +530,9 @@ class Hyperviseur_dash extends CI_Controller
$data['refunds'] = $this->wallet_model->getRefunds($startDate, $endDate, $network_id); $data['refunds'] = $this->wallet_model->getRefunds($startDate, $endDate, $network_id);
else if ($type == 'commission_payments') else if ($type == 'commission_payments')
$data['payments'] = $this->wallet_model->getCommissionPayments($startDate, $endDate, $network_id); $data['payments'] = $this->wallet_model->getCommissionPayments($startDate, $endDate, $network_id);
else if ($type == 'insurance-subscriptions'){
}
else{ else{
$data['transactions'] = $this->wallet_model->getRecharges($startDate, $endDate, $network_id); $data['transactions'] = $this->wallet_model->getRecharges($startDate, $endDate, $network_id);
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code')); $data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
@ -552,6 +566,8 @@ class Hyperviseur_dash extends CI_Controller
$this->load->view('historique_remboursement'); $this->load->view('historique_remboursement');
else if ($type == 'commission_payments') else if ($type == 'commission_payments')
$this->load->view('config_wallet_ilink_hyp/historique_commission_payements'); $this->load->view('config_wallet_ilink_hyp/historique_commission_payements');
else if ($type == 'insurance-subscriptions')
$this->load->view('nano_health/hyper/insurances_subscriptions.php');
else else
$this->load->view('historique_recharges'); $this->load->view('historique_recharges');
$this->load->view('footer'); $this->load->view('footer');
@ -1926,7 +1942,7 @@ class Hyperviseur_dash extends CI_Controller
$nh_config = $this->nano_health_model->getConfig($data['network_id']); $nh_config = $this->nano_health_model->getConfig($data['network_id']);
$data['nh_config'] = $nh_config ? $nh_config->first_row() : null ; $data['nh_config'] = $nh_config ? $nh_config->first_row() : null ;
$data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ; $data['config_id'] = $data['nh_config'] ? $data['nh_config']->id : null ;
$data['doctors'] = $this->db->get('nh_validating_doctors'); $data['doctors'] = $this->db->get_where('nh_validating_doctors',['nh_network_config_id' => $data['config_id']]);
$this->load->view('header_hyp', $data); $this->load->view('header_hyp', $data);
$this->load->view('nano_health/hyper/validating_doctors'); $this->load->view('nano_health/hyper/validating_doctors');

View File

@ -18,7 +18,9 @@ class NanoHealthController extends CI_Controller
$grid = $_POST['grid'] ?? []; $grid = $_POST['grid'] ?? [];
$this->db->delete('nh_years_prices_grid',['nh_network_config_id' => $configId]); $this->db->delete('nh_years_prices_grid',['nh_network_config_id' => $configId]);
if(sizeof($grid) > 0){
$this->db->insert_batch('nh_years_prices_grid',$grid); $this->db->insert_batch('nh_years_prices_grid',$grid);
}
echo json_encode("200"); echo json_encode("200");
} }
@ -32,8 +34,9 @@ class NanoHealthController extends CI_Controller
$grid = $_POST['grid'] ?? []; $grid = $_POST['grid'] ?? [];
$this->db->delete('nh_months_prices_grid',['nh_network_config_id' => $configId]); $this->db->delete('nh_months_prices_grid',['nh_network_config_id' => $configId]);
if(sizeof($grid) > 0){
$this->db->insert_batch('nh_months_prices_grid',$grid); $this->db->insert_batch('nh_months_prices_grid',$grid);
}
echo json_encode("200"); echo json_encode("200");
} }
} }

View File

@ -0,0 +1,79 @@
<?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 InsuranceSubscription extends CI_Controller
{
private $converter = null;
private $context = null;
function __construct()
{
parent::__construct();
// Load member model
$this->load->model('pagination/InsuranceSubscription_model', 'model');
// set to whatever your rates are relative to
$baseCurrency = 'USD';
// use your own credentials, or re-use your existing PDO connection
$pdo = new PDO('mysql:host=' . $this->db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password);
$configuration = new PDOProviderConfiguration();
$configuration->tableName = 'exchange_rate';
$configuration->exchangeRateColumnName = 'exchange_rate';
$configuration->targetCurrencyColumnName = 'target_currency';
$configuration->sourceCurrencyCode = $baseCurrency;
// this provider loads exchange rates from your database
$provider = new PDOProvider($pdo, $configuration);
// this provider calculates exchange rates relative to the base currency
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
// this currency converter can now handle any currency pair
$this->converter = new CurrencyConverter($provider);
$this->context = new AutoContext();
}
function getLists()
{
$data = $row = array();
// Fetch member's records
$witData = $this->model->getRows($_POST);
$i = $_POST['start'];
$current_url = $_POST['currentURL'];
foreach ($witData as $row) {
$i++;
$bonus_amount = Money::of(round($row->total_bonus_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR');
$data[] = array($i,$row->insurance_subscription_id, $row->lastname, $row->phone, $row->number_of_months, $row->number_of_beneficiaries,
$bonus_amount, strtoupper($this->lang->line($row->state)), $row->created_at,
'<a href="'.$current_url.'?history=insurance-subscriptions&id='.$row->insurance_subscription_id.'" class="btn btn-primary" > '.$this->lang->line('Voir plus...').'</a>');
}
$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);
}
}

View File

@ -665,7 +665,7 @@ $lang['add_act'] = "Add a procedure";
$lang['edit_act'] = "Edit an act"; $lang['edit_act'] = "Edit an act";
$lang['billing_type'] = "Billing type"; $lang['billing_type'] = "Billing type";
$lang['authorization_type'] = "authorization type"; $lang['authorization_type'] = "authorization type";
$lang['subscriptions_of_the_last_12_months'] = "Subscriptions of the last 12 months"; $lang['subscriptions_of_the_last_12_months'] = "Subscriptions and care requests of the last 12 months";
$lang['subscriptions_historic'] = "Subscription history"; $lang['subscriptions_historic'] = "Subscription history";
$lang['PACKAGE'] = "Package"; $lang['PACKAGE'] = "Package";
$lang['UNIT_PRICE'] = "Unit price"; $lang['UNIT_PRICE'] = "Unit price";
@ -693,4 +693,25 @@ $lang['add_provider_class'] = "Add a provider class";
$lang['edit_provider_class'] = "Edit a class"; $lang['edit_provider_class'] = "Edit a class";
$lang['delete_provider_class'] = "Delete a provider class"; $lang['delete_provider_class'] = "Delete a provider class";
$lang['provider_class_deleted'] = "Deleted provider class"; $lang['provider_class_deleted'] = "Deleted provider class";
$lang['first_rule_months_price_grid'] = "The minimum amount must not exceed the coverage limit per year";
$lang['subscriptions_history'] = "Subscription history";
$lang['bonus_amount'] = "Bonus amount";
$lang['number_of_beneficiaries'] = "Number of beneficiaries";
$lang['age_limit_of_insured_and_spouse'] = "Age limit of the insured and spouse";
$lang['age_limit_rule'] = "The age limit of the insured and spouse must be strictly greater than the age limit of the child beneficiary";
$lang['insured_infos'] = "Information about the insured";
$lang['subscriptions'] = "Subscriptions";
$lang['subscription_detail'] = "Subscription detail";
$lang['beneficiaries'] = "The beneficiaries";
$lang['insured_bonus_amount'] = "Insured_bonus amount";
$lang['gender'] = "Gender";
$lang['show'] = "Show";
$lang['accept'] = "Accept";
$lang['reject'] = "Reject";
$lang['UNDER_VALIDATION'] = "Under validation";
$lang['CHILD'] = "CHILD";
$lang['SPOUSE'] = "SPOUSE";
$lang['care_requests'] = "Care requests";
$lang['birthdate_proof_doc'] = "Birth certificate";
$lang['justice_doc'] = "Justice document";
?> ?>

View File

@ -677,7 +677,7 @@ $lang['add_act'] = "Ajouter un acte";
$lang['edit_act'] = "Modifier un acte"; $lang['edit_act'] = "Modifier un acte";
$lang['billing_type'] = "Type de facturation"; $lang['billing_type'] = "Type de facturation";
$lang['authorization_type'] = "Type d'autorisation"; $lang['authorization_type'] = "Type d'autorisation";
$lang['subscriptions_of_the_last_12_months'] = "Souscriptions des 12 derniers mois"; $lang['subscriptions_of_the_last_12_months'] = "Souscriptions et demandes de soins des 12 derniers mois";
$lang['subscriptions_historic'] = "Historique des souscriptions"; $lang['subscriptions_historic'] = "Historique des souscriptions";
$lang['PACKAGE'] = "Forfait"; $lang['PACKAGE'] = "Forfait";
$lang['UNIT_PRICE'] = "Prix unitaire"; $lang['UNIT_PRICE'] = "Prix unitaire";
@ -705,4 +705,25 @@ $lang['add_provider_class'] = "Ajouter une classe de prestataire";
$lang['edit_provider_class'] = "Modifier une classe"; $lang['edit_provider_class'] = "Modifier une classe";
$lang['delete_provider_class'] = "Suppression d'une classe de prestataire"; $lang['delete_provider_class'] = "Suppression d'une classe de prestataire";
$lang['provider_class_deleted'] = "Classe de prestataire supprimée"; $lang['provider_class_deleted'] = "Classe de prestataire supprimée";
$lang['first_rule_months_price_grid'] = "Le montant minimal ne doit pas être supérieur à la limite de couverture par an";
$lang['subscriptions_history'] = "Historique des souscriptions";
$lang['bonus_amount'] = "Montant de la prime";
$lang['number_of_beneficiaries'] = "Nombre dayants droit";
$lang['age_limit_of_insured_and_spouse'] = "Age limite de l'assuré et du conjoint";
$lang['age_limit_rule'] = "L'age limite de l'assuré et du conjoint doit être strictetement supérieur à l'age limite de layant droit enfant";
$lang['insured_infos'] = "Informations sur l'assuré";
$lang['subscriptions'] = "Souscriptions";
$lang['subscription_detail'] = "Detail de la souscription";
$lang['beneficiaries'] = "Les ayants droits ou benéficiaires";
$lang['insured_bonus_amount'] = "Montant de la prime d'assuré";
$lang['gender'] = "Sexe";
$lang['show'] = "Afficher";
$lang['accept'] = "Accepter";
$lang['reject'] = "Rejeter";
$lang['UNDER_VALIDATION'] = "En cours de validation";
$lang['CHILD'] = "ENFANT";
$lang['SPOUSE'] = "CONJOINT";
$lang['care_requests'] = "Demandes de soins";
$lang['birthdate_proof_doc'] = "Acte de naissance";
$lang['justice_doc'] = "Document de justice";
?> ?>

View File

@ -42,4 +42,8 @@ class Nano_health_model extends CI_Model
{ {
return $this->db->get_where('nh_provider_classes',['nh_network_config_id'=> $configId]); return $this->db->get_where('nh_provider_classes',['nh_network_config_id'=> $configId]);
} }
public function getInfosInsuranceSubscriptionById($insuranceSubscriptionId){
return $this->db->get_where('nh_infos_insurances_subscriptions',['insurance_subscription_id'=> $insuranceSubscriptionId])->first_row();
}
} }

View File

@ -168,11 +168,7 @@ class User_model extends CI_Model
FROM super_infos FROM super_infos
WHERE category='super' WHERE category='super'
AND code_parrain='".$codeHyp."')"); AND code_parrain='".$codeHyp."')");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getVilleByUserGeo($network,$country){ public function getVilleByUserGeo($network,$country){
@ -203,11 +199,7 @@ class User_model extends CI_Model
WHERE child.category='geolocated' AND dad.category='super' AND dad.code_parrain='".$codeHyp."' AND child.town='".$ville."' WHERE child.category='geolocated' AND dad.category='super' AND dad.code_parrain='".$codeHyp."' AND child.town='".$ville."'
LIMIT 100"); LIMIT 100");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getUsersGeolocatedPositionByVilleForHyp($ville,$codeHyp){ public function getUsersGeolocatedPositionByVilleForHyp($ville,$codeHyp){
@ -219,11 +211,7 @@ class User_model extends CI_Model
ON child.code_parrain=dad.code_membre ON child.code_parrain=dad.code_membre
WHERE child.category='geolocated' AND dad.category='super' AND dad.code_parrain='".$codeHyp."' AND child.town='".$ville."'"); WHERE child.category='geolocated' AND dad.category='super' AND dad.code_parrain='".$codeHyp."' AND child.town='".$ville."'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getDemandes($code_membre){ public function getDemandes($code_membre){
@ -242,11 +230,7 @@ class User_model extends CI_Model
ORDER BY dateAjout"); ORDER BY dateAjout");
} }
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
@ -318,11 +302,7 @@ class User_model extends CI_Model
WHERE d.code_membre='".$member_code."'".$chain. WHERE d.code_membre='".$member_code."'".$chain.
"ORDER BY date_creation"); "ORDER BY date_creation");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
@ -339,11 +319,7 @@ class User_model extends CI_Model
WHERE child.category='super' AND dad.category='hyper' AND dad.code_membre='".$codeHyp."' WHERE child.category='super' AND dad.category='hyper' AND dad.code_membre='".$codeHyp."'
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getUsersGeolocatedForSup($codeSup){ public function getUsersGeolocatedForSup($codeSup){
@ -359,11 +335,7 @@ class User_model extends CI_Model
WHERE child.category='geolocated' AND dad.category='super' AND dad.code_membre='".$codeSup."' LIMIT 100 WHERE child.category='geolocated' AND dad.category='super' AND dad.code_membre='".$codeSup."' LIMIT 100
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllGeolocatedUsersForHyp($codeHyp){ public function getAllGeolocatedUsersForHyp($codeHyp){
@ -377,11 +349,7 @@ class User_model extends CI_Model
AND code_parrain='".$codeHyp."') AND code_parrain='".$codeHyp."')
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllDemandesForSuper($member_code){ public function getAllDemandesForSuper($member_code){
@ -798,11 +766,7 @@ class User_model extends CI_Model
AND (codeParrain='".$codeHyper."' AND (codeParrain='".$codeHyper."'
OR codeParrain IN (SELECT code_membre FROM super_infos WHERE code_parrain='".$codeHyper."' AND category ='super')) OR codeParrain IN (SELECT code_membre FROM super_infos WHERE code_parrain='".$codeHyper."' AND category ='super'))
ORDER BY dateAjout"); ORDER BY dateAjout");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function adminGetTempsMoyen($pays,$codeHyper,$ville){ public function adminGetTempsMoyen($pays,$codeHyper,$ville){
@ -835,11 +799,7 @@ class User_model extends CI_Model
ORDER BY temps ORDER BY temps
LIMIT 5"); LIMIT 5");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
@ -855,11 +815,7 @@ class User_model extends CI_Model
ORDER BY temps DESC ORDER BY temps DESC
LIMIT 5"); LIMIT 5");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
@ -874,11 +830,7 @@ class User_model extends CI_Model
OR child.code_parrain IN (SELECT code_membre FROM super_infos WHERE code_parrain='".$codeHyper."' AND category ='super') OR child.code_parrain IN (SELECT code_membre FROM super_infos WHERE code_parrain='".$codeHyper."' AND category ='super')
AND child.town_id='".$ville."' AND child.town_id='".$ville."'
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllSimpleUser($pays,$codeHyper){ public function getAllSimpleUser($pays,$codeHyper){
@ -891,22 +843,14 @@ class User_model extends CI_Model
AND super_infos.code_parrain ='".$codeHyper."' AND super_infos.code_parrain ='".$codeHyper."'
GROUP BY super_infos.network_id)"); GROUP BY super_infos.network_id)");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getGeneratedCodes($codeHyper){ public function getGeneratedCodes($codeHyper){
$query = $this->db->query("SELECT * FROM codeGenerer WHERE code_parrain='".$codeHyper."' AND code_parrain!=code_membre"); $query = $this->db->query("SELECT * FROM codeGenerer WHERE code_parrain='".$codeHyper."' AND code_parrain!=code_membre");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
@ -914,11 +858,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT * FROM codeGenerer WHERE category='hyper'"); $query = $this->db->query("SELECT * FROM codeGenerer WHERE category='hyper'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
@ -928,11 +868,7 @@ class User_model extends CI_Model
FROM info_demandesAdhesion FROM info_demandesAdhesion
WHERE code_membre='".$codeHyp."'"); WHERE code_membre='".$codeHyp."'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getCodesByHyperviseur($codeHyp){ public function getCodesByHyperviseur($codeHyp){
@ -944,11 +880,7 @@ class User_model extends CI_Model
WHERE category='super' AND code_parrain='".$codeHyp."') WHERE category='super' AND code_parrain='".$codeHyp."')
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getCoutForAdmin($pays,$hyper,$ville,$type){ public function getCoutForAdmin($pays,$hyper,$ville,$type){
@ -1011,11 +943,7 @@ class User_model extends CI_Model
AND child.latitude!=-1 AND child.longitude!=-1 AND child.latitude!=-1 AND child.longitude!=-1
ORDER BY child.agent_id DESC LIMIT 100"); ORDER BY child.agent_id DESC LIMIT 100");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getCoutGeolocatedUsersForAdmin($pays,$hyper,$ville){ public function getCoutGeolocatedUsersForAdmin($pays,$hyper,$ville){
@ -1103,11 +1031,7 @@ class User_model extends CI_Model
AND child.category='geolocated' AND child.category='geolocated'
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getUsersSimpleForSup($network,$member_code){ public function getUsersSimpleForSup($network,$member_code){
@ -1120,30 +1044,18 @@ class User_model extends CI_Model
AND users.member_code='".$member_code."' AND users.member_code='".$member_code."'
AND users.network='".$network."') AND users.network='".$network."')
"); ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllVilles(){ public function getAllVilles(){
$query = $this->db->query("SELECT towns.id, towns.name, towns.status ,c.name AS country,c.id AS country_id $query = $this->db->query("SELECT towns.id, towns.name, towns.status ,c.name AS country,c.id AS country_id
FROM towns INNER JOIN countries c on towns.country_id = c.id"); FROM towns INNER JOIN countries c on towns.country_id = c.id");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllPays(){ public function getAllPays(){
$query = $this->db->query("SELECT * FROM countries ORDER BY name"); $query = $this->db->query("SELECT * FROM countries ORDER BY name");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function changeVilleStatut($id_ville,$new_statut){ public function changeVilleStatut($id_ville,$new_statut){
@ -1160,20 +1072,12 @@ class User_model extends CI_Model
public function getAllNetworksNames(){ public function getAllNetworksNames(){
$query = $this->db->query("SELECT * FROM networks WHERE country_id IS NULL ORDER BY name"); $query = $this->db->query("SELECT * FROM networks WHERE country_id IS NULL ORDER BY name");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllAssignedNetworks(){ public function getAllAssignedNetworks(){
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id FROM `networks` INNER JOIN countries ON networks.country_id=countries.id"); $query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id FROM `networks` INNER JOIN countries ON networks.country_id=countries.id");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function assignCountryToNetwork($name,$id_country){ public function assignCountryToNetwork($name,$id_country){
@ -1198,11 +1102,7 @@ class User_model extends CI_Model
public function getAllAdmin(){ public function getAllAdmin(){
$query = $this->db->query("SELECT firstname,lastname,admin.id AS id_admin,email,phone,adresse,admin.country AS country_id,admin.category,admin.salt,c.name AS country FROM admin INNER JOIN countries c on admin.country = c.id"); $query = $this->db->query("SELECT firstname,lastname,admin.id AS id_admin,email,phone,adresse,admin.country AS country_id,admin.category,admin.salt,c.name AS country FROM admin INNER JOIN countries c on admin.country = c.id");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function isEmailExist($email) { public function isEmailExist($email) {
@ -1289,19 +1189,11 @@ class User_model extends CI_Model
public function getIdCodeGenerer($code_membre){ public function getIdCodeGenerer($code_membre){
$query = $this->db->query("SELECT id FROM codeGenerer WHERE code_parrain='".$code_membre."' OR code_parrain IN (SELECT code_membre FROM codeGenerer where code_parrain='".$code_membre."')"); $query = $this->db->query("SELECT id FROM codeGenerer WHERE code_parrain='".$code_membre."' OR code_parrain IN (SELECT code_membre FROM codeGenerer where code_parrain='".$code_membre."')");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getGabonNetwork(){ public function getGabonNetwork(){
$query = $this->db->query("SELECT id,name FROM networks WHERE country_id='78'"); $query = $this->db->query("SELECT id,name FROM networks WHERE country_id='78'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getCodeHyper($id_network){ public function getCodeHyper($id_network){
$query = $this->db->query("SELECT codeGenerer_id FROM networks_agents WHERE network_id='".$id_network."'"); $query = $this->db->query("SELECT codeGenerer_id FROM networks_agents WHERE network_id='".$id_network."'");
@ -1320,11 +1212,7 @@ class User_model extends CI_Model
public function getVillesByPays($pays_id){ public function getVillesByPays($pays_id){
$query = $this->db->query("SELECT towns.id, towns.name, towns.status $query = $this->db->query("SELECT towns.id, towns.name, towns.status
FROM towns WHERE towns.country_id='".$pays_id."'"); FROM towns WHERE towns.country_id='".$pays_id."'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAgentsFromCountry($id_country){ public function getAgentsFromCountry($id_country){
@ -1332,11 +1220,7 @@ class User_model extends CI_Model
FROM super_infos AS ag FROM super_infos AS ag
WHERE ag.country_id='".$id_country."' AND category='super' WHERE ag.country_id='".$id_country."' AND category='super'
GROUP BY lastname"); GROUP BY lastname");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getPointGeolocalised($id_network,$lastname){ public function getPointGeolocalised($id_network,$lastname){
@ -1391,11 +1275,7 @@ class User_model extends CI_Model
public function getNetworks($country_id){ public function getNetworks($country_id){
$query = $this->db->query("SELECT id,name FROM networks WHERE country_id ='".$country_id."'"); $query = $this->db->query("SELECT id,name FROM networks WHERE country_id ='".$country_id."'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getActiveNetworks($country_id){ public function getActiveNetworks($country_id){
@ -1420,11 +1300,7 @@ class User_model extends CI_Model
AND child.town_id='".$ville."' AND child.town_id='".$ville."'
LIMIT ".$start.",".$limit); LIMIT ".$start.",".$limit);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function get_current_page_records_hyper($limit, $start,$hyper,$ville) public function get_current_page_records_hyper($limit, $start,$hyper,$ville)
@ -1443,11 +1319,7 @@ class User_model extends CI_Model
AND child.town='".$ville."' AND child.town='".$ville."'
LIMIT ".$start.",".$limit); LIMIT ".$start.",".$limit);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function get_current_page_records_super($limit, $start,$super) public function get_current_page_records_super($limit, $start,$super)
@ -1464,11 +1336,7 @@ class User_model extends CI_Model
AND child.code_parrain='".$super."' AND child.code_parrain='".$super."'
LIMIT ".$start.",".$limit); LIMIT ".$start.",".$limit);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function get_total($pays,$hyper,$ville) public function get_total($pays,$hyper,$ville)
@ -1497,29 +1365,17 @@ class User_model extends CI_Model
AND child.latitude!=-1 AND child.longitude!=-1 AND child.latitude!=-1 AND child.longitude!=-1
LIMIT ".$start.",".$limit); LIMIT ".$start.",".$limit);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getAllNetworksInfos($country_id){ public function getAllNetworksInfos($country_id){
$query = $this->db->query("SELECT * FROM networks WHERE country_id ='".$country_id."'"); $query = $this->db->query("SELECT * FROM networks WHERE country_id ='".$country_id."'");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getCountries(){ public function getCountries(){
$query = $this->db->query("SELECT countries.id,countries.name,countries.code_country,countries.code_dial,towns.name AS ville,towns.id AS id_ville FROM `towns` INNER JOIN countries ON towns.country_id=countries.id GROUP BY countries.id "); $query = $this->db->query("SELECT countries.id,countries.name,countries.code_country,countries.code_dial,towns.name AS ville,towns.id AS id_ville FROM `towns` INNER JOIN countries ON towns.country_id=countries.id GROUP BY countries.id ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getFreeCode(){ public function getFreeCode(){
@ -1551,11 +1407,7 @@ class User_model extends CI_Model
public function getInfosActivationHyperviseur(){ public function getInfosActivationHyperviseur(){
$query = $this->db->query("SELECT networks_agents.phone, networks_agents.validation_code, agents.number_super,agents.number_geoBysuper FROM `agents` INNER JOIN networks_agents ON networks_agents.agent_id=agents.id INNER JOIN codeGenerer ON codeGenerer.id=networks_agents.codeGenerer_id WHERE codeGenerer.category='hyper' AND agents.number_geoBysuper IS NULL AND agents.number_super IS NULL "); $query = $this->db->query("SELECT networks_agents.phone, networks_agents.validation_code, agents.number_super,agents.number_geoBysuper FROM `agents` INNER JOIN networks_agents ON networks_agents.agent_id=agents.id INNER JOIN codeGenerer ON codeGenerer.id=networks_agents.codeGenerer_id WHERE codeGenerer.category='hyper' AND agents.number_geoBysuper IS NULL AND agents.number_super IS NULL ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getCodeMembreHyper($network_id){ public function getCodeMembreHyper($network_id){
@ -1719,11 +1571,7 @@ class User_model extends CI_Model
WHERE child.country_id='".$pays."' WHERE child.country_id='".$pays."'
ORDER BY child.agent_id DESC "); ORDER BY child.agent_id DESC ");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function checkCountryGameExist($pays){ public function checkCountryGameExist($pays){
@ -1750,11 +1598,7 @@ class User_model extends CI_Model
public function getPaliers(){ public function getPaliers(){
$query = $this->db->query("SELECT * $query = $this->db->query("SELECT *
FROM paliers"); FROM paliers");
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function modifPalier($value,$niveau){ public function modifPalier($value,$niveau){
$query = $this->db->query("UPDATE paliers SET valeur = ".$value." WHERE id =".$niveau); $query = $this->db->query("UPDATE paliers SET valeur = ".$value." WHERE id =".$niveau);
@ -1839,11 +1683,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT * $query = $this->db->query("SELECT *
FROM infos_transaction FROM infos_transaction
WHERE `network_id`=".$id_network.$chain); WHERE `network_id`=".$id_network.$chain);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getDeletedTransactions($debut , $fin , $id_network){ public function getDeletedTransactions($debut , $fin , $id_network){
@ -1866,11 +1706,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT * $query = $this->db->query("SELECT *
FROM wallet_agent FROM wallet_agent
WHERE `network_id`=".$id_network); WHERE `network_id`=".$id_network);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
/** /**

View File

@ -53,11 +53,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT * $query = $this->db->query("SELECT *
FROM infos_transaction FROM infos_transaction
WHERE `network_id`=".$id_network.$chain); WHERE `network_id`=".$id_network.$chain);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
public function getTransactionsSup($debut , $fin , $codeMembre){ public function getTransactionsSup($debut , $fin , $codeMembre){
@ -72,11 +68,7 @@ class Wallet_model extends CI_Model
$query = $this->db->query("SELECT * $query = $this->db->query("SELECT *
FROM wallet_agent FROM wallet_agent
WHERE `network_id`=".$id_network); WHERE `network_id`=".$id_network);
if($query->num_rows()>0){ return $query->num_rows() > 0 ? $query : false;
return $query;
}else{
return false;
}
} }
/** /**

View File

@ -0,0 +1,97 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class InsuranceSubscription_model extends CI_Model
{
function __construct()
{
// Set table name
$this->table = 'nh_infos_insurances_subscriptions';
// Set orderable column fields
$this->column_order = array(null, 'insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state','created_at', null);
// Set searchable column fields
$this->column_search = array('insurance_subscription_id', 'lastname', 'phone', 'number_of_months', 'number_of_beneficiaries', 'bonus_amount', 'state','created_at');
// 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)]);
}
}
}

View File

@ -8,106 +8,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css"> <link rel="stylesheet" href="<?= base_url('dist/css/custom/levels-table.css') ?>">
.table-wrapper {
width: 700px;
margin: 30px auto;
background: #fff;
padding: 20px;
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
}
.table-title {
padding-bottom: 10px;
margin: 0 0 10px;
}
.table-title h2 {
margin: 6px 0 0;
font-size: 22px;
}
.table-title .add-new {
float: right;
height: 30px;
font-weight: bold;
font-size: 12px;
text-shadow: none;
min-width: 100px;
border-radius: 50px;
line-height: 13px;
}
.table-title .add-new i {
margin-right: 4px;
}
table.table {
table-layout: fixed;
}
table.table tr th, table.table tr td {
border-color: #e9e9e9;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table th:last-child {
width: 100px;
}
table.table td a {
cursor: pointer;
display: inline-block;
margin: 0 5px;
min-width: 24px;
}
table.table td a.add {
color: #27C46B;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #E34724;
}
table.table td i {
font-size: 19px;
}
table.table td a.add i {
font-size: 24px;
margin-right: -1px;
position: relative;
top: 3px;
}
table.table .form-control {
height: 32px;
line-height: 32px;
box-shadow: none;
border-radius: 2px;
}
/*table.table .form-control.error {*/
/* border-color: #f50000;*/
/*}*/
.error {
border-color: #f50000;
}
table.table td .add {
display: none;
}
</style>
<?php <?php
use Brick\Money\Context\CustomContext; use Brick\Money\Context\CustomContext;

View File

@ -8,106 +8,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css"> <link rel="stylesheet" href="<?= base_url('dist/css/custom/levels-table.css') ?>">
.table-wrapper {
width: 700px;
margin: 30px auto;
background: #fff;
padding: 20px;
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
}
.table-title {
padding-bottom: 10px;
margin: 0 0 10px;
}
.table-title h2 {
margin: 6px 0 0;
font-size: 22px;
}
.table-title .add-new {
float: right;
height: 30px;
font-weight: bold;
font-size: 12px;
text-shadow: none;
min-width: 100px;
border-radius: 50px;
line-height: 13px;
}
.table-title .add-new i {
margin-right: 4px;
}
table.table {
table-layout: fixed;
}
table.table tr th, table.table tr td {
border-color: #e9e9e9;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table th:last-child {
width: 100px;
}
table.table td a {
cursor: pointer;
display: inline-block;
margin: 0 5px;
min-width: 24px;
}
table.table td a.add {
color: #27C46B;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #E34724;
}
table.table td i {
font-size: 19px;
}
table.table td a.add i {
font-size: 24px;
margin-right: -1px;
position: relative;
top: 3px;
}
table.table .form-control {
height: 32px;
line-height: 32px;
box-shadow: none;
border-radius: 2px;
}
/*table.table .form-control.error {*/
/* border-color: #f50000;*/
/*}*/
.error {
border-color: #f50000;
}
table.table td .add {
display: none;
}
</style>
<?php <?php
use Brick\Money\Context\CustomContext; use Brick\Money\Context\CustomContext;

View File

@ -8,106 +8,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css"> <link rel="stylesheet" href="<?= base_url('dist/css/custom/levels-table.css') ?>">
.table-wrapper {
width: 700px;
margin: 30px auto;
background: #fff;
padding: 20px;
box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
}
.table-title {
padding-bottom: 10px;
margin: 0 0 10px;
}
.table-title h2 {
margin: 6px 0 0;
font-size: 22px;
}
.table-title .add-new {
float: right;
height: 30px;
font-weight: bold;
font-size: 12px;
text-shadow: none;
min-width: 100px;
border-radius: 50px;
line-height: 13px;
}
.table-title .add-new i {
margin-right: 4px;
}
table.table {
table-layout: fixed;
}
table.table tr th, table.table tr td {
border-color: #e9e9e9;
}
table.table th i {
font-size: 13px;
margin: 0 5px;
cursor: pointer;
}
table.table th:last-child {
width: 100px;
}
table.table td a {
cursor: pointer;
display: inline-block;
margin: 0 5px;
min-width: 24px;
}
table.table td a.add {
color: #27C46B;
}
table.table td a.edit {
color: #FFC107;
}
table.table td a.delete {
color: #E34724;
}
table.table td i {
font-size: 19px;
}
table.table td a.add i {
font-size: 24px;
margin-right: -1px;
position: relative;
top: 3px;
}
table.table .form-control {
height: 32px;
line-height: 32px;
box-shadow: none;
border-radius: 2px;
}
/*table.table .form-control.error {*/
/* border-color: #f50000;*/
/*}*/
.error {
border-color: #f50000;
}
table.table td .add {
display: none;
}
</style>
<?php <?php
use Brick\Money\Context\CustomContext; use Brick\Money\Context\CustomContext;

View File

@ -18,6 +18,49 @@
$("body").removeClass("loading"); $("body").removeClass("loading");
} }
}); });
// Export server side table
function newexportaction(e, dt, button, config) {
var self = this;
var oldStart = dt.settings()[0]._iDisplayStart;
dt.one('preXhr', function (e, s, data) {
// Just this once, load all data from the server...
data.start = 0;
data.length = 2147483647;
dt.one('preDraw', function (e, settings) {
// Call the original action function
if (button[0].className.indexOf('buttons-copy') >= 0) {
$.fn.dataTable.ext.buttons.copyHtml5.action.call(self, e, dt, button, config);
} else if (button[0].className.indexOf('buttons-excel') >= 0) {
$.fn.dataTable.ext.buttons.excelHtml5.available(dt, config) ?
$.fn.dataTable.ext.buttons.excelHtml5.action.call(self, e, dt, button, config) :
$.fn.dataTable.ext.buttons.excelFlash.action.call(self, e, dt, button, config);
} else if (button[0].className.indexOf('buttons-csv') >= 0) {
$.fn.dataTable.ext.buttons.csvHtml5.available(dt, config) ?
$.fn.dataTable.ext.buttons.csvHtml5.action.call(self, e, dt, button, config) :
$.fn.dataTable.ext.buttons.csvFlash.action.call(self, e, dt, button, config);
} else if (button[0].className.indexOf('buttons-pdf') >= 0) {
$.fn.dataTable.ext.buttons.pdfHtml5.available(dt, config) ?
$.fn.dataTable.ext.buttons.pdfHtml5.action.call(self, e, dt, button, config) :
$.fn.dataTable.ext.buttons.pdfFlash.action.call(self, e, dt, button, config);
} else if (button[0].className.indexOf('buttons-print') >= 0) {
$.fn.dataTable.ext.buttons.print.action(e, dt, button, config);
}
dt.one('preXhr', function (e, s, data) {
// DataTables thinks the first item displayed is index 0, but we're not drawing that.
// Set the property to what it was before exporting.
settings._iDisplayStart = oldStart;
data.start = oldStart;
});
// Reload the grid with the original page. Otherwise, API functions like table.cell(this) don't work properly.
setTimeout(dt.ajax.reload, 0);
// Prevent rendering of the full data to the DOM
return false;
});
});
// Requery the server with the new one-time export settings
dt.ajax.reload();
}
</script> </script>
</body> </body>

View File

@ -470,7 +470,7 @@
<div class="col-12"> <div class="col-12">
<label><?= $this->lang->line('user_image') ?></label> <label><?= $this->lang->line('user_image') ?></label>
<div> <div>
<img src="<?= $user_image_file ? $user_image : '../../images/broken.png' ?>" <img src="<?= $user_image_file ? $user_image : base_url('images/broken.png') ?>"
alt="user_image"/> alt="user_image"/>
</div> </div>
</div> </div>
@ -479,13 +479,13 @@
<div class="row" style="margin-top: 10px"> <div class="row" style="margin-top: 10px">
<div class="col-sm-6 text-center"> <div class="col-sm-6 text-center">
<label><?= $this->lang->line('document_image_front') ?></label> <label><?= $this->lang->line('document_image_front') ?></label>
<img src="<?= $document_front_file ? $document_front : '../../images/broken.png' ?>" <img src="<?= $document_front_file ? $document_front : base_url('images/broken.png') ?>"
alt="document_front"/> alt="document_front"/>
</div> </div>
<div class="col-sm-6 text-center"> <div class="col-sm-6 text-center">
<label><?= $this->lang->line('document_image_back') ?></label> <label><?= $this->lang->line('document_image_back') ?></label>
<img src="<?= $document_back_file ? $document_back : '../../images/broken.png'?>" <img src="<?= $document_back_file ? $document_back : base_url('images/broken.png')?>"
alt="document_back"/> alt="document_back"/>
</div> </div>
@ -674,7 +674,7 @@
<div class="col-12"> <div class="col-12">
<label><?= $this->lang->line('user_image') ?></label> <label><?= $this->lang->line('user_image') ?></label>
<div> <div>
<img src="<?= $user_image_file ? $user_image : '../../images/broken.png' ?>" <img src="<?= $user_image_file ? $user_image : base_url('images/broken.png') ?>"
alt="user_image"/> alt="user_image"/>
</div> </div>
</div> </div>
@ -683,13 +683,13 @@
<div class="row" style="margin-top: 10px"> <div class="row" style="margin-top: 10px">
<div class="col-sm-6 text-center"> <div class="col-sm-6 text-center">
<label><?= $this->lang->line('document_image_front') ?></label> <label><?= $this->lang->line('document_image_front') ?></label>
<img src="<?= $document_front_file ? $document_front : '../../images/broken.png' ?>" <img src="<?= $document_front_file ? $document_front : base_url('images/broken.png') ?>"
alt="document_front"/> alt="document_front"/>
</div> </div>
<div class="col-sm-6 text-center"> <div class="col-sm-6 text-center">
<label><?= $this->lang->line('document_image_back') ?></label> <label><?= $this->lang->line('document_image_back') ?></label>
<img src="<?= $document_back_file ? $document_back : '../../images/broken.png'?>" <img src="<?= $document_back_file ? $document_back : base_url('images/broken.png')?>"
alt="document_back"/> alt="document_back"/>
</div> </div>

View File

@ -11,60 +11,16 @@
use Brick\Money\Money; use Brick\Money\Money;
$context = new \Brick\Money\Context\AutoContext(); $context = new \Brick\Money\Context\AutoContext();
$month = time(); //$month = time();
$months[] = convertDate(date("M")); //$months[] = convertDate(date("M"));
$label_months [] = date("M") . " " . date("Y"); //$label_months [] = date("M") . " " . date("Y");
$years[] = date("Y"); //$years[] = date("Y");
for ($i = 1; $i <= 11; $i++) { //for ($i = 1; $i <= 11; $i++) {
$month = strtotime('last month', $month); // $month = strtotime('last month', $month);
$months [] = convertDate(date("M", $month)); // $months [] = convertDate(date("M", $month));
$years[] = date("Y", $month); // $years[] = date("Y", $month);
$label_months [] = date("M", $month) . " " . date("Y", $month); // $label_months [] = date("M", $month) . " " . date("Y", $month);
} //}
/**
** Retraits
**/
$date = date("Y");
$retraits_data[] = '';
$retraits_data = array();
for ($i = 1; $i <= 12; $i++) {
$retraits_query_mounth = $this->db->query("SELECT id FROM infos_transaction
WHERE network_id='" . $network_id . "'
AND MONTH(date_created) = '" . $months[$i - 1] . "'
AND YEAR(date_created) = '" . $years[$i - 1] . "'
AND type_transac='debit'");
$retraits_data[] = $retraits_query_mounth->num_rows();
}
$startDate = (new DateTime('01-' . $months[11] . '-' . $years[11]))->format('Y-m-d H:i:s');
$endDate = date_create_from_format('m/Y', $months[0] . '/' . $years[0])->format('Y-m-d H:i:s');
$retraits = $this->db->query("SELECT * FROM infos_transaction
WHERE network_id='" . $network_id . "'
AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "'
AND type_transac='debit'");
/**
** Dépots
**/
$date = date("Y");
$depots_data[] = '';
$depots_data = array();
for ($i = 1; $i <= 12; $i++) {
$depots_query_mounth = $this->db->query("SELECT id FROM infos_transaction
WHERE network_id='" . $network_id . "'
AND MONTH(date_created) = '" . $months[$i - 1] . "'
AND YEAR(date_created) = '" . $years[$i - 1] . "'
AND type_transac='credit'");
$depots_data[] = $depots_query_mounth->num_rows();
}
$depots = $this->db->query("SELECT * FROM infos_transaction
WHERE network_id='" . $network_id . "'
AND date_created BETWEEN '" . $startDate . "' AND '" . $endDate . "'
AND type_transac='credit'");
//if ($transactions != false) { //if ($transactions != false) {
// $transac = $transactions->num_rows(); // $transac = $transactions->num_rows();

View File

@ -10,16 +10,30 @@
use Brick\Money\Money; use Brick\Money\Money;
$context = new \Brick\Money\Context\AutoContext(); $context = new \Brick\Money\Context\AutoContext();
//$month = time(); $month = time();
//$months[] = convertDate(date("M")); $months[] = convertDate(date("M"));
//$label_months [] = date("M") . " " . date("Y"); $label_months [] = date("M") . " " . date("Y");
//$years[] = date("Y"); $years[] = date("Y");
//for ($i = 1; $i <= 11; $i++) { for ($i = 1; $i <= 11; $i++) {
// $month = strtotime('last month', $month); $month = strtotime('last month', $month);
// $months [] = convertDate(date("M", $month)); $months [] = convertDate(date("M", $month));
// $years[] = date("Y", $month); $years[] = date("Y", $month);
// $label_months [] = date("M", $month) . " " . date("Y", $month); $label_months [] = date("M", $month) . " " . date("Y", $month);
//} }
/**
** Liste des souscriptions
**/
$date = date("Y");
$insuranceSubcriptions =array();
for ($i = 1; $i <= 12; $i++) {
$monthQuery = $this->db->query("SELECT id FROM nh_insurances_subscriptions
WHERE MONTH(created_at) = '".$months[$i-1]."' AND YEAR(created_at) = '".$years[$i-1]."'
AND network_id ='".$this->session->userdata('network_id')."'");
array_push($insuranceSubcriptions, $monthQuery->num_rows());
}
$careRequests = [];
//if ($transactions != false) { //if ($transactions != false) {
// $transac = $transactions->num_rows(); // $transac = $transactions->num_rows();
@ -129,6 +143,17 @@ $context = new \Brick\Money\Context\AutoContext();
</div> </div>
</div> </div>
<div class="col-lg-3 col-xs-6"> <div class="col-lg-3 col-xs-6">
<div class="small-box bg-orange">
<div class="inner">
<h3><?= Money::of(round($nh_config->coverage_limit_per_insured_per_year ?? 0, 2), $curreny_code, $context)->formatTo('fr_FR'); ?></h3>
<p><?= $this->lang->line('coverage_limit_per_insured_per_year') ?> </p>
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active"> <div class="small-box bg-aqua-active">
<div class="inner"> <div class="inner">
<h3><?= $nh_config->max_number_of_beneficiaries ?? ''; ?></h3> <h3><?= $nh_config->max_number_of_beneficiaries ?? ''; ?></h3>
@ -139,8 +164,18 @@ $context = new \Brick\Money\Context\AutoContext();
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-2 col-xs-6">
<div class="col-lg-3 col-xs-6"> <div class="small-box bg-aqua-active">
<div class="inner">
<h3><?= $nh_config->age_limit_of_insured_and_spouse ?? ''; ?></h3>
<p><?= $this->lang->line('age_limit_of_insured_and_spouse') ?> </p>
</div>
<div class="icon">
<i class="ion ion-android-calendar"></i>
</div>
</div>
</div>
<div class="col-lg-2 col-xs-6">
<div class="small-box bg-aqua-active"> <div class="small-box bg-aqua-active">
<div class="inner"> <div class="inner">
<h3><?= $nh_config->age_limit_of_child_beneficiary ?? ''; ?></h3> <h3><?= $nh_config->age_limit_of_child_beneficiary ?? ''; ?></h3>
@ -151,17 +186,6 @@ $context = new \Brick\Money\Context\AutoContext();
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-orange">
<div class="inner">
<h3><?= Money::of(round($nh_config->coverage_limit_per_insured_per_year ?? 0, 2), $curreny_code, $context)->formatTo('fr_FR'); ?></h3>
<p><?= $this->lang->line('coverage_limit_per_insured_per_year') ?> </p>
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-2 col-xs-6"> <div class="col-lg-2 col-xs-6">
@ -311,7 +335,7 @@ $context = new \Brick\Money\Context\AutoContext();
<h3 class="box-title"> <h3 class="box-title">
<?= $this->lang->line('subscriptions_of_the_last_12_months'); ?></h3> <?= $this->lang->line('subscriptions_of_the_last_12_months'); ?></h3>
<div class="box-tools"> <div class="box-tools">
<a class="btn btn-primary" href="<?= current_url().($network_id ? '?id='.$network_id . '&history=subscriptions' : '')?>"> <a class="btn btn-primary" href="<?= current_url().('?history=insurance-subscriptions')?>">
<?= $this->lang->line('subscriptions_historic'); ?> <?= $this->lang->line('subscriptions_historic'); ?>
</a> </a>
</div> </div>
@ -426,7 +450,7 @@ $context = new \Brick\Money\Context\AutoContext();
</div> </div>
<div class="modal fade" id="modal-update"> <div class="modal fade" id="modal-update">
<div class="modal-dialog"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
@ -436,6 +460,8 @@ $context = new \Brick\Money\Context\AutoContext();
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="walletForm"> <form id="walletForm">
<div class="row">
<div class="col-lg-6">
<div class="form-group"> <div class="form-group">
<label for="nom" <label for="nom"
class="col-form-label"><?= $this->lang->line('provider_billing_period'); ?></label> class="col-form-label"><?= $this->lang->line('provider_billing_period'); ?></label>
@ -446,16 +472,6 @@ $context = new \Brick\Money\Context\AutoContext();
<?php } ?> <?php } ?>
</select> </select>
</div> </div>
<div class="form-group">
<label class="col-form-label"><?= $this->lang->line('max_number_of_beneficiaries'); ?></label>
<input type="number" min="0" max="9" required class="form-control"
name="max_number_of_beneficiaries" value="<?= $nh_config->max_number_of_beneficiaries ?? 0 ?>">
</div>
<div class="form-group">
<label class="col-form-label"><?= $this->lang->line('age_limit_of_child_beneficiary'); ?></label>
<input type="number" min="0" max="99" required class="form-control"
name="age_limit_of_child_beneficiary" value="<?= $nh_config->age_limit_of_child_beneficiary ?? 0 ?>">
</div>
<div class="form-group"> <div class="form-group">
<label class="col-form-label"><?= $this->lang->line('coverage_limit_per_insured_per_year'); ?></label> <label class="col-form-label"><?= $this->lang->line('coverage_limit_per_insured_per_year'); ?></label>
<input type="number" min="0" step="0.01" required class="form-control" <input type="number" min="0" step="0.01" required class="form-control"
@ -463,6 +479,24 @@ $context = new \Brick\Money\Context\AutoContext();
</div> </div>
<div class="form-group" style="margin-top: 40px"> <div class="form-group" style="margin-top: 40px">
<label class="col-form-label"><?= $this->lang->line('max_number_of_beneficiaries'); ?></label>
<input type="number" min="0" max="9" step="1" required class="form-control"
name="max_number_of_beneficiaries" value="<?= $nh_config->max_number_of_beneficiaries ?? 0 ?>">
</div>
<div class="form-group">
<label class="col-form-label"><?= $this->lang->line('age_limit_of_insured_and_spouse'); ?></label>
<input type="number" min="0" max="99" step="1" required class="form-control"
name="age_limit_of_insured_and_spouse" value="<?= $nh_config->age_limit_of_insured_and_spouse ?? 0 ?>">
</div>
<div class="form-group">
<label class="col-form-label"><?= $this->lang->line('age_limit_of_child_beneficiary'); ?></label>
<input type="number" min="0" max="99" step="1" required class="form-control"
name="age_limit_of_child_beneficiary" value="<?= $nh_config->age_limit_of_child_beneficiary ?? 0 ?>">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label class="col-form-label"><?= $this->lang->line('current_affection').' : '.$this->lang->line('percentage_insurer') . ' (%)'; ?></label> <label class="col-form-label"><?= $this->lang->line('current_affection').' : '.$this->lang->line('percentage_insurer') . ' (%)'; ?></label>
<input type="number" min="0" step=".01" required class="form-control" <input type="number" min="0" step=".01" required class="form-control"
name="current_affection_percentage_insurer" value="<?= $nh_config->current_affection_percentage_insurer ?? 0 ?>"> name="current_affection_percentage_insurer" value="<?= $nh_config->current_affection_percentage_insurer ?? 0 ?>">
@ -494,6 +528,9 @@ $context = new \Brick\Money\Context\AutoContext();
<input type="number" min="0" step=".01" required class="form-control" <input type="number" min="0" step=".01" required class="form-control"
name="exoneration_percentage_insured" value="<?= $nh_config->exoneration_percentage_insured ?? 0 ?>"> name="exoneration_percentage_insured" value="<?= $nh_config->exoneration_percentage_insured ?? 0 ?>">
</div> </div>
</div>
</div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -738,8 +775,37 @@ $context = new \Brick\Money\Context\AutoContext();
$(function () { $(function () {
$('#example1').DataTable(); $('#example1').DataTable();
$('#provider_classes').DataTable(); $('#provider_classes').DataTable();
}) })
</script> </script>
<script>
var areaChartData = {
labels : <?php echo json_encode($label_months) ?>,
datasets: [
{
label : "<?= $this->lang->line('subscriptions') ?>",
fillColor : 'rgba(255, 162, 0, 1)',
strokeColor : 'rgba(255, 162, 0, 1)',
pointColor : 'rgba(255, 162, 0, 1)',
pointStrokeColor : '#ffa200',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data: <?php echo json_encode($insuranceSubcriptions) ?>
},
{
label : "<?= $this->lang->line('care_requests') ?>",
fillColor : 'rgba(0, 187, 255, 1)',
strokeColor : 'rgba(0, 187, 255, 1)',
pointColor : '#00bbff',
pointStrokeColor : 'rgba(0, 187, 255, 1)',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(0, 187, 255, 1)',
data : <?php echo json_encode($careRequests) ?>
}
]
};
</script>
<script> <script>
toastr.options.closeButton = true; toastr.options.closeButton = true;
@ -755,6 +821,9 @@ $context = new \Brick\Money\Context\AutoContext();
var network_id = $(this).data('network-id'); var network_id = $(this).data('network-id');
if ($('#walletForm')[0].checkValidity()) { if ($('#walletForm')[0].checkValidity()) {
var age_limit_of_insured_and_spouse = parseFloat($('input[name=age_limit_of_insured_and_spouse]').val());
var age_limit_of_child_beneficiary = parseFloat($('input[name=age_limit_of_child_beneficiary]').val());
var current_affection_percentage_insurer = parseFloat($('input[name=current_affection_percentage_insurer]').val()); var current_affection_percentage_insurer = parseFloat($('input[name=current_affection_percentage_insurer]').val());
var current_affection_percentage_insured = parseFloat($('input[name=current_affection_percentage_insured]').val()); var current_affection_percentage_insured = parseFloat($('input[name=current_affection_percentage_insured]').val());
@ -764,7 +833,9 @@ $context = new \Brick\Money\Context\AutoContext();
var exoneration_percentage_insurer = parseFloat($('input[name=exoneration_percentage_insurer]').val()); var exoneration_percentage_insurer = parseFloat($('input[name=exoneration_percentage_insurer]').val());
var exoneration_percentage_insured = parseFloat($('input[name=exoneration_percentage_insured]').val()); var exoneration_percentage_insured = parseFloat($('input[name=exoneration_percentage_insured]').val());
if( (current_affection_percentage_insurer + current_affection_percentage_insured) !== 100){ if(age_limit_of_insured_and_spouse < age_limit_of_child_beneficiary){
toastr.error("<?= $this->lang->line('age_limit_rule')?>", "<?= $this->lang->line('management_rule')?>");
}else if((current_affection_percentage_insurer + current_affection_percentage_insured) !== 100){
toastr.error("<?= $this->lang->line('current_affection_rule')?>", "<?= $this->lang->line('management_rule')?>"); toastr.error("<?= $this->lang->line('current_affection_rule')?>", "<?= $this->lang->line('management_rule')?>");
}else if( (long_term_affection_percentage_insurer + long_term_affection_percentage_insured) !== 100){ }else if( (long_term_affection_percentage_insurer + long_term_affection_percentage_insured) !== 100){
toastr.error("<?= $this->lang->line('long_term_affection_rule')?>", "<?= $this->lang->line('management_rule')?>"); toastr.error("<?= $this->lang->line('long_term_affection_rule')?>", "<?= $this->lang->line('management_rule')?>");
@ -779,6 +850,7 @@ $context = new \Brick\Money\Context\AutoContext();
"id_config": config_id, "id_config": config_id,
"provider_billing_period": $("select[name=provider_billing_period]").val(), "provider_billing_period": $("select[name=provider_billing_period]").val(),
"max_number_of_beneficiaries": $("input[name=max_number_of_beneficiaries]").val(), "max_number_of_beneficiaries": $("input[name=max_number_of_beneficiaries]").val(),
"age_limit_of_insured_and_spouse": $("input[name=age_limit_of_insured_and_spouse]").val(),
"age_limit_of_child_beneficiary": $("input[name=age_limit_of_child_beneficiary]").val(), "age_limit_of_child_beneficiary": $("input[name=age_limit_of_child_beneficiary]").val(),
"coverage_limit_per_insured_per_year": $("input[name=coverage_limit_per_insured_per_year]").val(), "coverage_limit_per_insured_per_year": $("input[name=coverage_limit_per_insured_per_year]").val(),
"current_affection_percentage_insurer": current_affection_percentage_insurer, "current_affection_percentage_insurer": current_affection_percentage_insurer,
@ -1095,6 +1167,7 @@ $context = new \Brick\Money\Context\AutoContext();
// Years Grid // Years Grid
var actions1 = $("#years_prices_grid td:last-child").html(); var actions1 = $("#years_prices_grid td:last-child").html();
let maxAge = <?= $nh_config->age_limit_of_child_beneficiary ?? 0 ?>;
// Append table with add row form on add new button click // Append table with add row form on add new button click
$(".new1").click(function () { $(".new1").click(function () {
if (!actions1) { if (!actions1) {
@ -1104,10 +1177,23 @@ $context = new \Brick\Money\Context\AutoContext();
} }
$(this).attr("disabled", "disabled"); $(this).attr("disabled", "disabled");
var index = $("#years_prices_grid tbody tr:last-child").index(); var index = $("#years_prices_grid tbody tr:last-child").index();
var initValue = 0;
$("#years_prices_grid").find('tr').eq(index+1).each(function(i, element) {
$(element).find('td').each(function(i, element) {
// Recuperer l'ancien age maximal
var colVal = $(element).text();
if(i === 1 ){
initValue = parseInt(colVal.trim()) + 1 ;
}
});
});
var row = '<tr>' + var row = '<tr>' +
'<td><input type="number" required min="0" max="99" class="form-control" name="min_age"></td>' + `<td><input type="number" required min="0" max="99" class="form-control" name="min_age" value="${initValue}" disabled></td>` +
'<td><input type="number" required min="0" max="99" class="form-control" name="max_age" ></td>' + `<td><input type="number" required min="0" max="99" class="form-control" name="max_age" value="${maxAge}" ></td>` +
'<td><input type="number" required class="form-control" min="0" max="100" name="markup_percentage"></td>' + '<td><input type="number" required class="form-control" min="-100" max="100" name="markup_percentage"></td>' +
'<td> ' + actions1 + '</td>' + '<td> ' + actions1 + '</td>' +
'</tr>'; '</tr>';
$("#years_prices_grid").append(row); $("#years_prices_grid").append(row);
@ -1120,7 +1206,6 @@ $context = new \Brick\Money\Context\AutoContext();
var input = $(this).parents("tr").find('input[type="number"]'); var input = $(this).parents("tr").find('input[type="number"]');
var min = parseFloat($(this).parents("tr").find('input[name="min_age"]').first().val()); var min = parseFloat($(this).parents("tr").find('input[name="min_age"]').first().val());
var max = parseFloat($(this).parents("tr").find('input[name="max_age"]').first().val()); var max = parseFloat($(this).parents("tr").find('input[name="max_age"]').first().val());
let maxAge = <?= $nh_config->age_limit_of_child_beneficiary ?? 0 ?>;
input.each(function () { input.each(function () {
if ($(this).attr('name') == 'min_age') { if ($(this).attr('name') == 'min_age') {
@ -1135,6 +1220,7 @@ $context = new \Brick\Money\Context\AutoContext();
$(this).removeClass("error"); $(this).removeClass("error");
} }
} else if ($(this).attr('name') == 'max_age') { } else if ($(this).attr('name') == 'max_age') {
console.log('max')
if (max > maxAge || max <= min) { if (max > maxAge || max <= min) {
$(this).addClass("error"); $(this).addClass("error");
$(this)[0].reportValidity(); $(this)[0].reportValidity();
@ -1168,11 +1254,11 @@ $context = new \Brick\Money\Context\AutoContext();
$(document).on("click", ".edit1", function () { $(document).on("click", ".edit1", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) { $(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0) if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" name="min_age" value="' + $(this).text() + '">'); $(this).html('<input type="number" required class="form-control" min="0" name="min_age" value="' + $(this).text() + '" disabled>');
if (index == 1) if (index == 1)
$(this).html('<input type="number" required class="form-control" name="min_age" value="' + $(this).text() + '">'); $(this).html('<input type="number" required class="form-control" name="max_age" value="' + $(this).text() + '" disabled>');
if (index == 2) if (index == 2)
$(this).html('<input type="number" required class="form-control" min="0" max="100" name="markup_percentage" value="' + $(this).text() + '">'); $(this).html('<input type="number" required class="form-control" min="-100" max="100" name="markup_percentage" value="' + $(this).text() + '">');
}); });
$(this).parents("tr").find(".add, .edit").toggle(); $(this).parents("tr").find(".add, .edit").toggle();
$(".new1").attr("disabled", "disabled"); $(".new1").attr("disabled", "disabled");
@ -1185,6 +1271,8 @@ $context = new \Brick\Money\Context\AutoContext();
//Months Grid //Months Grid
var actions2 = $("#months_prices_grid td:last-child").html(); var actions2 = $("#months_prices_grid td:last-child").html();
let limitAmount = <?= $nh_config->coverage_limit_per_insured_per_year ?? 0 ?>;
// Append table with add row form on add new button click // Append table with add row form on add new button click
$(".new2").click(function () { $(".new2").click(function () {
if (!actions2) { if (!actions2) {
@ -1195,7 +1283,7 @@ $context = new \Brick\Money\Context\AutoContext();
$(this).attr("disabled", "disabled"); $(this).attr("disabled", "disabled");
var index = $("#months_prices_grid tbody tr:last-child").index(); var index = $("#months_prices_grid tbody tr:last-child").index();
var row = '<tr>' + var row = '<tr>' +
'<td><input type="number" required min="0" class="form-control" name="number_of_months"></td>' + '<td><input type="number" required min="1" class="form-control" name="number_of_months"></td>' +
'<td><input type="number" required min="0" step="0.01" class="form-control" name="min_amount" ></td>' + '<td><input type="number" required min="0" step="0.01" class="form-control" name="min_amount" ></td>' +
'<td> ' + actions2 + '</td>' + '<td> ' + actions2 + '</td>' +
'</tr>'; '</tr>';
@ -1207,8 +1295,19 @@ $context = new \Brick\Money\Context\AutoContext();
$(document).on("click", ".add2", function () { $(document).on("click", ".add2", function () {
var empty = false; var empty = false;
var input = $(this).parents("tr").find('input[type="number"]'); var input = $(this).parents("tr").find('input[type="number"]');
var minAmount = parseFloat($(this).parents("tr").find('input[name="min_amount"]').first().val());
input.each(function () { input.each(function () {
if ($(this).attr('name') == 'min_amount') {
if (minAmount > limitAmount) {
$(this).addClass("error");
$(this)[0].reportValidity();
empty = true;
toastr.error("<?= $this->lang->line('first_rule_months_price_grid')?>", "<?php echo $this->lang->line('request_error')?>");
} else {
$(this).removeClass("error");
}
} else {
if (!$(this)[0].checkValidity()) { if (!$(this)[0].checkValidity()) {
$(this).addClass("error"); $(this).addClass("error");
$(this)[0].reportValidity(); $(this)[0].reportValidity();
@ -1216,6 +1315,7 @@ $context = new \Brick\Money\Context\AutoContext();
} else { } else {
$(this).removeClass("error"); $(this).removeClass("error");
} }
}
}); });
$(this).parents("tr").find(".error").first().focus(); $(this).parents("tr").find(".error").first().focus();
if (!empty) { if (!empty) {
@ -1230,7 +1330,7 @@ $context = new \Brick\Money\Context\AutoContext();
$(document).on("click", ".edit2", function () { $(document).on("click", ".edit2", function () {
$(this).parents("tr").find("td:not(:last-child)").each(function (index) { $(this).parents("tr").find("td:not(:last-child)").each(function (index) {
if (index == 0) if (index == 0)
$(this).html('<input type="number" required class="form-control" min="0" name="number_of_months" value="' + $(this).text() + '">'); $(this).html('<input type="number" required class="form-control" min="1" name="number_of_months" value="' + $(this).text() + '">');
if (index == 1) if (index == 1)
$(this).html('<input type="number" required class="form-control" min="0" step="0.01" name="min_amount" value="' + $(this).text() + '">'); $(this).html('<input type="number" required class="form-control" min="0" step="0.01" name="min_amount" value="' + $(this).text() + '">');
}); });

View File

@ -0,0 +1,375 @@
<link rel="stylesheet"
href="<?= base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<link rel="stylesheet"
href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="https://cdn.datatables.net/select/1.3.1/css/select.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
<link rel="stylesheet"
href="<?= base_url('bower_components/jquery-ui/themes/base/jquery-ui.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<section class="content-header">
<h1 style="margin-bottom: 20px">
<?= $this->lang->line('subscriptions') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insurance_subscription_id; ?>
<div class="pull-right" >
<button id="download-notice" class="btn btn-success" >
<?= $this->lang->line('accept') ?>
</button>
<button id="download-notice" class="btn btn-danger" >
<?= $this->lang->line('reject') ?>
</button>
</div>
</h1>
<?php
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;
// set to whatever your rates are relative to
$baseCurrency = 'USD';
// use your own credentials, or re-use your existing PDO connection
$pdo = new PDO('mysql:host=' . $this->db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password);
$configuration = new PDOProviderConfiguration();
$configuration->tableName = 'exchange_rate';
$configuration->exchangeRateColumnName = 'exchange_rate';
$configuration->targetCurrencyColumnName = 'target_currency';
$configuration->sourceCurrencyCode = $baseCurrency;
// this provider loads exchange rates from your database
$provider = new PDOProvider($pdo, $configuration);
// this provider calculates exchange rates relative to the base currency
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
// this currency converter can now handle any currency pair
$this->converter = new CurrencyConverter($provider);
$this->context = new AutoContext();
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
$site_url = base_url();
if ($alert == "ok") {
if (!$success == "ok") {
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?= $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?= $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title"><?= $this->lang->line('insured_infos')?></h3>
</div>
<div class="box-body row" style="overflow-x:auto;">
<div class="col-lg-6" style="padding-left: 25px;">
<table style="width: 100%">
<colgroup>
<col span="1" style="width: 30%;">
<col span="1" style="width: 70%;">
</colgroup>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><?= $this->lang->line('Nom'); ?></td>
<td align="center"><strong><?= $user->lastname ?? '' . $user->firstname ?? ''; ?></strong></td>
</tr>
<tr>
<td><?= $this->lang->line('Adresse')?></td>
<td align="center"><strong><?= $user->adresse ?></strong></td>
</tr>
<tr>
<td><?= $this->lang->line('Contact')?></td>
<td align="center"><strong><?= $user->phone." | ".$user->email ?></strong></td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-6" style="padding-left: 25px;">
<table style="width: 100%">
<colgroup>
<col span="1" style="width: 30%;">
<col span="1" style="width: 70%;">
</colgroup>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-green-active">
<div class="inner">
<h3><?= Money::of(round($subscription->total_bonus_amount, 2), $subscription->currency_code, $this->context)->formatTo('fr_FR') ?></h3>
<p><?= $this->lang->line('bonus_amount') ?></p>
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-red">
<div class="inner">
<h3><?= Money::of(round($subscription->bonus_amount, 2), $subscription->currency_code, $this->context)->formatTo('fr_FR') ?></h3>
<p><?= $this->lang->line('insured_bonus_amount') ?></p>
</div>
<div class="icon">
<i class="ion ion-cash"></i>
</div>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-light-blue">
<div class="inner">
<h3> <?= $subscription->number_of_months ?> </h3>
<p><?= $this->lang->line('number_of_months') ?></p>
</div>
<div class="icon">
<i class="fa fa-clock-o"></i>
</div>
</div>
</div>
<div class="col-lg-3 col-xs-6">
<div class="small-box bg-blue-active">
<div class="inner">
<h3 style="white-space: pre-wrap; font-size: 1.9em;"><?= $this->lang->line($subscription->state)?> </h3>
<p><?= $this->lang->line('Statut') ?></p>
</div>
<div class="icon">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"><?= $this->lang->line('beneficiaries') ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<table id="example1" class="table table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th><?= $this->lang->line('Nom'); ?></th>
<th><?= $this->lang->line('gender'); ?></th>
<th><?= $this->lang->line('birth_date'); ?></th>
<th>Affiliation</th>
<th><?= $this->lang->line('bonus_amount'); ?></th>
<th>Images</th>
</tr>
</thead>
<tbody>
<?php
if (isset($beneficiaries)) {
foreach ($beneficiaries->result() as $i => $row) {
$bonus_amount = Money::of(round($row->bonus_amount, 2), $subscription->currency_code, $this->context)->formatTo('fr_FR');
echo "<tr>
<td>" . $i+1 . "</td>
<td>" . $row->lastname.' '.$row->firstname . "</td>
<td>" . $row->gender . "</td>
<td>" . $row->birthdate . "</td>
<td>".$this->lang->line($row->affiliation)."</td>
<td>" . $bonus_amount. "</td>";
?>
<td>
<button class="btn btn-primary" data-target="#images-modal" data-toggle="modal">
<?= $this->lang->line('show'); ?>
</button>
</td>
</tr>
<div class="modal fade" id="images-modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Images des documents</h3>
</div>
<div class="modal-body">
<?php
$birthdate_proof_doc = NANO_SANTE_SERVICE_URL . '/insurances-subscriptions-docs/'.$row->birthdate_proof_doc;
$birthdate_proof_doc_file = @fopen($birthdate_proof_doc ,'r');
$justice_doc = NANO_SANTE_SERVICE_URL . '/insurances-subscriptions-docs/'.$row->justice_doc;
$justice_doc_file = @fopen($justice_doc ,'r');
?>
<div class="row" style="margin-top: 10px">
<div class="col-sm-6 text-center">
<label><?= $this->lang->line('birthdate_proof_doc') ?></label>
<img src="<?= $birthdate_proof_doc_file ? $birthdate_proof_doc : base_url('images/broken.png') ?>"
alt="document_front"/>
</div>
<div class="col-sm-6 text-center">
<label><?= $this->lang->line('justice_doc') ?></label>
<img src="<?= $justice_doc_file ? $justice_doc : base_url('images/broken.png')?>"
alt="document_back"/>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</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/jquery-ui/jquery-ui.js') ?>"></script>
<script src="<?= base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="https://cdn.datatables.net/select/1.3.1/js/dataTables.select.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" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.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.20/dataRender/datetime.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
<script type="text/javascript">
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
$('#download-notice').click(function(e) {
e.preventDefault(); //stop the browser from following
window.open("<?= WALLET_SERVICE_URL.'/subscriptions_docs/'.$insurance_subscription_id.'.pdf'?>", '_blank');
});
const format = "<?=$this->session->userdata('site_lang')?>" === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
var table = $('#example1').DataTable(
{
order: [[1, 'asc']],
dom: 'Bfrtip',
"buttons": [
'pageLength',
{
"extend": 'excelHtml5',
title: "<?= $this->lang->line('taxes_list') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insurance_subscription_id?>",
// exportOptions: {
// columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
// },
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([4, 5].includes(j)) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data.body[i][j].replace(',', ".")
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
}
}
}
},
},
{
extend: 'csvHtml5',
title: "<?= $this->lang->line('taxes_list') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insurance_subscription_id?>",
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
title: "<?= $this->lang->line('taxes_list') . ' :: ' . $this->lang->line('subscription_detail') . ' - ' . $insurance_subscription_id?>",
},
// 'colvis'
]
}
);
$('#penalties').DataTable();
</script>

View File

@ -0,0 +1,301 @@
<!-- DataTables -->
<link rel="stylesheet"
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.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
<?php
?>
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php echo isset($category) ? 'Wallet' : $this->lang->line('Gestion des wallets') ; echo ' '.$network.' - '.$country
.' :: '.$this->lang->line('subscriptions_history'); ?>
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
</h1>
<?php
$site_url = base_url();
if ($alert == "ok") {
if (!$success == "ok") {
?>
<div class='alert alert-danger alert-dismissible col-xs-6'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible col-xs-6">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Success!</h4>
<?php echo $message; ?>
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
<div class="info-box-content">
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
<span class="info-box-number">
<input id="picker"
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%"
data-category="<?php echo isset($category) ? $category : null ?>"
type="text" name="daterange"
data-lang="<?php echo $this->session->userdata('site_lang') ?>"
value="<?php echo ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
</span>
<span> Format : <?php echo $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('export_transaction_history') ?></h3>
</div>
<div class="box-body" style="overflow-x:auto;">
<table id="subscriptions" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'>#</th>
<th align='center'>ID</th>
<th><?php echo $this->lang->line('Nom') ?></th>
<th><?php echo $this->lang->line('Contact') ?></th>
<th><?php echo $this->lang->line('number_of_months') ?></th>
<th><?php echo $this->lang->line('number_of_beneficiaries') ?></th>
<th><?php echo $this->lang->line('bonus_amount') ?></th>
<th><?php echo $this->lang->line('state') ?></th>
<th align='center'>Date</th>
<th align='center'>Action</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</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>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.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.20/dataRender/datetime.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.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>
$(function () {
const lang = $('#picker').data('lang');
const format = lang === 'french' ? 'fr' : 'en';
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
var table = $('#subscriptions').DataTable({
// Processing indicator
"processing": true,
"language": {
"processing": "<?= $this->lang->line('loading') ?>",
"emptyTable" : "<?= $this->lang->line('Aucune transaction') ?>"
},
// DataTables server-side processing mode
"serverSide": true,
// Initial no order.
"order": [],
// Load data from an Ajax source
"ajax": {
"url": "<?php echo base_url('pagination/InsuranceSubscription/getLists'); ?>",
"data":{
"startDate" : "<?= $startDate?>",
"endDate" : "<?= $endDate?>",
"id_network" : "<?= $id_network ?>",
"currentURL" : "<?= current_url()?>"
},
"type": "POST"
},
"aaSorting": [[8, "desc"]],
"columnDefs": [{
"targets": [8],
// "orderable": false,
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
}],
dom: 'Bfrtip',
"buttons": [
'pageLength',
{
"extend": 'excelHtml5',
title: "<?= $this->lang->line('Historique des subscriptions') ?>",
// exportOptions: {
// columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
// },
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([3, 4, 5,].includes(j)) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data.body[i][j].replace(',', ".")
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
}
}
}
},
trim: false,
"action": newexportaction
},
{
extend: 'csvHtml5',
title: "<?= $this->lang->line('Historique des subscriptions') ?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8]
},
customizeData: function (data) {
for (var i = 0; i < data.body.length; i++) {
for (var j = 0; j < data.body[i].length; j++) {
// data.body[i][j] = '\u200C' + data.body[i][j];
if ([3, 4, 5, 10, 11, 12, 13, 14,15].includes(j)) {
// Get the value and strip the non numeric characters
// var value = $(this).text();
value = data.body[i][j].replace(',', ".")
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
}
}
}
},
trim: false,
"action": newexportaction
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
title: "<?= $this->lang->line('Historique des subscriptions') ?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
},
trim: false,
"action": newexportaction
},
// 'colvis'
]
});
table.buttons().container()
.appendTo('#example_wrapper .col-sm-6:eq(0)');
});
</script>
<script type="text/javascript">
var startDate;
var endDate;
$(function () {
const lang = $('#picker').data('lang');
const category = $('#picker').data('category');
const id_network = "<?= $id_network?>";
$('input[name="daterange"]').daterangepicker({
opens: 'left',
autoUpdateInput: false,
locale: {
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
cancelLabel: 'Clear'
}
}, function (start, end, label) {
const debut = start.format('YYYY-MM-DD');
const fin = end.format('YYYY-MM-DD');
if(category)
window.location = "<?php echo current_url()?>" + "?history=insurance-subscriptions" + "&d=" + debut + "&f=" + fin;
else
window.location = "<?php echo current_url()?>" + "?id="+id_network+"&history=insurance-subscriptions" + "&d=" + debut + "&f=" + fin;
});
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
//do something, like clearing an input
$('#daterange').val('');
if(category)
window.location = "<?php echo current_url()?>" + "?history=insurance-subscriptions";
else
window.location = "<?php echo current_url()?>" + "?id="+id_network+"&history=insurance-subscriptions";
});
});
</script>
<script>
$(document).on("click", "#cancel", function () {
const id_transaction = $(this).data('id-transaction');
$.ajax({
url : '<?php echo base_url('Gestion/cancelIlinkTransation')?>',
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>

View File

@ -18,7 +18,8 @@
"ext-intl": "*", "ext-intl": "*",
"ext-json": "*", "ext-json": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-openssl": "*" "ext-openssl": "*",
"ext-pdo": "*"
}, },
"suggest": { "suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x" "paragonie/random_compat": "Provides better randomness in PHP 5.x"

6
dist/js/custom.js vendored
View File

@ -6,9 +6,9 @@ $(function () {
var barChartCanvas = $('#barChart').get(0).getContext('2d'); var barChartCanvas = $('#barChart').get(0).getContext('2d');
var barChart = new Chart(barChartCanvas); var barChart = new Chart(barChartCanvas);
var barChartData = areaChartData; var barChartData = areaChartData;
barChartData.datasets[1].fillColor = '#00bbff'; // barChartData.datasets[1].fillColor = '#00bbff';
barChartData.datasets[1].strokeColor = '#00bbff'; // barChartData.datasets[1].strokeColor = '#00bbff';
barChartData.datasets[1].pointColor = '#00bbff'; // barChartData.datasets[1].pointColor = '#00bbff';
var barChartOptions = { var barChartOptions = {
//Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
scaleBeginAtZero : true, scaleBeginAtZero : true,