<?php
$cs = Yii::app()->getClientScript();
$cs->registerScript("disablePortal", "function disablePortal(id){
    var r = confirm('Are you sure to block this Portal?');
        if(r==true)
        {
            jQuery.ajax({
              'type'  : 'post',
              'data'  : 'id=' + id,
              'url'  : $('#liveSite').val()+'index.php?r=Portal/BlockPortal',
              'cache': false,
              'success':function(data){
                if(data=='fail'){
                    t8.error('Error while Delete');
                }else {
                     reloadTable('#tbl_Portal_details');

                    t8.success('Portal blocked SuccessFully');
                }
               }
            });
        }


};", CClientScript::POS_HEAD);
$cs->registerScript("enablePortal", "function enablePortal(id){
    var r = confirm('Are you sure to unblock this Portal?');
        if(r==true)
        {
            jQuery.ajax({
                'type'  : 'post',
                'dataType'  : 'json',
                'data'  : 'id=' + id,
                'url'  : $('#liveSite').val()+'index.php?r=Portal/UnBlockPortal',
                'cache': false,
                'success':function(data){
                    if(data.status=='success'){
                        reloadTable('#tbl_Portal_details');
                        t8.success('Portal Unblocked SuccessFully!');

                    }else {
                        t8.error('This Portal cant be Unblocked');
                    }
                 }
            });
        }
};", CClientScript::POS_END);
 
?>

<script>
    var imageBase64Logo = null;
    $(document).ready(function () {
        var table_id = "#tbl_Portal_details";
        table = $(table_id).on("preXhr.dt", function (e, settings, data) {
            data.display_type = $("#display_type").val();
            return data;
        }).DataTable({
            //scrollY: "450px",
            pageLength: 50,
            processing: true,
            ajax: {
                url: "<?php echo Yii::app()->createUrl('Portal/GetList') ?>",
                type: "POST",
                cache: false,
            },
            serverSide: true,
            fixedColumns: true,
            columnDefs: [
                       {
                          "targets": [5],"visible": false,
                       },
            ],

            "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
                if ( aData[6] == "N" )  
                {  
                   $("td", nRow).addClass("bg-danger");

                }
                         
                  
            }
        });

    });
    </script>



<section class="panel" style="background-color:#F6F3EE;">
    <header class="panel-heading clearfix panel-theame">
    <i class="material-icons">dashboard</i> Portal Master    
        <div class="pull-right">
        <?php //if ((isset(Yii::app()->user->havePermissionOn['mas_Portal_add']) || Yii::app()->user->authorised_user == 1)) { ?>

            <button class="btn btn-sm btn-theme" onclick="loadPopupModal('Portal/create', 'Add New Portal Code', 'lg')"><i class="fa fa-plus"></i> ADD</button>
       
          <?php //} ?>
            </div>
    </header>
    <div class="panel-body">
        <div class="custom-data-table">
            <table class="table table-hover table-bordered personal-task" id="tbl_Portal_details" style="font-size:13px;">
                <thead>
                    <tr>
                        <th>SI No</th>
                        <th>Portal</th>
                        <th>Sort Order</th>
                        <th>Thumbnail</th>
                        <th>Return Url</th>
						<th>Action</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</section>
