guild/backend/modules/employee/views/manager/_form.php

36 lines
1000 B
PHP

<?php
use backend\modules\card\models\UserCard;
use common\models\User;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
/* @var $this yii\web\View */
/* @var $model backend\modules\employee\models\Manager */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="manager-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'user_card_id')->widget(Select2::className(),
[
'data' => UserCard::find()->select(['user_card.fio', 'user_card.id'])
->joinWith('manager')->where(['manager.user_card_id' => null])
->indexBy('user_card.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>