2020-05-02 10:49:34 +00:00
|
|
|
|
|
|
|
<!-- DataTables -->
|
|
|
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
|
|
|
|
<?php
|
2020-05-06 23:36:01 +00:00
|
|
|
use Carbon\Carbon;
|
2020-05-02 10:49:34 +00:00
|
|
|
function duree($time) {
|
|
|
|
$tabTemps = array("jours" => 86400,
|
|
|
|
"h" => 3600,
|
|
|
|
"m" => 60,
|
|
|
|
"s" => 1);
|
|
|
|
$result = "";
|
|
|
|
|
|
|
|
foreach($tabTemps as $uniteTemps => $nombreSecondesDansUnite) {
|
|
|
|
|
|
|
|
$$uniteTemps = floor($time/$nombreSecondesDansUnite);
|
|
|
|
|
|
|
|
$time = $time%$nombreSecondesDansUnite;
|
|
|
|
|
|
|
|
if($$uniteTemps > 0 || !empty($result)){
|
|
|
|
|
|
|
|
$result .= $$uniteTemps." $uniteTemps ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function dateDiff($date1, $date2){
|
|
|
|
$diff = abs($date1 - $date2); // abs pour avoir la valeur absolute, ainsi éviter d'avoir une différence négative
|
|
|
|
$retour = array();
|
|
|
|
|
|
|
|
$tmp = $diff;
|
|
|
|
$second = $tmp % 60;
|
|
|
|
|
|
|
|
$tmp = floor( ($tmp - $second) /60 );
|
|
|
|
$minute = $tmp % 60;
|
|
|
|
|
|
|
|
$tmp = floor( ($tmp - $minute)/60 );
|
|
|
|
$heure = $tmp % 24;
|
|
|
|
|
|
|
|
$tmp = floor( ($tmp - $heure) /24 );
|
|
|
|
$jour = $tmp;
|
|
|
|
|
|
|
|
return 'Depuis '.$jour.' jours '.$heure.' heures '.$minute.' minutes '.$second.' secondes';
|
|
|
|
}
|
|
|
|
|
|
|
|
function traitementTemps($time,$dateAjout){
|
|
|
|
if($time==null){
|
|
|
|
$now = time();
|
|
|
|
$date2 = strtotime($dateAjout);
|
|
|
|
|
|
|
|
return dateDiff($now, $date2);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
return duree($time);
|
|
|
|
}
|
|
|
|
}
|
2020-05-06 23:36:01 +00:00
|
|
|
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;
|
|
|
|
}
|
2020-05-02 10:49:34 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<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-arrow-down"></i></span>
|
|
|
|
|
|
|
|
<div class="info-box-content">
|
|
|
|
<span class="info-box-text"><?php echo $this->lang->line('Temps moyen de traitement entrant'); ?> </span>
|
|
|
|
<span class="info-box-number">
|
|
|
|
<?php
|
|
|
|
if($temp_moyen!=false){
|
|
|
|
if(duree($temp_moyen)==""){
|
|
|
|
echo "0s";
|
|
|
|
}else{
|
|
|
|
echo duree($temp_moyen);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
echo $this->lang->line('Aucune demande traitée');
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<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">
|
2020-05-06 23:36:01 +00:00
|
|
|
<!-- --><?php
|
|
|
|
// if($this->session->userdata('category') == "super"){
|
|
|
|
// if(isset($nameOfcurentGeolocatedUser))
|
|
|
|
// echo "<span class='info-box-number'>".$nameOfcurentGeolocatedUser."</span>";
|
|
|
|
// }
|
|
|
|
// ?>
|
2020-05-02 10:49:34 +00:00
|
|
|
<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') ?>"
|
|
|
|
data-type="<?php echo $demand_type?>" data-category="<?php echo $this->session->userdata('category') ?>"
|
|
|
|
value="<?php echo ($debut!=null & $fin != null) ? $debut. ' - '.$fin : ''?>"
|
|
|
|
/>
|
|
|
|
</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-md-12">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title"><?php echo $this->lang->line('Demandes'); ?> <?php echo $type ?></h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$result=$list;
|
|
|
|
if($result!=false){
|
|
|
|
|
|
|
|
$numrows=$result->num_rows();
|
|
|
|
$num = 0;
|
|
|
|
if ($numrows > 0) {
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<table id="listeMembres" class="table table-bordered table-striped table-modified">
|
|
|
|
<thead>
|
|
|
|
<?php
|
|
|
|
echo "
|
|
|
|
<tr class='label-primary'>
|
|
|
|
<th>".$this->lang->line('Téléphone utilisateur')."</th>
|
|
|
|
<th>".$this->lang->line('Catégorie')."</th>
|
|
|
|
<th>".$this->lang->line('Parrain')."</th>
|
|
|
|
<th>".$this->lang->line('Date de la demande')."</th>
|
|
|
|
<th>".$this->lang->line('Date de traitement')."</th>
|
|
|
|
<th>".$this->lang->line('Statut')."</th>
|
|
|
|
<th>".$this->lang->line('Délai de traitement')."</th>
|
|
|
|
</tr>";
|
|
|
|
?>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
// output data of each row
|
|
|
|
foreach($result->result() as $row) {
|
|
|
|
$num++;
|
|
|
|
|
|
|
|
$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 >Super </td>
|
|
|
|
<td>$row->code_membre</td>
|
2020-05-06 23:36:01 +00:00
|
|
|
<td>".toLocateDate($row->date_creation,$this->session->userdata('timezone'))."</td>
|
|
|
|
<td > ".toLocateDate($row->date_modified,$this->session->userdata('timezone'))."</td>
|
2020-05-02 10:49:34 +00:00
|
|
|
<td>$etat</td>
|
|
|
|
<td>".traitementTemps($row->temps,$row->date_creation)."</td>
|
|
|
|
|
|
|
|
</tr>";
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
echo $this->lang->line('Aucune demande');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
echo $this->lang->line('Aucune demande');
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title"><?php echo $this->lang->line('Demandes'); ?> <?php echo $type ?> <?php echo $this->lang->line('les plus rapidement traitées'); ?></h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$result=$tab_fastDemande;
|
|
|
|
if($result!=false){
|
|
|
|
|
|
|
|
$numrows=$result->num_rows();
|
|
|
|
$num = 0;
|
|
|
|
if ($numrows > 0) {
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<table id="listeDemandesRapides" class="table table-bordered table-striped table-modified">
|
|
|
|
<thead>
|
|
|
|
<?php
|
|
|
|
echo "
|
|
|
|
<tr class='label-primary'>
|
|
|
|
<th>N°</th>
|
|
|
|
<th>".$this->lang->line('Téléphone utilisateur')."</th>
|
|
|
|
<th>".$this->lang->line('Parrain')."</th>
|
|
|
|
<th>".$this->lang->line('Date de la demande')."</th>
|
|
|
|
<th>".$this->lang->line('Date de traitement')."</th>
|
|
|
|
<th>".$this->lang->line('Délai de traitement')."</th>
|
|
|
|
</tr>";
|
|
|
|
?>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
// output data of each row
|
|
|
|
foreach($result->result() as $row) {
|
|
|
|
$num++;
|
|
|
|
$superviseur = $row->superviseur;
|
|
|
|
if($row->superviseur==$this->session->userdata('member_code')){
|
|
|
|
$superviseur = $this->lang->line('Vous');
|
|
|
|
}
|
|
|
|
echo "<tr>
|
|
|
|
|
|
|
|
<td>$num</td>
|
|
|
|
<td>$row->emetteur</td>
|
|
|
|
<td>$superviseur</td>
|
2020-05-06 23:36:01 +00:00
|
|
|
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
|
|
|
|
<td > ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
|
2020-05-02 10:49:34 +00:00
|
|
|
<td>".duree($row->temps)."</td>
|
|
|
|
|
|
|
|
</tr>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
echo $this->lang->line('Aucune demande');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
echo $this->lang->line('Aucune demande');
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="box">
|
|
|
|
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h3 class="box-title"><?php echo $this->lang->line('Demandes'); ?> <?php echo $type ?> <?php echo $this->lang->line('les plus tardivement traitées'); ?></h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$result=$tab_slowDemande;
|
|
|
|
if($result!=false){
|
|
|
|
|
|
|
|
$numrows=$result->num_rows();
|
|
|
|
$num = 0;
|
|
|
|
if ($numrows > 0) {
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<table id="listeDemandesTardives" class="table table-bordered table-striped table-modified">
|
|
|
|
<thead>
|
|
|
|
<?php
|
|
|
|
echo "
|
|
|
|
<tr class='label-primary'>
|
|
|
|
<th>N°</th>
|
|
|
|
<th>".$this->lang->line('Contact')."</th>
|
|
|
|
<th>".$this->lang->line('Parrain')."</th>
|
|
|
|
<th>".$this->lang->line('Date de la demande')."</th>
|
|
|
|
<th>".$this->lang->line('Date de traitement')."</th>
|
|
|
|
<th>".$this->lang->line('Délai de traitement')."</th>
|
|
|
|
</tr>";
|
|
|
|
?>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
// output data of each row
|
|
|
|
foreach($result->result() as $row) {
|
|
|
|
$num++;
|
|
|
|
$superviseur = $row->superviseur;
|
|
|
|
if($row->superviseur==$this->session->userdata('member_code')){
|
|
|
|
$superviseur = $this->lang->line('Vous');
|
|
|
|
}
|
|
|
|
echo "<tr>
|
|
|
|
|
|
|
|
<td>$num</td>
|
|
|
|
<td>$row->emetteur</td>
|
|
|
|
<td>$superviseur</td>
|
2020-05-06 23:36:01 +00:00
|
|
|
<td>".toLocateDate($row->dateA,$this->session->userdata('timezone'))."</td>
|
|
|
|
<td> ".toLocateDate($row->dateM,$this->session->userdata('timezone'))."</td>
|
2020-05-02 10:49:34 +00:00
|
|
|
<td>".duree($row->temps)."</td>
|
|
|
|
|
|
|
|
</tr>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
echo $this->lang->line('Aucune demande');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
echo $this->lang->line('Aucune demande');
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
|
|
|
<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>
|
|
|
|
$(function () {
|
|
|
|
|
|
|
|
const lang = $('#picker').data('lang');
|
|
|
|
const format = lang === 'french' ? 'fr' : 'en';
|
|
|
|
moment.updateLocale(moment.locale(format), { invalidDate: "" }); // Blank text when is invalid date
|
|
|
|
|
|
|
|
$('#listeMembres').DataTable({
|
|
|
|
"aaSorting": [[ 3, "desc" ]],
|
|
|
|
"columnDefs": [{
|
|
|
|
targets: [3,4],
|
|
|
|
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format),
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#listeDemandesRapides').DataTable({
|
|
|
|
searching: false, paging: false, info: false,
|
2020-05-19 16:32:41 +00:00
|
|
|
"aaSorting": [[ 3, "desc" ]],
|
2020-05-02 10:49:34 +00:00
|
|
|
"columnDefs": [ {
|
2020-05-19 16:32:41 +00:00
|
|
|
targets: [3,4],
|
2020-05-02 10:49:34 +00:00
|
|
|
render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format)
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#listeDemandesTardives').DataTable({
|
|
|
|
searching: false, paging: false, info: false,
|
|
|
|
"aaSorting": [[ 3, "desc" ]],
|
|
|
|
"columnDefs": [ {
|
2020-05-19 16:32:41 +00:00
|
|
|
targets: [3,4],
|
2020-05-02 10:49:34 +00:00
|
|
|
render: $.fn.dataTable.render.moment( 'YYYY-MM-DD HH:mm:ss' , 'D MMMM YYYY HH:mm:ss', format)
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
var startDate;
|
|
|
|
var endDate;
|
|
|
|
|
|
|
|
function GetURLParameter(sParam)
|
|
|
|
{
|
|
|
|
var sPageURL = window.location.search.substring(1);
|
|
|
|
var sURLVariables = sPageURL.split('&');
|
|
|
|
for (var i = 0; i < sURLVariables.length; i++)
|
|
|
|
{
|
|
|
|
var sParameterName = sURLVariables[i].split('=');
|
|
|
|
if (sParameterName[0] == sParam)
|
|
|
|
{
|
|
|
|
return decodeURIComponent(sParameterName[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
|
|
var start = moment().subtract(29, 'days');
|
|
|
|
var end = moment();
|
|
|
|
|
|
|
|
startDate = start;
|
|
|
|
endDate = end;
|
|
|
|
|
|
|
|
function cb(start, end) {
|
|
|
|
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
|
|
|
|
startDate = start;
|
|
|
|
endDate = end;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#reportrange').daterangepicker({
|
|
|
|
startDate: start,
|
|
|
|
endDate: end,
|
|
|
|
ranges: {
|
|
|
|
'Today': [moment(), moment()],
|
|
|
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
|
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
|
|
|
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
|
|
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
|
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
|
|
}
|
|
|
|
}, cb);
|
|
|
|
|
|
|
|
cb(start, end);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
const category = $('#picker').data('category');
|
|
|
|
const lang = $('#picker').data('lang');
|
|
|
|
$('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 == 'super'){
|
|
|
|
window.location.replace("<?php echo base_url('index.php/Superviseur_dash/getDemandesAd')?>"+"?d="+debut+"&f="+fin);
|
|
|
|
}else if (category == 'hyper'){
|
|
|
|
window.location.replace("<?php echo base_url('index.php/Hyperviseur_dash/getDemandesAd')?>"+"?d="+debut+"&f="+fin);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('input[name="daterange"]').on('cancel.daterangepicker', function(ev, picker) {
|
|
|
|
//do something, like clearing an input
|
|
|
|
$('#daterange').val('');
|
|
|
|
if(category == 'super'){
|
|
|
|
window.location.replace("<?php echo base_url('index.php/Superviseur_dash/getDemandesAd')?>");
|
|
|
|
}else if (category == 'hyper'){
|
|
|
|
window.location.replace("<?php echo base_url('index.php/Hyperviseur_dash/getDemandesAd')?>");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
</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>
|