Fix: onChange + фильтрация групп
✅ this.options[value] вместо select.options[value] ✅ Проверка data перед addTag ✅ Исправлена группировка whereNull + orWhere в API Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
6a725d27de
commit
5689604004
|
|
@ -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 {
|
||||
// Пользователь без организации - только общие группы
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue