+ Add detect timezone for client browser

This commit is contained in:
DJERY-TOM 2020-05-07 00:36:01 +01:00
parent eb893a50fd
commit 2ad9e3d20d
12 changed files with 795 additions and 815 deletions

View File

@ -9,6 +9,7 @@ class Gestion extends CI_Controller
{
parent::_contruct();
$this->load->model('user_model');
date_default_timezone_set ($this->session->userdata('timezone'));
}
public function index()

View File

@ -13,6 +13,7 @@ class Hyperviseur_dash extends CI_Controller
{
parent::_contruct();
$this->load->model('user_model');
date_default_timezone_set ($this->session->userdata('timezone'));
}
public function index()

View File

@ -8,6 +8,7 @@ class Superviseur_dash extends CI_Controller
parent::__construct();
$this->load->model('Users_simple');
$this->load->model('User_model');
date_default_timezone_set ($this->session->userdata('timezone'));
}
public function index()

View File

@ -77,6 +77,8 @@
$data = $this->user_model->login_user($user_login['user_email'], $user_login['user_password'], $user_login['user_role']);
if ($data) {
$this->session->set_userdata('timezone' ,$this->input->post('timezone') );
date_default_timezone_set ($this->session->userdata('timezone'));
$hyper = "hyper";
$super = "super";

View File

@ -1,267 +1,278 @@
<!-- DataTables -->
<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
<div class="content-wrapper">
<div class="content-header">
<?php
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Error!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible">
<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
}
}
?>
<h1><?php echo $this->lang->line('Codes générés'); ?></h1>
</div>
<section class="content">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $this->lang->line('Générateur de codes'); ?></h3>
</div>
<div class="box-body">
<form name="form_login" action="<?php echo base_url('index.php/Gestion/generateCode') ?>" method="post">
<div class="row">
<div class="col-xs-3">
<input class="form-control" placeholder="<?php echo $this->lang->line('Entrez le nombre de codes'); ?>" type='number' name='c' min="1"/>
</div>
<div class="col-xs-4">
<input class="form-control" placeholder="Entrez le code membre" type='text' value="HYPER" readonly name='a'/>
</div>
<div class="col-xs-5">
<input class="btn btn-block btn-danger" name='b' type='submit' value='Generate'/>
</div>
</div>
</form>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('Tous les codes générés'); ?></h3>
</div>
<div class="box-body">
<?php
$sql1 = $list;
if($sql1!=false){
$numrows=$sql1->num_rows();
$num=0;
if ($numrows > 0) {
?>
<table id="codesGenerated" class="table table-bordered table-striped" >
<thead>
<tr class='label-primary'>
<th></th>
<th><?php echo $this->lang->line('Code'); ?></th>
<th><?php echo $this->lang->line('Catégorie'); ?></th>
<th><?php echo $this->lang->line('Créer le'); ?></th>
<th><?php echo $this->lang->line('Statut'); ?></th>
<th><?php echo $this->lang->line('Supprimer'); ?></th>
</tr>
</thead>
<tbody>
<?php
// output data of each row
foreach($sql1->result() as $row) {
$num ++;
$statut = $this->lang->line('Non attribué');
if($row->etat==1){
$statut = $this->lang->line('Attribué');
}
echo "<tr>
<td>$num</td>
<td> $row->code_membre </td>
<td >$row->category</td>
<td>$row->date_creation</td>
<td>$statut</td>
<td>
<a href='#myModal-2".$num."' role='button' data-toggle='modal'><i class='fa fa-remove'></i></a>
<div class='modal small hide fade' id='myModal-2".$num."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&#10007;</button>
<h3 id='myModalLabel'>".$this->lang->line('Confirmer la suppression')."</h3>
</div>
<div class='modal-body'>
<p class='error-text'><i class='icon-warning-sign modal-icon'></i>Voulez vous vraiment effacer</p>
</div>
<div class='modal-footer'>
<button class='btn' data-dismiss='modal' aria-hidden='true'>Annuler</button>
<a href='CodesG/suppr/?recordId=$row->id' role='button' class='btn btn-danger'>
".$this->lang->line('Supprimer')."</a>
</div>
</div>
</td>
</tr> ";
}
?>
<?php
} else {
echo "No Datas generated";
}
}else{
echo "No Datas generated";
}
$this->db->close();
?>
</tbody>
</table>
</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>
$(function () {
$('#codesGenerated').DataTable();
});
</script>
<script type='text/javascript'>
$(document).ready(function(){
$('#pays').change(function(){
var pays = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getHypByPays')?>',
type: 'post',
data: {pays: pays},
dataType: 'json',
success: function(data){
var len = data.length;
if(len > 0){
var select = document.getElementById('hyper');
$(select).empty();
for (var i in data) {
$(select).append('<option value=' + data[i].member_code + '>' + data[i].lastname +'-' + data[i].network + ' ('+ data[i].member_code +')</option>');
}
$(select).append("<option value='all' >Voir tout --</option>");
var code = data[0].member_code;
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code,pays:pays},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].ville + '>' + list[i].ville +'</option>');
}
$(select).append("<option value='all' >Voir tout --</option>");
}else{
var select = document.getElementById('ville');
$(select).empty();
$(select).append("<option value='all' >Voir tout --</option>");
}
}
});
}else{
var select = document.getElementById('hyper');
$(select).empty();
$(select).append("<option value='all' >Voir tout --</option>");
var select2 = document.getElementById('ville');
$(select2).empty();
$(select2).append("<option value='all' >Voir tout --</option>");
}
}
});
});
$('#hyper').change(function(){
var code = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].ville + '>' + list[i].ville +'</option>');
}
$(select).append("<option value='all' >Voir tout --</option>");
}else{
var select = document.getElementById('ville');
$(select).empty();
$(select).append("<option value='all' >Voir tout --</option>");
}
}
});
});
});
</script>
<!-- DataTables -->
<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
<div class="content-wrapper">
<div class="content-header">
<?php
use Carbon\Carbon;
function toLocateDate($date , $timezone){
if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone);
return $carbon->toDateTimeString();
}
return $date;
}
?>
<?php
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Error!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible">
<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
}
}
?>
<h1><?php echo $this->lang->line('Codes générés'); ?></h1>
</div>
<section class="content">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $this->lang->line('Générateur de codes'); ?></h3>
</div>
<div class="box-body">
<form name="form_login" action="<?php echo base_url('index.php/Gestion/generateCode') ?>" method="post">
<div class="row">
<div class="col-xs-3">
<input class="form-control" placeholder="<?php echo $this->lang->line('Entrez le nombre de codes'); ?>" type='number' name='c' min="1"/>
</div>
<div class="col-xs-4">
<input class="form-control" placeholder="Entrez le code membre" type='text' value="HYPER" readonly name='a'/>
</div>
<div class="col-xs-5">
<input class="btn btn-block btn-danger" name='b' type='submit' value='Generate'/>
</div>
</div>
</form>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line('Tous les codes générés'); ?></h3>
</div>
<div class="box-body">
<?php
$sql1 = $list;
if($sql1!=false){
$numrows=$sql1->num_rows();
$num=0;
if ($numrows > 0) {
?>
<table id="codesGenerated" class="table table-bordered table-striped" >
<thead>
<tr class='label-primary'>
<th></th>
<th><?php echo $this->lang->line('Code'); ?></th>
<th><?php echo $this->lang->line('Catégorie'); ?></th>
<th><?php echo $this->lang->line('Créer le'); ?></th>
<th><?php echo $this->lang->line('Statut'); ?></th>
<th><?php echo $this->lang->line('Supprimer'); ?></th>
</tr>
</thead>
<tbody>
<?php
// output data of each row
foreach($sql1->result() as $row) {
$num ++;
$statut = $this->lang->line('Non attribué');
if($row->etat==1){
$statut = $this->lang->line('Attribué');
}
echo "<tr>
<td>$num</td>
<td> $row->code_membre </td>
<td >$row->category</td>
<td>".toLocateDate($row->date_creation,$this->session->userdata('timezone'))."</td>
<td>$statut</td>
<td>
<a href='#myModal-2".$num."' role='button' data-toggle='modal'><i class='fa fa-remove'></i></a>
<div class='modal small hide fade' id='myModal-2".$num."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&#10007;</button>
<h3 id='myModalLabel'>".$this->lang->line('Confirmer la suppression')."</h3>
</div>
<div class='modal-body'>
<p class='error-text'><i class='icon-warning-sign modal-icon'></i>Voulez vous vraiment effacer</p>
</div>
<div class='modal-footer'>
<button class='btn' data-dismiss='modal' aria-hidden='true'>Annuler</button>
<a href='CodesG/suppr/?recordId=$row->id' role='button' class='btn btn-danger'>
".$this->lang->line('Supprimer')."</a>
</div>
</div>
</td>
</tr> ";
}
?>
<?php
} else {
echo "No Datas generated";
}
}else{
echo "No Datas generated";
}
$this->db->close();
?>
</tbody>
</table>
</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>
$(function () {
$('#codesGenerated').DataTable();
});
</script>
<script type='text/javascript'>
$(document).ready(function(){
$('#pays').change(function(){
var pays = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getHypByPays')?>',
type: 'post',
data: {pays: pays},
dataType: 'json',
success: function(data){
var len = data.length;
if(len > 0){
var select = document.getElementById('hyper');
$(select).empty();
for (var i in data) {
$(select).append('<option value=' + data[i].member_code + '>' + data[i].lastname +'-' + data[i].network + ' ('+ data[i].member_code +')</option>');
}
$(select).append("<option value='all' >Voir tout --</option>");
var code = data[0].member_code;
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code,pays:pays},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].ville + '>' + list[i].ville +'</option>');
}
$(select).append("<option value='all' >Voir tout --</option>");
}else{
var select = document.getElementById('ville');
$(select).empty();
$(select).append("<option value='all' >Voir tout --</option>");
}
}
});
}else{
var select = document.getElementById('hyper');
$(select).empty();
$(select).append("<option value='all' >Voir tout --</option>");
var select2 = document.getElementById('ville');
$(select2).empty();
$(select2).append("<option value='all' >Voir tout --</option>");
}
}
});
});
$('#hyper').change(function(){
var code = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].ville + '>' + list[i].ville +'</option>');
}
$(select).append("<option value='all' >Voir tout --</option>");
}else{
var select = document.getElementById('ville');
$(select).empty();
$(select).append("<option value='all' >Voir tout --</option>");
}
}
});
});
});
</script>

