mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
added condition to check parent name
This commit is contained in:
@ -133,13 +133,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
isNameFieldInvalid = value.isEmpty;
|
||||
|
||||
if (!isNameFieldInvalid) {
|
||||
if ((widget.parentSpace?.children.any(
|
||||
(child) => child.name == value) ??
|
||||
false) ||
|
||||
(widget.parentSpace?.name == value) ||
|
||||
(widget.editSpace?.children.any(
|
||||
(child) => child.name == value) ??
|
||||
false)) {
|
||||
if (_isNameConflict(value)) {
|
||||
isNameFieldExist = true;
|
||||
isOkButtonEnabled = false;
|
||||
} else {
|
||||
@ -387,7 +381,13 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool _isNameConflict(String value) {
|
||||
return (widget.parentSpace?.children.any((child) => child.name == value) ??
|
||||
false) ||
|
||||
(widget.editSpace?.parent?.name == value) ||
|
||||
(widget.editSpace?.children.any((child) => child.name == value) ??
|
||||
false);
|
||||
}
|
||||
|
||||
String _mapIconToProduct(String uuid, List<ProductModel> products) {
|
||||
// Find the product with the matching UUID
|
||||
|
Reference in New Issue
Block a user