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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user