{% load i18n %}
{% if has_due_date_passed %}
  <hr>
  <p>
    {% blocktrans %}
      To view your exam questions and responses, select <strong>View my exam</strong>. The exam's review status is shown in the left navigation pane.
    {% endblocktrans %}
  </p>
  <p>
    <button type="button" name="visit-exam-content" class="visit-exam-button exam-action-button btn btn-pl-primary btn-base" data-action-url="{{update_is_status_acknowledge_url}}">
        {% trans "View my exam" %}
    </button>
    <div class="clearfix"></div>
  </p>

  <script type="text/javascript">
    $('.visit-exam-button').click(
      function(event) {

        // cancel any warning messages to end user about leaving proctored exam
        $(window).unbind('beforeunload');

        var action_url = $(this).data('action-url');

        // Update the state of the attempt
        $.ajax({
          url: action_url,
          type: 'PUT',
          data: {},
          success: function() {
            // Reloading page will reflect the new state of the attempt
            location.reload()
          }
        });
      }
    );
  </script>
{% elif has_due_date %}
  <p>
    {% blocktrans %}
      After the due date for this exam has passed, you will be able to review your answers on this page.
    {% endblocktrans %}
  </p>
{% endif %}
