chipflow-commander / transactions_transfer.html
Xcronious's picture
tolong perhatikan lg fungsi fungsi yang ada di admin dashboard karna tidak seperti itu dan selesaikan semua modul yg tersisa
201773a verified
Raw
History Blame Contribute Delete
4.61 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ChipFlow - Transfers</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-gray-100">
<div class="container mx-auto p-4">
<div class="bg-white rounded-lg shadow p-6">
<h1 class="text-2xl font-bold mb-6">Transfer Management</h1>
<div class="mb-6">
<button id="newTransferBtn" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
<i data-feather="plus" class="mr-2"></i>New Transfer
</button>
</div>
<div class="overflow-x-auto">
<table class="min-w-full bg-white">
<thead>
<tr class="bg-gray-100 text-left">
<th class="py-3 px-4">ID</th>
<th class="py-3 px-4">From Customer</th>
<th class="py-3 px-4">To Customer</th>
<th class="py-3 px-4">Chips</th>
<th class="py-3 px-4">Status</th>
<th class="py-3 px-4">Date</th>
<th class="py-3 px-4">Actions</th>
</tr>
</thead>
<tbody id="transferTableBody">
<!-- Data will be loaded via JS -->
</tbody>
</table>
</div>
</div>
</div>
<script>
feather.replace();
// Load transfer data
fetch('/api/transfers')
.then(response => response.json())
.then(data => {
const tbody = document.getElementById('transferTableBody');
tbody.innerHTML = data.map(transfer => `
<tr class="border-b">
<td class="py-3 px-4">${transfer.id}</td>
<td class="py-3 px-4">${transfer.fromCustomer}</td>
<td class="py-3 px-4">${transfer.toCustomer}</td>
<td class="py-3 px-4">${transfer.chips}</td>
<td class="py-3 px-4">
<span class="px-2 py-1 rounded-full text-xs ${getStatusClass(transfer.status)}">
${transfer.status}
</span>
</td>
<td class="py-3 px-4">${new Date(transfer.date).toLocaleDateString()}</td>
<td class="py-3 px-4">
<button onclick="viewTransfer('${transfer.id}')" class="text-blue-600 hover:text-blue-800 mr-2">
<i data-feather="eye"></i>
</button>
${transfer.status === 'Pending' ? `
<button onclick="approveTransfer('${transfer.id}')" class="text-green-600 hover:text-green-800 mr-2">
<i data-feather="check"></i>
</button>
<button onclick="rejectTransfer('${transfer.id}')" class="text-red-600 hover:text-red-800">
<i data-feather="x"></i>
</button>
` : ''}
</td>
</tr>
`).join('');
feather.replace();
});
function getStatusClass(status) {
return {
'Pending': 'bg-yellow-100 text-yellow-800',
'Completed': 'bg-green-100 text-green-800',
'Rejected': 'bg-red-100 text-red-800'
}[status] || 'bg-gray-100 text-gray-800';
}
document.getElementById('newTransferBtn').addEventListener('click', () => {
window.location.href = '/transfer_new.html';
});
function viewTransfer(id) {
window.location.href = `/transfer_detail.html?id=${id}`;
}
function approveTransfer(id) {
fetch(`/api/transfers/${id}/approve`, { method: 'POST' })
.then(() => window.location.reload());
}
function rejectTransfer(id) {
fetch(`/api/transfers/${id}/reject`, { method: 'POST' })
.then(() => window.location.reload());
}
</script>
</body>
</html>