diff --git a/backend/modules/card/views/user-card/_form.php b/backend/modules/card/views/user-card/_form.php index 43df122..31e9527 100755 --- a/backend/modules/card/views/user-card/_form.php +++ b/backend/modules/card/views/user-card/_form.php @@ -129,6 +129,14 @@ use yii\widgets\ActiveForm; +
+
+ field($model, 'level')->dropDownList( + \common\models\UserCard::getLevelList(), + ['prompt' => '...'] + ) ?> +
+
diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index 1a91c9a..0cee7cc 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -35,6 +35,12 @@ $this->params['breadcrumbs'][] = $this->title; return Html::tag('img', null, ['src' => $model->photo, 'width' => '100px']); } ], + [ + 'attribute' => 'level', + 'value' => function($model){ + return \common\models\UserCard::getLevelLabel($model->level); + } + ], [ 'attribute' => 'resume', 'format' => 'raw', diff --git a/common/models/UserCard.php b/common/models/UserCard.php index 7d77ff2..6f9af81 100755 --- a/common/models/UserCard.php +++ b/common/models/UserCard.php @@ -29,6 +29,7 @@ use yii\helpers\ArrayHelper; * @property string $vc_text * @property int $position_id * @property int $city + * @property int $level * * @property FieldsValue[] $fieldsValues * @property ProjectUser[] $projectUsers @@ -40,6 +41,33 @@ class UserCard extends \yii\db\ActiveRecord const GENDER_M = 0; const GENDER_W = 1; + const LEVEL_JUNIOR = 1; + const LEVEL_MIDDLE = 2; + const LEVEL_MIDDLE_PLUS = 3; + const LEVEL_SENIOR = 4; + + /** + * @return string[] + */ + public static function getLevelList(): array + { + return [ + self::LEVEL_JUNIOR => 'Junior', + self::LEVEL_MIDDLE => 'Middle', + self::LEVEL_MIDDLE_PLUS => 'Middle+', + self::LEVEL_SENIOR => 'Senior', + ]; + } + + /** + * @param int $level + * @return string + */ + public static function getLevelLabel(int $level): string + { + return self::getLevelList()[$level]; + } + public function behaviors() { return [ @@ -67,7 +95,7 @@ class UserCard extends \yii\db\ActiveRecord { return [ [['fio', 'status', 'gender', 'email'], 'required'], - [['gender', 'status', 'position_id', 'id_user'], 'integer'], + [['gender', 'status', 'position_id', 'id_user', 'level'], 'integer'], [['dob', 'created_at', 'updated_at', 'deleted_at', 'vc_text'], 'safe'], [['fio', 'passport', 'photo', 'email', 'resume', 'city', 'link_vk', 'link_telegram'], 'string', 'max' => 255], [['salary'], 'string', 'max' => 100], @@ -100,7 +128,8 @@ class UserCard extends \yii\db\ActiveRecord 'city' => 'Город', 'link_vk' => 'VK', 'link_telegram' => 'Telegram', - 'vc_text' => 'Резюме текст' + 'vc_text' => 'Резюме текст', + 'level' => 'Уровень' ]; } diff --git a/console/migrations/m210630_140410_add_level_column_to_user_card_table.php b/console/migrations/m210630_140410_add_level_column_to_user_card_table.php new file mode 100644 index 0000000..5f4413d --- /dev/null +++ b/console/migrations/m210630_140410_add_level_column_to_user_card_table.php @@ -0,0 +1,25 @@ +addColumn('{{%user_card}}', 'level', $this->integer(1)->defaultValue(2)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('{{%user_card}}', 'level'); + } +} diff --git a/frontend/modules/api/models/ProfileSearchForm.php b/frontend/modules/api/models/ProfileSearchForm.php index 481bf35..ec782ba 100644 --- a/frontend/modules/api/models/ProfileSearchForm.php +++ b/frontend/modules/api/models/ProfileSearchForm.php @@ -58,7 +58,6 @@ class ProfileSearchForm extends Model if($this->skills){ $model->joinWith(['skillValues']); - Debug::prn(123); $this->skills = explode(',', $this->skills); $model->where(['card_skill.skill_id' => $this->skills]); }