restart
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
@isset($label)
|
||||
<label for="{{ $id }}">{!! __($label) !!}</label>
|
||||
@endisset
|
||||
<select id="{{ $id }}" name="{{ $name }}" class="form-control{{ $errors->first($name,' is-invalid') }}{{ isset($class) ? ' '.$class : '' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden;height:1rem" autocomplete="off">
|
||||
<select id="{{ $id }}" name="{{ $name }}" class="form-control{{ $errors->first($nameDot,' is-invalid') }}{{ isset($class) ? ' '.$class : '' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden;height:1rem" autocomplete="off">
|
||||
@if(!isset($multiple))
|
||||
<option></option>
|
||||
@endif
|
||||
@@ -20,7 +20,7 @@
|
||||
@if($help ?? false)
|
||||
<small class="form-text text-muted">@lang($help)</small>
|
||||
@endif
|
||||
@error($name)
|
||||
@error($nameDot)
|
||||
<div class="error-bubble"><div>{{ $message }}</div></div>
|
||||
@enderror
|
||||
</div>
|
||||
@@ -28,21 +28,36 @@
|
||||
@component('boilerplate::minify')
|
||||
<script>
|
||||
whenAssetIsLoaded('select2', () => {
|
||||
let parent = $('#{{ $id }}').parent();
|
||||
$('#{{ $id }}').select2({
|
||||
window.{{ 'S2_'.\Str::camel($id) }} = $('#{{ $id }}').select2({
|
||||
placeholder: '{{ $placeholder ?? '—' }}',
|
||||
allowClear: {{ $allowClear }},
|
||||
language: "{{ App::getLocale() }}",
|
||||
direction: "@lang('boilerplate::layout.direction')",
|
||||
minimumInputLength: {{ $minimumInputLength ?? 0 }},
|
||||
minimumInputLength: {{ $minimumInputLength ?? intval(isset($model)) }},
|
||||
minimumResultsForSearch: {{ $minimumResultsForSearch ?? 10 }},
|
||||
width: '100%',
|
||||
dropdownAutoWidth: true,
|
||||
dropdownParent: parent,
|
||||
dropdownParent: $('#{{ $id }}').parent(),
|
||||
tags: {{ $tags ?? 0 }},
|
||||
escapeMarkup: function(markup) { return markup },
|
||||
@isset($ajax)
|
||||
ajax: {
|
||||
delay: 200,
|
||||
url: '{{ $ajax }}',
|
||||
data: function (param) {
|
||||
return {
|
||||
q: param.term,
|
||||
length: {{ $maxLength ?? 10 }},
|
||||
@isset($model)
|
||||
m: "{{ $model }}",
|
||||
@endisset
|
||||
@if(!empty($ajaxParams))
|
||||
@foreach ($ajaxParams as $k => $v)
|
||||
{{ $k }}: "{{ $v }}",
|
||||
@endforeach
|
||||
@endif
|
||||
}
|
||||
},
|
||||
method: 'post'
|
||||
}
|
||||
@endisset
|
||||
|
||||
Reference in New Issue
Block a user