mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 16:09:40 +00:00
Compare commits
4 Commits
9d130139f7
...
0cb2875672
Author | SHA1 | Date | |
---|---|---|---|
0cb2875672 | |||
04fcf0a140 | |||
9396f37fea | |||
0e4d37ccac |
@ -4,6 +4,8 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
|||||||
|
|
||||||
class SvgTextButton extends StatelessWidget {
|
class SvgTextButton extends StatelessWidget {
|
||||||
final String svgAsset;
|
final String svgAsset;
|
||||||
|
final double? horizontalPadding;
|
||||||
|
final double? verticalPadding;
|
||||||
final String label;
|
final String label;
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
final Color backgroundColor;
|
final Color backgroundColor;
|
||||||
@ -25,6 +27,8 @@ class SvgTextButton extends StatelessWidget {
|
|||||||
this.svgColor = const Color(0xFF496EFF),
|
this.svgColor = const Color(0xFF496EFF),
|
||||||
this.labelColor = Colors.black,
|
this.labelColor = Colors.black,
|
||||||
this.borderRadius = 10.0,
|
this.borderRadius = 10.0,
|
||||||
|
this.horizontalPadding,
|
||||||
|
this.verticalPadding,
|
||||||
this.boxShadow = const [
|
this.boxShadow = const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: ColorsManager.lightGrayColor,
|
color: ColorsManager.lightGrayColor,
|
||||||
@ -43,7 +47,9 @@ class SvgTextButton extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(borderRadius),
|
borderRadius: BorderRadius.circular(borderRadius),
|
||||||
onTap: onPressed,
|
onTap: onPressed,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: horizontalPadding ?? 24,
|
||||||
|
vertical: verticalPadding ?? 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
borderRadius: BorderRadius.circular(borderRadius),
|
borderRadius: BorderRadius.circular(borderRadius),
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/non_bookable_spaces_params.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/non_bookable_spaces_params.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/send_bookable_spaces_to_api_params.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/service/non_bookable_spaces_service.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/service/non_bookable_spaces_service.dart';
|
||||||
import 'package:syncrow_web/pages/space_management_v2/main_module/shared/models/paginated_data_model.dart';
|
import 'package:syncrow_web/pages/space_management_v2/main_module/shared/models/paginated_data_model.dart';
|
||||||
|
|
||||||
@ -13,24 +11,13 @@ part 'non_bookaable_spaces_state.dart';
|
|||||||
class NonBookableSpacesBloc
|
class NonBookableSpacesBloc
|
||||||
extends Bloc<NonBookableSpacesEvent, NonBookableSpacesState> {
|
extends Bloc<NonBookableSpacesEvent, NonBookableSpacesState> {
|
||||||
NonBookableSpacesService nonBookableSpacesService;
|
NonBookableSpacesService nonBookableSpacesService;
|
||||||
List<BookableSpacemodel> selectedBookableSpaces = [];
|
|
||||||
NonBookableSpacesBloc(this.nonBookableSpacesService)
|
NonBookableSpacesBloc(this.nonBookableSpacesService)
|
||||||
: super(NonBookableSpacesInitial()) {
|
: super(NonBookableSpacesInitial()) {
|
||||||
on<CallInitStateEvent>(_onCallInitStateEvent);
|
on<CallInitStateEvent>(_onCallInitStateEvent);
|
||||||
on<LoadUnBookableSpacesEvent>(_onLoadUnBookableSpacesEvent);
|
on<LoadUnBookableSpacesEvent>(_onLoadUnBookableSpacesEvent);
|
||||||
on<AddToBookableSpaceEvent>(_onAddToBookableSpaceEvent);
|
|
||||||
on<RemoveFromBookableSpaceEvent>(_onRemoveFromBookableSpaceEvent);
|
|
||||||
on<SendBookableSpacesToApi>(_onSendBookableSpacesToApi);
|
|
||||||
on<CheckConfigurValidityEvent>(_onCheckConfigurValidityEvent);
|
|
||||||
on<EditModeSelected>(_onEditModeSelected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeOfDay? get endTime =>
|
|
||||||
selectedBookableSpaces.first.spaceConfig!.bookingEndTime;
|
|
||||||
|
|
||||||
TimeOfDay? get startTime =>
|
|
||||||
selectedBookableSpaces.first.spaceConfig!.bookingStartTime;
|
|
||||||
|
|
||||||
void _onCallInitStateEvent(
|
void _onCallInitStateEvent(
|
||||||
CallInitStateEvent event, Emitter<NonBookableSpacesState> emit) {
|
CallInitStateEvent event, Emitter<NonBookableSpacesState> emit) {
|
||||||
emit(NonBookableSpacesInitial());
|
emit(NonBookableSpacesInitial());
|
||||||
@ -75,76 +62,4 @@ class NonBookableSpacesBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onAddToBookableSpaceEvent(
|
|
||||||
AddToBookableSpaceEvent event,
|
|
||||||
Emitter<NonBookableSpacesState> emit,
|
|
||||||
) {
|
|
||||||
if (state is NonBookableSpacesLoaded) {
|
|
||||||
final currentState = state as NonBookableSpacesLoaded;
|
|
||||||
emit(AddNonBookableSpaceIntoBookableState());
|
|
||||||
final updatedSelectedSpaces =
|
|
||||||
List<BookableSpacemodel>.from(currentState.selectedBookableSpaces)
|
|
||||||
..add(event.nonBookableSpace);
|
|
||||||
|
|
||||||
selectedBookableSpaces.add(event.nonBookableSpace);
|
|
||||||
|
|
||||||
emit(
|
|
||||||
NonBookableSpacesLoaded(
|
|
||||||
nonBookableSpaces: currentState.nonBookableSpaces,
|
|
||||||
selectedBookableSpaces: updatedSelectedSpaces,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onRemoveFromBookableSpaceEvent(RemoveFromBookableSpaceEvent event,
|
|
||||||
Emitter<NonBookableSpacesState> emit) {
|
|
||||||
if (state is NonBookableSpacesLoaded) {
|
|
||||||
final currentState = state as NonBookableSpacesLoaded;
|
|
||||||
emit(RemoveBookableSpaceIntoNonBookableState());
|
|
||||||
if (currentState.selectedBookableSpaces.isNotEmpty) {
|
|
||||||
currentState.selectedBookableSpaces.remove(event.bookableSpace);
|
|
||||||
}
|
|
||||||
selectedBookableSpaces.remove(event.bookableSpace);
|
|
||||||
emit(
|
|
||||||
NonBookableSpacesLoaded(
|
|
||||||
nonBookableSpaces: currentState.nonBookableSpaces,
|
|
||||||
selectedBookableSpaces: currentState.selectedBookableSpaces,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onSendBookableSpacesToApi(SendBookableSpacesToApi event,
|
|
||||||
Emitter<NonBookableSpacesState> emit) async {
|
|
||||||
emit(const NonBookableSpacesLoading());
|
|
||||||
try {
|
|
||||||
await nonBookableSpacesService.sendBookableSpacesToApi(
|
|
||||||
SendBookableSpacesToApiParams.fromBookableSpacesModel(
|
|
||||||
selectedBookableSpaces,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
add(CallInitStateEvent());
|
|
||||||
} catch (e) {
|
|
||||||
emit(
|
|
||||||
NonBookableSpacesError(e.toString()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onCheckConfigurValidityEvent(
|
|
||||||
CheckConfigurValidityEvent event, Emitter<NonBookableSpacesState> emit) {
|
|
||||||
if (selectedBookableSpaces.first.spaceConfig!.isValid) {
|
|
||||||
emit(ValidSaveButtonState());
|
|
||||||
} else {
|
|
||||||
emit(UnValidSaveButtonState());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onEditModeSelected(
|
|
||||||
EditModeSelected event, Emitter<NonBookableSpacesState> emit) {
|
|
||||||
selectedBookableSpaces.clear();
|
|
||||||
selectedBookableSpaces.add(event.editingBookableSpace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,28 +15,3 @@ class LoadUnBookableSpacesEvent extends NonBookableSpacesEvent {
|
|||||||
required this.nonBookableSpacesParams,
|
required this.nonBookableSpacesParams,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddToBookableSpaceEvent extends NonBookableSpacesEvent {
|
|
||||||
final BookableSpacemodel nonBookableSpace;
|
|
||||||
const AddToBookableSpaceEvent({
|
|
||||||
required this.nonBookableSpace,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class RemoveFromBookableSpaceEvent extends NonBookableSpacesEvent {
|
|
||||||
final BookableSpacemodel bookableSpace;
|
|
||||||
const RemoveFromBookableSpaceEvent({
|
|
||||||
required this.bookableSpace,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class SendBookableSpacesToApi extends NonBookableSpacesEvent {}
|
|
||||||
|
|
||||||
class CheckConfigurValidityEvent extends NonBookableSpacesEvent {}
|
|
||||||
|
|
||||||
class EditModeSelected extends NonBookableSpacesEvent {
|
|
||||||
final BookableSpacemodel editingBookableSpace;
|
|
||||||
const EditModeSelected({
|
|
||||||
required this.editingBookableSpace,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@ -30,10 +30,3 @@ class NonBookableSpacesError extends NonBookableSpacesState {
|
|||||||
const NonBookableSpacesError(this.error);
|
const NonBookableSpacesError(this.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
class AddNonBookableSpaceIntoBookableState extends NonBookableSpacesState {}
|
|
||||||
|
|
||||||
class RemoveBookableSpaceIntoNonBookableState extends NonBookableSpacesState {}
|
|
||||||
|
|
||||||
class ValidSaveButtonState extends NonBookableSpacesState {}
|
|
||||||
|
|
||||||
class UnValidSaveButtonState extends NonBookableSpacesState {}
|
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
import 'package:bloc/bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/send_bookable_spaces_to_api_params.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/service/non_bookable_spaces_service.dart';
|
||||||
|
|
||||||
|
part 'setup_bookable_spaces_event.dart';
|
||||||
|
part 'setup_bookable_spaces_state.dart';
|
||||||
|
|
||||||
|
class SetupBookableSpacesBloc
|
||||||
|
extends Bloc<SetupBookableSpacesEvent, SetupBookableSpacesState> {
|
||||||
|
NonBookableSpacesService nonBookableSpacesService;
|
||||||
|
List<BookableSpacemodel> selectedBookableSpaces = [];
|
||||||
|
SetupBookableSpacesBloc(this.nonBookableSpacesService)
|
||||||
|
: super(SetupBookableSpacesInitial()) {
|
||||||
|
on<AddToBookableSpaceEvent>(_onAddToBookableSpaceEvent);
|
||||||
|
on<RemoveFromBookableSpaceEvent>(_onRemoveFromBookableSpaceEvent);
|
||||||
|
on<SendBookableSpacesToApi>(_onSendBookableSpacesToApi);
|
||||||
|
on<CheckConfigurValidityEvent>(_onCheckConfigurValidityEvent);
|
||||||
|
on<EditModeSelected>(_onEditModeSelected);
|
||||||
|
}
|
||||||
|
TimeOfDay? get endTime =>
|
||||||
|
selectedBookableSpaces.first.spaceConfig!.bookingEndTime;
|
||||||
|
|
||||||
|
TimeOfDay? get startTime =>
|
||||||
|
selectedBookableSpaces.first.spaceConfig!.bookingStartTime;
|
||||||
|
|
||||||
|
void _onAddToBookableSpaceEvent(
|
||||||
|
AddToBookableSpaceEvent event,
|
||||||
|
Emitter<SetupBookableSpacesState> emit,
|
||||||
|
) {
|
||||||
|
emit(InProgressState());
|
||||||
|
selectedBookableSpaces.add(event.nonBookableSpace);
|
||||||
|
emit(AddNonBookableSpaceIntoBookableState(
|
||||||
|
bookableSpaces: selectedBookableSpaces));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onRemoveFromBookableSpaceEvent(RemoveFromBookableSpaceEvent event,
|
||||||
|
Emitter<SetupBookableSpacesState> emit) {
|
||||||
|
emit(InProgressState());
|
||||||
|
selectedBookableSpaces.remove(event.bookableSpace);
|
||||||
|
emit(RemoveBookableSpaceIntoNonBookableState(
|
||||||
|
bookableSpaces: selectedBookableSpaces));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onSendBookableSpacesToApi(SendBookableSpacesToApi event,
|
||||||
|
Emitter<SetupBookableSpacesState> emit) async {
|
||||||
|
emit(SendBookableSpacesLoading());
|
||||||
|
try {
|
||||||
|
await nonBookableSpacesService.sendBookableSpacesToApi(
|
||||||
|
SendBookableSpacesToApiParams.fromBookableSpacesModel(
|
||||||
|
selectedBookableSpaces,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
emit(SendBookableSpacesSuccess());
|
||||||
|
} catch (e) {
|
||||||
|
emit(
|
||||||
|
SendBookableSpacesError(e.toString()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onCheckConfigurValidityEvent(CheckConfigurValidityEvent event,
|
||||||
|
Emitter<SetupBookableSpacesState> emit) {
|
||||||
|
if (selectedBookableSpaces.first.spaceConfig!.isValid) {
|
||||||
|
emit(ValidSaveButtonState());
|
||||||
|
} else {
|
||||||
|
emit(UnValidSaveButtonState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onEditModeSelected(
|
||||||
|
EditModeSelected event, Emitter<SetupBookableSpacesState> emit) {
|
||||||
|
selectedBookableSpaces.clear();
|
||||||
|
selectedBookableSpaces.add(event.editingBookableSpace);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
part of 'setup_bookable_spaces_bloc.dart';
|
||||||
|
|
||||||
|
sealed class SetupBookableSpacesEvent extends Equatable {
|
||||||
|
const SetupBookableSpacesEvent();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
class AddToBookableSpaceEvent extends SetupBookableSpacesEvent {
|
||||||
|
final BookableSpacemodel nonBookableSpace;
|
||||||
|
const AddToBookableSpaceEvent({
|
||||||
|
required this.nonBookableSpace,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoveFromBookableSpaceEvent extends SetupBookableSpacesEvent {
|
||||||
|
final BookableSpacemodel bookableSpace;
|
||||||
|
const RemoveFromBookableSpaceEvent({
|
||||||
|
required this.bookableSpace,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class SendBookableSpacesToApi extends SetupBookableSpacesEvent {}
|
||||||
|
|
||||||
|
class CheckConfigurValidityEvent extends SetupBookableSpacesEvent {}
|
||||||
|
|
||||||
|
class EditModeSelected extends SetupBookableSpacesEvent {
|
||||||
|
final BookableSpacemodel editingBookableSpace;
|
||||||
|
const EditModeSelected({
|
||||||
|
required this.editingBookableSpace,
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
part of 'setup_bookable_spaces_bloc.dart';
|
||||||
|
|
||||||
|
sealed class SetupBookableSpacesState extends Equatable {
|
||||||
|
const SetupBookableSpacesState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final class SetupBookableSpacesInitial extends SetupBookableSpacesState {}
|
||||||
|
|
||||||
|
class AddNonBookableSpaceIntoBookableState extends SetupBookableSpacesState {
|
||||||
|
final List<BookableSpacemodel> bookableSpaces;
|
||||||
|
const AddNonBookableSpaceIntoBookableState({
|
||||||
|
required this.bookableSpaces,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class InProgressState extends SetupBookableSpacesState {}
|
||||||
|
|
||||||
|
class RemoveBookableSpaceIntoNonBookableState extends SetupBookableSpacesState {
|
||||||
|
final List<BookableSpacemodel> bookableSpaces;
|
||||||
|
const RemoveBookableSpaceIntoNonBookableState({
|
||||||
|
required this.bookableSpaces,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidSaveButtonState extends SetupBookableSpacesState {}
|
||||||
|
|
||||||
|
class UnValidSaveButtonState extends SetupBookableSpacesState {}
|
||||||
|
|
||||||
|
class SendBookableSpacesLoading extends SetupBookableSpacesState {}
|
||||||
|
|
||||||
|
class SendBookableSpacesSuccess extends SetupBookableSpacesState {}
|
||||||
|
|
||||||
|
class SendBookableSpacesError extends SetupBookableSpacesState {
|
||||||
|
final String error;
|
||||||
|
const SendBookableSpacesError(this.error);
|
||||||
|
}
|
@ -61,7 +61,10 @@ class ManageBookableSpacesWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10,
|
||||||
|
horizontal: 35,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -75,7 +78,7 @@ class ManageBookableSpacesWidget extends StatelessWidget {
|
|||||||
child: TableOfBookableSpacesWidget(),
|
child: TableOfBookableSpacesWidget(),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 15,
|
||||||
),
|
),
|
||||||
const Expanded(
|
const Expanded(
|
||||||
flex: 5,
|
flex: 5,
|
||||||
|
@ -4,6 +4,7 @@ import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/data/
|
|||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/non_bookable_spaces_params.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/non_bookable_spaces_params.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/steps_cubit/cubit/steps_cubit.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/steps_cubit/cubit/steps_cubit.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/details_steps_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/details_steps_widget.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/next_first_step_button.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/next_first_step_button.dart';
|
||||||
@ -42,22 +43,25 @@ class _SetupBookableSpacesDialogState extends State<SetupBookableSpacesDialog> {
|
|||||||
: (context) => StepsCubit()..editValueInit(),
|
: (context) => StepsCubit()..editValueInit(),
|
||||||
),
|
),
|
||||||
BlocProvider<NonBookableSpacesBloc>(
|
BlocProvider<NonBookableSpacesBloc>(
|
||||||
create: widget.editingBookableSpace == null
|
create: (context) => NonBookableSpacesBloc(
|
||||||
? (context) => NonBookableSpacesBloc(
|
RemoteNonBookableSpaces(HTTPService()),
|
||||||
RemoteNonBookableSpaces(HTTPService()),
|
)..add(
|
||||||
)..add(
|
LoadUnBookableSpacesEvent(
|
||||||
LoadUnBookableSpacesEvent(
|
nonBookableSpacesParams:
|
||||||
nonBookableSpacesParams:
|
NonBookableSpacesParams(currentPage: 1),
|
||||||
NonBookableSpacesParams(currentPage: 1),
|
),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
: (context) => NonBookableSpacesBloc(
|
|
||||||
RemoteNonBookableSpaces(HTTPService()),
|
|
||||||
)..add(
|
|
||||||
EditModeSelected(
|
|
||||||
editingBookableSpace: widget.editingBookableSpace!),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
BlocProvider<SetupBookableSpacesBloc>(
|
||||||
|
create: widget.editingBookableSpace == null
|
||||||
|
? (context) => SetupBookableSpacesBloc(
|
||||||
|
RemoteNonBookableSpaces(HTTPService()))
|
||||||
|
: (context) => SetupBookableSpacesBloc(
|
||||||
|
RemoteNonBookableSpaces(HTTPService()))
|
||||||
|
..add(EditModeSelected(
|
||||||
|
editingBookableSpace: widget.editingBookableSpace!,
|
||||||
|
)),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
child: AlertDialog(
|
child: AlertDialog(
|
||||||
backgroundColor: ColorsManager.whiteColors,
|
backgroundColor: ColorsManager.whiteColors,
|
||||||
@ -101,8 +105,10 @@ class _SetupBookableSpacesDialogState extends State<SetupBookableSpacesDialog> {
|
|||||||
),
|
),
|
||||||
Builder(builder: (context) {
|
Builder(builder: (context) {
|
||||||
final stepsState = context.watch<StepsCubit>().state;
|
final stepsState = context.watch<StepsCubit>().state;
|
||||||
final nonBookableBloc = context.watch<NonBookableSpacesBloc>();
|
final setupBookableSpacesBloc =
|
||||||
final selectedSpaces = nonBookableBloc.selectedBookableSpaces;
|
context.watch<SetupBookableSpacesBloc>();
|
||||||
|
final selectedSpaces =
|
||||||
|
setupBookableSpacesBloc.selectedBookableSpaces;
|
||||||
return stepsState is StepOneState
|
return stepsState is StepOneState
|
||||||
? NextFirstStepButton(selectedSpaces: selectedSpaces)
|
? NextFirstStepButton(selectedSpaces: selectedSpaces)
|
||||||
: SaveSecondStepButton(
|
: SaveSecondStepButton(
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/update_bookable_space_param.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/bookable_spaces_bloc/bookable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/update_bookable_spaces/update_bookable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_management_v2/main_module/shared/models/paginated_data_model.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
|
class BookableSpaceSwitchActivationWidget extends StatelessWidget {
|
||||||
|
final PaginatedDataModel<BookableSpacemodel> bookableSpaces;
|
||||||
|
final BookableSpacemodel space;
|
||||||
|
const BookableSpaceSwitchActivationWidget({
|
||||||
|
super.key,
|
||||||
|
required this.bookableSpaces,
|
||||||
|
required this.space,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Transform.scale(
|
||||||
|
scale: 0.7,
|
||||||
|
child:
|
||||||
|
BlocConsumer<UpdateBookableSpacesBloc, UpdateBookableSpacesState>(
|
||||||
|
listener: (context, updateState) {
|
||||||
|
if (updateState is UpdateBookableSpaceSuccess) {
|
||||||
|
context.read<BookableSpacesBloc>().add(
|
||||||
|
InsertUpdatedSpaceEvent(
|
||||||
|
bookableSpaces: bookableSpaces,
|
||||||
|
bookableSpace: space,
|
||||||
|
updatedBookableSpaceConfig:
|
||||||
|
updateState.bookableSpaceConfig,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (context, updateState) {
|
||||||
|
final isLoading = updateState is UpdateBookableSpaceLoading &&
|
||||||
|
updateState.updatingSpaceUuid == space.spaceUuid;
|
||||||
|
if (isLoading) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
return Switch(
|
||||||
|
trackOutlineColor: WidgetStateProperty.resolveWith<Color>(
|
||||||
|
(Set<WidgetState> states) {
|
||||||
|
return ColorsManager.whiteColors;
|
||||||
|
}),
|
||||||
|
value: space.spaceConfig!.availability,
|
||||||
|
activeTrackColor: ColorsManager.blueColor,
|
||||||
|
inactiveTrackColor: ColorsManager.grayBorder,
|
||||||
|
thumbColor: WidgetStateProperty.resolveWith<Color>(
|
||||||
|
(Set<WidgetState> states) {
|
||||||
|
return ColorsManager.whiteColors;
|
||||||
|
}),
|
||||||
|
onChanged: (value) {
|
||||||
|
context.read<UpdateBookableSpacesBloc>().add(
|
||||||
|
UpdateBookableSpace(
|
||||||
|
updatedParams: UpdateBookableSpaceParam(
|
||||||
|
spaceUuid: space.spaceUuid,
|
||||||
|
availability: value,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/time_picker_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/time_picker_widget.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
@ -50,11 +50,12 @@ class BookingPeriodWidget extends StatelessWidget {
|
|||||||
if (timePicked == null) {
|
if (timePicked == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final nonBookableBloc = context.read<NonBookableSpacesBloc>();
|
final setupBookableSpacesBloc =
|
||||||
|
context.read<SetupBookableSpacesBloc>();
|
||||||
|
|
||||||
if (nonBookableBloc.endTime != null &&
|
if (setupBookableSpacesBloc.endTime != null &&
|
||||||
isEndTimeAfterStartTime(
|
isEndTimeAfterStartTime(
|
||||||
timePicked, nonBookableBloc.endTime!)) {
|
timePicked, setupBookableSpacesBloc.endTime!)) {
|
||||||
ScaffoldMessenger.of(context).clearSnackBars();
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content:
|
content:
|
||||||
@ -64,7 +65,7 @@ class BookingPeriodWidget extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
throw Exception();
|
throw Exception();
|
||||||
} else {
|
} else {
|
||||||
nonBookableBloc.selectedBookableSpaces.forEach(
|
setupBookableSpacesBloc.selectedBookableSpaces.forEach(
|
||||||
(e) => e.spaceConfig!.bookingStartTime = timePicked,
|
(e) => e.spaceConfig!.bookingStartTime = timePicked,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -83,10 +84,11 @@ class BookingPeriodWidget extends StatelessWidget {
|
|||||||
if (timePicked == null) {
|
if (timePicked == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final nonBookableBloc = context.read<NonBookableSpacesBloc>();
|
final setupBookableSpacesBloc =
|
||||||
if (nonBookableBloc.startTime != null &&
|
context.read<SetupBookableSpacesBloc>();
|
||||||
|
if (setupBookableSpacesBloc.startTime != null &&
|
||||||
isEndTimeAfterStartTime(
|
isEndTimeAfterStartTime(
|
||||||
nonBookableBloc.startTime!, timePicked)) {
|
setupBookableSpacesBloc.startTime!, timePicked)) {
|
||||||
ScaffoldMessenger.of(context).clearSnackBars();
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content:
|
content:
|
||||||
@ -96,7 +98,7 @@ class BookingPeriodWidget extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
throw Exception();
|
throw Exception();
|
||||||
} else {
|
} else {
|
||||||
nonBookableBloc.selectedBookableSpaces.forEach(
|
setupBookableSpacesBloc.selectedBookableSpaces.forEach(
|
||||||
(e) => e.spaceConfig!.bookingEndTime = timePicked,
|
(e) => e.spaceConfig!.bookingEndTime = timePicked,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
class CheckBoxSpaceWidget extends StatelessWidget {
|
class CheckBoxSpaceWidget extends StatelessWidget {
|
||||||
final BookableSpacemodel nonBookableSpace;
|
final BookableSpacemodel nonBookableSpace;
|
||||||
@ -15,33 +16,58 @@ class CheckBoxSpaceWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isChecked = selectedSpaces.any(
|
|
||||||
(element) => element.spaceUuid == nonBookableSpace.spaceUuid,
|
|
||||||
);
|
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Checkbox(
|
BlocBuilder<SetupBookableSpacesBloc, SetupBookableSpacesState>(
|
||||||
value: isChecked,
|
builder: (context, state) {
|
||||||
onChanged: (value) {
|
final isChecked = switch (state) {
|
||||||
final bloc = context.read<NonBookableSpacesBloc>();
|
AddNonBookableSpaceIntoBookableState(
|
||||||
if (value ?? false) {
|
bookableSpaces: final spaces
|
||||||
bloc.add(
|
) =>
|
||||||
AddToBookableSpaceEvent(
|
spaces.any((s) => s.spaceUuid == nonBookableSpace.spaceUuid),
|
||||||
nonBookableSpace: nonBookableSpace,
|
RemoveBookableSpaceIntoNonBookableState(
|
||||||
),
|
bookableSpaces: final spaces
|
||||||
);
|
) =>
|
||||||
} else {
|
spaces.any((s) => s.spaceUuid == nonBookableSpace.spaceUuid),
|
||||||
bloc.add(
|
_ => false,
|
||||||
RemoveFromBookableSpaceEvent(
|
};
|
||||||
bookableSpace: nonBookableSpace,
|
|
||||||
),
|
return Checkbox(
|
||||||
);
|
value: isChecked,
|
||||||
}
|
onChanged: (value) {
|
||||||
|
final bloc = context.read<SetupBookableSpacesBloc>();
|
||||||
|
if (value ?? false) {
|
||||||
|
bloc.add(AddToBookableSpaceEvent(
|
||||||
|
nonBookableSpace: nonBookableSpace));
|
||||||
|
} else {
|
||||||
|
bloc.add(RemoveFromBookableSpaceEvent(
|
||||||
|
bookableSpace: nonBookableSpace));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
Expanded(child: Text(nonBookableSpace.spaceName)),
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
nonBookableSpace.spaceName,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
nonBookableSpace.spaceVirtualAddress,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/data/remote_update_bookable_space_service.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/bookable_spaces_bloc/bookable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/update_bookable_spaces/update_bookable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/screens/setup_bookable_spaces_dialog.dart';
|
||||||
|
import 'package:syncrow_web/services/api/http_service.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
|
class EditBookableSpaceButtonWidget extends StatelessWidget {
|
||||||
|
final BookableSpacemodel? space;
|
||||||
|
const EditBookableSpaceButtonWidget({
|
||||||
|
super.key,
|
||||||
|
required this.space,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
final bookableBloc = context.read<BookableSpacesBloc>();
|
||||||
|
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => MultiBlocProvider(
|
||||||
|
providers: [
|
||||||
|
BlocProvider.value(
|
||||||
|
value: bookableBloc,
|
||||||
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (context) => UpdateBookableSpacesBloc(
|
||||||
|
RemoteUpdateBookableSpaceService(HTTPService()),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: SetupBookableSpacesDialog(
|
||||||
|
editingBookableSpace: space,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
fixedSize: const Size(50, 30),
|
||||||
|
elevation: 1,
|
||||||
|
),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.settings,
|
||||||
|
height: 15,
|
||||||
|
color: ColorsManager.blue1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/data/remote_update_bookable_space_service.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/bookable_spaces_params.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/bookable_spaces_params.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/update_bookable_space_param.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/bookable_spaces_bloc/bookable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/bookable_spaces_bloc/bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/update_bookable_spaces/update_bookable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/bookable_space_switch_activation_widget.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/screens/setup_bookable_spaces_dialog.dart';
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/custom_data_table.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/custom_data_table.dart';
|
||||||
import 'package:syncrow_web/services/api/http_service.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/edit_bookable_space_button_widget.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
|
|
||||||
class TableOfBookableSpacesWidget extends StatelessWidget {
|
class TableOfBookableSpacesWidget extends StatelessWidget {
|
||||||
const TableOfBookableSpacesWidget({
|
const TableOfBookableSpacesWidget({
|
||||||
@ -43,12 +37,9 @@ class TableOfBookableSpacesWidget extends StatelessWidget {
|
|||||||
items: state.bookableSpacesList.data,
|
items: state.bookableSpacesList.data,
|
||||||
cellsWidgets: (space) => [
|
cellsWidgets: (space) => [
|
||||||
DataCell(
|
DataCell(
|
||||||
Padding(
|
DataCellWidget(
|
||||||
padding: const EdgeInsetsGeometry.only(left: 10),
|
title: space.spaceName,
|
||||||
child: Text(
|
),
|
||||||
space.spaceName,
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
DataCell(Padding(
|
DataCell(Padding(
|
||||||
padding: const EdgeInsetsGeometry.only(left: 10),
|
padding: const EdgeInsetsGeometry.only(left: 10),
|
||||||
@ -62,123 +53,33 @@ class TableOfBookableSpacesWidget extends StatelessWidget {
|
|||||||
child: Wrap(
|
child: Wrap(
|
||||||
spacing: 4,
|
spacing: 4,
|
||||||
children: space.spaceConfig!.bookableDays
|
children: space.spaceConfig!.bookableDays
|
||||||
.map((day) => Text(
|
.map(
|
||||||
day,
|
(day) => DataCellWidget(title: day),
|
||||||
style: const TextStyle(fontSize: 11),
|
)
|
||||||
))
|
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
DataCell(
|
DataCell(
|
||||||
Padding(
|
DataCellWidget(
|
||||||
padding: const EdgeInsetsGeometry.only(left: 10),
|
title: space.spaceConfig!.bookingStartTime!.format(context),
|
||||||
child: Text(
|
|
||||||
space.spaceConfig!.bookingStartTime!.format(context),
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
Padding(
|
DataCellWidget(
|
||||||
padding: const EdgeInsetsGeometry.only(left: 10),
|
title: space.spaceConfig!.bookingEndTime!.format(context),
|
||||||
child: Text(
|
|
||||||
space.spaceConfig!.bookingEndTime!.format(context),
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(Padding(
|
DataCell(
|
||||||
padding: const EdgeInsetsGeometry.only(left: 10),
|
DataCellWidget(
|
||||||
child: Text(
|
title: '${space.spaceConfig!.cost} Points',
|
||||||
'${space.spaceConfig!.cost} Points',
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
))),
|
|
||||||
DataCell(Center(
|
|
||||||
child: Transform.scale(
|
|
||||||
scale: 0.7,
|
|
||||||
child: BlocConsumer<UpdateBookableSpacesBloc,
|
|
||||||
UpdateBookableSpacesState>(
|
|
||||||
listener: (context, updateState) {
|
|
||||||
if (updateState is UpdateBookableSpaceSuccess) {
|
|
||||||
context.read<BookableSpacesBloc>().add(
|
|
||||||
InsertUpdatedSpaceEvent(
|
|
||||||
bookableSpaces: state.bookableSpacesList,
|
|
||||||
bookableSpace: space,
|
|
||||||
updatedBookableSpaceConfig:
|
|
||||||
updateState.bookableSpaceConfig,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
builder: (context, updateState) {
|
|
||||||
final isLoading =
|
|
||||||
updateState is UpdateBookableSpaceLoading &&
|
|
||||||
updateState.updatingSpaceUuid == space.spaceUuid;
|
|
||||||
if (isLoading) {
|
|
||||||
return const Center(child: CircularProgressIndicator());
|
|
||||||
}
|
|
||||||
return Switch(
|
|
||||||
trackOutlineColor:
|
|
||||||
WidgetStateProperty.resolveWith<Color>(
|
|
||||||
(Set<WidgetState> states) {
|
|
||||||
return ColorsManager.whiteColors;
|
|
||||||
}),
|
|
||||||
value: space.spaceConfig!.availability,
|
|
||||||
activeTrackColor: ColorsManager.blueColor,
|
|
||||||
inactiveTrackColor: ColorsManager.grayBorder,
|
|
||||||
thumbColor: WidgetStateProperty.resolveWith<Color>(
|
|
||||||
(Set<WidgetState> states) {
|
|
||||||
return ColorsManager.whiteColors;
|
|
||||||
}),
|
|
||||||
onChanged: (value) {
|
|
||||||
context.read<UpdateBookableSpacesBloc>().add(
|
|
||||||
UpdateBookableSpace(
|
|
||||||
updatedParams: UpdateBookableSpaceParam(
|
|
||||||
spaceUuid: space.spaceUuid,
|
|
||||||
availability: value,
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
DataCell(BookableSpaceSwitchActivationWidget(
|
||||||
|
bookableSpaces: state.bookableSpacesList,
|
||||||
|
space: space,
|
||||||
)),
|
)),
|
||||||
DataCell(Center(
|
DataCell(EditBookableSpaceButtonWidget(
|
||||||
child: ElevatedButton(
|
space: space,
|
||||||
onPressed: () {
|
|
||||||
final bookableBloc = context.read<BookableSpacesBloc>();
|
|
||||||
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => MultiBlocProvider(
|
|
||||||
providers: [
|
|
||||||
BlocProvider.value(
|
|
||||||
value: bookableBloc,
|
|
||||||
),
|
|
||||||
BlocProvider(
|
|
||||||
create: (context) => UpdateBookableSpacesBloc(
|
|
||||||
RemoteUpdateBookableSpaceService(HTTPService()),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: SetupBookableSpacesDialog(
|
|
||||||
editingBookableSpace: space,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
fixedSize: const Size(50, 30),
|
|
||||||
elevation: 1,
|
|
||||||
),
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
Assets.settings,
|
|
||||||
height: 15,
|
|
||||||
color: ColorsManager.blue1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
columnsTitles: const [
|
columnsTitles: const [
|
||||||
@ -199,3 +100,22 @@ class TableOfBookableSpacesWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DataCellWidget extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
const DataCellWidget({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsetsGeometry.only(left: 10),
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(fontSize: 11),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@ class RowOfButtonsTitleWidget extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
@ -52,6 +53,8 @@ class RowOfButtonsTitleWidget extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SvgTextButton(
|
SvgTextButton(
|
||||||
|
verticalPadding: 10,
|
||||||
|
horizontalPadding: 10,
|
||||||
svgSize: 15,
|
svgSize: 15,
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/steps_cubit/cubit/steps_cubit.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/steps_cubit/cubit/steps_cubit.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/buttons_divider_bottom_dialog_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/buttons_divider_bottom_dialog_widget.dart';
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class NextFirstStepButton extends StatelessWidget {
|
|||||||
: () {
|
: () {
|
||||||
context.read<StepsCubit>().goToNextStep();
|
context.read<StepsCubit>().goToNextStep();
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.add(CheckConfigurValidityEvent());
|
.add(CheckConfigurValidityEvent());
|
||||||
},
|
},
|
||||||
onCancelPressed: () => context.pop(),
|
onCancelPressed: () => context.pop(),
|
||||||
|
@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/cubit/toggle_points_switch_cubit.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/toggle_cubit/toggle_points_switch_cubit.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/search_unbookable_spaces_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/search_unbookable_spaces_widget.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
@ -78,13 +78,13 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
.read<TogglePointsSwitchCubit>()
|
.read<TogglePointsSwitchCubit>()
|
||||||
.activateSwitch();
|
.activateSwitch();
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.forEach(
|
.forEach(
|
||||||
(e) => e.spaceConfig!.cost = -1,
|
(e) => e.spaceConfig!.cost = -1,
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.add(CheckConfigurValidityEvent());
|
.add(CheckConfigurValidityEvent());
|
||||||
} else {
|
} else {
|
||||||
context
|
context
|
||||||
@ -92,13 +92,13 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
.unActivateSwitch();
|
.unActivateSwitch();
|
||||||
widget.pointsController.clear();
|
widget.pointsController.clear();
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.forEach(
|
.forEach(
|
||||||
(e) => e.spaceConfig!.cost = 0,
|
(e) => e.spaceConfig!.cost = 0,
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.add(CheckConfigurValidityEvent());
|
.add(CheckConfigurValidityEvent());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -115,7 +115,7 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
height: 40,
|
height: 40,
|
||||||
onChanged: (p0) {
|
onChanged: (p0) {
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.forEach(
|
.forEach(
|
||||||
(e) => e.spaceConfig!.cost = int.parse(
|
(e) => e.spaceConfig!.cost = int.parse(
|
||||||
@ -125,7 +125,7 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.add(CheckConfigurValidityEvent());
|
.add(CheckConfigurValidityEvent());
|
||||||
},
|
},
|
||||||
controller: widget.pointsController,
|
controller: widget.pointsController,
|
||||||
|
@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/update_bookable_space_param.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/params/update_bookable_space_param.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/update_bookable_spaces/update_bookable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/update_bookable_spaces/update_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/buttons_divider_bottom_dialog_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/buttons_divider_bottom_dialog_widget.dart';
|
||||||
|
|
||||||
@ -21,7 +22,18 @@ class SaveSecondStepButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<NonBookableSpacesBloc, NonBookableSpacesState>(
|
return BlocConsumer<SetupBookableSpacesBloc, SetupBookableSpacesState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is SendBookableSpacesSuccess) {
|
||||||
|
context.read<NonBookableSpacesBloc>().add(CallInitStateEvent());
|
||||||
|
} else if (state is SendBookableSpacesError) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(state.error),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return ButtonsDividerBottomDialogWidget(
|
return ButtonsDividerBottomDialogWidget(
|
||||||
title: 'Save',
|
title: 'Save',
|
||||||
@ -33,7 +45,7 @@ class SaveSecondStepButton extends StatelessWidget {
|
|||||||
)) {
|
)) {
|
||||||
isEditingMode
|
isEditingMode
|
||||||
? callEditLogic(context)
|
? callEditLogic(context)
|
||||||
: context.read<NonBookableSpacesBloc>().add(
|
: context.read<SetupBookableSpacesBloc>().add(
|
||||||
SendBookableSpacesToApi(),
|
SendBookableSpacesToApi(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -51,7 +63,7 @@ class SaveSecondStepButton extends StatelessWidget {
|
|||||||
context.read<NonBookableSpacesBloc>().add(CallInitStateEvent()),
|
context.read<NonBookableSpacesBloc>().add(CallInitStateEvent()),
|
||||||
updatedParams: UpdateBookableSpaceParam.fromBookableModel(
|
updatedParams: UpdateBookableSpaceParam.fromBookableModel(
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.first,
|
.first,
|
||||||
),
|
),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/cubit/toggle_points_switch_cubit.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/toggle_cubit/toggle_points_switch_cubit.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/booking_period_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/booking_period_widget.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/points_part_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/points_part_widget.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/week_checkbox_title_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/week_checkbox_title_widget.dart';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
|
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ class TimePickerWidget extends StatefulWidget {
|
|||||||
required this.onTimePicked,
|
required this.onTimePicked,
|
||||||
required this.title,
|
required this.title,
|
||||||
});
|
});
|
||||||
late NonBookableSpacesBloc nonBookableSpacesBloc;
|
late SetupBookableSpacesBloc setupBookableSpacesBloc;
|
||||||
final void Function(TimeOfDay? timePicked) onTimePicked;
|
final void Function(TimeOfDay? timePicked) onTimePicked;
|
||||||
@override
|
@override
|
||||||
State<TimePickerWidget> createState() => _TimePickerWidgetState();
|
State<TimePickerWidget> createState() => _TimePickerWidgetState();
|
||||||
@ -22,7 +22,7 @@ class _TimePickerWidgetState extends State<TimePickerWidget> {
|
|||||||
TimeOfDay? timePicked;
|
TimeOfDay? timePicked;
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
widget.nonBookableSpacesBloc = context.read<NonBookableSpacesBloc>();
|
widget.setupBookableSpacesBloc = context.read<SetupBookableSpacesBloc>();
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ class _TimePickerWidgetState extends State<TimePickerWidget> {
|
|||||||
);
|
);
|
||||||
widget.onTimePicked(tempTime);
|
widget.onTimePicked(tempTime);
|
||||||
timePicked = tempTime;
|
timePicked = tempTime;
|
||||||
widget.nonBookableSpacesBloc.add(CheckConfigurValidityEvent());
|
widget.setupBookableSpacesBloc.add(CheckConfigurValidityEvent());
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/check_box_space_widget.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/widgets/check_box_space_widget.dart';
|
||||||
import 'package:syncrow_web/pages/space_management_v2/main_module/shared/models/paginated_data_model.dart';
|
import 'package:syncrow_web/pages/space_management_v2/main_module/shared/models/paginated_data_model.dart';
|
||||||
|
|
||||||
@ -36,8 +36,9 @@ class UnbookableListWidget extends StatelessWidget {
|
|||||||
if (index < nonBookableSpaces.data.length) {
|
if (index < nonBookableSpaces.data.length) {
|
||||||
return CheckBoxSpaceWidget(
|
return CheckBoxSpaceWidget(
|
||||||
nonBookableSpace: nonBookableSpaces.data[index],
|
nonBookableSpace: nonBookableSpaces.data[index],
|
||||||
selectedSpaces:
|
selectedSpaces: context
|
||||||
context.read<NonBookableSpacesBloc>().selectedBookableSpaces,
|
.read<SetupBookableSpacesBloc>()
|
||||||
|
.selectedBookableSpaces,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/non_bookable_spaces_bloc/non_bookaable_spaces_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/presentation/blocs/setup_bookable_spaces_bloc/setup_bookable_spaces_bloc.dart';
|
||||||
|
|
||||||
class WeekDaysCheckboxRow extends StatefulWidget {
|
class WeekDaysCheckboxRow extends StatefulWidget {
|
||||||
final BookableSpacemodel? editingBookableSpace;
|
final BookableSpacemodel? editingBookableSpace;
|
||||||
@ -58,14 +58,14 @@ class _WeekDaysCheckboxRowState extends State<WeekDaysCheckboxRow> {
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
for (var space in context
|
for (var space in context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces) {
|
.selectedBookableSpaces) {
|
||||||
space.spaceConfig!.bookableDays = selectedDays;
|
space.spaceConfig!.bookableDays = selectedDays;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
context
|
context
|
||||||
.read<NonBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.add(CheckConfigurValidityEvent());
|
.add(CheckConfigurValidityEvent());
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user