<h3 class="sub-header-4 mt-5">Data Filters</h3>
<div class="bg-gray p-3">

<% @presenter.sources.each do |source| %>
  <%# Source options; e.g. 'All Data' or 'Survey Data only' %>
  <%= form_with(url: district_school_analyze_index_path,
                method: :get,
                data: {
                turbo_frame: "results",
                turbo_action: "advance",
                controller: "analyze",
                action: "input->analyze#submit"
                }) do |f| %>

            <%  params.reject{|key,_| key == "graph"}.each do |key, value|  %>
                <input type="hidden" id="year" name="<%= key  %>" value="<%= value %>">
            <% end %>

            <input type="radio"
                   id="<%= source.slug %>"
                   class="form-check-input"
                   name="graph"
                   value="<%= source.graph.slug %>"
                   <%= source.slug == @presenter.source.slug ? "checked" : "" %>>
            <label for="<%= source.slug %>"><%= source.to_s %></label>
        <% end %>


        <% if source.slug != "all-data" %>
          <%= form_with(url: district_school_analyze_index_path,
                        method: :get,
                        data: {
                        turbo_frame: "results",
                        turbo_action: "advance",
                        controller: "analyze",
                        action: "input->analyze#submit"
                        }) do |f| %>

            <%  params.reject{|key,_| key == "graph"}.each do |key, value|  %>
                  <input type="hidden" id="year" name="<%= key  %>" value="<%= value %>">
            <% end %>

            <%# Slices; e.g. 'Students & Teachers' or 'Students by Group' or 'Parents by Group' %>
            <% @presenter.slices.each do | slice |  %>
              <div class="d-flex flex-row mx-3">
                  <input type="radio"
                        id="<%= slice.slug %>"
                        class="form-check-input me-2"
                        name="graph"
                        value="<%= slice.graph.slug %>"
                        <%= slice.slug == @presenter.slice.slug ? "checked" : "" %>
                        <%= slice.slug == "all-data" ? "hidden" : "" %>>

                  <label class="text-break" for="<%= slice.slug %>"
                    <%= slice.slug == "all-data" ? "hidden" : "" %>>
                    <%= slice.to_s %></label>
                    <% if slice.slug == "parents-by-group"  %>
                       <i class='fa-solid fa-circle-question px-3' data-bs-toggle='popover' data-bs-placement='right' data-bs-content='This graph displays results from the parent survey organized by the demographics of their children, as opposed to the demographics of the parent. For example, the “male students” graph displays data from all parents who have male students in the selected school.'></i>
                    <% end %>
              </div>
            <% end %>
      <% end %>
  <% end %>
<% end %>

<%= render partial: "group_selectors" %>
</div>
