diff --git a/backend/main.py b/backend/main.py index 93009ed..2588f0c 100644 --- a/backend/main.py +++ b/backend/main.py @@ -406,7 +406,7 @@ async def serve_media(path: str, request: _Request): raise _HE(404, "Nicht gefunden.") return _media_response(filepath) -APP_VER = "918" # muss mit APP_VER in app.js übereinstimmen +APP_VER = "919" # muss mit APP_VER in app.js übereinstimmen @app.get("/.well-known/assetlinks.json") async def assetlinks(): diff --git a/backend/routes/auth.py b/backend/routes/auth.py index a0174e6..9ad43fe 100644 --- a/backend/routes/auth.py +++ b/backend/routes/auth.py @@ -240,7 +240,7 @@ async def me(user=Depends(get_current_user)): profil_sichtbarkeit, avatar_url, created_at, is_founder, is_partner, founder_number, is_founder_pending, notes_ki_enabled, gassi_stunde_push, - preferred_theme + preferred_theme, subscription_tier FROM users WHERE id=?""", (user["id"],) ).fetchone() diff --git a/backend/static/index.html b/backend/static/index.html index 0e13659..d079f75 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -599,10 +599,10 @@ - - - - + + + + diff --git a/backend/static/js/app.js b/backend/static/js/app.js index c6d2189..3e3529d 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -3,7 +3,7 @@ Router, State-Management, Navigation, Initialisierung. ============================================================ */ -const APP_VER = '918'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen +const APP_VER = '919'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen const APP_VERSION = '1.5.1'; // ← semantische Version, wird bei make release gesetzt const IS_STAGING = location.hostname === 'staging.banyaro.app'; // Cache-Bust-Parameter nach Update-Reload sofort entfernen diff --git a/backend/static/js/pages/settings.js b/backend/static/js/pages/settings.js index 8767cc6..f95e235 100644 --- a/backend/static/js/pages/settings.js +++ b/backend/static/js/pages/settings.js @@ -77,6 +77,125 @@ window.Page_settings = (() => { } } + // ---------------------------------------------------------- + // ABO & TARIF + // ---------------------------------------------------------- + function _tierCard(u) { + const tier = u.subscription_tier || 'standard'; + const rolle = u.rolle || 'user'; + const isAdmin = rolle === 'admin' || rolle === 'moderator'; + const isPro = ['pro','pro_test'].includes(tier); + const isBreeder = ['breeder','breeder_test'].includes(tier) || rolle === 'breeder'; + const isStandard = !isAdmin && !isPro && !isBreeder; + + const _badge = (label, color) => + `${label}`; + + const _upgradeBtn = (id, label, price, color) => + ``; + + let statusHtml = ''; + let actionsHtml = ''; + + if (isAdmin) { + statusHtml = _badge('Admin', '#6366f1'); + } else if (isBreeder) { + statusHtml = _badge('Züchter aktiv', '#C4843A'); + } else if (isPro) { + statusHtml = _badge('Pro aktiv', '#16a34a'); + actionsHtml = ` +
+ ${_upgradeBtn('settings-upgrade-breeder-btn','Züchter werden','49 €/Jahr','#C4843A')} +
`; + } else { + statusHtml = _badge('Kostenlos', '#888'); + actionsHtml = ` +
+ ${_upgradeBtn('settings-upgrade-pro-btn','Ban Yaro Pro','29 €/Jahr','#16a34a')} + ${_upgradeBtn('settings-upgrade-breeder-btn','Züchter','49 €/Jahr','#C4843A')} +
`; + } + + return ` +
+
Abo & Tarif
+
+
+ Aktueller Tarif: + ${statusHtml} +
+ ${actionsHtml} +
+
`; + } + + function _showUpgradeModal(tier) { + const isPro = tier === 'pro'; + const label = isPro ? 'Ban Yaro Pro' : 'Züchter'; + const price = isPro ? '29 €/Jahr' : '49 €/Jahr'; + const features = isPro + ? ['Mehrere Hunde verwalten', 'Ernährungsbereich mit KI-Berater', 'Erweiterte Karten-Layer', 'Alle künftigen Pro-Features'] + : ['Vollständige Züchter-Plattform', 'Warteliste, Läufigkeit & Trächtigkeit', 'Wurfverwaltung, Stammbaum, IK-Rechner', 'KI-Züchter-Assistent & Datenexport']; + + const featureList = features.map(f => + `
  • ✓ ${f}
  • ` + ).join(''); + + const subject = encodeURIComponent(`Upgrade auf ${label} — Ban Yaro`); + const body = encodeURIComponent( + `Hallo,\n\nich möchte meinen Account auf ${label} upgraden.\n\nMein Account: ${_appState.user?.email || ''}\n\nBitte schickt mir die Zahlungsinformationen.\n\nViele Grüße` + ); + const mailHref = `mailto:hallo@banyaro.app?subject=${subject}&body=${body}`; + + UI.modal.open({ + title: `${label} freischalten`, + body: ` +
    +
    +
    ${price}
    +
    + Einmaliger Jahresbeitrag
    Kündigung jederzeit möglich +
    +
    + +
    + Aktuell läuft die Freischaltung noch manuell. Schreib uns kurz eine E-Mail — + wir schalten deinen Account innerhalb von 24 Stunden frei und schicken + dir die Bankverbindung. +
    +
    `, + footer: ` + + + E-Mail senden + ` + }); + } + // ---------------------------------------------------------- // RENDER // ---------------------------------------------------------- @@ -276,13 +395,6 @@ window.Page_settings = (() => { Feedback geben - ${!_appState.user?.subscription_tier || _appState.user.subscription_tier === 'standard' || _appState.user.subscription_tier === 'standard_test' ? ` -
    - ⭐ Ban Yaro Pro kommt bald — mehr Features, mehrere Hunde. -
    - ` : ''}