chore: integriere Logo-Upload und Vorschau in Veranstalter-Wizard, verbessere Navigationslogik und erweitere Datenmodelle
Signed-off-by: StefanMoCoAt <stefan.mo.co@gmail.com>
This commit is contained in:
+2
@@ -11,6 +11,8 @@ data class Veranstalter(
|
||||
val telefon: String = "",
|
||||
val adresse: String = "",
|
||||
val mitgliedSeit: String = "",
|
||||
val logoUrl: String? = null,
|
||||
val logoBase64: String? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
+5
-1
@@ -1,12 +1,12 @@
|
||||
package at.mocode.frontend.features.veranstalter.presentation
|
||||
|
||||
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.features.veranstalter.domain.Veranstalter as DomainVeranstalter
|
||||
|
||||
// UDF: State beschreibt die gesamte UI in einem Snapshot
|
||||
@@ -34,6 +34,8 @@ data class VeranstalterListItem(
|
||||
val oepsNummer: String,
|
||||
val ort: String,
|
||||
val loginStatus: String,
|
||||
val logoUrl: String? = null,
|
||||
val logoBase64: String? = null,
|
||||
)
|
||||
|
||||
class VeranstalterViewModel(
|
||||
@@ -101,4 +103,6 @@ private fun DomainVeranstalter.toListItem() = VeranstalterListItem(
|
||||
oepsNummer = oepsNummer,
|
||||
ort = ort,
|
||||
loginStatus = loginStatus,
|
||||
logoUrl = logoUrl,
|
||||
logoBase64 = logoBase64,
|
||||
)
|
||||
|
||||
+5
-3
@@ -326,9 +326,11 @@ data class VeranstalterDetailUiModel(
|
||||
val ansprechpartner: String,
|
||||
val email: String,
|
||||
val telefon: String,
|
||||
val adresse: String,
|
||||
val loginStatus: LoginStatus,
|
||||
val mitgliedSeit: String,
|
||||
val adresse: String,
|
||||
val loginStatus: LoginStatus,
|
||||
val mitgliedSeit: String,
|
||||
val logoUrl: String? = null,
|
||||
val logoBase64: String? = null,
|
||||
)
|
||||
|
||||
data class VeranstaltungListUiModel(
|
||||
|
||||
+2
@@ -11,4 +11,6 @@ data class VeranstalterUiModel(
|
||||
val ansprechpartner: String,
|
||||
val email: String,
|
||||
val loginStatus: LoginStatus,
|
||||
val logoUrl: String? = null,
|
||||
val logoBase64: String? = null,
|
||||
)
|
||||
|
||||
+8
@@ -21,6 +21,8 @@ data class VeranstalterWizardState(
|
||||
val email: String = "",
|
||||
val telefon: String = "",
|
||||
val adresse: String = "",
|
||||
val logoUrl: String? = null,
|
||||
val logoBase64: String? = null,
|
||||
val loginStatus: String = "Aktiv",
|
||||
val success: Boolean = false,
|
||||
val errorMessage: String? = null
|
||||
@@ -35,6 +37,7 @@ sealed interface VeranstalterWizardIntent {
|
||||
data class UpdateEmail(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateTelefon(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateAdresse(val v: String) : VeranstalterWizardIntent
|
||||
data class UpdateLogo(val base64: String?) : VeranstalterWizardIntent
|
||||
data object Save : VeranstalterWizardIntent
|
||||
}
|
||||
|
||||
@@ -55,6 +58,7 @@ class VeranstalterWizardViewModel(
|
||||
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.UpdateLogo -> _state.value = _state.value.copy(logoBase64 = intent.base64)
|
||||
is VeranstalterWizardIntent.Save -> save()
|
||||
}
|
||||
}
|
||||
@@ -72,6 +76,8 @@ class VeranstalterWizardViewModel(
|
||||
email = v.email,
|
||||
telefon = v.telefon,
|
||||
adresse = v.adresse,
|
||||
logoUrl = v.logoUrl,
|
||||
logoBase64 = v.logoBase64,
|
||||
loginStatus = v.loginStatus
|
||||
)
|
||||
}.onFailure { t ->
|
||||
@@ -93,6 +99,8 @@ class VeranstalterWizardViewModel(
|
||||
email = s.email,
|
||||
telefon = s.telefon,
|
||||
adresse = s.adresse,
|
||||
logoUrl = s.logoUrl,
|
||||
logoBase64 = s.logoBase64,
|
||||
loginStatus = s.loginStatus
|
||||
)
|
||||
val result = if (s.editId != null) {
|
||||
|
||||
@@ -36,6 +36,7 @@ kotlin {
|
||||
implementation(projects.frontend.features.deviceInitialization)
|
||||
implementation(projects.frontend.features.znsImportFeature)
|
||||
implementation(projects.frontend.features.turnierFeature)
|
||||
implementation(projects.frontend.features.veranstalterFeature)
|
||||
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.runtime)
|
||||
|
||||
+12
-2
@@ -1,6 +1,5 @@
|
||||
package at.mocode.veranstaltung.feature.di
|
||||
|
||||
import at.mocode.frontend.core.domain.zns.ZnsImportProvider
|
||||
import at.mocode.veranstaltung.feature.presentation.EventWizardViewModel
|
||||
import at.mocode.veranstaltung.feature.presentation.VeranstaltungManagementViewModel
|
||||
import org.koin.core.qualifier.named
|
||||
@@ -8,5 +7,16 @@ import org.koin.dsl.module
|
||||
|
||||
val veranstaltungModule = module {
|
||||
factory { VeranstaltungManagementViewModel(get()) }
|
||||
factory { EventWizardViewModel(get(named("apiClient")), get(), get(), get(), get<ZnsImportProvider>(), get()) }
|
||||
factory { (veranstalterId: Long?) ->
|
||||
EventWizardViewModel(
|
||||
veranstalterIdParam = veranstalterId,
|
||||
httpClient = get(named("apiClient")),
|
||||
authTokenManager = get(),
|
||||
vereinRepository = get(),
|
||||
veranstalterRepository = get(),
|
||||
masterdataRepository = get(),
|
||||
znsImportProvider = get(),
|
||||
turnierWizardViewModel = get()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -13,6 +13,7 @@ import at.mocode.frontend.core.domain.zns.ZnsImportProvider
|
||||
import at.mocode.frontend.core.domain.zns.ZnsRemoteVerein
|
||||
import at.mocode.frontend.core.network.NetworkConfig
|
||||
import at.mocode.frontend.features.turnier.presentation.TurnierWizardViewModel
|
||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import at.mocode.frontend.features.verein.domain.VereinRepository
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.request.*
|
||||
@@ -64,9 +65,11 @@ data class VeranstaltungWizardState(
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
class EventWizardViewModel(
|
||||
private val veranstalterIdParam: Long?,
|
||||
private val httpClient: HttpClient,
|
||||
private val authTokenManager: AuthTokenManager,
|
||||
private val vereinRepository: VereinRepository,
|
||||
private val veranstalterRepository: VeranstalterRepository,
|
||||
private val masterdataRepository: MasterdataRepository,
|
||||
private val znsImportProvider: ZnsImportProvider,
|
||||
val turnierWizardViewModel: TurnierWizardViewModel // Injected Child-ViewModel
|
||||
@@ -80,6 +83,27 @@ class EventWizardViewModel(
|
||||
checkStammdatenStatus()
|
||||
// Simulation eines Initial-Datums
|
||||
state = state.copy(startDatum = LocalDate(2026, 4, 25), endDatum = LocalDate(2026, 4, 26))
|
||||
|
||||
if (veranstalterIdParam != null) {
|
||||
loadVeranstalterContext(veranstalterIdParam)
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadVeranstalterContext(id: Long) {
|
||||
viewModelScope.launch {
|
||||
val result = veranstalterRepository.getById(id)
|
||||
result.onSuccess { v ->
|
||||
setVeranstalter(
|
||||
id = Uuid.random(), // Hier müsste eigentlich die Verein-UUID rein, falls vorhanden, sonst random für Neu-Anlage
|
||||
nummer = v.oepsNummer,
|
||||
name = v.name,
|
||||
standardOrt = v.ort,
|
||||
logo = v.logoBase64 ?: v.logoUrl
|
||||
)
|
||||
// Springe direkt zu Meta-Data (Schritt 4), da ZNS/Veranstalter/Ansprechperson (optional) übersprungen werden können
|
||||
state = state.copy(currentStep = WizardStep.META_DATA)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun checkZnsAvailability() {
|
||||
|
||||
Reference in New Issue
Block a user