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