Spaces:
Running
Running
tolong perhatikan lg fungsi fungsi yang ada di admin dashboard karna tidak seperti itu dan selesaikan semua modul yg tersisa
Browse files- admin_dashboard.html +91 -23
- transactions_topup.html +107 -0
- transactions_transfer.html +107 -0
- transactions_withdraw.html +109 -0
admin_dashboard.html
CHANGED
|
@@ -28,51 +28,63 @@
|
|
| 28 |
|
| 29 |
<div class="mb-4">
|
| 30 |
<h3 class="text-xs uppercase text-blue-300 mb-2 px-2">Transaksi</h3>
|
| 31 |
-
<a href="
|
| 32 |
<i data-feather="plus-circle" class="mr-2"></i>
|
| 33 |
Top Up
|
| 34 |
</a>
|
| 35 |
-
<a href="
|
| 36 |
<i data-feather="dollar-sign" class="mr-2"></i>
|
| 37 |
Withdraw
|
| 38 |
</a>
|
| 39 |
-
<a href="
|
| 40 |
<i data-feather="repeat" class="mr-2"></i>
|
| 41 |
Transfer
|
| 42 |
</a>
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
<div class="mb-4">
|
| 46 |
<h3 class="text-xs uppercase text-blue-300 mb-2 px-2">Management</h3>
|
| 47 |
-
<a href="
|
| 48 |
<i data-feather="database" class="mr-2"></i>
|
| 49 |
Bank Accounts
|
| 50 |
</a>
|
| 51 |
-
<a href="
|
| 52 |
<i data-feather="credit-card" class="mr-2"></i>
|
| 53 |
ID Stock
|
| 54 |
</a>
|
| 55 |
-
<a href="
|
| 56 |
<i data-feather="users" class="mr-2"></i>
|
| 57 |
Admin Users
|
| 58 |
</a>
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
<div class="mb-4">
|
| 62 |
<h3 class="text-xs uppercase text-blue-300 mb-2 px-2">Reports</h3>
|
| 63 |
-
<a href="
|
| 64 |
<i data-feather="activity" class="mr-2"></i>
|
| 65 |
Transactions
|
| 66 |
</a>
|
| 67 |
-
<a href="
|
| 68 |
<i data-feather="file-text" class="mr-2"></i>
|
| 69 |
Audit Log
|
| 70 |
</a>
|
| 71 |
-
<a href="
|
| 72 |
<i data-feather="pie-chart" class="mr-2"></i>
|
| 73 |
Analytics
|
| 74 |
</a>
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
</nav>
|
| 77 |
</div>
|
| 78 |
|
|
@@ -200,17 +212,73 @@
|
|
| 200 |
</main>
|
| 201 |
</div>
|
| 202 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
const userRole = 'admin'; // Can be 'owner' or 'admin'
|
| 209 |
-
|
| 210 |
-
if(userRole === 'admin') {
|
| 211 |
-
// Hide owner-only features
|
| 212 |
-
document.querySelectorAll('.owner-only').forEach(el => el.style.display = 'none');
|
| 213 |
-
}
|
| 214 |
-
</script>
|
| 215 |
</body>
|
| 216 |
</html>
|
|
|
|
| 28 |
|
| 29 |
<div class="mb-4">
|
| 30 |
<h3 class="text-xs uppercase text-blue-300 mb-2 px-2">Transaksi</h3>
|
| 31 |
+
<a href="transactions_topup.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg">
|
| 32 |
<i data-feather="plus-circle" class="mr-2"></i>
|
| 33 |
Top Up
|
| 34 |
</a>
|
| 35 |
+
<a href="transactions_withdraw.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 36 |
<i data-feather="dollar-sign" class="mr-2"></i>
|
| 37 |
Withdraw
|
| 38 |
</a>
|
| 39 |
+
<a href="transactions_transfer.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 40 |
<i data-feather="repeat" class="mr-2"></i>
|
| 41 |
Transfer
|
| 42 |
</a>
|
| 43 |
+
<a href="transactions_history.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 44 |
+
<i data-feather="list" class="mr-2"></i>
|
| 45 |
+
Transaction History
|
| 46 |
+
</a>
|
| 47 |
+
</div>
|
| 48 |
|
| 49 |
<div class="mb-4">
|
| 50 |
<h3 class="text-xs uppercase text-blue-300 mb-2 px-2">Management</h3>
|
| 51 |
+
<a href="bank_accounts.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg">
|
| 52 |
<i data-feather="database" class="mr-2"></i>
|
| 53 |
Bank Accounts
|
| 54 |
</a>
|
| 55 |
+
<a href="id_stock.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 56 |
<i data-feather="credit-card" class="mr-2"></i>
|
| 57 |
ID Stock
|
| 58 |
</a>
|
| 59 |
+
<a href="admin_users.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 60 |
<i data-feather="users" class="mr-2"></i>
|
| 61 |
Admin Users
|
| 62 |
</a>
|
| 63 |
+
<a href="customer_management.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 64 |
+
<i data-feather="user" class="mr-2"></i>
|
| 65 |
+
Customer Management
|
| 66 |
+
</a>
|
| 67 |
+
</div>
|
| 68 |
|
| 69 |
<div class="mb-4">
|
| 70 |
<h3 class="text-xs uppercase text-blue-300 mb-2 px-2">Reports</h3>
|
| 71 |
+
<a href="reports_transactions.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg">
|
| 72 |
<i data-feather="activity" class="mr-2"></i>
|
| 73 |
Transactions
|
| 74 |
</a>
|
| 75 |
+
<a href="reports_audit.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 76 |
<i data-feather="file-text" class="mr-2"></i>
|
| 77 |
Audit Log
|
| 78 |
</a>
|
| 79 |
+
<a href="reports_analytics.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 80 |
<i data-feather="pie-chart" class="mr-2"></i>
|
| 81 |
Analytics
|
| 82 |
</a>
|
| 83 |
+
<a href="reports_daily.html" class="flex items-center px-3 py-2 hover:bg-blue-700 rounded-lg mt-1">
|
| 84 |
+
<i data-feather="calendar" class="mr-2"></i>
|
| 85 |
+
Daily Reports
|
| 86 |
+
</a>
|
| 87 |
+
</div>
|
| 88 |
</nav>
|
| 89 |
</div>
|
| 90 |
|
|
|
|
| 212 |
</main>
|
| 213 |
</div>
|
| 214 |
</div>
|
| 215 |
+
<script>
|
| 216 |
+
feather.replace();
|
| 217 |
+
|
| 218 |
+
// Role-based access control
|
| 219 |
+
const userRole = localStorage.getItem('userRole') || 'admin';
|
| 220 |
+
|
| 221 |
+
// Hide owner-only features for non-owners
|
| 222 |
+
if(userRole !== 'owner') {
|
| 223 |
+
document.querySelectorAll('.owner-only').forEach(el => el.style.display = 'none');
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
// Load real transaction data
|
| 227 |
+
fetch('/api/transactions')
|
| 228 |
+
.then(response => response.json())
|
| 229 |
+
.then(data => {
|
| 230 |
+
const tbody = document.querySelector('tbody');
|
| 231 |
+
tbody.innerHTML = data.map(transaction => `
|
| 232 |
+
<tr>
|
| 233 |
+
<td class="px-6 py-4">${transaction.id}</td>
|
| 234 |
+
<td class="px-6 py-4">${transaction.type}</td>
|
| 235 |
+
<td class="px-6 py-4">${transaction.amount}</td>
|
| 236 |
+
<td class="px-6 py-4">
|
| 237 |
+
<span class="px-2 py-1 ${getStatusClass(transaction.status)} rounded-full text-xs">
|
| 238 |
+
${transaction.status}
|
| 239 |
+
</span>
|
| 240 |
+
</td>
|
| 241 |
+
<td class="px-6 py-4">${new Date(transaction.date).toLocaleDateString()}</td>
|
| 242 |
+
<td class="px-6 py-4">
|
| 243 |
+
${transaction.status === 'Pending' ? `
|
| 244 |
+
<button onclick="approveTransaction('${transaction.id}')" class="text-green-600 hover:text-green-800 mr-2">
|
| 245 |
+
<i data-feather="check"></i>
|
| 246 |
+
</button>
|
| 247 |
+
<button onclick="rejectTransaction('${transaction.id}')" class="text-red-600 hover:text-red-800">
|
| 248 |
+
<i data-feather="x"></i>
|
| 249 |
+
</button>
|
| 250 |
+
` : `
|
| 251 |
+
<button onclick="viewTransaction('${transaction.id}')" class="text-blue-600 hover:text-blue-800">
|
| 252 |
+
<i data-feather="eye"></i>
|
| 253 |
+
</button>
|
| 254 |
+
`}
|
| 255 |
+
</td>
|
| 256 |
+
</tr>
|
| 257 |
+
`).join('');
|
| 258 |
+
feather.replace();
|
| 259 |
+
});
|
| 260 |
+
|
| 261 |
+
function getStatusClass(status) {
|
| 262 |
+
return {
|
| 263 |
+
'Pending': 'bg-yellow-100 text-yellow-800',
|
| 264 |
+
'Approved': 'bg-green-100 text-green-800',
|
| 265 |
+
'Rejected': 'bg-red-100 text-red-800'
|
| 266 |
+
}[status] || 'bg-gray-100 text-gray-800';
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
function approveTransaction(id) {
|
| 270 |
+
fetch(`/api/transactions/${id}/approve`, { method: 'POST' })
|
| 271 |
+
.then(() => window.location.reload());
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
function rejectTransaction(id) {
|
| 275 |
+
fetch(`/api/transactions/${id}/reject`, { method: 'POST' })
|
| 276 |
+
.then(() => window.location.reload());
|
| 277 |
+
}
|
| 278 |
|
| 279 |
+
function viewTransaction(id) {
|
| 280 |
+
window.location.href = `/transaction_detail.html?id=${id}`;
|
| 281 |
+
}
|
| 282 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
</body>
|
| 284 |
</html>
|
transactions_topup.html
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ChipFlow - Top Up</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="bg-gray-100">
|
| 11 |
+
<div class="container mx-auto p-4">
|
| 12 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 13 |
+
<h1 class="text-2xl font-bold mb-6">Top Up Management</h1>
|
| 14 |
+
|
| 15 |
+
<div class="mb-6">
|
| 16 |
+
<button id="newTopupBtn" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
|
| 17 |
+
<i data-feather="plus" class="mr-2"></i>New Top Up
|
| 18 |
+
</button>
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div class="overflow-x-auto">
|
| 22 |
+
<table class="min-w-full bg-white">
|
| 23 |
+
<thead>
|
| 24 |
+
<tr class="bg-gray-100 text-left">
|
| 25 |
+
<th class="py-3 px-4">ID</th>
|
| 26 |
+
<th class="py-3 px-4">Customer</th>
|
| 27 |
+
<th class="py-3 px-4">Bank</th>
|
| 28 |
+
<th class="py-3 px-4">Amount</th>
|
| 29 |
+
<th class="py-3 px-4">Status</th>
|
| 30 |
+
<th class="py-3 px-4">Date</th>
|
| 31 |
+
<th class="py-3 px-4">Actions</th>
|
| 32 |
+
</tr>
|
| 33 |
+
</thead>
|
| 34 |
+
<tbody id="topupTableBody">
|
| 35 |
+
<!-- Data will be loaded via JS -->
|
| 36 |
+
</tbody>
|
| 37 |
+
</table>
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<script>
|
| 43 |
+
feather.replace();
|
| 44 |
+
|
| 45 |
+
// Load topup data
|
| 46 |
+
fetch('/api/topups')
|
| 47 |
+
.then(response => response.json())
|
| 48 |
+
.then(data => {
|
| 49 |
+
const tbody = document.getElementById('topupTableBody');
|
| 50 |
+
tbody.innerHTML = data.map(topup => `
|
| 51 |
+
<tr class="border-b">
|
| 52 |
+
<td class="py-3 px-4">${topup.id}</td>
|
| 53 |
+
<td class="py-3 px-4">${topup.customerName}</td>
|
| 54 |
+
<td class="py-3 px-4">${topup.bankName}</td>
|
| 55 |
+
<td class="py-3 px-4">${topup.amount}</td>
|
| 56 |
+
<td class="py-3 px-4">
|
| 57 |
+
<span class="px-2 py-1 rounded-full text-xs ${getStatusClass(topup.status)}">
|
| 58 |
+
${topup.status}
|
| 59 |
+
</span>
|
| 60 |
+
</td>
|
| 61 |
+
<td class="py-3 px-4">${new Date(topup.date).toLocaleDateString()}</td>
|
| 62 |
+
<td class="py-3 px-4">
|
| 63 |
+
<button onclick="viewTopup('${topup.id}')" class="text-blue-600 hover:text-blue-800 mr-2">
|
| 64 |
+
<i data-feather="eye"></i>
|
| 65 |
+
</button>
|
| 66 |
+
${topup.status === 'Pending' ? `
|
| 67 |
+
<button onclick="approveTopup('${topup.id}')" class="text-green-600 hover:text-green-800 mr-2">
|
| 68 |
+
<i data-feather="check"></i>
|
| 69 |
+
</button>
|
| 70 |
+
<button onclick="rejectTopup('${topup.id}')" class="text-red-600 hover:text-red-800">
|
| 71 |
+
<i data-feather="x"></i>
|
| 72 |
+
</button>
|
| 73 |
+
` : ''}
|
| 74 |
+
</td>
|
| 75 |
+
</tr>
|
| 76 |
+
`).join('');
|
| 77 |
+
feather.replace();
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
function getStatusClass(status) {
|
| 81 |
+
return {
|
| 82 |
+
'Pending': 'bg-yellow-100 text-yellow-800',
|
| 83 |
+
'Completed': 'bg-green-100 text-green-800',
|
| 84 |
+
'Rejected': 'bg-red-100 text-red-800'
|
| 85 |
+
}[status] || 'bg-gray-100 text-gray-800';
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
document.getElementById('newTopupBtn').addEventListener('click', () => {
|
| 89 |
+
window.location.href = '/topup_new.html';
|
| 90 |
+
});
|
| 91 |
+
|
| 92 |
+
function viewTopup(id) {
|
| 93 |
+
window.location.href = `/topup_detail.html?id=${id}`;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
function approveTopup(id) {
|
| 97 |
+
fetch(`/api/topups/${id}/approve`, { method: 'POST' })
|
| 98 |
+
.then(() => window.location.reload());
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
function rejectTopup(id) {
|
| 102 |
+
fetch(`/api/topups/${id}/reject`, { method: 'POST' })
|
| 103 |
+
.then(() => window.location.reload());
|
| 104 |
+
}
|
| 105 |
+
</script>
|
| 106 |
+
</body>
|
| 107 |
+
</html>
|
transactions_transfer.html
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ChipFlow - Transfers</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="bg-gray-100">
|
| 11 |
+
<div class="container mx-auto p-4">
|
| 12 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 13 |
+
<h1 class="text-2xl font-bold mb-6">Transfer Management</h1>
|
| 14 |
+
|
| 15 |
+
<div class="mb-6">
|
| 16 |
+
<button id="newTransferBtn" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
|
| 17 |
+
<i data-feather="plus" class="mr-2"></i>New Transfer
|
| 18 |
+
</button>
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div class="overflow-x-auto">
|
| 22 |
+
<table class="min-w-full bg-white">
|
| 23 |
+
<thead>
|
| 24 |
+
<tr class="bg-gray-100 text-left">
|
| 25 |
+
<th class="py-3 px-4">ID</th>
|
| 26 |
+
<th class="py-3 px-4">From Customer</th>
|
| 27 |
+
<th class="py-3 px-4">To Customer</th>
|
| 28 |
+
<th class="py-3 px-4">Chips</th>
|
| 29 |
+
<th class="py-3 px-4">Status</th>
|
| 30 |
+
<th class="py-3 px-4">Date</th>
|
| 31 |
+
<th class="py-3 px-4">Actions</th>
|
| 32 |
+
</tr>
|
| 33 |
+
</thead>
|
| 34 |
+
<tbody id="transferTableBody">
|
| 35 |
+
<!-- Data will be loaded via JS -->
|
| 36 |
+
</tbody>
|
| 37 |
+
</table>
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<script>
|
| 43 |
+
feather.replace();
|
| 44 |
+
|
| 45 |
+
// Load transfer data
|
| 46 |
+
fetch('/api/transfers')
|
| 47 |
+
.then(response => response.json())
|
| 48 |
+
.then(data => {
|
| 49 |
+
const tbody = document.getElementById('transferTableBody');
|
| 50 |
+
tbody.innerHTML = data.map(transfer => `
|
| 51 |
+
<tr class="border-b">
|
| 52 |
+
<td class="py-3 px-4">${transfer.id}</td>
|
| 53 |
+
<td class="py-3 px-4">${transfer.fromCustomer}</td>
|
| 54 |
+
<td class="py-3 px-4">${transfer.toCustomer}</td>
|
| 55 |
+
<td class="py-3 px-4">${transfer.chips}</td>
|
| 56 |
+
<td class="py-3 px-4">
|
| 57 |
+
<span class="px-2 py-1 rounded-full text-xs ${getStatusClass(transfer.status)}">
|
| 58 |
+
${transfer.status}
|
| 59 |
+
</span>
|
| 60 |
+
</td>
|
| 61 |
+
<td class="py-3 px-4">${new Date(transfer.date).toLocaleDateString()}</td>
|
| 62 |
+
<td class="py-3 px-4">
|
| 63 |
+
<button onclick="viewTransfer('${transfer.id}')" class="text-blue-600 hover:text-blue-800 mr-2">
|
| 64 |
+
<i data-feather="eye"></i>
|
| 65 |
+
</button>
|
| 66 |
+
${transfer.status === 'Pending' ? `
|
| 67 |
+
<button onclick="approveTransfer('${transfer.id}')" class="text-green-600 hover:text-green-800 mr-2">
|
| 68 |
+
<i data-feather="check"></i>
|
| 69 |
+
</button>
|
| 70 |
+
<button onclick="rejectTransfer('${transfer.id}')" class="text-red-600 hover:text-red-800">
|
| 71 |
+
<i data-feather="x"></i>
|
| 72 |
+
</button>
|
| 73 |
+
` : ''}
|
| 74 |
+
</td>
|
| 75 |
+
</tr>
|
| 76 |
+
`).join('');
|
| 77 |
+
feather.replace();
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
function getStatusClass(status) {
|
| 81 |
+
return {
|
| 82 |
+
'Pending': 'bg-yellow-100 text-yellow-800',
|
| 83 |
+
'Completed': 'bg-green-100 text-green-800',
|
| 84 |
+
'Rejected': 'bg-red-100 text-red-800'
|
| 85 |
+
}[status] || 'bg-gray-100 text-gray-800';
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
document.getElementById('newTransferBtn').addEventListener('click', () => {
|
| 89 |
+
window.location.href = '/transfer_new.html';
|
| 90 |
+
});
|
| 91 |
+
|
| 92 |
+
function viewTransfer(id) {
|
| 93 |
+
window.location.href = `/transfer_detail.html?id=${id}`;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
function approveTransfer(id) {
|
| 97 |
+
fetch(`/api/transfers/${id}/approve`, { method: 'POST' })
|
| 98 |
+
.then(() => window.location.reload());
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
function rejectTransfer(id) {
|
| 102 |
+
fetch(`/api/transfers/${id}/reject`, { method: 'POST' })
|
| 103 |
+
.then(() => window.location.reload());
|
| 104 |
+
}
|
| 105 |
+
</script>
|
| 106 |
+
</body>
|
| 107 |
+
</html>
|
transactions_withdraw.html
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ChipFlow - Withdrawals</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="bg-gray-100">
|
| 11 |
+
<div class="container mx-auto p-4">
|
| 12 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 13 |
+
<h1 class="text-2xl font-bold mb-6">Withdrawal Management</h1>
|
| 14 |
+
|
| 15 |
+
<div class="mb-6">
|
| 16 |
+
<button id="newWithdrawBtn" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
|
| 17 |
+
<i data-feather="plus" class="mr-2"></i>New Withdrawal
|
| 18 |
+
</button>
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div class="overflow-x-auto">
|
| 22 |
+
<table class="min-w-full bg-white">
|
| 23 |
+
<thead>
|
| 24 |
+
<tr class="bg-gray-100 text-left">
|
| 25 |
+
<th class="py-3 px-4">ID</th>
|
| 26 |
+
<th class="py-3 px-4">Customer</th>
|
| 27 |
+
<th class="py-3 px-4">Bank</th>
|
| 28 |
+
<th class="py-3 px-4">Chips</th>
|
| 29 |
+
<th class="py-3 px-4">Amount</th>
|
| 30 |
+
<th class="py-3 px-4">Status</th>
|
| 31 |
+
<th class="py-3 px-4">Date</th>
|
| 32 |
+
<th class="py-3 px-4">Actions</th>
|
| 33 |
+
</tr>
|
| 34 |
+
</thead>
|
| 35 |
+
<tbody id="withdrawTableBody">
|
| 36 |
+
<!-- Data will be loaded via JS -->
|
| 37 |
+
</tbody>
|
| 38 |
+
</table>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
<script>
|
| 44 |
+
feather.replace();
|
| 45 |
+
|
| 46 |
+
// Load withdrawal data
|
| 47 |
+
fetch('/api/withdrawals')
|
| 48 |
+
.then(response => response.json())
|
| 49 |
+
.then(data => {
|
| 50 |
+
const tbody = document.getElementById('withdrawTableBody');
|
| 51 |
+
tbody.innerHTML = data.map(withdrawal => `
|
| 52 |
+
<tr class="border-b">
|
| 53 |
+
<td class="py-3 px-4">${withdrawal.id}</td>
|
| 54 |
+
<td class="py-3 px-4">${withdrawal.customerName}</td>
|
| 55 |
+
<td class="py-3 px-4">${withdrawal.bankName}</td>
|
| 56 |
+
<td class="py-3 px-4">${withdrawal.chips}</td>
|
| 57 |
+
<td class="py-3 px-4">${withdrawal.amount}</td>
|
| 58 |
+
<td class="py-3 px-4">
|
| 59 |
+
<span class="px-2 py-1 rounded-full text-xs ${getStatusClass(withdrawal.status)}">
|
| 60 |
+
${withdrawal.status}
|
| 61 |
+
</span>
|
| 62 |
+
</td>
|
| 63 |
+
<td class="py-3 px-4">${new Date(withdrawal.date).toLocaleDateString()}</td>
|
| 64 |
+
<td class="py-3 px-4">
|
| 65 |
+
<button onclick="viewWithdrawal('${withdrawal.id}')" class="text-blue-600 hover:text-blue-800 mr-2">
|
| 66 |
+
<i data-feather="eye"></i>
|
| 67 |
+
</button>
|
| 68 |
+
${withdrawal.status === 'Pending' ? `
|
| 69 |
+
<button onclick="approveWithdrawal('${withdrawal.id}')" class="text-green-600 hover:text-green-800 mr-2">
|
| 70 |
+
<i data-feather="check"></i>
|
| 71 |
+
</button>
|
| 72 |
+
<button onclick="rejectWithdrawal('${withdrawal.id}')" class="text-red-600 hover:text-red-800">
|
| 73 |
+
<i data-feather="x"></i>
|
| 74 |
+
</button>
|
| 75 |
+
` : ''}
|
| 76 |
+
</td>
|
| 77 |
+
</tr>
|
| 78 |
+
`).join('');
|
| 79 |
+
feather.replace();
|
| 80 |
+
});
|
| 81 |
+
|
| 82 |
+
function getStatusClass(status) {
|
| 83 |
+
return {
|
| 84 |
+
'Pending': 'bg-yellow-100 text-yellow-800',
|
| 85 |
+
'Completed': 'bg-green-100 text-green-800',
|
| 86 |
+
'Rejected': 'bg-red-100 text-red-800'
|
| 87 |
+
}[status] || 'bg-gray-100 text-gray-800';
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
document.getElementById('newWithdrawBtn').addEventListener('click', () => {
|
| 91 |
+
window.location.href = '/withdraw_new.html';
|
| 92 |
+
});
|
| 93 |
+
|
| 94 |
+
function viewWithdrawal(id) {
|
| 95 |
+
window.location.href = `/withdraw_detail.html?id=${id}`;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
function approveWithdrawal(id) {
|
| 99 |
+
fetch(`/api/withdrawals/${id}/approve`, { method: 'POST' })
|
| 100 |
+
.then(() => window.location.reload());
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
function rejectWithdrawal(id) {
|
| 104 |
+
fetch(`/api/withdrawals/${id}/reject`, { method: 'POST' })
|
| 105 |
+
.then(() => window.location.reload());
|
| 106 |
+
}
|
| 107 |
+
</script>
|
| 108 |
+
</body>
|
| 109 |
+
</html>
|