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


{% block subtitle %}
<ol class="breadcrumb">
        <li>{% trans '任务考核' %}</li>
        <li>{% trans '任务设置' %}</li>
</ol>
{% endblock %}

{% block form_content %}
<script>

    $(document).ready(function () {

        $('.btn-save').click(function () {
            $.SubmitForm('#obj_form form', '{{request.path}}',function (){
                $('.alert').fadeIn();
            });
        });

        $('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
        //$('.datepicker').datepicker('setDate',new Date());
        //setDatePickerZh();

        {% if not form.instance.start_tm %}
            $('.datepicker').datepicker('setDate',new Date());
        {% else%}
            $('#date_from').val("{{form.instance.start_tm | date:'Y-m-d'}}");
            $('#date_to').val("{{form.instance.end_tm | date:'Y-m-d'}}");
        {% endif %}
        //$('#date_from').val('{{form.instance.start_tm}}');
        //$('#date_to').val('{{form.instance.end_tm}}');
    })

</script>
<style>
    input[type=checkbox]{
        display: inline-block;
        width: auto;
        height: auto;
        margin-top: 10px;
    }
</style>
<div class="alert alert-success" role="alert" style="display: none">提示：保存成功！</div>
<div class="form-group product_photo">
    <label class="col-sm-2 control-label ">任务名称</label>
    <div class="col-sm-8">{{ form.name }}
    </div>
</div>
<div class="form-group product_photo">
    <label class="col-sm-2 control-label ">任务开始时间</label>
    <div class="col-sm-8">
        <input class="datepicker form-control" name="start_tm" id="date_from" placeholder="请选择开始时间" />
    </div>
</div>
<div class="form-group product_photo">
    <label class="col-sm-2 control-label ">任务结束时间</label>
    <div class="col-sm-8">
        <input class="datepicker form-control" name="end_tm" id="date_to" placeholder="请选择结束时间" />
    </div>
</div>
<div class="form-group ">
    <label class="col-sm-2 control-label ">是否有效</label>
    <div class="col-sm-1">
        <div>
            {{ form.is_active }}
        </div>
    </div>
</div>
<div class="form-group product_photo">
    <label class="col-sm-2 control-label ">备注</label>
    <div class="col-sm-8">{{ form.remark }}</div>
</div>
<div>
    <a class="btn btn-primary btn-save" type="button" style="float:right;">保存</a>
</div>
{% endblock %}