2024-07-22 13:09:45 +00:00
|
|
|
<x-leenooks::form.base {{ $attributes }}>
|
|
|
|
<select class="form-control @error($name) is-invalid @enderror" id="{{ $id }}" name="{{ $name }}">
|
|
|
|
@if(isset($addvalues) && $addvalues)
|
|
|
|
<option id="new"></option>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
@empty($groupby)
|
|
|
|
@foreach($options as $option)
|
|
|
|
@continue(! Arr::get($option,'value'))
|
2024-07-23 08:47:36 +00:00
|
|
|
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($name,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
|
2024-07-22 13:09:45 +00:00
|
|
|
@endforeach
|
|
|
|
@else
|
|
|
|
@foreach($options->groupBy($groupby) as $group)
|
|
|
|
<optgroup label="{{ $groupby == 'active' ? (Arr::get($group->first(),$groupby) ? 'Active' : 'Not Active') : Arr::get($group->first(),$groupby) }}">
|
|
|
|
@foreach($group as $option)
|
2024-07-23 08:47:36 +00:00
|
|
|
@continue(! Arr::get($option,'value'))
|
|
|
|
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
|
2024-07-22 13:09:45 +00:00
|
|
|
@endforeach
|
|
|
|
</optgroup>
|
|
|
|
@endforeach
|
|
|
|
@endempty
|
|
|
|
</select>
|
|
|
|
</x-leenooks::form.base>
|
|
|
|
|
|
|
|
@section('page-scripts')
|
|
|
|
@css(select2)
|
|
|
|
@js(select2,autofocus)
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#{{ $id }}').select2({
|
|
|
|
dropdownAutoWidth: true,
|
|
|
|
width: 'style',
|
|
|
|
@isset($addvalues)
|
|
|
|
tags: true,
|
|
|
|
placeholder: '',
|
|
|
|
allowClear: true,
|
|
|
|
@endisset
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@append
|