feat(veranstaltung): ZNS-Import-Assistent hinzugefügt und Workflow verbessert
Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
@@ -44,6 +44,12 @@ Um die Wartezeit beim ersten Import von ~20 Minuten auf wenige Sekunden/Minuten
|
|||||||
2. **Wizard-Implementation:** Umsetzung des 3-Schritt-Flows im `VeranstaltungNeuScreen.kt`.
|
2. **Wizard-Implementation:** Umsetzung des 3-Schritt-Flows im `VeranstaltungNeuScreen.kt`.
|
||||||
3. **API-Erweiterung:** `ZnsImportService` um den `mode=LIGHT` Parameter erweitern.
|
3. **API-Erweiterung:** `ZnsImportService` um den `mode=LIGHT` Parameter erweitern.
|
||||||
|
|
||||||
|
🧹 **[Curator]**: Journal-Eintrag für Session am 16. April 2026 abgeschlossen.
|
||||||
|
|
||||||
|
* **Status**: Implementierung des ZNS-First Wizards in `VeranstaltungKonfigV2` abgeschlossen.
|
||||||
|
* **Resultat**: Performance-Steigerung durch ZNS-Light Integration direkt im ersten Wizard-Schritt.
|
||||||
|
* **Technik**: Entkopplung via `ZnsImportProvider` Interface erfolgreich angewendet.
|
||||||
|
|
||||||
---
|
---
|
||||||
🧹 **[Curator]**: Dieses Dokument dient als Übergabeprotokoll für die nächste Session. Alle fachlichen und technischen
|
🧹 **[Curator]**: Dieses Dokument wurde um die finalen Implementierungsdetails ergänzt. Alle fachlichen und technischen
|
||||||
Parameter sind hiermit fixiert.
|
Parameter sind hiermit fixiert und umgesetzt.
|
||||||
|
|||||||
+241
-58
@@ -21,10 +21,14 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import at.mocode.frontend.core.domain.zns.ZnsImportProvider
|
||||||
|
import org.koin.compose.koinInject
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
import javax.swing.JFileChooser
|
||||||
|
import javax.swing.filechooser.FileNameExtensionFilter
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -306,6 +310,9 @@ fun VeranstaltungKonfigV2(
|
|||||||
onSaved: (Long, Long) -> Unit, // eventId, veranstalterId
|
onSaved: (Long, Long) -> Unit, // eventId, veranstalterId
|
||||||
onVeranstalterCreated: (Long) -> Unit = {}, // Neuer Flow: nach Vereinsanlage ins Profil
|
onVeranstalterCreated: (Long) -> Unit = {}, // Neuer Flow: nach Vereinsanlage ins Profil
|
||||||
) {
|
) {
|
||||||
|
val znsImporter: ZnsImportProvider = koinInject()
|
||||||
|
val znsState = znsImporter.state
|
||||||
|
|
||||||
DesktopThemeV2 {
|
DesktopThemeV2 {
|
||||||
var currentStep by remember { mutableStateOf(if (veranstalterId == 0L) 1 else 2) }
|
var currentStep by remember { mutableStateOf(if (veranstalterId == 0L) 1 else 2) }
|
||||||
|
|
||||||
@@ -417,73 +424,98 @@ fun VeranstaltungKonfigV2(
|
|||||||
Box(Modifier.weight(1f).fillMaxWidth()) {
|
Box(Modifier.weight(1f).fillMaxWidth()) {
|
||||||
when (currentStep) {
|
when (currentStep) {
|
||||||
1 -> {
|
1 -> {
|
||||||
// --- SCHRITT 1: Veranstalterwahl ---
|
// --- SCHRITT 1: ZNS-First Daten-Akquise ---
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
var search by remember { mutableStateOf("") }
|
Text(
|
||||||
val filteredVereine = remember(search) {
|
"Daten-Akquise & Veranstalter",
|
||||||
StoreV2.vereine.filter {
|
style = MaterialTheme.typography.titleMedium,
|
||||||
it.name.contains(search, ignoreCase = true) || (it.ort?.contains(search, ignoreCase = true) ?: false)
|
fontWeight = FontWeight.Bold
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text("Für welchen Verein wird die Veranstaltung angelegt?", style = MaterialTheme.typography.titleMedium)
|
|
||||||
|
|
||||||
OutlinedTextField(
|
|
||||||
value = search,
|
|
||||||
onValueChange = { search = it },
|
|
||||||
label = { Text("Veranstalter suchen...") },
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) }
|
|
||||||
)
|
)
|
||||||
|
|
||||||
LazyColumn(
|
// 1. ZNS Import Bereich (Prominent)
|
||||||
modifier = Modifier.weight(1f).fillMaxWidth(),
|
ZnsImportWizardSection(
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
state = znsState,
|
||||||
) {
|
onFileSelect = { path -> znsImporter.onFileSelected(path) },
|
||||||
items(filteredVereine) { verein ->
|
onStartImport = { znsImporter.startImport(mode = "LIGHT") },
|
||||||
val isSelected = selectedVereinId == verein.id
|
onReset = { znsImporter.reset() }
|
||||||
Surface(
|
)
|
||||||
onClick = { selectedVereinId = verein.id },
|
|
||||||
shape = MaterialTheme.shapes.medium,
|
HorizontalDivider(Modifier.padding(vertical = 8.dp))
|
||||||
color = if (isSelected) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface,
|
|
||||||
border = if (isSelected) null else androidx.compose.foundation.BorderStroke(
|
// 2. Bestehende Veranstalter (Kompakt)
|
||||||
1.dp,
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.weight(1f)) {
|
||||||
MaterialTheme.colorScheme.outlineVariant
|
var search by remember { mutableStateOf("") }
|
||||||
)
|
val filteredVereine = remember(search) {
|
||||||
) {
|
StoreV2.vereine.filter {
|
||||||
Row(
|
it.name.contains(search, ignoreCase = true) || (it.ort?.contains(search, ignoreCase = true)
|
||||||
Modifier.padding(16.dp).fillMaxWidth(),
|
?: false)
|
||||||
verticalAlignment = Alignment.CenterVertically
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text("Oder bestehenden Veranstalter wählen:", style = MaterialTheme.typography.titleSmall)
|
||||||
|
|
||||||
|
OutlinedTextField(
|
||||||
|
value = search,
|
||||||
|
onValueChange = { search = it },
|
||||||
|
label = { Text("Veranstalter suchen...") },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
|
) {
|
||||||
|
items(filteredVereine) { verein ->
|
||||||
|
val isSelected = selectedVereinId == verein.id
|
||||||
|
Surface(
|
||||||
|
onClick = { selectedVereinId = verein.id },
|
||||||
|
shape = MaterialTheme.shapes.small,
|
||||||
|
color = if (isSelected) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface,
|
||||||
|
border = if (isSelected) null else androidx.compose.foundation.BorderStroke(
|
||||||
|
1.dp,
|
||||||
|
MaterialTheme.colorScheme.outlineVariant
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
Column(Modifier.weight(1f)) {
|
Row(
|
||||||
Text(verein.name, fontWeight = FontWeight.Bold)
|
Modifier.padding(horizontal = 12.dp, vertical = 8.dp).fillMaxWidth(),
|
||||||
Text("${verein.ort ?: ""} | ${verein.oepsNummer}", style = MaterialTheme.typography.bodySmall)
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Column(Modifier.weight(1f)) {
|
||||||
|
Text(verein.name, style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Bold)
|
||||||
|
Text(
|
||||||
|
"${verein.ort ?: ""} | ${verein.oepsNummer}",
|
||||||
|
style = MaterialTheme.typography.labelSmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (isSelected) Icon(
|
||||||
|
Icons.AutoMirrored.Filled.KeyboardArrowRight,
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(16.dp)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if (isSelected) Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalDivider()
|
if (showVereinNeu) {
|
||||||
|
AlertDialog(
|
||||||
if (!showVereinNeu) {
|
onDismissRequest = { showVereinNeu = false },
|
||||||
OutlinedButton(
|
title = { Text("Manueller Eintrag") },
|
||||||
onClick = { showVereinNeu = true },
|
text = {
|
||||||
modifier = Modifier.fillMaxWidth()
|
Box(Modifier.heightIn(max = 500.dp)) {
|
||||||
) {
|
VeranstalterAnlegenWizard(
|
||||||
Icon(Icons.Default.Add, contentDescription = null)
|
onCancel = { showVereinNeu = false },
|
||||||
Spacer(Modifier.width(8.dp))
|
onVereinCreated = { newId ->
|
||||||
Text("Neuen Veranstalter / Verein anlegen")
|
showVereinNeu = false
|
||||||
}
|
onVeranstalterCreated(newId)
|
||||||
} else {
|
}
|
||||||
VeranstalterAnlegenWizard(
|
)
|
||||||
onCancel = { showVereinNeu = false },
|
}
|
||||||
onVereinCreated = { newId ->
|
},
|
||||||
// Neuer gewünschter Flow: nach Schritt 2 ins Veranstalter‑Profil wechseln
|
confirmButton = {}
|
||||||
showVereinNeu = false
|
|
||||||
onVeranstalterCreated(newId)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1539,3 +1571,154 @@ private fun Step3Branding(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ZnsImportWizardSection(
|
||||||
|
state: at.mocode.frontend.core.domain.zns.ZnsImportState,
|
||||||
|
onFileSelect: (String) -> Unit,
|
||||||
|
onStartImport: () -> Unit,
|
||||||
|
onReset: () -> Unit
|
||||||
|
) {
|
||||||
|
Card(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.4f)),
|
||||||
|
border = androidx.compose.foundation.BorderStroke(1.dp, MaterialTheme.colorScheme.primary.copy(alpha = 0.2f))
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
Icon(Icons.Default.CloudUpload, contentDescription = null, tint = MaterialTheme.colorScheme.primary)
|
||||||
|
Text("ZNS-Stammdaten Import (ZIP)", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Bold)
|
||||||
|
Spacer(Modifier.weight(1f))
|
||||||
|
if (state.isFinished || state.errorMessage != null) {
|
||||||
|
TextButton(onClick = onReset) {
|
||||||
|
Icon(Icons.Default.Refresh, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
|
Spacer(Modifier.width(4.dp))
|
||||||
|
Text("Neu laden")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.jobId == null) {
|
||||||
|
// Datei-Auswahl Modus
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = state.selectedFilePath ?: "",
|
||||||
|
onValueChange = {},
|
||||||
|
readOnly = true,
|
||||||
|
placeholder = { Text("ZNS.zip auswählen...") },
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
singleLine = true,
|
||||||
|
textStyle = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
val path = pickZipFile()
|
||||||
|
if (path != null) onFileSelect(path)
|
||||||
|
},
|
||||||
|
enabled = !state.isUploading
|
||||||
|
) {
|
||||||
|
Icon(Icons.Default.FolderOpen, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text("Durchsuchen")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = onStartImport,
|
||||||
|
enabled = state.selectedFilePath != null && !state.isUploading,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
if (state.isUploading) {
|
||||||
|
CircularProgressIndicator(modifier = Modifier.size(18.dp), strokeWidth = 2.dp)
|
||||||
|
} else {
|
||||||
|
Icon(Icons.Default.Bolt, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text("Schnell-Import starten (LIGHT)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Progress Modus
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(state.jobStatus ?: "Verarbeite...", style = MaterialTheme.typography.labelMedium)
|
||||||
|
Text("${state.progress}%", style = MaterialTheme.typography.labelMedium)
|
||||||
|
}
|
||||||
|
|
||||||
|
LinearProgressIndicator(
|
||||||
|
progress = { state.progress / 100f },
|
||||||
|
modifier = Modifier.fillMaxWidth().height(8.dp).clip(RoundedCornerShape(4.dp)),
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
state.progressDetail.ifBlank { "Warte auf Server..." },
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
|
||||||
|
if (state.isFinished && state.jobStatus == "ABGESCHLOSSEN") {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
|
modifier = Modifier.padding(top = 4.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.CheckCircle,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = Color(0xFF2E7D32),
|
||||||
|
modifier = Modifier.size(16.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
"Import erfolgreich! Vereine wurden aktualisiert.",
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = Color(0xFF2E7D32)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.errorMessage != null) {
|
||||||
|
Surface(
|
||||||
|
color = MaterialTheme.colorScheme.errorContainer,
|
||||||
|
shape = RoundedCornerShape(4.dp),
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
Modifier.padding(8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.Error,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.error,
|
||||||
|
modifier = Modifier.size(16.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
state.errorMessage ?: "Fehler",
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onErrorContainer
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun pickZipFile(): String? {
|
||||||
|
val chooser = JFileChooser()
|
||||||
|
chooser.dialogTitle = "ZNS.zip auswählen"
|
||||||
|
chooser.fileFilter = FileNameExtensionFilter("ZIP-Archiv (*.zip)", "zip")
|
||||||
|
chooser.isAcceptAllFileFilterUsed = false
|
||||||
|
val result = chooser.showOpenDialog(null)
|
||||||
|
return if (result == JFileChooser.APPROVE_OPTION) chooser.selectedFile.absolutePath else null
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user