commit
ff423ab723
@ -7,7 +7,7 @@ echo \kartik\select2\Select2::widget(
|
|||||||
[
|
[
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attribute' => 'field_name',
|
'attribute' => 'field_name',
|
||||||
'data' => \common\models\Balance::getNameList(),
|
'data' => \common\models\Balance::getNameList(\common\models\UseStatus::USE_BALANCE),
|
||||||
'options' => ['placeholder' => 'Выбрать параметр','class' => 'form-control'],
|
'options' => ['placeholder' => 'Выбрать параметр','class' => 'form-control'],
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
'allowClear' => true
|
'allowClear' => true
|
||||||
|
@ -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()
|
public static function tableName()
|
||||||
|
Loading…
Reference in New Issue
Block a user