{% extends 'obj_form.html' %}
{% load i18n %}




    {% block js %}
        {{ block.super }}
        $('.btn-save').click(function(){
            $.SubmitForm('#obj_form form','{{request.path}}');
        });
{#        $(".btn-delete").click(function(){#}
{#            $.ajax({#}
{#                type:'GET',#}
{#                url:"/obj/delete/"+{{ id }}+'/',#}
{#                success: function(d) {#}
{#                    alert ("data deleted successfully!");#}
{#                }#}
{#            });#}
{#        });#}

        $('.member_level').hide()

        $('#id_birthday').datepicker({dateFormat: "yy-mm-dd",changeYear:true,yearRange:'-100:+0'})


        var opt = $("#id_member_level").find('option');
        for (var i=0;i<opt.length;i++){
            var optVar=opt.eq(i).val();//option中的值
            if (optVar == {{ lev_id }}){
                console.log(optVar)
                opt[i].selected = true;
            }
        }

    {% endblock %}


    {% block subtitle-1 %}
        {% trans "会员管理" %}
    {% endblock %}
    {% block subtitle-2 %}
        {% trans "新建会员" %}
    {% endblock %}

    <span style="margin-left:10px; color:green; ">
        {% block subtitle-3 %}
            {% if form.instance.id %}
                {% trans "edit" %}
            {% else %}
                {% trans "create" %}
            {% endif %}
        {% endblock %}
    </span>



{% block form_content %}
    {{ block.super }}
    <div class="form-group ">
        <label class="col-sm-2 control-label "> 姓名:</label>
        <div class="col-sm-10">{{ form.name }}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">性别:</label>
        <div class="col-sm-10">{{ form.gender }}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">生日:</label>
        <div class="col-sm-10">{{ form.birthday }}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">地址:</label>
        <div class="col-sm-10">{{ form.address }}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">联系方式:</label>
        <div class="col-sm-10">{{ form.phone }}</div>
    </div>
    <div class="form-group member_level">
        <label class="col-sm-2 control-label ">会员等级:</label>
        <div class="col-sm-10">{{ form.member_level }}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">备注说明:</label>
        <div class="col-sm-10">{{ form.remark }}</div>
    </div>

    <div>
        <a class="btn btn-primary btn-save" type="button" style="float:right;">{% trans '保存' %}</a>
{#        <a class="btn btn-primary btn-delete" type="button" style="float:right;">{% trans 'delete' %}</a>#}
    </div>
{% endblock %}
