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