瀏覽代碼

Sortiert nach namen als default

erdo 16 小時之前
父節點
當前提交
48e47a41ea
共有 1 個文件被更改,包括 18 次插入7 次删除
  1. 18 7
      gesamtliste.php

+ 18 - 7
gesamtliste.php

@@ -6,7 +6,7 @@ require_once 'db_config.php';
 $filterPlayerId = isset($_GET['team_filter']) ? (int)$_GET['team_filter'] : 0;
 $filterTypId = isset($_GET['typ_filter']) ? (int)$_GET['typ_filter'] : 0;
 
-// SQL Query mit dynamischen Filtern
+// SQL Query mit Filtern und Standard-Sortierung nach Titel (A-Z)
 $sql = "SELECT sp.*, t.bezeichnung as typ_name, MAX(sc.sterne) as best_sterne, 
                (SELECT status FROM besitzstatus WHERE spiel_id = sp.id AND spieler_id = :fid) as einzel_status,
                (SELECT GROUP_CONCAT(CONCAT(p.name, ': ', b.status) SEPARATOR '||') 
@@ -22,7 +22,7 @@ if ($filterTypId > 0) {
     $sql .= " AND sp.typ_id = :tid ";
 }
 
-$sql .= " GROUP BY sp.id ORDER BY sp.id DESC";
+$sql .= " GROUP BY sp.id ORDER BY sp.titel ASC";
 
 $stmt = $pdo->prepare($sql);
 $params = ['fid' => $filterPlayerId];
@@ -32,6 +32,7 @@ if ($filterTypId > 0) { $params['tid'] = $filterTypId; }
 $stmt->execute($params);
 $inventory = $stmt->fetchAll();
 
+// Daten für die Filter-Dropdowns
 $spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
 $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetchAll();
 ?>
@@ -68,7 +69,9 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
         th { background: var(--header-bg); color: var(--header-text); text-align: left; padding: 15px; cursor: pointer; font-size: 0.85em; }
         td { padding: 12px 15px; border-bottom: 1px solid var(--row-border); }
         
-        .game-thumb { width: 55px; height: 55px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
+        .game-thumb { width: 55px; height: 55px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: 0.2s; }
+        .game-thumb:hover { transform: scale(1.1); border-color: var(--accent); }
+
         .lvl-badge { padding: 4px 10px; border-radius: 20px; color: white; font-size: 11px; font-weight: bold; text-transform: uppercase; }
         .lvl-Einsteiger { background: #27ae60; } 
         .lvl-Fortgeschrittene { background: #2980b9; } 
@@ -78,13 +81,17 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
         .st-badge { padding: 5px 12px; border-radius: 15px; font-size: 11px; font-weight: bold; }
         .st-besitzt { background: #d4edda; color: #155724; }
         .dark-theme .st-besitzt { background: #1b4332; color: #74c69d; }
+        .st-verkauft { background: #fff3cd; color: #856404; }
+        .st-keins { background: #f8d7da; color: #721c24; }
         
         .team-pill { display: inline-flex; align-items: center; background: var(--bg); padding: 4px 10px; border-radius: 6px; font-size: 12px; margin: 2px; border: 1px solid var(--border); }
         .dot { height: 8px; width: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
 
-        #imgModal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); align-items: center; justify-content: center; }
+        #imgModal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); align-items: center; justify-content: center; cursor: zoom-out; }
         #modalContent { max-width: 90%; max-height: 90%; border-radius: 10px; }
         .image-preview { position: absolute; display: none; width: 220px; border: 4px solid white; border-radius: 12px; z-index: 999; box-shadow: 0 15px 35px rgba(0,0,0,0.4); pointer-events: none; }
+        
+        .theme-toggle { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
     </style>
 </head>
 <body>
@@ -93,21 +100,21 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
     <div class="header-area">
         <h1>📝 Sammlungs-Übersicht</h1>
         <div class="nav-group">
-            <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon" style="background:none; border:none; font-size:1.5rem; cursor:pointer;">🌙</button>
+            <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
             <a href="index.php" class="back-link">Dashboard</a>
         </div>
     </div>
 
     <div class="filter-bar">
         <form method="GET" id="filterForm">
-            <select name="team_filter" onchange="document.getElementById('filterForm').submit()">
+            <select name="team_filter" onchange="this.form.submit()">
                 <option value="0">-- Alle Teams --</option>
                 <?php foreach ($spieler as $p): ?>
                     <option value="<?= $p['id'] ?>" <?= $filterPlayerId == $p['id'] ? 'selected' : '' ?>><?= htmlspecialchars($p['name']) ?></option>
                 <?php endforeach; ?>
             </select>
 
-            <select name="typ_filter" onchange="document.getElementById('filterForm').submit()">
+            <select name="typ_filter" onchange="this.form.submit()">
                 <option value="0">-- Alle Typen --</option>
                 <?php foreach ($typen as $t): ?>
                     <option value="<?= $t['id'] ?>" <?= $filterTypId == $t['id'] ? 'selected' : '' ?>><?= htmlspecialchars($t['bezeichnung']) ?></option>
@@ -179,6 +186,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
 <img id="hoverPreview" class="image-preview" src="">
 
 <script>
+    // Theme Switcher
     function toggleTheme() {
         const isDark = document.documentElement.classList.toggle('dark-theme');
         localStorage.setItem('theme', isDark ? 'dark' : 'light');
@@ -189,6 +197,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
         document.getElementById('theme-icon').innerText = '☀️';
     }
 
+    // Modal & Preview Logik
     const modal = document.getElementById("imgModal");
     const modalImg = document.getElementById("modalContent");
     function openModal(url) { modal.style.display = "flex"; modalImg.src = url; hidePreview(); }
@@ -205,12 +214,14 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
     }
     document.addEventListener('mousemove', (e) => { if(preview.style.display==='block') updatePos(e); });
 
+    // Live-Suche
     function filterTable() {
         let val = document.getElementById("searchInput").value.toUpperCase();
         let tr = document.getElementById("exitTable").getElementsByTagName("tr");
         for (let i = 1; i < tr.length; i++) tr[i].style.display = tr[i].innerText.toUpperCase().includes(val) ? "" : "none";
     }
 
+    // Sortierung
     function sortTable(n) {
         var table = document.getElementById("exitTable");
         var rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;