manager employee fix

This commit is contained in:
2023-05-04 15:10:56 +03:00
parent b2f482e10b
commit f9c7328529
10 changed files with 44 additions and 56 deletions

View File

@ -17,8 +17,8 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'manager_id')->widget(Select2::className(),
[
'data' => Manager::find()->select(['fio', 'manager.id'])
->joinWith('userCard')->indexBy('manager.id')->column(),
'data' => Manager::find()->select(['email', 'manager.id'])
->joinWith('user')->indexBy('manager.id')->column(),
'options' => ['placeholder' => '...','class' => 'form-control'],
'hideSearch' => false,
'pluginOptions' => [
@ -26,18 +26,16 @@ use yii\widgets\ActiveForm;
],
]) ?>
<?= $form->field($model, 'user_card_id')->widget(Select2::className(),
<?= $form->field($model, 'employee_id')->widget(
Select2::class,
[
'data' => UserCard::find()->select(['fio', 'user_card.id'])
->joinWith('manager')->where(['manager.user_card_id' => null])->indexBy('user_card.id')->column(),
'options' => ['placeholder' => '...','class' => 'form-control'],
'hideSearch' => false,
'data' => \common\models\UserCard::getListUserWithUserId(),
'options' => ['placeholder' => '...', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
'closeOnSelect' => false
'allowClear' => true
],
]) ?>
]
); ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>

View File

@ -26,17 +26,11 @@ $this->params['breadcrumbs'][] = $this->title;
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'manager_id',
'filter' => UserCard::find()->select(['fio', 'user_card.id'])
->joinWith('manager')->where(['not',['manager.user_card_id' => null]])
->indexBy('user_card.id')->column(),
'value' => 'manager.userCard.fio',
'value' => 'manager.user.userCard.fio',
],
[
'attribute' => 'user_card_id',
'filter' => ManagerEmployee::find()->select(['fio', 'manager_employee.id'])
->joinWith('userCard')
->indexBy('manager_employee.id')->column(),
'value' => 'userCard.fio',
'attribute' => 'employee_id',
'value' => 'employee.email',
],
['class' => 'yii\grid\ActionColumn'],
],