<div class="modal fade" id="modal-info-repository-row" 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('repository_row.modal_info.head_title', repository_row: @repository_row.name) %>
          <%= @repository_row.archived? ? I18n.t('atwho.res.archived') : '' %>
        </h4>
      </div>

      <div class="modal-body">
        <ol class="breadcrumb breadcrumb-repository">
          <span class="fas fa-list-alt" aria-hidden="true"></span>
          <%= t('repositories.repository', name: @repository_row.repository.name) %>
          <%= @repository_row.repository.archived? ? I18n.t('atwho.res.archived') : '' %>
        </ol>
        <div class="row">
          <div class="col-md-8">
            <p>
              <span>
                <%= t('repository_row.modal_info.ID') %>
                <%= @repository_row.code %>
              </span>
              <br>
              <span>
                <%= t('repository_row.modal_info.added_on') %>:
                <%= l(@repository_row.created_at, format: :full) %>
              </span>
              <br>
              <span>
                <%= t('repository_row.modal_info.added_by') %>:
                <%= @repository_row.created_by.full_name %>
              </span>
              <% @repository_row.repository_cells.each do |repository_cell| %>
                <br>
                <span>
                  <%= t 'repository_row.modal_info.column_name', cf: repository_cell.repository_column.name %>
                  <% if repository_cell.value_type == 'RepositoryAssetValue' %>
                    <%= render partial: 'assets/asset_link', locals: { asset: repository_cell.value.asset, display_image_tag: false }, formats: :html %>
                  <% else %>
                    <%= custom_auto_link(repository_cell.value.formatted, simple_format: false, team: current_team) %>
                  <% end %>
                </span>
              <% end %>
            </p>
          </div>
          <div class="col-md-4 bar-code-container">
            <canvas id="bar-code-canvas" class="hidden" data-id="<%= @repository_row.parent_id || @repository_row.id %>"></canvas>
            <img id="bar-code-image"></img>
          </div>
        </div>

        <% if @repository_row.repository.is_a?(Repository) %>
          <% if @assigned_modules.size.positive? %>
            <div>
              <%= t('repository_row.modal_info.title', nr: @assigned_modules.size) %>
              <%= t('repository_row.modal_info.private_tasks', nr: @private_modules.size) if @private_modules.size.positive? %>
            </div>
            <% if @viewable_modules.size.positive? %>
            <div class="linked-children-datatable">
              <table id="repository_row-info-table" class="table dataTable no-footer" role="grid">
                <tbody>
                  <% @viewable_modules.each do |my_module|  %>
                    <tr role="row">
                      <td class="sorting_1">
                        <ol class='breadcrumb'>
                          <li>
                            <span class='fas fa-users'></span>&nbsp;
                            <%= render partial: 'search/results/partials/team_text.html.erb',
                                       locals: { team: my_module.experiment.project.team } %>
                          </li>
                          <li>
                            <%= image_tag 'icon_small/project.svg' %>
                            <%= render partial: 'search/results/partials/project_text.html.erb',
                                      locals: { project: my_module.experiment.project } %>
                          </li>
                          <li>
                            <%= image_tag 'icon_small/experiment.svg' %>
                            <%= render partial: 'search/results/partials/experiment_text.html.erb',
                                      locals: { experiment: my_module.experiment } %>
                          </li>
                          <li>
                            <%= image_tag 'icon_small/task.svg' %>
                            <%= render partial: 'search/results/partials/my_module_text.html.erb',
                                      locals: { my_module: my_module,
                                                link_to_page: :repositories,
                                                repository: @repository_row.repository } %>
                          </li>
                        </ol>
                      </td>
                    </tr>
                  <% end %>
                </tbody>
                <thead>
                  <tr>
                    <th></th>
                  </tr>
                </thead>
              </table>
            </div>
            <% end %>
          <% else %>
            <em><%= t('repository_row.modal_info.no_tasks') %></em>
          <% end %>
        <% end %>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal"><%= t('general.close')%></button>
        <button type="button" class="btn btn-primary print-label-button" data-dismiss="modal" data-url="<%= print_modal_repository_repository_rows_path(@repository_row.repository) %>"  data-rows="[<%= @repository_row.id %>]"><%= t('repository_row.modal_print_label.print_label') %></button>

      </div>
    </div>
  </div>
</div>
