backoffice/application/views/gestion_recherche.php

655 lines
36 KiB
PHP
Raw Normal View History

<link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<link rel="stylesheet" href="<?php echo 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://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<style>
.name-link
{
color: white;
text-decoration: none;
}
.form-style{
display: block;
width: 50%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
}
.form-group-style {
margin-bottom: 15px;
width: 50%;
}
.img-style{
width:20%;
margin:5%;
}
.conteneur-img{
text-align: center;
}
.label-radio{
font-style:bold;
margin-right:30px;
color: #444;
font-weight: 700;
}
</style>
<section class="content-header">
<h1>
<?php echo $this->lang->line('Rechercher un utilisateur'); ?>
</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="box box-primary">
<div class="box-header with-border">
</div>
<div class="box-body">
<form name="form_login" action="<?php echo base_url('index.php/Gestion/get_user') ?>" method="post">
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<label>Numéro de téléphone :</label>
<div class="input-group date" >
<div class="input-group-addon">
<i class="glyphicon glyphicon-earphone"></i>
</div>
<input type="text" class="form-control pull-right" id="phone" name="phone" value="<?php echo $default_phone?>">
</div>
</div>
</div>
<div class='col-sm-3'>
<div class="form-group">
<label>Numéro de transaction :</label>
<div class="input-group date" >
<div class="input-group-addon">
<i class="glyphicon glyphicon-usd"></i>
</div>
<input type="text" class="form-control pull-right" id="transac" name="transac" value="<?php echo $default_transac?>">
</div>
</div>
</div>
<div class='col-sm-3'>
<div class="form-group">
<label>Code membre :</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="glyphicon glyphicon-user"></i>
</div>
<input type="text" class="form-control pull-right" id="code" name="code" value="<?php echo $default_code?>">
</div>
</div>
</div>
<div class='col-sm-3'>
<div class="form-group">
<label>Nom :</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="glyphicon glyphicon-user"></i>
</div>
<input type="text" class="form-control pull-right" id="nom" name="nom" value="<?php echo $default_nom?>">
</div>
</div>
</div>
<div class="col-sm-4 col-sm-offset-4">
<input class="btn btn-primary btn-block" id='search' disabled='disabled' name='b' type='submit' value='<?php echo $this->lang->line('Rechercher'); ?>'/>
</div>
</div>
</form>
</div>
</div>
<div class="box box-primary">
<div class="box-header with-border">
<?php if($result_search == 1){ ?>
<h3 class="box-title"><?php echo $num_res.' '.$this->lang->line('utilisateur trouvé'); ?></h3>
<div class="box-body">
<div class="row">
<?php $users = $res_users;
if($users!=false){
$numrows= $users->num_rows();
$num = 0;
if ($numrows > 0) {
foreach($users->result() as $row) {
$num ++;
?>
<div class="col-md-3">
<!-- Profile Image -->
<div class="box box-primary">
<div class="box-body box-profile">
<img class="profile-user-img img-responsive img-circle" src="../../dist/img/user-g.png" alt="User profile picture">
<h3 class="profile-username text-center"><?php echo $row->lastname ?></h3>
<p class="text-muted text-center"><?php echo $row->category ?></p>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b><?php echo $this->lang->line('Reseau'); ?></b> <a class="pull-right"><?php echo $row->network_name ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('code membre'); ?></b> <a class="pull-right"><?php echo $row->code ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Ville'); ?></b> <a class="pull-right"><?php echo $row->town_name ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Contact'); ?></b> <a class="pull-right"><?php echo $row->phone ?></a>
</li>
</ul>
<a href="#" class="btn btn-primary btn-block" data-toggle="modal" data-target="#infos<?php echo $num; ?>"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<div class="modal fade" id="infos<?php echo $num; ?>" tabindex="-1" role="dialog" aria-labelledby="infosModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('Informations de l utilisateur'); ?></h3>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="nom" class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label>
<input type="text" class="form-control" id="nom-g<?php echo $num; ?>" name="nom" value="<?php echo $row->lastname ?>">
</div>
<div class="form-group">
<label for="adresse" class="col-form-label"><?php echo $this->lang->line('Adresse'); ?></label>
<input class="form-control" id="adresse-g<?php echo $num; ?>" name="adresse-g" value="<?php echo $row->adresse ?>">
</div>
<div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('Email'); ?></label>
<input class="form-control" id="email-g<?php echo $num; ?>" name="email-g" value="<?php echo $row->email ?>">
</div>
<div class="form-group col-sm-6">
<label for="m-phone" class="col-form-label"><?php echo $this->lang->line('Contact'); ?></label>
<input class="form-control" id="phone-g<?php echo $num; ?>" name="phone-g" value="<?php echo $row->phone ?>">
</div>
<div class="form-group col-sm-6">
<label for="m-transac" class="col-form-label"><?php echo $this->lang->line('Numéro de transaction'); ?></label>
<input class="form-control" id="transac-g<?php echo $num; ?>" name="transac-g" value="<?php echo $row->transac ?>">
</div>
<div class="form-group col-sm-6">
<label for="code-m" class="col-form-label"><?php echo $this->lang->line('code membre'); ?></label>
<input class="form-control" disabled id="code-m" name="code-m" value="<?php echo $row->code ?>">
</div>
<div class="form-group col-sm-6">
<label for="code-p" class="col-form-label"><?php echo $this->lang->line('Code parrain'); ?></label>
<input class="form-control" disabled id="code-p" name="code-p" value="<?php echo $row->parrain ?>">
</div>
<div class="form-group col-sm-6">
<label for="category" class="col-form-label"><?php echo $this->lang->line('Catégorie'); ?></label>
<input class="form-control" disabled id="category" name="category" value="<?php echo $row->category ?>">
</div>
<div class="form-group col-sm-6">
<label for="date-ins" class="col-form-label"><?php echo $this->lang->line('Date inscription'); ?></label>
<input class="form-control" disabled id="date-ins" name="date-ins" value="<?php echo $row->date_created ?>">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" class="btn btn-primary valid-infos-g" data-num="<?php echo $num; ?>" data-idnetworkAgent="<?php echo $row->networkAgent_id ?>" data-idUser="<?php echo $row->userID ?>" ><?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
<?php
}
}
}
?>
<?php $simple_users = $res_simple_users;
if($simple_users!=null){
$numrows= $simple_users->num_rows();
$num = 0;
if ($numrows > 0) {
foreach($simple_users->result() as $row) {
$num ++;
?>
<div class="col-md-3">
<!-- Profile Image -->
<div class="box box-success">
<div class="box-body box-profile">
<img class="profile-user-img img-responsive img-circle" src="../../dist/img/user-s.png" alt="User profile picture">
<h3 class="profile-username text-center"><?php echo $row->lastname ?></h3>
<p class="text-muted text-center"><?php echo $this->lang->line('Utilisateur simple'); ?></p>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b><?php echo $this->lang->line('Reseau'); ?></b> <a class="pull-right"><?php echo $row->network ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Pays'); ?></b> <a class="pull-right"><?php echo $row->country ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Contact'); ?></b> <a class="pull-right"><?php echo $row->phone ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Date inscription'); ?></b> <a class="pull-right"><?php echo $row->date_created ?></a>
</li>
</ul>
<a href="#" class="btn btn-success btn-block" data-toggle="modal" data-target="#infos-s"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<div class="modal fade" id="infos-s" data-id="<?php echo $row->id_user; ?>" tabindex="-1" role="dialog" aria-labelledby="infos-s-ModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('Informations de l utilisateur'); ?></h3>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="nom" class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label>
<input type="text" class="form-control" id="nom-s" name="nom" value="<?php echo $row->lastname ?>">
</div>
<div class="form-group">
<label for="adresse" class="col-form-label"><?php echo $this->lang->line('Adresse'); ?></label>
<input class="form-control" id="adresse-s" name="adresse" value="<?php echo $row->adresse ?>">
</div>
<div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('Email'); ?></label>
<input class="form-control" id="email-s" name="email" value="<?php echo $row->email ?>">
</div>
<div class="form-group">
<label for="m-phone" class="col-form-label"><?php echo $this->lang->line('Contact'); ?></label>
<input class="form-control" id="phone-s" name="m-phone" value="<?php echo $row->phone ?>">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" id="valid-infos-s" class="btn btn-primary"><?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
<?php
}
}
}
?>
</div>
</div>
<?php }elseif($result_search == 2){ ?>
<?php $simple_users = $res_simple_users;
if($simple_users!=null){
?>
<h3 class="box-title"><?php echo $simple_users->num_rows().' '.$this->lang->line('utilisateur trouvé'); ?></h3>
<div class="box-body">
<div class="row">
<?php
$numrows= $simple_users->num_rows();
$num = 0;
if ($numrows > 0) {
foreach($simple_users->result() as $row) {
$num ++;
?>
<div class="col-md-3">
<!-- Profile Image -->
<div class="box box-success">
<div class="box-body box-profile">
<img class="profile-user-img img-responsive img-circle" src="../../dist/img/user-s.png" alt="User profile picture">
<h3 class="profile-username text-center"><?php echo $row->lastname ?></h3>
<p class="text-muted text-center"><?php echo $this->lang->line('Utilisateur simple'); ?></p>
<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b><?php echo $this->lang->line('Reseau'); ?></b> <a class="pull-right"><?php echo $row->network ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Pays'); ?></b> <a class="pull-right"><?php echo $row->country ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Contact'); ?></b> <a class="pull-right"><?php echo $row->phone ?></a>
</li>
<li class="list-group-item">
<b><?php echo $this->lang->line('Date inscription'); ?></b> <a class="pull-right"><?php echo $row->date_created ?></a>
</li>
</ul>
<a href="#" class="btn btn-success btn-block" data-toggle="modal" data-target="#infos-s"><b><?php echo $this->lang->line('Voir plus...'); ?></b></a>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<div class="modal fade" id="infos-s" data-id="<?php echo $row->id_user; ?>" tabindex="-1" role="dialog" aria-labelledby="infos-s-ModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><?php echo $this->lang->line('Informations de l utilisateur'); ?></h3>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="nom" class="col-form-label"><?php echo $this->lang->line('Nom'); ?></label>
<input type="text" class="form-control" id="nom-s" name="nom" value="<?php echo $row->lastname ?>">
</div>
<div class="form-group">
<label for="adresse" class="col-form-label"><?php echo $this->lang->line('Adresse'); ?></label>
<input class="form-control" id="adresse-s" name="adresse" value="<?php echo $row->adresse ?>">
</div>
<div class="form-group">
<label for="email" class="col-form-label"><?php echo $this->lang->line('Email'); ?></label>
<input class="form-control" id="email-s" name="email" value="<?php echo $row->email ?>">
</div>
<div class="form-group">
<label for="m-phone" class="col-form-label"><?php echo $this->lang->line('Contact'); ?></label>
<input class="form-control" id="phone-s" name="m-phone" value="<?php echo $row->phone ?>">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
<button type="button" id="valid-infos-s" class="btn btn-primary"><?php echo $this->lang->line('Valider'); ?></button>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<?php
}else{
?>
<h3 class="box-title"><?php echo $this->lang->line('Aucun utilisateur trouvé'); ?></h3>
<?php
}
?>
<?php }elseif($result_search == 0){ ?>
<div class="conteneur-img">
<img class="img-style" src="../../dist/img/search.png" alt="icon search">
</div>
<?php } ?>
</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 src="<?php echo base_url('dist/js/demo.js') ?>"></script>
<script src="<?php echo base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script src="<?php echo base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
//Date picker
//$('#date-debut').datepicker({autoclose: true,format: 'yyyy-mm-dd'});
$("#date-debut").datetimepicker({
format:'YYYY-MM-DD HH:mm:ss',
locale: moment.locale('fr')
});
$('#date-fin').datetimepicker({
format:'YYYY-MM-DD HH:mm:ss'
});
</script>
<script>
$('#pays').change(function(){
var pays = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Gestion/getVilleByPays')?>',
type: 'post',
data: {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].id + "'>" + list[i].name +"</option>");
}
var id_ville = list[0].id;
$.ajax({
url:'<?php echo base_url('index.php/Gestion/getAgentByVilles')?>',
type: 'post',
data: {id_ville: id_ville},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('agent');
$(select).empty();
for (var i in list) {
$(select).append("<option value='" + list[i].lastname + "'>" + list[i].lastname +"</option>");
}
}else{
var select = document.getElementById('agent');
$(select).empty();
}
}
});
}else{
var select = document.getElementById('ville');
$(select).empty();
var select2 = document.getElementById('agent');
$(select2).empty();
}
}
});
});
$('#ville').change(function(){
var ville = $(this).val();
$.ajax({
url:'<?php echo base_url('index.php/Gestion/getAgentByVilles')?>',
type: 'post',
data: {id_ville: ville},
dataType: 'json',
success: function(list){
var len = list.length;
if(len > 0){
var select = document.getElementById('agent');
$(select).empty();
for (var i in list) {
$(select).append("<option value='" + list[i].lastname + "'>" + list[i].lastname +"</option>");
}
}else{
var select = document.getElementById('agent');
$(select).empty();
}
}
});
});
$('#phone').change(function(){
if($(this).val() !==''){
$('#search').prop('disabled', false );
}else{
if($('#transac').val() =='' && $('#code').val() =='' && $('#nom').val() ==''){
$('#search').prop('disabled', true );
}
}
});
$('#nom').change(function(){
if($(this).val() !==''){
$('#search').prop('disabled', false );
}else{
if($('#transac').val() =='' && $('#code').val() =='' && $('#phone').val() ==''){
$('#search').prop('disabled', true );
}
}
});
$('#transac').change(function(){
if($(this).val() !==''){
$('#search').prop('disabled', false );
}else{
if($('#phone').val() =='' && $('#code').val() =='' && $('#nom').val() ==''){
$('#search').prop('disabled', true );
}
}
});
$('#code').change(function(){
if($(this).val() !==''){
$('#search').prop('disabled', false );
}else{
if($('#transac').val() =='' && $('#phone').val() =='' && $('#nom').val() ==''){
$('#search').prop('disabled', true );
}
}
});
$('#valid-infos-s').click(function(){
var user_id = $('#infos-s').data('id');
var nom = $('#nom-s').val();
var adresse =$('#adresse-s').val();
var contact =$('#phone-s').val();
var email =$('#email-s').val();
$.ajax({
url : '<?php echo base_url('index.php/Gestion/update_info_user')?>',
type : 'POST',
dataType : 'json',
data: {"user_id": user_id,"nom": nom, "adresse": adresse, "contact": contact, "email": email},
success : function(data, statut){
if(data=='200'){
alert("Les informations ont été mises à jour.") ? "" : location.reload(true);
}else{
alert("Une erreur s'est produite.");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
}
});
});
$('.valid-infos-g').click(function(){
var num = $(this).attr('data-num');
var user_id = $(this).attr('data-idUser');
var net_ag_id = $(this).attr('data-idnetworkAgent');
var nom = $('#nom-g'+num).val();
var adresse =$('#adresse-g'+num).val();
var email =$('#email-g'+num).val();
var contact =$('#phone-g'+num).val();
var transac =$('#transac-g'+num).val();
$.ajax({
url : '<?php echo base_url('index.php/Gestion/update_info_geolocated')?>',
type : 'POST',
dataType : 'json',
data: {"user_id": user_id,"id_netAg": net_ag_id, "nom": nom, "adresse": adresse, "contact": contact, "transac":transac, "email": email},
success : function(data, statut){
if(data=='200'){
alert("Les informations ont été mises à jour.") ? "" : location.reload(true);
}else{
alert("Une erreur s'est produite.");
}
},
error : function(resultat, statut, erreur){
alert("Une erreur s'est produite.");
console.log(resultat+" "+erreur);
}
});
});
</script>