{% load i18n %}
<div class="sequence proctored-exam completed" data-exam-id="{{exam_id}}">
  <h3>
    {% blocktrans %}
      Are you sure you want to end your proctored exam?
    {% endblocktrans %}
  </h3>
  <ul>
    <li> {% trans 'Make sure that you have selected "Submit" for each answer before you submit your exam.' %}</li>
    <li> {% trans 'Once you click "Yes, end my proctored exam", the exam will be closed, and your proctoring session will be submitted for review.' %}</li>
  </ul>
  {% trans "Yes, end my proctored exam" as end_exam %}
  <button type="button" name="submit-proctored-exam" class="exam-action-button btn btn-pl-primary btn-base" data-action="submit" data-exam-id="{{exam_id}}" data-change-state-url="{{change_state_url}}" data-loading-text="<span class='fa fa-circle-o-notch fa-spin'></span> {% trans 'Ending Exam' %}" data-cta-text="{{ end_exam }}">
    {{ end_exam }}
  </button>
  {% if does_time_remain %}
    <button type="button" name="goback-proctored-exam" class="exam-action-button btn btn-secondary btn-base" data-action="start" data-exam-id="{{exam_id}}" data-change-state-url="{{change_state_url}}" style="box-shadow: none">
      {% blocktrans %}
        No, I'd like to continue working
      {% endblocktrans %}
    </button>
  {% endif %}
</div>
{% include 'proctored_exam/error_modal.html' %}


<script type="text/javascript">
  var edx = edx || {};
  edx.courseware = edx.courseware || {};
  edx.courseware.proctored_exam = edx.courseware.proctored_exam || {};
  edx.courseware.proctored_exam.configuredWorkerURL = "{{ backend_js_bundle }}";

  $('.exam-action-button').click(
      edx.courseware.proctored_exam.examEndHandler
  );
</script>
