Files
opensem/resources/views/load/form/select2.blade.php
Ludovic CANDELLIER a7f661ab10 fixes
2021-10-04 13:49:45 +02:00

27 lines
756 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', () => {
document.querySelector('.select2-search__field').focus();
});
}
</script>
@endpush
@push('css')
<link rel="stylesheet" href="/assets/plugins/select2/css/select2.min.css">
@endpush
@php(define('LOAD_SELECT2', true))
@endif