<?php

/*$cs = Yii::app()->getClientScript();

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

$cs->registerScript("deleteNotes",  "function deleteNotes(id){
    var r = confirm('Are you sure to delete this Note?');
    
        if(r==true)
        {
            jQuery.ajax({
              'type'  : 'post',
              'data'  : 'id=' + id ,
              'url'  : $('#liveSite').val()+'index.php?r=purchasingorder/deleteNotes',
              'cache': false,
              'success':function(data){
                if(data=='fail'){
                    alert('Error while Deleting');
                }else {
                    t8.success('Note Deleted SuccessFully!');
                    reloadTable('#tbl_notes_details');
                }
               }
            });
        }

   
};", CClientScript::POS_HEAD);




$cs->registerScript("loadOrderNotes", '

        $(document).ready(function() {

        var table_id ="#tbl_notes_details";
        var file_id =$("#hid_file_id").val();
        var table = $(table_id).DataTable({

             scrollY         : "380px",

           // scrollX         : "true",

           // scrollCollapse  : true,

            pageLength      : 50,

              paging:false,

            ajax: {

                url: "' . Yii::app()->createUrl('purchasingorder/GetNotesList') . '",

                type: "POST",
                data:{"id":file_id},

                cache : false,

            },

            serverSide:     true,

            fixedColumns:   true,

			processing: true,

            fixedHeader: {

                headerOffset: $("header.main").outerHeight()

            }

        } );

        $(".dataTables_scrollFoot").hide();

    });', CClientScript::POS_HEAD);*/


?>

   <div>
    <div class="table-responsive" style="max-height:500px">
        <table class="table table-hover table-bordered personal-task" id="purchase_order_notes_table">
            <tr>
                <th style="width:2%">No</th>
                <th style="width:17%">Notes</th>
                <th class="text-center" style="width:10%">
                    <a class="btn btn-xs btn-theme " href="#" onclick="addTableRow($('#purchase_order_notes_table'));"><i class="fa fa-plus"></i></a></th>
            </tr>
            <?php foreach ($modelNotes as $i => $modelNotes){ ?>
            <tr>
                <td>  <label><?php echo ($i+1); ?> </label></td>                
                <td>
                    <?php echo $form->hiddenField($modelNotes, "[" . $i . "]id"); ?>                
                    <?php echo $form->textArea($modelNotes, "[" . $i . "]notes", array( 'class' => 'tooltipster desc go en-text-area',  'title' => 'Add notes here'));  ?>
                    <?php echo $form->error($modelNotes, "[" . $i . "]notes"); ?>
                </td> 
                <td class="text-center nw" width="1%">
                          <?php echo CHtml::link('<i class="fa fa-times"></i>', 'javascript:void(0);', array('class'=>'btn btn-xs btn-danger','onclick' => 'removeTableRow($(\'#purchase_order_notes_table\'),this,this.id)', 'title' => 'Remove this item','id'=>'order_'.$i)); ?>
                    </td>           
            </tr>
            
            <?php
            }
            ?>
       
        </table>
       
    
    </div>
         </div>
         

