${new Intl.NumberFormat('de-DE').format(article.weight_grams)} g | ${quantityBadge}
diff --git a/src/categories.php b/src/categories.php
index 7fb8a29..2112425 100644
--- a/src/categories.php
+++ b/src/categories.php
@@ -121,7 +121,7 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id
$stmt_check->close();
}
-$categories_query = $conn->prepare("SELECT c.id, c.name, c.color, c.user_id, u.username as creator_name FROM categories c JOIN users u ON c.user_id = u.id WHERE c.user_id IN ($placeholders) ORDER BY c.name ASC");
+$categories_query = $conn->prepare("SELECT c.id, c.name, c.color, c.user_id, COALESCE(NULLIF(u.display_name, ''), u.username) as creator_name FROM categories c JOIN users u ON c.user_id = u.id WHERE c.user_id IN ($placeholders) ORDER BY c.name ASC");
$categories_query->bind_param($types, ...$household_member_ids);
$categories_query->execute();
$categories_list = $categories_query->get_result()->fetch_all(MYSQLI_ASSOC);
diff --git a/src/index.php b/src/index.php
index 4c0f224..177ee96 100644
--- a/src/index.php
+++ b/src/index.php
@@ -44,7 +44,7 @@ $types = str_repeat('i', count($household_member_ids));
// --- Daten für die Statistik-Boxen laden ---
$articles_by_category = [];
-$sql_articles_by_category = "SELECT c.name AS category_name, COUNT(a.id) AS article_count FROM articles a LEFT JOIN categories c ON a.category_id = c.id WHERE a.user_id IN ($placeholders) OR a.household_id = ? GROUP BY c.name ORDER BY article_count DESC";
+$sql_articles_by_category = "SELECT c.name AS category_name, c.color AS category_color, COUNT(a.id) AS article_count FROM articles a LEFT JOIN categories c ON a.category_id = c.id WHERE a.user_id IN ($placeholders) OR a.household_id = ? GROUP BY c.name, c.color ORDER BY article_count DESC";
$stmt_articles_by_category = $conn->prepare($sql_articles_by_category);
if ($stmt_articles_by_category) {
$all_params = array_merge($household_member_ids, [$current_user_household_id]);
@@ -55,6 +55,7 @@ if ($stmt_articles_by_category) {
while ($row = $result_articles_by_category->fetch_assoc()) {
$articles_by_category[] = [
'category_name' => $row['category_name'] ?: 'Ohne Kategorie',
+ 'category_color' => $row['category_color'] ?: '#e2e8f0',
'article_count' => $row['article_count']
];
}
@@ -79,11 +80,42 @@ if ($stmt_lists) {
}
$stmt_lists->close();
}
+
+// Weitere Statistiken sammeln
+$total_articles = 0;
+$stmt_count_articles = $conn->prepare("SELECT COUNT(*) as count FROM articles WHERE user_id IN ($placeholders) OR household_id = ?");
+$stmt_count_articles->bind_param($all_types, ...$all_params);
+$stmt_count_articles->execute();
+$total_articles = $stmt_count_articles->get_result()->fetch_assoc()['count'];
+$stmt_count_articles->close();
+
+$total_lists = 0;
+$stmt_count_lists = $conn->prepare("SELECT COUNT(*) as count FROM packing_lists WHERE is_template = 0 AND (user_id IN ($placeholders) OR household_id = ?)");
+$stmt_count_lists->bind_param($all_types, ...$all_params);
+$stmt_count_lists->execute();
+$total_lists = $stmt_count_lists->get_result()->fetch_assoc()['count'];
+$stmt_count_lists->close();
+
+$total_templates = 0;
+$stmt_count_templates = $conn->prepare("SELECT COUNT(*) as count FROM packing_lists WHERE is_template = 1 AND (user_id IN ($placeholders) OR household_id = ?)");
+$stmt_count_templates->bind_param($all_types, ...$all_params);
+$stmt_count_templates->execute();
+$total_templates = $stmt_count_templates->get_result()->fetch_assoc()['count'];
+$stmt_count_templates->close();
+
+$total_backpacks = 0;
+$stmt_count_bp = $conn->prepare("SELECT COUNT(*) as count FROM backpacks WHERE user_id IN ($placeholders) OR household_id = ?");
+$stmt_count_bp->bind_param($all_types, ...$all_params);
+$stmt_count_bp->execute();
+$total_backpacks = $stmt_count_bp->get_result()->fetch_assoc()['count'];
+$stmt_count_bp->close();
+
$conn->close();
// Daten für die Diagramme vorbereiten
$category_chart_labels = json_encode(array_column($articles_by_category, 'category_name'));
$category_chart_data = json_encode(array_column($articles_by_category, 'article_count'));
+$category_chart_colors = json_encode(array_column($articles_by_category, 'category_color'));
$list_chart_labels = json_encode(array_column($packing_lists_stats, 'packing_list_name'));
$list_chart_data = json_encode(array_column($packing_lists_stats, 'total_weight_grams'));
@@ -94,7 +126,7 @@ $random_quote = $quotes[array_rand($quotes)];
-
Willkommen zurück, !
+
Willkommen zurück, !
Organisiere deine Ausrüstung und bereite dich optimal auf dein nächstes Abenteuer vor.
@@ -105,10 +137,37 @@ $random_quote = $quotes[array_rand($quotes)];
+
+
+
+
+ Artikel im Haushalt
+
+
+
+
+
+
+
-
-
+
+
Füge Artikel hinzu, um hier eine Übersicht zu sehen.
@@ -122,8 +181,8 @@ $random_quote = $quotes[array_rand($quotes)];
-
-
+
+
Erstelle eine Packliste, um hier eine Analyse zu sehen.
@@ -141,12 +200,6 @@ $random_quote = $quotes[array_rand($quotes)];