public function actionAjaxCreate($field, $value, $no_ajax = 0)
 {
     $model = new VtrsTruckService();
     $model->{$field} = $value;
     try {
         if ($model->save()) {
             if ($no_ajax) {
                 $this->redirect(Yii::app()->request->urlReferrer);
             }
             return TRUE;
         } else {
             return var_export($model->getErrors());
         }
     } catch (Exception $e) {
         throw new CHttpException(500, $e->getMessage());
     }
 }
Пример #2
0
                                            "finv_id"=>$data->vtdcFixr->fixrFiit->fiit_finv_id
                                        ),
                                        array("target" => "_blank")
                                    )
                                    :"-"'), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'empty($data->vtdc_fixr_id) && Yii::app()->user->checkAccess("Trucks.VtrcTruck.DeletevtdcTruckDocs")')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/trucks/vtdcTruckDoc/delete", array("vtdc_id" => $data->vtdc_id))', 'deleteConfirmation' => Yii::t('TrucksModule.crud', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip')))));
}
Yii::endProfile('vtdc_vtrc_id.view.grid');
//}
if (!$ajax || $ajax == 'vtrs-truck-service-grid') {
    Yii::beginProfile('vtrs_vtrc_id.view.grid');
    $grid_error = '';
    $grid_warning = '';
    if (empty($modelMain->vtrsTruckServices)) {
        $model = new VtrsTruckService();
        $model->vtrs_vtrc_id = $modelMain->primaryKey;
        if (!$model->save()) {
            $grid_error .= implode('<br/>', $model->errors);
        }
        unset($model);
    }
    if (empty($modelMain->vtrsTruckServices)) {
        $grid_warning = Yii::t('TrucksModule.model', 'Truck services add by attaching it to Invoice items as expense position!');
    }
    ?>
    <div class="table-header">
        <?php 
    echo Yii::t('TrucksModule.model', 'Vtrs Truck Service');
    ?>
    </div>

    <?php