add payment ledger impl and payu impl
This commit is contained in:
@@ -25,6 +25,7 @@ import com.android.trisolarispms.ui.roomstay.ManageRoomStaySelection
|
||||
import com.android.trisolarispms.ui.roomstay.BookingRoomStaysScreen
|
||||
import com.android.trisolarispms.ui.roomstay.BookingDetailsTabsScreen
|
||||
import com.android.trisolarispms.ui.home.HomeScreen
|
||||
import com.android.trisolarispms.ui.payment.BookingPaymentsScreen
|
||||
import com.android.trisolarispms.ui.property.AddPropertyScreen
|
||||
import com.android.trisolarispms.ui.room.RoomFormScreen
|
||||
import com.android.trisolarispms.ui.room.RoomsScreen
|
||||
@@ -35,6 +36,8 @@ import com.android.trisolarispms.ui.roomimage.ImageTagsScreen
|
||||
import com.android.trisolarispms.ui.roomimage.AddImageTagScreen
|
||||
import com.android.trisolarispms.ui.roomimage.EditImageTagScreen
|
||||
import com.android.trisolarispms.ui.roomstay.ActiveRoomStaysScreen
|
||||
import com.android.trisolarispms.ui.payu.PayuSettingsScreen
|
||||
import com.android.trisolarispms.ui.payu.PayuQrScreen
|
||||
import com.android.trisolarispms.ui.roomtype.AddAmenityScreen
|
||||
import com.android.trisolarispms.ui.roomtype.AddRoomTypeScreen
|
||||
import com.android.trisolarispms.ui.roomtype.AmenitiesScreen
|
||||
@@ -83,6 +86,11 @@ class MainActivity : ComponentActivity() {
|
||||
it == "ADMIN" || it == "MANAGER" || it == "STAFF"
|
||||
} == true
|
||||
}
|
||||
val canManagePayuSettings: (String) -> Boolean = { propertyId ->
|
||||
state.isSuperAdmin || state.propertyRoles[propertyId]?.any {
|
||||
it == "ADMIN" || it == "MANAGER"
|
||||
} == true
|
||||
}
|
||||
|
||||
BackHandler(enabled = currentRoute != AppRoute.Home) {
|
||||
when (currentRoute) {
|
||||
@@ -114,6 +122,15 @@ class MainActivity : ComponentActivity() {
|
||||
currentRoute.propertyId,
|
||||
currentRoute.roomTypeId
|
||||
)
|
||||
is AppRoute.PayuSettings -> route.value = AppRoute.ActiveRoomStays(
|
||||
currentRoute.propertyId,
|
||||
selectedPropertyName.value ?: "Property"
|
||||
)
|
||||
is AppRoute.PayuQr -> route.value = AppRoute.BookingDetailsTabs(
|
||||
currentRoute.propertyId,
|
||||
currentRoute.bookingId,
|
||||
null
|
||||
)
|
||||
is AppRoute.CreateBooking -> route.value = AppRoute.ActiveRoomStays(
|
||||
currentRoute.propertyId,
|
||||
selectedPropertyName.value ?: "Property"
|
||||
@@ -157,6 +174,11 @@ class MainActivity : ComponentActivity() {
|
||||
currentRoute.propertyId,
|
||||
selectedPropertyName.value ?: "Property"
|
||||
)
|
||||
is AppRoute.BookingPayments -> route.value = AppRoute.BookingDetailsTabs(
|
||||
currentRoute.propertyId,
|
||||
currentRoute.bookingId,
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +275,8 @@ class MainActivity : ComponentActivity() {
|
||||
onBack = { route.value = AppRoute.Home },
|
||||
onViewRooms = { route.value = AppRoute.Rooms(currentRoute.propertyId) },
|
||||
onCreateBooking = { route.value = AppRoute.CreateBooking(currentRoute.propertyId) },
|
||||
showPayuSettings = canManagePayuSettings(currentRoute.propertyId),
|
||||
onPayuSettings = { route.value = AppRoute.PayuSettings(currentRoute.propertyId) },
|
||||
onManageRoomStay = { booking ->
|
||||
val fromAt = booking.checkInAt?.takeIf { it.isNotBlank() }
|
||||
?: booking.expectedCheckInAt.orEmpty()
|
||||
@@ -281,6 +305,28 @@ class MainActivity : ComponentActivity() {
|
||||
)
|
||||
}
|
||||
)
|
||||
is AppRoute.PayuSettings -> PayuSettingsScreen(
|
||||
propertyId = currentRoute.propertyId,
|
||||
onBack = {
|
||||
route.value = AppRoute.ActiveRoomStays(
|
||||
currentRoute.propertyId,
|
||||
selectedPropertyName.value ?: "Property"
|
||||
)
|
||||
}
|
||||
)
|
||||
is AppRoute.PayuQr -> PayuQrScreen(
|
||||
propertyId = currentRoute.propertyId,
|
||||
bookingId = currentRoute.bookingId,
|
||||
pendingAmount = currentRoute.pendingAmount,
|
||||
guestPhone = currentRoute.guestPhone,
|
||||
onBack = {
|
||||
route.value = AppRoute.BookingDetailsTabs(
|
||||
currentRoute.propertyId,
|
||||
currentRoute.bookingId,
|
||||
null
|
||||
)
|
||||
}
|
||||
)
|
||||
is AppRoute.ManageRoomStaySelect -> ManageRoomStaySelectScreen(
|
||||
propertyId = currentRoute.propertyId,
|
||||
bookingFromAt = currentRoute.fromAt,
|
||||
@@ -420,6 +466,32 @@ class MainActivity : ComponentActivity() {
|
||||
currentRoute.bookingId,
|
||||
guestId
|
||||
)
|
||||
},
|
||||
onOpenPayuQr = { pendingAmount, guestPhone ->
|
||||
route.value = AppRoute.PayuQr(
|
||||
propertyId = currentRoute.propertyId,
|
||||
bookingId = currentRoute.bookingId,
|
||||
pendingAmount = pendingAmount,
|
||||
guestPhone = guestPhone
|
||||
)
|
||||
},
|
||||
onOpenPayments = {
|
||||
route.value = AppRoute.BookingPayments(
|
||||
propertyId = currentRoute.propertyId,
|
||||
bookingId = currentRoute.bookingId
|
||||
)
|
||||
}
|
||||
)
|
||||
is AppRoute.BookingPayments -> BookingPaymentsScreen(
|
||||
propertyId = currentRoute.propertyId,
|
||||
bookingId = currentRoute.bookingId,
|
||||
canAddCash = canManagePayuSettings(currentRoute.propertyId),
|
||||
onBack = {
|
||||
route.value = AppRoute.BookingDetailsTabs(
|
||||
currentRoute.propertyId,
|
||||
currentRoute.bookingId,
|
||||
null
|
||||
)
|
||||
}
|
||||
)
|
||||
is AppRoute.Rooms -> RoomsScreen(
|
||||
|
||||
Reference in New Issue
Block a user