This commit is contained in:
2023-04-12 13:14:37 +03:00
parent c65b7d10cc
commit 8bc601aa6a
43 changed files with 3005 additions and 795 deletions

View File

@ -0,0 +1,12 @@
<div class="request-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -0,0 +1,63 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="request-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'user_id')->widget(
Select2::class,
[
'data' => \common\models\UserCard::getListUserWithUserId(),
'options' => ['placeholder' => '...', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
<?= $form->field($model, 'position_id')->dropDownList(\common\models\Position::getList(), [
'prompt' => 'Выберите'
]) ?>
<?= $form->field($model, 'skill_ids')->widget(
Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\Skill::find()->all(), 'id', 'name'),
'options' => ['placeholder' => '...', 'class' => 'form-control', 'multiple' => true],
'pluginOptions' => [
'allowClear' => true
],
]
)->label('Навыки'); ?>
<?= $form->field($model, 'knowledge_level_id')->dropDownList(
\common\models\UserCard::getLevelList(),
['prompt' => '...']
) ?>
<?= $form->field($model, 'descr')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'specialist_count')->textInput() ?>
<?= $form->field($model, 'status')->dropDownList(\common\models\Request::getStatus(), [
'prompt' => 'Выберите'
]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\RequestSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="request-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<?= $form->field($model, 'user_id') ?>
<?= $form->field($model, 'title') ?>
<?php // echo $form->field($model, 'position_id') ?>
<?php // echo $form->field($model, 'skill_ids') ?>
<?php // echo $form->field($model, 'knowledge_level_id') ?>
<?php // echo $form->field($model, 'descr') ?>
<?php // echo $form->field($model, 'specialist_count') ?>
<?php // echo $form->field($model, 'status') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
$this->title = 'Добавить';
$this->params['breadcrumbs'][] = ['label' => 'Запросы', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="request-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,62 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\request\models\RequestSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Запросы';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="request-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Добавить запрос', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//'id',
'created_at',
//'updated_at',
[
'attribute' => 'user_id',
'value' => function(\common\models\Request $model){
return $model->user->userCard->fio ?? 'Не задано';
}
],
'title',
[
'attribute' => 'position_id',
'value' => function(\common\models\Request $model){
return $model->position->name ?? 'Не задано';
}
],
//'skill_ids',
[
'attribute' => 'knowledge_level_id',
'value' => function(\common\models\Request $model){
return \common\models\UserCard::getLevelList()[$model->knowledge_level_id];
}
],
//'descr:ntext',
'specialist_count',
[
'attribute' => 'status',
'value' => function(\common\models\Request $model){
return \common\models\KnowledgeLevel::getStatus()[$model->status];
}
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
$this->title = 'Редактировать запрос: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Запросы', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Ред.';
?>
<div class="request-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,88 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
/* @var $searchDataProvider \yii\data\ArrayDataProvider */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Requests', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="request-view">
<p>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'created_at',
'updated_at',
[
'attribute' => 'user_id',
'value' => function (\common\models\Request $model) {
return $model->user->userCard->fio ?? 'Не задано';
}
],
'title',
[
'attribute' => 'position_id',
'value' => function (\common\models\Request $model) {
return $model->position->name ?? 'Не задано';
}
],
// 'skill_ids',
[
'attribute' => 'skill_ids',
'value' => function (\common\models\Request $model) {
$skillStr = '';
foreach ($model->skills as $skill) {
$skillStr .= $skill['name'] . ", ";
}
return $skillStr;
}
],
[
'attribute' => 'knowledge_level_id',
'value' => function (\common\models\Request $model) {
return \common\models\UserCard::getLevelList()[$model->knowledge_level_id];
}
],
'descr:ntext',
'specialist_count',
[
'attribute' => 'status',
'value' => function (\common\models\Request $model) {
return \common\models\Request::getStatus()[$model->status] ?? 'Не задано';
}
],
],
]) ?>
<h3>Подходящие кандидаты</h3>
<?= GridView::widget([
'dataProvider' => $searchDataProvider,
'columns' => [['class' => 'yii\grid\SerialColumn'],
'id',
'fio',
],
]); ?>
</div>