2022-08-02 12:34:20 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="{{ $id }}">{{ $label }}</label>
|
2022-08-05 14:19:20 +00:00
|
|
|
<div class="input-group has-validation">
|
|
|
|
@empty($icon)
|
|
|
|
@else
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fa-fw {{ $icon }}"></i></span>
|
|
|
|
</div>
|
|
|
|
@endempty()
|
2022-08-02 12:34:20 +00:00
|
|
|
|
|
|
|
<select class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}">
|
|
|
|
@if(! isset($addvalues) || ! $addvalues)
|
|
|
|
<option id="new"></option>
|
|
|
|
@endif
|
2024-07-03 03:02:59 +00:00
|
|
|
@empty($groupby)
|
2022-08-05 14:19:20 +00:00
|
|
|
@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
|
|
|
|
@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)
|
|
|
|
@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
|
|
|
|
</optgroup>
|
|
|
|
@endforeach
|
|
|
|
@endempty
|
2022-08-02 12:34:20 +00:00
|
|
|
</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
|