<div class="modal fade" id="modal-info-sample" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title"><%= t('samples.modal_info.head_title', sample: @sample.name) %></h4>
      </div>

      <div class="modal-body">
        <p>
          <span>
            <%= t "samples.modal_info.sample_type" %>
            <% if @sample.sample_type.present? %>
              <%= @sample.sample_type.name %>
            <% else %>
              <em><%= t "samples.modal_info.no_type" %></em>
            <% end %>
          </span>
          <br>
          <span>
            <%= t "samples.modal_info.sample_group" %>
            <span class="glyphicon glyphicon-asterisk" style="<%= "color: #{@sample.sample_group.color}" if @sample.sample_group.present? %>"></span>
            <% if @sample.sample_group.present? %>
              <%= @sample.sample_group.name %>
            <% else %>
              <em><%= t "samples.modal_info.no_group" %></em>
            <% end %>
          </span>
          <br>
          <span>
            <%= t "samples.modal_info.added_on" %>
            <%= l @sample.created_at, format: :full %>
          </span>
          <br>
          <span>
            <%= t "samples.modal_info.added_by" %>
            <%= @sample.user.full_name %>
          </span>
          <% @sample.sample_custom_fields.each do |sample_custom_field| %>
            <br>
            <span>
              <%= t "samples.modal_info.custom_field", cf: sample_custom_field.custom_field.name %>
              <%= sample_custom_field.value %>
            </span>
          <% end %>
        </p>

      <% if @sample.my_modules.count > 0 %>
        <div>
          <%= t("samples.modal_info.title", nr: @sample.my_modules.count) %>
        </div>
        <div class="linked-children-datatable">
          <table id="sample-info-table" class="table dataTable no-footer" role="grid">
            <tbody>
              <% @sample.my_modules.each_with_index do |mod, i|  %>
                <tr role="row">
                  <td class="sorting_1">
                    <ol class='breadcrumb'>
                      <li><span class='glyphicon glyphicon-blackboard'></span>&nbsp;
                        <%= render partial: 'search/results/partials/project_text.html.erb',
                                  locals: { project: mod.experiment.project } %>
                      </li>
                      <li><i class='fa fa-flask'></i>&nbsp;
                        <%= render partial: 'search/results/partials/experiment_text.html.erb',
                                  locals: { experiment: mod.experiment } %>
                      </li>
                      <li><span class='glyphicon glyphicon-credit-card'></span>&nbsp;
                        <%= render partial: 'search/results/partials/my_module_text.html.erb',
                                  locals: { my_module: mod, link_to_page: :samples } %>
                      </li>
                    </ol>
                  </td>
                </tr>
              <% end %>
            </tbody>
            <thead>
              <tr>
                <th></th>
              </tr>
            </thead>
          </table>
        </div>
      <% else %>
        <em><%=t "samples.modal_info.no_tasks" %></em>
      <% end %>
      </div>

      <div class="modal-footer">
        <button type="button" class="btn btn-primary" data-dismiss="modal"><%= t("general.close")%></button>
      </div>
    </div>
  </div>
</div>
