Update Banyak
This commit is contained in:
+96
-2
@@ -52,6 +52,7 @@
|
||||
<div class="col-sm-6">
|
||||
<ol class="float-sm-right mb-0">
|
||||
<!--<a type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#staticBackdrop">Tambah</a>-->
|
||||
<a type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#modalpesan">Kirim Pemberitahuan</a>
|
||||
</ol>
|
||||
</div>
|
||||
<!-- Modal Tambah -->
|
||||
@@ -129,6 +130,97 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- END Modal Tambah -->
|
||||
<!-- Modal Pesan Pemberitahuan -->
|
||||
<div class="modal fade" id="modalpesan" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="staticBackdropLabel">Tambah Server Aplikasi</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="card-body pb-0">
|
||||
<div class="form-group">
|
||||
<label>Status Server</label>
|
||||
<select class="form-control" name="jenisserver">
|
||||
<option value="0">All Server</option>
|
||||
<option value="1">Aktif</option>
|
||||
<option value="2">Tidak Aktif</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="card-body pb-0">
|
||||
<div class="form-group">
|
||||
<label>Isi Pesan WhatsApp</label>
|
||||
<textarea class="form-control" rows="10" name="isipesan"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<input type="submit" name="kirimpesan" class="btn btn-primary" value="Tambah">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END Modal Tambah -->
|
||||
<?php
|
||||
|
||||
if (isset($_POST['kirimpesan'])) {
|
||||
$now = date('Y-m-d'); // Tahun 4 digit
|
||||
|
||||
// Tentukan kondisi WHERE
|
||||
if ($_POST['jenisserver'] == 0) {
|
||||
$wer = "WHERE id != 1";
|
||||
} elseif ($_POST['jenisserver'] == 1) {
|
||||
$wer = "WHERE id != 1 AND expaired_date > :now";
|
||||
} elseif ($_POST['jenisserver'] == 2) {
|
||||
$wer = "WHERE id != 1 AND expaired_date < :now";
|
||||
} else {
|
||||
$wer = "";
|
||||
}
|
||||
|
||||
// Query database (ambil semua nomor)
|
||||
$sql = "SELECT whatsApp FROM data_server $wer";
|
||||
$stm = $pdo->prepare($sql);
|
||||
|
||||
// Bind parameter jika ada kondisi tanggal
|
||||
if ($_POST['jenisserver'] == 1 || $_POST['jenisserver'] == 2) {
|
||||
$stm->bindParam(':now', $now);
|
||||
}
|
||||
|
||||
$stm->execute();
|
||||
$data = $stm->fetchAll(PDO::FETCH_COLUMN); // langsung array nomor
|
||||
|
||||
// Hapus nomor kosong & duplikat
|
||||
$nomorList = array_filter(array_unique($data));
|
||||
|
||||
if (!empty($nomorList)) {
|
||||
$message = $_POST['isipesan'];
|
||||
$APIwa = new PesanWA();
|
||||
|
||||
// Kirim semua nomor sekaligus (array)
|
||||
$APIwa->Send_Pesan(1, 'sendMessage', $nomorList, $message);
|
||||
|
||||
sweetAlert("Pesan akan segera dikirim ke ".count($nomorList)." nomor", "success");
|
||||
} else {
|
||||
sweetAlert("Data nomor WhatsApp tidak ditemukan", "error");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
@@ -138,6 +230,7 @@
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama Server</th>
|
||||
<th>Saldo Voucher</th>
|
||||
<th>Alamat</th>
|
||||
<th>Nama Admin</th>
|
||||
<th>Nomor WhatsApp</th>
|
||||
@@ -150,16 +243,17 @@
|
||||
<tbody>
|
||||
<?php
|
||||
$no = 1;
|
||||
$aserver = mysqli_query($con,"SELECT * FROM data_server WHERE id !='1' ORDER BY expaired_date DESC");
|
||||
$aserver = mysqli_query($con,"SELECT * FROM data_server LEFT JOIN v_akumulasi_paygw ON data_server.id=v_akumulasi_paygw.id_data_server WHERE id !='1' ORDER BY expaired_date DESC");
|
||||
while ($server = mysqli_fetch_assoc($aserver))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $no; ?></td>
|
||||
<td><?php echo $server['nama_server']; ?></td>
|
||||
<td>Rp. <?php echo number_format($server['tersedia']); ?></td>
|
||||
<td style="max-width : 130px;"><?php echo $server['alamat']; ?></td>
|
||||
<td><?php echo $server['nama_pemilik']; ?></td>
|
||||
<td style="max-width : 100px;"><?php echo $server['nomor_whatsapp']; ?></td>
|
||||
<td style="max-width : 100px;"><?php echo $server['whatsapp']; ?></td>
|
||||
<td>Rp. <?php echo number_format($server['harga_sewa']); ?></td>
|
||||
<td><?php
|
||||
if ($server['expaired_date'] >= date('Y-m-d')) { ?>
|
||||
|
||||
Reference in New Issue
Block a user