diff --git a/common/models/CompanyInfo.php b/common/models/CompanyInfo.php index 33fc139..068c1cd 100755 --- a/common/models/CompanyInfo.php +++ b/common/models/CompanyInfo.php @@ -1,54 +1,80 @@ 1], - [['staff'], 'integer', 'min' => 1], - ]; - } + /** + * @inheritdoc + */ + public static function tableName() + { + return 'company_info'; + } - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'company_info_id' => Yii::t('app', 'Company Info ID'), - 'name' => Yii::t('app', 'Название компании'), - 'staff' => Yii::t('app', 'Количество сотрудников'), - 'street' => Yii::t('app', 'Улица'), - 'house' => Yii::t('app', 'Дом'), - 'hide_mail' => Yii::t('app', 'не публиковать Email'), - ]; + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'name', + 'street', + 'house', + ], + 'required', + ], + [ + [ + 'name', + 'street', + 'house', + ], + 'string', + ], + [ + [ 'hide_mail' ], + 'integer', + ], + [ + [ 'staff' ], + 'default', + 'value' => 1, + ], + [ + [ 'staff' ], + 'integer', + 'min' => 1, + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'company_info_id' => Yii::t('app', 'Company Info ID'), + 'name' => Yii::t('app', 'Название компании'), + 'staff' => Yii::t('app', 'Количество сотрудников'), + 'street' => Yii::t('app', 'Улица'), + 'house' => Yii::t('app', 'Дом'), + 'hide_mail' => Yii::t('app', 'не публиковать Email'), + ]; + } } -} diff --git a/common/models/PortfolioSearch.php b/common/models/PortfolioSearch.php index 4e26fed..75308b5 100644 --- a/common/models/PortfolioSearch.php +++ b/common/models/PortfolioSearch.php @@ -104,8 +104,8 @@ ->joinWith([ 'specializations' ]) ->where([ 'like', - 'specialization_name', - $this->specializationString, + 'LOWER(specialization_name)', + mb_strtolower($this->specializationString), ]) ->asArray() ->column(); @@ -129,11 +129,13 @@ (new \DateTime($this->date_add_to))->modify('+1 day')->format('Y-m-d') ]); - $query->andFilterWhere( - [ - 'portfolio_id' => $query2, - ] - ); + if(!empty($this->specializationString)) { + $query->andWhere( + [ + 'portfolio_id' => $query2, + ] + ); + } $query->andFilterWhere([ 'like', diff --git a/common/models/Project.php b/common/models/Project.php index 812aafe..d26f8d8 100644 --- a/common/models/Project.php +++ b/common/models/Project.php @@ -68,7 +68,7 @@ { return [ [ - [ 'name' ], + [ 'name', 'link' ], 'required', ], [ @@ -76,6 +76,7 @@ 'project_pid', 'payment_variant', 'contractual', + 'budget_currency', ], 'integer', ], diff --git a/common/models/ProjectSearch.php b/common/models/ProjectSearch.php index 47fb0ef..e3cebc4 100644 --- a/common/models/ProjectSearch.php +++ b/common/models/ProjectSearch.php @@ -13,6 +13,8 @@ class ProjectSearch extends Project { + public $date_add_from; + public $date_add_to; /** * @inheritdoc */ @@ -43,6 +45,8 @@ 'description', 'file', 'specializationString', + 'date_add_from', + 'date_add_to', ], 'safe', ], @@ -50,6 +54,20 @@ [ 'view_count' ], 'number', ], + [ + [ + 'date_add_from', + ], + 'default', + 'value' => date('Y-m-d', 0), + ], + [ + [ + 'date_add_to', + ], + 'default', + 'value' => date('Y-m-d'), + ], ]; } @@ -94,8 +112,8 @@ ->joinWith([ 'specializations' ]) ->where([ 'like', - 'specialization_name', - $this->specializationString, + 'LOWER(specialization_name)', + mb_strtolower($this->specializationString), ]) ->asArray() ->column(); @@ -116,11 +134,20 @@ 'contractual' => $this->contractual, ]); - $query->andFilterWhere( - [ - 'project_id' => $query2, - ] - ); + $query->andFilterWhere([ + 'between', + 'date_add', + $this->date_add_from, + (new \DateTime($this->date_add_to))->modify('+1 day')->format('Y-m-d'), + ]); + + if(!empty($this->specializationString)) { + $query->andWhere( + [ + 'project_id' => $query2, + ] + ); + } $query->andFilterWhere([ 'like', diff --git a/common/models/User.php b/common/models/User.php index 35354fe..faa1c38 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -89,7 +89,6 @@ [ 'firstname', 'lastname', - 'email', ], 'required', ], diff --git a/common/models/UserInfo.php b/common/models/UserInfo.php index d502e4d..78ae37e 100755 --- a/common/models/UserInfo.php +++ b/common/models/UserInfo.php @@ -29,6 +29,7 @@ * @property integer $type * @property string $geography * @property integer $salary_currency + * @property string $email */ class UserInfo extends \yii\db\ActiveRecord { @@ -68,6 +69,7 @@ [ [ 'city', + 'email', ], 'required', ], @@ -195,6 +197,12 @@ 'default', 'value' => [], ], + [ + [ + 'email', + ], + 'email', + ], ]; } @@ -267,4 +275,5 @@ { $this->geographies = $value; } + } diff --git a/console/migrations/m160219_152535_add_preview_portfolio.php b/console/migrations/m160219_152535_add_preview_portfolio.php new file mode 100644 index 0000000..699aeba --- /dev/null +++ b/console/migrations/m160219_152535_add_preview_portfolio.php @@ -0,0 +1,16 @@ +addColumn('{{%portfolio}}', 'preview', $this->string(1000)); + } + + public function down() + { + $this->dropColumn('{{%portfolio}}', 'preview'); + } +} diff --git a/console/migrations/m160222_160058_add_user_info_email.php b/console/migrations/m160222_160058_add_user_info_email.php new file mode 100644 index 0000000..1d75ecb --- /dev/null +++ b/console/migrations/m160222_160058_add_user_info_email.php @@ -0,0 +1,16 @@ +addColumn('{{%user_info}}', 'email', $this->string()); + } + + public function down() + { + $this->dropColumn('{{%user_info}}', 'email'); + } +} diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index 8b69b13..cca4a57 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -644,8 +644,7 @@ $project->link('payments', Payment::findOne($one_payment)); } return $this->redirect([ - 'projects-update', - 'id' => $project->project_id, + 'projects', ]); } } @@ -724,6 +723,7 @@ foreach($project->paymentInput as $one_payment) { $project->link('payments', Payment::findOne($one_payment)); } + return $this->redirect(['projects']); } } return $this->render('_projects_form', [ diff --git a/frontend/views/accounts/_projects_form.php b/frontend/views/accounts/_projects_form.php index b553025..1d5cb2e 100644 --- a/frontend/views/accounts/_projects_form.php +++ b/frontend/views/accounts/_projects_form.php @@ -236,7 +236,7 @@ = $form->field($project, 'date_end') ->dropDownList([ 1 => 'Неделя', - 2 => '2 неделю', + 2 => '2 недели', 3 => 'Месяц', ]) ?> diff --git a/frontend/views/accounts/general.php b/frontend/views/accounts/general.php index 066f768..92d324f 100755 --- a/frontend/views/accounts/general.php +++ b/frontend/views/accounts/general.php @@ -171,8 +171,8 @@