@if(!defined('LOAD_SET_OPTIONS'))
	@push('js')
		<script>  
			function setOptions(selector,data,selected,all) {
				// console.log(data);
				console.log(selector);
				var $el = $(selector);
				$el.empty(); // remove old options
				if (all) {
					$el.append($("<option></option>").attr("value",'').text('{{ __("all") }}'));
				}
				$.each(data, function(key, name) {
					if (key != null) {
						if (key == selected) {
							$el.append($("<option selected='selected'></option>").attr("value", key).text(name));
						} else {
							$el.append($("<option></option>").attr("value", key).text(name));
						}
					}
				});	
			}
		</script>
	@endpush
	@php(define('LOAD_SET_OPTIONS', true))
@endif		