feat(konto): 'Abo verwalten'-Button (Stripe Portal) + past_due-Hinweis
- Abo verwalten → /billing/portal (Stripe Customer Portal) - bei past_due: roter Hinweis 'Zahlung fehlgeschlagen' Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -171,11 +171,14 @@
|
|||||||
h += '<div class="hosting-msg ok">Zahlung erfolgreich — Ihre Instanz wird bereitgestellt.</div>';
|
h += '<div class="hosting-msg ok">Zahlung erfolgreich — Ihre Instanz wird bereitgestellt.</div>';
|
||||||
|
|
||||||
if (subscription) {
|
if (subscription) {
|
||||||
|
const pastDue = subscription.status === "past_due";
|
||||||
|
if (pastDue) h += '<div class="hosting-msg err">Letzte Zahlung fehlgeschlagen — bitte Zahlungsmittel im Abo-Portal aktualisieren.</div>';
|
||||||
h += '<div class="hosting-row"><span class="muted">Abo</span><b>' +
|
h += '<div class="hosting-row"><span class="muted">Abo</span><b>' +
|
||||||
esc(subscription.plan) + " · " + esc(subscription.status) + "</b></div>";
|
esc(subscription.plan) + " · " + esc(subscription.status) + "</b></div>";
|
||||||
if (subscription.current_period_end)
|
if (subscription.current_period_end)
|
||||||
h += '<div class="hosting-row"><span class="muted">Nächste Verlängerung</span><span>' +
|
h += '<div class="hosting-row"><span class="muted">Nächste Verlängerung</span><span>' +
|
||||||
esc(new Date(subscription.current_period_end).toLocaleDateString("de-CH")) + "</span></div>";
|
esc(new Date(subscription.current_period_end).toLocaleDateString("de-CH")) + "</span></div>";
|
||||||
|
h += '<div style="margin-top:14px"><button class="hosting-btn hosting-btn-dark" id="managePlan" style="width:auto;padding:9px 18px">Abo verwalten</button></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instances && instances.length) {
|
if (instances && instances.length) {
|
||||||
@@ -235,6 +238,12 @@
|
|||||||
);
|
);
|
||||||
const add = root.querySelector("#addInstance");
|
const add = root.querySelector("#addInstance");
|
||||||
if (add) add.onclick = () => alert("Weitere Instanzen kommen bald. Kontaktieren Sie uns für ein Mehrfach-Abo.");
|
if (add) add.onclick = () => alert("Weitere Instanzen kommen bald. Kontaktieren Sie uns für ein Mehrfach-Abo.");
|
||||||
|
const manage = root.querySelector("#managePlan");
|
||||||
|
if (manage) manage.onclick = async () => {
|
||||||
|
manage.disabled = true;
|
||||||
|
try { const { url } = await api("POST", "/billing/portal"); go(url); }
|
||||||
|
catch (err) { alert(err.message); manage.disabled = false; }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (acctTab === "profile") {
|
if (acctTab === "profile") {
|
||||||
root.querySelector("#saveProfile").onclick = async (e) => {
|
root.querySelector("#saveProfile").onclick = async (e) => {
|
||||||
|
|||||||
@@ -171,11 +171,14 @@
|
|||||||
h += '<div class="hosting-msg ok">Zahlung erfolgreich — Ihre Instanz wird bereitgestellt.</div>';
|
h += '<div class="hosting-msg ok">Zahlung erfolgreich — Ihre Instanz wird bereitgestellt.</div>';
|
||||||
|
|
||||||
if (subscription) {
|
if (subscription) {
|
||||||
|
const pastDue = subscription.status === "past_due";
|
||||||
|
if (pastDue) h += '<div class="hosting-msg err">Letzte Zahlung fehlgeschlagen — bitte Zahlungsmittel im Abo-Portal aktualisieren.</div>';
|
||||||
h += '<div class="hosting-row"><span class="muted">Abo</span><b>' +
|
h += '<div class="hosting-row"><span class="muted">Abo</span><b>' +
|
||||||
esc(subscription.plan) + " · " + esc(subscription.status) + "</b></div>";
|
esc(subscription.plan) + " · " + esc(subscription.status) + "</b></div>";
|
||||||
if (subscription.current_period_end)
|
if (subscription.current_period_end)
|
||||||
h += '<div class="hosting-row"><span class="muted">Nächste Verlängerung</span><span>' +
|
h += '<div class="hosting-row"><span class="muted">Nächste Verlängerung</span><span>' +
|
||||||
esc(new Date(subscription.current_period_end).toLocaleDateString("de-CH")) + "</span></div>";
|
esc(new Date(subscription.current_period_end).toLocaleDateString("de-CH")) + "</span></div>";
|
||||||
|
h += '<div style="margin-top:14px"><button class="hosting-btn hosting-btn-dark" id="managePlan" style="width:auto;padding:9px 18px">Abo verwalten</button></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instances && instances.length) {
|
if (instances && instances.length) {
|
||||||
@@ -235,6 +238,12 @@
|
|||||||
);
|
);
|
||||||
const add = root.querySelector("#addInstance");
|
const add = root.querySelector("#addInstance");
|
||||||
if (add) add.onclick = () => alert("Weitere Instanzen kommen bald. Kontaktieren Sie uns für ein Mehrfach-Abo.");
|
if (add) add.onclick = () => alert("Weitere Instanzen kommen bald. Kontaktieren Sie uns für ein Mehrfach-Abo.");
|
||||||
|
const manage = root.querySelector("#managePlan");
|
||||||
|
if (manage) manage.onclick = async () => {
|
||||||
|
manage.disabled = true;
|
||||||
|
try { const { url } = await api("POST", "/billing/portal"); go(url); }
|
||||||
|
catch (err) { alert(err.message); manage.disabled = false; }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if (acctTab === "profile") {
|
if (acctTab === "profile") {
|
||||||
root.querySelector("#saveProfile").onclick = async (e) => {
|
root.querySelector("#saveProfile").onclick = async (e) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user