Update Banyak
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
// require __DIR__ . "/../payment/paydisini/api_control.php";
|
||||
// require __DIR__ . "/../payment/client/intruksi_pay.php";
|
||||
require __DIR__ . "/payment/paydisini/proses.php";
|
||||
|
||||
$stmt = $pdo->prepare("SELECT * FROM agen_tambah_saldo WHERE id_agen_voucher = :id_agen_voucher AND status_payment != 'SUCCESS' ORDER BY id DESC LIMIT 1");
|
||||
$stmt->bindParam(':id_agen_voucher', $_SESSION['agen'], PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$dataGet = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
|
||||
<nav class="navbar fixed-top">
|
||||
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
|
||||
<div class="row">
|
||||
<div class="col-6 icon-container">
|
||||
<a href="index.php" class="fa fa-arrow-left text-light"></a>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<h6 class="text-light mt-2 mb-2">Isi Saldo</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 70px; margin-bottom: 20px;">
|
||||
<div class="card-body">
|
||||
<?php if($jenisAgen == 'Prabayar') { ?>
|
||||
<div style="text-align: center; color: #fff;">
|
||||
<p>Saldo Anda</p>
|
||||
|
||||
<div style="display: inline-flex; align-items: center; justify-content: center;">
|
||||
<h1 style="font-size: 36px; color: #fff; margin: 0;">
|
||||
<small>Rp. </small>
|
||||
<b id="saldoValue"><?php echo number_format($pcmem['saldo']); ?></b>
|
||||
</h1>
|
||||
<a onclick="toggleSaldo()" style="background: none; border: none; margin-left: 10px; cursor: pointer;">
|
||||
<i id="iconEye" class="fa fa-eye text-light" style="font-size: 24px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<center>
|
||||
<p style="color: #fff;">Total Transaksi Belum Di Bayar</p>
|
||||
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo substr(number_format($pcmem['saldo']),1); ?></b></h1>
|
||||
</center>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 850px; border: none; z-index: 1;">
|
||||
<div class="card-body" style="margin: 20px;">
|
||||
<?php if(!empty($dataGet['nominal'])) { ?>
|
||||
<div class="text-center">
|
||||
<h4><?= "Rp. ". number_format($dataGet['nominal']); ?></h4>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="payment-card">
|
||||
<?php
|
||||
|
||||
echo getListPembayaran($pelanggan['id']);
|
||||
// if ($pelanggan['status'] == 'SUCCESS') {
|
||||
// echo getStatus($pelanggan);
|
||||
// }
|
||||
// elseif ($pelanggan['status'] == 'PENDING') {
|
||||
// $data_get = json_decode($pelanggan['data_get'], true);
|
||||
// $expired = $data_get['data']['expired'] ?? null;
|
||||
// // $expired = date('Y-m-d 18:47:10');
|
||||
|
||||
// if (!empty($expired) && $expired <= date('Y-m-d H:i:s')) {
|
||||
// echo getListPembayaran($pelanggan['id']);
|
||||
// } else {
|
||||
// echo getIntruksi($pelanggan['data_get']);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// echo getListPembayaran($pelanggan['id']);
|
||||
// }
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php } else { ?>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label>Masukan Nominal</label>
|
||||
<input type="text" class="form-control rupiah" id="rupiah0" name="nominal" required="required">
|
||||
<i class="text-danger">Untuk isi saldo minimal Rp. 25,000</i>
|
||||
</div><br>
|
||||
<input type="submit" name="tambah_saldo" value="Tambah Saldo" class="btn btn-warning btn-md btn-block" style="border-radius: 30px;" >
|
||||
</form>
|
||||
<?php } ?>
|
||||
<div class="mt-4">
|
||||
<hr>
|
||||
<center>
|
||||
<p>Riwayat isi saldo otomatis</p>
|
||||
</center>
|
||||
<table class="table">
|
||||
<?php
|
||||
$stmt2 = $pdo->prepare("SELECT * FROM agen_tambah_saldo WHERE id_agen_voucher = :id_agen_voucher AND status_payment != 'PENDING' ORDER BY waktu DESC, id DESC");
|
||||
$stmt2->bindParam(':id_agen_voucher', $_SESSION['agen'], PDO::PARAM_INT);
|
||||
$stmt2->execute();
|
||||
while($saldo = $stmt2->fetch(PDO::FETCH_ASSOC)) { ?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $saldo['waktu']; ?>
|
||||
<p><b>Rp. <?php echo number_format($saldo['nominal']); ?></b></p>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<?php echo $saldo['status_payment']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if (isset($_POST['tambah_saldo'])) {
|
||||
try {
|
||||
|
||||
$nominal = preg_replace("/[^0-9]/", "", $_POST['nominal']);
|
||||
|
||||
if($nominal >= 25000) {
|
||||
$waktu = date('Y-m-d H:i:s');
|
||||
$keterangan = "Tambah saldo agen voucher";
|
||||
|
||||
// print_r($response);
|
||||
|
||||
$stmt = $pdo->prepare("INSERT INTO agen_tambah_saldo (id_data_server, id_agen_voucher, nominal, waktu, keterangan, status_payment)
|
||||
VALUES (:id_data_server, :id_agen_voucher, :nominal, :waktu, :keterangan, 'PENDING')");
|
||||
$stmt->bindParam(':id_data_server', $pcmem['id_data_server'], PDO::PARAM_INT);
|
||||
$stmt->bindParam(':id_agen_voucher', $_SESSION['agen'], PDO::PARAM_INT);
|
||||
$stmt->bindParam(':nominal', $nominal, PDO::PARAM_INT); // Pastikan nominal di-bind sebagai integer
|
||||
$stmt->bindParam(':waktu', $waktu);
|
||||
$stmt->bindParam(':keterangan', $keterangan);
|
||||
$stmt->execute();
|
||||
|
||||
sweetAlert("Permintaan Tambah Saldo Berhasil", "success");
|
||||
} else {
|
||||
sweetAlert("Nominal yang anda masukan kurang dari Rp. 25,000", "error");
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
// Menangani kesalahan saat eksekusi
|
||||
sweetAlert("Terjadi kesalahan: " . htmlspecialchars($e->getMessage()), "error");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['ubah_moninal'])) {
|
||||
try {
|
||||
|
||||
$nominal = preg_replace("/[^0-9]/", "", $_POST['nominal']);
|
||||
|
||||
if($nominal >= 25000) {
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE agen_tambah_saldo SET nominal = :nominal, url_payment = :url_payment, status_payment = :status_payment WHERE id_payment = :id_payment");
|
||||
$stmt->bindParam(':id', $ada['id_payment']);
|
||||
// Eksekusi statement
|
||||
$stmt->execute();
|
||||
|
||||
sweetAlert("Nominal Permintaan telah di ubah", "success");
|
||||
} else {
|
||||
sweetAlert("Nominal yang anda masukan kurang dari Rp. 25,000", "error");
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
// Menangani kesalahan saat eksekusi
|
||||
sweetAlert("Terjadi kesalahan: " . htmlspecialchars($e->getMessage()), "error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<script>
|
||||
let isVisible = false; // Default: tersembunyi
|
||||
const originalSaldo = "<?php echo number_format($pcmem['saldo']); ?>";
|
||||
|
||||
function toggleSaldo() {
|
||||
const saldoValue = document.getElementById('saldoValue');
|
||||
const iconEye = document.getElementById('iconEye');
|
||||
|
||||
if (!isVisible) {
|
||||
// Sembunyikan
|
||||
saldoValue.textContent = "••••••••••••";
|
||||
iconEye.classList.remove("fa-eye");
|
||||
iconEye.classList.add("fa-eye-slash");
|
||||
} else {
|
||||
// Tampilkan
|
||||
saldoValue.textContent = originalSaldo;
|
||||
iconEye.classList.remove("fa-eye-slash");
|
||||
iconEye.classList.add("fa-eye");
|
||||
}
|
||||
|
||||
isVisible = !isVisible;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user