Update Banyak
This commit is contained in:
+380
-62
@@ -36,6 +36,12 @@ $nomor = $data[0]['nomor_whatsapp'];
|
||||
$username = $data[0]['username'];
|
||||
$email = $data[0]['email'];
|
||||
$profile = $data[0]['profile'];
|
||||
$rek_nomor = $data[0]['rekening_nomor'];
|
||||
$rek_nama = $data[0]['rekening_nama'];
|
||||
$rek_bank = $data[0]['rekening_bank'];
|
||||
$rek_status = $data[0]['rekening_status'];
|
||||
$nama_server = $data[0]['nama_server'];
|
||||
$whatsapp = $data[0]['whatsapp'];
|
||||
// echo "<pre>";
|
||||
// print_r($data);
|
||||
// echo "</pre>";
|
||||
@@ -57,23 +63,30 @@ $profile = $data[0]['profile'];
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="card">
|
||||
<div class="card-body" style="margin-bottom: -40px;">
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="card-body">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<table class="table table-borderless">
|
||||
<center>
|
||||
<label>Foto Profile</label>
|
||||
<div class="uploadImage" data-id="profile" style="width: 25%; zoom: 60%;">
|
||||
<span>Click to upload image</span>
|
||||
<img src="#" alt="Image preview">
|
||||
<div data-id="profile" style="width: 80%; zoom: 60%;">
|
||||
<img src="img/user/<?= $profile; ?>" style="width: 100%; margin-top: 20px;">
|
||||
<div class="progressContainer">
|
||||
<div class="progressBar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</center>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card-body">
|
||||
<table class="table table-borderless">
|
||||
<center>
|
||||
<label>Detail Akun</label>
|
||||
</center>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="p-2">Nama</td>
|
||||
@@ -99,46 +112,10 @@ $profile = $data[0]['profile'];
|
||||
</table>
|
||||
<input type="submit" class="btn btn-sm btn-primary m-1" name="simpan" value="Simpan">
|
||||
</form>
|
||||
|
||||
<?php if (isset($_SESSION['user'])) { ?>
|
||||
|
||||
<button class="btn btn-primary btn-block text-center" id="absenButton" onclick="handleAbsen()">Loading...</button>
|
||||
<script>
|
||||
let absenStatus = 'belum'; // default
|
||||
|
||||
function updateButtonFromStatus() {
|
||||
absenStatus = AndroidInterface.getTrackingStatus();
|
||||
const btn = document.getElementById('absenButton');
|
||||
|
||||
if (absenStatus === 'masuk') {
|
||||
btn.innerText = 'Absen Keluar';
|
||||
} else {
|
||||
btn.innerText = 'Absen Masuk';
|
||||
}
|
||||
}
|
||||
|
||||
function handleAbsen() {
|
||||
const userId = '<?=$id?>';
|
||||
const btn = document.getElementById('absenButton');
|
||||
|
||||
if (absenStatus === 'masuk') {
|
||||
AndroidInterface.stopTracking();
|
||||
absenStatus = 'belum';
|
||||
btn.innerText = 'Absen Masuk';
|
||||
} else {
|
||||
AndroidInterface.startTracking(userId);
|
||||
absenStatus = 'masuk';
|
||||
btn.innerText = 'Absen Keluar';
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = updateButtonFromStatus;
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card-body">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<table class="table table-borderless">
|
||||
<center>
|
||||
@@ -179,8 +156,182 @@ $profile = $data[0]['profile'];
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card-body">
|
||||
|
||||
<?php if($_SESSION['master']) {
|
||||
$readolny = ($rek_status != 'verificated' && $rek_status != 'onverification') ? '' : 'readonly disabled'; ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<table class="table table-borderless">
|
||||
<center>
|
||||
<label>Rekening Bank
|
||||
<?= ($rek_status == 'onverification')
|
||||
? '<span class="badge badge-warning p-2">On Verification</span>'
|
||||
: (($rek_status == 'verificated')
|
||||
? '<span class="badge badge-success p-2">Verificated</span>'
|
||||
: ''); ?>
|
||||
</label>
|
||||
</center>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="p-2">Bank</td>
|
||||
<td class="p-2">:</td>
|
||||
<td class="p-2">
|
||||
<div class="input-group mb-3">
|
||||
<select class="form-control" id="bank_code" name="bank_code" required <?= $readolny ?>>
|
||||
<option value="">-- PILIH BANK --</option>
|
||||
<option value="bca" <?= ($rek_bank=='bca' ? 'selected' : '') ?>>BCA</option>
|
||||
<option value="bni" <?= ($rek_bank=='bni' ? 'selected' : '') ?>>BNI</option>
|
||||
<option value="bri" <?= ($rek_bank=='bri' ? 'selected' : '') ?>>BRI</option>
|
||||
<option value="mandiri"<?= ($rek_bank=='mandiri' ? 'selected' : '') ?>>Mandiri</option>
|
||||
<option value="bjb" <?= ($rek_bank=='bjb' ? 'selected' : '') ?>>BJB</option>
|
||||
<option value="cimb" <?= ($rek_bank=='cimb' ? 'selected' : '') ?>>CIMB</option>
|
||||
<option value="danamon"<?= ($rek_bank=='danamon' ? 'selected' : '') ?>>Danamon</option>
|
||||
<option value="permata"<?= ($rek_bank=='permata' ? 'selected' : '') ?>>Permata</option>
|
||||
<option value="maybank"<?= ($rek_bank=='maybank' ? 'selected' : '') ?>>Maybank</option>
|
||||
<option value="btn" <?= ($rek_bank=='btn' ? 'selected' : '') ?>>BTN</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-2">Nomor Rekening</td>
|
||||
<td class="p-2">:</td>
|
||||
<td class="p-2">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control" type="text" id="account_number" name="account_number"
|
||||
value="<?= htmlspecialchars($rek_nomor ?? '') ?>" required <?= $readolny ?>>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-2">Nama Penerima</td>
|
||||
<td class="p-2">:</td>
|
||||
<td class="p-2">
|
||||
<div class="input-group mb-1">
|
||||
<input class="form-control" type="text" id="account_holder" name="account_holder"
|
||||
value="<?= htmlspecialchars($rek_nama ?? '') ?>" readonly>
|
||||
</div>
|
||||
<span id="testStatusCek"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= ($rek_status != 'verificated' && $rek_status != 'onverification')
|
||||
? '<input type="submit" class="btn btn-sm btn-primary m-1" name="simpanrekening" value="Simpan">'
|
||||
: ''; ?>
|
||||
<?= ($rek_status == 'onverification')
|
||||
? '<input type="submit" class="btn btn-sm btn-success m-1" name="verifikasirek" value="Verifikasi Rekening">'
|
||||
: ''; ?>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
// if (isset($_POST['simpanrekening'])) {
|
||||
// $SQLrek = "UPDATE data_server
|
||||
// SET rekening_bank = :rekening_bank,
|
||||
// rekening_nomor = :rekening_nomor,
|
||||
// rekening_nama = :rekening_nama,
|
||||
// rekening_status = 'onverification'
|
||||
// WHERE id = :iddatas";
|
||||
// $stmt = $pdo->prepare($SQLrek);
|
||||
|
||||
// // pakai bindValue (langsung ambil dari $_POST)
|
||||
// $stmt->bindValue(':rekening_bank', $_POST['bank_code']);
|
||||
// $stmt->bindValue(':rekening_nomor', $_POST['account_number']);
|
||||
// $stmt->bindValue(':rekening_nama', $_POST['account_holder']);
|
||||
// $stmt->bindValue(':iddatas', $id, PDO::PARAM_INT);
|
||||
|
||||
// if ($stmt->execute()) {
|
||||
// $Pesan = "*Permintaan Verifikasi Rekening*
|
||||
|
||||
// Server : " . $nama_server . "
|
||||
// BANK : " . strtoupper($_POST['bank_code']) . "
|
||||
// Rekening : *" . $_POST['account_number'] . "*
|
||||
// Nama Rek : " . strtoupper($_POST['account_holder']) . "
|
||||
|
||||
// status : _*On Verification*_
|
||||
|
||||
|
||||
// _# Manja ~ Notif_
|
||||
// ";
|
||||
// $nomorWA = ['6281298698422', '6285655548738'];
|
||||
// $APIwa = new PesanWA();
|
||||
// $APIwa->Send_Pesan('1','sendMessage',$nomorWA,$Pesan);
|
||||
|
||||
// sweetAlert("BERHASIL.! Rekening telah ditambahkan silahkan tunggu verifikasi", "success");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (isset($_POST['verifikasirek'])) {
|
||||
$SQLrek = "UPDATE data_server
|
||||
SET rekening_status = 'verificated'
|
||||
WHERE id = :iddatas";
|
||||
$stmt = $pdo->prepare($SQLrek);
|
||||
|
||||
$stmt->bindValue(':iddatas', $id, PDO::PARAM_INT);
|
||||
|
||||
$stmt->execute();
|
||||
$Pesanwarek = "*Verifikasi Rekening Berhasil*
|
||||
|
||||
Server : " . $nama_server . "
|
||||
BANK : " . strtoupper($rek_bank) . "
|
||||
Rekening : *" . $rek_nomor . "*
|
||||
Nama Rek : " . $rek_nama . "
|
||||
|
||||
status : _*Verificated*_
|
||||
|
||||
|
||||
_# Manja ~ Notif_
|
||||
";
|
||||
$nomorWArek = ["$whatsapp", "6281298698422", "6285655548738"];
|
||||
$APIwa = new PesanWA();
|
||||
$APIwa->Send_Pesan('1','sendMessage',$nomorWArek,$Pesanwarek);
|
||||
|
||||
sweetAlert("BERHASIL.! Rekening telah di verifikasi", "success");
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<center>
|
||||
<p>Riwayat Pencairan Dana</p>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<table id="withdrawTable" class="table table-striped table-bordered" style="zoom: 90%; width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Server</th>
|
||||
<th>Dibuat</th>
|
||||
<th>Nominal</th>
|
||||
<th>User</th>
|
||||
<th>Status</th>
|
||||
<th>Diproses</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<?php $data1111 = "123"; if (isset($id) && $data1111 == "123") { ?>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@@ -335,13 +486,12 @@ $profile = $data[0]['profile'];
|
||||
<th>Priode</th>
|
||||
<th>Nominal</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
// Query untuk mengambil data dari tabel apk_payment
|
||||
$stmt = $pdo->prepare("SELECT * FROM apk_payment WHERE id_data_server = :id ORDER BY waktu_transaksi");
|
||||
$stmt = $pdo->prepare("SELECT * FROM apk_payment WHERE id_data_server = :id AND jenis IS NULL ORDER BY waktu_transaksi");
|
||||
$stmt->bindParam(':id', $id);
|
||||
$stmt->execute();
|
||||
|
||||
@@ -355,17 +505,6 @@ $profile = $data[0]['profile'];
|
||||
<td><?php echo htmlspecialchars($row['keterangan']); ?></td>
|
||||
<td><?php echo number_format($row['nominal'], 0, ',', '.'); ?></td>
|
||||
<td><?php echo htmlspecialchars($row['status']); ?></td>
|
||||
<td>
|
||||
<form method="post">
|
||||
<?php if($row['status'] == 'PENDING' || $row['status'] == 'BELUM DIBAYAR') { ?>
|
||||
<a href="payment/paydisini/?order_id=<?php echo htmlspecialchars($row['order_id']); ?>" class="btn btn-sm btn-primary m-1">Bayar</a>
|
||||
<?php if($row['status'] == 'BELUM DIBAYAR') { ?>
|
||||
<input type="submit" name="hapus<?php echo $row['id']; ?>" class="btn btn-sm btn-danger m-1" value="Hapus" >
|
||||
<?php } } else { ?>
|
||||
<a href="payment/paydisini/?order_id=<?php echo htmlspecialchars($row['order_id']); ?>" class="btn btn-sm btn-secondary m-1">Detail</a>
|
||||
<?php } ?>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if(isset($_POST['hapus'.$row['id']]))
|
||||
@@ -402,6 +541,75 @@ $profile = $data[0]['profile'];
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<!--START Modal WithDrow-->
|
||||
<div class="modal fade" id="editModal" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="editModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<form id="editForm" method="post" enctype="multipart/form-data">
|
||||
<div class="modal-header bg-primary text-white">
|
||||
<h5 class="modal-title" id="staticBackdropLabel">Upload Bukti Success</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="id" id="editId">
|
||||
<div class="form-group text-center">
|
||||
<label class="form-label d-block">Upload Gambar</label>
|
||||
|
||||
<!-- klik gambar untuk upload -->
|
||||
<img id="previewImg"
|
||||
src="img/imgblank.jpg"
|
||||
class="img-fluid mb-2 rounded border"
|
||||
style="max-height:500px; cursor:pointer;"
|
||||
onclick="document.getElementById('bukti_success').click();">
|
||||
|
||||
<!-- hidden input file -->
|
||||
<input type="file"
|
||||
class="form-control mt-2 d-none"
|
||||
name="bukti_success"
|
||||
id="bukti_success"
|
||||
accept="image/*"
|
||||
required>
|
||||
|
||||
<!-- tampilkan nama file -->
|
||||
<div id="fileName" class="mt-2 text-muted"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--END Modal WithDrow-->
|
||||
<div class="modal fade" id="viewBuktiModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" style="max-width: fit-content; margin: auto;">
|
||||
<div class="modal-content border-0 bg-transparent shadow-none" style="width: auto;">
|
||||
<div class="position-relative d-inline-block">
|
||||
|
||||
<!-- Tombol Close -->
|
||||
<button type="button" class="close text-white position-absolute"
|
||||
data-dismiss="modal" aria-label="Close"
|
||||
style="top: 10px; right: 10px; filter: invert(1); z-index: 10;">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
<!-- Gambar dari JS -->
|
||||
<img id="viewBuktiImg" src=""
|
||||
class="img-fluid rounded shadow d-block"
|
||||
alt="Bukti Transaksi" style="max-height: 600px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
// if (isset($_POST['simpanPassword'])) {
|
||||
// if ($_POST['password'] == $_POST['confirm_password']) {
|
||||
@@ -507,4 +715,114 @@ document.querySelectorAll('.toggle-password').forEach(function(toggle) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#withdrawTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"responsive": true,
|
||||
"ajax": {
|
||||
"url": "controller/get_withdrow.php?i=<?= $id; ?>",
|
||||
"type": "POST"
|
||||
},
|
||||
"pageLength": 10,
|
||||
"columns": [
|
||||
{ "data": 0 }, // Server
|
||||
{ "data": 1 }, // Dibuat
|
||||
{ "data": 2 }, // Nominal
|
||||
{ "data": 3 }, // User
|
||||
{
|
||||
"data": 4, // Status
|
||||
"render": function(data, type, row, meta) {
|
||||
if (data === 'pending') {
|
||||
return `<span class="badge bg-primary p-2">${data.toUpperCase()}</span>`;
|
||||
} else {
|
||||
return `<span class="badge bg-success p-2">${data.toUpperCase()}</span>`;
|
||||
}
|
||||
}
|
||||
},
|
||||
{ "data": 5 }, // Diproses
|
||||
{
|
||||
"data": 6, // id unik
|
||||
"render": function(data, type, row, meta) {
|
||||
let btn = "";
|
||||
|
||||
if (row[4] === 'pending') {
|
||||
btn += `<button class="btn btn-sm btn-warning me-1" onclick="editData('${data.id}')">Bayar</button>`;
|
||||
}
|
||||
|
||||
if (row[4] === 'success') {
|
||||
btn += `<button class="btn btn-sm btn-secondary me-1" onclick="viewBukti('${data.bukti_success}')">
|
||||
<i class="fa fa-image"></i>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
return btn;
|
||||
}
|
||||
}
|
||||
],
|
||||
"order": [[1, "desc"]] // urut berdasarkan Dibuat
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Preview gambar saat pilih file
|
||||
document.getElementById("bukti_success").addEventListener("change", function(event){
|
||||
const file = event.target.files[0];
|
||||
if(file){
|
||||
// preview gambar
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e){
|
||||
document.getElementById("previewImg").src = e.target.result;
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
// tampilkan nama file
|
||||
document.getElementById("fileName").innerText = file.name;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function editData(id) {
|
||||
$("#editId").val(id); // set hidden input
|
||||
$("#bukti_success").val(""); // reset file input
|
||||
$("#previewImg").attr("src", "img/imgblank.jpg"); // reset preview
|
||||
$("#editModal").modal("show"); // tampilkan modal
|
||||
}
|
||||
|
||||
function viewBukti(imgPath) {
|
||||
$("#viewBuktiImg").attr("src", imgPath);
|
||||
$("#viewBuktiModal").modal("show");
|
||||
}
|
||||
|
||||
|
||||
// submit form
|
||||
$("#editForm").on("submit", function(e){
|
||||
e.preventDefault();
|
||||
let formData = new FormData(this);
|
||||
|
||||
$.ajax({
|
||||
url: "controller/update_withdraw.php",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res){
|
||||
try {
|
||||
let json = JSON.parse(res);
|
||||
if(json.success){
|
||||
Swal.fire("Berhasil!", json.message, "success");
|
||||
$("#editModal").modal("hide");
|
||||
$('#withdrawTable').DataTable().ajax.reload(null, false);
|
||||
} else {
|
||||
Swal.fire("Gagal!", json.message, "error");
|
||||
}
|
||||
} catch(e){
|
||||
Swal.fire("Error!", "Response tidak valid: " + res, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user