activeScreen:improve menu
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.compose.foundation.lazy.grid.items
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material.icons.filled.People
|
||||
import androidx.compose.material.icons.filled.MeetingRoom
|
||||
import androidx.compose.material.icons.filled.Payment
|
||||
@@ -21,6 +22,8 @@ import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.FloatingActionButton
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
@@ -63,6 +66,7 @@ fun ActiveRoomStaysScreen(
|
||||
) {
|
||||
val state by viewModel.state.collectAsState()
|
||||
val selectedBooking = remember { mutableStateOf<BookingListItem?>(null) }
|
||||
val menuExpanded = remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(propertyId) {
|
||||
viewModel.load(propertyId)
|
||||
@@ -76,17 +80,40 @@ fun ActiveRoomStaysScreen(
|
||||
IconButton(onClick = onViewRooms) {
|
||||
Icon(Icons.Default.MeetingRoom, contentDescription = "Available Rooms")
|
||||
}
|
||||
IconButton(onClick = onOpenSettings) {
|
||||
Icon(Icons.Default.Settings, contentDescription = "Settings")
|
||||
IconButton(onClick = { menuExpanded.value = true }) {
|
||||
Icon(Icons.Default.MoreVert, contentDescription = "Menu")
|
||||
}
|
||||
if (showRazorpaySettings) {
|
||||
IconButton(onClick = onRazorpaySettings) {
|
||||
Icon(Icons.Default.Payment, contentDescription = "Razorpay Settings")
|
||||
DropdownMenu(
|
||||
expanded = menuExpanded.value,
|
||||
onDismissRequest = { menuExpanded.value = false }
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Settings") },
|
||||
leadingIcon = { Icon(Icons.Default.Settings, contentDescription = null) },
|
||||
onClick = {
|
||||
menuExpanded.value = false
|
||||
onOpenSettings()
|
||||
}
|
||||
)
|
||||
if (showRazorpaySettings) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Razorpay Settings") },
|
||||
leadingIcon = { Icon(Icons.Default.Payment, contentDescription = null) },
|
||||
onClick = {
|
||||
menuExpanded.value = false
|
||||
onRazorpaySettings()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
if (showUserAdmin) {
|
||||
IconButton(onClick = onUserAdmin) {
|
||||
Icon(Icons.Default.People, contentDescription = "Property Users")
|
||||
if (showUserAdmin) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Property Users") },
|
||||
leadingIcon = { Icon(Icons.Default.People, contentDescription = null) },
|
||||
onClick = {
|
||||
menuExpanded.value = false
|
||||
onUserAdmin()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -106,10 +133,10 @@ fun ActiveRoomStaysScreen(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
|
||||
state.error?.let {
|
||||
Text(text = it, color = MaterialTheme.colorScheme.error)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
state.error?.let {
|
||||
Text(text = it, color = MaterialTheme.colorScheme.error)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
}
|
||||
|
||||
if (!state.isLoading && state.error == null) {
|
||||
if (state.checkedInBookings.isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user