Terminplaner: Warnung im Dialog, wenn K16 mit den Unterlagen nicht rausging
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
72eedeb59c
commit
878a530bd7
3 files changed
+20
-4
No files matched your search
@@ -6,7 +6,7 @@ import { copyText } from '../CopyableCredential'
|
|||||||
import { getFunktionen, setFeature, getTermineAnleitung } from '../../lib/teamApi'
|
import { getFunktionen, setFeature, getTermineAnleitung } from '../../lib/teamApi'
|
||||||
import {
|
import {
|
||||||
FUNKTIONEN, ZUSTAND, AKTION_LABEL, funktionOf, aktionen, mergeFunktion, siteKeyOf, abgeschaltetText,
|
FUNKTIONEN, ZUSTAND, AKTION_LABEL, funktionOf, aktionen, mergeFunktion, siteKeyOf, abgeschaltetText,
|
||||||
hindernisText, panelModell, anleitungOffen, textformNoetig, textformAnsicht, textformBereit,
|
hindernisText, panelModell, anleitungOffen, textformNoetig, textformAnsicht, textformBereit, speicherStatus,
|
||||||
} from '../../lib/funktionenView'
|
} from '../../lib/funktionenView'
|
||||||
import { CHANNELS, channelLabel } from '../../lib/analyseView'
|
import { CHANNELS, channelLabel } from '../../lib/analyseView'
|
||||||
import { berlinYmd } from '../../lib/format'
|
import { berlinYmd } from '../../lib/format'
|
||||||
@@ -186,17 +186,17 @@ export default function CustomerFunktionen({ customerId }) {
|
|||||||
setStatus(null)
|
setStatus(null)
|
||||||
try {
|
try {
|
||||||
const mitTextform = textformNoetig(key, action, termine)
|
const mitTextform = textformNoetig(key, action, termine)
|
||||||
const { projects: changed } = await setFeature(customerId, key, {
|
const antwort = await setFeature(customerId, key, {
|
||||||
projectId, action, note: note.trim(),
|
projectId, action, note: note.trim(),
|
||||||
...(mitTextform ? { textformDate: textform.date, textformChannel: textform.channel } : {}),
|
...(mitTextform ? { textformDate: textform.date, textformChannel: textform.channel } : {}),
|
||||||
})
|
})
|
||||||
// Die Antwort enthaelt das ganze Projekt; uebernommen wird nur die geaenderte Funktion
|
// Die Antwort enthaelt das ganze Projekt; uebernommen wird nur die geaenderte Funktion
|
||||||
const updated = changed?.[0]
|
const updated = antwort?.projects?.[0]
|
||||||
if (updated) setProjects((list) => mergeFunktion(list, updated.projectId, key, updated))
|
if (updated) setProjects((list) => mergeFunktion(list, updated.projectId, key, updated))
|
||||||
setConfirm(null)
|
setConfirm(null)
|
||||||
setNote('')
|
setNote('')
|
||||||
setTextform(LEERE_TEXTFORM)
|
setTextform(LEERE_TEXTFORM)
|
||||||
setStatus({ ok: true, text: 'Gespeichert.' })
|
setStatus(speicherStatus(antwort))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setConfirm(null)
|
setConfirm(null)
|
||||||
setStatus({ ok: false, text: err.message })
|
setStatus({ ok: false, text: err.message })
|
||||||
|
|||||||
@@ -223,3 +223,9 @@ export function featureBody({ projectId, action, note, textformDate, textformCha
|
|||||||
}
|
}
|
||||||
return body
|
return body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** K16 (Unterlagen an den Kunden) ging beim Aktivieren nicht raus: Antwort mit warnung: true (Portal, funktionenAdmin). */
|
||||||
|
export const K16_WARNUNG = 'Eingeschaltet, aber die E-Mail mit den Unterlagen (K16) ging nicht raus. Bitte die Leistungsbeschreibung und den AVV von Hand an den Kunden senden.'
|
||||||
|
|
||||||
|
/** Statuszeile nach dem Speichern einer Aktion: Warnung statt "Gespeichert.", wenn die Antwort warnung: true traegt. */
|
||||||
|
export const speicherStatus = (antwort) => (antwort?.warnung === true ? { ok: false, text: K16_WARNUNG } : { ok: true, text: 'Gespeichert.' })
|
||||||
@@ -23,6 +23,8 @@ const {
|
|||||||
textformAnsicht,
|
textformAnsicht,
|
||||||
textformBereit,
|
textformBereit,
|
||||||
featureBody,
|
featureBody,
|
||||||
|
speicherStatus,
|
||||||
|
K16_WARNUNG,
|
||||||
} = await loadModule('src/lib/funktionenView.js')
|
} = await loadModule('src/lib/funktionenView.js')
|
||||||
|
|
||||||
test('FUNKTIONEN: News und Terminplaner mit den Bestätigungstexten', () => {
|
test('FUNKTIONEN: News und Terminplaner mit den Bestätigungstexten', () => {
|
||||||
@@ -460,3 +462,11 @@ test('featureBody: Aktivieren mit Textform trägt Datum und Weg, sonst bleibt de
|
|||||||
'halbe Angaben gehen nicht mit',
|
'halbe Angaben gehen nicht mit',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('speicherStatus: warnung true (K16 nicht gesendet) wird zur Warnung, sonst "Gespeichert."', () => {
|
||||||
|
assert.deepEqual(speicherStatus({ projects: [], warnung: true }), { ok: false, text: K16_WARNUNG })
|
||||||
|
assert.match(K16_WARNUNG, /K16/)
|
||||||
|
assert.match(K16_WARNUNG, /von Hand/)
|
||||||
|
assert.deepEqual(speicherStatus({ projects: [] }), { ok: true, text: 'Gespeichert.' })
|
||||||
|
assert.deepEqual(speicherStatus(undefined), { ok: true, text: 'Gespeichert.' })
|
||||||
|
})
|
||||||
Reference in new issue
Block a user