select.blade.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <div class="input-group input-group-sm">
  2. <div class="input-group-prepend">
  3. <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b></span>
  4. </div>
  5. <select class="form-control {{ $class }}" name="{{$name}}" data-value="{{ request($name, $value) }}" style="width: 100%;">
  6. @if($selectAll)
  7. <option value="">{{trans('admin.all')}}</option>
  8. @endif
  9. @foreach($options as $select => $option)
  10. <option value="{{$select}}" {{ Dcat\Admin\Support\Helper::equal($select, request($name, $value)) ?'selected':'' }}>{{$option}}</option>
  11. @endforeach
  12. </select>
  13. </div>
  14. @include('admin::scripts.select')
  15. <script require="@select2">
  16. var configs = {!! json_encode($configs) !!};
  17. @yield('admin.select-ajax')
  18. @if(isset($remote))
  19. $.ajax({!! $remote['ajaxOptions'] !!}).done(function(data) {
  20. $("{{ $selector }}").select2($.extend({!! json_encode($configs) !!}, {
  21. data: data,
  22. })).val({!! $values !!}).trigger("change");
  23. });
  24. @else
  25. $("{!! $selector !!}").select2(configs);
  26. @endif
  27. </script>
  28. @yield('admin.select-load')
  29. @yield('admin.select-lang')