{% load i18n %}
<div class="sequence proctored-exam completed" data-exam-id="{{exam_id}}">
  <h3>
    {% blocktrans %}
      You have submitted this practice proctored exam
    {% endblocktrans %}
  </h3>

  <p>
    {% blocktrans %}
      Practice exams do not affect your grade.
      You have completed this practice exam and can continue with your course work.
    {% endblocktrans %}
  </p>
  <button class="gated-sequence start-timed-exam action-primary" data-ajax-url="{{enter_exam_endpoint}}" data-exam-id="{{exam_id}}" data-attempt-proctored=true data-start-immediately=false>
    
    <a>
      {% trans "You can also retry this practice exam" %}
    </a>
  </button>
</div>
<script type="text/javascript">
  $('.start-timed-exam').click(
    function(event) {
      var action_url = $(this).data('ajax-url');
      var exam_id = $(this).data('exam-id');
      var attempt_proctored = $(this).data('attempt-proctored');
      var start_immediately = $(this).data('start-immediately');
      if (typeof action_url === "undefined" ) {
        return false;
      }
      $.post(
        action_url,
        {
          "exam_id": exam_id,
          "attempt_proctored": attempt_proctored,
          "start_clock": start_immediately
        },
        function(data) {
          // reload the page, because we've unlocked it
          location.reload();
        }
      );
    }
  );
</script>
