<div>
  <em>
    <%= t("projects.reports.elements.modals.project_contents_inner.instructions") %>
  </em>
</div>

<% if project.project_my_modules.is_archived(false).exists? %>
  <div class="checkbox-tree">
    <ul>
      <li>
        <%= form.check_box :project, label: project.name %>
        <ul>

          <% project.experiments.is_archived(false).each do |experiment| %>
            <% next unless experiment.my_modules.is_archived(false).exists? %>
            <li>
              <%= form.check_box "experiment_#{experiment.id}", label: experiment.name %>
              <ul>

                <% experiment.my_module_groups.each do |my_module_group| %>
                  <% next unless my_module_group.my_modules.is_archived(false).exists? %>
                  <% my_module_group.ordered_modules.is_archived(false).each do |my_module| %>
                    <li>
                      <%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
                    </li>
                  <% end %>
                <% end %>

                <!-- Tasks without groups -->
                <% modules_without_group = experiment.modules_without_group %>
                <% if modules_without_group.exists? %>
                  <% modules_without_group.each do |my_module| %>
                    <li>
                      <%= form.check_box "modules[#{my_module.id}]", label: my_module.name %>
                    </li>
                  <% end %>
                <% end %>

              </ul>
            </li>
          <% end %>

        </ul>
      </li>
    </ul>
  </div>
<% else %>
  <div>
    <em>
      <%= t("projects.reports.elements.modals.project_contents_inner.no_modules") %>
    </em>
  </div>
<% end %>
