<h1>Access Cards</h1> <%= link_to 'New Card', new_card_path if can? :create, Card %> <%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %> <%= link_to 'Door Logs', door_logs_path if can? :read, DoorLog %> <p> <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 %> </p> <table class="lined-table"> <col /> <col /> <col class="col_highlight" /> <col /> <col class="col_highlight" /> <tr> <th>User</th> <th>Note</th> <th>DB ID</th> <th>Card #</th> <th>Access?</th> <th>Days Accessed Last Month</th> <th></th> <th></th> <th></th> </tr> <% if !@cards.blank? %> <% @cards.each do |card| %> <tr> <td> <% if card.user.nil? %> n/a <% else %> <%= raw(card.user.member_status_symbol) %> <%= link_to card.user.name , card %> <% end %> </td> <td><%= card.name %></td> <td><%= card.id %></td> <td><%= card.card_number %></td> <td><%= if card.card_permissions == 1 then "Access" end %></td> <td><%= card.accesses_this_week unless card.accesses_this_week < 1 %></td> <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> </tr> <% end %> <% end %> </table> <br />