user card level
This commit is contained in:
parent
8c9b5f04d4
commit
74ada385f5
@ -129,6 +129,14 @@ use yii\widgets\ActiveForm;
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<?= $form->field($model, 'level')->dropDownList(
|
||||
\common\models\UserCard::getLevelList(),
|
||||
['prompt' => '...']
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
@ -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',
|
||||
|
@ -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' => 'Уровень'
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles adding columns to table `{{%user_card}}`.
|
||||
*/
|
||||
class m210630_140410_add_level_column_to_user_card_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('{{%user_card}}', 'level', $this->integer(1)->defaultValue(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropColumn('{{%user_card}}', 'level');
|
||||
}
|
||||
}
|
@ -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]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user