<% if current_user.acts_as_reviewer? %>
  <div data-id="vote-count">
    <strong>Votes: </strong>

    <% if @candidate.pending? && current_user.commented_on?(@candidate.test_hash) %>
      <%= link_to admin_up_vote_path(test_hash: @candidate.test_hash), remote: true do %>
        Yea (<span data-id="up-votes"><%= @candidate.votes.yea.count %></span>)
      <% end %>

      <%= link_to admin_down_vote_path(test_hash: @candidate.test_hash), remote: true do %>
        Nay (<span data-id="down-votes"><%= @candidate.votes.nay.count %></span>)
      <% end %>
    <% elsif @candidate.pending? %>
      <div>You must comment before you can vote</div>
      <span>Yea (<span data-id="up-votes"><%= @candidate.votes.yea.count %></span>)</span>
      <span>Nay (<span data-id="down-votes"><%= @candidate.votes.nay.count %></span>)</span>
    <% else %>
      Voting closed -
      Yea (<%= @candidate.votes.yea.count %>) -
      Nay (<%= @candidate.votes.nay.count %>)
    <% end %>

    <small>(Your vote: <span data-id="my-vote"><%= current_user.my_vote(@candidate) %></span>)</small>
  </div>
<% end %>

<% if current_user.acts_as_manager? %>
  <div>
    <%= form_tag admin_interview_path(test_hash: @candidate.test_hash) do %>
      <strong>Interview: </strong>

      <%= radio_button_tag :review_status, :approved, checked = @candidate.approved? %>
      <%= label_tag :review_status_approved, "Yes" %>

      <%= radio_button_tag :review_status, :declined, checked = @candidate.declined? %>
      <%= label_tag :review_status_declined, "No" %>

      <div>
        <span>Review comments for recruiter</span>
        <%= text_area_tag :review_comments, @candidate.review_comments %>
        <%= submit_tag 'Send Request' %>
      </div>
    <% end %>
  </div>
<% else %>

  <strong>Candidate Interview Status: </strong><%= @candidate.review_status %>
  <% unless @candidate.review_status.blank? %>
    <div>Review Status Comments:</div>
    <div><%= @candidate.review_comments %></div>
  <% end %>
<% end %>
