diff --git a/app/Http/Controllers/Api/GroupSearchController.php b/app/Http/Controllers/Api/GroupSearchController.php index a327afe..c7c05a9 100755 --- a/app/Http/Controllers/Api/GroupSearchController.php +++ b/app/Http/Controllers/Api/GroupSearchController.php @@ -22,8 +22,8 @@ class GroupSearchController extends Controller if ($user->organization_id) { // Пользователь в организации - показываем общие + группы организации $groupsQuery->where(function($q) use ($user) { - $q->whereNull('organization_id') - ->orWhere('organization_id', $user->organization_id); + $q->whereNull('organization_id'); + $q->orWhere('organization_id', $user->organization_id); }); } else { // Пользователь без организации - только общие группы diff --git a/resources/views/components/tags-input.blade.php b/resources/views/components/tags-input.blade.php index 8859bf3..cf3b671 100644 --- a/resources/views/components/tags-input.blade.php +++ b/resources/views/components/tags-input.blade.php @@ -91,20 +91,20 @@ document.addEventListener('DOMContentLoaded', function() { } }, onChange: function(value) { - if (value) { - addTag(value, select.options[value]); - select.clear(); + if (value && this.options[value]) { + addTag(value, this.options[value]); + this.clear(); } } }); - + // Добавление тега function addTag(id, data) { - if (selectedTags.has(String(id))) return; - + if (!data || selectedTags.has(String(id))) return; + selectedTags.add(String(id)); updateHiddenInput(); - + const tag = document.createElement('div'); tag.className = 'tag-badge'; tag.dataset.id = id;