Kundenansicht neu P7: Wechselseite schlank, Sofortbeginn-Häkchen nur privat
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6ecb5242c
commit
e7ac625f26
4 files changed
+270
-89
No files matched your search
@@ -72,11 +72,20 @@ export function baueBlock(zeilen, { id } = {}) {
|
||||
return h('dl', { id, class: 'kn-block' }, (zeilen || []).map((z) => h('div', { class: 'kn-block-zeile' }, h('dt', null, z.label), h('dd', { id: z.id }, z.text))))
|
||||
}
|
||||
|
||||
/** true, wenn die Antwort den Wortlaut trägt: status, knopf und die Linkzeile des Abos. Ohne ihn zeigt keine Seite einen Bestellknopf. */
|
||||
export function hatWortlaut(daten) {
|
||||
const nichtLeer = (x) => typeof x === 'string' && x !== ''
|
||||
|
||||
/**
|
||||
* true, wenn die Antwort den Wortlaut trägt: status, knopf und die Sätze der Seite (art 'abo' | 'wechsel' | 'speicher' | 'gutschrift').
|
||||
* Ohne ihn zeigt keine Seite einen Bestellknopf.
|
||||
*/
|
||||
export function hatWortlaut(daten, art = 'abo') {
|
||||
const t = daten?.bestelltexte
|
||||
return Boolean(t && typeof t === 'object' && typeof t.status === 'string' && t.status && typeof t.knopf === 'string' && t.knopf
|
||||
&& typeof t.abo?.linkzeile?.text === 'string' && t.abo.linkzeile.text)
|
||||
if (!t || typeof t !== 'object' || !nichtLeer(t.status) || !nichtLeer(t.knopf)) return false
|
||||
if (art === 'gutschrift') return nichtLeer(t.gutschrift?.satz?.text) && nichtLeer(t.gutschrift?.knopf)
|
||||
if (!nichtLeer(t[art]?.linkzeile?.text)) return false
|
||||
if (art === 'wechsel') return nichtLeer(t.wechsel.haken) && nichtLeer(t.wechsel.gesperrt)
|
||||
if (art === 'abo') return nichtLeer(t.abo.haken)
|
||||
return true
|
||||
}
|
||||
|
||||
export { K }
|
||||
Reference in new issue
Block a user