{% load i18n static %}
{% load common %}
{% block extend_js %}
{% endblock %}
<div style="padding: 10px;min-height: 350px;max-height: 550px;min-width: 550px">
    <form class="layui-form action-form" action="" method="post" id="{{ model_name }}_{{ action_repr }}">
        <input type="hidden" id="id_model_pk" name="pk" value="{{ object_id }}"/>
        {% csrf_token %}
        {% with form.form as f %}
            <div class="layui-form-item">
                {{ f.emp }}
            </div>
            <div class="layui-form-item">
                {% layui_inline f.advance_amount %}
                {% layui_inline f.advance_time %}
            </div>
            <div class="layui-form-item">
                {% layui_inline f.advance_remark %}
            </div>
        {% endwith %}
    </form>
</div>

<script>
    layui.use(['form', 'laydate', 'element'], function () {
        var form = layui.form, laydate = layui.laydate, element = layui.element;
        ;
        $("form.layui-form input.layui-datetime").each(function () {
            laydate.render({
                    elem: this
                    ,type: 'datetime'
                    // ,min:minDate()
            });
        });
        function minDate(){
            var now = new Date();
            return now.getFullYear() + '-' + (now.getMonth() + 1) + '-01';
        }
        $('#id_advance_amount').change(function () {
            var amount = $('#id_advance_amount').val();
            if (amount <= 0) {
                layer.alert(gettext('the_amount_need_lager_than_zero'), {
                    title: gettext('system_exception')
                    ,icon: 5
                    ,btn: gettext('btn_confirm')
                    })
            }
        })
    })
</script>