mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
removed tag model and use tag only
This commit is contained in:
@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/access_management/bloc/access_bloc.dart';
|
import 'package:syncrow_web/pages/access_management/bloc/access_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/bloc/access_event.dart';
|
import 'package:syncrow_web/pages/access_management/bloc/access_event.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/bloc/access_state.dart';
|
import 'package:syncrow_web/pages/access_management/bloc/access_state.dart';
|
||||||
import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
|
||||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||||
import 'package:syncrow_web/pages/common/buttons/search_reset_buttons.dart';
|
import 'package:syncrow_web/pages/common/buttons/search_reset_buttons.dart';
|
||||||
import 'package:syncrow_web/pages/common/custom_table.dart';
|
import 'package:syncrow_web/pages/common/custom_table.dart';
|
||||||
|
@ -15,7 +15,6 @@ import 'package:syncrow_web/pages/space_tree/bloc/space_tree_event.dart';
|
|||||||
import 'package:syncrow_web/services/auth_api.dart';
|
import 'package:syncrow_web/services/auth_api.dart';
|
||||||
import 'package:syncrow_web/utils/constants/strings_manager.dart';
|
import 'package:syncrow_web/utils/constants/strings_manager.dart';
|
||||||
import 'package:syncrow_web/utils/helpers/shared_preferences_helper.dart';
|
import 'package:syncrow_web/utils/helpers/shared_preferences_helper.dart';
|
||||||
import 'package:syncrow_web/utils/navigation_service.dart';
|
|
||||||
import 'package:syncrow_web/utils/snack_bar.dart';
|
import 'package:syncrow_web/utils/snack_bar.dart';
|
||||||
|
|
||||||
class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||||
|
@ -5,9 +5,6 @@ import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
|||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
import 'package:syncrow_web/services/devices_mang_api.dart';
|
import 'package:syncrow_web/services/devices_mang_api.dart';
|
||||||
import 'package:syncrow_web/utils/constants/strings_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/constants/temp_const.dart';
|
|
||||||
import 'package:syncrow_web/utils/helpers/shared_preferences_helper.dart';
|
|
||||||
|
|
||||||
part 'device_managment_event.dart';
|
part 'device_managment_event.dart';
|
||||||
part 'device_managment_state.dart';
|
part 'device_managment_state.dart';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_event.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_state.dart';
|
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_state.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
|
|
||||||
class AssignTagModelBloc
|
class AssignTagModelBloc
|
||||||
extends Bloc<AssignTagModelEvent, AssignTagModelState> {
|
extends Bloc<AssignTagModelEvent, AssignTagModelState> {
|
||||||
@ -19,7 +19,7 @@ class AssignTagModelBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final tags = <TagModel>[];
|
final tags = <Tag>[];
|
||||||
|
|
||||||
for (var selectedProduct in event.addedProducts) {
|
for (var selectedProduct in event.addedProducts) {
|
||||||
final existingCount = existingTagCounts[selectedProduct.productId] ?? 0;
|
final existingCount = existingTagCounts[selectedProduct.productId] ?? 0;
|
||||||
@ -39,7 +39,7 @@ class AssignTagModelBloc
|
|||||||
if (missingCount > 0) {
|
if (missingCount > 0) {
|
||||||
tags.addAll(List.generate(
|
tags.addAll(List.generate(
|
||||||
missingCount,
|
missingCount,
|
||||||
(index) => TagModel(
|
(index) => Tag(
|
||||||
tag: '',
|
tag: '',
|
||||||
product: selectedProduct.product,
|
product: selectedProduct.product,
|
||||||
location: 'Main Space',
|
location: 'Main Space',
|
||||||
@ -61,7 +61,7 @@ class AssignTagModelBloc
|
|||||||
final currentState = state;
|
final currentState = state;
|
||||||
if (currentState is AssignTagModelLoaded &&
|
if (currentState is AssignTagModelLoaded &&
|
||||||
currentState.tags.isNotEmpty) {
|
currentState.tags.isNotEmpty) {
|
||||||
final tags = List<TagModel>.from(currentState.tags);
|
final tags = List<Tag>.from(currentState.tags);
|
||||||
tags[event.index] = tags[event.index].copyWith(tag: event.tag);
|
tags[event.index] = tags[event.index].copyWith(tag: event.tag);
|
||||||
final updatedTags = _calculateAvailableTags(allTags, tags);
|
final updatedTags = _calculateAvailableTags(allTags, tags);
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class AssignTagModelBloc
|
|||||||
|
|
||||||
if (currentState is AssignTagModelLoaded &&
|
if (currentState is AssignTagModelLoaded &&
|
||||||
currentState.tags.isNotEmpty) {
|
currentState.tags.isNotEmpty) {
|
||||||
final tags = List<TagModel>.from(currentState.tags);
|
final tags = List<Tag>.from(currentState.tags);
|
||||||
|
|
||||||
// Use copyWith for immutability
|
// Use copyWith for immutability
|
||||||
tags[event.index] =
|
tags[event.index] =
|
||||||
@ -101,7 +101,7 @@ class AssignTagModelBloc
|
|||||||
|
|
||||||
if (currentState is AssignTagModelLoaded &&
|
if (currentState is AssignTagModelLoaded &&
|
||||||
currentState.tags.isNotEmpty) {
|
currentState.tags.isNotEmpty) {
|
||||||
final tags = List<TagModel>.from(currentState.tags);
|
final tags = List<Tag>.from(currentState.tags);
|
||||||
|
|
||||||
emit(AssignTagModelLoaded(
|
emit(AssignTagModelLoaded(
|
||||||
tags: tags,
|
tags: tags,
|
||||||
@ -117,7 +117,7 @@ class AssignTagModelBloc
|
|||||||
|
|
||||||
if (currentState is AssignTagModelLoaded &&
|
if (currentState is AssignTagModelLoaded &&
|
||||||
currentState.tags.isNotEmpty) {
|
currentState.tags.isNotEmpty) {
|
||||||
final tags = List<TagModel>.from(currentState.tags)
|
final tags = List<Tag>.from(currentState.tags)
|
||||||
..remove(event.tagToDelete);
|
..remove(event.tagToDelete);
|
||||||
|
|
||||||
final updatedTags = _calculateAvailableTags(allTags, tags);
|
final updatedTags = _calculateAvailableTags(allTags, tags);
|
||||||
@ -132,14 +132,14 @@ class AssignTagModelBloc
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _validateTags(List<TagModel> tags) {
|
bool _validateTags(List<Tag> tags) {
|
||||||
final uniqueTags = tags.map((tag) => tag.tag?.trim() ?? '').toSet();
|
final uniqueTags = tags.map((tag) => tag.tag?.trim() ?? '').toSet();
|
||||||
final hasEmptyTag = tags.any((tag) => (tag.tag?.trim() ?? '').isEmpty);
|
final hasEmptyTag = tags.any((tag) => (tag.tag?.trim() ?? '').isEmpty);
|
||||||
final isValid = uniqueTags.length == tags.length && !hasEmptyTag;
|
final isValid = uniqueTags.length == tags.length && !hasEmptyTag;
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _getValidationError(List<TagModel> tags) {
|
String? _getValidationError(List<Tag> tags) {
|
||||||
// Check for duplicate tags
|
// Check for duplicate tags
|
||||||
|
|
||||||
final nonEmptyTags = tags
|
final nonEmptyTags = tags
|
||||||
@ -165,7 +165,7 @@ class AssignTagModelBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<String> _calculateAvailableTags(
|
List<String> _calculateAvailableTags(
|
||||||
List<String> allTags, List<TagModel> tags) {
|
List<String> allTags, List<Tag> tags) {
|
||||||
final selectedTags = tags
|
final selectedTags = tags
|
||||||
.where((tag) => (tag.tag?.trim().isNotEmpty ?? false))
|
.where((tag) => (tag.tag?.trim().isNotEmpty ?? false))
|
||||||
.map((tag) => tag.tag!.trim())
|
.map((tag) => tag.tag!.trim())
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
||||||
|
|
||||||
abstract class AssignTagModelEvent extends Equatable {
|
abstract class AssignTagModelEvent extends Equatable {
|
||||||
@ -10,7 +10,7 @@ abstract class AssignTagModelEvent extends Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class InitializeTagModels extends AssignTagModelEvent {
|
class InitializeTagModels extends AssignTagModelEvent {
|
||||||
final List<TagModel> initialTags;
|
final List<Tag> initialTags;
|
||||||
final List<SelectedProduct> addedProducts;
|
final List<SelectedProduct> addedProducts;
|
||||||
|
|
||||||
const InitializeTagModels({
|
const InitializeTagModels({
|
||||||
@ -45,8 +45,8 @@ class UpdateLocation extends AssignTagModelEvent {
|
|||||||
class ValidateTagModels extends AssignTagModelEvent {}
|
class ValidateTagModels extends AssignTagModelEvent {}
|
||||||
|
|
||||||
class DeleteTagModel extends AssignTagModelEvent {
|
class DeleteTagModel extends AssignTagModelEvent {
|
||||||
final TagModel tagToDelete;
|
final Tag tagToDelete;
|
||||||
final List<TagModel> tags;
|
final List<Tag> tags;
|
||||||
|
|
||||||
const DeleteTagModel({required this.tagToDelete, required this.tags});
|
const DeleteTagModel({required this.tagToDelete, required this.tags});
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
|
|
||||||
abstract class AssignTagModelState extends Equatable {
|
abstract class AssignTagModelState extends Equatable {
|
||||||
const AssignTagModelState();
|
const AssignTagModelState();
|
||||||
@ -13,7 +13,7 @@ class AssignTagModelInitial extends AssignTagModelState {}
|
|||||||
class AssignTagModelLoading extends AssignTagModelState {}
|
class AssignTagModelLoading extends AssignTagModelState {}
|
||||||
|
|
||||||
class AssignTagModelLoaded extends AssignTagModelState {
|
class AssignTagModelLoaded extends AssignTagModelState {
|
||||||
final List<TagModel> tags;
|
final List<Tag> tags;
|
||||||
final bool isSaveEnabled;
|
final bool isSaveEnabled;
|
||||||
final String? errorMessage;
|
final String? errorMessage;
|
||||||
|
|
||||||
|
@ -6,12 +6,12 @@ import 'package:syncrow_web/pages/common/buttons/cancel_button.dart';
|
|||||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_event.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_model_state.dart';
|
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/bloc/assign_tag_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/models/space_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/tag_model/views/add_device_type_model_widget.dart';
|
import 'package:syncrow_web/pages/spaces_management/tag_model/views/add_device_type_model_widget.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
@ -23,8 +23,8 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
final List<SubspaceTemplateModel>? subspaces;
|
final List<SubspaceTemplateModel>? subspaces;
|
||||||
final SpaceTemplateModel? spaceModel;
|
final SpaceTemplateModel? spaceModel;
|
||||||
|
|
||||||
final List<TagModel> initialTags;
|
final List<Tag> initialTags;
|
||||||
final ValueChanged<List<TagModel>>? onTagsAssigned;
|
final ValueChanged<List<Tag>>? onTagsAssigned;
|
||||||
final List<SelectedProduct> addedProducts;
|
final List<SelectedProduct> addedProducts;
|
||||||
final List<String>? allTags;
|
final List<String>? allTags;
|
||||||
final String spaceName;
|
final String spaceName;
|
||||||
@ -195,7 +195,7 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
.infinity, // Ensure full width for dropdown
|
.infinity, // Ensure full width for dropdown
|
||||||
child: DialogTextfieldDropdown(
|
child: DialogTextfieldDropdown(
|
||||||
key: ValueKey(
|
key: ValueKey(
|
||||||
'dropdown_${Uuid().v4()}_${index}'),
|
'dropdown_${Uuid().v4()}_$index'),
|
||||||
items: state.updatedTags,
|
items: state.updatedTags,
|
||||||
initialValue: tag.tag,
|
initialValue: tag.tag,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
@ -255,13 +255,13 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
label: 'Add New Device',
|
label: 'Add New Device',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final updatedTags =
|
final updatedTags =
|
||||||
List<TagModel>.from(state.tags);
|
List<Tag>.from(state.tags);
|
||||||
final result =
|
final result =
|
||||||
TagHelper.updateSubspaceTagModels(
|
TagHelper.updateSubspaceTagModels(
|
||||||
updatedTags, subspaces);
|
updatedTags, subspaces);
|
||||||
|
|
||||||
final processedTags =
|
final processedTags =
|
||||||
result['updatedTags'] as List<TagModel>;
|
result['updatedTags'] as List<Tag>;
|
||||||
final processedSubspaces =
|
final processedSubspaces =
|
||||||
List<SubspaceTemplateModel>.from(
|
List<SubspaceTemplateModel>.from(
|
||||||
result['subspaces'] as List<dynamic>);
|
result['subspaces'] as List<dynamic>);
|
||||||
@ -311,14 +311,14 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
onPressed: state.isSaveEnabled
|
onPressed: state.isSaveEnabled
|
||||||
? () async {
|
? () async {
|
||||||
final updatedTags =
|
final updatedTags =
|
||||||
List<TagModel>.from(state.tags);
|
List<Tag>.from(state.tags);
|
||||||
|
|
||||||
final result =
|
final result =
|
||||||
TagHelper.updateSubspaceTagModels(
|
TagHelper.updateSubspaceTagModels(
|
||||||
updatedTags, subspaces);
|
updatedTags, subspaces);
|
||||||
|
|
||||||
final processedTags =
|
final processedTags =
|
||||||
result['updatedTags'] as List<TagModel>;
|
result['updatedTags'] as List<Tag>;
|
||||||
final processedSubspaces =
|
final processedSubspaces =
|
||||||
List<SubspaceTemplateModel>.from(
|
List<SubspaceTemplateModel>.from(
|
||||||
result['subspaces']
|
result['subspaces']
|
||||||
|
@ -7,7 +7,6 @@ import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_mo
|
|||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
|
|
||||||
class TagHelper {
|
class TagHelper {
|
||||||
static Map<String, dynamic> updateTags<T>({
|
static Map<String, dynamic> updateTags<T>({
|
||||||
@ -131,9 +130,9 @@ class TagHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<String> getAvailableTagModels(
|
static List<String> getAvailableTagModels(
|
||||||
List<String> allTags, List<TagModel> currentTags, TagModel currentTag) {
|
List<String> allTags, List<Tag> currentTags, Tag currentTag) {
|
||||||
List<String> availableTagsForTagModel =
|
List<String> availableTagsForTagModel =
|
||||||
TagHelper.getAvailableTags<TagModel>(
|
TagHelper.getAvailableTags<Tag>(
|
||||||
allTags: allTags,
|
allTags: allTags,
|
||||||
currentTags: currentTags,
|
currentTags: currentTags,
|
||||||
currentTag: currentTag,
|
currentTag: currentTag,
|
||||||
@ -142,11 +141,11 @@ class TagHelper {
|
|||||||
return availableTagsForTagModel;
|
return availableTagsForTagModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<TagModel> generateInitialTags({
|
static List<Tag> generateInitialTags({
|
||||||
List<TagModel>? spaceTagModels,
|
List<Tag>? spaceTagModels,
|
||||||
List<SubspaceTemplateModel>? subspaces,
|
List<SubspaceTemplateModel>? subspaces,
|
||||||
}) {
|
}) {
|
||||||
final List<TagModel> initialTags = [];
|
final List<Tag> initialTags = [];
|
||||||
|
|
||||||
if (spaceTagModels != null) {
|
if (spaceTagModels != null) {
|
||||||
initialTags.addAll(spaceTagModels);
|
initialTags.addAll(spaceTagModels);
|
||||||
@ -212,7 +211,7 @@ class TagHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<SelectedProduct> createInitialSelectedProducts(
|
static List<SelectedProduct> createInitialSelectedProducts(
|
||||||
List<TagModel>? tags, List<SubspaceTemplateModel>? subspaces) {
|
List<Tag>? tags, List<SubspaceTemplateModel>? subspaces) {
|
||||||
final Map<ProductModel, int> productCounts = {};
|
final Map<ProductModel, int> productCounts = {};
|
||||||
|
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
@ -282,7 +281,7 @@ class TagHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int? checkTagExistInSubspaceModels(
|
static int? checkTagExistInSubspaceModels(
|
||||||
TagModel tag, List<dynamic>? subspaces) {
|
Tag tag, List<dynamic>? subspaces) {
|
||||||
if (subspaces == null) return null;
|
if (subspaces == null) return null;
|
||||||
|
|
||||||
for (int i = 0; i < subspaces.length; i++) {
|
for (int i = 0; i < subspaces.length; i++) {
|
||||||
@ -298,8 +297,8 @@ class TagHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, dynamic> updateSubspaceTagModels(
|
static Map<String, dynamic> updateSubspaceTagModels(
|
||||||
List<TagModel> updatedTags, List<SubspaceTemplateModel>? subspaces) {
|
List<Tag> updatedTags, List<SubspaceTemplateModel>? subspaces) {
|
||||||
final result = TagHelper.updateTags<TagModel>(
|
final result = TagHelper.updateTags<Tag>(
|
||||||
updatedTags: updatedTags,
|
updatedTags: updatedTags,
|
||||||
subspaces: subspaces,
|
subspaces: subspaces,
|
||||||
getInternalId: (tag) => tag.internalId,
|
getInternalId: (tag) => tag.internalId,
|
||||||
@ -311,7 +310,7 @@ class TagHelper {
|
|||||||
checkTagExistInSubspace: checkTagExistInSubspaceModels,
|
checkTagExistInSubspace: checkTagExistInSubspaceModels,
|
||||||
);
|
);
|
||||||
|
|
||||||
final processedTags = result['updatedTags'] as List<TagModel>;
|
final processedTags = result['updatedTags'] as List<Tag>;
|
||||||
final processedSubspaces =
|
final processedSubspaces =
|
||||||
List<SubspaceTemplateModel>.from(result['subspaces'] as List<dynamic>);
|
List<SubspaceTemplateModel>.from(result['subspaces'] as List<dynamic>);
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_event.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_state.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_state.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/create_space_template_body_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/create_space_template_body_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_update_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_update_model.dart';
|
||||||
import 'package:syncrow_web/services/space_model_mang_api.dart';
|
import 'package:syncrow_web/services/space_model_mang_api.dart';
|
||||||
import 'package:syncrow_web/utils/constants/action_enum.dart';
|
import 'package:syncrow_web/utils/constants/action_enum.dart';
|
||||||
@ -94,14 +94,9 @@ class CreateSpaceModelBloc
|
|||||||
orElse: () => subspace,
|
orElse: () => subspace,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update the subspace's tags
|
|
||||||
final eventTagIds = matchingEventSubspace.tags
|
|
||||||
?.map((e) => e.internalId)
|
|
||||||
.toSet() ??
|
|
||||||
{};
|
|
||||||
|
|
||||||
final updatedTags = [
|
final updatedTags = [
|
||||||
...?subspace.tags?.map<TagModel>((tag) {
|
...?subspace.tags?.map<Tag>((tag) {
|
||||||
final matchingTag =
|
final matchingTag =
|
||||||
matchingEventSubspace.tags?.firstWhere(
|
matchingEventSubspace.tags?.firstWhere(
|
||||||
(e) => e.internalId == tag.internalId,
|
(e) => e.internalId == tag.internalId,
|
||||||
@ -112,14 +107,14 @@ class CreateSpaceModelBloc
|
|||||||
? tag.copyWith(tag: matchingTag?.tag)
|
? tag.copyWith(tag: matchingTag?.tag)
|
||||||
: tag;
|
: tag;
|
||||||
}) ??
|
}) ??
|
||||||
<TagModel>[],
|
<Tag>[],
|
||||||
...?matchingEventSubspace.tags?.where(
|
...?matchingEventSubspace.tags?.where(
|
||||||
(e) =>
|
(e) =>
|
||||||
subspace.tags
|
subspace.tags
|
||||||
?.every((t) => t.internalId != e.internalId) ??
|
?.every((t) => t.internalId != e.internalId) ??
|
||||||
true,
|
true,
|
||||||
) ??
|
) ??
|
||||||
<TagModel>[],
|
<Tag>[],
|
||||||
];
|
];
|
||||||
return subspace.copyWith(
|
return subspace.copyWith(
|
||||||
subspaceName: matchingEventSubspace.subspaceName,
|
subspaceName: matchingEventSubspace.subspaceName,
|
||||||
@ -244,7 +239,7 @@ class CreateSpaceModelBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newSubspaces != null) {
|
if (newSubspaces != null) {
|
||||||
for (var newSubspace in newSubspaces!) {
|
for (var newSubspace in newSubspaces) {
|
||||||
// Tag without UUID
|
// Tag without UUID
|
||||||
if ((newSubspace.uuid == null || newSubspace.uuid!.isEmpty)) {
|
if ((newSubspace.uuid == null || newSubspace.uuid!.isEmpty)) {
|
||||||
final List<TagModelUpdate> tagUpdates = [];
|
final List<TagModelUpdate> tagUpdates = [];
|
||||||
@ -268,7 +263,7 @@ class CreateSpaceModelBloc
|
|||||||
|
|
||||||
if (prevSubspaces != null && newSubspaces != null) {
|
if (prevSubspaces != null && newSubspaces != null) {
|
||||||
final newSubspaceMap = {
|
final newSubspaceMap = {
|
||||||
for (var subspace in newSubspaces!) subspace.uuid: subspace
|
for (var subspace in newSubspaces) subspace.uuid: subspace
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var prevSubspace in prevSubspaces) {
|
for (var prevSubspace in prevSubspaces) {
|
||||||
@ -309,8 +304,8 @@ class CreateSpaceModelBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<TagModelUpdate> processTagUpdates(
|
List<TagModelUpdate> processTagUpdates(
|
||||||
List<TagModel>? prevTags,
|
List<Tag>? prevTags,
|
||||||
List<TagModel>? newTags,
|
List<Tag>? newTags,
|
||||||
) {
|
) {
|
||||||
final List<TagModelUpdate> tagUpdates = [];
|
final List<TagModelUpdate> tagUpdates = [];
|
||||||
final processedTags = <String?>{};
|
final processedTags = <String?>{};
|
||||||
@ -332,7 +327,7 @@ class CreateSpaceModelBloc
|
|||||||
if (prevTags != null && newTags != null) {
|
if (prevTags != null && newTags != null) {
|
||||||
for (var prevTag in prevTags) {
|
for (var prevTag in prevTags) {
|
||||||
final existsInNew =
|
final existsInNew =
|
||||||
newTags!.any((newTag) => newTag.uuid == prevTag.uuid);
|
newTags.any((newTag) => newTag.uuid == prevTag.uuid);
|
||||||
if (!existsInNew) {
|
if (!existsInNew) {
|
||||||
tagUpdates
|
tagUpdates
|
||||||
.add(TagModelUpdate(action: Action.delete, uuid: prevTag.uuid));
|
.add(TagModelUpdate(action: Action.delete, uuid: prevTag.uuid));
|
||||||
@ -349,7 +344,7 @@ class CreateSpaceModelBloc
|
|||||||
if (newTags != null) {
|
if (newTags != null) {
|
||||||
final prevTagUuids = prevTags?.map((t) => t.uuid).toSet() ?? {};
|
final prevTagUuids = prevTags?.map((t) => t.uuid).toSet() ?? {};
|
||||||
|
|
||||||
for (var newTag in newTags!) {
|
for (var newTag in newTags) {
|
||||||
// Tag without UUID
|
// Tag without UUID
|
||||||
if ((newTag.uuid == null || !prevTagUuids.contains(newTag.uuid)) &&
|
if ((newTag.uuid == null || !prevTagUuids.contains(newTag.uuid)) &&
|
||||||
!processedTags.contains(newTag.tag)) {
|
!processedTags.contains(newTag.tag)) {
|
||||||
@ -365,9 +360,9 @@ class CreateSpaceModelBloc
|
|||||||
|
|
||||||
// Case 3: Tags updated
|
// Case 3: Tags updated
|
||||||
if (prevTags != null && newTags != null) {
|
if (prevTags != null && newTags != null) {
|
||||||
final newTagMap = {for (var tag in newTags!) tag.uuid: tag};
|
final newTagMap = {for (var tag in newTags) tag.uuid: tag};
|
||||||
|
|
||||||
for (var prevTag in prevTags!) {
|
for (var prevTag in prevTags) {
|
||||||
final newTag = newTagMap[prevTag.uuid];
|
final newTag = newTagMap[prevTag.uuid];
|
||||||
if (newTag != null) {
|
if (newTag != null) {
|
||||||
tagUpdates.add(TagModelUpdate(
|
tagUpdates.add(TagModelUpdate(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
|
|
||||||
abstract class CreateSpaceModelEvent extends Equatable {
|
abstract class CreateSpaceModelEvent extends Equatable {
|
||||||
const CreateSpaceModelEvent();
|
const CreateSpaceModelEvent();
|
||||||
@ -49,7 +49,7 @@ class AddSubspacesToSpaceTemplate extends CreateSpaceModelEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AddTagsToSpaceTemplate extends CreateSpaceModelEvent {
|
class AddTagsToSpaceTemplate extends CreateSpaceModelEvent {
|
||||||
final List<TagModel> tags;
|
final List<Tag> tags;
|
||||||
|
|
||||||
AddTagsToSpaceTemplate(this.tags);
|
AddTagsToSpaceTemplate(this.tags);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_update_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_update_model.dart';
|
||||||
import 'package:syncrow_web/utils/constants/action_enum.dart';
|
import 'package:syncrow_web/utils/constants/action_enum.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
@ -9,7 +9,7 @@ class SpaceTemplateModel extends Equatable {
|
|||||||
String? uuid;
|
String? uuid;
|
||||||
String modelName;
|
String modelName;
|
||||||
List<SubspaceTemplateModel>? subspaceModels;
|
List<SubspaceTemplateModel>? subspaceModels;
|
||||||
final List<TagModel>? tags;
|
final List<Tag>? tags;
|
||||||
String internalId;
|
String internalId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -38,7 +38,7 @@ class SpaceTemplateModel extends Equatable {
|
|||||||
[],
|
[],
|
||||||
tags: (json['tags'] as List<dynamic>?)
|
tags: (json['tags'] as List<dynamic>?)
|
||||||
?.where((item) => item is Map<String, dynamic>) // Validate type
|
?.where((item) => item is Map<String, dynamic>) // Validate type
|
||||||
.map((item) => TagModel.fromJson(item as Map<String, dynamic>))
|
.map((item) => Tag.fromJson(item as Map<String, dynamic>))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@ -47,7 +47,7 @@ class SpaceTemplateModel extends Equatable {
|
|||||||
String? uuid,
|
String? uuid,
|
||||||
String? modelName,
|
String? modelName,
|
||||||
List<SubspaceTemplateModel>? subspaceModels,
|
List<SubspaceTemplateModel>? subspaceModels,
|
||||||
List<TagModel>? tags,
|
List<Tag>? tags,
|
||||||
String? internalId,
|
String? internalId,
|
||||||
}) {
|
}) {
|
||||||
return SpaceTemplateModel(
|
return SpaceTemplateModel(
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class SubspaceTemplateModel {
|
class SubspaceTemplateModel {
|
||||||
final String? uuid;
|
final String? uuid;
|
||||||
String subspaceName;
|
String subspaceName;
|
||||||
final bool disabled;
|
final bool disabled;
|
||||||
List<TagModel>? tags;
|
List<Tag>? tags;
|
||||||
String internalId;
|
String internalId;
|
||||||
|
|
||||||
SubspaceTemplateModel({
|
SubspaceTemplateModel({
|
||||||
@ -25,7 +25,7 @@ class SubspaceTemplateModel {
|
|||||||
internalId: internalId,
|
internalId: internalId,
|
||||||
disabled: json['disabled'] ?? false,
|
disabled: json['disabled'] ?? false,
|
||||||
tags: (json['tags'] as List<dynamic>?)
|
tags: (json['tags'] as List<dynamic>?)
|
||||||
?.map((item) => TagModel.fromJson(item))
|
?.map((item) => Tag.fromJson(item))
|
||||||
.toList() ??
|
.toList() ??
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@ -44,7 +44,7 @@ class SubspaceTemplateModel {
|
|||||||
String? uuid,
|
String? uuid,
|
||||||
String? subspaceName,
|
String? subspaceName,
|
||||||
bool? disabled,
|
bool? disabled,
|
||||||
List<TagModel>? tags,
|
List<Tag>? tags,
|
||||||
String? internalId,
|
String? internalId,
|
||||||
}) {
|
}) {
|
||||||
return SubspaceTemplateModel(
|
return SubspaceTemplateModel(
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/base_tag.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/create_space_template_body_model.dart';
|
|
||||||
import 'package:uuid/uuid.dart';
|
|
||||||
|
|
||||||
class TagModel extends BaseTag {
|
|
||||||
TagModel({
|
|
||||||
String? uuid,
|
|
||||||
required String? tag,
|
|
||||||
ProductModel? product,
|
|
||||||
String? internalId,
|
|
||||||
String? location,
|
|
||||||
}) : super(
|
|
||||||
uuid: uuid,
|
|
||||||
tag: tag,
|
|
||||||
product: product,
|
|
||||||
internalId: internalId,
|
|
||||||
location: location,
|
|
||||||
);
|
|
||||||
factory TagModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
final String internalId = json['internalId'] ?? const Uuid().v4();
|
|
||||||
|
|
||||||
return TagModel(
|
|
||||||
uuid: json['uuid'] ,
|
|
||||||
internalId: internalId,
|
|
||||||
tag: json['tag'] ?? '',
|
|
||||||
product: json['product'] != null
|
|
||||||
? ProductModel.fromMap(json['product'])
|
|
||||||
: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
TagModel copyWith(
|
|
||||||
{String? tag,
|
|
||||||
ProductModel? product,
|
|
||||||
String? uuid,
|
|
||||||
String? location,
|
|
||||||
String? internalId}) {
|
|
||||||
return TagModel(
|
|
||||||
tag: tag ?? this.tag,
|
|
||||||
product: product ?? this.product,
|
|
||||||
location: location ?? this.location,
|
|
||||||
internalId: internalId ?? this.internalId,
|
|
||||||
uuid:uuid?? this.uuid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {
|
|
||||||
'uuid': uuid,
|
|
||||||
'tag': tag,
|
|
||||||
'product': product?.toMap(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TagModelExtensions on TagModel {
|
|
||||||
TagBodyModel toTagBodyModel() {
|
|
||||||
return TagBodyModel()
|
|
||||||
..uuid = uuid
|
|
||||||
..tag = tag ?? ''
|
|
||||||
..productUuid = product?.uuid;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:syncrow_web/common/edit_chip.dart';
|
import 'package:syncrow_web/common/edit_chip.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/button_content_widget.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/button_content_widget.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart';
|
import 'package:syncrow_web/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/subspace_name_label_widget.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/subspace_name_label_widget.dart';
|
||||||
@ -10,9 +10,9 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
|||||||
class SubspaceModelCreate extends StatefulWidget {
|
class SubspaceModelCreate extends StatefulWidget {
|
||||||
final List<SubspaceTemplateModel> subspaces;
|
final List<SubspaceTemplateModel> subspaces;
|
||||||
final void Function(
|
final void Function(
|
||||||
List<SubspaceTemplateModel> newSubspaces, List<TagModel>? tags)?
|
List<SubspaceTemplateModel> newSubspaces, List<Tag>? tags)?
|
||||||
onSpaceModelUpdate;
|
onSpaceModelUpdate;
|
||||||
final List<TagModel> tags;
|
final List<Tag> tags;
|
||||||
|
|
||||||
const SubspaceModelCreate({
|
const SubspaceModelCreate({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -28,7 +28,7 @@ class SubspaceModelCreate extends StatefulWidget {
|
|||||||
class _SubspaceModelCreateState extends State<SubspaceModelCreate> {
|
class _SubspaceModelCreateState extends State<SubspaceModelCreate> {
|
||||||
late List<SubspaceTemplateModel> _subspaces;
|
late List<SubspaceTemplateModel> _subspaces;
|
||||||
String? errorSubspaceId;
|
String? errorSubspaceId;
|
||||||
late List<TagModel> _tags;
|
late List<Tag> _tags;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -117,7 +117,7 @@ class _SubspaceModelCreateState extends State<SubspaceModelCreate> {
|
|||||||
.where((s) => !updatedIds.contains(s.internalId))
|
.where((s) => !updatedIds.contains(s.internalId))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final List<TagModel> tagsToAppendToSpace = [];
|
final List<Tag> tagsToAppendToSpace = [];
|
||||||
|
|
||||||
for (var s in deletedSubspaces) {
|
for (var s in deletedSubspaces) {
|
||||||
if (s.tags != null) {
|
if (s.tags != null) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
|
|
||||||
abstract class AddDeviceModelState extends Equatable {
|
abstract class AddDeviceModelState extends Equatable {
|
||||||
const AddDeviceModelState();
|
const AddDeviceModelState();
|
||||||
@ -15,7 +15,7 @@ class AddDeviceModelLoading extends AddDeviceModelState {}
|
|||||||
|
|
||||||
class AddDeviceModelLoaded extends AddDeviceModelState {
|
class AddDeviceModelLoaded extends AddDeviceModelState {
|
||||||
final List<SelectedProduct> selectedProducts;
|
final List<SelectedProduct> selectedProducts;
|
||||||
final List<TagModel> initialTag;
|
final List<Tag> initialTag;
|
||||||
|
|
||||||
const AddDeviceModelLoaded({
|
const AddDeviceModelLoaded({
|
||||||
required this.selectedProducts,
|
required this.selectedProducts,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
|
|
||||||
abstract class AddDeviceTypeModelEvent extends Equatable {
|
abstract class AddDeviceTypeModelEvent extends Equatable {
|
||||||
const AddDeviceTypeModelEvent();
|
const AddDeviceTypeModelEvent();
|
||||||
@ -25,7 +25,7 @@ class UpdateProductCountEvent extends AddDeviceTypeModelEvent {
|
|||||||
|
|
||||||
|
|
||||||
class InitializeDeviceTypeModel extends AddDeviceTypeModelEvent {
|
class InitializeDeviceTypeModel extends AddDeviceTypeModelEvent {
|
||||||
final List<TagModel> initialTags;
|
final List<Tag> initialTags;
|
||||||
final List<SelectedProduct> addedProducts;
|
final List<SelectedProduct> addedProducts;
|
||||||
|
|
||||||
const InitializeDeviceTypeModel({
|
const InitializeDeviceTypeModel({
|
||||||
|
@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/common/buttons/cancel_button.dart';
|
import 'package:syncrow_web/pages/common/buttons/cancel_button.dart';
|
||||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart';
|
import 'package:syncrow_web/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/helper/tag_helper.dart';
|
import 'package:syncrow_web/pages/spaces_management/helper/tag_helper.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/tag_model/bloc/add_device_model_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/tag_model/bloc/add_device_model_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/tag_model/bloc/add_device_model_state.dart';
|
import 'package:syncrow_web/pages/spaces_management/tag_model/bloc/add_device_model_state.dart';
|
||||||
@ -20,7 +20,7 @@ class AddDeviceTypeModelWidget extends StatelessWidget {
|
|||||||
final List<ProductModel>? products;
|
final List<ProductModel>? products;
|
||||||
final List<SelectedProduct>? initialSelectedProducts;
|
final List<SelectedProduct>? initialSelectedProducts;
|
||||||
final List<SubspaceTemplateModel>? subspaces;
|
final List<SubspaceTemplateModel>? subspaces;
|
||||||
final List<TagModel>? spaceTagModels;
|
final List<Tag>? spaceTagModels;
|
||||||
final List<String>? allTags;
|
final List<String>? allTags;
|
||||||
final String spaceName;
|
final String spaceName;
|
||||||
final bool isCreate;
|
final bool isCreate;
|
||||||
|
Reference in New Issue
Block a user