<link rel"stylesheet" type="text/css" href="application.css">


<body>

<div class="box fade-in one">


<h1 style="margin-left:100px;margin-top:100px;font-family:Droid Sans">Election 2016</h1>

<h3 style="color:#0080ff;margin-left:100px">
<%= link_to "MIS 21 - B DataBAES", "/about" %>
</h3>

<h4 style="color:#0080ff;margin-left:100px">
	<% if user_signed_in? %>
	  	<% if current_user.email == "norenceilicito@gmail.com" %>
            Hello <a href = "/vote_history"> <%= current_user.first_name %></a>! <br>
      	  	<h4 style="margin-left:100px">
            <%= link_to "Vote", vote_path %>&nbsp;&nbsp;
            <%= link_to('Log Out', destroy_user_session_path, :method => :delete) %> &nbsp;&nbsp;
            <%= link_to "Admin", admin_candidates_path %>
            </h4>
      <% else %>
            Hello <a href = "/vote_history"> <%= current_user.first_name %></a>! <br>
            <h4 style="margin-left:100px">
            <%= link_to "Vote", vote_path %>&nbsp;&nbsp;
            &nbsp;&nbsp;
            <%= link_to('Log Out', destroy_user_session_path, :method => :delete) %></h4>
      <% end %>
	<% else %>
		<h5 style="color:#0080ff;margin-left:100px">
			You're not signed in.
			<%= link_to "Login", new_user_session_path %>
			<%= link_to "Register", new_user_registration_path %>

		</h5>
	<% end %>

</h4>

<table width="100%" style="margin:100px;">
  <tr>
    <th>Position</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Slogan</th>
    <th>Number of Votes</th>
  </tr>
  <% @candidates.each do |position_id, candidates| %>
    <tr>
      <% candidates.each do |candidate|%>
    </tr>
      
    <tr>
      <!--<td><%= candidate.position_id %></td>-->
      <td><%= Position.find(position_id).name %>
      <td><%= candidate.first_name %></td>
      <td><%= candidate.last_name %></td>
      <td><%= candidate.slogan %></td>
      <td><%= candidate.votes.count %></td>
    </tr>
      <% end %>
  <% end %>
</table>





</div>




</body>

