Team-API, Sidebar-Zaehler und Format-Hilfen fuer Gutschriften, Angebote und E-Mail-Speicher
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
813c6a7e18
commit
91d526e909
13 files changed
+487
-47
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { fmtDate } from './format'
|
||||
|
||||
// E-Mail-Speicher (Zusatzspeicher-Aufgaben in konsoleH): Texte wortgleich aus dem Admin-Panel (public/admin.js 908-982).
|
||||
|
||||
const GB_INCLUDED = 5
|
||||
const GB_PER_UNIT = 5
|
||||
const gbOfUnits = (units) => GB_INCLUDED + GB_PER_UNIT * (Number(units) || 0)
|
||||
|
||||
export function storageLabel(units) {
|
||||
const n = Number(units) || 0
|
||||
const packages = n === 0 ? 'kein Paket' : n === 1 ? '1 Paket' : `${n} Pakete`
|
||||
return `${packages} (${gbOfUnits(n)} GB)`
|
||||
}
|
||||
|
||||
export function summaryText({ allocatedGb, packageGb, warnGb, packageName }) {
|
||||
const warn = Number(allocatedGb) >= Number(warnGb)
|
||||
const head = `${allocatedGb} von ${packageGb} GB vergeben (Paket ${packageName})`
|
||||
return { warn, text: warn ? `${head} – Warnschwelle ${warnGb} GB erreicht: größeres Hetzner-Paket buchen.` : `${head} · Warnung ab ${warnGb} GB` }
|
||||
}
|
||||
|
||||
export const taskText = (t) => (t.kind === 'einrichten'
|
||||
? `Postfachgrenze in konsoleH jetzt auf ${t.targetGb} GB setzen`
|
||||
: `Postfachgrenze in konsoleH am ${fmtDate(t.dueAt)} auf ${t.targetGb} GB senken`)
|
||||
|
||||
export const scopeText = (t) =>
|
||||
`Gesamtspeicher des Kunden: ${t.targetGb} GB, auf seine Postfächer verteilt nach seiner Vorgabe – § 3 Abs. 4${t.contactDomain ? ` · Kontakt: ${t.contactDomain}` : ''}`
|
||||
|
||||
export const changeText = (t) => `${storageLabel(t.fromUnits)} → ${storageLabel(t.toUnits)}${t.viaCancellation ? ' · über die Kündigungsseite' : ''}`
|
||||
|
||||
export const partialText = (t) => (t.partial
|
||||
? `Teilweise: Stripe steht noch auf der bezahlten Menge, nicht auf ${t.toUnits} Paket(en) – Stückzahl in Stripe von Hand nachziehen.${t.error ? ` Fehler: ${t.error}` : ''}`
|
||||
: '')
|
||||
|
||||
export const orderedKind = (t) => (t.toUnits > t.fromUnits ? 'Bestellung (Plus)' : 'Verringerung (Minus)')
|
||||
|
||||
export const isOverdue = (t, now = Date.now()) => Boolean(t.dueAt && new Date(t.dueAt).getTime() <= now)
|
||||
|
||||
export const failedText = (f) =>
|
||||
`${storageLabel(f.fromUnits)} → ${storageLabel(f.toUnits)} – Stripe hat die Änderung abgelehnt, nichts berechnet, keine Aufgabe.${f.error ? ` Fehler: ${f.error}` : ''}`
|
||||
Reference in new issue
Block a user