View File

@ -5,6 +5,7 @@
<div class="content-wrapper">
<?php
use Carbon\Carbon;
function duree($time) {
$tabTemps = array("jours" => 86400,
"h" => 3600,
@ -58,6 +59,14 @@
return duree($time);
}
}
function toLocateDate($date , $timezone){
if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone);
return $carbon->toDateTimeString();
}
return $date;
}
?>
<section class="content">
@ -88,12 +97,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">
<?php
if($this->session->userdata('category') == "super"){
if(isset($nameOfcurentGeolocatedUser))
echo "<span class='info-box-number'>".$nameOfcurentGeolocatedUser."</span>";
}
?>
<!-- --><?php
// if($this->session->userdata('category') == "super"){
// if(isset($nameOfcurentGeolocatedUser))
// echo "<span class='info-box-number'>".$nameOfcurentGeolocatedUser."</span>";
// }
// ?>
<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%" type="text" name="daterange" data-lang="<?php echo $this->session->userdata('site_lang') ?>"
@ -162,8 +171,8 @@
<td> $row->phone </td>
<td >Super </td>
<td>$row->code_membre</td>
<td>$row->date_creation </td>
<td > $row->date_modified</td>
<td>".toLocateDate($row->date_creation,$this->session->userdata('timezone'))."</td>
<td > ".toLocateDate($row->date_modified,$this->session->userdata('timezone'))."</td>
<td>$etat</td>
<td>".traitementTemps($row->temps,$row->date_creation)."</td>
@ -237,8 +246,8 @@
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td > ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>".duree($row->temps)."</td>
</tr>";
@ -305,29 +314,16 @@
if($row->superviseur==$this->session->userdata('member_code')){
$superviseur = $this->lang->line('Vous');
}
if($type==$this->lang->line('Adhésion')){
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".duree($row->temps)."</td>
</tr>";}else{
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>".duree($row->temps)."</td>
</tr>";
}
}
?>
</tbody>

