<%
  content_for :title, "Quiz Review - Skills Assessment Admin"
%>

<div>
  <h1>Quiz Review</h1>

  <div>
    <% unless @candidate.pending? %>
      <strong>Name:</strong> <%= @candidate.name %><br />
    <% end %>
    <strong>Test ID:</strong> <%= @candidate.test_hash %><br />
    <strong>Years of Experience:</strong> <%= @candidate.experience %><br />
    <strong>Client/Project:</strong> <%= @candidate.project %><br />
    <strong>Position Type:</strong> <%= @candidate.position %><br />
    <strong>Skill Needs:</strong> <%= @candidate.skill_needs %><br />
    <strong>Recruiter Email:</strong> <%= mail_to @candidate.recruiter.name, @candidate.recruiter.email %><br />
  </div>

  <% @quiz.each do |question| %>
    <%= form_for(:answer, url: '#never-post', html:{id: 'summary-form'}) do |form| %>
      <h2><%= question.question %></h2>
      <%= image_tag question.attachment if question.attachment.present? %>

      <fieldset disabled>
        <%= render partial: "quiz/#{question.input_type}", locals: {question: question, answer: question.answer, form: form} %>
      </fieldset>
    <% end %>
  <% end %>

  <%= link_to("Back to list", admin_results_path, { class: "" }) %>
</div>

<div>
  <div>
    <h1>Voting</h1>
    <div><%= render partial: 'voting' %></div>
  </div>

  <div>
    <h1 id="comment-header">Comments</h1>
    <% if policy(QuizComment).new? %>
      <%= render partial: 'comment_form', locals: {comment: @comment, test_hash: @candidate.test_hash } %>
    <% end %>
    <%= render partial: 'comment', collection: @comments, locals: { test_hash: @candidate.test_hash } %>
    <a href="#comment-header">Back to top</a>
  </div>
</div>
