Commit 30fbd0bce17be9121e529b4e76c4ee468c806b9e
1 parent
fe41f4ed
09.02.16
Showing
8 changed files
with
137 additions
and
25 deletions
Show diff stats
backend/views/specialization/_form.php
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | use yii\helpers\Html; | 3 | use yii\helpers\Html; |
4 | use yii\widgets\ActiveForm; | 4 | use yii\widgets\ActiveForm; |
5 | use yii\helpers\ArrayHelper; | 5 | use yii\helpers\ArrayHelper; |
6 | +use \kartik\color\ColorInput; | ||
6 | /* @var $this yii\web\View */ | 7 | /* @var $this yii\web\View */ |
7 | /* @var $model common\models\Specialization */ | 8 | /* @var $model common\models\Specialization */ |
8 | /* @var $form yii\widgets\ActiveForm */ | 9 | /* @var $form yii\widgets\ActiveForm */ |
@@ -20,9 +21,13 @@ use yii\helpers\ArrayHelper; | @@ -20,9 +21,13 @@ use yii\helpers\ArrayHelper; | ||
20 | 21 | ||
21 | 22 | ||
22 | if($model->specialization_pid == 0 && !empty($model->specialization_id) ){ | 23 | if($model->specialization_pid == 0 && !empty($model->specialization_id) ){ |
23 | - echo $form->field($model, 'background')->textInput(); | ||
24 | 24 | ||
25 | - echo \common\widgets\ImageUploader::widget([ | 25 | + |
26 | + echo $form->field($model, 'background')->widget(ColorInput::classname(), [ | ||
27 | + 'options' => ['placeholder' => 'Select color ...'], | ||
28 | + ]); | ||
29 | + | ||
30 | + echo \common\widgets\ImageUploader::widget([ | ||
26 | 'model'=> $model, | 31 | 'model'=> $model, |
27 | 'field'=>'image', | 32 | 'field'=>'image', |
28 | 'width'=>940, | 33 | 'width'=>940, |
common/models/UserInfo.php
@@ -61,13 +61,13 @@ class UserInfo extends \yii\db\ActiveRecord | @@ -61,13 +61,13 @@ class UserInfo extends \yii\db\ActiveRecord | ||
61 | public function rules() | 61 | public function rules() |
62 | { | 62 | { |
63 | return [ | 63 | return [ |
64 | - [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'], | 64 | + [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery','is_customer','is_freelancer'], 'integer'], |
65 | [['date_visit'], 'safe'], | 65 | [['date_visit'], 'safe'], |
66 | [['experience', 'soft', 'guarantee', 'about', 'city', 'country', 'image', 'poster', 'social_vk', 'social_fb', 'social_in', 'social_t'], 'string'], | 66 | [['experience', 'soft', 'guarantee', 'about', 'city', 'country', 'image', 'poster', 'social_vk', 'social_fb', 'social_in', 'social_t'], 'string'], |
67 | [['prepayment'], 'number'], | 67 | [['prepayment'], 'number'], |
68 | 68 | ||
69 | [['rank', 'location'], 'string', 'max' => 50], | 69 | [['rank', 'location'], 'string', 'max' => 50], |
70 | - [['salary', 'job'], 'string', 'max' => 255], | 70 | + [['salary', 'job','firstname','lastname'], 'string', 'max' => 255], |
71 | [['busy', 'member'], 'boolean'], | 71 | [['busy', 'member'], 'boolean'], |
72 | ]; | 72 | ]; |
73 | } | 73 | } |
@@ -96,6 +96,12 @@ class UserInfo extends \yii\db\ActiveRecord | @@ -96,6 +96,12 @@ class UserInfo extends \yii\db\ActiveRecord | ||
96 | 'delivery' => Yii::t('app', 'Delivery'), | 96 | 'delivery' => Yii::t('app', 'Delivery'), |
97 | 'prepayment' => Yii::t('app', 'Prepayment'), | 97 | 'prepayment' => Yii::t('app', 'Prepayment'), |
98 | 'about' => Yii::t('app', 'About'), | 98 | 'about' => Yii::t('app', 'About'), |
99 | + 'type' => Yii::t('app', 'Is Default'), | ||
100 | + 'firstname' => 'Имя', | ||
101 | + 'lastname' => 'Фамилия', | ||
102 | + 'alt_location' => 'Город не в списке', | ||
103 | + 'is_customer' => '', | ||
104 | + 'is_freelancer' => '', | ||
99 | 105 | ||
100 | ]; | 106 | ]; |
101 | } | 107 | } |
composer.json
@@ -25,7 +25,8 @@ | @@ -25,7 +25,8 @@ | ||
25 | "developeruz/yii2-db-rbac": "*", | 25 | "developeruz/yii2-db-rbac": "*", |
26 | "nodge/yii2-eauth": "*", | 26 | "nodge/yii2-eauth": "*", |
27 | "yiisoft/yii2-imagine": "^2.0", | 27 | "yiisoft/yii2-imagine": "^2.0", |
28 | - "mihaildev/yii2-elfinder": "^1.1" | 28 | + "mihaildev/yii2-elfinder": "^1.1", |
29 | + "kartik-v/yii2-widget-colorinput": "*" | ||
29 | }, | 30 | }, |
30 | "require-dev": { | 31 | "require-dev": { |
31 | "yiisoft/yii2-codeception": "*", | 32 | "yiisoft/yii2-codeception": "*", |
composer.lock
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
5 | "This file is @generated automatically" | 5 | "This file is @generated automatically" |
6 | ], | 6 | ], |
7 | - "hash": "5f5473586959d0912177c3dace19c844", | ||
8 | - "content-hash": "2d0acd792b2e28f03338a962c2923bbe", | 7 | + "hash": "f958ed2e8b3c8028fd675954db6672d5", |
8 | + "content-hash": "d6ebcd3630219974938579b63b419fdd", | ||
9 | "packages": [ | 9 | "packages": [ |
10 | { | 10 | { |
11 | "name": "almasaeed2010/adminlte", | 11 | "name": "almasaeed2010/adminlte", |
@@ -324,7 +324,7 @@ | @@ -324,7 +324,7 @@ | ||
324 | }, | 324 | }, |
325 | "dist": { | 325 | "dist": { |
326 | "type": "zip", | 326 | "type": "zip", |
327 | - "url": "https://api.github.com/repos/cebe/markdown/zipball/d7b6f46cd423174c8a86c7f816dea45008dbf454", | 327 | + "url": "https://api.github.com/repos/cebe/markdown/zipball/35d47fe727a453a8aa5c6be7e627caad8f16d586", |
328 | "reference": "d7b6f46cd423174c8a86c7f816dea45008dbf454", | 328 | "reference": "d7b6f46cd423174c8a86c7f816dea45008dbf454", |
329 | "shasum": "" | 329 | "shasum": "" |
330 | }, | 330 | }, |
@@ -660,6 +660,60 @@ | @@ -660,6 +660,60 @@ | ||
660 | "time": "2016-01-10 12:26:29" | 660 | "time": "2016-01-10 12:26:29" |
661 | }, | 661 | }, |
662 | { | 662 | { |
663 | + "name": "kartik-v/yii2-widget-colorinput", | ||
664 | + "version": "dev-master", | ||
665 | + "source": { | ||
666 | + "type": "git", | ||
667 | + "url": "https://github.com/kartik-v/yii2-widget-colorinput.git", | ||
668 | + "reference": "18537fcdab0f5491d5eebff8e2464ef6a616ee4c" | ||
669 | + }, | ||
670 | + "dist": { | ||
671 | + "type": "zip", | ||
672 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-colorinput/zipball/18537fcdab0f5491d5eebff8e2464ef6a616ee4c", | ||
673 | + "reference": "18537fcdab0f5491d5eebff8e2464ef6a616ee4c", | ||
674 | + "shasum": "" | ||
675 | + }, | ||
676 | + "require": { | ||
677 | + "kartik-v/yii2-krajee-base": "*" | ||
678 | + }, | ||
679 | + "type": "yii2-extension", | ||
680 | + "extra": { | ||
681 | + "branch-alias": { | ||
682 | + "dev-master": "1.0.x-dev" | ||
683 | + } | ||
684 | + }, | ||
685 | + "autoload": { | ||
686 | + "psr-4": { | ||
687 | + "kartik\\color\\": "" | ||
688 | + } | ||
689 | + }, | ||
690 | + "notification-url": "https://packagist.org/downloads/", | ||
691 | + "license": [ | ||
692 | + "BSD 3-Clause" | ||
693 | + ], | ||
694 | + "authors": [ | ||
695 | + { | ||
696 | + "name": "Kartik Visweswaran", | ||
697 | + "email": "kartikv2@gmail.com", | ||
698 | + "homepage": "http://www.krajee.com/" | ||
699 | + } | ||
700 | + ], | ||
701 | + "description": "An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)", | ||
702 | + "homepage": "https://github.com/kartik-v/yii2-widget-colorinput", | ||
703 | + "keywords": [ | ||
704 | + "HTML5", | ||
705 | + "color", | ||
706 | + "extension", | ||
707 | + "form", | ||
708 | + "input", | ||
709 | + "jquery", | ||
710 | + "plugin", | ||
711 | + "widget", | ||
712 | + "yii2" | ||
713 | + ], | ||
714 | + "time": "2016-02-02 14:28:12" | ||
715 | + }, | ||
716 | + { | ||
663 | "name": "kartik-v/yii2-widget-select2", | 717 | "name": "kartik-v/yii2-widget-select2", |
664 | "version": "dev-master", | 718 | "version": "dev-master", |
665 | "source": { | 719 | "source": { |
@@ -1228,7 +1282,7 @@ | @@ -1228,7 +1282,7 @@ | ||
1228 | }, | 1282 | }, |
1229 | "dist": { | 1283 | "dist": { |
1230 | "type": "zip", | 1284 | "type": "zip", |
1231 | - "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/574dcb1d101ae55be230e0c00a2428af6ec4c5c1", | 1285 | + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/d33d1046a5951f2f7823fe343f28ddc58b3421a4", |
1232 | "reference": "574dcb1d101ae55be230e0c00a2428af6ec4c5c1", | 1286 | "reference": "574dcb1d101ae55be230e0c00a2428af6ec4c5c1", |
1233 | "shasum": "" | 1287 | "shasum": "" |
1234 | }, | 1288 | }, |
@@ -1452,7 +1506,7 @@ | @@ -1452,7 +1506,7 @@ | ||
1452 | }, | 1506 | }, |
1453 | "dist": { | 1507 | "dist": { |
1454 | "type": "zip", | 1508 | "type": "zip", |
1455 | - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/b312ab9d0c446971069e22a524fec01c7cddc75e", | 1509 | + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/8d8e0e1a6151a46ea5cda344e2234b7225c61e7a", |
1456 | "reference": "b312ab9d0c446971069e22a524fec01c7cddc75e", | 1510 | "reference": "b312ab9d0c446971069e22a524fec01c7cddc75e", |
1457 | "shasum": "" | 1511 | "shasum": "" |
1458 | }, | 1512 | }, |
console/migrations/m160208_125956_user_info_add_status_fields.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +class m160208_125956_user_info_add_status_fields extends Migration | ||
6 | +{ | ||
7 | + public function up() | ||
8 | + { | ||
9 | + $this->addColumn('user_info', 'is_freelancer', $this->integer()); | ||
10 | + $this->addColumn('user_info', 'is_customer', $this->integer()); | ||
11 | + } | ||
12 | + | ||
13 | + public function down() | ||
14 | + { | ||
15 | + $this->dropColumn('user_info', 'is_freelancer'); | ||
16 | + $this->dropColumn('user_info', 'is_customer'); | ||
17 | + } | ||
18 | +} |
frontend/controllers/SiteController.php
@@ -55,9 +55,9 @@ class SiteController extends Controller | @@ -55,9 +55,9 @@ class SiteController extends Controller | ||
55 | $out = ['results' => ['id' => '', 'text' => '']]; | 55 | $out = ['results' => ['id' => '', 'text' => '']]; |
56 | if (!is_null($q)) { | 56 | if (!is_null($q)) { |
57 | $query = new Query; | 57 | $query = new Query; |
58 | - $query->select('id, name AS text') | 58 | + $query->select('name AS id, name AS text') |
59 | ->from('cities') | 59 | ->from('cities') |
60 | - ->where(['like', 'name', $q]) | 60 | + ->where(['like', 'name', mb_convert_case( $q,MB_CASE_TITLE, "UTF-8")]) |
61 | ->limit(20); | 61 | ->limit(20); |
62 | $command = $query->createCommand(); | 62 | $command = $query->createCommand(); |
63 | $data = $command->queryAll(); | 63 | $data = $command->queryAll(); |
@@ -84,7 +84,7 @@ class SiteController extends Controller | @@ -84,7 +84,7 @@ class SiteController extends Controller | ||
84 | */ | 84 | */ |
85 | public function actionIndex() | 85 | public function actionIndex() |
86 | { | 86 | { |
87 | - $specializations = Specialization::find()->where(['specialization_pid'=>0])->all(); | 87 | + $specializations = Specialization::find()->where(['specialization_pid'=>0])->orderBy('specialization_id')->all(); |
88 | 88 | ||
89 | return $this->render('index',[ | 89 | return $this->render('index',[ |
90 | 'specializations' => $specializations, | 90 | 'specializations' => $specializations, |
@@ -213,8 +213,11 @@ class SiteController extends Controller | @@ -213,8 +213,11 @@ class SiteController extends Controller | ||
213 | 213 | ||
214 | $user_info = new UserInfo(); | 214 | $user_info = new UserInfo(); |
215 | 215 | ||
216 | + $user_info->load(Yii::$app->request->post(),'SignupForm'); | ||
217 | + | ||
216 | $user_info->user_id = $user->id; | 218 | $user_info->user_id = $user->id; |
217 | 219 | ||
220 | + | ||
218 | $user_info->save(); | 221 | $user_info->save(); |
219 | 222 | ||
220 | if (Yii::$app->getUser()->login($user)) { | 223 | if (Yii::$app->getUser()->login($user)) { |
frontend/models/SignupForm.php
@@ -18,6 +18,9 @@ class SignupForm extends Model | @@ -18,6 +18,9 @@ class SignupForm extends Model | ||
18 | public $verifyCode; | 18 | public $verifyCode; |
19 | public $location; | 19 | public $location; |
20 | public $type; | 20 | public $type; |
21 | + public $is_customer; | ||
22 | + public $is_freelancer; | ||
23 | + public $city; | ||
21 | 24 | ||
22 | /** | 25 | /** |
23 | * @inheritdoc | 26 | * @inheritdoc |
@@ -30,7 +33,7 @@ class SignupForm extends Model | @@ -30,7 +33,7 @@ class SignupForm extends Model | ||
30 | ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], | 33 | ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'], |
31 | ['username', 'string', 'min' => 2, 'max' => 255], | 34 | ['username', 'string', 'min' => 2, 'max' => 255], |
32 | 35 | ||
33 | - ['location', 'string', 'min' => 2, 'max' => 255], | 36 | + ['city', 'string', 'min' => 2, 'max' => 255], |
34 | 37 | ||
35 | ['email', 'filter', 'filter' => 'trim'], | 38 | ['email', 'filter', 'filter' => 'trim'], |
36 | ['email', 'required'], | 39 | ['email', 'required'], |
@@ -41,6 +44,8 @@ class SignupForm extends Model | @@ -41,6 +44,8 @@ class SignupForm extends Model | ||
41 | ['verifyCode', 'captcha'], | 44 | ['verifyCode', 'captcha'], |
42 | 45 | ||
43 | ['type', 'integer'], | 46 | ['type', 'integer'], |
47 | + ['is_customer', 'integer'], | ||
48 | + ['is_freelancer', 'integer'], | ||
44 | 49 | ||
45 | ['password', 'required'], | 50 | ['password', 'required'], |
46 | ['password', 'string', 'min' => 6], | 51 | ['password', 'string', 'min' => 6], |
@@ -67,5 +72,23 @@ class SignupForm extends Model | @@ -67,5 +72,23 @@ class SignupForm extends Model | ||
67 | 72 | ||
68 | return null; | 73 | return null; |
69 | } | 74 | } |
75 | + /** | ||
76 | + * @inheritdoc | ||
77 | + */ | ||
78 | + public function attributeLabels() | ||
79 | + { | ||
80 | + return [ | ||
81 | + 'username' => 'Логин', | ||
82 | + 'password' => 'Пароль', | ||
83 | + 'email' => 'E-mail', | ||
84 | + 'type' => Yii::t('app', 'Is Default'), | ||
85 | + 'firstname' => 'Имя', | ||
86 | + 'lastname' => 'Фамилия', | ||
87 | + 'city' => 'Город', | ||
88 | + 'alt_location' => 'Город не в списке', | ||
89 | + 'is_customer' => '', | ||
90 | + 'is_freelancer' => '', | ||
91 | + ]; | ||
92 | + } | ||
70 | 93 | ||
71 | } | 94 | } |
frontend/views/site/registration.php
@@ -71,15 +71,17 @@ | @@ -71,15 +71,17 @@ | ||
71 | 71 | ||
72 | 72 | ||
73 | <div class="check-radio-wr"> | 73 | <div class="check-radio-wr"> |
74 | - <div class="custom-form-buttons"> | ||
75 | - <input class="custom-check" id="custom-check-1" type="checkbox" checked> | ||
76 | - <label for="custom-check-1"><span></span>Я - Фрилансер</label> | ||
77 | - </div> | ||
78 | - | ||
79 | - <div class="custom-form-buttons"> | ||
80 | - <input class="custom-check" id="custom-check-2" type="checkbox"> | ||
81 | - <label for="custom-check-2"><span></span>Я - Заказчик</label> | ||
82 | - </div> | 74 | + <?= $form->field($model, 'is_freelancer', [ 'template' => "{input}\n{label}\n{error}" , 'options'=>['class'=>'custom-form-buttons'] ]) |
75 | + ->label('<span></span>Я - Фрилансер') | ||
76 | + ->checkbox([ | ||
77 | + 'class' => 'custom-check', | ||
78 | + ], false); ?> | ||
79 | + | ||
80 | + <?= $form->field($model, 'is_customer', [ 'template' => "{input}\n{label}\n{error}", 'options'=>['class'=>'custom-form-buttons'] ]) | ||
81 | + ->label('<span></span>Я - заказчик') | ||
82 | + ->checkbox([ | ||
83 | + 'class' => 'custom-check', | ||
84 | + ], false); ?> | ||
83 | </div> | 85 | </div> |
84 | 86 | ||
85 | 87 | ||
@@ -96,7 +98,7 @@ | @@ -96,7 +98,7 @@ | ||
96 | <div class="input-blocks-wrapper"> | 98 | <div class="input-blocks-wrapper"> |
97 | <div class="input-blocks"> | 99 | <div class="input-blocks"> |
98 | <?= | 100 | <?= |
99 | - $form->field($model, 'location')->widget(Select2::classname(), [ | 101 | + $form->field($model, 'city')->widget(Select2::classname(), [ |
100 | 'options' => ['placeholder' => 'Выбор города ...'], | 102 | 'options' => ['placeholder' => 'Выбор города ...'], |
101 | 'pluginOptions' => [ | 103 | 'pluginOptions' => [ |
102 | 'allowClear' => true, | 104 | 'allowClear' => true, |
@@ -115,7 +117,7 @@ | @@ -115,7 +117,7 @@ | ||
115 | </div> | 117 | </div> |
116 | </div> | 118 | </div> |
117 | 119 | ||
118 | - | 120 | + |
119 | 121 | ||
120 | 122 | ||
121 | 123 |