33 lines
919 B
PHP
33 lines
919 B
PHP
@if(!defined('LOAD_SELECT2'))
|
|
@push('scripts')
|
|
<script src="/assets/plugins/select2/js/select2.full.min.js"></script>
|
|
<script src="/assets/plugins/select2/js/i18n/{{ App::getLocale() }}.js"></script>
|
|
|
|
<script>
|
|
function initSelect2(sel) {
|
|
var selector = (typeof(sel) == 'undefined') ? '.select2' : sel;
|
|
$(selector).select2({
|
|
placeholder: "{{ __('select_a_value') }}",
|
|
allowClear: false,
|
|
width: {
|
|
value: '100%'
|
|
}
|
|
});
|
|
|
|
$(document).on('select2:open',(e) => {
|
|
let t = $(e.target);
|
|
console.log(t);
|
|
if (t && t.length) {
|
|
let id = t[0].id || t[0].name;
|
|
let item = document.querySelector(`input[aria-controls*='${id}']`);
|
|
return item ? item.focus() : false;
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
@endpush
|
|
@push('css')
|
|
<link rel="stylesheet" href="/assets/plugins/select2/css/select2.min.css">
|
|
@endpush
|
|
@php(define('LOAD_SELECT2', true))
|
|
@endif |