- Settings page: bot token (masked), admin IDs, commission config, WireGuard status - Categories page: CRUD with product count, delete guard - Payment Wallets page: commission wallets display, toggle, percentage - Users page: balance adjustment form (total_balance / bonus_balance) with audit log - Seed & Reset page: seed demo data (5 users, 10 products, 5 wallets, 5 purchases) and clear all data button with confirmation - Dashboard: flash messages for seed/clear success - Fixed seed.js: use dynamic IDs instead of hardcoded to avoid FK violations - Fixed seed.js: clear all tables before seeding to avoid UNIQUE constraints
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import { layout } from './layout.js';
|
|
|
|
export function renderPaymentWallets(data) {
|
|
const walletRows = Object.entries(data.wallets).map(([type, addr]) =>
|
|
`<tr>
|
|
<td><strong>${type}</strong></td>
|
|
<td><code>${escapeHtml(addr || 'Not set')}</code></td>
|
|
</tr>`
|
|
).join('');
|
|
|
|
const content = `
|
|
<div class="detail-card">
|
|
<h2>Commission Status</h2>
|
|
<p><strong>Commission:</strong> <span class="badge badge-${data.commissionEnabled ? 'active' : 'banned'}">${data.commissionEnabled ? 'ON' : 'OFF'}</span></p>
|
|
<p><strong>Percentage:</strong> ${data.commissionPercent}%</p>
|
|
</div>
|
|
|
|
<div class="detail-card">
|
|
<h2>Commission Wallet Addresses</h2>
|
|
<p class="muted">These are the shop's payment wallets. Edit them in the <code>.env</code> file.</p>
|
|
<table>
|
|
<thead><tr><th>Currency</th><th>Address</th></tr></thead>
|
|
<tbody>${walletRows}</tbody>
|
|
</table>
|
|
</div>
|
|
`;
|
|
return layout('Payment Wallets', content, 'payment-wallets');
|
|
}
|
|
|
|
function escapeHtml(str) {
|
|
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
}
|