chore: erweitere Veranstalter-Wizard um Bearbeitungsmodus, füge Kontaktdaten und Step-Logik hinzu
Signed-off-by: StefanMoCoAt <stefan.mo.co@gmail.com>
This commit is contained in:
parent
18e619abfc
commit
544fbf792c
|
|
@ -62,12 +62,13 @@ Die Pferdesportliche Logik (§ 39) ist nun im Wizard sichtbar. Der nächste Schr
|
|||
- Bereinigung von Compiler-Warnungen (unnecessary non-null assertions) in den neuen Screen-Komponenten.
|
||||
- Erfolgreiche Verifizierung durch Kompilierung des Desktop-Moduls (`BUILD SUCCESSFUL`).
|
||||
|
||||
### 2026-04-21 14:30 - [Lead Architect] & [Frontend Expert]
|
||||
* **Aktion:** Styling-Vereinheitlichung und Daten-Ownership-Korrektur.
|
||||
* **Ergebnis:**
|
||||
* Veranstalter-Verwaltung auf Card-Design umgestellt (MsCard).
|
||||
* Event-Ownership in den Fake-Daten korrigiert (Neumarkt vs. Linz).
|
||||
* Globale Event-Verwaltung nach Datum absteigend sortieren.
|
||||
* MsFilterBar Alignment-Fix (Text-Baseline).
|
||||
* Reiter-Modelle um Nation und Bundesland erweitert.
|
||||
* **Status:** Alle fachlichen Anforderungen an das UI-Refining und Datenmodellierung in dieser Session erfüllt.
|
||||
### 2026-04-21 15:00 - [Frontend Expert] & [Lead Architect]
|
||||
* **Aktion:** Professionalisierung des Veranstalter-Wizards und Profil-Bearbeitung.
|
||||
* **Ergebnis:**
|
||||
* **Veranstalter-Domäne:** Erweiterung um Kontaktdaten (Telefon, E-Mail, Ansprechpartner, Adresse).
|
||||
* **Veranstalter-Wizard:** Refactoring des Wizards zu einer vollwertigen Edit/Create-Komponente inklusive Detail-Erfassung (Step 2).
|
||||
* **Repository-Update:** `FakeVeranstalterRepository` liefert nun vollständige Datensätze für alle Mock-Veranstalter.
|
||||
* **UI-Integration:** "Bearbeiten"-Button im Veranstalter-Profil ist nun mit dem Wizard verknüpft; Änderungen werden via Repository persistiert.
|
||||
* **Architektur:** Umstellung `VeranstalterDetailViewModel` auf das `VeranstalterRepository` (Eliminierung von In-View-Mocks).
|
||||
* **Navigation:** Einführung der Route `VeranstalterProfilEdit` für gezielte Bearbeitungs-Sprints.
|
||||
* **Status:** Der "Veranstalter-Wizard" ist nun fachlich fertiggestellt und ermöglicht die vollständige Verwaltung der Veranstalter-Stammdaten.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ sealed class AppScreen(val route: String) {
|
|||
|
||||
data object VeranstalterVerwaltung : AppScreen("/veranstalter/verwaltung")
|
||||
data class VeranstalterProfil(val id: Long) : AppScreen("/veranstalter/profil/$id")
|
||||
data class VeranstalterProfilEdit(val id: Long) : AppScreen("/veranstalter/profil/$id/edit")
|
||||
|
||||
// data class VeranstaltungProfil(val id: Long) : AppScreen("/veranstaltung/profil/$id")
|
||||
|
||||
|
|
@ -82,6 +83,7 @@ sealed class AppScreen(val route: String) {
|
|||
private val VEREIN_PROFIL = Regex("/vereine/profil/(\\d+)$")
|
||||
private val FUNKTIONAER_PROFIL = Regex("/funktionaere/profil/(\\d+)$")
|
||||
private val VERANSTALTER_PROFIL = Regex("/veranstalter/profil/(\\d+)$")
|
||||
private val VERANSTALTER_PROFIL_EDIT = Regex("/veranstalter/profil/(\\d+)/edit$")
|
||||
// private val VERANSTALTUNG_PROFIL_LEGACY = Regex("/veranstaltung/profil/(\\d+)$")
|
||||
|
||||
fun fromRoute(route: String): AppScreen {
|
||||
|
|
@ -119,6 +121,7 @@ sealed class AppScreen(val route: String) {
|
|||
VEREIN_PROFIL.matchEntire(route)?.destructured?.let { (id) -> return VereinProfil(id.toLong()) }
|
||||
FUNKTIONAER_PROFIL.matchEntire(route)?.destructured?.let { (id) -> return FunktionaerProfil(id.toLong()) }
|
||||
VERANSTALTER_PROFIL.matchEntire(route)?.destructured?.let { (id) -> return VeranstalterProfil(id.toLong()) }
|
||||
VERANSTALTER_PROFIL_EDIT.matchEntire(route)?.destructured?.let { (id) -> return VeranstalterProfilEdit(id.toLong()) }
|
||||
/*
|
||||
EVENT_PROFIL.matchEntire(route)?.destructured?.let { (id) -> return EventProfil(id.toLong()) }
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,12 +9,78 @@ import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
|||
*/
|
||||
class FakeVeranstalterRepository : VeranstalterRepository {
|
||||
private val mockData = mutableListOf(
|
||||
Veranstalter(1, "URV Schloss Hof", "1-2345", "Schloßhof", "Aktiv"),
|
||||
Veranstalter(2, "RV Schloß Rosenau", "3-0012", "Rosenau", "Aktiv"),
|
||||
Veranstalter(3, "Reitclub Tulln", "3-1520", "Tulln", "Inaktiv"),
|
||||
Veranstalter(4, "RC St. Pölten", "3-0101", "St. Pölten", "Aktiv"),
|
||||
Veranstalter(5, "Union Reitklub Wien", "9-0001", "Wien", "Aktiv"),
|
||||
Veranstalter(6, "Reitclub Neumarkt", "6-009", "Neumarkt", "Aktiv")
|
||||
Veranstalter(
|
||||
id = 1,
|
||||
name = "URV Schloss Hof",
|
||||
oepsNummer = "1-2345",
|
||||
ort = "Schloßhof",
|
||||
loginStatus = "Aktiv",
|
||||
ansprechpartner = "Max Mustermann",
|
||||
email = "office@schlosshof.at",
|
||||
telefon = "+43 1 234567",
|
||||
adresse = "Schloßstraße 1, 2294 Schloßhof",
|
||||
mitgliedSeit = "01.01.2020"
|
||||
),
|
||||
Veranstalter(
|
||||
id = 2,
|
||||
name = "RV Schloß Rosenau",
|
||||
oepsNummer = "3-0012",
|
||||
ort = "Rosenau",
|
||||
loginStatus = "Aktiv",
|
||||
ansprechpartner = "Erika Muster",
|
||||
email = "erika@rosenau.at",
|
||||
telefon = "+43 2822 1234",
|
||||
adresse = "Schloßplatz 1, 3924 Rosenau",
|
||||
mitgliedSeit = "15.03.2018"
|
||||
),
|
||||
Veranstalter(
|
||||
id = 3,
|
||||
name = "Reitclub Tulln",
|
||||
oepsNummer = "3-1520",
|
||||
ort = "Tulln",
|
||||
loginStatus = "Inaktiv",
|
||||
ansprechpartner = "Hansi Hinterseer",
|
||||
email = "hansi@tulln.at",
|
||||
telefon = "+43 2272 5555",
|
||||
adresse = "Donauweg 10, 3430 Tulln",
|
||||
mitgliedSeit = "10.10.2010"
|
||||
),
|
||||
Veranstalter(
|
||||
id = 4,
|
||||
name = "RC St. Pölten",
|
||||
oepsNummer = "3-0101",
|
||||
ort = "St. Pölten",
|
||||
loginStatus = "Aktiv",
|
||||
ansprechpartner = "Petra Reiter",
|
||||
email = "petra@rc-stpoelten.at",
|
||||
telefon = "+43 2742 9876",
|
||||
adresse = "Pferdegasse 5, 3100 St. Pölten",
|
||||
mitgliedSeit = "20.05.2022"
|
||||
),
|
||||
Veranstalter(
|
||||
id = 5,
|
||||
name = "Union Reitklub Wien",
|
||||
oepsNummer = "9-0001",
|
||||
ort = "Wien",
|
||||
loginStatus = "Aktiv",
|
||||
ansprechpartner = "Stefan Wiener",
|
||||
email = "stefan@urkw.at",
|
||||
telefon = "+43 1 90001",
|
||||
adresse = "Hauptstraße 100, 1010 Wien",
|
||||
mitgliedSeit = "12.12.2012"
|
||||
),
|
||||
Veranstalter(
|
||||
id = 6,
|
||||
name = "Reitclub Neumarkt",
|
||||
oepsNummer = "6-009",
|
||||
ort = "Neumarkt",
|
||||
loginStatus = "Aktiv",
|
||||
ansprechpartner = "Karl Neumarkter",
|
||||
email = "karl@rc-neumarkt.at",
|
||||
telefon = "+43 6216 1234",
|
||||
adresse = "Mühlweg 1, 5202 Neumarkt am Wallersee",
|
||||
mitgliedSeit = "01.04.2024"
|
||||
)
|
||||
)
|
||||
|
||||
override suspend fun list(): Result<List<Veranstalter>> = Result.success(mockData)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ data class Veranstalter(
|
|||
val oepsNummer: String,
|
||||
val ort: String,
|
||||
val loginStatus: String,
|
||||
val ansprechpartner: String = "",
|
||||
val email: String = "",
|
||||
val telefon: String = "",
|
||||
val adresse: String = "",
|
||||
val mitgliedSeit: String = "",
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import at.mocode.frontend.features.veranstalter.data.remote.FakeVeranstalterRepo
|
|||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import at.mocode.frontend.features.veranstalter.presentation.VeranstalterDetailViewModel
|
||||
import at.mocode.frontend.features.veranstalter.presentation.VeranstalterViewModel
|
||||
import at.mocode.frontend.features.veranstalter.presentation.VeranstalterWizardViewModel
|
||||
import org.koin.dsl.module
|
||||
|
||||
val veranstalterModule = module {
|
||||
single<VeranstalterRepository> { FakeVeranstalterRepository() }
|
||||
factory { VeranstalterViewModel(get()) }
|
||||
factory { VeranstalterDetailViewModel(get()) }
|
||||
factory { VeranstalterWizardViewModel(get()) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ fun VeranstalterDetailScreen(
|
|||
onZurueck: () -> Unit,
|
||||
onVeranstaltungOeffnen: (Long) -> Unit,
|
||||
onVeranstaltungNeu: () -> Unit,
|
||||
onEditVeranstalter: (Long) -> Unit,
|
||||
) {
|
||||
val state by viewModel.state.collectAsState()
|
||||
|
||||
|
|
@ -134,7 +135,7 @@ fun VeranstalterDetailScreen(
|
|||
}
|
||||
// Profil bearbeiten
|
||||
OutlinedButton(
|
||||
onClick = { /* Navigation zu Vereinen */ },
|
||||
onClick = { onEditVeranstalter(veranstalter.id) },
|
||||
border = BorderStroke(1.dp, Color(0xFFD1D5DB)),
|
||||
) {
|
||||
Icon(Icons.Default.Settings, contentDescription = null, modifier = Modifier.size(14.dp))
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
package at.mocode.frontend.features.veranstalter.presentation
|
||||
|
||||
import at.mocode.frontend.core.designsystem.models.LoginStatus
|
||||
import at.mocode.frontend.core.designsystem.models.VeranstaltungStatus
|
||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import at.mocode.frontend.core.designsystem.models.VeranstaltungStatus
|
||||
import at.mocode.frontend.core.designsystem.models.LoginStatus
|
||||
|
||||
data class VeranstalterDetailState(
|
||||
val isLoading: Boolean = false,
|
||||
|
|
@ -53,64 +53,52 @@ class VeranstalterDetailViewModel(
|
|||
private fun load(id: Long) {
|
||||
_state.value = _state.value.copy(isLoading = true)
|
||||
scope.launch {
|
||||
// In einer echten App würden wir hier das Repo abfragen.
|
||||
// Für den Prototyp nutzen wir vorerst die Logik aus dem Screen, aber im VM gekapselt.
|
||||
val result = repo.getById(id)
|
||||
result.onSuccess { v ->
|
||||
val uiModel = VeranstalterDetailUiModel(
|
||||
id = v.id,
|
||||
name = v.name,
|
||||
oepsNummer = v.oepsNummer,
|
||||
ansprechpartner = v.ansprechpartner,
|
||||
email = v.email,
|
||||
telefon = v.telefon,
|
||||
adresse = v.adresse,
|
||||
loginStatus = when(v.loginStatus) {
|
||||
"Aktiv" -> LoginStatus.AKTIV
|
||||
else -> LoginStatus.AUSSTEHEND
|
||||
},
|
||||
mitgliedSeit = v.mitgliedSeit
|
||||
)
|
||||
|
||||
val mockVeranstalter = VeranstalterDetailUiModel(
|
||||
id = id,
|
||||
name = "Reit- und Fahrverein Wels",
|
||||
oepsNummer = "V-OOE-1234",
|
||||
ansprechpartner = "Maria Huber",
|
||||
email = "office@rfv-wels.at",
|
||||
telefon = "+43 7242 12345",
|
||||
adresse = "Reitweg 15\n4600 Wels",
|
||||
loginStatus = LoginStatus.AKTIV,
|
||||
mitgliedSeit = "15.1.2023",
|
||||
)
|
||||
// In einer realen App würden wir hier auch die Events vom Repo laden
|
||||
// Für den Prototyp behalten wir vorerst die Mock-Events, filtern sie aber ggf.
|
||||
val mockVeranstaltungen = listOf(
|
||||
VeranstaltungListUiModel(
|
||||
id = 1L,
|
||||
name = "Union Reit- und Fahrverein Neumarkt Frühjahrsturnier 2026",
|
||||
datum = "25.-26. April 2026",
|
||||
ort = "Reitanlage Stroblmair, Neumarkt/M., OO",
|
||||
turnierAnzahl = 2,
|
||||
nennungen = 87,
|
||||
bewerbe = 26,
|
||||
letzteAktivitaet = "22.03.2026 14:30",
|
||||
status = VeranstaltungStatus.VORBEREITUNG,
|
||||
)
|
||||
)
|
||||
|
||||
val mockVeranstaltungen = listOf(
|
||||
VeranstaltungListUiModel(
|
||||
id = 1L,
|
||||
name = "Union Reit- und Fahrverein Neumarkt Frühjahrsturnier 2026",
|
||||
datum = "25.-26. April 2026",
|
||||
ort = "Reitanlage Stroblmair, Neumarkt/M., OO",
|
||||
turnierAnzahl = 2,
|
||||
nennungen = 87,
|
||||
bewerbe = 26,
|
||||
letzteAktivitaet = "22.03.2026 14:30",
|
||||
status = VeranstaltungStatus.VORBEREITUNG,
|
||||
),
|
||||
VeranstaltungListUiModel(
|
||||
id = 2L,
|
||||
name = "AWÖ-Cup Stadl-Paura 2025",
|
||||
datum = "15.-17. Mai 2025",
|
||||
ort = "Bundesgestüt Piber, Stadl-Paura",
|
||||
turnierAnzahl = 2,
|
||||
nennungen = 142,
|
||||
bewerbe = 33,
|
||||
letzteAktivitaet = "17.05.2025 18:45",
|
||||
status = VeranstaltungStatus.ABGESCHLOSSEN,
|
||||
),
|
||||
VeranstaltungListUiModel(
|
||||
id = 3L,
|
||||
name = "Linzer Pferdetage 2026",
|
||||
datum = "12.-14. Juni 2026",
|
||||
ort = "Reitsportzentrum Linz-Ebelsberg",
|
||||
turnierAnzahl = 2,
|
||||
nennungen = 23,
|
||||
bewerbe = 30,
|
||||
letzteAktivitaet = "20.03.2026 09:15",
|
||||
status = VeranstaltungStatus.VORBEREITUNG,
|
||||
),
|
||||
)
|
||||
|
||||
_state.value = _state.value.copy(
|
||||
isLoading = false,
|
||||
veranstalter = mockVeranstalter,
|
||||
veranstaltungen = mockVeranstaltungen,
|
||||
filteredVeranstaltungen = mockVeranstaltungen
|
||||
)
|
||||
applyFilter()
|
||||
_state.value = _state.value.copy(
|
||||
isLoading = false,
|
||||
veranstalter = uiModel,
|
||||
veranstaltungen = mockVeranstaltungen,
|
||||
filteredVeranstaltungen = mockVeranstaltungen
|
||||
)
|
||||
applyFilter()
|
||||
}.onFailure { t ->
|
||||
_state.value = _state.value.copy(
|
||||
isLoading = false,
|
||||
errorMessage = t.message ?: "Fehler beim Laden"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
package at.mocode.frontend.features.veranstalter.presentation
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import at.mocode.frontend.features.veranstalter.domain.Veranstalter
|
||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
data class VeranstalterWizardState(
|
||||
val isLoading: Boolean = false,
|
||||
val isSaving: Boolean = false,
|
||||
val editId: Long? = null,
|
||||
val name: String = "",
|
||||
val oepsNummer: String = "",
|
||||
val ort: String = "",
|
||||
val ansprechpartner: String = "",
|
||||
val email: String = "",
|
||||
val telefon: String = "",
|
||||
val adresse: String = "",
|
||||
val loginStatus: String = "Aktiv",
|
||||
val success: Boolean = false,
|
||||
val errorMessage: String? = null
|
||||
)
|
||||
|
||||
sealed interface VeranstalterWizardIntent {
|
||||
data class Load(val id: Long) : VeranstalterWizardIntent
|
||||
data class UpdateName(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateOeps(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateOrt(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateAnsprechpartner(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateEmail(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateTelefon(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateAdresse(val v: String) : VeranstalterWizardIntent
|
||||
data object Save : VeranstalterWizardIntent
|
||||
}
|
||||
|
||||
class VeranstalterWizardViewModel(
|
||||
private val repo: VeranstalterRepository
|
||||
) : ViewModel() {
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
private val _state = MutableStateFlow(VeranstalterWizardState())
|
||||
val state: StateFlow<VeranstalterWizardState> = _state
|
||||
|
||||
fun send(intent: VeranstalterWizardIntent) {
|
||||
when (intent) {
|
||||
is VeranstalterWizardIntent.Load -> load(intent.id)
|
||||
is VeranstalterWizardIntent.UpdateName -> _state.value = _state.value.copy(name = intent.v)
|
||||
is VeranstalterWizardIntent.UpdateOeps -> _state.value = _state.value.copy(oepsNummer = intent.v)
|
||||
is VeranstalterWizardIntent.UpdateOrt -> _state.value = _state.value.copy(ort = intent.v)
|
||||
is VeranstalterWizardIntent.UpdateAnsprechpartner -> _state.value = _state.value.copy(ansprechpartner = intent.v)
|
||||
is VeranstalterWizardIntent.UpdateEmail -> _state.value = _state.value.copy(email = intent.v)
|
||||
is VeranstalterWizardIntent.UpdateTelefon -> _state.value = _state.value.copy(telefon = intent.v)
|
||||
is VeranstalterWizardIntent.UpdateAdresse -> _state.value = _state.value.copy(adresse = intent.v)
|
||||
is VeranstalterWizardIntent.Save -> save()
|
||||
}
|
||||
}
|
||||
|
||||
private fun load(id: Long) {
|
||||
_state.value = _state.value.copy(isLoading = true, editId = id)
|
||||
scope.launch {
|
||||
repo.getById(id).onSuccess { v ->
|
||||
_state.value = _state.value.copy(
|
||||
isLoading = false,
|
||||
name = v.name,
|
||||
oepsNummer = v.oepsNummer,
|
||||
ort = v.ort,
|
||||
ansprechpartner = v.ansprechpartner,
|
||||
email = v.email,
|
||||
telefon = v.telefon,
|
||||
adresse = v.adresse,
|
||||
loginStatus = v.loginStatus
|
||||
)
|
||||
}.onFailure { t ->
|
||||
_state.value = _state.value.copy(isLoading = false, errorMessage = t.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun save() {
|
||||
val s = _state.value
|
||||
_state.value = _state.value.copy(isSaving = true)
|
||||
scope.launch {
|
||||
val model = Veranstalter(
|
||||
id = s.editId ?: 0L,
|
||||
name = s.name,
|
||||
oepsNummer = s.oepsNummer,
|
||||
ort = s.ort,
|
||||
ansprechpartner = s.ansprechpartner,
|
||||
email = s.email,
|
||||
telefon = s.telefon,
|
||||
adresse = s.adresse,
|
||||
loginStatus = s.loginStatus
|
||||
)
|
||||
val result = if (s.editId != null) {
|
||||
repo.update(s.editId, model)
|
||||
} else {
|
||||
repo.create(model)
|
||||
}
|
||||
|
||||
result.onSuccess {
|
||||
_state.value = _state.value.copy(isSaving = false, success = true)
|
||||
}.onFailure { t ->
|
||||
_state.value = _state.value.copy(isSaving = false, errorMessage = t.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -178,6 +178,17 @@ fun DesktopContentArea(
|
|||
onBack = onBack,
|
||||
onZurVeranstaltung = { evtId: Long -> onNavigate(AppScreen.EventProfil(currentScreen.id, evtId)) },
|
||||
onNeuVeranstaltung = { onNavigate(AppScreen.EventNeu) },
|
||||
onEditVeranstalter = { id ->
|
||||
onNavigate(AppScreen.VeranstalterProfilEdit(id))
|
||||
}
|
||||
)
|
||||
|
||||
is AppScreen.VeranstalterProfilEdit -> VeranstalterAnlegenWizard(
|
||||
editId = currentScreen.id,
|
||||
onCancel = onBack,
|
||||
onVereinCreated = { id ->
|
||||
onNavigate(AppScreen.VeranstalterProfil(id))
|
||||
}
|
||||
)
|
||||
|
||||
// Neuer Flow: Veranstalter auswählen → Event-Wizard
|
||||
|
|
@ -188,6 +199,7 @@ fun DesktopContentArea(
|
|||
)
|
||||
|
||||
is AppScreen.VeranstalterNeu -> VeranstalterAnlegenWizard(
|
||||
editId = null,
|
||||
onCancel = onBack,
|
||||
onVereinCreated = { newId: Long -> onNavigate(AppScreen.VeranstalterProfil(newId)) }
|
||||
)
|
||||
|
|
@ -199,6 +211,7 @@ fun DesktopContentArea(
|
|||
onBack = onBack,
|
||||
onZurVeranstaltung = { evtId -> onNavigate(AppScreen.EventProfil(vId, evtId)) },
|
||||
onNeuVeranstaltung = { onNavigate(AppScreen.EventKonfig(vId)) },
|
||||
onEditVeranstalter = { id -> onNavigate(AppScreen.VeranstalterProfilEdit(id)) }
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,14 @@ fun VeranstalterDetail(
|
|||
onBack: () -> Unit,
|
||||
onZurVeranstaltung: (Long) -> Unit,
|
||||
onNeuVeranstaltung: () -> Unit,
|
||||
onEditVeranstalter: (Long) -> Unit,
|
||||
) {
|
||||
VeranstalterDetailScreen(
|
||||
veranstalterId = veranstalterId,
|
||||
viewModel = koinInject(),
|
||||
onZurueck = onBack,
|
||||
onVeranstaltungOeffnen = onZurVeranstaltung,
|
||||
onVeranstaltungNeu = onNeuVeranstaltung
|
||||
onVeranstaltungNeu = onNeuVeranstaltung,
|
||||
onEditVeranstalter = onEditVeranstalter
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ fun PreviewVeranstalterDetailScreen() {
|
|||
onZurueck = {},
|
||||
onVeranstaltungOeffnen = {},
|
||||
onVeranstaltungNeu = {},
|
||||
onEditVeranstalter = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,37 +4,61 @@ import androidx.compose.foundation.clickable
|
|||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import at.mocode.frontend.shell.desktop.data.Store
|
||||
import at.mocode.frontend.core.domain.zns.ZnsImportProvider
|
||||
import at.mocode.frontend.core.domain.zns.ZnsImportState
|
||||
import at.mocode.frontend.features.veranstalter.presentation.VeranstalterWizardIntent
|
||||
import at.mocode.frontend.features.veranstalter.presentation.VeranstalterWizardViewModel
|
||||
import at.mocode.frontend.shell.desktop.data.Store
|
||||
import at.mocode.frontend.shell.desktop.screens.veranstaltung.components.pickZnsFile
|
||||
import org.koin.compose.koinInject
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import org.koin.compose.viewmodel.koinViewModel
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun VeranstalterAnlegenWizard(
|
||||
editId: Long? = null,
|
||||
onCancel: () -> Unit,
|
||||
onVereinCreated: (Long) -> Unit
|
||||
) {
|
||||
var step by remember { mutableStateOf(1) }
|
||||
var selectedVereinId by remember { mutableLongStateOf(0L) }
|
||||
val viewModel = koinViewModel<VeranstalterWizardViewModel>()
|
||||
val state by viewModel.state.collectAsState()
|
||||
var step by remember { mutableIntStateOf(1) }
|
||||
|
||||
LaunchedEffect(editId) {
|
||||
if (editId != null) {
|
||||
viewModel.send(VeranstalterWizardIntent.Load(editId))
|
||||
step = 2 // Direkt zu den Details beim Editieren
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(state.success) {
|
||||
if (state.success) {
|
||||
onVereinCreated(state.editId ?: 0L)
|
||||
}
|
||||
}
|
||||
|
||||
val znsImporter = koinInject<ZnsImportProvider>()
|
||||
val znsState = znsImporter.state
|
||||
|
||||
Column(Modifier.fillMaxSize().padding(24.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
IconButton(onClick = onCancel) { Icon(Icons.Default.Close, null) }
|
||||
Text("Veranstalter registrieren", style = MaterialTheme.typography.headlineSmall)
|
||||
Text(
|
||||
if (editId == null) "Veranstalter registrieren" else "Veranstalter-Profil bearbeiten",
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
}
|
||||
|
||||
LinearProgressIndicator(
|
||||
|
|
@ -47,14 +71,21 @@ fun VeranstalterAnlegenWizard(
|
|||
1 -> Step1Veranstalter(
|
||||
znsState = znsState,
|
||||
znsImporter = znsImporter,
|
||||
selectedVereinId = selectedVereinId,
|
||||
onVereinSelected = { selectedVereinId = it },
|
||||
selectedVereinId = state.editId ?: 0L,
|
||||
onVereinSelected = { id ->
|
||||
// Mock: Wir laden die Daten des Vereins aus dem Store in das VM
|
||||
at.mocode.frontend.shell.desktop.data.Store.vereine.find { it.id == id }?.let { v ->
|
||||
viewModel.send(VeranstalterWizardIntent.UpdateName(v.name))
|
||||
viewModel.send(VeranstalterWizardIntent.UpdateOeps(v.oepsNummer))
|
||||
viewModel.send(VeranstalterWizardIntent.UpdateOrt(v.ort ?: ""))
|
||||
}
|
||||
},
|
||||
onVeranstalterCreated = {
|
||||
selectedVereinId = it
|
||||
onVereinCreated(it)
|
||||
// Nicht mehr direkt navigieren, sondern zu Step 2
|
||||
step = 2
|
||||
}
|
||||
)
|
||||
2 -> { /* Optional: Weitere Details für den Veranstalter */ }
|
||||
2 -> Step2VeranstalterDetails(viewModel)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -63,16 +94,91 @@ fun VeranstalterAnlegenWizard(
|
|||
Spacer(Modifier.width(8.dp))
|
||||
if (step == 1) {
|
||||
Button(
|
||||
onClick = { onVereinCreated(selectedVereinId) },
|
||||
enabled = selectedVereinId != 0L
|
||||
onClick = { step = 2 },
|
||||
enabled = state.name.isNotBlank()
|
||||
) {
|
||||
Text("Fertigstellen")
|
||||
Text("Weiter zu den Details")
|
||||
}
|
||||
} else {
|
||||
Button(
|
||||
onClick = { viewModel.send(VeranstalterWizardIntent.Save) },
|
||||
enabled = !state.isSaving && state.name.isNotBlank()
|
||||
) {
|
||||
if (state.isSaving) {
|
||||
CircularProgressIndicator(Modifier.size(18.dp), strokeWidth = 2.dp, color = Color.White)
|
||||
} else {
|
||||
Text(if (editId == null) "Registrierung abschließen" else "Änderungen speichern")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Step2VeranstalterDetails(viewModel: VeranstalterWizardViewModel) {
|
||||
val state by viewModel.state.collectAsState()
|
||||
|
||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp), modifier = Modifier.verticalScroll(rememberScrollState())) {
|
||||
Text("Ergänzen Sie die Kontaktdaten für diesen Veranstalter.", style = MaterialTheme.typography.bodyMedium)
|
||||
|
||||
OutlinedTextField(
|
||||
value = state.name,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateName(it)) },
|
||||
label = { Text("Name des Veranstalters / Vereins") },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
OutlinedTextField(
|
||||
value = state.oepsNummer,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateOeps(it)) },
|
||||
label = { Text("OEBS-Nr") },
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = state.ort,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateOrt(it)) },
|
||||
label = { Text("Ort") },
|
||||
modifier = Modifier.weight(2f)
|
||||
)
|
||||
}
|
||||
|
||||
HorizontalDivider()
|
||||
Text("Ansprechpartner & Kontakt", style = MaterialTheme.typography.titleSmall)
|
||||
|
||||
OutlinedTextField(
|
||||
value = state.ansprechpartner,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateAnsprechpartner(it)) },
|
||||
label = { Text("Name Ansprechpartner") },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
OutlinedTextField(
|
||||
value = state.email,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateEmail(it)) },
|
||||
label = { Text("E-Mail Adresse") },
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
OutlinedTextField(
|
||||
value = state.telefon,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateTelefon(it)) },
|
||||
label = { Text("Telefonnummer") },
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
|
||||
OutlinedTextField(
|
||||
value = state.adresse,
|
||||
onValueChange = { viewModel.send(VeranstalterWizardIntent.UpdateAdresse(it)) },
|
||||
label = { Text("Postanschrift") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
minLines = 2
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Step1Veranstalter(
|
||||
znsState: ZnsImportState,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user