read method

Future<void> read()

Implementation

Future<void> read() async {
  state.loading();
  await UServices.hotel.readHotelReservations(
    p: UHotelReservationReadParams(
      pageNumber: pageNumber.value,
      pageSize: pageSize,
      hotelId: hotelFilter?.id ?? hotel?.id,
      roomId: room?.id,
      userName: guestFilter.text.nullIfEmpty(),
      tags: _statusTag == null ? null : <int>[_statusTag!],
      checkInDate: checkInFilter,
      checkOutDate: checkOutFilter,
      selectorArgs: const HotelReservationSelectorArgs(
        user: UserSelectorArgs(),
        room: HotelRoomSelectorArgs(hotel: HotelSelectorArgs()),
        hotel: HotelSelectorArgs(),
        invoice: HotelInvoiceSelectorArgs(),
      ),
    ),
    onOk: (UResponse<List<UHotelReservationResponse>> r) {
      list = r.result ?? <UHotelReservationResponse>[];
      setTotalPages(r.totalCount);
      setListState(isEmpty: list.isEmpty);
    },
    onError: (UResponse<dynamic> e) => setError(e.message),
    onException: (String e) => setError(),
  );
}