Merge pull request #11 from apuc/change_profile

Change profile
This commit is contained in:
kavalar 2019-07-05 13:15:21 +03:00 committed by GitHub
commit ff423ab723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,7 @@ echo \kartik\select2\Select2::widget(
[
'model' => $model,
'attribute' => 'field_name',
'data' => \common\models\Balance::getNameList(),
'data' => \common\models\Balance::getNameList(\common\models\UseStatus::USE_BALANCE),
'options' => ['placeholder' => 'Выбрать параметр','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true

View File

@ -77,9 +77,14 @@ class Balance extends \yii\db\ActiveRecord
];
}
public static function getNameList()
public static function getNameList($type)
{
return ArrayHelper::map(AdditionalFields::find()->all(),'id','name');
return ArrayHelper::map(
AdditionalFields::find()
->leftJoin('use_field', 'additional_fields.id=use_field.field_id')
->where(['use_field.use' => $type])->all(), 'id', 'name'
);
}
public static function tableName()