### 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:
+10
-1
@@ -20,7 +20,16 @@ data class DemoEventAcc(
|
||||
)
|
||||
|
||||
object DemoEventGuards {
|
||||
val hasZns: Guard<DemoEventStep, DemoEventAcc> = { ctx, _ -> (ctx.stats?.vereinCount ?: 0) > 0 }
|
||||
val hasZns: Guard<DemoEventStep, DemoEventAcc> = { ctx, _ ->
|
||||
val stats = ctx.stats
|
||||
if (stats == null) false
|
||||
else {
|
||||
val hasData = stats.vereinCount > 0
|
||||
// Einfache Frische-Prüfung: Falls lastImport gesetzt ist, sollte er vorhanden sein.
|
||||
hasData && !stats.lastImport.isNullOrBlank()
|
||||
}
|
||||
}
|
||||
|
||||
// Heuristik für Demo: Kontaktperson nötig, wenn keine Veranstalter-ID vorhanden
|
||||
// oder die Nummer ein Organisations-Präfix trägt (z. B. „ORG-“)
|
||||
val needsContactPerson: Guard<DemoEventStep, DemoEventAcc> = { _, acc ->
|
||||
|
||||
+1
-1
@@ -282,7 +282,7 @@ private fun ZnsCheckStep(viewModel: EventWizardViewModel) {
|
||||
.heightIn(max = 500.dp)
|
||||
.padding(vertical = 8.dp)
|
||||
) {
|
||||
StammdatenImportScreen(onBack = {})
|
||||
StammdatenImportScreen(onBack = { viewModel.checkStammdatenStatus() })
|
||||
}
|
||||
|
||||
Button(
|
||||
|
||||
+16
@@ -150,6 +150,22 @@ class EventWizardViewModel(
|
||||
try {
|
||||
val stats = masterdataRepository.getStats()
|
||||
state = state.copy(stammdatenStats = stats, isZnsAvailable = stats.vereinCount > 0, isCheckingStats = false)
|
||||
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
state = state.copy(isCheckingStats = false, error = "Fehler beim Laden der Stammdaten-Stats: ${e.message}")
|
||||
}
|
||||
|
||||
+6
-3
@@ -340,9 +340,12 @@ fun DesktopContentArea(
|
||||
}
|
||||
|
||||
is AppScreen.ConnectivityCheck -> {
|
||||
val viewModel = koinViewModel<PingViewModel>()
|
||||
PingScreen(viewModel = viewModel)
|
||||
}
|
||||
val viewModel = koinViewModel<PingViewModel>()
|
||||
PingScreen(
|
||||
viewModel = viewModel,
|
||||
onNavigateToLogin = { onNavigate(AppScreen.Login()) }
|
||||
)
|
||||
}
|
||||
|
||||
is AppScreen.Profile -> {
|
||||
val viewModel = koinViewModel<ProfileViewModel>()
|
||||
|
||||
Reference in New Issue
Block a user