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

    {% block js %}
        {{ block.super }}    
        $('.btn-save').click(function(){
            $.SubmitForm('#obj_form form','{{request.path}}');
        });

        $('#product_label').autocomplete({            
            source: function(request, response) {
                $.ajax({
                    url: '/obj/ajax/autocomplete/product/',
                    dataType: "json",
                    data: {
                        term: $("#product_label").val() ,//搜索栏里的内容
                        company_id:{{request.user.company_id}} //额外参数
                    },
                    success: function(data) {
                        response(data);
                    }
                });
            },
            select: function (event, ui) {
                $("#id_product").val(ui.item.value);
                $("#product_label").val(ui.item.label);
                return false;
            }
        });
        $('#agent_label').autocomplete({            
            source: function(request, response) {
                $.ajax({
                    url: '/obj/ajax/autocomplete/agent/',
                    dataType: "json",
                    data: {
                        term: $("#agent_label").val() ,//搜索栏里的内容
                        company_id:{{request.user.company_id}} //额外参数
                    },
                    success: function(data) {
                        response(data);
                    }
                });
            },
            select: function (event, ui) {
                $("#id_agent").val(ui.item.value);
                $("#agent_label").val(ui.item.label);
                return false;
            }
        });
        $('#store_label').autocomplete({            
            source: function(request, response) {
                $.ajax({
                    url: '/obj/ajax/autocomplete/store/',
                    dataType: "json",
                    data: {
                        term: $("#store_label").val() ,//搜索栏里的内容
                        company_id:{{request.user.company_id}} //额外参数
                    },
                    success: function(data) {
                        response(data);
                    }
                });
            },
            select: function (event, ui) {
                $("#id_store").val(ui.item.value);
                $("#store_label").val(ui.item.label);
                return false;
            }
        });


    {% 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 "修改" %}
            {% else %}
                {% trans "新建" %}
            {% 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.code}} </div>
    </div>

    <div class="form-group ">
        <label class="col-sm-2 control-label ">产品名称 </label>
        <div class="col-sm-10"><input type="text" class="form-control" id="product_label"
            {% if form.instance.id %} value="{{form.instance.product.name}}" {% endif %} >
        </div>
    </div>

 
    <div class="form-group ">
        <label class="col-sm-2 control-label ">产地 </label>
        <div class="col-sm-10">{{form.chandi}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">原产地 </label>
        <div class="col-sm-10">{{form.origin}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">生产地址 </label>
        <div class="col-sm-10">{{form.shengchanaddress}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">生产厂 </label>
        <div class="col-sm-10">{{form.shengchanfactory}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">生产时间 </label>
        <div class="col-sm-10">{{form.first_tm}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">生产组装地 </label>
        <div class="col-sm-10">{{form.assembly}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">批号 </label>
        <div class="col-sm-10">{{form.pihao}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">批次 </label>
        <div class="col-sm-10">{{form.pici}}</div>
    </div>
    <!-- <div class="form-group ">
        <label class="col-sm-2 control-label ">防伪码 </label>
        <div class="col-sm-10">{{form.fangweiqr}}</div>
    </div> -->
    <div class="form-group ">
        <label class="col-sm-2 control-label ">检验时间 </label>
        <div class="col-sm-10">{{form.check_tm}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">检验员编号 </label>
        <div class="col-sm-10">{{form.check_user}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">生产许可证编号 </label>
        <div class="col-sm-10">{{form.scxkzbh}}</div>
    </div>
    <div class="form-group ">
        <label class="col-sm-2 control-label ">出口食品卫生注册编号 </label>
        <div class="col-sm-10">{{form.ckwszcbh}}</div>
    </div>

    <div  style="margin-top:20px;">      
        <a type="button" class='btn btn-primary btn-save' style="float:right;">
            <span class='glyphicon glyphicon-floppy-disk' style='padding-right:5px;'></span>{% trans '保存' %}
        </a>
    </div>    
   
{% endblock %}