View File

@ -5,6 +5,7 @@
<div class="content-wrapper">
<?php
use Carbon\Carbon;
function duree($time)
{
$tabTemps = array("jours" => 86400,
@ -61,6 +62,15 @@
}
}
function toLocateDate($date , $timezone){
if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone);
return $carbon->toDateTimeString();
}
return $date;
}
?>
<!-- Content Header (Page header) -->
<section class="content-header">
@ -216,26 +226,6 @@
// output data of each row
foreach ($result->result() as $row) {
$num++;
if ($type == $this->lang->line('Adhésion')) {
$etat = $this->lang->line("Non traitée");
if ($row->etat == 1) {
$etat = $this->lang->line("traitée");
}
$code = $row->code_membre;
if ($row->code_membre == $this->session->userdata('member_code')) {
$code = $this->lang->line('Vous');
}
echo "<tr>
<td> $row->phone </td>
<td>$code</td>
<td>$row->dateAjout </td>
<td > $row->dateModif</td>
<td>$etat</td>
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
</tr>";
} else {
$etat = $this->lang->line("Non traitée");
if ($row->statut == 1) {
$etat = $this->lang->line("Acceptée");
@ -251,17 +241,16 @@
$destination = $this->lang->line('Vous');
}
echo "<tr>
<td> $row->phone</td>
<td >$origin </td>
<td > $row->montant</td>
<td>$row->dateAjout </td>
<td > $row->dateModif</td>
<td>".toLocateDate($row->dateAjout,$this->session->userdata('timezone'))."</td>
<td > ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td>
<td>$etat</td>
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
</tr>";
}
}
?>
</tbody>
@ -325,27 +314,7 @@
// output data of each row
foreach ($result->result() as $row) {
$num++;
if ($type == $this->lang->line('Adhésion')) {
$etat = $this->lang->line("Non traitée");
if ($row->etat == 1) {
$etat = $this->lang->line("traitée");
}
$code = $row->code;
if ($row->code == $this->session->userdata('member_code')) {
$code = $this->lang->line('Vous');
}
echo "<tr>
<td> $row->phone </td>
<td >$row->categorie </td>
<td>$code</td>
<td>$row->dateAjout </td>
<td > $row->dateModif</td>
<td>$etat</td>
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
</tr>";
} else {
$etat = $this->lang->line("Non traitée");
if ($row->statut == 1) {
$etat = $this->lang->line("Acceptée");
@ -363,13 +332,13 @@
echo "<tr>
<td > $row->montant</td>
<td>$row->dateAjout </td>
<td > $row->dateModif</td>
<td>".toLocateDate($row->dateAjout,$this->session->userdata('timezone'))."</td>
<td > ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td>
<td>$etat</td>
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
</tr>";
}
}
?>
</tbody>
@ -439,35 +408,19 @@
if ($row->superviseur == $this->session->userdata('member_code')) {
$superviseur = $this->lang->line('Vous');
}
if ($type == $this->lang->line('Adhésion')) {
$etat = $this->lang->line("Non traitée");
if ($row->etat == 1) {
$etat = $this->lang->line("traitée");
}
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>" . duree($row->temps) . "</td>
</tr>";
} else {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td > ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>" . duree($row->temps) . "</td>
</tr>";
}
}
?>
</tbody>
@ -535,31 +488,19 @@
if ($row->superviseur == $this->session->userdata('member_code')) {
$superviseur = $this->lang->line('Vous');
}
if ($type == $this->lang->line('Adhésion')) {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>" . duree($row->temps) . "</td>
</tr>";
} else {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>" . duree($row->temps) . "</td>
</tr>";
}
}
?>
</tbody>
@ -629,30 +570,19 @@
if ($row->superviseur == $this->session->userdata('member_code')) {
$superviseur = $this->lang->line('Vous');
}
if ($type == $this->lang->line('Adhésion')) {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>" . duree($row->temps) . "</td>
</tr>";
} else {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>" . duree($row->temps) . "</td>
</tr>";
}
}
?>
</tbody>
@ -732,30 +662,19 @@
if ($row->superviseur == $this->session->userdata('member_code')) {
$superviseur = $this->lang->line('Vous');
}
if ($type == $this->lang->line('Adhésion')) {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>" . duree($row->temps) . "</td>
</tr>";
} else {
echo "<tr>
<td>$num</td>
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>" . duree($row->temps) . "</td>
</tr>";
}
}
?>
</tbody>
@ -843,8 +762,8 @@
<td >$origin </td>
<td>$destination</td>
<td > $row->montant</td>
<td>$row->dateAjout </td>
<td > $row->dateModif</td>
<td>".toLocateDate($row->dateAjout,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateModif,$this->session->userdata('timezone'))."</td>
<td>$etat</td>
<td>" . traitementTemps($row->temps, $row->dateAjout) . "</td>
@ -923,8 +842,8 @@
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>" . duree($row->temps) . "</td>
</tr>";
@ -1001,8 +920,8 @@
<td>$row->emetteur</td>
<td>$superviseur</td>
<td>$row->montant</td>
<td>$row->dateA</td>
<td>$row->dateM</td>
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
<td>" . duree($row->temps) . "</td>
</tr>";

