openBooking method

dynamic openBooking(
  1. BookingModel request
)

Implementation

openBooking(BookingModel request) async {
  final isSuperAdmin =
      authenticationController.userProfileModel.value.data?.isSuperAdmin ??
          false;
  final isAgent =
      authenticationController.userProfileModel.value.data?.isAgent ?? false;

  if (isSuperAdmin) {
    Get.toNamed(Routes.MANAGE_BOOKINGS, parameters: {'id': request.id ?? ''});
  }

  if (isAgent) {
    if (request.assignee != null) {
      Get.toNamed(Routes.MANAGE_BOOKINGS,
          parameters: {'id': request.id ?? ''});
    } else {
      DefaultSnackbar.show("Invalid booking",
          "you need to claim the booking first, before opening a booking.");
    }
  }
}