|
|
@@ -55,10 +55,11 @@ if (isset($_POST['add_new_game'])) {
|
|
|
$titel = trim($_POST['new_titel']);
|
|
|
$level = (empty($_POST['new_level']) || $_POST['new_level'] == 'Unknown') ? 'Unknown' : $_POST['new_level'];
|
|
|
$typ_id = ($_POST['new_typ_id'] == '0') ? null : (int)$_POST['new_typ_id'];
|
|
|
+ $bild_url = trim($_POST['new_bild_url']);
|
|
|
|
|
|
try {
|
|
|
$stmt = $pdo->prepare("INSERT INTO spiele (titel, typ_id, ean, level, bild_url) VALUES (?, ?, ?, ?, ?)");
|
|
|
- $stmt->execute([$titel, $typ_id, $ean, $level, "https://via.placeholder.com/60?text=Scan"]);
|
|
|
+ $stmt->execute([$titel, $typ_id, $ean, $level, $bild_url]);
|
|
|
$msg = "✅ Spiel erfolgreich angelegt!";
|
|
|
} catch (PDOException $e) {
|
|
|
if ($e->getCode() == 23000) {
|
|
|
@@ -70,8 +71,8 @@ if (isset($_POST['add_new_game'])) {
|
|
|
|
|
|
// Spiel aktualisieren
|
|
|
if (isset($_POST['update_game'])) {
|
|
|
- $stmt = $pdo->prepare("UPDATE spiele SET titel = ?, typ_id = ?, ean = ?, level = ? WHERE id = ?");
|
|
|
- $stmt->execute([$_POST['titel'], ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']), $_POST['ean'], $_POST['level'], (int)$_POST['spiel_id']]);
|
|
|
+ $stmt = $pdo->prepare("UPDATE spiele SET titel = ?, typ_id = ?, ean = ?, level = ?, bild_url = ? WHERE id = ?");
|
|
|
+ $stmt->execute([$_POST['titel'], ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']), $_POST['ean'], $_POST['level'], $_POST['bild_url'], (int)$_POST['spiel_id']]);
|
|
|
$msg = "💾 Änderungen gespeichert!";
|
|
|
}
|
|
|
|
|
|
@@ -92,30 +93,32 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<meta charset="UTF-8">
|
|
|
<title>EXIT Admin - Stammdaten</title>
|
|
|
<style>
|
|
|
- body { font-family: 'Segoe UI', sans-serif; background: #f4f7f6; padding: 20px; }
|
|
|
- .container { max-width: 1200px; margin: 0 auto; }
|
|
|
+ body { font-family: 'Segoe UI', sans-serif; background: #121212; color: #e0e0e0; padding: 20px; }
|
|
|
+ .container { max-width: 1300px; margin: 0 auto; }
|
|
|
.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; }
|
|
|
.alert-success { background: #27ae60; color: white; }
|
|
|
.alert-error { background: #e74c3c; color: white; }
|
|
|
|
|
|
- .admin-card { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 30px; }
|
|
|
+ .admin-card { background: #1e1e1e; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); margin-bottom: 30px; border: 1px solid #333; }
|
|
|
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
|
|
|
- th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
|
|
|
- input, select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; width: 100%; box-sizing: border-box; }
|
|
|
+ th, td { padding: 10px; border-bottom: 1px solid #333; text-align: left; }
|
|
|
+ th { color: #e67e22; }
|
|
|
+ input, select { padding: 8px; border: 1px solid #444; border-radius: 6px; width: 100%; box-sizing: border-box; background: #2a2a2a; color: white; }
|
|
|
|
|
|
- /* Unbekannt Styling */
|
|
|
- .lvl-unknown { background: #f39c12 !important; color: white; }
|
|
|
- .btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; }
|
|
|
+ .lvl-unknown { background: #d35400 !important; color: white; }
|
|
|
+ .btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; }
|
|
|
.btn-add { background: #27ae60; width: 100%; margin-top: 10px; }
|
|
|
.btn-save { background: #2980b9; }
|
|
|
- .btn-del { background: #e74c3c; }
|
|
|
+ .btn-del { background: #c0392b; }
|
|
|
.btn-nav { background: #e67e22; }
|
|
|
+
|
|
|
+ .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: #333; }
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
|
|
|
<div class="container">
|
|
|
- <div style="display:flex; justify-content: space-between; align-items: center;">
|
|
|
+ <div style="display:flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
|
|
<h1>🛠 Stammdaten Verwaltung</h1>
|
|
|
<div>
|
|
|
<a href="index.php" class="btn btn-nav">Dashboard</a>
|
|
|
@@ -130,7 +133,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<div class="admin-card">
|
|
|
<h3>🆕 Neues Spiel hinzufügen</h3>
|
|
|
<form method="POST">
|
|
|
- <div style="display: grid; grid-template-columns: 2fr 1.5fr 1.5fr 1.5fr; gap: 15px;">
|
|
|
+ <div style="display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 2fr; gap: 10px;">
|
|
|
<input type="text" name="new_titel" placeholder="Spieltitel" required>
|
|
|
<input type="text" name="new_ean" placeholder="EAN Scannen" required>
|
|
|
<select name="new_typ_id">
|
|
|
@@ -145,6 +148,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<option value="Fortgeschrittene">Fortgeschrittene</option>
|
|
|
<option value="Profi">Profi</option>
|
|
|
</select>
|
|
|
+ <input type="text" name="new_bild_url" placeholder="Bild-URL (z.B. https://...)">
|
|
|
</div>
|
|
|
<button type="submit" name="add_new_game" class="btn btn-add">Spiel in Datenbank speichern</button>
|
|
|
</form>
|
|
|
@@ -155,10 +159,12 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<table>
|
|
|
<thead>
|
|
|
<tr>
|
|
|
+ <th style="width: 50px;">Bild</th>
|
|
|
<th>Titel</th>
|
|
|
<th>EAN</th>
|
|
|
<th>Typ</th>
|
|
|
<th>Level</th>
|
|
|
+ <th>Bild-URL</th>
|
|
|
<th>Aktion</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
@@ -169,6 +175,7 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<tr>
|
|
|
<form method="POST">
|
|
|
<input type="hidden" name="spiel_id" value="<?= $sp['id'] ?>">
|
|
|
+ <td><img src="<?= htmlspecialchars($sp['bild_url']) ?>" class="img-preview" alt="Cover"></td>
|
|
|
<td><input type="text" name="titel" value="<?= htmlspecialchars($sp['titel']) ?>"></td>
|
|
|
<td><input type="text" name="ean" value="<?= htmlspecialchars($sp['ean']) ?>"></td>
|
|
|
<td>
|
|
|
@@ -187,9 +194,10 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<option value="Profi" <?= $sp['level']=='Profi'?'selected':'' ?>>Profi</option>
|
|
|
</select>
|
|
|
</td>
|
|
|
+ <td><input type="text" name="bild_url" value="<?= htmlspecialchars($sp['bild_url']) ?>"></td>
|
|
|
<td style="white-space:nowrap;">
|
|
|
- <button type="submit" name="update_game" class="btn btn-save">💾</button>
|
|
|
- <button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Wirklich löschen?')">🗑</button>
|
|
|
+ <button type="submit" name="update_game" class="btn btn-save" title="Speichern">💾</button>
|
|
|
+ <button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Wirklich löschen?')" title="Löschen">🗑</button>
|
|
|
</td>
|
|
|
</form>
|
|
|
</tr>
|
|
|
@@ -200,7 +208,6 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
- // Nachricht nach 3 Sek ausblenden
|
|
|
setTimeout(() => {
|
|
|
const msg = document.getElementById('msg-box');
|
|
|
if(msg) msg.style.display = 'none';
|