{% extends "django_pesapal/base.html" %}

{% load i18n %}

{% block content %}
  <div>&nbsp;</div>
  <div class="row">
    <div class="col-sm-offset-3 col-md-6">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">{% trans "Redirect Page" %}</h3>
        </div>
        <div class="panel-body">
          <p>
            {% trans "Thank you for making the purchase" %}
          </p>
          <blockquote>
            {{ message }}
          </blockquote>
          {% if payment_pending %}
            <a href="{{ check_status_url }}" class="btn btn-primary">{% trans "Check payment status" %}</a>  
          {% endif %}
          <a href="{{ transaction_completed_url }}" class="btn btn-success pull-right">{% trans "Continue Shopping" %}</a>
        </div>
      </div>
    </div>
  </div>
{% endblock content %}

{% block javascript %}
  {{ block.super }}
  {% if payment_status == 1 %}
    <script type="text/javascript">
      setTimeout(function() {
        location.href='{{ transaction_completed_url }}';
      }, 3000);

      var counter = 3;
      setInterval(function() {
        $('.countdown').text(--counter);
      }, 1000);
    </script>
  {% endif %}
{% endblock javascript %}