45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
use backend\modules\project\models\Project;
 | 
						|
use common\models\User;
 | 
						|
use kartik\select2\Select2;
 | 
						|
use yii\helpers\Html;
 | 
						|
use yii\widgets\ActiveForm;
 | 
						|
 | 
						|
/* @var $this yii\web\View */
 | 
						|
/* @var $model backend\modules\project\models\ProjectUser */
 | 
						|
/* @var $form yii\widgets\ActiveForm */
 | 
						|
?>
 | 
						|
 | 
						|
<div class="project-user-form">
 | 
						|
 | 
						|
    <?php $form = ActiveForm::begin(); ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'project_id')->widget(Select2::className(),
 | 
						|
        [
 | 
						|
            'data' => Project::find()->select(['name', 'id'])->indexBy('id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ) ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'user_id')->widget(Select2::className(),
 | 
						|
        [
 | 
						|
            'data' => User::find()->select(['username', 'id'])->indexBy('id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ) ?>
 | 
						|
 | 
						|
    <div class="form-group">
 | 
						|
        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <?php ActiveForm::end(); ?>
 | 
						|
 | 
						|
</div>
 |