<?php
$cs = Yii::app()->getClientScript();
$baseUrl = Yii::app()->baseUrl;

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

        var table_id ="#tbl_hiddengmc_details";
        var table = $(table_id).on("preXhr.dt", function (e, settings, data) {
                    data.distributer_type_id = $("#distributer_type_id").val();
                    data.category_id = $("#category_id").val();
                    return data;
                    }).DataTable({
            scrollY         : "380px",
           // scrollX         : "true",
           // scrollCollapse  : true,
            pageLength      : 50,
			processing: true,
            ajax: {
                url: "' . Yii::app()->createUrl('Hiddengmc/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> Hidden GMC for Distributers
        <div class="pull-right">
            <?php //if (isset(Yii::app()->user->havePermissionOn['master_gmc_add']) ||  Yii::app()->user->authorised_user == 1) { ?>
            <button class="btn btn-sm btn-theme" onclick="loadPopupModal('hiddengmc/create', 'Add', 'lg')"><i class="fa fa-plus"></i> ADD</button>
           <?php // }  ?>
        </div>
        <div class=" col-sm-2 pull-right">
            <?php echo CHtml::dropdownList('distributer_type_id', '', MasDistributerType::getActiveDistributerType(), array('data-label' => 'Distributor Type', 'class' => 'form-control', 'onChange' => 'reloadTable("#tbl_hiddengmc_details")', 'empty' => 'Distributor', 'data-search' => true)); ?>    
        </div>

    </header>
    <div class="panel-body">
        <div class="custom-data-table">
            <table class="table table-hover table-bordered personal-task" id="tbl_hiddengmc_details">
                <thead>
                    <tr>
                        <th width="5%">Sl No</th>
                        <th>Category</th>
                        <th>GMC Code</th>
                        <th>Model No</th>
                        <th>Distributer Type</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th width="5%">Sl No</th>
                        <th>Category</th>
                        <th>GMC Code</th>
                        <th>Distributer Type</th>
                        <th>Actions</th>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
</section>
