diff --git a/backend/modules/card/models/UserCardSearch.php b/backend/modules/card/models/UserCardSearch.php index cfe1241..7e971e1 100755 --- a/backend/modules/card/models/UserCardSearch.php +++ b/backend/modules/card/models/UserCardSearch.php @@ -21,7 +21,7 @@ class UserCardSearch extends UserCard { return [ [['id', 'gender', 'status'], 'integer'], - [['fio', 'passport', 'photo', 'email', 'dob', 'created_at', 'updated_at'], 'safe'], + [['fio', 'passport', 'photo', 'email', 'dob', 'created_at', 'updated_at', 'city'], 'safe'], ['skills', 'each', 'rule' => ['integer']], ]; } @@ -71,6 +71,7 @@ class UserCardSearch extends UserCard 'gender' => $this->gender, 'dob' => $this->dob, 'status' => $this->status, + 'city' => $this->city, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]); @@ -78,6 +79,7 @@ class UserCardSearch extends UserCard $query->andFilterWhere(['like', 'fio', $this->fio]) ->andFilterWhere(['like', 'passport', $this->passport]) ->andFilterWhere(['like', 'photo', $this->photo]) + ->andFilterWhere(['like', 'city', $this->city]) ->andFilterWhere(['like', 'email', $this->email]); $query->andFilterWhere(['skill.id' => $this->skills]); diff --git a/backend/modules/card/views/user-card/_form.php b/backend/modules/card/views/user-card/_form.php index 0f24963..2726ca1 100755 --- a/backend/modules/card/views/user-card/_form.php +++ b/backend/modules/card/views/user-card/_form.php @@ -67,6 +67,12 @@ use yii\widgets\ActiveForm; +
+ = Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?> = Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
@@ -27,19 +28,23 @@ $this->params['breadcrumbs'][] = $this->title; 'fio', 'passport', [ - 'attribute' => 'Photo', + 'attribute' => 'photo', 'format' => 'raw', 'value' => function ($model) { return Html::tag('img', null, ['src' => $model->photo, 'width' => '100px']); } ], [ - 'attribute' => 'Resume', + 'attribute' => 'resume', 'format' => 'raw', 'value' => function ($model) { return Html::a('Скачать', $model->resume, ['target' => '_blank']); } ], + [ + 'attribute' => 'city', + 'value' => $model->city + ], [ 'attribute' => 'gender', 'value' => $model->gendersText, diff --git a/common/models/UserCard.php b/common/models/UserCard.php index 2e0dc5f..d2f3555 100755 --- a/common/models/UserCard.php +++ b/common/models/UserCard.php @@ -26,6 +26,7 @@ use yii\helpers\ArrayHelper; * @property string $resume * @property string $salary * @property int $position_id + * @property int $city * * @property FieldsValue[] $fieldsValues * @property ProjectUser[] $projectUsers @@ -66,7 +67,7 @@ class UserCard extends \yii\db\ActiveRecord [['fio', 'status', 'gender'], 'required'], [['gender', 'status', 'position_id', 'id_user'], 'integer'], [['dob', 'created_at', 'updated_at', 'deleted_at'], 'safe'], - [['fio', 'passport', 'photo', 'email', 'resume'], 'string', 'max' => 255], + [['fio', 'passport', 'photo', 'email', 'resume', 'city'], 'string', 'max' => 255], [['salary'], 'string', 'max' => 100], [['position_id'], 'exist', 'skipOnError' => true, 'targetClass' => Position::class, 'targetAttribute' => ['position_id' => 'id']], [['status'], 'exist', 'skipOnError' => true, 'targetClass' => Status::class, 'targetAttribute' => ['status' => 'id']], @@ -94,6 +95,7 @@ class UserCard extends \yii\db\ActiveRecord 'resume' => 'Резюме', 'salary' => 'Зарплата', 'position_id' => 'Должность', + 'city' => 'Город', ]; } diff --git a/console/migrations/m191206_145411_add_column_city_to_user_card.php b/console/migrations/m191206_145411_add_column_city_to_user_card.php new file mode 100644 index 0000000..ade1e19 --- /dev/null +++ b/console/migrations/m191206_145411_add_column_city_to_user_card.php @@ -0,0 +1,37 @@ +addColumn('user_card', 'city', $this->string(255)); + +// $this->addColumn('user_card', 'city', $this->integer(11)->notNull()->defaultValue('1')); +// $this->addForeignKey( +// 'city', +// 'user_card', +// 'city', +// 'cities', +// 'id', +// 'RESTRICT', +// 'CASCADE' +// ); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropForeignKey('cityID', 'user_card'); + $this->dropColumn('user_card', 'city'); + } +}