diff --git a/assets/css/style.css b/assets/css/style.css index 7c85bd2..313da6e 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -828,29 +828,59 @@ input:focus, select:focus, textarea:focus { font-size: 1.3rem; } -.premade-invite-inline { width: 100%; } - -.premade-invite-inline select { - width: 100%; - padding: 0.45rem 0.6rem; - font-size: 0.82rem; +.premade-slot-invite-btn { + background: none; + border: none; + padding: 1rem 2rem; color: var(--text-muted); - background: transparent; - border: 1px dashed var(--border); - border-radius: 6px; + font-size: 1.5rem; + line-height: 1; + cursor: pointer; } -.premade-invite-inline select:hover { border-color: var(--gold); color: var(--gold); } +.premade-slot-invite-btn:hover { color: var(--gold); } -.premade-class-select { - width: auto; - max-width: 100%; - padding: 0.15rem 0.4rem; +.premade-class-btn { + background: none; + border: none; + padding: 0; + margin: 0; + font: inherit; font-size: 0.78rem; - border-radius: 4px; - color: var(--text-muted); + font-weight: 600; + text-align: left; + color: var(--gold); + cursor: pointer; } +.premade-class-btn:hover { color: var(--gold-hover); text-decoration: underline; } + +.premade-invite-list { + display: flex; + flex-direction: column; + gap: 0.5rem; + max-height: 340px; + overflow-y: auto; + margin: 1.25rem 0; +} + +.premade-invite-option { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.5rem 0.75rem; + background: var(--bg-panel-alt); + border: 1px solid var(--border); + border-radius: 8px; + color: var(--text); + cursor: pointer; + text-align: left; + font-size: 0.95rem; + width: 100%; +} + +.premade-invite-option:hover { border-color: var(--gold); color: var(--gold); } + .premade-slot-name { display: flex; flex-direction: column; diff --git a/assets/js/premades.js b/assets/js/premades.js new file mode 100644 index 0000000..65297a4 --- /dev/null +++ b/assets/js/premades.js @@ -0,0 +1,74 @@ +(function () { + 'use strict'; + + function openModal(modal) { + if (modal) modal.hidden = false; + } + + function closeModal(modal) { + if (modal) modal.hidden = true; + } + + function wireModal(modal) { + if (!modal) return; + var closeBtn = modal.querySelector('.modal-close'); + if (closeBtn) closeBtn.addEventListener('click', function () { closeModal(modal); }); + modal.addEventListener('click', function (e) { + if (e.target === modal) closeModal(modal); + }); + } + + // ---- Mitglied einladen ---- + var inviteModal = document.getElementById('premade-invite-modal'); + var inviteForm = document.getElementById('premade-invite-form'); + var invitePremadeIdField = document.getElementById('premade-invite-premade-id'); + var inviteUserIdField = document.getElementById('premade-invite-user-id'); + + wireModal(inviteModal); + + document.querySelectorAll('.premade-slot-invite-btn').forEach(function (btn) { + btn.addEventListener('click', function () { + invitePremadeIdField.value = btn.getAttribute('data-premade-id') || ''; + openModal(inviteModal); + }); + }); + + if (inviteModal) { + inviteModal.querySelectorAll('.premade-invite-option').forEach(function (btn) { + btn.addEventListener('click', function () { + inviteUserIdField.value = btn.getAttribute('data-user-id') || ''; + inviteForm.submit(); + }); + }); + } + + // ---- Klasse festlegen/aendern ---- + var classModal = document.getElementById('premade-class-modal'); + var classForm = document.getElementById('premade-class-form'); + var classPremadeIdField = document.getElementById('premade-class-premade-id'); + var classValueField = document.getElementById('premade-class-value'); + + wireModal(classModal); + + document.querySelectorAll('.premade-class-btn').forEach(function (btn) { + btn.addEventListener('click', function () { + classPremadeIdField.value = btn.getAttribute('data-premade-id') || ''; + var currentClass = btn.getAttribute('data-current-class') || ''; + if (classModal) { + classModal.querySelectorAll('.class-picker-option').forEach(function (option) { + option.classList.toggle('selected', option.getAttribute('data-class') === currentClass); + }); + } + openModal(classModal); + }); + }); + + if (classModal) { + classModal.querySelectorAll('.class-picker-option').forEach(function (btn) { + btn.addEventListener('click', function () { + classValueField.value = btn.getAttribute('data-class') || ''; + classForm.submit(); + }); + }); + } +})(); diff --git a/premades.php b/premades.php index 99fdcab..febe33f 100644 --- a/premades.php +++ b/premades.php @@ -89,7 +89,7 @@ foreach ($premades as $p) { } } $inviteCandidates = []; -foreach (db()->query("SELECT discord_id, discord_username, display_name FROM users WHERE discord_id IS NOT NULL AND status = 'active' ORDER BY display_name, username")->fetchAll() as $row) { +foreach (db()->query("SELECT id, discord_id, discord_username, display_name, avatar_filename FROM users WHERE discord_id IS NOT NULL AND status = 'active' ORDER BY display_name, username")->fetchAll() as $row) { if (in_array((int) $row['discord_id'], $busyDiscordIds, true)) { continue; } @@ -201,19 +201,7 @@ include __DIR__ . '/includes/header.php';
-
- - - - -
+ + @@ -232,17 +220,9 @@ include __DIR__ . '/includes/header.php'; Einladung offen -
- - - - -
+ @@ -300,6 +280,55 @@ include __DIR__ . '/includes/header.php';
+ + + + + + + + + +