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


<body class = "indexcontainer">

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



<h1 style="font-size:100px; color:#464646; margin-left:100px;margin-top:100px;font-family:impact; padding-left:350px ">Election 2016</h1>

<h3 style="color:#464646;margin-left:50px; position:absolute; padding-left:560px; font-family:impact;" >
<%= link_to "MIS 21 - B DataBAES", "/about" %>
</h3>

<h2 style="color:#464646;margin-left:100px; padding-top:50px;padding-left: 530px;font-family:impact;">
	<% if user_signed_in? %>
	  	<% if current_user.email == "norenceilicito@gmail.com" %>
            Hello <a href = "/vote_history"> <%= current_user.first_name %></a>! <br>
      	  	<h3 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; padding-left:530px; padding-top:20px">
            <%= link_to "Vote", vote_path %>&nbsp;&nbsp;
            &nbsp;&nbsp;
            <%= link_to('Log Out', destroy_user_session_path, :method => :delete) %></h4>
      <% end %>
	<% else %>
		<h4 style="color:#464646;margin-left:100px; padding-top:10px;padding-left:480px; font-family:impact;">
			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="font-size: 15px;margin-left:330px; margin-top:80px ;font-family:fantasy;">
  <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>

