87 lines
2.8 KiB
PHP
87 lines
2.8 KiB
PHP
<?php
|
|
$stmt = $pdo->prepare("SELECT SUM(user_hs_aktif) AS user_hs_aktif FROM v_jumlah_pelanggan $SqlDataWHIdM");
|
|
$stmt->execute();
|
|
$datauser = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
$hotspotAktif = ($datauser['user_hs_aktif'] > 0);
|
|
?>
|
|
<section class="content" style="zoom : 85%;">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<h4>Pelanggan Aktif</h4>
|
|
</div>
|
|
<div class="col-sm-6 text-right">
|
|
<form id="exportForm" action="excel/exportPelAktif.php?data=<?= encrypt_url(json_encode([$SqlSvData])); ?>" method="POST" target="_blank">
|
|
<input type="hidden" name="datatable_params" id="datatableParams">
|
|
<button type="submit" id="export-button" class="btn btn-success"><i class="fas fa-file-excel mr-2"></i>Export</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<table id="dataTable3" class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr class="bg-success">
|
|
<th>No</th>
|
|
<th>Nama</th>
|
|
<th>NIK</th>
|
|
<th>Id Pelanggan</th>
|
|
<?php if($hotspotAktif) { ?>
|
|
<th>Akun Hotspot</th>
|
|
<?php } ?>
|
|
<th>Alamat</th>
|
|
<th>Koordinat</th>
|
|
<th>Nomor WhatsApp</th>
|
|
<th>Server</th>
|
|
<th>Mikrotik</th>
|
|
<th>Paket</th>
|
|
<th>Status Koneksi</th>
|
|
<th>Mulai Berlangganan</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<script>
|
|
$(document).ready(function(){
|
|
var table = $("#dataTable3").DataTable({
|
|
processing: true,
|
|
serverSide: true,
|
|
ajax: {
|
|
url: "controller/get_user_aktif.php?data=<?= encrypt_url(json_encode([$SqlSvData, $SqlDataWHIdM, $hotspotAktif])); ?>",
|
|
type: "POST"
|
|
},
|
|
responsive: true,
|
|
lengthChange: true,
|
|
autoWidth: false,
|
|
buttons: ["excel", "pdf", "print"]
|
|
});
|
|
|
|
table.buttons().container().appendTo('#dataTable3_wrapper .col-md-6:eq(0)');
|
|
|
|
// Debug: tampilkan POST parameter setiap kali request
|
|
table.on('preXhr.dt', function(e, settings, data){
|
|
console.log("🔎 DataTables POST Params:", data);
|
|
});
|
|
|
|
// Simpan param terakhir ke hidden input (opsional untuk export)
|
|
table.on('draw', function(){
|
|
const params = table.ajax.params();
|
|
console.log("📦 Last Ajax Params:", params);
|
|
$("#datatableParams").val(JSON.stringify(params));
|
|
});
|
|
});
|
|
</script>
|
|
|
|
|