### feat: erweitere Wizard- und UI-Logik

- Füge automatische Re-Evaluierung im `EventWizardViewModel` nach Import hinzu.
- Aktualisiere `StammdatenImportScreen` mit `onBack`-Callback für Status-Prüfung.
- Erweitere `PingScreen` im `ConnectivityCheck`-Screen um Navigation zum Login.
- Präzisiere `hasZns`-Guard mit Prüfung auf Import-Datum.
This commit is contained in:
2026-04-21 21:10:58 +02:00
parent 92028d9e02
commit 3f4ba9eea9
4 changed files with 35 additions and 26 deletions
@@ -282,7 +282,7 @@ private fun ZnsCheckStep(viewModel: EventWizardViewModel) {
.heightIn(max = 500.dp)
.padding(vertical = 8.dp)
) {
StammdatenImportScreen(onBack = { viewModel.checkStammdatenStatus() })
StammdatenImportScreen(onBack = { viewModel.reEvaluateCurrentStep() })
}
Button(
@@ -153,18 +153,8 @@ class EventWizardViewModel(
// Falls WizardRuntime aktiv ist, re-evaluieren wir den aktuellen Step,
// falls wir noch im ZNS_CHECK hängen
if (WizardFeatureFlags.WizardRuntimeEnabled && state.currentStep == WizardStep.ZNS_CHECK) {
val ctx = buildWizardContext()
val current = ensureWizardStateInitialized()
// Wir versuchen ein "next" ohne explizite User-Aktion, um den Guard zu prüfen
val next = DemoEventFlow.next(ctx, current)
if (next != current) {
wizardState = next
mapToWizardStep(next.current)?.let {
state = state.copy(currentStep = it)
saveDraftInternal(it)
}
}
if (state.currentStep == WizardStep.ZNS_CHECK) {
reEvaluateCurrentStep()
}
} catch (e: Exception) {
state = state.copy(isCheckingStats = false, error = "Fehler beim Laden der Stammdaten-Stats: ${e.message}")
@@ -272,6 +262,21 @@ class EventWizardViewModel(
stats = state.stammdatenStats
)
fun reEvaluateCurrentStep() {
if (WizardFeatureFlags.WizardRuntimeEnabled) {
val ctx = buildWizardContext()
val current = ensureWizardStateInitialized()
val next = DemoEventFlow.next(ctx, current)
if (next != current) {
wizardState = next
mapToWizardStep(next.current)?.let {
state = state.copy(currentStep = it)
saveDraftInternal(it)
}
}
}
}
private fun buildAccFromState(): DemoEventAcc = DemoEventAcc(
veranstalterId = state.veranstalterId?.toString(),
veranstalterNr = state.veranstalterVereinsNummer
@@ -344,14 +349,17 @@ class EventWizardViewModel(
ort = standardOrt,
logoUrl = logo
)
reEvaluateCurrentStep()
}
fun setAnsprechperson(satznummer: String, name: String) {
state = state.copy(ansprechpersonSatznummer = satznummer, ansprechpersonName = name)
reEvaluateCurrentStep()
}
fun updateMetaData(name: String, ort: String, start: LocalDate?, end: LocalDate?, logo: String?) {
state = state.copy(name = name, ort = ort, startDatum = start, endDatum = end, logoUrl = logo)
reEvaluateCurrentStep()
}
fun addTurnier(nummer: String = "", pfad: String? = null) {