backoffice/application/views/gestion_operateurs_hyp.php

243 lines
8.4 KiB
PHP
Raw Permalink Normal View History

2022-04-18 11:39:19 +00:00
<link rel="stylesheet" href="<?= base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
2020-10-27 10:50:41 +00:00
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
2022-04-18 11:39:19 +00:00
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
2020-10-27 10:50:41 +00:00
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
2022-04-18 11:39:19 +00:00
<?= $this->lang->line('management_operators'); ?>
2020-10-27 10:50:41 +00:00
</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>
2022-04-18 11:39:19 +00:00
<?= $message; ?>
2020-10-27 10:50:41 +00:00
</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>
2022-04-18 11:39:19 +00:00
<?= $message; ?>
2020-10-27 10:50:41 +00:00
</div>
<?php
}
}
?>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
2022-04-18 11:39:19 +00:00
<h3 class="box-title"><?= $this->lang->line('operators'); ?></h3>
2020-10-27 10:50:41 +00:00
</div>
<div class="box-body" style="overflow-x:auto;">
<?php
2020-11-06 17:47:42 +00:00
$sql2 = $operators;
2020-10-27 10:50:41 +00:00
if($sql2!=false){
$numrows=$sql2->num_rows();
$num = 0;
if ($numrows > 0) {
?>
<table id="validated" class="table table-bordered table-striped">
<thead>
<tr>
<th align='center'></th>
2022-04-18 11:39:19 +00:00
<th><?= $this->lang->line('Pays'); ?></th>
2020-11-06 17:47:42 +00:00
<th>Type</th>
2022-04-18 11:39:19 +00:00
<th><?= $this->lang->line('Nom'); ?></th>
2020-11-06 17:47:42 +00:00
<th>Code</th>
2022-04-18 11:39:19 +00:00
<th align='center'><?= $this->lang->line('Adresse'); ?></th>
<th align='center'><?= $this->lang->line('Statut'); ?></th>
<th align='center'><?= $this->lang->line('Activer/Désactiver'); ?></th>
2020-10-27 10:50:41 +00:00
<!-- <th align='center'> Action </th>-->
</tr>
</thead>
<tbody>
<?php
foreach($sql2->result() as $row) {
// Seuls les operateurs bancaires peuvent appartenir à des pays etrangers
if($row->type != 'bank' && ($row->country_id != $row->network_country_id))
continue;
2020-10-27 10:50:41 +00:00
$num ++;
2020-11-06 17:47:42 +00:00
$type = $this->session->userdata('site_lang') === 'french' ? $row->type_fr : $row->type_en;
2020-10-27 10:50:41 +00:00
echo "<tr>
<td align='center'>$num</td>
2020-11-06 17:47:42 +00:00
<td >$row->country</td>
<td>$type</td>
<td >$row->operator_name</td>
<td >$row->operator_code</td>
<td>$row->operator_address</td>";
2020-10-27 10:50:41 +00:00
?>
<?php
if($row->id_network){
?>
<td><span class="label label-success"><?= $this->lang->line('Actif'); ?></span></td>
2020-11-06 17:47:42 +00:00
<td><button type="button" data-toggle="modal" data-target="#disableOperator" data-id-operator-country="<?=$row->id ?>" data-id-network="<?= $row->id_network ?>" class="btn btn-danger openModal"><?= $this->lang->line('Désactiver'); ?></button></td>
2020-10-27 10:50:41 +00:00
<?php
}else{
?>
<td><span class="label label-danger"><?= $this->lang->line('Inactif'); ?></span></td>
2022-04-18 11:39:19 +00:00
<td><button type="button" data-id-operator-country="<?= $row->id ?>" data-id-network="<?= $network_id ?>" class="btn btn-primary activeOperator" ><?= $this->lang->line('Activer'); ?></button></td>
2020-10-27 10:50:41 +00:00
<?php
}
?>
<!-- <td>-->
<!-- <a href="--><?php //echo current_url().($row->id_network ? '?id='.$row->id_network : '')?><!--" class="btn btn-primary btn-block" --><?php //if(!$row->id_network) echo "disabled"?><!-- >-->
<!-- <b>--><?php //echo $this->lang->line('Voir plus...'); ?><!--</b>-->
<!-- </a>-->
<!-- </td>-->
<?php
}
?>
</tbody>
</table>
<?php
}
else {
2020-11-06 17:47:42 +00:00
echo $this->lang->line('no_operator');
2020-10-27 10:50:41 +00:00
}
}else {
2020-11-06 17:47:42 +00:00
echo $this->lang->line('no_operator');
2020-10-27 10:50:41 +00:00
}
?>
</div>
</div>
</div>
</div>
2020-11-06 17:47:42 +00:00
<div class="modal fade" id="disableOperator" tabindex="-1" role="dialog" aria-hidden="true">
2020-10-27 10:50:41 +00:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2022-04-18 11:39:19 +00:00
<h3 class="modal-title"><?= $this->lang->line('operator_deactivation'); ?></h3>
2020-10-27 10:50:41 +00:00
</div>
<div class="modal-body">
<h4> Etes vous certain de vouloir ?</h4>
</div>
<div class="modal-footer">
2022-04-18 11:39:19 +00:00
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?= $this->lang->line('Fermer'); ?></button>
<button type="button" class="btn btn-primary" id="deleteWallet" > <?= $this->lang->line('Valider'); ?></button>
2020-10-27 10:50:41 +00:00
</div>
</div>
</div>
</div>
</section>
</div>
<!-- jQuery 3 -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<!-- Bootstrap 3.3.7 -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<!-- DataTables -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
<script src="<?= base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<!-- Slimscroll -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<!-- FastClick -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<!-- AdminLTE App -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<!-- AdminLTE for demo purposes -->
2022-04-18 11:39:19 +00:00
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
2020-10-27 10:50:41 +00:00
<script>
$(function() {
$('#validated').DataTable();
})
</script>
<script>
toastr.options.closeButton = true;
toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 5000;
toastr.options.closeEasing = 'swing';
2020-11-06 17:47:42 +00:00
var id_operator_country = null;
2020-10-27 10:50:41 +00:00
$(document).on("click", ".openModal", function () {
2020-11-06 17:47:42 +00:00
id_operator_country = $(this).data('id-operator-country');
2020-10-27 10:50:41 +00:00
id_network = $(this).data('id-network');
})
2020-11-06 17:47:42 +00:00
$(document).on("click", ".activeOperator", function () {
const id_operator_country = $(this).data('id-operator-country');
2020-10-27 10:50:41 +00:00
const id_network = $(this).data('id-network');
console.log(id_operator_country)
2020-10-27 10:50:41 +00:00
$.ajax({
2022-04-18 11:39:19 +00:00
url : '<?= base_url('Hyperviseur_dash/active_operator')?>',
2020-10-27 10:50:41 +00:00
type : 'POST',
dataType : 'json',
2020-11-06 17:47:42 +00:00
data: {"id_operator_country": id_operator_country , "id_network" : id_network},
2020-10-27 10:50:41 +00:00
success : function(data){
if(data=='200'){
Swal.fire({
icon: 'success',
2022-04-18 11:39:19 +00:00
title: "<?= $this->lang->line('operator_activated')?>",
text: "<?= $this->lang->line('informations_updated')?>",
2020-10-27 10:50:41 +00:00
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" :
}else{
2022-04-18 11:39:19 +00:00
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
2020-10-27 10:50:41 +00:00
}
},
error : function(resultat, statut, error){
console.log(resultat+" "+error );
2022-04-18 11:39:19 +00:00
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
2020-10-27 10:50:41 +00:00
}
})
});
$('#deleteWallet').click(function(){
$.ajax({
2022-04-18 11:39:19 +00:00
url : '<?= base_url('Hyperviseur_dash/deactive_operator')?>',
2020-10-27 10:50:41 +00:00
type : 'POST',
dataType : 'json',
2020-11-06 17:47:42 +00:00
data: {"id_operator_country": id_operator_country , "id_network" : id_network},
2020-10-27 10:50:41 +00:00
success : function(data){
if(data=='200'){
Swal.fire({
icon: 'success',
2022-04-18 11:39:19 +00:00
title: "<?= $this->lang->line('operator_deactivated')?>",
text: "<?= $this->lang->line('informations_updated')?>",
2020-10-27 10:50:41 +00:00
timer: 3000
}).then(()=>{
location.reload();
});
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
}else{
2022-04-18 11:39:19 +00:00
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
2020-10-27 10:50:41 +00:00
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
2022-04-18 11:39:19 +00:00
toastr.error("<?= $this->lang->line('error_message')?>" , "<?= $this->lang->line('request_error')?>");
2020-10-27 10:50:41 +00:00
}
});
});
</script>