wohnungen: preserve map across HTMX polls, add rejected section, drop €/m²

- #flats-map uses hx-preserve; marker data moved to <script type="application/json">
  sibling that diffs+updates instead of rebuilding Leaflet every poll (fixes
  whitescreen + tiles rendering outside the card)
- upsert_flat backfills lat/lng on existing rows missing coords (older flats
  scraped before the lat/lng migration now appear on the map once alert re-submits)
- collapsible "Abgelehnte Wohnungen" section at the bottom with Wiederherstellen
- remove €/m² column from the list

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-21 13:33:55 +02:00
parent 4fd0b50a43
commit 51b6b02b24
4 changed files with 155 additions and 45 deletions

View file

@ -404,6 +404,8 @@ def _wohnungen_context(user) -> dict:
last = db.last_application_for_flat(uid, f["id"])
flats_view.append({"row": f, "last": last})
rejected_view = db.rejected_flats(uid)
allowed, reason = _manual_apply_allowed()
alert_label, alert_chip = _alert_status(notif_row)
has_running = _has_running_application(uid)
@ -422,6 +424,7 @@ def _wohnungen_context(user) -> dict:
})
return {
"flats": flats_view,
"rejected_flats": rejected_view,
"map_points": map_points,
"has_filters": _has_filters(filters_row),
"alert_label": alert_label,
@ -548,6 +551,20 @@ async def action_reject(
return _wohnungen_partial_or_redirect(request, user)
@app.post("/actions/unreject")
async def action_unreject(
request: Request,
flat_id: str = Form(...),
csrf: str = Form(...),
user=Depends(require_user),
):
require_csrf(user["id"], csrf)
db.unreject_flat(user["id"], flat_id)
db.log_audit(user["username"], "flat.unrejected", f"flat_id={flat_id}",
user_id=user["id"], ip=client_ip(request))
return _wohnungen_partial_or_redirect(request, user)
# ---------------------------------------------------------------------------
# Tab: Bewerbungen
# ---------------------------------------------------------------------------