guild/backend/modules/project/views/project-user/_form.php

62 lines
1.8 KiB
PHP
Raw Normal View History

2021-11-23 14:58:28 +03:00
<?php
use backend\modules\project\models\Project;
use kartik\depdrop\DepDrop;
2021-11-23 14:58:28 +03:00
use yii\helpers\Html;
use yii\helpers\Url;
2021-11-23 14:58:28 +03:00
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')->dropDownList(
Project::find()->select(['name', 'id'])->indexBy('id')->column(),
2021-11-23 14:58:28 +03:00
[
'id' => 'project-id',
'prompt' => 'Выберите'
2021-11-23 14:58:28 +03:00
]
);
?>
2021-11-23 14:58:28 +03:00
<?= $form->field($model, 'card_id')->widget(DepDrop::className(),
2021-11-23 14:58:28 +03:00
[
'options' => ['id' => 'card_id'],
2021-11-23 14:58:28 +03:00
'pluginOptions' => [
'depends' => ['project-id'],
'placeholder' => 'Выберите',
'url' => Url::to(['/project/project-user/users-not-on-project'])
,'initialize' => false,
],
'type' => DepDrop::TYPE_SELECT2,
'select2Options' => [
'hideSearch' => false,
'pluginOptions' => [
'allowClear' => true,
'closeOnSelect' => false,
'multiple' => true,
'hideSearch' => false
],
'showToggleAll' => false,
2021-11-23 14:58:28 +03:00
],
]
);
echo "<p>
* в списке отображаются только пользователи у которых присудствует запись в таблице user (в user_card есть id_user)
</p>";
?>
2021-11-23 14:58:28 +03:00
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>