43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<div class="form-group">
|
|
<label for="{{ $id }}">{{ $label }}</label>
|
|
<div class="input-group">
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text"><i class="fa-fw {{ $icon ?? 'fas fa-list' }}"></i></span>
|
|
</div>
|
|
|
|
<select class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}">
|
|
@if(! isset($addvalues) || ! $addvalues)
|
|
<option id="new"></option>
|
|
@endif
|
|
@foreach($options as $option)
|
|
@empty(Arr::get($option,'value')) @continue @endempty
|
|
<option value="{{ Arr::get($option,'id') }}" @if(Arr::get($option,'id') == old($old,$value))selected @endif>{{ Arr::get($option,'value') }}</option>
|
|
@endforeach
|
|
</select>
|
|
|
|
<span class="invalid-feedback" role="alert">
|
|
@error($id)
|
|
{{ $message }}
|
|
@enderror
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
@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 |