<% if current_user.org_id? %>
  <div class="row">
    <div class="col-md-12">
      <div class="table-responsive">
        <table class="table table-hover">
          <thead>
            <tr>
              <th scope="col">
                <%= _('Project Title') %>&nbsp;
                <%= paginable_sort_link('plans.title') %>
              </th>
              <th scope="col">
                <%= _('Template') %>&nbsp;
                <%= paginable_sort_link('templates.title') %>
              </th>
              <th scope="col"><%= _('Owner') %></th>
              <th scope="col" class="date-column">
                <%= _('Updated') %>&nbsp;
                <%= paginable_sort_link('plans.updated_at') %>
              </th>
              <th scope="col" class="sorter-false download-column"><%= _('Download') %></th>
            </tr>
          </thead>
          <tbody>
            <% scope.each do |plan| %>
              <tr>
                <td>
                  <%= truncate plan.title, length: 40 %>
                </td>
                <td><%= plan.template.title %></td>
                <td><%= plan.owner.present? ? plan.owner.name : _('Unknown') %></td>
                <td><%= l(plan.updated_at.to_date, formats: :short) %></td>
                <td class="text-center">
                  <%= link_to plan_export_path(plan, format: :pdf),
                      target: '_blank' do %>
                    <i class="fa fa-file-pdf-o" aria-hidden="true"></i>
                    <em class="sr-only"><%= _('(new window)') %></em>
                  <% end %>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
    </div>
  </div>
<% end %>

