backoffice/application/views/codeg.php

268 lines
9.5 KiB
PHP
Raw Normal View History

2020-02-06 10:09:39 +00:00
<!-- 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>