<?php
$cs = Yii::app()->getClientScript();
$baseUrl = Yii::app()->baseUrl;
$cs->registerScript("downloadUploaded", "function downloadUploaded(id){
    if(id>0){
        window.open($('#liveSite').val()+'index.php?r=initialbacklog/downloadUploaded&id='+id, '_blank');   
    }else{
        t8.error('Please Select');
    }
}", CClientScript::POS_HEAD);
$cs->registerScript("deleteInitialbacklog",  "function deleteInitialbacklog(id){
    var r = confirm('Are you sure to delete this?');
    if(r==true)
    {
        jQuery.ajax({
          'type'  : 'post',
          'data'  : 'id=' + id+'&YII_CSRF_TOKEN=".Yii::app()->request->csrfToken."',
          'url'  : $('#liveSite').val()+'index.php?r=initialbacklog/deletebacklog',
          'cache': false,
          'success':function(data){
            if(data=='fail'){
                t8.error('Error while Delete');
            }else {
               t8.success('Deleted SuccessFully');
               location.reload();
            }
           }
        });
    }

   
};", CClientScript::POS_HEAD);


$cs->registerScript("loadInitialbacklog", '
        $(document).ready(function() {

        var table_id ="#tbl_back_log_details";
        var table = $(table_id).DataTable({
            scrollY         : "380px",
           // scrollX         : "true",
           // scrollCollapse  : true,
            pageLength      : 50,
			processing: true,
            ajax: {
                url: "' . Yii::app()->createUrl('Initialbacklog/GetList') . '",
                type: "POST",
                cache : false,
                "data": function ( params ) {
                    params.YII_CSRF_TOKEN = "'.Yii::app()->request->csrfToken.'";
                }
            },
            serverSide:     true,
            fixedColumns:   true,
			processing: true,
            fixedHeader: {
                headerOffset: $("header.main").outerHeight()
            }
        } );
        $(".dataTables_scrollFoot").hide();
    });', CClientScript::POS_HEAD);
    ?>
    <section class="panel">
        <header class="panel-heading clearfix panel-theame">
            <i class="fa fa-tasks"></i> Backlog
            <div class="pull-right">
                <?php  
                $modelInitialBacklog=UploadInitialBacklogShipment::model()->find();
                if (empty($modelInitialBacklog)){ ?>
                    <button class="btn btn-sm btn-theme" onclick="loadPopupModal('initialbacklog/Uploadbacklog','Upload Initial BackLog','lg')"><i class="fa fa-arrow-up"></i> Upload</button>
                <?php } ?>
            </div>
            
        </header>
        <div class="panel-body">
            <div class="custom-data-table">
                <table class="table table-hover table-bordered personal-task" id="tbl_back_log_details">
                    <thead>
                        <tr>
                            <th width="5%">Sl No</th>
                            <th>Date</th>
                            <th>File Name</th>
                            <th width="5%">Actions</th>
                            
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>Sl No</th>
                            <th>Date</th>
                            <th>File Name</th>
                            <th>Actions</th>
                           
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </section>