2013-01-26 09:21:41 +00:00
<h1>Access Cards</h1>
2012-10-14 12:46:19 +00:00
2012-10-14 13:23:35 +00:00
<%= link_to 'New Card', new_card_path if can? :create, Card %>
<%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %>
2013-02-09 10:32:26 +00:00
<p>
<b>Most Active Card Last 7 Days:</b> <%= @most_active_card.name %> (<%= @most_active_card.accesses_this_week %> times)
</p>
2012-10-14 12:46:19 +00:00
<table>
2013-01-25 13:52:19 +00:00
<col />
<col />
<col class="col_highlight" />
<col />
<col class="col_highlight" />
2012-10-14 12:46:19 +00:00
<tr>
<th>User</th>
<th>Note</th>
<th>DB ID</th>
<th>Card #</th>
<th>Access?</th>
2013-02-09 10:32:26 +00:00
<th>Accesses Last 7 Days</th>
2012-10-14 12:46:19 +00:00
<th></th>
<th></th>
<th></th>
</tr>
<% if !@cards.blank? %>
<% @cards.each do |card| %>
<tr>
2013-02-09 10:32:26 +00:00
<td><%= link_to card.user.name, card %></td>
2012-10-14 12:46:19 +00:00
<td><%= card.name %></td>
<td><%= card.id %></td>
<td><%= card.card_number %></td>
<td><%= if card.card_permissions == 1 then "Access" end %></td>
2013-02-09 10:32:26 +00:00
<td><%= card.accesses_this_week unless card.accesses_this_week < 1 %></td>
2012-10-14 13:23:35 +00:00
<td><%= link_to 'Upload', upload_path(card) if can? :upload, card %></td>
<td><%= link_to 'Edit', edit_card_path(card) if can? :update, card %></td>
<td><%= link_to 'Destroy', card, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE CARD FROM THE DOOR SYSTEM! DISABLE AND UPLOAD IT FIRST.', :method => :delete if can? :destroy, card %></td>
2012-10-14 12:46:19 +00:00
</tr>
<% end %>
<% end %>
</table>
<br />