26 lines
923 B
PHP
26 lines
923 B
PHP
@if (!defined('LOAD_AUTOCOMPLETE'))
|
|
@push('js')
|
|
<script src="{{ asset('/assets/plugins/autocomplete/bootstrap-autocomplete.min.js') }}"></script>
|
|
<script>
|
|
function initAutocomplete(sel, callback) {
|
|
var selector = (typeof(sel) == 'undefined') ? '.autocomplete' : sel;
|
|
$(selector).autoComplete({
|
|
noResultsText: ''
|
|
});
|
|
|
|
$(selector).on('autocomplete.select', function(evt, item) {
|
|
var field = $(this).data('field');
|
|
var id = item.value;
|
|
$('#' + field).val(id);
|
|
|
|
if (typeof(callback) != 'undefined') {
|
|
var c = callback + '(' + id + ')';
|
|
eval(c);
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
@endpush
|
|
@php(define('LOAD_AUTOCOMPLETE', true))
|
|
@endif
|