Feat: Универсальный компонент Searchable Select

 TomSelect библиотека (15KB vs 100KB у Select2)
 Blade компонент x-searchable-select
 API endpoint /api/organizations/search
 Поиск по названию и ИНН
 AJAX загрузка данных
 Используется в create.blade.php для групп
 Модульная архитектура - можно использовать для других полей

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad
2026-03-30 10:36:02 +08:00
co-authored by Qwen-Coder
parent f198afd8a0
commit 4503c217eb
5 changed files with 100 additions and 10 deletions
+10 -7
View File
@@ -30,13 +30,13 @@
<div class="mb-3" id="organizationField" style="display:none;">
<label class="form-label">Организация *</label>
<select name="organization_id" class="form-select @error('organization_id') is-invalid @enderror">
<option value="">Выберите организацию</option>
@foreach($organizations as $id => $name)
<option value="{{ $id }}" {{ old('organization_id') == $id ? 'selected' : '' }}>{{ $name }}</option>
@endforeach
</select>
@error('organization_id')<div class="invalid-feedback">{{ $message }}</div>@enderror
<x-searchable-select
name="organization_id"
url="{{ route('api.organizations.search') }}"
placeholder="Начните вводить название организации..."
:required="true"
/>
@error('organization_id')<div class="invalid-feedback d-block">{{ $message }}</div>@enderror
</div>
<div class="mb-3">
@@ -90,3 +90,6 @@ document.addEventListener('DOMContentLoaded', function() {
});
</script>
@endsection
@push('scripts')
@endpush