250 lines
8.0 KiB
PHP
Executable File
250 lines
8.0 KiB
PHP
Executable File
<link rel="stylesheet"
|
||
href="<?= 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="<?= base_url('bower_components/toastr/toastr.css') ?>">
|
||
<div class="content-wrapper">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
|
||
<h1>
|
||
<?= $this->lang->line('nano_health_management'); ?>
|
||
</h1>
|
||
<?php
|
||
|
||
use Brick\Money\Money;
|
||
|
||
$context = new \Brick\Money\Context\AutoContext();
|
||
$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>
|
||
<?= $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">×</button>
|
||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||
<?= $message; ?>
|
||
</div>
|
||
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</section>
|
||
|
||
<section class="content">
|
||
<div class="row">
|
||
<div class="col-xs-12">
|
||
<div class="box">
|
||
<div class="box-header">
|
||
<h3 class="box-title"><?= $this->lang->line('ilink_world_networks'); ?></h3>
|
||
</div>
|
||
<div class="box-body" style="overflow-x:auto;">
|
||
|
||
<?php
|
||
|
||
$sql2 = $networks;
|
||
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'>N°</th>
|
||
<th><?= $this->lang->line('Reseau'); ?></th>
|
||
<th><?= $this->lang->line('Pays'); ?></th>
|
||
<th align='center'><?= $this->lang->line('nano_health'); ?></th>
|
||
<th align='center'> Action</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
foreach ($sql2->result() as $row) {
|
||
$num++;
|
||
//$member_code = randomString1(10);
|
||
echo "<tr>
|
||
<td align='center'>$num</td>
|
||
<td >$row->network</td>
|
||
<td>$row->country</td>";
|
||
?>
|
||
<?php
|
||
if ($row->has_nano_health) {
|
||
?>
|
||
<td>
|
||
<button type="button" data-toggle="modal" data-target="#disableWallet"
|
||
data-network-id="<?= $row->id ?>"
|
||
class="btn btn-danger openModal"><?= $this->lang->line('Désactiver'); ?></button>
|
||
</td>
|
||
<?php
|
||
} else {
|
||
?>
|
||
<td>
|
||
<button type="button" data-network-id="<?= $row->id ?>"
|
||
class="btn btn-primary activateNanoCredit"><?= $this->lang->line('Activer'); ?></button>
|
||
</td>
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
<td>
|
||
<a href="<?= current_url(). ($row->has_nano_health? '?id=' . $row->id_network : '')?>"
|
||
class="btn btn-primary btn-block" <?php if (!$row->has_nano_health) echo "disabled" ?> >
|
||
<b><?= $this->lang->line('Voir plus...'); ?></b>
|
||
</a>
|
||
</td>
|
||
|
||
<?php
|
||
}
|
||
?>
|
||
</tbody>
|
||
</table>
|
||
|
||
<?php
|
||
|
||
} else {
|
||
echo $this->lang->line('Aucun réseau');
|
||
}
|
||
} else {
|
||
echo $this->lang->line('Aucun réseau');
|
||
}
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal fade" id="disableWallet" tabindex="-1" role="dialog" aria-hidden="true">
|
||
<div class="modal-dialog" role="document">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h3 class="modal-title"><?= $this->lang->line('nano_health_removal'); ?></h3>
|
||
</div>
|
||
<div class="modal-body">
|
||
<h4> Etes vous certain de vouloir ?</h4>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<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>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- <div class="alert alert-info alert-dismissible" aria-hidden="true">-->
|
||
<!-- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>-->
|
||
<!-- <h4><i class="icon fa fa-info"></i>Info!</h4>-->
|
||
<!-- Data is Saved-->
|
||
<!-- </div>-->
|
||
</section>
|
||
</div>
|
||
|
||
<!-- jQuery 3 -->
|
||
<script src="<?= base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
||
<!-- Bootstrap 3.3.7 -->
|
||
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||
<!-- DataTables -->
|
||
<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>
|
||
<!-- Slimscroll -->
|
||
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||
<!-- FastClick -->
|
||
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||
<!-- AdminLTE App -->
|
||
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
|
||
<!-- AdminLTE for demo purposes -->
|
||
<script src="<?= base_url('dist/js/demo.js') ?>"></script>
|
||
<script src="<?= base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
|
||
<script src="<?= base_url('dist/js/sweetalert2.js') ?>"></script>
|
||
|
||
<script>
|
||
$(function () {
|
||
$('#validated').DataTable();
|
||
})
|
||
</script>
|
||
|
||
<script>
|
||
toastr.options.closeButton = true;
|
||
toastr.options.closeMethod = 'fadeOut';
|
||
toastr.options.closeDuration = 5000;
|
||
toastr.options.closeEasing = 'swing';
|
||
|
||
var network_id = null;
|
||
|
||
$(document).on("click", ".openModal", function () {
|
||
network_id = $(this).data('network-id');
|
||
})
|
||
|
||
|
||
$('.activateNanoCredit').click(function () {
|
||
const id_network = $(this).data('network-id');
|
||
$.ajax({
|
||
url: '<?= base_url('index.php/Gestion/activate_nano_health')?>',
|
||
type: 'POST',
|
||
dataType: 'json',
|
||
data: {"id_network": id_network},
|
||
success: function (data, statut) {
|
||
if (data == '200') {
|
||
Swal.fire({
|
||
icon: 'success',
|
||
title: "<?= $this->lang->line('activate_nano_health')?>",
|
||
text: "<?= $this->lang->line('informations_updated')?>",
|
||
timer: 3000
|
||
}).then(() => {
|
||
location.reload();
|
||
});
|
||
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
|
||
} else {
|
||
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||
}
|
||
},
|
||
|
||
error: function (resultat, statut, erreur) {
|
||
console.log(resultat + " " + erreur);
|
||
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||
}
|
||
});
|
||
});
|
||
|
||
$('#deleteWallet').click(function () {
|
||
$.ajax({
|
||
url: '<?= base_url('index.php/Gestion/deactivate_nano_health')?>',
|
||
type: 'POST',
|
||
dataType: 'json',
|
||
data: {"id_network": network_id},
|
||
success: function (data, statut) {
|
||
if (data == '200') {
|
||
Swal.fire({
|
||
icon: 'success',
|
||
title: "<?= $this->lang->line('nano_health_deleted')?>",
|
||
text: "<?= $this->lang->line('informations_updated')?>",
|
||
timer: 3000
|
||
}).then(() => {
|
||
location.reload();
|
||
});
|
||
// alert("Les informations ont été mises à jour.") ? "" : location.reload();
|
||
} else {
|
||
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||
}
|
||
},
|
||
|
||
error: function (resultat, statut, erreur) {
|
||
console.log(resultat + " " + erreur);
|
||
toastr.error("<?= $this->lang->line('error_message')?>", "<?= $this->lang->line('request_error')?>");
|
||
}
|
||
});
|
||
});
|
||
</script>
|