<div class="popup_inner_element">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
    'id' => 'shipping-tracking-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => false,
    ));
?>
    <ul class="nav nav-tabs company-nav-tabs nav-tab-theme">
        <li class="active"><a href="#tab1" data-toggle="tab">General</a></li>
        <li><a href="#tab2" data-toggle="tab" onclick="tableRefresh('#tbl_shipdocument_details')">Documents</a></li>
        <li><a href="#tab3" data-toggle="tab" onclick="tableRefresh('#tbl_shipdocument_details')">History</a></li>
    </ul>
   <div class="tab-content">
        <div class="tab-pane active" id="tab1">
            <?php $this->renderPartial('tracking_general', array('model' => $model, 'form' => $form)); ?>
        </div>
        <div class="tab-pane" id="tab2">
            <?php $this->renderPartial('tracking_documents', array('model' => $model, 'form' => $form,'modelDocument'=>$modelDocument)); ?>
        </div>
        <div class="tab-pane" id="tab3">
            <?php $this->renderPartial('tracking_history', array('model' => $model)); ?>
        </div>
    </div> 
    <div class="modal-footer">
         <button type="button" class="btn btn-danger" id="shipping-tracking_close" data-dismiss="modal">Close</button>
        <?php 
            $url = Yii::app()->createUrl('purchasingorder/savetracking');
            echo CHtml::ajaxSubmitButton('Save', $url, array(
                'dataType' => 'json',
                'type' => 'post',
                'success' => 'function(data) {
                    $("#loader").hide();
                        if(data.status=="success"){  
                            $("#shipping-tracking_close").click();
                            t8.success("Saved!");
                            reloadTable("#tbl_order_details");
                        } else { 
                             $.each(data, function(key, val) {
                                  t8.error(""+val+""); 
                            }); 
                        } 
                }',
                'beforeSend' => 'function(){
                    $("#loader").show();
                    $(".toast8-error").hide(); 
                }',
            ), array('id' => 'mybtn' . rand(), 'class' => 'shipping-tracking-save-btn btn btn-theme'));
    ?>
        
    </div>
    <?php $this->endWidget(); ?>
</div>