Fix amenities back navigation
This commit is contained in:
@@ -52,6 +52,7 @@ class MainActivity : ComponentActivity() {
|
||||
val selectedRoomType = remember { mutableStateOf<com.android.trisolarispms.data.api.model.RoomTypeDto?>(null) }
|
||||
val selectedAmenity = remember { mutableStateOf<com.android.trisolarispms.data.api.model.AmenityDto?>(null) }
|
||||
val roomFormKey = remember { mutableStateOf(0) }
|
||||
val amenitiesReturnRoute = remember { mutableStateOf<AppRoute>(AppRoute.Home) }
|
||||
val currentRoute = route.value
|
||||
val canManageProperty: (String) -> Boolean = { propertyId ->
|
||||
state.isSuperAdmin || (state.propertyRoles[propertyId]?.contains("ADMIN") == true)
|
||||
@@ -64,7 +65,10 @@ class MainActivity : ComponentActivity() {
|
||||
isSuperAdmin = state.isSuperAdmin,
|
||||
onAddProperty = { route.value = AppRoute.AddProperty },
|
||||
onAmenities = {
|
||||
selectedPropertyId.value?.let { route.value = AppRoute.Amenities(it) }
|
||||
selectedPropertyId.value?.let { propertyId ->
|
||||
amenitiesReturnRoute.value = AppRoute.Home
|
||||
route.value = AppRoute.Amenities(propertyId)
|
||||
}
|
||||
},
|
||||
refreshKey = refreshKey.value,
|
||||
selectedPropertyId = selectedPropertyId.value,
|
||||
@@ -132,7 +136,7 @@ class MainActivity : ComponentActivity() {
|
||||
)
|
||||
is AppRoute.Amenities -> AmenitiesScreen(
|
||||
propertyId = currentRoute.propertyId,
|
||||
onBack = { route.value = AppRoute.RoomTypes(currentRoute.propertyId) },
|
||||
onBack = { route.value = amenitiesReturnRoute.value },
|
||||
onAdd = { route.value = AppRoute.AddAmenity(currentRoute.propertyId) },
|
||||
canManageAmenities = state.isSuperAdmin,
|
||||
onEdit = {
|
||||
|
||||
Reference in New Issue
Block a user