diff --git a/backend/modules/card/models/UserCardSearch.php b/backend/modules/card/models/UserCardSearch.php index 1aa3f8d..e3998e2 100755 --- a/backend/modules/card/models/UserCardSearch.php +++ b/backend/modules/card/models/UserCardSearch.php @@ -20,7 +20,7 @@ class UserCardSearch extends UserCard public function rules() { return [ - [['id', 'gender', 'status'], 'integer'], + [['id', 'gender', 'status', 'at_project'], 'integer'], [['fio', 'passport', 'photo', 'email', 'dob', 'created_at', 'updated_at', 'city', 'test_task_getting_date', 'test_task_complete_date'], 'safe'], ['skills', 'each', 'rule' => ['integer']], ]; @@ -86,6 +86,7 @@ class UserCardSearch extends UserCard 'test_task_getting_date' => $this->test_task_getting_date, 'test_task_complete_date' => $this->test_task_complete_date, 'resume_tariff' => $this->resume_tariff, + 'at_project' => $this->at_project, ]); $query->andFilterWhere(['like', 'fio', $this->fio]) diff --git a/backend/modules/card/views/user-card/_form.php b/backend/modules/card/views/user-card/_form.php index ae1bfba..109b359 100755 --- a/backend/modules/card/views/user-card/_form.php +++ b/backend/modules/card/views/user-card/_form.php @@ -149,6 +149,17 @@ use yii\widgets\ActiveForm; +
+
+ field($model, 'at_project')->dropDownList( + $model->getBusyness(), + [ + 'prompt' => 'Выберите' + ] + ) ?> +
+
+
diff --git a/backend/modules/card/views/user-card/_search.php b/backend/modules/card/views/user-card/_search.php index a328d09..cd9b214 100755 --- a/backend/modules/card/views/user-card/_search.php +++ b/backend/modules/card/views/user-card/_search.php @@ -35,6 +35,8 @@ use yii\widgets\ActiveForm; field($model, 'updated_at') ?> + field($model, 'at_project') ?> +
'btn btn-primary']) ?> 'btn btn-default']) ?> diff --git a/backend/modules/card/views/user-card/index.php b/backend/modules/card/views/user-card/index.php index dc9c5b1..9c1c3ef 100755 --- a/backend/modules/card/views/user-card/index.php +++ b/backend/modules/card/views/user-card/index.php @@ -59,6 +59,13 @@ $this->params['breadcrumbs'][] = $this->title; ], ]), ], + [ + 'attribute' => 'at_project', + 'value' => function ($model) { + return $model->getBusynessForUser($model->at_project); + }, + 'filter' => \common\models\UserCard::getBusyness(), + ], //'created_at', //'updated_at', [ diff --git a/backend/views/layouts/left.php b/backend/views/layouts/left.php index 4e81dd9..11c0953 100755 --- a/backend/views/layouts/left.php +++ b/backend/views/layouts/left.php @@ -8,6 +8,10 @@ $menuItems[] = ['label' => $status, 'icon' => 'id-card', 'url' => ['/card/user-card?UserCardSearch[status]=' . $key], 'active' => \Yii::$app->controller->id == 'user-card',]; } + $busynessArr = \common\models\UserCard::getBusyness(); + foreach ($busynessArr as $key => $busyness) { + $menuItems[] = ['label' => $busyness, 'icon' => 'id-card', 'url' => ['/card/user-card?UserCardSearch[at_project]=' . $key], 'active' => \Yii::$app->controller->id == 'user-card']; + } $projectStatuses = \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROJECT); $projectItems = [['label' => 'Все', 'icon' => 'cubes', 'url' => ['/project/project'], 'active' => \Yii::$app->controller->id == 'project']]; foreach ($projectStatuses as $key => $status) { diff --git a/common/models/UserCard.php b/common/models/UserCard.php index bc3b283..10e1c04 100755 --- a/common/models/UserCard.php +++ b/common/models/UserCard.php @@ -41,6 +41,7 @@ use yii\helpers\ArrayHelper; * @property string $resume_text * @property int $resume_template_id * @property int $resume_tariff + * @property int $at_project * * @property FieldsValue[] $fieldsValues * @property ProjectUser[] $projectUsers @@ -63,6 +64,9 @@ class UserCard extends \yii\db\ActiveRecord const SCENARIO_UPDATE_RESUME_TEXT = 'update_resume_text'; const SCENARIO_DOWNLOAD_RESUME = 'download_resume_text'; + const AT_PROJECT_BUSY = 1; + const AT_PROJECT_FREE = 0; + /** * @return string[] @@ -113,7 +117,7 @@ class UserCard extends \yii\db\ActiveRecord { return [ [['fio', 'status', 'gender', 'email', 'level', 'position_id'], 'required'], - [['gender', 'status', 'position_id', 'id_user', 'level', 'years_of_exp', 'resume_tariff'], 'integer'], + [['gender', 'status', 'position_id', 'id_user', 'level', 'years_of_exp', 'resume_tariff', 'at_project'], 'integer'], [['dob', 'created_at', 'updated_at', 'deleted_at', 'vc_text', 'vc_text_short', 'test_task_getting_date', 'test_task_complete_date'], 'safe'], ['email', 'unique', 'message'=>'Почтовый адрес уже используется'], [['fio', 'passport', 'photo', 'email', 'resume', 'city', 'link_vk', 'link_telegram', 'specification'], 'string', 'max' => 255], @@ -160,7 +164,8 @@ class UserCard extends \yii\db\ActiveRecord 'test_task_complete_date' => 'Дата выполнения тестового', 'resume_template_id' => 'Шаблон резюме', 'resume_text' => 'Резюме сгенерированный текст', - 'resume_tariff' => 'Ставка для резюме' + 'resume_tariff' => 'Ставка для резюме', + 'at_project' => 'Занят на проекте' ]; } @@ -212,6 +217,22 @@ class UserCard extends \yii\db\ActiveRecord ]; } + public static function getBusyness() + { + return [ + self::AT_PROJECT_BUSY => 'На проекте', + self::AT_PROJECT_FREE => 'Не занят' + ]; + } + + /** + * @throws Exception + */ + public function getBusynessForUser($key) + { + return ArrayHelper::getValue($this->getBusyness(), $key); + } + /** * @return string status text label */ diff --git a/console/migrations/m221219_115735_add_busy_on_project_column_to_user_card_table.php b/console/migrations/m221219_115735_add_busy_on_project_column_to_user_card_table.php new file mode 100644 index 0000000..080321c --- /dev/null +++ b/console/migrations/m221219_115735_add_busy_on_project_column_to_user_card_table.php @@ -0,0 +1,25 @@ +addColumn('user_card', 'at_project', $this->integer(2)->defaultValue(null)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('user_card', 'at_project'); + } +}