2013-01-26 09:21:41 +00:00
<h1>Access Cards</h1>
2012-10-14 12:46:19 +00:00
2013-12-02 09:03:40 +00:00
<%= link_to 'New Card', new_card_path, :class => "btn" if can? :create, Card %>
<%= link_to 'Upload all cards', upload_all_path, :class => "btn" if can? :upload_all, Card %>
<%= link_to 'Door Logs', door_logs_path, :class => "btn" if can? :read, DoorLog %>
<%= link_to 'Space API', space_api_path, :class => "btn" %>
<%= link_to 'Remote Door Access', space_api_access_path, :class => "btn" if can? :access_doors_remotely, :door_access %>
2013-02-09 10:32:26 +00:00
<p>
2013-09-27 08:19:58 +00:00
<b>Most Active Card Last Month:</b> <%= @most_active_card.name unless @most_active_card.blank? %> (<%= @most_active_card.accesses_this_week unless @most_active_card.blank? %> days)
</p>
<p>
<% unless @runner_up_card.blank? %>
<b>Runner Up:</b> <%= @runner_up_card.name %> (<%= @runner_up_card.accesses_this_week %> days)
<% end %>
2013-02-09 10:32:26 +00:00
</p>
2013-08-28 15:40:36 +00:00
<table class="lined-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-09-27 08:19:58 +00:00
<th>Days Accessed Last Month</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-05-24 06:25:09 +00:00
<td>
<% if card.user.nil? %>
n/a
<% else %>
2013-08-28 15:40:36 +00:00
<%= raw(card.user.member_status_symbol) %>
2013-05-24 06:25:09 +00:00
<%= link_to card.user.name , card %>
<% end %>
</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 />