<!DOCTYPE html>
<html lang="en">{% load static %}
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="VNPAY PAYMENT GATEWAY DEMO">
    <meta name="author" content="VNPAY">
    <title>{{ title }}</title>
    <!-- Bootstrap core CSS -->
    <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"/>
    <!-- Custom styles for this template -->
    <link href="{% static "css/jumbotron-narrow.css" %}" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

    <!--[if lt IE 9]><script src="{% static "js/ie8-responsive-file-warning.js" %}"></script><![endif]-->
    <script src="{% static "js/ie-emulation-modes-warning.js" %}"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{% static "js/ie10-viewport-bug-workaround.js" %}"></script>
</head>
<body>
<div class="container">
    {% block content %}
    {% endblock %}

    <footer class="footer">
        <p>&copy; VNPAY {% now "Y" %}</p>
    </footer>
</div> <!-- /container -->


<link href="https://pay.vnpay.vn/lib/vnpay/vnpay.css" rel="stylesheet"/>
<script src="https://pay.vnpay.vn/lib/vnpay/vnpay.js"></script>

<script type="text/javascript">
    $("#btnPopup").click(function () {
        var postData = $("#frmCreateOrder").serialize();
        var submitUrl = $("#frmCreateOrder").attr("action");
        $.ajax({
            type: "POST",
            url: submitUrl,
            data: postData,
            dataType: 'JSON',
            success: function (x) {
                if (x.code === '00') {
                    vnpay.open({width: 480, height: 600, url: x.data});
                    return false;
                } else {
                    alert(x.Message);
                }
            }
        });
        return false;
    });
</script>


<script>

</script>
</body>
</html>
