{% load i18n %}

{% ifequal obj 'Award' %}
<style>
  
    #tb tbody td img{
        height:30px;
        cursor:pointer;
    }
    
</style>
{% endifequal %}
<style> 
    .word-wrap{
        width: 100%;white-space: normal;word-wrap: break-word;word-break: break-all;
    }
</style>



<script type="text/javascript">
    $(document).ready(function(){    
        var page_length=10;   

        var table=$('#tb').DataTable({
            dom: 'Bfrtip',
            autoWidth: true,
            pageLength: page_length,
            buttons: [{extend:'excelHtml5',text: '导出到Excel'}],   
            language:lng,
			
			{% if order %}
            order: {{order|safe}},
			{% endif %}
			
            data:{{data|safe}}
        });      
        table.columns().every( function () {                        
            var that = this;             
            $('input', this.footer() ).on( 'keyup change clear', function () {
                if ( that.search() !== this.value ) {
                    that.search( this.value ).draw();
                }
            });
        });       
  

        $('#tb').on("click","td a",function(event){			
            event.preventDefault(); 
            $.OpenDlg($(this).attr('href'),'发货单明细列表',1000,700);             
			          
        });     

       
        

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

            $('#dt_fr').val('{{date_from}}');
            $('#dt_to').val('{{date_to}}');

            $('.btn-qry').click(function(){
                var date_from,date_to;
                date_fr=$('#dt_fr').val();
                date_to=$('#dt_to').val();
                var params=[];
                if(date_fr!=''){params.push('date_from='+date_fr)};
                if(date_to!=''){params.push('date_to='+date_to)};

                if(params.length==0){
                    bootbox.alert("{% trans '请先输入查询条件！'%}");
                }else{
                    $.RefreshContent('{{request.path}}?'+params.join('&'));
                }
            });
        {% endif %}

        
       
    });
   function updateCode(id,ele){
        $.ajax({
            url:'/obj/deliverynote/update/'+id+'/',
            success:function (data){
                if (data.res){
                    alert(data.res)
                    $(ele).parent("td").empty()
                }
            }
        })
   } 
</script>



<ol class="breadcrumb">
        <li>{{subtt.0}}</li>
        <li>{{subtt.1}}</li>     
</ol>




   
    



{% if dt %}
    <form role="form"  class="form-inline" style="margin-top:0px;padding-left:10px;">
        <div class="col-sm-2 input-group">
            <span class="input-group-addon">{% trans "开始日期"%}</span>
            <input class="datepicker form-control" id="dt_fr" />
        </div>
        <div class="col-sm-2 input-group">
            <span class="input-group-addon">{% trans "结束日期"%}</span>
            <input class="datepicker form-control" id="dt_to" />
        </div>    
        <div  class="col-sm-2 input-group">
            <span class='input-group-btn'>
                <a type="button" class='btn btn-primary btn-qry'>
                    <span class='glyphicon glyphicon-search' style='padding-right:5px;'></span>{% trans '查找' %}
                </a>
            </span>        
        </div>
    </form>
    <div class="clearfix"></div>
{% endif %}




<div class="col-md-12 col-sm-12 col-xs-12">
    <div class="x_panel">
        <div  class="table-responsive">
            <table id='tb'  class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
            <thead>
                {% for c in clmns %}
                    <th>{{c}}</th>
                {% endfor %}
            </thead>
            <tbody></tbody>
            <tfoot>
                {% for c in clmns %}
                    <th><input type="text" placeholder="{{c}}"></th>            
                {% endfor %}            
            </tfoot>
            </table>
        </div>
    </div>
</div>

<style>
    .edit-box {
        position: fixed;
        top: 50%;
        left: 50%;
        margin-top: -250px;
        margin-left: -350px;
        width: 500px;
        height: 300px;
        border-radius: 7px;
        box-shadow: 1px 1px 7px #444;
        background: #fff;
        padding: 1.5rem;
        display: none;
        font-size: 1.6rem;
    }
    .showEditBox {
        padding: 0.3rem 1rem;
        border: 1px solid #d5d5d5;
        border-radius: 7px;
        cursor: pointer;
        font-weight: bold;
    }
    .showEditBox:hover {
        color: #5b80c3;
        border: 1px solid #5b80c3;
    }
    .showEditBox:active {
        background: #d5d5d5;
    }
    #edit-box-id {
        font-weight: bold;
    }
    .edit-box-1, .edit-box-2, .edit-box-3 {
        border-bottom: 1px solid #d5d5d5;
        padding: 1rem 0;
    }
    .closeEditBox {
        font-size: 1.2rem;
        font-weight: bold;
        border-radius: 7px;
        cursor: pointer;
        padding: 0.4rem 0.8rem;
        border: 1px solid #d5d5d5;
    }
    .closeEditBox:hover {
        background: #d5d5d5;
    }
    .edit-box-check-btn, .edit-box-send-btn {
        font-size: 1.2rem;
        font-weight: bold;
        border-radius: 7px;
        cursor: pointer;
        padding: 0.4rem 0.8rem;
        border: 1px solid #d5d5d5;
        width: 5rem;
        text-align: center;
    }
    
    .closeEditBox:hover {
        background: #d5d5d5;
    }
</style>
