public function actionUpdate($ccmp_id)
 {
     $model = $this->loadModel($ccmp_id);
     //company group forma submitita
     if (isset($_POST['save_company_group'])) {
         $this->actionUpdategroup($ccmp_id);
         return;
     }
     //company manager forma submitita
     if (isset($_POST['save_company_manager'])) {
         $this->actionUpdatemanager($ccmp_id);
         return;
     }
     $model->scenario = $this->scenario;
     $custom = $model->cccdCustomData;
     $this->performAjaxValidation($model, 'ccmp-company-form');
     if (isset($_POST['CcmpCompany'])) {
         $model->attributes = $_POST['CcmpCompany'];
         try {
             if ($model->save()) {
                 if (isset($_GET['returnUrl'])) {
                     $this->redirect($_GET['returnUrl']);
                 } else {
                     $this->redirect(array('update', 'ccmp_id' => $model->ccmp_id, 'active_tab' => 'main'));
                 }
             }
         } catch (Exception $e) {
             $model->addError('ccmp_id', $e->getMessage());
         }
     }
     //branc
     $criteria = new CDbCriteria();
     $criteria->addCondition('ccbr_ccmp_id = :ccmp_id');
     $criteria->params = array(':ccmp_id' => $model->ccmp_id);
     $mCcbr = new CcbrBranch('search');
     $mCcbr->findAll($criteria);
     $this->render('update', array('model' => $model, 'active_tab' => 'main', 'model_manage_ccbr' => $mCcbr));
 }
 public function actionCreateAjax($ccmp_id)
 {
     $model4update = new CcbrBranch();
     $model4update->scenario = $this->scenario;
     if (isset($_POST['CcbrBranch'])) {
         //$this->performAjaxValidation($model4update, 'branch-form');
         $model4update->attributes = $_POST['CcbrBranch'];
         if ($model4update->validate()) {
             try {
                 $model4update->save();
             } catch (Exception $e) {
                 $model4update->addError('ccbr_id', $e->getMessage());
             }
         } else {
             $this->renderPartial("_form_horizontal_ajax", array('ccmp_id' => $ccmp_id, 'model4update' => $model4update));
             exit;
         }
     }
     $model4new = new CcbrBranch();
     $model4new->ccbr_ccmp_id = $ccmp_id;
     $this->renderPartial("_form_horizontal_ajax", array('ccmp_id' => $ccmp_id, 'model4update' => $model4new));
     //$this->render('view', array('model' => $model, 'model4grid' => $model4grid, 'model4update' => $model4update));
 }
        ?>
        <div class="alert alert-error"><?php 
        echo $grid_error;
        ?>
</div>
        <?php 
    }
    if (!empty($grid_warning)) {
        ?>
        <div class="alert alert-warning"><?php 
        echo $grid_warning;
        ?>
</div>
        <?php 
    }
    $model = new CcbrBranch();
    $model->ccbr_ccmp_id = $modelMain->primaryKey;
    // render grid view
    $can_edit = Yii::app()->user->checkAccess("D2company.CcbrBranch.Update");
    $this->widget('TbGridView', array('id' => 'ccbr-branch-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => '&nbsp;', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'ccbr_name', 'editable' => array('url' => $this->createUrl('//d2company/ccbrBranch/editableSaver'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'ccbr_code', 'editable' => array('url' => $this->createUrl('//d2company/ccbrBranch/editableSaver'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'ccbr_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2company/ccbrBranch/editableSaver'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'ccbr_hide', 'editable' => array('url' => $this->createUrl('//d2company/ccbrBranch/editableSaver'), 'apply' => $can_edit), 'htmlOptions' => array('class' => 'numeric-column')), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'TRUE')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2company/ccbrBranch/delete", array("ccbr_id" => $data->ccbr_id))', 'deleteConfirmation' => Yii::t('D2companyModule.crud_static', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'), 'visible' => Yii::app()->user->checkAccess("D2company.CcbrBranch.Delete")))));
    ?>

<?php 
    Yii::endProfile('ccbr_ccmp_id.view.grid');
}
?>

<?php 
if ((!$ajax || $ajax == 'ccuc-user-company-grid') && Yii::app()->user->checkAccess("D2company.CcucUserCompany.View")) {
    Yii::beginProfile('ccuc_ccmp_id.view.grid');
    $grid_error = '';