{% load i18n %}


<style> 
    .word-wrap{
        width: 100%;white-space: normal;word-wrap: break-word;word-break: break-all;
    }
    #tb tbody td:nth-child(9){
        padding-top:2px;
        padding-bottom:2px;
    }

    #tb tbody td:nth-child(10){
        padding-top:2px;
        padding-bottom:2px;
    }


</style>



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

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

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

        var table=$('#tb').DataTable({
            dom: 'Bfrtip',
            autoWidth: true,
            pageLength: page_length,
            buttons: [{extend:'excelHtml5',text: '导出到Excel'}],   
            language:lng,           
            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){
            var s=$(this).text();
            $(event.target.parentNode).addClass('row_selected');
            event.preventDefault();
            $.OpenDlg($(this).attr('href'),s+' 喷码明细:',1000,700);              
        });     


        $('.btn-qry').click(function(){     
            date_fr=$('#dt_fr').val();
            date_to=$('#dt_to').val();            
            var params=[];               
            if(date_fr!=''){params.push('dt_fr='+date_fr)};
            if(date_to!=''){params.push('dt_to='+date_to)};            
            $.RefreshContent('{{request.path}}?'+params.join('&'));            
        });       
    });
</script>



<ol class="breadcrumb">
        <li>物流查询</li>
        <li>喷码数据</li>     
</ol>

<div class="col-md-12 col-sm-12 col-xs-12">
<form role="form"  class="form-inline" style="margin-top:0px;">
    <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 pull-right" >
        <span class='input-group-btn'>
            <a type="button" class='btn btn-primary btn-qry pull-right'>
                <span class='glyphicon glyphicon-search' style='padding-right:5px;'></span>{% trans '查询' %}
            </a>
        </span>       
    </div>
</form>
</div>


<div class="clearfix"></div>

<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>
