31 lines
975 B
PHP
31 lines
975 B
PHP
@script
|
|
<script>
|
|
const initialiseHelpdeskSelect2 = function () {
|
|
if (!window.jQuery || !window.jQuery.fn || !window.jQuery.fn.select2) {
|
|
return;
|
|
}
|
|
|
|
window.jQuery('[data-helpdesk-select2], [data-helpdesk-select]').each(function () {
|
|
const element = window.jQuery(this);
|
|
|
|
if (element.data('select2')) {
|
|
return;
|
|
}
|
|
|
|
element.select2({
|
|
width: '100%',
|
|
theme: 'default'
|
|
});
|
|
|
|
element.on('change', function () {
|
|
this.dispatchEvent(new Event('input', { bubbles: true }));
|
|
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
});
|
|
});
|
|
};
|
|
|
|
initialiseHelpdeskSelect2();
|
|
document.addEventListener('livewire:navigated', initialiseHelpdeskSelect2);
|
|
</script>
|
|
@endscript
|