lazyflat/web/templates/_settings_partner.html
EiSiMo a212dff4d9 bewerben UX: instant feedback; drop forensics detail; partner feature
1. Bewerben button: hx-disabled-elt + hx-on::before-request flips the
   text to "läuft…" and disables the button the moment the confirm is
   accepted. .btn[disabled] now renders at 55% opacity with
   not-allowed cursor. Existing 3s poll interval picks up the running
   state for the chip beside the address.

2. Bewerbungen tab: delete the /bewerbungen/<id> forensics detail page
   + template entirely. The list now shows a plain "Report (ZIP)"
   button for every row regardless of success — same download route
   (/bewerbungen/<id>/report.zip), same visual style. External link to
   the listing moved onto the address itself.

3. Verified retention: web/retention.py runs cleanup_retention() hourly,
   which DELETEs errors + audit_log rows older than RETENTION_DAYS (14)
   and nulls applications.forensics_json for older rows. No code change
   needed.

4. Partner feature. Migration v8 adds partnerships(from_user_id,
   to_user_id, status, created_at, accepted_at). Einstellungen →
   Partner lets users:
   - send a request by username
   - accept / decline incoming requests
   - withdraw outgoing requests
   - unlink the active partnership

   A user can only have one accepted partnership; accepting one wipes
   stale pending rows involving either side. On the Wohnungen list, if
   the partner has applied to a flat, a small primary-colored circle
   with the partner's first-name initial sits on the top-right of the
   Bewerben button; if they've rejected it, the badge sits on Ablehnen.
   Badge is hover-tooltipped with the partner's name + verb.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 18:18:24 +02:00

100 lines
4.6 KiB
HTML

<h2 class="font-semibold mb-2">Partner</h2>
<p class="text-sm text-slate-600 mb-4">
Verknüpfe deinen Account mit einem anderen Benutzer. Ihr seht dann gegenseitig,
welche Wohnungen der/die andere schon beworben oder abgelehnt hat.
</p>
{% if partner_flash %}
<div class="chip mb-4
{% if partner_flash in ('sent','accepted','declined','unlinked') %}chip-ok
{% elif partner_flash in ('nouser','exists','accept_failed') %}chip-bad
{% endif %}">
{% if partner_flash == 'sent' %}Anfrage gesendet.
{% elif partner_flash == 'accepted' %}Partnerschaft aktiv.
{% elif partner_flash == 'declined' %}Anfrage abgelehnt.
{% elif partner_flash == 'unlinked' %}Partnerschaft beendet.
{% elif partner_flash == 'nouser' %}Benutzer nicht gefunden.
{% elif partner_flash == 'exists' %}Bereits eine Anfrage oder Verknüpfung vorhanden.
{% elif partner_flash == 'accept_failed' %}Annahme fehlgeschlagen.
{% endif %}
</div>
{% endif %}
{% if partner %}
<section class="card p-4 mb-6 flex items-center justify-between gap-3">
<div>
<div class="text-xs uppercase tracking-wide text-slate-500">Verknüpft mit</div>
<div class="text-sm font-medium">
{{ partner_profile.firstname or partner.username }}
<span class="text-slate-500">({{ partner.username }})</span>
</div>
</div>
<form method="post" action="/actions/partner/unlink"
onsubmit="return confirm('Partnerschaft wirklich beenden?');">
<input type="hidden" name="csrf" value="{{ csrf }}">
<button class="btn btn-danger text-sm" type="submit">Trennen</button>
</form>
</section>
{% else %}
{% if incoming_requests %}
<section class="card mb-6">
<div class="px-4 py-2 border-b border-soft text-xs uppercase tracking-wide text-slate-500">
Eingegangene Anfragen
</div>
<div class="divide-y divide-soft">
{% for r in incoming_requests %}
<div class="px-4 py-3 flex items-center justify-between gap-3">
<span class="text-sm">{{ r.from_username }}</span>
<div class="flex gap-2">
<form method="post" action="/actions/partner/accept">
<input type="hidden" name="csrf" value="{{ csrf }}">
<input type="hidden" name="request_id" value="{{ r.id }}">
<button class="btn btn-primary text-sm" type="submit">Annehmen</button>
</form>
<form method="post" action="/actions/partner/decline">
<input type="hidden" name="csrf" value="{{ csrf }}">
<input type="hidden" name="request_id" value="{{ r.id }}">
<button class="btn btn-ghost text-sm" type="submit">Ablehnen</button>
</form>
</div>
</div>
{% endfor %}
</div>
</section>
{% endif %}
{% if outgoing_requests %}
<section class="card mb-6">
<div class="px-4 py-2 border-b border-soft text-xs uppercase tracking-wide text-slate-500">
Ausgehende Anfragen
</div>
<div class="divide-y divide-soft">
{% for r in outgoing_requests %}
<div class="px-4 py-3 flex items-center justify-between gap-3">
<span class="text-sm">{{ r.to_username }} <span class="text-slate-500">(ausstehend)</span></span>
<form method="post" action="/actions/partner/decline">
<input type="hidden" name="csrf" value="{{ csrf }}">
<input type="hidden" name="request_id" value="{{ r.id }}">
<button class="btn btn-ghost text-sm" type="submit">Zurückziehen</button>
</form>
</div>
{% endfor %}
</div>
</section>
{% endif %}
<section class="card p-4">
<h3 class="font-semibold mb-3">Neue Anfrage</h3>
<form method="post" action="/actions/partner/request"
class="flex items-end gap-3 flex-wrap"
autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore data-form-type="other">
<input type="hidden" name="csrf" value="{{ csrf }}">
<div class="flex-1 min-w-0">
<label class="block text-xs uppercase tracking-wide text-slate-500 mb-1">Benutzername</label>
<input class="input" name="partner_username" required
autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<button class="btn btn-primary text-sm" type="submit">Anfrage senden</button>
</form>
</section>
{% endif %}