From 8200544531bd8f2be5db5272ff4617891f94ccf7 Mon Sep 17 00:00:00 2001 From: Leorne Date: Mon, 9 Dec 2019 10:54:39 +0300 Subject: [PATCH 1/2] cities for profiles --- .../modules/card/models/UserCardSearch.php | 4 +- .../modules/card/views/user-card/_form.php | 6 +++ .../modules/card/views/user-card/index.php | 1 + .../modules/card/views/user-card/update.php | 4 +- backend/modules/card/views/user-card/view.php | 11 ++++-- common/models/UserCard.php | 4 +- ...06_145411_add_column_city_to_user_card.php | 37 +++++++++++++++++++ 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 console/migrations/m191206_145411_add_column_city_to_user_card.php 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; +
+
+ field($model, 'city')->textInput(['maxlength' => true]) ?> +
+
+
field($model, 'email')->textInput(['maxlength' => true]) ?> diff --git a/backend/modules/card/views/user-card/index.php b/backend/modules/card/views/user-card/index.php index c4b2494..622adeb 100755 --- a/backend/modules/card/views/user-card/index.php +++ b/backend/modules/card/views/user-card/index.php @@ -36,6 +36,7 @@ $this->params['breadcrumbs'][] = $this->title; }, ], 'fio', +// 'city', //'passport', 'salary', 'email:email', diff --git a/backend/modules/card/views/user-card/update.php b/backend/modules/card/views/user-card/update.php index 6d547a2..b448634 100755 --- a/backend/modules/card/views/user-card/update.php +++ b/backend/modules/card/views/user-card/update.php @@ -6,9 +6,9 @@ use yii\helpers\Html; /* @var $model backend\modules\card\models\UserCard */ $this->title = $model->fio; -$this->params['breadcrumbs'][] = ['label' => 'User Cards', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => 'Профили', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update'; +$this->params['breadcrumbs'][] = 'Редактировать'; ?>
diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index 4ec95e2..0b1baef 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -12,12 +12,13 @@ use yii\widgets\DetailView; /* @var $modelFildValue yii\data\ActiveDataProvider */ $this->title = $model->fio; -$this->params['breadcrumbs'][] = ['label' => 'User Cards', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => 'Профили', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>

+ 'btn btn-primary']) ?> $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'); + } +} From 34e56f9fcc26be1d41bd898d015a3a5601b22015 Mon Sep 17 00:00:00 2001 From: Leorne Date: Mon, 9 Dec 2019 17:25:43 +0300 Subject: [PATCH 2/2] remove descriptions from notes list --- backend/modules/notes/views/notes/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/modules/notes/views/notes/index.php b/backend/modules/notes/views/notes/index.php index e5fa61a..88e0484 100755 --- a/backend/modules/notes/views/notes/index.php +++ b/backend/modules/notes/views/notes/index.php @@ -23,7 +23,7 @@ $this->params['breadcrumbs'][] = $this->title; ['class' => 'yii\grid\SerialColumn'], // 'id', 'name', - 'description', + // 'description', 'created_at', // 'updated_at',