mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
Refactor SidebarBloc: streamline room data handling by using paginatedSpaces.data directly
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/booking_system/domain/models/bookable_room.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/booking_system/domain/services/booking_system_service.dart';
|
import 'package:syncrow_web/pages/access_management/booking_system/domain/services/booking_system_service.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/sidebar/sidebar_event.dart';
|
import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/sidebar/sidebar_event.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/sidebar/sidebar_state.dart';
|
import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/sidebar/sidebar_state.dart';
|
||||||
@ -104,24 +103,10 @@ class SidebarBloc extends Bloc<SidebarEvent, SidebarState> {
|
|||||||
size: _pageSize,
|
size: _pageSize,
|
||||||
search: _currentSearch,
|
search: _currentSearch,
|
||||||
);
|
);
|
||||||
final rooms = paginatedSpaces.data.map((space) {
|
|
||||||
return BookableSpaceModel(
|
|
||||||
uuid: space.uuid,
|
|
||||||
spaceName: space.spaceName,
|
|
||||||
virtualLocation: space.virtualLocation,
|
|
||||||
bookableConfig: BookableConfig(
|
|
||||||
uuid: space.bookableConfig.uuid,
|
|
||||||
daysAvailable: space.bookableConfig.daysAvailable,
|
|
||||||
startTime: space.bookableConfig.startTime,
|
|
||||||
endTime: space.bookableConfig.endTime,
|
|
||||||
active: space.bookableConfig.active,
|
|
||||||
points: space.bookableConfig.points,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}).toList();
|
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
allRooms: rooms,
|
allRooms: paginatedSpaces.data,
|
||||||
displayedRooms: rooms,
|
displayedRooms: paginatedSpaces.data,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
hasMore: paginatedSpaces.hasNext,
|
hasMore: paginatedSpaces.hasNext,
|
||||||
totalPages: paginatedSpaces.totalPage,
|
totalPages: paginatedSpaces.totalPage,
|
||||||
|
Reference in New Issue
Block a user