예제 #1
0
파일: AccCat.php 프로젝트: chaimvaid/linet3
 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($params)
 {
     $query = AccCat::find();
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]);
     //$this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type_id' => $this->type_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
예제 #2
0
 public function actionAutocomplete($term = '')
 {
     $res = AccCat::AutoComplete($term);
     echo \yii\helpers\Json::encode($res);
     Yii::$app->end();
     //*/
 }
예제 #3
0
 public function getCategory()
 {
     return $this->hasOne(AccCat::className(), array('id' => 'cat_id'));
 }
예제 #4
0
파일: _form.php 프로젝트: chaimvaid/linet3
<div class="form">

    <?php 
use yii\helpers\ArrayHelper;
use kartik\select2\Select2;
$form = kartik\form\ActiveForm::begin(array('id' => 'accounts-form' . $model->type, 'options' => array('enctype' => 'multipart/form-data')));
$id6111 = ArrayHelper::map(\app\models\AccId6111::find()->All(), 'id', 'name');
$id6111[0] = Yii::t('app', 'None');
$currncies = ArrayHelper::map(\app\models\Currates::GetRateList(), 'currency_id', 'name');
$accounts = ArrayHelper::map(\app\models\Accounts::find()->all(), 'id', 'name');
$accounts[0] = Yii::t('app', 'None');
$acccat = ArrayHelper::map(\app\models\AccCat::find()->where(["type_id" => $model->type])->all(), 'id', 'name');
?>

    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo $form->field($model, 'type', ['template' => '{input}'])->hiddenInput();
?>
    <div class="col-md-4 col-sm-6">
        <?php 
app\widgets\TbPanel::begin(array('header' => Yii::t('app', "Account General Details")));
?>
        <?php 
echo $form->field($model, 'name');
?>
        <?php 
echo $form->field($model, 'cat_id')->dropDownList($acccat);
?>
      
예제 #5
0
파일: index.php 프로젝트: chaimvaid/linet3
  'tabs' => $list,
  // additional javascript options for the tabs plugin
  'headerTemplate' => '<li><a id="{id}" href="{url}" title="{title}">{title}</a></li>',
  'options' => array(
  'active' => $type,
  ),
  )); // */
//app\widgets\MiniForm::end();
// $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
/**/
use kartik\widgets\ActiveForm;
use app\models\AccCat;
//\yii\widgets\Pjax::begin();
echo app\widgets\GridView::widget(['id' => $searchModel->type, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'name', array('attribute' => 'id6111', 'format' => 'raw', 'value' => function ($data) {
    return \yii\helpers\Html::encode(isset($data->accId6111) ? $data->accId6111->name : "");
}, 'filter' => \yii\helpers\ArrayHelper::map(\app\models\AccId6111::find()->all(), 'id', 'name')), array('attribute' => 'cat_id', 'format' => 'raw', 'value' => function ($data) {
    return \yii\helpers\Html::encode(isset($data->category) ? $data->category->name : "");
}, 'filter' => \yii\helpers\ArrayHelper::map(AccCat::find()->where(["type_id" => $searchModel->type])->all(), 'id', 'name')), 'src_tax', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{display}{create}{update}{delete}', 'buttons' => array('create' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-file"></i>', ["docs/create/?id=" . $model->id]);
    //'url' => 'yii\helpers\BaseUrl::base().("docs/create", array("id"=>$data->id))',
}, 'update' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-pencil"></i>', $url);
    //'url' => 'yii\helpers\BaseUrl::base().("accounts/update", array("id"=>$data->id))',
}, 'delete' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-trash"></i>', $url, ['data-method' => 'post', 'data-confirm' => 'Are you sure you want to delete this item?']);
    //'url' => 'yii\helpers\BaseUrl::base().("accounts/delete", array("id"=>$data->id))',
}, 'display' => function ($url, $model, $key) {
    return Html::a('<i class="glyphicon glyphicon-transfer"></i>', ["accounts/transaction/" . $model->id]);
    //'url' => 'yii\helpers\BaseUrl::base().("accounts/transaction", array("id"=>$data->id))',
})]]]);
//\yii\widgets\Pjax::end();