{% extends "bee_django_crm/custom_base.html" %}
{% load bee_django_crm_filter %}
{% load bootstrap3 %}
{% block styles %}
    <style>
        body {
            background-color: #1A3440;
        }

        .app_title {
            background-color: #6A90A1;
            padding: 10px;
            color: #ffffff;
        }

        .app_body {
            background-color: #ffffff;
            padding: 20px;
        }
    </style>
{% endblock %}
{% block content %}
    <div class="app_title text-center"><h4>合同协议</h4></div>
    <div class="app_body">
        {% if is_user_agree %}
            <h4>提交成功，请等待客服确认</h4>
        {% else %}
            {{ preuser_contract.contract.agreement|default:""|safe }}
            <hr>
            <table class="table">
                <tr>
                    <td>学生姓名：</td>
                    <td>{{ preuser_contract.preuser.name }}</td>
                </tr>
                <tr>
                    <td>合同名称：</td>
                    <td>{{ preuser_contract.contract.name }}</td>
                </tr>
                <tr>
                    <td>开课时间：</td>
                    <td>{{ preuser_contract.study_at }}</td>
                </tr>
                <tr>
                    <td>结课时间：</td>
                    <td>{{ preuser_contract.get_finish_at }}</td>
                </tr>
                <tr>
                    <td>合同备注：</td>
                    <td>{{ preuser_contract.info }}</td>
                </tr>
            </table>
            <div style="margin: 10px auto;">
                <form method="post" action="{% url "bee_django_crm:preuser_contract_agreement" preuser_contract_id %}">
                    {% csrf_token %}
                    {% bootstrap_form form %}
                    {% bootstrap_button '提交' %}

                    {#                {{ form.is_user_agree.errors }}#}
                    {##}
                    {#                {{ form.is_user_agree }} 我同意以上协议#}
                    {#                <div style="margin: 10px auto;"><input type="submit" value="提交" class="btn btn-success"/></div>#}
                </form>


                {#        <input type="checkbox" id="agree_checkbox">我同意以上条款</div>#}
                {#    <div>#}

                {#                <button class="btn btn-success">下一步</button>#}
                {#        <a href="#"#}
                {#           data-confirm="{% url "bee_django_exam:user_exam_notice" user_id grade.id %}"#}
                {#           onclick="click_next_btn(this)" class="btn btn-success">下一步</a>#}
            </div>
        {% endif %}
    </div>
{% endblock %}
{% block scripts %}
    <script>
        {#        function click_next_btn(_this) {#}
        {#            var agree = $('#agree_checkbox').is(':checked');#}
        {#            if (!agree) {#}
        {#                alert("请勾选同意该条款");#}
        {#                return;#}
        {#            }#}
        {#            location.href = "{% url 'bee_django_exam:user_exam_record_add' user_id %}";#}
        {#            var url = $(_this).attr('data-confirm');#}
        {#            console.log(url)#}
        {#            $.post(url).done(function (data) {#}
        {#            });#}
        {##}
        {##}
        {#        }#}
    </script>
{% endblock %}