From 816b39fc743d8b282e9c931b4b07c5618935f3c0 Mon Sep 17 00:00:00 2001 From: iIronside Date: Thu, 17 Nov 2022 12:40:22 +0300 Subject: [PATCH] add resume tariff column to user_card table --- .../modules/card/models/UserCardSearch.php | 1 + .../modules/card/views/user-card/_form.php | 1 + backend/modules/card/views/user-card/view.php | 4 ++ common/models/ResumeTemplate.php | 4 +- common/models/UserCard.php | 6 ++- ...esume_tariff_column_at_user_card_table.php | 40 +++++++++++++++++++ 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 console/migrations/m221117_091058_add_resume_tariff_column_at_user_card_table.php diff --git a/backend/modules/card/models/UserCardSearch.php b/backend/modules/card/models/UserCardSearch.php index 5cac5e3..1aa3f8d 100755 --- a/backend/modules/card/models/UserCardSearch.php +++ b/backend/modules/card/models/UserCardSearch.php @@ -85,6 +85,7 @@ class UserCardSearch extends UserCard 'updated_at' => $this->updated_at, 'test_task_getting_date' => $this->test_task_getting_date, 'test_task_complete_date' => $this->test_task_complete_date, + 'resume_tariff' => $this->resume_tariff, ]); $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 230cb4f..ae1bfba 100755 --- a/backend/modules/card/views/user-card/_form.php +++ b/backend/modules/card/views/user-card/_form.php @@ -120,6 +120,7 @@ use yii\widgets\ActiveForm; user->can('confidential_information')): ?>
field($model, 'salary')->textInput(['maxlength' => true]) ?> + field($model, 'resume_tariff')->textInput(['maxlength' => true]) ?>
diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index c72c7a9..29af3d7 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -80,6 +80,10 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'salary', 'visible' => Yii::$app->user->can('confidential_information') ], + [ + 'attribute' => 'resume_tariff', + 'visible' => Yii::$app->user->can('confidential_information') + ], [ 'attribute' => 'position_id', 'value' => (isset($model->position->name)) ? $model->position->name : 'Без должности', diff --git a/common/models/ResumeTemplate.php b/common/models/ResumeTemplate.php index 7aea051..e498d7a 100644 --- a/common/models/ResumeTemplate.php +++ b/common/models/ResumeTemplate.php @@ -28,6 +28,7 @@ class ResumeTemplate extends \yii\db\ActiveRecord 'Пол' => '${gender}', 'Резюме' => '${resume}', 'Зароботная плата' => '${salary}', + 'Ставка для резюме' => '${resume_tariff}', 'Позиция' => '${position_id}', 'Город' => '${city}', 'Ссылка ВК' => '${link_vk}', @@ -47,6 +48,7 @@ class ResumeTemplate extends \yii\db\ActiveRecord '${gender}'=> 'gender', '${resume}'=> 'resume', '${salary}' => 'salary', + '${resume_tariff}' => 'resume_tariff', '${position_id}'=> 'position_id', '${city}'=> 'city', '${link_vk}' => 'link_vk', @@ -104,7 +106,7 @@ class ResumeTemplate extends \yii\db\ActiveRecord 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => 'Статус', - 'template_body' => 'Template Body', + 'template_body' => 'Тело шаблона', 'header_text' => 'Текст в верхнем контикуле', 'header_image' => 'Картинка в верхнем контикуле', ]; diff --git a/common/models/UserCard.php b/common/models/UserCard.php index 45d306e..44eabd9 100755 --- a/common/models/UserCard.php +++ b/common/models/UserCard.php @@ -40,6 +40,7 @@ use yii\helpers\ArrayHelper; * @property string $test_task_complete_date * @property string $resume_text * @property int $resume_template_id + * @property int $resume_tariff * * @property FieldsValue[] $fieldsValues * @property ProjectUser[] $projectUsers @@ -112,7 +113,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'], 'integer'], + [['gender', 'status', 'position_id', 'id_user', 'level', 'years_of_exp', 'resume_tariff'], '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], @@ -158,7 +159,8 @@ class UserCard extends \yii\db\ActiveRecord 'test_task_getting_date' => 'Дата получения тестового', 'test_task_complete_date' => 'Дата выполнения тестового', 'resume_template_id' => 'Шаблон резюме', - 'resume_text' => 'Резюме сгенерированный текст' + 'resume_text' => 'Резюме сгенерированный текст', + 'resume_tariff' => 'Ставка для резюме' ]; } diff --git a/console/migrations/m221117_091058_add_resume_tariff_column_at_user_card_table.php b/console/migrations/m221117_091058_add_resume_tariff_column_at_user_card_table.php new file mode 100644 index 0000000..d6a6d37 --- /dev/null +++ b/console/migrations/m221117_091058_add_resume_tariff_column_at_user_card_table.php @@ -0,0 +1,40 @@ +addColumn('user_card', 'resume_tariff', $this->integer()); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('user_card', 'resume_tariff'); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m221117_091058_add_resume_tariff_column_at_user_card_table cannot be reverted.\n"; + + return false; + } + */ +}