<div class="row">
<div class="col-md-12">
<h1><%= _('%{org_name} Plans') % { org_name: current_user.org.name } %></h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<% if @feedback_plans.length > 0 %>
<h2><%= _('Notifications') %></h2>
<div class="panel panel-default">
<div class="panel-body notifications">
<table class="table">
<thead>
<th><%= _('Plan') %></th>
<th><%= _('Requestor') %></th>
<th><%= _('Type') %></th>
<th><%= _('Actions') %></th>
</thead>
<tbody>
<% @feedback_plans.each do |notice| %>
<!-- Using the plan owner as the requestor even though it could have been issued by a co-owner -->
<!-- TODO: correct this behavior once the notification table is in place -->
<tr>
<td><%= link_to notice.name, plan_path(notice) %></td>
<td><%= notice.owner.name(false) %></td>
<td><%= _('Feedback requested') %></td>
<td><%= link_to _('Complete'), feedback_complete_org_admin_plan_path(notice), 'data-toggle': 'tooltip', title: _('Notify the plan owner that I have finished providing feedback') %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<% end %>
<% if @plans.length > 0 %>
<%= link_to _('Download plans'), org_admin_download_plans_path(format: :csv), target: '_blank', class: 'btn btn-default pull-right' %>
<div class="table-responsive">
<table class="table table-hover tablesorter" id="my-plans">
<thead>
<% if @plans.length > TABLE_FILTER_MIN_ROWS %>
<tr>
<th colspan="6" class="sorter-false">
<%= render(partial: "shared/table_filter",
locals: { placeholder: _('Filter plans')}) %>
</th>
</tr>
<% end %>
<tr>
<th><%= _('Project Title') %></th>
<th><%= _('Template') %></th>
<th><%= _('Organisation') %></th>
<th><%= _('Owner') %></th>
<th><%= _('Updated') %></th>
<th><%= _('Visibility') %></th>
</tr>
</thead>
<tbody>
<% @plans.each do |plan| %>
<tr>
<td>
<%= link_to "#{plan.title.length > 60 ? "#{plan.title[0..59]} ..." : plan.title}", plan_path(plan) %>
</td>
<td><%= plan.template.title %></td>
<td><%= plan.users.first.org.name %></td>
<td><%= plan.users.first.name(false) %></td>
<td><%= l(plan.latest_update.to_date, formats: :short) %></td>
<td class="plan-visibility">
<%= plan.visibility === 'is_test' ? _('Test') : raw(display_visibility(plan.visibility)) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
</div>
</div>