Abo-Bereich visuell auf Premium-Niveau gehoben
Plan-Karten: eigenes Icon je Stufe (🌱/🌿/👑), Rabatt als farbiger Chip statt reinem Fließtext, Prämien-Intervalle als eigene Chips (aus den admin- konfigurierten Werten berechnet), Preis mit Farbverlauf, sanft pulsierender Rahmen für die aktuell gebuchte Stufe. Abo-Status: Tabelle durch ein Stat-Kachel-Raster ersetzt (Icon + Label + Wert pro Kennzahl, Rabatt farblich hervorgehoben), echte Fortschrittsbalken statt Text für den Weg zum nächsten Teddy (Prozent aus dem admin-konfigurierten Intervall berechnet), "Bereits erhalten" als Badge-Chip, verfügbare Prämien als eigene, leicht glühende Karten statt schlichter Buttons. Benachrichtigungen: farbiger Icon-Kreis pro Ereignistyp (Erfolg/Prämie/ Warnung/Abbruch/Info) statt einheitlicher grauer Liste — auf einen Blick erkennbar, worum es bei jedem Eintrag geht. Alles in 4 Sprachen (DE/EN/CH/FR), neues i18n-Template aboRewardEveryLabel für die Prämien-Intervall-Chips. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
28ded7faae
commit
2c6d4dedae
@@ -257,6 +257,7 @@ export const ui = {
|
|||||||
aboAktivesLabel: "✓ Dein aktuelles Abo",
|
aboAktivesLabel: "✓ Dein aktuelles Abo",
|
||||||
aboWechselnBtn: "Zu diesem Abo wechseln",
|
aboWechselnBtn: "Zu diesem Abo wechseln",
|
||||||
aboNichtBuchbar: "Derzeit nicht buchbar",
|
aboNichtBuchbar: "Derzeit nicht buchbar",
|
||||||
|
aboRewardEveryLabel: "alle {n} Mon.",
|
||||||
aboStatusTitle: "Dein Abo-Status",
|
aboStatusTitle: "Dein Abo-Status",
|
||||||
aboFieldStufe: "Abo-Stufe", aboFieldPreis: "Monatlicher Preis", aboFieldRabatt: "Enthaltener Rabatt",
|
aboFieldStufe: "Abo-Stufe", aboFieldPreis: "Monatlicher Preis", aboFieldRabatt: "Enthaltener Rabatt",
|
||||||
aboFieldStart: "Startdatum", aboFieldNaechsteZahlung: "Nächste Zahlung", aboFieldLaufzeit: "Bisherige Laufzeit",
|
aboFieldStart: "Startdatum", aboFieldNaechsteZahlung: "Nächste Zahlung", aboFieldLaufzeit: "Bisherige Laufzeit",
|
||||||
@@ -558,6 +559,7 @@ export const ui = {
|
|||||||
aboAktivesLabel: "✓ Your current plan",
|
aboAktivesLabel: "✓ Your current plan",
|
||||||
aboWechselnBtn: "Switch to this plan",
|
aboWechselnBtn: "Switch to this plan",
|
||||||
aboNichtBuchbar: "Currently unavailable",
|
aboNichtBuchbar: "Currently unavailable",
|
||||||
|
aboRewardEveryLabel: "every {n} mo.",
|
||||||
aboStatusTitle: "Your subscription status",
|
aboStatusTitle: "Your subscription status",
|
||||||
aboFieldStufe: "Plan", aboFieldPreis: "Monthly price", aboFieldRabatt: "Included discount",
|
aboFieldStufe: "Plan", aboFieldPreis: "Monthly price", aboFieldRabatt: "Included discount",
|
||||||
aboFieldStart: "Start date", aboFieldNaechsteZahlung: "Next payment", aboFieldLaufzeit: "Duration so far",
|
aboFieldStart: "Start date", aboFieldNaechsteZahlung: "Next payment", aboFieldLaufzeit: "Duration so far",
|
||||||
@@ -859,6 +861,7 @@ export const ui = {
|
|||||||
aboAktivesLabel: "✓ Dis aktuells Abo",
|
aboAktivesLabel: "✓ Dis aktuells Abo",
|
||||||
aboWechselnBtn: "Zu dem Abo wechsle",
|
aboWechselnBtn: "Zu dem Abo wechsle",
|
||||||
aboNichtBuchbar: "Momentan nöd buechbar",
|
aboNichtBuchbar: "Momentan nöd buechbar",
|
||||||
|
aboRewardEveryLabel: "alli {n} Mt.",
|
||||||
aboStatusTitle: "Din Abo-Status",
|
aboStatusTitle: "Din Abo-Status",
|
||||||
aboFieldStufe: "Abo-Stufe", aboFieldPreis: "Monetliche Priis", aboFieldRabatt: "Enthaltene Rabatt",
|
aboFieldStufe: "Abo-Stufe", aboFieldPreis: "Monetliche Priis", aboFieldRabatt: "Enthaltene Rabatt",
|
||||||
aboFieldStart: "Startdatum", aboFieldNaechsteZahlung: "Nächschti Zahlig", aboFieldLaufzeit: "Bisherigi Laufziit",
|
aboFieldStart: "Startdatum", aboFieldNaechsteZahlung: "Nächschti Zahlig", aboFieldLaufzeit: "Bisherigi Laufziit",
|
||||||
@@ -1160,6 +1163,7 @@ export const ui = {
|
|||||||
aboAktivesLabel: "✓ Votre abonnement actuel",
|
aboAktivesLabel: "✓ Votre abonnement actuel",
|
||||||
aboWechselnBtn: "Passer à cet abonnement",
|
aboWechselnBtn: "Passer à cet abonnement",
|
||||||
aboNichtBuchbar: "Actuellement indisponible",
|
aboNichtBuchbar: "Actuellement indisponible",
|
||||||
|
aboRewardEveryLabel: "tous les {n} mois",
|
||||||
aboStatusTitle: "Statut de votre abonnement",
|
aboStatusTitle: "Statut de votre abonnement",
|
||||||
aboFieldStufe: "Formule", aboFieldPreis: "Prix mensuel", aboFieldRabatt: "Remise incluse",
|
aboFieldStufe: "Formule", aboFieldPreis: "Prix mensuel", aboFieldRabatt: "Remise incluse",
|
||||||
aboFieldStart: "Date de début", aboFieldNaechsteZahlung: "Prochain paiement", aboFieldLaufzeit: "Durée jusqu'ici",
|
aboFieldStart: "Date de début", aboFieldNaechsteZahlung: "Prochain paiement", aboFieldLaufzeit: "Durée jusqu'ici",
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ const aboPlanLabels: Record<AboStufe, { name: string; vorteil: string }> = {
|
|||||||
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
||||||
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
||||||
};
|
};
|
||||||
|
// Eigenes Icon je Stufe (rein optisch, nicht admin-editierbar) — soll auf einen Blick erkennbar
|
||||||
|
// machen, dass es sich um eine aufsteigende Reihe handelt (Keimling → Blatt → Krone).
|
||||||
|
const aboPlanIcon: Record<AboStufe, string> = { klein: "🌱", mittel: "🌿", gross: "👑" };
|
||||||
|
|
||||||
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
||||||
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
||||||
@@ -356,8 +359,18 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
return (
|
return (
|
||||||
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
||||||
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
||||||
|
<span class="abo-plan-icon" aria-hidden="true">{aboPlanIcon[stufe]}</span>
|
||||||
<h3>{labels.name}</h3>
|
<h3>{labels.name}</h3>
|
||||||
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
||||||
|
<span class="abo-plan-discount-chip">💰 −{cfg.rabattProzent}%</span>
|
||||||
|
<div class="abo-plan-rewards">
|
||||||
|
{cfg.kleinIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip">🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.kleinIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
{cfg.grossIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip abo-plan-reward-chip-gross">🧸🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.grossIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
||||||
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -369,28 +382,81 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
||||||
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
||||||
<table class="specs">
|
|
||||||
<tbody>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStufe}</th><td id="abo-field-stufe">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldPreis}</th><td id="abo-field-preis">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldRabatt}</th><td id="abo-field-rabatt">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStart}</th><td id="abo-field-start">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldNaechsteZahlung}</th><td id="abo-field-naechste">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldLaufzeit}</th><td id="abo-field-laufzeit">–</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p id="abo-fortschritt-klein" style="display:none;"></p>
|
<div class="abo-stat-grid">
|
||||||
<p id="abo-fortschritt-gross" style="display:none;"></p>
|
<div class="abo-stat-tile">
|
||||||
<p id="abo-praemien-erhalten"></p>
|
<span class="abo-stat-icon" aria-hidden="true">🎫</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStufe}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-stufe">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💶</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldPreis}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-preis">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile abo-stat-tile-highlight">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💰</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldRabatt}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-rabatt">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">📅</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStart}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-start">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">🔁</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldNaechsteZahlung}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-naechste">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">⏱️</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldLaufzeit}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-laufzeit">–</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-reward-progress-block">
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-klein-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸 {t.accountDash.aboEinloesenKleinLabel}</span>
|
||||||
|
<span id="abo-fortschritt-klein-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill" id="abo-fortschritt-klein-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-gross-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸🧸 {t.accountDash.aboEinloesenGrossLabel}</span>
|
||||||
|
<span id="abo-fortschritt-gross-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill abo-reward-bar-gross" id="abo-fortschritt-gross-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-erhalten-chip">
|
||||||
|
<span aria-hidden="true">🧸</span>
|
||||||
|
<span id="abo-praemien-erhalten"></span>
|
||||||
|
</div>
|
||||||
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
||||||
|
|
||||||
<div class="abo-praemien-block">
|
<div class="abo-praemien-block">
|
||||||
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
||||||
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
||||||
<div class="abo-praemien-row">
|
<div class="abo-praemien-row">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-klein" style="display:none;" data-einloesen="klein">🧸 {t.accountDash.aboEinloesenKleinLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<div class="abo-reward-ready" id="abo-einloesen-klein-wrap" style="display:none;">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-gross" style="display:none;" data-einloesen="gross">🧸 {t.accountDash.aboEinloesenGrossLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenKleinLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-klein" data-einloesen="klein">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-ready" id="abo-einloesen-gross-wrap" style="display:none;">
|
||||||
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenGrossLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-gross" data-einloesen="gross">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -506,6 +572,7 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
import { rechnungAlsPdfHerunterladen } from "../../../scripts/invoice-pdf";
|
import { rechnungAlsPdfHerunterladen } from "../../../scripts/invoice-pdf";
|
||||||
import { fuegeTeddyGratisHinzu } from "../../../scripts/cart";
|
import { fuegeTeddyGratisHinzu } from "../../../scripts/cart";
|
||||||
import { formatPrice } from "../../../i18n/format";
|
import { formatPrice } from "../../../i18n/format";
|
||||||
|
import { aboStufenKonfig } from "../../../data/abo";
|
||||||
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
||||||
|
|
||||||
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
||||||
@@ -595,6 +662,30 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
||||||
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
||||||
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
||||||
|
// Icon + Farbkategorie je Benachrichtigungs-Typ — rein optisch, keine Übersetzung nötig
|
||||||
|
// (die Schlüssel sind sprachneutrale Konstanten aus scripts/account.ts).
|
||||||
|
const NOTIF_ICON: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "🎉",
|
||||||
|
abo_gewechselt: "🔄",
|
||||||
|
abo_zahlung_erfolgreich: "✅",
|
||||||
|
abo_teddy_klein_frei: "🧸",
|
||||||
|
abo_teddy_gross_frei: "🧸",
|
||||||
|
abo_bald_praemie: "⏳",
|
||||||
|
abo_gekuendigt: "🚫",
|
||||||
|
abo_teddy_klein_eingeloest: "🎁",
|
||||||
|
abo_teddy_gross_eingeloest: "🎁",
|
||||||
|
};
|
||||||
|
const NOTIF_KATEGORIE: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "erfolg",
|
||||||
|
abo_gewechselt: "info",
|
||||||
|
abo_zahlung_erfolgreich: "erfolg",
|
||||||
|
abo_teddy_klein_frei: "praemie",
|
||||||
|
abo_teddy_gross_frei: "praemie",
|
||||||
|
abo_bald_praemie: "warnung",
|
||||||
|
abo_gekuendigt: "abbruch",
|
||||||
|
abo_teddy_klein_eingeloest: "praemie",
|
||||||
|
abo_teddy_gross_eingeloest: "praemie",
|
||||||
|
};
|
||||||
|
|
||||||
function renderAbo() {
|
function renderAbo() {
|
||||||
const a = getAccount();
|
const a = getAccount();
|
||||||
@@ -645,19 +736,28 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
||||||
}
|
}
|
||||||
|
|
||||||
const fortschrittKlein = document.getElementById("abo-fortschritt-klein");
|
// Echte Fortschrittsbalken statt reinem Text — Prozent ergibt sich aus dem admin-
|
||||||
if (fortschrittKlein) {
|
// konfigurierten Intervall (aboStufenKonfig) minus der noch fehlenden Monate.
|
||||||
if (status.naechsterKleinIn != null) {
|
const stufenKonfig = aboStufenKonfig(status.stufe);
|
||||||
fortschrittKlein.style.display = "block";
|
const fortschrittKleinWrap = document.getElementById("abo-fortschritt-klein-wrap");
|
||||||
fortschrittKlein.textContent = aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn));
|
if (fortschrittKleinWrap) {
|
||||||
} else fortschrittKlein.style.display = "none";
|
if (status.naechsterKleinIn != null && stufenKonfig.kleinIntervallMonate > 0) {
|
||||||
|
fortschrittKleinWrap.style.display = "block";
|
||||||
|
setText("abo-fortschritt-klein-text", aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn)));
|
||||||
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.kleinIntervallMonate - status.naechsterKleinIn) / stufenKonfig.kleinIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-klein-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittKleinWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
const fortschrittGross = document.getElementById("abo-fortschritt-gross");
|
const fortschrittGrossWrap = document.getElementById("abo-fortschritt-gross-wrap");
|
||||||
if (fortschrittGross) {
|
if (fortschrittGrossWrap) {
|
||||||
if (status.naechsterGrossIn != null) {
|
if (status.naechsterGrossIn != null && stufenKonfig.grossIntervallMonate > 0) {
|
||||||
fortschrittGross.style.display = "block";
|
fortschrittGrossWrap.style.display = "block";
|
||||||
fortschrittGross.textContent = aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn));
|
setText("abo-fortschritt-gross-text", aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn)));
|
||||||
} else fortschrittGross.style.display = "none";
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.grossIntervallMonate - status.naechsterGrossIn) / stufenKonfig.grossIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-gross-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittGrossWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
||||||
@@ -674,11 +774,11 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
|
|
||||||
const hasKlein = status.kleinVerfuegbar > 0;
|
const hasKlein = status.kleinVerfuegbar > 0;
|
||||||
const hasGross = status.grossVerfuegbar > 0;
|
const hasGross = status.grossVerfuegbar > 0;
|
||||||
const einloesenKlein = document.getElementById("abo-einloesen-klein") as HTMLElement | null;
|
const einloesenKleinWrap = document.getElementById("abo-einloesen-klein-wrap") as HTMLElement | null;
|
||||||
const einloesenGross = document.getElementById("abo-einloesen-gross") as HTMLElement | null;
|
const einloesenGrossWrap = document.getElementById("abo-einloesen-gross-wrap") as HTMLElement | null;
|
||||||
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
||||||
if (einloesenKlein) einloesenKlein.style.display = hasKlein ? "inline-flex" : "none";
|
if (einloesenKleinWrap) einloesenKleinWrap.style.display = hasKlein ? "flex" : "none";
|
||||||
if (einloesenGross) einloesenGross.style.display = hasGross ? "inline-flex" : "none";
|
if (einloesenGrossWrap) einloesenGrossWrap.style.display = hasGross ? "flex" : "none";
|
||||||
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
||||||
|
|
||||||
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
||||||
@@ -696,10 +796,14 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
} else {
|
} else {
|
||||||
a.benachrichtigungen.forEach((n) => {
|
a.benachrichtigungen.forEach((n) => {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
li.className = "small abo-notif-item" + (n.gelesen ? "" : " abo-notif-unread");
|
const kategorie = NOTIF_KATEGORIE[n.key] ?? "info";
|
||||||
|
li.className = `abo-notif-item abo-notif-${kategorie}` + (n.gelesen ? "" : " abo-notif-unread");
|
||||||
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
||||||
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
||||||
li.textContent = `${n.datum} — ${text}`;
|
li.innerHTML = `
|
||||||
|
<span class="abo-notif-icon" aria-hidden="true">${NOTIF_ICON[n.key] ?? "🔔"}</span>
|
||||||
|
<span class="abo-notif-body"><span class="abo-notif-text small">${text}</span><span class="abo-notif-date small">${n.datum}</span></span>
|
||||||
|
`;
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ const aboPlanLabels: Record<AboStufe, { name: string; vorteil: string }> = {
|
|||||||
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
||||||
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
||||||
};
|
};
|
||||||
|
// Eigenes Icon je Stufe (rein optisch, nicht admin-editierbar) — soll auf einen Blick erkennbar
|
||||||
|
// machen, dass es sich um eine aufsteigende Reihe handelt (Keimling → Blatt → Krone).
|
||||||
|
const aboPlanIcon: Record<AboStufe, string> = { klein: "🌱", mittel: "🌿", gross: "👑" };
|
||||||
|
|
||||||
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
||||||
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
||||||
@@ -356,8 +359,18 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
return (
|
return (
|
||||||
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
||||||
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
||||||
|
<span class="abo-plan-icon" aria-hidden="true">{aboPlanIcon[stufe]}</span>
|
||||||
<h3>{labels.name}</h3>
|
<h3>{labels.name}</h3>
|
||||||
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
||||||
|
<span class="abo-plan-discount-chip">💰 −{cfg.rabattProzent}%</span>
|
||||||
|
<div class="abo-plan-rewards">
|
||||||
|
{cfg.kleinIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip">🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.kleinIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
{cfg.grossIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip abo-plan-reward-chip-gross">🧸🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.grossIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
||||||
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -369,28 +382,81 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
||||||
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
||||||
<table class="specs">
|
|
||||||
<tbody>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStufe}</th><td id="abo-field-stufe">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldPreis}</th><td id="abo-field-preis">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldRabatt}</th><td id="abo-field-rabatt">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStart}</th><td id="abo-field-start">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldNaechsteZahlung}</th><td id="abo-field-naechste">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldLaufzeit}</th><td id="abo-field-laufzeit">–</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p id="abo-fortschritt-klein" style="display:none;"></p>
|
<div class="abo-stat-grid">
|
||||||
<p id="abo-fortschritt-gross" style="display:none;"></p>
|
<div class="abo-stat-tile">
|
||||||
<p id="abo-praemien-erhalten"></p>
|
<span class="abo-stat-icon" aria-hidden="true">🎫</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStufe}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-stufe">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💶</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldPreis}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-preis">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile abo-stat-tile-highlight">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💰</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldRabatt}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-rabatt">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">📅</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStart}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-start">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">🔁</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldNaechsteZahlung}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-naechste">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">⏱️</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldLaufzeit}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-laufzeit">–</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-reward-progress-block">
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-klein-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸 {t.accountDash.aboEinloesenKleinLabel}</span>
|
||||||
|
<span id="abo-fortschritt-klein-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill" id="abo-fortschritt-klein-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-gross-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸🧸 {t.accountDash.aboEinloesenGrossLabel}</span>
|
||||||
|
<span id="abo-fortschritt-gross-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill abo-reward-bar-gross" id="abo-fortschritt-gross-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-erhalten-chip">
|
||||||
|
<span aria-hidden="true">🧸</span>
|
||||||
|
<span id="abo-praemien-erhalten"></span>
|
||||||
|
</div>
|
||||||
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
||||||
|
|
||||||
<div class="abo-praemien-block">
|
<div class="abo-praemien-block">
|
||||||
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
||||||
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
||||||
<div class="abo-praemien-row">
|
<div class="abo-praemien-row">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-klein" style="display:none;" data-einloesen="klein">🧸 {t.accountDash.aboEinloesenKleinLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<div class="abo-reward-ready" id="abo-einloesen-klein-wrap" style="display:none;">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-gross" style="display:none;" data-einloesen="gross">🧸 {t.accountDash.aboEinloesenGrossLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenKleinLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-klein" data-einloesen="klein">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-ready" id="abo-einloesen-gross-wrap" style="display:none;">
|
||||||
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenGrossLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-gross" data-einloesen="gross">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -506,6 +572,7 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
import { rechnungAlsPdfHerunterladen } from "../../../scripts/invoice-pdf";
|
import { rechnungAlsPdfHerunterladen } from "../../../scripts/invoice-pdf";
|
||||||
import { fuegeTeddyGratisHinzu } from "../../../scripts/cart";
|
import { fuegeTeddyGratisHinzu } from "../../../scripts/cart";
|
||||||
import { formatPrice } from "../../../i18n/format";
|
import { formatPrice } from "../../../i18n/format";
|
||||||
|
import { aboStufenKonfig } from "../../../data/abo";
|
||||||
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
||||||
|
|
||||||
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
||||||
@@ -595,6 +662,30 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
||||||
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
||||||
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
||||||
|
// Icon + Farbkategorie je Benachrichtigungs-Typ — rein optisch, keine Übersetzung nötig
|
||||||
|
// (die Schlüssel sind sprachneutrale Konstanten aus scripts/account.ts).
|
||||||
|
const NOTIF_ICON: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "🎉",
|
||||||
|
abo_gewechselt: "🔄",
|
||||||
|
abo_zahlung_erfolgreich: "✅",
|
||||||
|
abo_teddy_klein_frei: "🧸",
|
||||||
|
abo_teddy_gross_frei: "🧸",
|
||||||
|
abo_bald_praemie: "⏳",
|
||||||
|
abo_gekuendigt: "🚫",
|
||||||
|
abo_teddy_klein_eingeloest: "🎁",
|
||||||
|
abo_teddy_gross_eingeloest: "🎁",
|
||||||
|
};
|
||||||
|
const NOTIF_KATEGORIE: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "erfolg",
|
||||||
|
abo_gewechselt: "info",
|
||||||
|
abo_zahlung_erfolgreich: "erfolg",
|
||||||
|
abo_teddy_klein_frei: "praemie",
|
||||||
|
abo_teddy_gross_frei: "praemie",
|
||||||
|
abo_bald_praemie: "warnung",
|
||||||
|
abo_gekuendigt: "abbruch",
|
||||||
|
abo_teddy_klein_eingeloest: "praemie",
|
||||||
|
abo_teddy_gross_eingeloest: "praemie",
|
||||||
|
};
|
||||||
|
|
||||||
function renderAbo() {
|
function renderAbo() {
|
||||||
const a = getAccount();
|
const a = getAccount();
|
||||||
@@ -645,19 +736,28 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
||||||
}
|
}
|
||||||
|
|
||||||
const fortschrittKlein = document.getElementById("abo-fortschritt-klein");
|
// Echte Fortschrittsbalken statt reinem Text — Prozent ergibt sich aus dem admin-
|
||||||
if (fortschrittKlein) {
|
// konfigurierten Intervall (aboStufenKonfig) minus der noch fehlenden Monate.
|
||||||
if (status.naechsterKleinIn != null) {
|
const stufenKonfig = aboStufenKonfig(status.stufe);
|
||||||
fortschrittKlein.style.display = "block";
|
const fortschrittKleinWrap = document.getElementById("abo-fortschritt-klein-wrap");
|
||||||
fortschrittKlein.textContent = aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn));
|
if (fortschrittKleinWrap) {
|
||||||
} else fortschrittKlein.style.display = "none";
|
if (status.naechsterKleinIn != null && stufenKonfig.kleinIntervallMonate > 0) {
|
||||||
|
fortschrittKleinWrap.style.display = "block";
|
||||||
|
setText("abo-fortschritt-klein-text", aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn)));
|
||||||
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.kleinIntervallMonate - status.naechsterKleinIn) / stufenKonfig.kleinIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-klein-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittKleinWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
const fortschrittGross = document.getElementById("abo-fortschritt-gross");
|
const fortschrittGrossWrap = document.getElementById("abo-fortschritt-gross-wrap");
|
||||||
if (fortschrittGross) {
|
if (fortschrittGrossWrap) {
|
||||||
if (status.naechsterGrossIn != null) {
|
if (status.naechsterGrossIn != null && stufenKonfig.grossIntervallMonate > 0) {
|
||||||
fortschrittGross.style.display = "block";
|
fortschrittGrossWrap.style.display = "block";
|
||||||
fortschrittGross.textContent = aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn));
|
setText("abo-fortschritt-gross-text", aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn)));
|
||||||
} else fortschrittGross.style.display = "none";
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.grossIntervallMonate - status.naechsterGrossIn) / stufenKonfig.grossIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-gross-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittGrossWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
||||||
@@ -674,11 +774,11 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
|
|
||||||
const hasKlein = status.kleinVerfuegbar > 0;
|
const hasKlein = status.kleinVerfuegbar > 0;
|
||||||
const hasGross = status.grossVerfuegbar > 0;
|
const hasGross = status.grossVerfuegbar > 0;
|
||||||
const einloesenKlein = document.getElementById("abo-einloesen-klein") as HTMLElement | null;
|
const einloesenKleinWrap = document.getElementById("abo-einloesen-klein-wrap") as HTMLElement | null;
|
||||||
const einloesenGross = document.getElementById("abo-einloesen-gross") as HTMLElement | null;
|
const einloesenGrossWrap = document.getElementById("abo-einloesen-gross-wrap") as HTMLElement | null;
|
||||||
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
||||||
if (einloesenKlein) einloesenKlein.style.display = hasKlein ? "inline-flex" : "none";
|
if (einloesenKleinWrap) einloesenKleinWrap.style.display = hasKlein ? "flex" : "none";
|
||||||
if (einloesenGross) einloesenGross.style.display = hasGross ? "inline-flex" : "none";
|
if (einloesenGrossWrap) einloesenGrossWrap.style.display = hasGross ? "flex" : "none";
|
||||||
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
||||||
|
|
||||||
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
||||||
@@ -696,10 +796,14 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
} else {
|
} else {
|
||||||
a.benachrichtigungen.forEach((n) => {
|
a.benachrichtigungen.forEach((n) => {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
li.className = "small abo-notif-item" + (n.gelesen ? "" : " abo-notif-unread");
|
const kategorie = NOTIF_KATEGORIE[n.key] ?? "info";
|
||||||
|
li.className = `abo-notif-item abo-notif-${kategorie}` + (n.gelesen ? "" : " abo-notif-unread");
|
||||||
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
||||||
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
||||||
li.textContent = `${n.datum} — ${text}`;
|
li.innerHTML = `
|
||||||
|
<span class="abo-notif-icon" aria-hidden="true">${NOTIF_ICON[n.key] ?? "🔔"}</span>
|
||||||
|
<span class="abo-notif-body"><span class="abo-notif-text small">${text}</span><span class="abo-notif-date small">${n.datum}</span></span>
|
||||||
|
`;
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ const aboPlanLabels: Record<AboStufe, { name: string; vorteil: string }> = {
|
|||||||
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
||||||
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
||||||
};
|
};
|
||||||
|
// Eigenes Icon je Stufe (rein optisch, nicht admin-editierbar) — soll auf einen Blick erkennbar
|
||||||
|
// machen, dass es sich um eine aufsteigende Reihe handelt (Keimling → Blatt → Krone).
|
||||||
|
const aboPlanIcon: Record<AboStufe, string> = { klein: "🌱", mittel: "🌿", gross: "👑" };
|
||||||
|
|
||||||
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
||||||
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
||||||
@@ -356,8 +359,18 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
return (
|
return (
|
||||||
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
||||||
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
||||||
|
<span class="abo-plan-icon" aria-hidden="true">{aboPlanIcon[stufe]}</span>
|
||||||
<h3>{labels.name}</h3>
|
<h3>{labels.name}</h3>
|
||||||
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
||||||
|
<span class="abo-plan-discount-chip">💰 −{cfg.rabattProzent}%</span>
|
||||||
|
<div class="abo-plan-rewards">
|
||||||
|
{cfg.kleinIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip">🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.kleinIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
{cfg.grossIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip abo-plan-reward-chip-gross">🧸🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.grossIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
||||||
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -369,28 +382,81 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
||||||
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
||||||
<table class="specs">
|
|
||||||
<tbody>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStufe}</th><td id="abo-field-stufe">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldPreis}</th><td id="abo-field-preis">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldRabatt}</th><td id="abo-field-rabatt">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStart}</th><td id="abo-field-start">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldNaechsteZahlung}</th><td id="abo-field-naechste">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldLaufzeit}</th><td id="abo-field-laufzeit">–</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p id="abo-fortschritt-klein" style="display:none;"></p>
|
<div class="abo-stat-grid">
|
||||||
<p id="abo-fortschritt-gross" style="display:none;"></p>
|
<div class="abo-stat-tile">
|
||||||
<p id="abo-praemien-erhalten"></p>
|
<span class="abo-stat-icon" aria-hidden="true">🎫</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStufe}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-stufe">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💶</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldPreis}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-preis">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile abo-stat-tile-highlight">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💰</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldRabatt}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-rabatt">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">📅</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStart}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-start">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">🔁</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldNaechsteZahlung}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-naechste">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">⏱️</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldLaufzeit}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-laufzeit">–</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-reward-progress-block">
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-klein-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸 {t.accountDash.aboEinloesenKleinLabel}</span>
|
||||||
|
<span id="abo-fortschritt-klein-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill" id="abo-fortschritt-klein-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-gross-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸🧸 {t.accountDash.aboEinloesenGrossLabel}</span>
|
||||||
|
<span id="abo-fortschritt-gross-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill abo-reward-bar-gross" id="abo-fortschritt-gross-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-erhalten-chip">
|
||||||
|
<span aria-hidden="true">🧸</span>
|
||||||
|
<span id="abo-praemien-erhalten"></span>
|
||||||
|
</div>
|
||||||
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
||||||
|
|
||||||
<div class="abo-praemien-block">
|
<div class="abo-praemien-block">
|
||||||
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
||||||
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
||||||
<div class="abo-praemien-row">
|
<div class="abo-praemien-row">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-klein" style="display:none;" data-einloesen="klein">🧸 {t.accountDash.aboEinloesenKleinLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<div class="abo-reward-ready" id="abo-einloesen-klein-wrap" style="display:none;">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-gross" style="display:none;" data-einloesen="gross">🧸 {t.accountDash.aboEinloesenGrossLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenKleinLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-klein" data-einloesen="klein">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-ready" id="abo-einloesen-gross-wrap" style="display:none;">
|
||||||
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenGrossLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-gross" data-einloesen="gross">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -506,6 +572,7 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
import { rechnungAlsPdfHerunterladen } from "../../../scripts/invoice-pdf";
|
import { rechnungAlsPdfHerunterladen } from "../../../scripts/invoice-pdf";
|
||||||
import { fuegeTeddyGratisHinzu } from "../../../scripts/cart";
|
import { fuegeTeddyGratisHinzu } from "../../../scripts/cart";
|
||||||
import { formatPrice } from "../../../i18n/format";
|
import { formatPrice } from "../../../i18n/format";
|
||||||
|
import { aboStufenKonfig } from "../../../data/abo";
|
||||||
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
||||||
|
|
||||||
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
||||||
@@ -595,6 +662,30 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
||||||
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
||||||
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
||||||
|
// Icon + Farbkategorie je Benachrichtigungs-Typ — rein optisch, keine Übersetzung nötig
|
||||||
|
// (die Schlüssel sind sprachneutrale Konstanten aus scripts/account.ts).
|
||||||
|
const NOTIF_ICON: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "🎉",
|
||||||
|
abo_gewechselt: "🔄",
|
||||||
|
abo_zahlung_erfolgreich: "✅",
|
||||||
|
abo_teddy_klein_frei: "🧸",
|
||||||
|
abo_teddy_gross_frei: "🧸",
|
||||||
|
abo_bald_praemie: "⏳",
|
||||||
|
abo_gekuendigt: "🚫",
|
||||||
|
abo_teddy_klein_eingeloest: "🎁",
|
||||||
|
abo_teddy_gross_eingeloest: "🎁",
|
||||||
|
};
|
||||||
|
const NOTIF_KATEGORIE: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "erfolg",
|
||||||
|
abo_gewechselt: "info",
|
||||||
|
abo_zahlung_erfolgreich: "erfolg",
|
||||||
|
abo_teddy_klein_frei: "praemie",
|
||||||
|
abo_teddy_gross_frei: "praemie",
|
||||||
|
abo_bald_praemie: "warnung",
|
||||||
|
abo_gekuendigt: "abbruch",
|
||||||
|
abo_teddy_klein_eingeloest: "praemie",
|
||||||
|
abo_teddy_gross_eingeloest: "praemie",
|
||||||
|
};
|
||||||
|
|
||||||
function renderAbo() {
|
function renderAbo() {
|
||||||
const a = getAccount();
|
const a = getAccount();
|
||||||
@@ -645,19 +736,28 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
||||||
}
|
}
|
||||||
|
|
||||||
const fortschrittKlein = document.getElementById("abo-fortschritt-klein");
|
// Echte Fortschrittsbalken statt reinem Text — Prozent ergibt sich aus dem admin-
|
||||||
if (fortschrittKlein) {
|
// konfigurierten Intervall (aboStufenKonfig) minus der noch fehlenden Monate.
|
||||||
if (status.naechsterKleinIn != null) {
|
const stufenKonfig = aboStufenKonfig(status.stufe);
|
||||||
fortschrittKlein.style.display = "block";
|
const fortschrittKleinWrap = document.getElementById("abo-fortschritt-klein-wrap");
|
||||||
fortschrittKlein.textContent = aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn));
|
if (fortschrittKleinWrap) {
|
||||||
} else fortschrittKlein.style.display = "none";
|
if (status.naechsterKleinIn != null && stufenKonfig.kleinIntervallMonate > 0) {
|
||||||
|
fortschrittKleinWrap.style.display = "block";
|
||||||
|
setText("abo-fortschritt-klein-text", aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn)));
|
||||||
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.kleinIntervallMonate - status.naechsterKleinIn) / stufenKonfig.kleinIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-klein-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittKleinWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
const fortschrittGross = document.getElementById("abo-fortschritt-gross");
|
const fortschrittGrossWrap = document.getElementById("abo-fortschritt-gross-wrap");
|
||||||
if (fortschrittGross) {
|
if (fortschrittGrossWrap) {
|
||||||
if (status.naechsterGrossIn != null) {
|
if (status.naechsterGrossIn != null && stufenKonfig.grossIntervallMonate > 0) {
|
||||||
fortschrittGross.style.display = "block";
|
fortschrittGrossWrap.style.display = "block";
|
||||||
fortschrittGross.textContent = aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn));
|
setText("abo-fortschritt-gross-text", aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn)));
|
||||||
} else fortschrittGross.style.display = "none";
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.grossIntervallMonate - status.naechsterGrossIn) / stufenKonfig.grossIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-gross-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittGrossWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
||||||
@@ -674,11 +774,11 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
|
|
||||||
const hasKlein = status.kleinVerfuegbar > 0;
|
const hasKlein = status.kleinVerfuegbar > 0;
|
||||||
const hasGross = status.grossVerfuegbar > 0;
|
const hasGross = status.grossVerfuegbar > 0;
|
||||||
const einloesenKlein = document.getElementById("abo-einloesen-klein") as HTMLElement | null;
|
const einloesenKleinWrap = document.getElementById("abo-einloesen-klein-wrap") as HTMLElement | null;
|
||||||
const einloesenGross = document.getElementById("abo-einloesen-gross") as HTMLElement | null;
|
const einloesenGrossWrap = document.getElementById("abo-einloesen-gross-wrap") as HTMLElement | null;
|
||||||
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
||||||
if (einloesenKlein) einloesenKlein.style.display = hasKlein ? "inline-flex" : "none";
|
if (einloesenKleinWrap) einloesenKleinWrap.style.display = hasKlein ? "flex" : "none";
|
||||||
if (einloesenGross) einloesenGross.style.display = hasGross ? "inline-flex" : "none";
|
if (einloesenGrossWrap) einloesenGrossWrap.style.display = hasGross ? "flex" : "none";
|
||||||
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
||||||
|
|
||||||
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
||||||
@@ -696,10 +796,14 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
} else {
|
} else {
|
||||||
a.benachrichtigungen.forEach((n) => {
|
a.benachrichtigungen.forEach((n) => {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
li.className = "small abo-notif-item" + (n.gelesen ? "" : " abo-notif-unread");
|
const kategorie = NOTIF_KATEGORIE[n.key] ?? "info";
|
||||||
|
li.className = `abo-notif-item abo-notif-${kategorie}` + (n.gelesen ? "" : " abo-notif-unread");
|
||||||
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
||||||
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
||||||
li.textContent = `${n.datum} — ${text}`;
|
li.innerHTML = `
|
||||||
|
<span class="abo-notif-icon" aria-hidden="true">${NOTIF_ICON[n.key] ?? "🔔"}</span>
|
||||||
|
<span class="abo-notif-body"><span class="abo-notif-text small">${text}</span><span class="abo-notif-date small">${n.datum}</span></span>
|
||||||
|
`;
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ const aboPlanLabels: Record<AboStufe, { name: string; vorteil: string }> = {
|
|||||||
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
mittel: { name: aboStufeName("mittel", lang), vorteil: aboStufeVorteil("mittel", lang) },
|
||||||
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
gross: { name: aboStufeName("gross", lang), vorteil: aboStufeVorteil("gross", lang) },
|
||||||
};
|
};
|
||||||
|
// Eigenes Icon je Stufe (rein optisch, nicht admin-editierbar) — soll auf einen Blick erkennbar
|
||||||
|
// machen, dass es sich um eine aufsteigende Reihe handelt (Keimling → Blatt → Krone).
|
||||||
|
const aboPlanIcon: Record<AboStufe, string> = { klein: "🌱", mittel: "🌿", gross: "👑" };
|
||||||
|
|
||||||
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
// "Zuletzt angesehen" zeigt in dieser Vorschau einfach die ersten echten Produkte aus dem Shop —
|
||||||
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
// in Phase 2 kommt hier die tatsächliche Verlaufs-Historie der angemeldeten Person hin.
|
||||||
@@ -360,8 +363,18 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
return (
|
return (
|
||||||
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
<div class={`card abo-plan-card abo-plan-${stufe}`} data-abo-plan={stufe} data-abo-plan-aktiv={cfg.aktiv ? "1" : "0"}>
|
||||||
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
<span class="abo-plan-badge" data-abo-active-badge style="display:none;">{t.accountDash.aboAktivesLabel}</span>
|
||||||
|
<span class="abo-plan-icon" aria-hidden="true">{aboPlanIcon[stufe]}</span>
|
||||||
<h3>{labels.name}</h3>
|
<h3>{labels.name}</h3>
|
||||||
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
<p class="abo-plan-price">{formatPrice(cfg.preis, lang)} <span class="small">{t.accountDash.aboPreisSuffix}</span></p>
|
||||||
|
<span class="abo-plan-discount-chip">💰 −{cfg.rabattProzent}%</span>
|
||||||
|
<div class="abo-plan-rewards">
|
||||||
|
{cfg.kleinIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip">🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.kleinIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
{cfg.grossIntervallMonate > 0 && (
|
||||||
|
<span class="abo-plan-reward-chip abo-plan-reward-chip-gross">🧸🧸 {t.accountDash.aboRewardEveryLabel.replace("{n}", String(cfg.grossIntervallMonate))}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
<p class="small abo-plan-vorteil">{labels.vorteil}</p>
|
||||||
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
<button type="button" class="btn btn-primary btn-sm abo-plan-btn" data-abo-choose={stufe}>{t.accountDash.aboAbschliessenBtn}</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -373,28 +386,81 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-1" aria-hidden="true">✨</span>
|
||||||
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
<span class="loyalty-card-sparkle loyalty-card-sparkle-2" aria-hidden="true">✨</span>
|
||||||
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
<h3>{t.accountDash.aboStatusTitle} <span class="badge" id="abo-active-badge"></span></h3>
|
||||||
<table class="specs">
|
|
||||||
<tbody>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStufe}</th><td id="abo-field-stufe">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldPreis}</th><td id="abo-field-preis">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldRabatt}</th><td id="abo-field-rabatt">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldStart}</th><td id="abo-field-start">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldNaechsteZahlung}</th><td id="abo-field-naechste">–</td></tr>
|
|
||||||
<tr><th>{t.accountDash.aboFieldLaufzeit}</th><td id="abo-field-laufzeit">–</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p id="abo-fortschritt-klein" style="display:none;"></p>
|
<div class="abo-stat-grid">
|
||||||
<p id="abo-fortschritt-gross" style="display:none;"></p>
|
<div class="abo-stat-tile">
|
||||||
<p id="abo-praemien-erhalten"></p>
|
<span class="abo-stat-icon" aria-hidden="true">🎫</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStufe}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-stufe">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💶</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldPreis}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-preis">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile abo-stat-tile-highlight">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">💰</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldRabatt}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-rabatt">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">📅</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldStart}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-start">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">🔁</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldNaechsteZahlung}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-naechste">–</span>
|
||||||
|
</div>
|
||||||
|
<div class="abo-stat-tile">
|
||||||
|
<span class="abo-stat-icon" aria-hidden="true">⏱️</span>
|
||||||
|
<span class="abo-stat-label">{t.accountDash.aboFieldLaufzeit}</span>
|
||||||
|
<span class="abo-stat-value" id="abo-field-laufzeit">–</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-reward-progress-block">
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-klein-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸 {t.accountDash.aboEinloesenKleinLabel}</span>
|
||||||
|
<span id="abo-fortschritt-klein-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill" id="abo-fortschritt-klein-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-progress" id="abo-fortschritt-gross-wrap" style="display:none;">
|
||||||
|
<div class="abo-reward-progress-head">
|
||||||
|
<span>🧸🧸 {t.accountDash.aboEinloesenGrossLabel}</span>
|
||||||
|
<span id="abo-fortschritt-gross-text"></span>
|
||||||
|
</div>
|
||||||
|
<div class="loyalty-progress-bar abo-reward-bar"><div class="loyalty-progress-fill abo-reward-bar-gross" id="abo-fortschritt-gross-fill"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="abo-erhalten-chip">
|
||||||
|
<span aria-hidden="true">🧸</span>
|
||||||
|
<span id="abo-praemien-erhalten"></span>
|
||||||
|
</div>
|
||||||
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
<p id="abo-gekuendigt-hinweis" class="small" style="display:none;"></p>
|
||||||
|
|
||||||
<div class="abo-praemien-block">
|
<div class="abo-praemien-block">
|
||||||
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
<h4>{t.accountDash.aboPraemienVerfuegbarTitle}</h4>
|
||||||
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
<p class="small" id="abo-keine-praemien">{t.accountDash.aboKeinePraemienVerfuegbar}</p>
|
||||||
<div class="abo-praemien-row">
|
<div class="abo-praemien-row">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-klein" style="display:none;" data-einloesen="klein">🧸 {t.accountDash.aboEinloesenKleinLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<div class="abo-reward-ready" id="abo-einloesen-klein-wrap" style="display:none;">
|
||||||
<button type="button" class="btn btn-outline btn-sm" id="abo-einloesen-gross" style="display:none;" data-einloesen="gross">🧸 {t.accountDash.aboEinloesenGrossLabel} — {t.accountDash.aboEinloesenBtn}</button>
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenKleinLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-klein" data-einloesen="klein">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="abo-reward-ready" id="abo-einloesen-gross-wrap" style="display:none;">
|
||||||
|
<span class="abo-reward-ready-icon" aria-hidden="true">🧸</span>
|
||||||
|
<div class="abo-reward-ready-body">
|
||||||
|
<strong>{t.accountDash.aboEinloesenGrossLabel}</strong>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="abo-einloesen-gross" data-einloesen="gross">{t.accountDash.aboEinloesenBtn}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
<p class="small" id="abo-eingeloest-hinweis" style="display:none; color: var(--c-accent);">{t.accountDash.aboEingeloestHinweis}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -514,6 +580,7 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
import { rechnungAlsPdfHerunterladen } from "../../scripts/invoice-pdf";
|
import { rechnungAlsPdfHerunterladen } from "../../scripts/invoice-pdf";
|
||||||
import { fuegeTeddyGratisHinzu } from "../../scripts/cart";
|
import { fuegeTeddyGratisHinzu } from "../../scripts/cart";
|
||||||
import { formatPrice } from "../../i18n/format";
|
import { formatPrice } from "../../i18n/format";
|
||||||
|
import { aboStufenKonfig } from "../../data/abo";
|
||||||
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
const { loginPath, fallbackName, greetingTemplate, reviewedBadgeText, invoiceLang, invoiceLabels, loyaltyProgressTemplate, loyaltyRemainingOne, loyaltyRemainingOther, loyaltyUnlockedTitle, loyaltyUnlockedText, aboLang, aboLabels } = (window as any).__accountDashVars;
|
||||||
|
|
||||||
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
// Zugriffsschutz: diese Seite ist nur für angemeldete Kund:innen gedacht. Es gibt noch kein
|
||||||
@@ -605,6 +672,30 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
// Abosystem: Pläne, Status, Fortschritt, Prämien und Benachrichtigungen live aus dem Konto
|
||||||
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
// rendern (Nav-Kachel + Planvergleich + Statuskarte + Benachrichtigungsliste).
|
||||||
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
const aboNameMap: Record<string, string> = { klein: aboLabels.nameKlein, mittel: aboLabels.nameMittel, gross: aboLabels.nameGross };
|
||||||
|
// Icon + Farbkategorie je Benachrichtigungs-Typ — rein optisch, keine Übersetzung nötig
|
||||||
|
// (die Schlüssel sind sprachneutrale Konstanten aus scripts/account.ts).
|
||||||
|
const NOTIF_ICON: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "🎉",
|
||||||
|
abo_gewechselt: "🔄",
|
||||||
|
abo_zahlung_erfolgreich: "✅",
|
||||||
|
abo_teddy_klein_frei: "🧸",
|
||||||
|
abo_teddy_gross_frei: "🧸",
|
||||||
|
abo_bald_praemie: "⏳",
|
||||||
|
abo_gekuendigt: "🚫",
|
||||||
|
abo_teddy_klein_eingeloest: "🎁",
|
||||||
|
abo_teddy_gross_eingeloest: "🎁",
|
||||||
|
};
|
||||||
|
const NOTIF_KATEGORIE: Record<string, string> = {
|
||||||
|
abo_abgeschlossen: "erfolg",
|
||||||
|
abo_gewechselt: "info",
|
||||||
|
abo_zahlung_erfolgreich: "erfolg",
|
||||||
|
abo_teddy_klein_frei: "praemie",
|
||||||
|
abo_teddy_gross_frei: "praemie",
|
||||||
|
abo_bald_praemie: "warnung",
|
||||||
|
abo_gekuendigt: "abbruch",
|
||||||
|
abo_teddy_klein_eingeloest: "praemie",
|
||||||
|
abo_teddy_gross_eingeloest: "praemie",
|
||||||
|
};
|
||||||
|
|
||||||
function renderAbo() {
|
function renderAbo() {
|
||||||
const a = getAccount();
|
const a = getAccount();
|
||||||
@@ -655,19 +746,28 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
activeBadge.className = "badge " + (status.aktiv ? "abo-badge-active" : "abo-badge-inactive");
|
||||||
}
|
}
|
||||||
|
|
||||||
const fortschrittKlein = document.getElementById("abo-fortschritt-klein");
|
// Echte Fortschrittsbalken statt reinem Text — Prozent ergibt sich aus dem admin-
|
||||||
if (fortschrittKlein) {
|
// konfigurierten Intervall (aboStufenKonfig) minus der noch fehlenden Monate.
|
||||||
if (status.naechsterKleinIn != null) {
|
const stufenKonfig = aboStufenKonfig(status.stufe);
|
||||||
fortschrittKlein.style.display = "block";
|
const fortschrittKleinWrap = document.getElementById("abo-fortschritt-klein-wrap");
|
||||||
fortschrittKlein.textContent = aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn));
|
if (fortschrittKleinWrap) {
|
||||||
} else fortschrittKlein.style.display = "none";
|
if (status.naechsterKleinIn != null && stufenKonfig.kleinIntervallMonate > 0) {
|
||||||
|
fortschrittKleinWrap.style.display = "block";
|
||||||
|
setText("abo-fortschritt-klein-text", aboLabels.fortschrittKleinTemplate.replace("{n}", String(status.naechsterKleinIn)));
|
||||||
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.kleinIntervallMonate - status.naechsterKleinIn) / stufenKonfig.kleinIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-klein-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittKleinWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
const fortschrittGross = document.getElementById("abo-fortschritt-gross");
|
const fortschrittGrossWrap = document.getElementById("abo-fortschritt-gross-wrap");
|
||||||
if (fortschrittGross) {
|
if (fortschrittGrossWrap) {
|
||||||
if (status.naechsterGrossIn != null) {
|
if (status.naechsterGrossIn != null && stufenKonfig.grossIntervallMonate > 0) {
|
||||||
fortschrittGross.style.display = "block";
|
fortschrittGrossWrap.style.display = "block";
|
||||||
fortschrittGross.textContent = aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn));
|
setText("abo-fortschritt-gross-text", aboLabels.fortschrittGrossTemplate.replace("{n}", String(status.naechsterGrossIn)));
|
||||||
} else fortschrittGross.style.display = "none";
|
const pct = Math.min(100, Math.max(0, ((stufenKonfig.grossIntervallMonate - status.naechsterGrossIn) / stufenKonfig.grossIntervallMonate) * 100));
|
||||||
|
const fill = document.getElementById("abo-fortschritt-gross-fill") as HTMLElement | null;
|
||||||
|
if (fill) fill.style.width = `${pct}%`;
|
||||||
|
} else fortschrittGrossWrap.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
setText("abo-praemien-erhalten", aboLabels.praemienErhaltenTemplate
|
||||||
@@ -684,11 +784,11 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
|
|
||||||
const hasKlein = status.kleinVerfuegbar > 0;
|
const hasKlein = status.kleinVerfuegbar > 0;
|
||||||
const hasGross = status.grossVerfuegbar > 0;
|
const hasGross = status.grossVerfuegbar > 0;
|
||||||
const einloesenKlein = document.getElementById("abo-einloesen-klein") as HTMLElement | null;
|
const einloesenKleinWrap = document.getElementById("abo-einloesen-klein-wrap") as HTMLElement | null;
|
||||||
const einloesenGross = document.getElementById("abo-einloesen-gross") as HTMLElement | null;
|
const einloesenGrossWrap = document.getElementById("abo-einloesen-gross-wrap") as HTMLElement | null;
|
||||||
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
const keinePraemien = document.getElementById("abo-keine-praemien") as HTMLElement | null;
|
||||||
if (einloesenKlein) einloesenKlein.style.display = hasKlein ? "inline-flex" : "none";
|
if (einloesenKleinWrap) einloesenKleinWrap.style.display = hasKlein ? "flex" : "none";
|
||||||
if (einloesenGross) einloesenGross.style.display = hasGross ? "inline-flex" : "none";
|
if (einloesenGrossWrap) einloesenGrossWrap.style.display = hasGross ? "flex" : "none";
|
||||||
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
if (keinePraemien) keinePraemien.style.display = hasKlein || hasGross ? "none" : "block";
|
||||||
|
|
||||||
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
const kuendigenBtn = document.getElementById("abo-kuendigen-btn") as HTMLElement | null;
|
||||||
@@ -706,10 +806,14 @@ const angekommeneBestellungen = beispielBestellungen.filter((b) => b.status ===
|
|||||||
} else {
|
} else {
|
||||||
a.benachrichtigungen.forEach((n) => {
|
a.benachrichtigungen.forEach((n) => {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
li.className = "small abo-notif-item" + (n.gelesen ? "" : " abo-notif-unread");
|
const kategorie = NOTIF_KATEGORIE[n.key] ?? "info";
|
||||||
|
li.className = `abo-notif-item abo-notif-${kategorie}` + (n.gelesen ? "" : " abo-notif-unread");
|
||||||
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
let text = aboLabels.notifKeyLabels[n.key] ?? n.key;
|
||||||
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
if (n.stufe) text = text.replace("{stufe}", aboNameMap[n.stufe] ?? n.stufe);
|
||||||
li.textContent = `${n.datum} — ${text}`;
|
li.innerHTML = `
|
||||||
|
<span class="abo-notif-icon" aria-hidden="true">${NOTIF_ICON[n.key] ?? "🔔"}</span>
|
||||||
|
<span class="abo-notif-body"><span class="abo-notif-text small">${text}</span><span class="abo-notif-date small">${n.datum}</span></span>
|
||||||
|
`;
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+143
-12
@@ -2458,24 +2458,67 @@ a:focus-visible, button:focus-visible {
|
|||||||
}
|
}
|
||||||
@media (prefers-reduced-motion: reduce) { .btn-daten-hero, .btn-daten-hero::after, .btn-daten-hero-sparkle { animation: none; } }
|
@media (prefers-reduced-motion: reduce) { .btn-daten-hero, .btn-daten-hero::after, .btn-daten-hero-sparkle { animation: none; } }
|
||||||
|
|
||||||
/* Abosystem: drei Planvergleichs-Karten + Statuskarte + Benachrichtigungsliste. */
|
/* Abosystem: drei Planvergleichs-Karten + Statuskarte + Benachrichtigungsliste. Soll insgesamt
|
||||||
|
deutlich "wertiger" aussehen als ein normaler Formular-/Tabellenbereich — durchgehend mit
|
||||||
|
Icons, Farbverläufen, echten Fortschrittsbalken statt reinem Text und leicht animierten
|
||||||
|
Akzenten, damit sich das Abo auf den ersten Blick nach einem Premium-Feature anfühlt. */
|
||||||
.abo-plans { margin: 1.4rem 0 1.6rem; }
|
.abo-plans { margin: 1.4rem 0 1.6rem; }
|
||||||
.abo-plan-card {
|
.abo-plan-card {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.6rem;
|
gap: 0.5rem;
|
||||||
border: 1.5px solid rgba(244, 241, 247, 0.14);
|
border: 1.5px solid rgba(244, 241, 247, 0.14);
|
||||||
transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
|
transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
|
||||||
}
|
}
|
||||||
.abo-plan-card:hover { transform: translateY(-3px); }
|
.abo-plan-card::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--plan-color, var(--c-accent)) 16%, transparent), transparent 70%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.abo-plan-card > * { position: relative; z-index: 1; }
|
||||||
|
.abo-plan-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -20px color-mix(in srgb, var(--plan-color, var(--c-accent)) 55%, transparent); }
|
||||||
.abo-plan-klein { --plan-color: #6ecb8f; }
|
.abo-plan-klein { --plan-color: #6ecb8f; }
|
||||||
.abo-plan-mittel { --plan-color: var(--c-accent); }
|
.abo-plan-mittel { --plan-color: var(--c-accent); }
|
||||||
.abo-plan-gross { --plan-color: #e3b23c; }
|
.abo-plan-gross { --plan-color: #e3b23c; }
|
||||||
.abo-plan-card h3 { margin: 0.2rem 0 0; color: var(--plan-color, var(--c-accent)); }
|
.abo-plan-icon { font-size: 2.1rem; line-height: 1; filter: drop-shadow(0 2px 8px color-mix(in srgb, var(--plan-color, var(--c-accent)) 60%, transparent)); }
|
||||||
.abo-plan-price { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; margin: 0; }
|
.abo-plan-card h3 { margin: 0; color: var(--plan-color, var(--c-accent)); }
|
||||||
|
.abo-plan-price { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; margin: 0; background-image: linear-gradient(120deg, var(--c-text), var(--plan-color, var(--c-accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
||||||
|
.abo-plan-price .small { -webkit-text-fill-color: var(--c-text-muted); color: var(--c-text-muted); }
|
||||||
|
.abo-plan-discount-chip {
|
||||||
|
align-self: flex-start;
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
padding: 0.25rem 0.75rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: color-mix(in srgb, var(--plan-color, var(--c-accent)) 26%, transparent);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--plan-color, var(--c-accent)) 50%, transparent);
|
||||||
|
color: var(--plan-color, var(--c-accent));
|
||||||
|
}
|
||||||
|
.abo-plan-rewards { display: flex; gap: 0.4rem; flex-wrap: wrap; }
|
||||||
|
.abo-plan-reward-chip {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 0.2rem 0.6rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(244, 241, 247, 0.06);
|
||||||
|
border: 1px solid rgba(244, 241, 247, 0.16);
|
||||||
|
color: var(--c-text-muted);
|
||||||
|
}
|
||||||
|
.abo-plan-reward-chip-gross { background: color-mix(in srgb, #e3b23c 16%, transparent); border-color: color-mix(in srgb, #e3b23c 40%, transparent); color: #f6dda0; }
|
||||||
.abo-plan-vorteil { margin: 0; color: var(--c-text-muted); flex-grow: 1; }
|
.abo-plan-vorteil { margin: 0; color: var(--c-text-muted); flex-grow: 1; }
|
||||||
.abo-plan-card.is-current-plan { border-color: var(--plan-color, var(--c-accent)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--plan-color, var(--c-accent)) 50%, transparent), 0 0 20px -8px color-mix(in srgb, var(--plan-color, var(--c-accent)) 60%, transparent); }
|
.abo-plan-card.is-current-plan {
|
||||||
|
border-color: var(--plan-color, var(--c-accent));
|
||||||
|
box-shadow: 0 0 0 1px color-mix(in srgb, var(--plan-color, var(--c-accent)) 55%, transparent), 0 0 28px -10px color-mix(in srgb, var(--plan-color, var(--c-accent)) 70%, transparent);
|
||||||
|
animation: abo-plan-current-glow 3.2s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
@keyframes abo-plan-current-glow {
|
||||||
|
0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--plan-color, var(--c-accent)) 55%, transparent), 0 0 20px -10px color-mix(in srgb, var(--plan-color, var(--c-accent)) 65%, transparent); }
|
||||||
|
50% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--plan-color, var(--c-accent)) 70%, transparent), 0 0 32px -8px color-mix(in srgb, var(--plan-color, var(--c-accent)) 80%, transparent); }
|
||||||
|
}
|
||||||
.abo-plan-badge { align-self: flex-start; background: color-mix(in srgb, var(--plan-color, var(--c-accent)) 30%, transparent); border: 1px solid color-mix(in srgb, var(--plan-color, var(--c-accent)) 55%, transparent); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.78rem; font-weight: 700; }
|
.abo-plan-badge { align-self: flex-start; background: color-mix(in srgb, var(--plan-color, var(--c-accent)) 30%, transparent); border: 1px solid color-mix(in srgb, var(--plan-color, var(--c-accent)) 55%, transparent); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.78rem; font-weight: 700; }
|
||||||
.abo-plan-btn { align-self: flex-start; }
|
.abo-plan-btn { align-self: flex-start; }
|
||||||
.abo-plan-btn:disabled { opacity: 0.6; cursor: default; }
|
.abo-plan-btn:disabled { opacity: 0.6; cursor: default; }
|
||||||
@@ -2485,13 +2528,101 @@ a:focus-visible, button:focus-visible {
|
|||||||
.abo-status-card h3 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
|
.abo-status-card h3 { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
|
||||||
.abo-badge-active { background: rgba(126, 200, 160, 0.28); border-color: rgba(126, 200, 160, 0.5); color: #cfeee0; }
|
.abo-badge-active { background: rgba(126, 200, 160, 0.28); border-color: rgba(126, 200, 160, 0.5); color: #cfeee0; }
|
||||||
.abo-badge-inactive { background: color-mix(in srgb, var(--c-sale) 30%, transparent); border-color: color-mix(in srgb, var(--c-sale) 55%, transparent); }
|
.abo-badge-inactive { background: color-mix(in srgb, var(--c-sale) 30%, transparent); border-color: color-mix(in srgb, var(--c-sale) 55%, transparent); }
|
||||||
|
|
||||||
|
/* Stat-Kacheln statt trockener Tabelle — jede Kennzahl bekommt ein eigenes Icon und mehr
|
||||||
|
optisches Gewicht, der Rabatt (der eigentliche "Wow"-Wert des Abos) sticht farblich heraus. */
|
||||||
|
.abo-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem; margin: 0.2rem 0 1.1rem; }
|
||||||
|
.abo-stat-tile {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.15rem;
|
||||||
|
padding: 0.8rem 0.9rem;
|
||||||
|
border-radius: var(--radius-m);
|
||||||
|
background: rgba(244, 241, 247, 0.045);
|
||||||
|
border: 1px solid rgba(244, 241, 247, 0.1);
|
||||||
|
}
|
||||||
|
.abo-stat-tile-highlight { background: color-mix(in srgb, #e3b23c 12%, transparent); border-color: color-mix(in srgb, #e3b23c 38%, transparent); }
|
||||||
|
.abo-stat-icon { font-size: 1.3rem; }
|
||||||
|
.abo-stat-label { font-size: 0.76rem; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
|
||||||
|
.abo-stat-value { font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; }
|
||||||
|
.abo-stat-tile-highlight .abo-stat-value { color: #e3b23c; }
|
||||||
|
|
||||||
|
/* Echte Fortschrittsbalken (wiederverwendet dieselbe Optik wie der Treuebonus-Balken) für den
|
||||||
|
Weg zum nächsten Teddy — deutlich greifbarer als reiner Fließtext. */
|
||||||
|
.abo-reward-progress-block { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 0.4rem; }
|
||||||
|
.abo-reward-progress-head { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.88rem; font-weight: 600; }
|
||||||
|
.abo-reward-bar-gross { background: linear-gradient(90deg, #e3b23c, #f6dda0); }
|
||||||
|
|
||||||
|
.abo-erhalten-chip {
|
||||||
|
align-self: flex-start;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.4rem 0.9rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(126, 200, 160, 0.14);
|
||||||
|
border: 1px solid rgba(126, 200, 160, 0.35);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
.abo-praemien-block { border-top: 1px dashed rgba(244, 241, 247, 0.14); padding-top: 0.9rem; margin-top: 0.3rem; }
|
.abo-praemien-block { border-top: 1px dashed rgba(244, 241, 247, 0.14); padding-top: 0.9rem; margin-top: 0.3rem; }
|
||||||
.abo-praemien-block h4 { margin: 0 0 0.4rem; }
|
.abo-praemien-block h4 { margin: 0 0 0.4rem; }
|
||||||
.abo-praemien-row { display: flex; gap: 0.7rem; flex-wrap: wrap; }
|
.abo-praemien-row { display: flex; gap: 0.9rem; flex-wrap: wrap; }
|
||||||
|
|
||||||
|
/* Verfügbare Prämie: eigene, leicht pulsierende Karte statt eines schlichten Buttons — soll
|
||||||
|
klar als "hier wartet etwas Kostenloses auf dich" auffallen. */
|
||||||
|
.abo-reward-ready {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.8rem;
|
||||||
|
padding: 0.7rem 1rem;
|
||||||
|
border-radius: var(--radius-l);
|
||||||
|
background: linear-gradient(155deg, color-mix(in srgb, #e3b23c 16%, var(--c-anthracite-light)), var(--c-anthracite));
|
||||||
|
border: 1.5px solid color-mix(in srgb, #e3b23c 45%, transparent);
|
||||||
|
animation: abo-reward-ready-glow 2.6s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
@keyframes abo-reward-ready-glow {
|
||||||
|
0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, #e3b23c 35%, transparent), 0 0 14px -6px color-mix(in srgb, #e3b23c 55%, transparent); }
|
||||||
|
50% { box-shadow: 0 0 0 1px color-mix(in srgb, #e3b23c 55%, transparent), 0 0 22px -4px color-mix(in srgb, #e3b23c 75%, transparent); }
|
||||||
|
}
|
||||||
|
.abo-reward-ready-icon { font-size: 1.8rem; }
|
||||||
|
.abo-reward-ready-body { display: flex; flex-direction: column; gap: 0.4rem; }
|
||||||
|
.abo-reward-ready-body strong { font-size: 0.92rem; }
|
||||||
|
|
||||||
.abo-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.6rem; }
|
.abo-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.6rem; }
|
||||||
.abo-cancel-btn { border-color: color-mix(in srgb, var(--c-sale) 55%, transparent); color: var(--c-sale); }
|
.abo-cancel-btn { border-color: color-mix(in srgb, var(--c-sale) 55%, transparent); color: var(--c-sale); }
|
||||||
|
|
||||||
.abo-notif-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; max-height: 260px; overflow-y: auto; }
|
/* Benachrichtigungen als kleine Timeline: farbiger Icon-Kreis je Ereignistyp statt einer
|
||||||
.abo-notif-item { padding: 0.5rem 0.7rem; border-radius: var(--radius-m); background: rgba(244, 241, 247, 0.05); border-left: 3px solid transparent; }
|
einheitlichen grauen Liste. */
|
||||||
.abo-notif-item.abo-notif-unread { border-left-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 10%, transparent); }
|
.abo-notif-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; max-height: 320px; overflow-y: auto; }
|
||||||
@media (prefers-reduced-motion: reduce) { .abo-plan-card { transition: none; } }
|
.abo-notif-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.7rem;
|
||||||
|
padding: 0.55rem 0.8rem;
|
||||||
|
border-radius: var(--radius-m);
|
||||||
|
background: rgba(244, 241, 247, 0.05);
|
||||||
|
border-left: 3px solid transparent;
|
||||||
|
--notif-color: var(--c-text-muted);
|
||||||
|
}
|
||||||
|
.abo-notif-item.abo-notif-unread { border-left-color: var(--notif-color); background: color-mix(in srgb, var(--notif-color) 10%, transparent); }
|
||||||
|
.abo-notif-item.abo-notif-erfolg { --notif-color: #7ec8a0; }
|
||||||
|
.abo-notif-item.abo-notif-praemie { --notif-color: #e3b23c; }
|
||||||
|
.abo-notif-item.abo-notif-warnung { --notif-color: var(--c-sale); }
|
||||||
|
.abo-notif-item.abo-notif-abbruch { --notif-color: #e07a9c; }
|
||||||
|
.abo-notif-item.abo-notif-info { --notif-color: var(--c-accent); }
|
||||||
|
.abo-notif-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
background: color-mix(in srgb, var(--notif-color) 22%, transparent);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--notif-color) 45%, transparent);
|
||||||
|
}
|
||||||
|
.abo-notif-body { display: flex; flex-direction: column; gap: 0.15rem; }
|
||||||
|
.abo-notif-date { color: var(--c-text-muted); }
|
||||||
|
@media (prefers-reduced-motion: reduce) { .abo-plan-card, .abo-plan-card.is-current-plan, .abo-reward-ready { animation: none; transition: none; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user