diff --git a/backend/views/specialization/_form.php b/backend/views/specialization/_form.php index 5940197..a1117a6 100755 --- a/backend/views/specialization/_form.php +++ b/backend/views/specialization/_form.php @@ -3,6 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; +use \kartik\color\ColorInput; /* @var $this yii\web\View */ /* @var $model common\models\Specialization */ /* @var $form yii\widgets\ActiveForm */ @@ -20,9 +21,13 @@ use yii\helpers\ArrayHelper; if($model->specialization_pid == 0 && !empty($model->specialization_id) ){ - echo $form->field($model, 'background')->textInput(); - echo \common\widgets\ImageUploader::widget([ + + echo $form->field($model, 'background')->widget(ColorInput::classname(), [ + 'options' => ['placeholder' => 'Select color ...'], + ]); + + echo \common\widgets\ImageUploader::widget([ 'model'=> $model, 'field'=>'image', 'width'=>940, diff --git a/common/models/UserInfo.php b/common/models/UserInfo.php index 20bbae6..df09162 100755 --- a/common/models/UserInfo.php +++ b/common/models/UserInfo.php @@ -61,13 +61,13 @@ class UserInfo extends \yii\db\ActiveRecord public function rules() { return [ - [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'], + [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery','is_customer','is_freelancer'], 'integer'], [['date_visit'], 'safe'], [['experience', 'soft', 'guarantee', 'about', 'city', 'country', 'image', 'poster', 'social_vk', 'social_fb', 'social_in', 'social_t'], 'string'], [['prepayment'], 'number'], [['rank', 'location'], 'string', 'max' => 50], - [['salary', 'job'], 'string', 'max' => 255], + [['salary', 'job','firstname','lastname'], 'string', 'max' => 255], [['busy', 'member'], 'boolean'], ]; } @@ -96,6 +96,12 @@ class UserInfo extends \yii\db\ActiveRecord 'delivery' => Yii::t('app', 'Delivery'), 'prepayment' => Yii::t('app', 'Prepayment'), 'about' => Yii::t('app', 'About'), + 'type' => Yii::t('app', 'Is Default'), + 'firstname' => 'Имя', + 'lastname' => 'Фамилия', + 'alt_location' => 'Город не в списке', + 'is_customer' => '', + 'is_freelancer' => '', ]; } diff --git a/composer.json b/composer.json index ea847ea..5b7014e 100755 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "developeruz/yii2-db-rbac": "*", "nodge/yii2-eauth": "*", "yiisoft/yii2-imagine": "^2.0", - "mihaildev/yii2-elfinder": "^1.1" + "mihaildev/yii2-elfinder": "^1.1", + "kartik-v/yii2-widget-colorinput": "*" }, "require-dev": { "yiisoft/yii2-codeception": "*", diff --git a/composer.lock b/composer.lock index 88011d3..32647d9 100755 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5f5473586959d0912177c3dace19c844", - "content-hash": "2d0acd792b2e28f03338a962c2923bbe", + "hash": "f958ed2e8b3c8028fd675954db6672d5", + "content-hash": "d6ebcd3630219974938579b63b419fdd", "packages": [ { "name": "almasaeed2010/adminlte", @@ -324,7 +324,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cebe/markdown/zipball/d7b6f46cd423174c8a86c7f816dea45008dbf454", + "url": "https://api.github.com/repos/cebe/markdown/zipball/35d47fe727a453a8aa5c6be7e627caad8f16d586", "reference": "d7b6f46cd423174c8a86c7f816dea45008dbf454", "shasum": "" }, @@ -660,6 +660,60 @@ "time": "2016-01-10 12:26:29" }, { + "name": "kartik-v/yii2-widget-colorinput", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/kartik-v/yii2-widget-colorinput.git", + "reference": "18537fcdab0f5491d5eebff8e2464ef6a616ee4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kartik-v/yii2-widget-colorinput/zipball/18537fcdab0f5491d5eebff8e2464ef6a616ee4c", + "reference": "18537fcdab0f5491d5eebff8e2464ef6a616ee4c", + "shasum": "" + }, + "require": { + "kartik-v/yii2-krajee-base": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "kartik\\color\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD 3-Clause" + ], + "authors": [ + { + "name": "Kartik Visweswaran", + "email": "kartikv2@gmail.com", + "homepage": "http://www.krajee.com/" + } + ], + "description": "An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)", + "homepage": "https://github.com/kartik-v/yii2-widget-colorinput", + "keywords": [ + "HTML5", + "color", + "extension", + "form", + "input", + "jquery", + "plugin", + "widget", + "yii2" + ], + "time": "2016-02-02 14:28:12" + }, + { "name": "kartik-v/yii2-widget-select2", "version": "dev-master", "source": { @@ -1228,7 +1282,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/574dcb1d101ae55be230e0c00a2428af6ec4c5c1", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/d33d1046a5951f2f7823fe343f28ddc58b3421a4", "reference": "574dcb1d101ae55be230e0c00a2428af6ec4c5c1", "shasum": "" }, @@ -1452,7 +1506,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/b312ab9d0c446971069e22a524fec01c7cddc75e", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/8d8e0e1a6151a46ea5cda344e2234b7225c61e7a", "reference": "b312ab9d0c446971069e22a524fec01c7cddc75e", "shasum": "" }, diff --git a/console/migrations/m160208_125956_user_info_add_status_fields.php b/console/migrations/m160208_125956_user_info_add_status_fields.php new file mode 100644 index 0000000..dfd2a87 --- /dev/null +++ b/console/migrations/m160208_125956_user_info_add_status_fields.php @@ -0,0 +1,18 @@ +addColumn('user_info', 'is_freelancer', $this->integer()); + $this->addColumn('user_info', 'is_customer', $this->integer()); + } + + public function down() + { + $this->dropColumn('user_info', 'is_freelancer'); + $this->dropColumn('user_info', 'is_customer'); + } +} diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index a8c69e1..b391fe1 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -55,9 +55,9 @@ class SiteController extends Controller $out = ['results' => ['id' => '', 'text' => '']]; if (!is_null($q)) { $query = new Query; - $query->select('id, name AS text') + $query->select('name AS id, name AS text') ->from('cities') - ->where(['like', 'name', $q]) + ->where(['like', 'name', mb_convert_case( $q,MB_CASE_TITLE, "UTF-8")]) ->limit(20); $command = $query->createCommand(); $data = $command->queryAll(); @@ -84,7 +84,7 @@ class SiteController extends Controller */ public function actionIndex() { - $specializations = Specialization::find()->where(['specialization_pid'=>0])->all(); + $specializations = Specialization::find()->where(['specialization_pid'=>0])->orderBy('specialization_id')->all(); return $this->render('index',[ 'specializations' => $specializations, @@ -213,8 +213,11 @@ class SiteController extends Controller $user_info = new UserInfo(); + $user_info->load(Yii::$app->request->post(),'SignupForm'); + $user_info->user_id = $user->id; + $user_info->save(); if (Yii::$app->getUser()->login($user)) { diff --git a/frontend/models/SignupForm.php b/frontend/models/SignupForm.php index 3b49ebe..065eec5 100755 --- a/frontend/models/SignupForm.php +++ b/frontend/models/SignupForm.php @@ -18,6 +18,9 @@ class SignupForm extends Model public $verifyCode; public $location; public $type; + public $is_customer; + public $is_freelancer; + public $city; /** * @inheritdoc @@ -30,7 +33,7 @@ class SignupForm extends Model ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], ['username', 'string', 'min' => 2, 'max' => 255], - ['location', 'string', 'min' => 2, 'max' => 255], + ['city', 'string', 'min' => 2, 'max' => 255], ['email', 'filter', 'filter' => 'trim'], ['email', 'required'], @@ -41,6 +44,8 @@ class SignupForm extends Model ['verifyCode', 'captcha'], ['type', 'integer'], + ['is_customer', 'integer'], + ['is_freelancer', 'integer'], ['password', 'required'], ['password', 'string', 'min' => 6], @@ -67,5 +72,23 @@ class SignupForm extends Model return null; } + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'username' => 'Логин', + 'password' => 'Пароль', + 'email' => 'E-mail', + 'type' => Yii::t('app', 'Is Default'), + 'firstname' => 'Имя', + 'lastname' => 'Фамилия', + 'city' => 'Город', + 'alt_location' => 'Город не в списке', + 'is_customer' => '', + 'is_freelancer' => '', + ]; + } } diff --git a/frontend/views/site/registration.php b/frontend/views/site/registration.php index 991db14..53d74b9 100644 --- a/frontend/views/site/registration.php +++ b/frontend/views/site/registration.php @@ -71,15 +71,17 @@