diff --git a/lib/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart b/lib/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart index 98491538..c789c2a9 100644 --- a/lib/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart +++ b/lib/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart @@ -32,9 +32,6 @@ class LinkSpaceToModelBloc List spacesList = spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? []; spacesListIds = spacesList; - for (var spaceId in spacesList) { - print('spaceId===$spaceId'); - } } hasSelectedSpaces = spaceBloc.state.selectedCommunities.any((communityId) { @@ -43,12 +40,12 @@ class LinkSpaceToModelBloc return spacesList.isNotEmpty; }); if (hasSelectedSpaces) { - print("At least one space is selected."); + debugPrint("At least one space is selected."); } else { - print("No spaces selected."); + debugPrint("No spaces selected."); } } catch (e) { - print("Error in _getSpaceIds: $e"); + debugPrint("Error in _getSpaceIds: $e"); } } diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart index f67f8b2c..8c6ef3e9 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart @@ -1,235 +1,9 @@ -// import 'package:flutter/material.dart'; -// import 'package:flutter_bloc/flutter_bloc.dart'; -// import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart'; -// import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_model_bloc.dart'; -// import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_model_event.dart'; -// import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; -// import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart'; -// import 'package:syncrow_web/utils/color_manager.dart'; - -// class LinkSpaceModelSpacesDialog extends StatefulWidget { -// final SpaceTemplateModel spaceModel; -// LinkSpaceModelSpacesDialog({super.key, required this.spaceModel}); - -// @override -// State createState() => -// _LinkSpaceModelSpacesDialogState(); -// } - -// class _LinkSpaceModelSpacesDialogState -// extends State { -// TextEditingController searchController = TextEditingController(); - -// @override -// void initState() { -// context.read().add(SpaceModelSelectedIdsEvent()); -// super.initState(); -// } - -// @override -// Widget build(BuildContext context) { -// return AlertDialog( -// contentPadding: EdgeInsets.zero, -// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), -// backgroundColor: Colors.white, -// content: SizedBox( -// width: MediaQuery.of(context).size.width * 0.4, -// child: Column( -// mainAxisSize: MainAxisSize.min, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Expanded( -// child: Padding( -// padding: const EdgeInsets.all(15.0), -// child: Column( -// mainAxisSize: MainAxisSize.min, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// const Center( -// child: Text( -// "Link Space Model to Spaces", -// style: TextStyle( -// fontSize: 18, -// fontWeight: FontWeight.bold, -// color: Colors.blueAccent, -// ), -// ), -// ), -// const Divider(), -// const SizedBox(height: 16), -// _buildDetailRow( -// "Space model name:", widget.spaceModel.modelName), -// _buildDetailRow("Creation date and time:", -// widget.spaceModel.createdAt.toString()), -// _buildDetailRow("Created by:", "Admin"), -// const SizedBox(height: 12), -// const Text( -// "Link to:", -// style: TextStyle(fontWeight: FontWeight.bold), -// ), -// const Text( -// "Please select all the spaces where you would like to link the Routine.", -// style: TextStyle(fontSize: 12, color: Colors.grey), -// ), -// const SizedBox(height: 8), -// Expanded( -// child: SizedBox( -// child: Column( -// children: [ -// Expanded( -// flex: 7, -// child: Container( -// color: ColorsManager.whiteColors, -// child: SpaceTreeView( -// isSide: true, -// onSelect: () { -// context.read().add( -// SpaceModelSelectedIdsEvent()); -// }))) -// ], -// ), -// ), -// ), -// const SizedBox( -// height: 20, -// ), -// ], -// ), -// ), -// ), - -// // Buttons -// Row( -// children: [ -// Expanded( -// child: Container( -// height: 50, -// decoration: const BoxDecoration( -// border: Border( -// right: BorderSide( -// color: ColorsManager.grayColor, -// width: 0.5, -// ), -// top: BorderSide( -// color: ColorsManager.grayColor, -// width: 1, -// ), -// ), -// ), -// child: _buildButton("Cancel", Colors.grey, () { -// Navigator.of(context).pop(); -// }), -// ), -// ), -// Expanded( -// child: Container( -// height: 50, -// decoration: const BoxDecoration( -// border: Border( -// left: BorderSide( -// color: ColorsManager.grayColor, -// width: 0.5, -// ), -// top: BorderSide( -// color: ColorsManager.grayColor, -// width: 1.0, -// ), -// ), -// ), -// child: _buildButton( -// "Confirm", ColorsManager.onSecondaryColor, () { -// final spaceModelBloc = context.read(); -// if (!spaceModelBloc.hasSelectedSpaces) { -// ScaffoldMessenger.of(context).showSnackBar( -// const SnackBar( -// content: -// Text("Please select at least one space")), -// ); -// return; -// } else { -// // spaceModelBloc.add(LinkSpaceModelEvent( -// // selectedSpaceMode: widget.spaceModel.uuid)); - -// spaceModelBloc.add(ValidateSpaceModelEvent(context: context)); -// } - -// Future.delayed(const Duration(seconds: 3), () { -// Navigator.of(context).pop(); -// Navigator.of(context).pop(); - -// // showDialog( -// // context: context, -// // builder: (BuildContext dialogContext) { -// // return const LinkingSuccessful(); -// // }, -// // ); - -// showDialog( -// context: context, -// builder: (BuildContext dialogContext) { -// return const ConfirmOverwriteDialog(); -// }, -// ); -// }); -// }), -// ), -// ), -// ], -// ), -// ], -// ), -// ), -// ); -// } - -// // Method to build a detail row -// Widget _buildDetailRow(String label, String value) { -// return Padding( -// padding: const EdgeInsets.symmetric(vertical: 4), -// child: Row( -// children: [ -// Expanded( -// child: Text( -// label, -// style: TextStyle(fontWeight: FontWeight.bold), -// ), -// ), -// const SizedBox(width: 8), -// Expanded( -// child: Text( -// value, -// style: -// TextStyle(fontWeight: FontWeight.bold, color: Colors.black), -// ), -// ), -// ], -// ), -// ); -// } - -// Widget _buildButton(String text, Color color, VoidCallback onPressed) { -// return InkWell( -// onTap: onPressed, -// child: Center( -// child: Text( -// text, -// style: TextStyle( -// color: color, fontWeight: FontWeight.w400, fontSize: 14), -// ), -// ), -// ); -// } -// } - import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart'; import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_bloc.dart'; import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_event.dart'; -import 'package:syncrow_web/pages/spaces_management/link_space_model/bloc/link_space_to_model_state.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; -import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart'; -import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/overwrite_dialog.dart'; import 'package:syncrow_web/utils/color_manager.dart'; class LinkSpaceModelSpacesDialog extends StatefulWidget { @@ -244,9 +18,6 @@ class LinkSpaceModelSpacesDialog extends StatefulWidget { class _LinkSpaceModelSpacesDialogState extends State { - final TextEditingController _searchController = TextEditingController(); - bool _isLoading = false; - @override void initState() { context.read().add(LinkSpaceModelSelectedIdsEvent()); @@ -420,14 +191,15 @@ Widget _buildDetailRow(String label, String value) { Expanded( child: Text( label, - style: TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), ), const SizedBox(width: 8), Expanded( child: Text( value, - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black), + style: const TextStyle( + fontWeight: FontWeight.bold, color: Colors.black), ), ), ], diff --git a/lib/services/space_model_mang_api.dart b/lib/services/space_model_mang_api.dart index d4fa06f4..5253c73e 100644 --- a/lib/services/space_model_mang_api.dart +++ b/lib/services/space_model_mang_api.dart @@ -2,7 +2,6 @@ import 'package:syncrow_web/pages/spaces_management/space_model/models/create_sp import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; import 'package:syncrow_web/services/api/http_service.dart'; import 'package:syncrow_web/utils/constants/api_const.dart'; -import 'package:syncrow_web/utils/constants/temp_const.dart'; class SpaceModelManagementApi { Future> listSpaceModels( @@ -66,11 +65,6 @@ class SpaceModelManagementApi { required String projectId, required List spaceUuids, required bool isOverWrite}) async { - print(spaceModelUuid); - print(projectId); - print(spaceUuids); - print(isOverWrite); - final response = await HTTPService().post( path: ApiEndpoints.linkSpaceModel .replaceAll('{projectId}', projectId) @@ -93,6 +87,7 @@ class SpaceModelManagementApi { expectedResponseModel: (json) { return json; }); + return response; } Future deleteSpaceModel(String spaceModelUuid, String projectId) async {