View File

@ -4,7 +4,17 @@
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<div class="content-wrapper">
<?php
use Carbon\Carbon;
function toLocateDate($date , $timezone){
if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone);
return $carbon->toDateTimeString();
}
return $date;
}
?>
<!-- Content Header (Page header) -->
<section class="content-header">
@ -92,7 +102,7 @@
echo "<tr>
<td align='center' >$num</td>
<td>".$fmt->format($row->montant)."</td>
<td> $row->date</td>
<td>".toLocateDate($row->date,$this->session->userdata('timezone'))."</td>
</tr>";
}
?>

View File

@ -4,7 +4,17 @@
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<div class="content-wrapper">
<?php
use Carbon\Carbon;
function toLocateDate($date , $timezone){
if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone);
return $carbon->toDateTimeString();
}
return $date;
}
?>
<!-- Content Header (Page header) -->
<section class="content-header">
@ -103,7 +113,7 @@
<td>".$fmt->format( $row->commission_hyp)."</td>
<td>".$fmt->format( $row->commission_sup)."</td>
<td>".$fmt->format( $row->commission_ag)."</td>
<td> $row->date_created</td>
<td>".toLocateDate($row->date_created,$this->session->userdata('timezone'))."</td>
</tr>";
}

View File

@ -60,7 +60,7 @@
}
?>
<form action="<?php echo base_url('index.php/login_user') ?>" method="post" class="bottom-75">
<form id="loginForm" action="<?php echo base_url('index.php/login_user') ?>" method="post" class="bottom-75">
<div class="table-form">
<div class="form-groups">
<div class="input-group date" style="margin-bottom : 10px;">
@ -164,6 +164,22 @@
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- iCheck -->
<script src="<?php echo base_url('plugins/iCheck/icheck.min.js') ?>"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.7/jstz.min.js"></script>
<script>
$(document).ready(function(){
var tz = jstz.determine(); // Determines the time zone of the browser client
var timezone = tz.name(); //For e.g.:"Asia/Kolkata" for the Indian Time.
// Insert client timezone on login
$("#loginForm").submit( function(eventObj) {
$("<input />").attr("type", "hidden")
.attr("name", "timezone")
.attr("value", timezone)
.appendTo("#loginForm");
return true;
});
});
</script>
<script>
$(function () {
$('input').iCheck({

View File

@ -1,399 +1,411 @@
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Error!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible">
<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
}
}
?>
<h1>
<?php echo $this->lang->line("Demandes d'adhésions et codes valides"); ?>
</h1>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-6">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line("Demandes adhésion"); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<?php
$sql2 = $list_dem;
if($sql2!=false){
$numrows=$sql2->num_rows();
$num = 3000;
if ($numrows > 0) {
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th><?php echo $this->lang->line("Téléphone"); ?></th>
<th><?php echo $this->lang->line("Parrain"); ?></th>
<th><?php echo $this->lang->line("Reseau"); ?></th>
<th><?php echo $this->lang->line("Statut"); ?></th>
<th><?php echo $this->lang->line("Date de la demande"); ?></th>
<th><?php echo $this->lang->line("Supprimer"); ?></th>
</tr>
</thead>
<tbody>
<?php
// output data of each row
foreach($sql2->result() as $row) {
$etat = $this->lang->line("Non traitée");
if($row->etat==1){
$etat = $this->lang->line("traitée");
}
$num ++;
//$member_code = randomString1(10);
echo "<tr>
<td> $row->phone</td>
<td >$row->code_membre </td>
<td>$row->network</td>
<td>$etat</td>
<td >$row->date_creation</td>";
if($row->etat==0){
echo "
<td>
<a href='#myModal-1".$num."' role='button' class='btn btn-block btn-danger' data-toggle='modal'><i class='fa fa-remove'></i></a>
<div class='modal fade' id='myModal-1".$num."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-label='Close'>
<span aria-hidden='true'>&times;</span></button>
<h4 class='modal-title'>".$this->lang->line('Confirmer la suppression')."</h4>
</div>
<div class='modal-body'>
<p class='error-text'><i class='icon-warning-sign modal-icon'></i>".$this->lang->line('Message suppression')." ". $row->phone."?</p>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default pull-left' data-dismiss='modal'>".$this->lang->line('Fermer')."</button>
<a href='".$site_url."Member_code_admin/delete/?recordId=".$row->phone."' role='button' class='btn btn-danger'>
".$this->lang->line('Supprimer')."</a>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('Aucune demande');
}
}
?>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<div class="col-xs-6">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line("Codes valides"); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<?php
$sql1 = $list_codes;
if($sql1!=false){
$numrows=$sql1->num_rows();
$num = 0;
if ($numrows > 0) {
?>
<table id="unvalidated" class="table table-bordered table-striped">
<thead>
<tr>
<th><?php echo $this->lang->line("Code"); ?></th>
<th><?php echo $this->lang->line("Catégorie"); ?></th>
<th><?php echo $this->lang->line("Statut"); ?></th>
<th><?php echo $this->lang->line("Créer le"); ?></th>
<th><?php echo $this->lang->line("Parrain"); ?></th>
<th><?php echo $this->lang->line("Supprimer"); ?></th>
</tr>
</thead>
<tbody>
<?php
// output data of each row
foreach($sql1->result() as $row) {
$etat = $this->lang->line("Non assigné");
if($row->etat==1){
$etat = $this->lang->line("assigné");
}
$num ++;
echo "<tr>
<td> $row->code_membre</td>
<td>$row->category </td>
<td>$etat</td>
<td>$row->date_creation</td>
<td>$row->code_parrain</td>
<td>";
if($row->etat==0){
echo "
<a href='#myModal-2".$num."' role='button' class='btn btn-block btn-danger' data-toggle='modal'><i class='fa fa-remove'></i></a>
<div class='modal smallfade' id='myModal-2".$num."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-label='Close'>
<span aria-hidden='true'>&times;</span></button>
<h4 class='modal-title'>".$this->lang->line('Confirmer la suppression')."</h4>
</div>
<div class='modal-body'>
<p class='error-text'><i class='icon-warning-sign modal-icon'></i>".$this->lang->line('Message suppression code')." ".$row->code_membre."?</p>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default pull-left' data-dismiss='modal'>".$this->lang->line('Fermer')."</button>
<a href='".$site_url."index.php/Member_code_admin/suppress/?recordId=".$row->code_membre."' role='button' class='btn btn-danger' id='delete'>
".$this->lang->line('Supprimer')."</a>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>
</td>";
}
echo "</tr> ";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
}
else {
echo $this->lang->line("Aucun membre validé");
}
}
$this->db->close();
?>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</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>
$(function() {
$('#unvalidated').DataTable()
$('#validated').DataTable()
})
</script>
<script type='text/javascript'>
$(document).ready(function(){
$('#pays').change(function(){
var pays = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getHypByPays')?>',
type: 'post',
data: {pays: pays},
dataType: 'json',
success: function(data){
var len = data.length;
if(len > 0){
var select = document.getElementById('hyper');
if(select===null){
var grpPays = document.getElementById('grp-pays');
$(grpPays).empty();
$(grpPays).append("<select class='form-control input-lg' name='hyper' required id='hyper'></select>");
select = document.getElementById('hyper');
}
$(select).empty();
for (var i in data) {
$(select).append('<option value=' + data[i].code_membre + '>' + data[i].lastname +'-' + data[i].network + ' ('+ data[i].code_membre +')</option>');
}
var code = data[0].code_membre;
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code,pays:pays},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
if(select===null){
var grpVille = document.getElementById('grp-ville');
$(grpVille).empty();
$(grpVille).append("<select class='form-control input-lg' name='ville' required id='ville'></select>");
select = document.getElementById('ville');
}
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].town_id + '>' + list[i].town +'</option>');
}
}else{
var select = document.getElementById('ville');
$(select).empty();
}
}
});
}else{
var select = document.getElementById('hyper');
$(select).empty();
var select2 = document.getElementById('ville');
$(select2).empty();
}
}
});
});
$('#hyper').change(function(){
var code = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].town_id + '>' + list[i].town +'</option>');
}
}else{
var select = document.getElementById('ville');
$(select).empty();
}
}
});
});
});
</script>
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<?php
use Carbon\Carbon;
function toLocateDate($date , $timezone){
if($date){
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
$carbon->setTimezone($timezone);
return $carbon->toDateTimeString();
}
return $date;
}
?>
<?php
$site_url = base_url();
if($alert=="ok") {
if(!$success=="ok"){
?>
<div class='alert alert-danger alert-dismissible'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-ban'></i> Error!</h4>
<?php echo $message; ?>
</div>
<?php
} else {
?>
<div class="alert alert-success alert-dismissible">
<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
}
}
?>
<h1>
<?php echo $this->lang->line("Demandes d'adhésions et codes valides"); ?>
</h1>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-6">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line("Demandes adhésion"); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<?php
$sql2 = $list_dem;
if($sql2!=false){
$numrows=$sql2->num_rows();
$num = 3000;
if ($numrows > 0) {
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th><?php echo $this->lang->line("Téléphone"); ?></th>
<th><?php echo $this->lang->line("Parrain"); ?></th>
<th><?php echo $this->lang->line("Reseau"); ?></th>
<th><?php echo $this->lang->line("Statut"); ?></th>
<th><?php echo $this->lang->line("Date de la demande"); ?></th>
<th><?php echo $this->lang->line("Supprimer"); ?></th>
</tr>
</thead>
<tbody>
<?php
// output data of each row
foreach($sql2->result() as $row) {
$etat = $this->lang->line("Non traitée");
if($row->etat==1){
$etat = $this->lang->line("traitée");
}
$num ++;
//$member_code = randomString1(10);
echo "<tr>
<td> $row->phone</td>
<td >$row->code_membre </td>
<td>$row->network</td>
<td>$etat</td>
<td >".toLocateDate($row->date_creation,$this->session->userdata('timezone'))."</td>";
if($row->etat==0){
echo "
<td>
<a href='#myModal-1".$num."' role='button' class='btn btn-block btn-danger' data-toggle='modal'><i class='fa fa-remove'></i></a>
<div class='modal fade' id='myModal-1".$num."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-label='Close'>
<span aria-hidden='true'>&times;</span></button>
<h4 class='modal-title'>".$this->lang->line('Confirmer la suppression')."</h4>
</div>
<div class='modal-body'>
<p class='error-text'><i class='icon-warning-sign modal-icon'></i>".$this->lang->line('Message suppression')." ". $row->phone."?</p>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default pull-left' data-dismiss='modal'>".$this->lang->line('Fermer')."</button>
<a href='".$site_url."Member_code_admin/delete/?recordId=".$row->phone."' role='button' class='btn btn-danger'>
".$this->lang->line('Supprimer')."</a>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
<?php
}
else {
echo $this->lang->line('Aucune demande');
}
}
?>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<div class="col-xs-6">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php echo $this->lang->line("Codes valides"); ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<?php
$sql1 = $list_codes;
if($sql1!=false){
$numrows=$sql1->num_rows();
$num = 0;
if ($numrows > 0) {
?>
<table id="unvalidated" class="table table-bordered table-striped">
<thead>
<tr>
<th><?php echo $this->lang->line("Code"); ?></th>
<th><?php echo $this->lang->line("Catégorie"); ?></th>
<th><?php echo $this->lang->line("Statut"); ?></th>
<th><?php echo $this->lang->line("Créer le"); ?></th>
<th><?php echo $this->lang->line("Parrain"); ?></th>
<th><?php echo $this->lang->line("Supprimer"); ?></th>
</tr>
</thead>
<tbody>
<?php
// output data of each row
foreach($sql1->result() as $row) {
$etat = $this->lang->line("Non assigné");
if($row->etat==1){
$etat = $this->lang->line("assigné");
}
$num ++;
echo "<tr>
<td> $row->code_membre</td>
<td>$row->category </td>
<td>$etat</td>
<td >".toLocateDate($row->date_creation,$this->session->userdata('timezone'))."</td>
<td>$row->code_parrain</td>
<td>";
if($row->etat==0){
echo "
<a href='#myModal-2".$num."' role='button' class='btn btn-block btn-danger' data-toggle='modal'><i class='fa fa-remove'></i></a>
<div class='modal smallfade' id='myModal-2".$num."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-label='Close'>
<span aria-hidden='true'>&times;</span></button>
<h4 class='modal-title'>".$this->lang->line('Confirmer la suppression')."</h4>
</div>
<div class='modal-body'>
<p class='error-text'><i class='icon-warning-sign modal-icon'></i>".$this->lang->line('Message suppression code')." ".$row->code_membre."?</p>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default pull-left' data-dismiss='modal'>".$this->lang->line('Fermer')."</button>
<a href='".$site_url."index.php/Member_code_admin/suppress/?recordId=".$row->code_membre."' role='button' class='btn btn-danger' id='delete'>
".$this->lang->line('Supprimer')."</a>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>
</td>";
}
echo "</tr> ";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
}
else {
echo $this->lang->line("Aucun membre validé");
}
}
$this->db->close();
?>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</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>
$(function() {
$('#unvalidated').DataTable()
$('#validated').DataTable()
})
</script>
<script type='text/javascript'>
$(document).ready(function(){
$('#pays').change(function(){
var pays = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getHypByPays')?>',
type: 'post',
data: {pays: pays},
dataType: 'json',
success: function(data){
var len = data.length;
if(len > 0){
var select = document.getElementById('hyper');
if(select===null){
var grpPays = document.getElementById('grp-pays');
$(grpPays).empty();
$(grpPays).append("<select class='form-control input-lg' name='hyper' required id='hyper'></select>");
select = document.getElementById('hyper');
}
$(select).empty();
for (var i in data) {
$(select).append('<option value=' + data[i].code_membre + '>' + data[i].lastname +'-' + data[i].network + ' ('+ data[i].code_membre +')</option>');
}
var code = data[0].code_membre;
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code,pays:pays},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
if(select===null){
var grpVille = document.getElementById('grp-ville');
$(grpVille).empty();
$(grpVille).append("<select class='form-control input-lg' name='ville' required id='ville'></select>");
select = document.getElementById('ville');
}
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].town_id + '>' + list[i].town +'</option>');
}
}else{
var select = document.getElementById('ville');
$(select).empty();
}
}
});
}else{
var select = document.getElementById('hyper');
$(select).empty();
var select2 = document.getElementById('ville');
$(select2).empty();
}
}
});
});
$('#hyper').change(function(){
var code = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Admin/getVilleByHyp')?>',
type: 'post',
data: {code: code},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('ville');
$(select).empty();
for (var i in list) {
$(select).append('<option value=' + list[i].town_id + '>' + list[i].town +'</option>');
}
}else{
var select = document.getElementById('ville');
$(select).empty();
}
}
});
});
});
</script>

View File

@ -12,7 +12,8 @@
},
"require": {
"php": ">=5.4",
"spatie/async": "^1.4"
"spatie/async": "^1.4",
"nesbot/carbon": "^2.33"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"