readDetail method
Loads one user's wallets, merchants and dorm contracts for the details part of the dialog.
Implementation
Future<void> readDetail(UUserResponse u) async {
detailState.loading();
final UUserResponse? full = (await UServices.user.readById(
p: UIdParams(id: u.id, selectorArgs: const UUserSelectorArgs(wallet: UWalletSelectorArgs(), merchant: UMerchantSelectorArgs())),
)).$1?.result;
wallets = full?.wallets ?? <UWalletResponse>[];
merchants = full?.merchants ?? <UMerchantResponse>[];
final (UResponse<List<UDormBedContractResponse>>? r, _, _) = await UServices.hotel.readDormBedContract(
p: UDormBedContractReadParams(
userId: u.id,
pageNumber: 1,
pageSize: 100,
selectorArgs: const UDormBedContractSelectorArgs(
bed: UDormBedSelectorArgs(room: UDormRoomSelectorArgs(dorm: UDormSelectorArgs())),
invoice: UDormBedInvoiceSelectorArgs(),
),
),
);
if (r == null) {
detailState.error();
return;
}
contracts = r.result ?? <UDormBedContractResponse>[];
detailState.loaded();
}