Kundenansicht P5: Einrichtungs-Ticket mit Abrechnung, unlockedBy für alle Funktionen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-16 16:00:00 +00:00
1 parent b000dba698
commit 1d149f50b1
4 files changed
+126 -12

No files matched your search

+7 -4
View File
@@ -9,7 +9,7 @@ import { speichereZustimmung, zustimmungFuerSitzung } from './featureConsents.js
import { aboLage, laeuft } from './aboStatus.js'
import { berlinDateTime } from './berlinTime.js'
import { loeschTag } from './termine/frist.js'
import { createFeatureTicket } from './ticketAdmin.js'
import { ABRECHNUNGS_ZEILEN, createFeatureTicket } from './ticketAdmin.js'
export const FEATURE_KEYS = featureKeys()
/** Bezeichnung (name) und Verneinung im Satz "Für dieses Projekt gibt es noch {keine}" (keine) je Funktion; aus dem Register. */
@@ -144,8 +144,8 @@ export const unlockedByVon = (doc) => doc?.unlockedBy || (doc?.unlockedByPurchas
* bei News verspraeche das Datum eine Loeschung, die nie kommt) und fuer Oeffnungszeiten live, dort nur beim Abschaltgrund
* abo_ende (bei einer Abschaltung durch das Team gibt es keine Loeschfrist); es ist null, wenn disabledAt fehlt oder nicht lesbar ist.
* disabledReason und disabledAt gelten fuer jede Funktion.
* Funktionen mit aboInklusive (Oeffnungszeiten live) tragen zusaetzlich unlockedBy (kauf | abo | team, null solange die Funktion
* aus ist), aboEndeAt (Ende des Wartungs-Abos erkannt) und einbau (angestossen | manuell, Ergebnis des Neubaus).
* Jede Funktion traegt unlockedBy (kauf | abo | projekt | team, null solange die Funktion aus ist). Funktionen mit aboInklusive
* (Oeffnungszeiten live) tragen zusaetzlich aboEndeAt (Ende des Wartungs-Abos erkannt) und einbau (angestossen | manuell, Ergebnis des Neubaus).
* key: Funktionsschluessel (auch ohne Dokument); ohne Angabe der des Dokuments.
*/
export async function featureView(doc, key = doc?.featureKey) {
@@ -162,9 +162,10 @@ export async function featureView(doc, key = doc?.featureKey) {
disabledReason: abgeschaltet ? doc.disabledReason || null : null,
disabledAt: abgeschaltet ? doc.disabledAt || null : null,
loeschungAm: loeschtag ? loeschTag(doc.disabledAt) : null,
// unlockedBy (kauf | abo | projekt | team, null solange die Funktion aus ist) gilt fuer jede Funktion (V7); aboEndeAt und einbau nur mit aboInklusive
unlockedBy: doc && doc.state !== 'off' ? unlockedByVon(doc) : null,
...(mitAbo
? {
unlockedBy: doc && doc.state !== 'off' ? unlockedByVon(doc) : null,
aboEndeAt: doc?.aboEndeAt || null,
einbau: doc?.einbau || null,
}
@@ -454,6 +455,8 @@ async function legeTicketAn(doc, project, customer) {
featureKey: doc.featureKey,
siteKey: doc.siteKey,
...texte,
// Abo-Modell: die Abrechnung am Funktionsdokument (abo | projekt) kommt auch bei einem ersetzten Ticket wieder ans Ticket
...(Object.hasOwn(ABRECHNUNGS_ZEILEN, doc.einrichtungAbrechnung) ? { abrechnung: doc.einrichtungAbrechnung } : {}),
})
return ticketId
}