diff --git a/src/api/main.py b/src/api/main.py index 69ed8d0..8118ccb 100644 --- a/src/api/main.py +++ b/src/api/main.py @@ -283,6 +283,51 @@ def admin_toggle( return RedirectResponse(url="/admin", status_code=303) +@app.get("/search/special", response_class=HTMLResponse) +def web_search_special( + request: Request, + type: str = Query(...), + current_user: str = Depends(get_current_user), +): + account_name, is_admin, show_all = _resolve_effective_account(request, current_user) + + query_fn = { + "no_photo": db.search_contacts_without_photo, + "no_city": db.search_contacts_without_city, + "no_social": db.search_contacts_without_social, + }.get(type) + + if not query_fn: + return RedirectResponse(url="/", status_code=303) + + title_map = { + "no_photo": "Kontakte ohne Bild", + "no_city": "Kontakte ohne Stadt", + "no_social": "Kontakte ohne Social Profil", + } + + with db.get_connection() as conn: + rows = query_fn(conn, account_name) + + for row in rows: + if not row.get("full_name"): + row["full_name"] = db._build_full_name(row) + + return templates.TemplateResponse( + "index.html", + { + "request": request, + "current_user": current_user, + "is_admin": is_admin, + "show_all": show_all, + "account_name": account_name or "alle Accounts", + "contacts": rows, + "search": "", + "search_title": title_map.get(type, "Suche"), + }, + ) + + @app.get("/search", response_class=HTMLResponse) def web_search( request: Request, diff --git a/src/api/templates/dashboard.html b/src/api/templates/dashboard.html index 0148598..9240f13 100644 --- a/src/api/templates/dashboard.html +++ b/src/api/templates/dashboard.html @@ -242,6 +242,44 @@ .search-form button:hover { background: #0055aa; } + + .contact-stats { + display: flex; + gap: 1.5rem; + } + + .contact-stats-left { + flex: 1; + } + + .contact-stats-right { + flex: 1; + display: flex; + flex-direction: column; + gap: 0.5rem; + justify-content: center; + } + + .special-search { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0.4rem 0.6rem; + background: #f8f9fa; + border-radius: 4px; + text-decoration: none; + color: inherit; + font-size: 0.8125rem; + transition: background 0.15s; + } + + .special-search:hover { + background: #e9ecef; + } + + .special-search-label { + color: #555; + } @@ -263,8 +301,23 @@
Kontakte
-
{{ contact_count }}
-
gespeicherte Kontakte
+
+
+
{{ contact_count }}
+
gespeicherte Kontakte
+
+ +
diff --git a/src/api/templates/index.html b/src/api/templates/index.html index c5ef333..2e2ad1c 100644 --- a/src/api/templates/index.html +++ b/src/api/templates/index.html @@ -6,7 +6,7 @@ - Kontakte – {{ account_name }} + {% if search_title %}{{ search_title }} – {% endif %}{{ account_name }}