mirror of
https://github.com/myronblair/tomtomgames
synced 2026-06-30 17:51:08 -05:00
Fix add new game: reset form on section load, add prominent Add New Game button
- resetGameForm() now called every time Game Management section is opened, preventing stuck edit state (disabled slug, wrong form title) - Added prominent Add New Game button at top of section (master admin only) - DOMContentLoaded init ensures form state is correct on page load Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+11
-4
@@ -772,7 +772,14 @@ tr:hover td{background:rgba(255,255,255,.015)}
|
||||
|
||||
<!-- ── GAME MANAGEMENT ─────────────────────────────────── -->
|
||||
<div class="section" id="section-games">
|
||||
<div class="page-title">🕹️ Game Management</div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;flex-wrap:wrap;gap:10px">
|
||||
<div class="page-title" style="margin-bottom:0">🕹️ Game Management</div>
|
||||
<?php if ((int)$_SESSION['user_id'] === MASTER_ADMIN_ID): ?>
|
||||
<button class="btn btn-gold" onclick="resetGameForm();document.getElementById('game-form-card').scrollIntoView({behavior:'smooth'})" style="padding:10px 20px;font-size:15px">
|
||||
➕ Add New Game
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Add / Edit form — master admin always sees this; others see it only when editing -->
|
||||
<div class="card" id="game-form-card" style="margin-bottom:16px;<?= (int)$_SESSION['user_id'] !== MASTER_ADMIN_ID ? 'display:none' : '' ?>">
|
||||
@@ -1172,8 +1179,8 @@ loadStats();
|
||||
loadPurchases('pending');
|
||||
loadCashouts('pending');
|
||||
loadUsers();
|
||||
// Initialize game form state on page load
|
||||
if (typeof resetGameForm === 'function') resetGameForm();
|
||||
// Initialize game form once DOM is ready
|
||||
document.addEventListener('DOMContentLoaded', () => resetGameForm());
|
||||
|
||||
async function loadStats() {
|
||||
const d = await apiFetch('stats');
|
||||
@@ -3428,7 +3435,7 @@ function showSec(name) {
|
||||
if (name === 'referrals') { loadAdminReferrals('pending', document.querySelector('#section-referrals .ftab')); }
|
||||
if (name === 'platform-accounts') loadPlatformAccountRequests('pending', document.querySelector('#section-platform-accounts .ftab'));
|
||||
if (name === 'broadcasts') loadBroadcasts();
|
||||
if (name === 'games') { loadGames(); loadArchivedGames(); }
|
||||
if (name === 'games') { loadGames(); loadArchivedGames(); resetGameForm(); }
|
||||
if (name === 'payments') loadPaymentSettings();
|
||||
if (name === 'payout-settings') loadPayoutSettings();
|
||||
if (name === 'cashout-methods') loadCashoutMethods();
|
||||
|
||||
Reference in New Issue
Block a user