$(function() {
	// Buscar e seleção de fornecedor
	$('#search_provider').on('keyup', function() {
		if($(this).val() != '') {
			let text = $(this).val();		
			utils.searchRequestBy('searchprovider', text, 'searchresultprovider');
		} else {
			$('.searchresultprovider').hide();
		}
	});

	$(document).on('click', 'div.searchresultprovider ul li', function() {
		let clicked = parseInt($(this).attr('data-list'));
		let text = $(this).html();

		$('input[name="filter[provider]"]').val(clicked);
		$('input[name="filter[provider_name]"]').val(text);
		$('div.searchresultprovider').hide(100);
	});
});