<%= javascript_tag do %>
var operatorLabels = <%= raw_json Query.operators_labels %>;
var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
var availableFilters = <%= raw_json query.available_filters_as_json %>;
var labelDayPlural = <%= raw_json l(:label_day_plural) %>;

var filtersUrl = <%= raw_json queries_filter_path(:project_id => @query.project.try(:id), :type => @query.type) %>;

$(document).ready(function(){
  initFilters();
  <% query.filters.each do |field, options| %>
  addFilter("<%= field %>", <%= raw_json query.operator_for(field) %>, <%= raw_json query.values_for(field) %>);
  <% end %>
});
<% end %>

<div id="filters-table">
</div>

<div class="add-filter">
<%= label_tag('add_filter_select', l(:label_filter_add)) %>
<%= select_tag 'add_filter_select', filters_options_for_select(query), :name => nil %>
</div>

<div id="icon-copy-source" style="display: none;"><%= sprite_icon('') %></div>
<%= hidden_field_tag 'f[]', '' %>
<% include_calendar_headers_tags %>
