<%
# Copyright (C) 2013 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% if @quiz.description && !@quiz.description.empty? %>
  <div class="description user_content teacher-version"><%= public_user_content(@quiz.description) %></div>
<% end %>

<form class="form-horizontal bootstrap-form display-only" style="margin-top:18px;">
  <fieldset>
    <div class="control-group">
      <div class="control-label">
        <%= t(:quiz_type, "Quiz Type") %>
      </div>
      <div class="controls">
        <span class="value"><%= render_quiz_type(@quiz.quiz_type) %></span>
      </div>
    </div>

    <div class="control-group">
      <div class="control-label">
        <%= t(:points, "Points") %>
      </div>
      <div class="controls">
        <span class="value"><%= points_possible_display %></span>
      </div>
    </div>

    <% if @quiz.graded? && @quiz.assignment_group.present? %>
      <div class="control-group">
        <div class="control-label">
          <%= t(:group, "Assignment Group") %>
        </div>
        <div class="controls">
          <span class="value"><%= @quiz.assignment_group.name %></span>
        </div>
      </div>
    <% end %>

    <div class="control-group">
      <div class="control-label">
        <%= t(:shuffle_answers, "Shuffle Answers") %>
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.shuffle_answers ? t('#options.yes', "Yes") : t('#options.no', "No") %>
        </span>
      </div>
    </div>

    <div class="control-group">
      <div class="control-label">
        <%= t('label.time_limit', "Time Limit") %>
      </div>
      <div class="controls">
        <span class="value">
          <% if @quiz.time_limit %>
            <%= t(:time_limit, "Minute", :count => @quiz.time_limit + ((@submission && @submission.extra_time) || 0)) %>
          <% else %>
            <%= t(:no_time_limit, "No Time Limit") %>
          <% end %>
        </span>
      </div>
    </div>

    <div class="control-group">
      <div class="control-label">
        <%= t(:multiple_attempts, "Multiple Attempts") %>
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.single_attempt? ? t('#options.no', "No") : t('#options.yes', "Yes") %>
        </span>
      </div>
    </div>

    <% unless @quiz.single_attempt? %>
      <div class="control-group">
        <div class="control-label">
          <%= t(:score_to_keep, "Score to Keep") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= render_score_to_keep(@quiz.scoring_policy) %>
          </span>
        </div>
      </div>

      <div class="control-group">
        <div class="control-label">
          <%= t(:attempts, "Attempts") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.unlimited_attempts? ? t(:unlimited, "Unlimited") : @quiz.allowed_attempts %>
          </span>
        </div>
      </div>
    <% end %>

    <div class="control-group">
      <div class="control-label">
        <%= t(:view_responses, "View Responses") %>
      </div>
      <div class="controls">
        <span class="value">
          <%= render_show_responses(@quiz.hide_results) %>
        </span>
      </div>
    </div>

    <% if @quiz.hide_results != 'always' %>
      <div class="control-group">
        <div class="control-label">
          <%= t('show_correct_answers', "Show Correct Answers") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= render_show_correct_answers(@quiz) %>
          </span>
        </div>
      </div>
    <% end %>

    <% unless @quiz.access_code.blank? %>
      <div class="control-group">
        <div class="control-label">
          <%= t(:code, "Access Code") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.access_code %>
          </span>
        </div>
      </div>
    <% end %>

    <% unless @quiz.ip_filter.blank? %>
      <div class="control-group">
        <div class="control-label">
          <%= t(:filter, "IP Filter") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.ip_filter %>
          </span>
        </div>
      </div>
    <% end %>

    <div class="control-group">
      <div class="control-label">
        <%= t('one_question_at_a_time', 'One Question at a Time') %>
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.one_question_at_a_time? ? t('#options.yes', "Yes") : t('#options.no', "No") %>
        </span>
      </div>
    </div>

    <% if feature_enabled?(:lockdown_browser) %>
      <div class="control-group">
        <div class="control-label">
          <%= t(:require_lockdown_browser, "Require Respondus LockDown Browser") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.require_lockdown_browser ? t('#options.yes', "Yes") : t('#options.no', "No") %>
          </span>
        </div>
      </div>

      <div class="control-group">
        <div class="control-label">
          <%= t(:require_lockdown_browser_for_results, "Required to View Quiz Results") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.require_lockdown_browser_for_results ? t('#options.yes', "Yes") : t('#options.no', "No") %>
          </span>
        </div>
      </div>
      <% if @quiz.lockdown_browser_use_lti_tool? %>
        <div class="control-group">
          <div class="control-label">
            <%= t(:require_lockdown_browser_monitor, "Webcam Required") %>
          </div>
          <div class="controls">
            <span class="value">
              <%= @quiz.require_lockdown_browser_monitor ? t('#options.yes', "Yes") : t('#options.no', "No") %>
            </span>
          </div>
        </div>
      <% end %>
    <% end %>

    <% if @quiz.one_question_at_a_time %>
      <div class="control-group">
        <div class="control-label">
          <%= t('cant_go_back', "Lock Questions After Answering") %>
        </div>
        <div class="controls">
          <span class="value">
            <%= @quiz.cant_go_back ? t('#options.yes', "Yes") : t('#options.no', "No") %>
          </span>
        </div>
      </div>
    <% end %>

    <div class="control-group" style="<%= hidden unless @quiz.survey? %>">
      <div class="control-label">
        <%= t('anonymous_submissions', "Anonymous Submissions") %>
      </div>
      <div class="controls">
        <span class="value">
          <%= @quiz.anonymous_submissions ? t('#options.yes', "Yes") : t('#options.no', "No") %>
        </span>
      </div>
    </div>
  </fieldset>
</form>

<table class="ic-Table assignment_dates">
  <thead>
    <tr>
      <th scope="col"><%= t(:due, 'Due') %></th>
      <th scope="col"><%= t(:for, 'For') %></th>
      <th scope="col"><%= t(:available_from, 'Available from') %></th>
      <th scope="col"><%= t(:until, 'Until') %></th>
    </tr>
  </thead>

  <%= render 'shared/override_list', :assignment => @quiz,
    :user => @current_user %>

</table>
