<?php 
$cs = Yii::app()->getClientScript();
$cs->registerScript("deleteContact",  "function deleteContact(id){
    var r = confirm('Are you sure to delete this?');
    
        if(r==true)
        {
            jQuery.ajax({
              'type'  : 'post',
              'data'  : 'id=' + id ,
              'url'  : $('#liveSite').val()+'index.php?r=vendor/deletecontact',
              'cache': false,
              'success':function(data){
                if(data=='fail'){
                    alert('Error while Delete');
                }else {
                    window.open('vendor/VendorContactCreate&id= +id','Add New Contact','lg');
                    alert('Deleted SuccessFully!');
                }
               }
            });
        }

   
};", CClientScript::POS_HEAD);
$cs->registerScript("loadCustomerContact", '
        $(document).ready(function() {

        var table_id ="#tbl_customer_contact_details";
        var cust_id=$("#hid_cust_id").val();
        var table = $(table_id).DataTable({
            scrollY         : "380px",
           // scrollX         : "true",
           // scrollCollapse  : true,
            pageLength      : 50,
			processing: true,
            ajax: {
                data : {"customer_id":cust_id},
                url: "' . Yii::app()->createUrl('vendor/GetContactList') . '",
                type: "POST",
                cache : false,
            },
            serverSide:     true,
            fixedColumns:   true,
        } );
        $(".dataTables_scrollFoot").hide();
    });', CClientScript::POS_HEAD);
    ?>


<div class="clearfix"></div>
                <table class="table table-hover table-bordered personal-task" id="tbl_customer_contact_details">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Designation</th>
                            <th>Phone No</th>
                            <th>Customer</th>
                            <th class="text-center"><button class="btn btn-xs btn-theme"  onclick="loadPopupModal('vendor/VendorContactCreate&c_id=<?php echo $c_id;?>','Add New Contact','lg');"><i class="fa fa-plus"></i> ADD</button></th>
                        </tr>
                    </thead>
                    
                    <tfoot>
                        <tr>
                            <th>Name</th>
                            <th>Designation</th>
                            <th>Phone No</th>
                            <th>Customer</th>
                            <th>Actions</th>
                        </tr>
                    </tfoot>
                    
                </table>
         