Commit d02fd466ade19613365baef18ffb58add51b8aa8

Authored by Yarik
1 parent 6f9635de

test

common/models/Currency.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "currency".
  9 + *
  10 + * @property integer $currency_id
  11 + * @property string $name
  12 + * @property string $symbol
  13 + * @property string $code
  14 + * @property double $rate
  15 + * @property string $date_update
  16 + * @property integer $is_default
  17 + */
  18 +class Currency extends \yii\db\ActiveRecord
  19 +{
  20 + /**
  21 + * @inheritdoc
  22 + */
  23 + public static function tableName()
  24 + {
  25 + return 'currency';
  26 + }
  27 +
  28 + /**
  29 + * @inheritdoc
  30 + */
  31 + public function rules()
  32 + {
  33 + return [
  34 + [['rate'], 'number'],
  35 + [['date_update'], 'safe'],
  36 + [['is_default'], 'integer'],
  37 + [['name', 'symbol'], 'string', 'max' => 255],
  38 + [['code'], 'string', 'max' => 3],
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * @inheritdoc
  44 + */
  45 + public function attributeLabels()
  46 + {
  47 + return [
  48 + 'currency_id' => Yii::t('app', 'Currency ID'),
  49 + 'name' => Yii::t('app', 'Name'),
  50 + 'symbol' => Yii::t('app', 'Symbol'),
  51 + 'code' => Yii::t('app', 'Code'),
  52 + 'rate' => Yii::t('app', 'Rate'),
  53 + 'date_update' => Yii::t('app', 'Date Update'),
  54 + 'is_default' => Yii::t('app', 'Is Default'),
  55 + ];
  56 + }
  57 +}
... ...
common/models/Project.php
... ... @@ -73,7 +73,6 @@
73 73 ],
74 74 [
75 75 [
76   - 'deadline',
77 76 'project_pid',
78 77 'payment_variant',
79 78 'contractual',
... ... @@ -116,6 +115,16 @@
116 115 'default',
117 116 'value' => [ ],
118 117 ],
  118 + [
  119 + ['deadline'],
  120 + 'integer',
  121 + 'min' => 1,
  122 + ],
  123 + [
  124 + ['deadline'],
  125 + 'default',
  126 + 'value' => 1,
  127 + ],
119 128 ];
120 129 }
121 130  
... ...
common/models/Team.php
... ... @@ -80,7 +80,7 @@
80 80 'experience_from',
81 81 ],
82 82 'integer',
83   - 'max' => 2016,
  83 + 'max' => date('Y'),
84 84 'min' => 1950,
85 85 ],
86 86 [
... ...
common/models/UserInfo.php
... ... @@ -3,6 +3,8 @@
3 3 namespace common\models;
4 4  
5 5 use Yii;
  6 + use yii\behaviors\AttributeBehavior;
  7 + use yii\db\ActiveRecord;
6 8  
7 9 /**
8 10 * This is the model class for table "user_info".
... ... @@ -25,6 +27,7 @@
25 27 * @property double $prepayment
26 28 * @property string $about
27 29 * @property integer $type
  30 + * @property string $geography
28 31 */
29 32 class UserInfo extends \yii\db\ActiveRecord
30 33 {
... ... @@ -69,7 +72,10 @@
69 72 'integer',
70 73 ],
71 74 [
72   - [ 'date_visit' ],
  75 + [
  76 + 'date_visit',
  77 + 'geographies',
  78 + ],
73 79 'safe',
74 80 ],
75 81 [
... ... @@ -91,6 +97,7 @@
91 97 [ 'prepayment' ],
92 98 'number',
93 99 'min' => 1,
  100 + 'max' => 100,
94 101 ],
95 102 [
96 103 [ 'experience' ],
... ... @@ -130,12 +137,22 @@
130 137 'boolean',
131 138 ],
132 139 [
133   - [ 'view_count', 'busy', 'member', 'salary', 'guarantee', 'prepayment' ],
  140 + [
  141 + 'view_count',
  142 + 'busy',
  143 + 'member',
  144 + 'salary',
  145 + 'guarantee',
  146 + 'prepayment',
  147 + ],
134 148 'default',
135 149 'value' => 0,
136 150 ],
137 151 [
138   - ['salary', 'guarantee'],
  152 + [
  153 + 'salary',
  154 + 'guarantee',
  155 + ],
139 156 'integer',
140 157 'min' => 0,
141 158 ],
... ... @@ -177,19 +194,37 @@
177 194 'prepayment' => Yii::t('app', 'Минимальная предоплата за работы'),
178 195 'about' => Yii::t('app', 'О себе'),
179 196 'type' => Yii::t('app', 'Is Default'),
180   - 'member' => Yii::t('app', 'Членство в МФП'),
  197 + 'member' => Yii::t('app', 'Членство в МФП'),
181 198 'alt_location' => 'Город не в списке',
182   - 'country' => Yii::t('app', 'Страна'),
183   - 'city' => Yii::t('app', 'Город'),
184   - 'image' => Yii::t('app', 'Аватар'),
185   - 'poster' => Yii::t('app', 'Подложка'),
186   - 'social_vk' => Yii::t('app', 'Vk.com'),
187   - 'social_fb' => Yii::t('app', 'FaceBook.com'),
188   - 'social_in' => Yii::t('app', 'LinkedIn.com'),
189   - 'social_t' => Yii::t('app', 'Twitter.com'),
  199 + 'country' => Yii::t('app', 'Страна'),
  200 + 'city' => Yii::t('app', 'Город'),
  201 + 'image' => Yii::t('app', 'Аватар'),
  202 + 'poster' => Yii::t('app', 'Подложка'),
  203 + 'social_vk' => Yii::t('app', 'Vk.com'),
  204 + 'social_fb' => Yii::t('app', 'FaceBook.com'),
  205 + 'social_in' => Yii::t('app', 'LinkedIn.com'),
  206 + 'social_t' => Yii::t('app', 'Twitter.com'),
  207 + 'geography' => Yii::t('app', 'География работ'),
  208 + 'geographies' => Yii::t('app', 'География работ'),
190 209 'is_customer' => '',
191 210 'is_freelancer' => '',
192 211  
193 212 ];
194 213 }
  214 +
  215 + public function beforeSave($insert)
  216 + {
  217 + $this->geography = json_encode($this->geographies, JSON_UNESCAPED_UNICODE);
  218 + return parent::beforeSave($insert);
  219 + }
  220 +
  221 + public function getGeographies()
  222 + {
  223 + return json_decode($this->geography);
  224 + }
  225 +
  226 + public function setGeographies($value)
  227 + {
  228 + $this->geographies = $value;
  229 + }
195 230 }
... ...
console/migrations/m160217_131655_currency_connection.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160217_131655_currency_connection extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->addColumn('{{%user_info}}', 'salary_currency', $this->integer()->defaultValue(3));
  10 + $this->addColumn('{{%vacancy}}', 'salary_currency', $this->integer()->defaultValue(3));
  11 + $this->addColumn('{{%project}}', 'budget_currency', $this->integer()->defaultValue(3));
  12 + $this->addForeignKey('user_info_salary_currency', '{{%user_info}}', 'salary_currency', '{{%currency}}', 'currency_id', 'SET DEFAULT', 'CASCADE');
  13 + $this->addForeignKey('vacancy_salary_currency', '{{%vacancy}}', 'salary_currency', '{{%currency}}', 'currency_id', 'SET DEFAULT', 'CASCADE');
  14 + $this->addForeignKey('project_budget_currency', '{{%project}}', 'budget_currency', '{{%currency}}', 'currency_id', 'SET DEFAULT', 'CASCADE');
  15 + }
  16 +
  17 + public function down()
  18 + {
  19 + $this->dropForeignKey('user_info_salary_currency', '{{%user_info}}');
  20 + $this->dropForeignKey('vacancy_salary_currency', '{{%vacancy}}');
  21 + $this->dropForeignKey('project_budget_currency', '{{%project}}');
  22 + $this->dropColumn('{{%user_info}}', 'salary_currency');
  23 + $this->dropColumn('{{%vacancy}}', 'salary_currency');
  24 + $this->dropColumn('{{%project}}', 'budget_currency');
  25 + }
  26 +}
... ...
frontend/controllers/AccountsController.php
... ... @@ -668,14 +668,7 @@
668 668 if(!$project instanceof ActiveRecord) {
669 669 throw new NotFoundHttpException('Запись не найдена');
670 670 }
671   - $specialization = Specialization::find()
672   - ->select([
673   - 'specialization_name',
674   - 'specialization_id',
675   - ])
676   - ->indexBy('specialization_id')
677   - ->asArray()
678   - ->column();
  671 + $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
679 672 $payment = Payment::find()
680 673 ->select([
681 674 'name',
... ... @@ -726,7 +719,7 @@
726 719 }
727 720 return $this->render('_projects_form', [
728 721 'project' => $project,
729   - 'specialization' => $specialization,
  722 + 'specializations' => $specializations,
730 723 'payment' => $payment,
731 724 'projects' => $projects,
732 725 ]);
... ...
frontend/views/accounts/_team_form.php
... ... @@ -72,7 +72,7 @@
72 72 <div class="input-blocks-wrapper">
73 73 <div class="input-blocks">
74 74 <?= $form->field($team, 'experience_from', [ 'template' => "{label},<span style='font-weight: 700;font-size: 13px'>лет</span><br /><span class='admn-input-txt' style='margin-right: 10px'>с</span>{input}<span class='admn-input-txt' style='margin-left: 10px'>года</span> \n{hint}\n{error}" ])
75   - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number'])?>
  75 + ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number', 'min' => 1950, 'max' => date('Y')])?>
76 76 </div>
77 77 </div>
78 78  
... ...
frontend/views/accounts/service.php
... ... @@ -8,8 +8,10 @@
8 8 use common\models\Specialization;
9 9 use common\models\User;
10 10 use common\models\UserInfo;
  11 + use kartik\select2\Select2;
11 12 use yii\helpers\ArrayHelper;
12 13 use yii\helpers\Html;
  14 + use yii\web\JsExpression;
13 15 use yii\widgets\ActiveForm;
14 16  
15 17 $this->title = 'Услуги';
... ... @@ -71,8 +73,24 @@
71 73 </ul>
72 74 </div>
73 75 <div class="input-blocks-wrapper">
74   - <div class="input-blocks" style="color: red">
75   - Гоеграфия работ?????????????
  76 + <div class="input-blocks">
  77 + <?=
  78 + $form->field($user_info, 'geographies')->widget(Select2::classname(), [
  79 + 'options' => ['placeholder' => 'Выбор города ...', 'multiple' => true],
  80 + 'pluginOptions' => [
  81 + 'allowClear' => true,
  82 + 'minimumInputLength' => 3,
  83 + 'ajax' => [
  84 + 'url' => \yii\helpers\Url::to(['site/city']),
  85 + 'dataType' => 'json',
  86 + 'data' => new JsExpression('function(params) { return {q:params.term}; }')
  87 + ],
  88 + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
  89 + 'templateResult' => new JsExpression('function(city) { return city.text; }'),
  90 + 'templateSelection' => new JsExpression('function (city) { return city.text; }'),
  91 + ],
  92 + ]);
  93 + ?>
76 94 </div>
77 95 </div>
78 96 <div class="input-blocks-wrapper">
... ...
frontend/views/layouts/admin.php
... ... @@ -81,7 +81,7 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
81 81 ],
82 82 [
83 83 'label' => 'Уведомления о проектах',
84   - 'url' => ['accounts/projects'],
  84 + 'url' => ['/projects'],
85 85 ],
86 86 [
87 87 'label' => 'Закладки',
... ...
frontend/views/layouts/company.php
... ... @@ -162,4 +162,11 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
162 162 /*====End of blocks created in view====*/
163 163 ?>
164 164 </div>
  165 + <script>
  166 + $('div.rating').rating({
  167 + fx: 'full',
  168 + readOnly: 'true',
  169 + url: 'rating.php'
  170 + });
  171 + </script>
165 172 <?php $this->endContent() ?>
166 173 \ No newline at end of file
... ...
frontend/views/layouts/gallery-company.php
... ... @@ -118,4 +118,11 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
118 118 </div>
119 119 </div>
120 120 </div>
  121 + <script>
  122 + $('div.rating').rating({
  123 + fx: 'full',
  124 + readOnly: 'true',
  125 + url: 'rating.php'
  126 + });
  127 + </script>
121 128 <?php $this->endContent() ?>
122 129 \ No newline at end of file
... ...
frontend/views/layouts/gallery.php
... ... @@ -107,5 +107,12 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
107 107 </div>
108 108 </div>
109 109 </div>
  110 + <script>
  111 + $('div.rating').rating({
  112 + fx: 'full',
  113 + readOnly: 'true',
  114 + url: 'rating.php'
  115 + });
  116 + </script>
110 117  
111 118 <?php $this->endContent() ?>
112 119 \ No newline at end of file
... ...
frontend/views/layouts/main.php
... ... @@ -153,7 +153,7 @@ AppAsset::register($this);
153 153 ],
154 154 'items' => [
155 155 [
156   - 'url' => ['accounts/projects'],
  156 + 'url' => ['/projects'],
157 157 'template' => '<a href="{url}" class="main-menu-icons-home"></a>',
158 158 ],
159 159 [
... ... @@ -368,13 +368,6 @@ AppAsset::register($this);
368 368 </div>
369 369 </div>
370 370 </div>
371   -<script>
372   - $('div.rating').rating({
373   - fx: 'full',
374   - readOnly: 'true',
375   - url: 'rating.php'
376   - });
377   -</script>
378 371 <?php $this->endBody() ?>
379 372  
380 373 </body>
... ...
frontend/views/layouts/performer.php
... ... @@ -140,5 +140,12 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
140 140 </div>
141 141  
142 142 </div>
  143 + <script>
  144 + $('div.rating').rating({
  145 + fx: 'full',
  146 + readOnly: 'true',
  147 + url: 'rating.php'
  148 + });
  149 + </script>
143 150  
144 151 <?php $this->endContent() ?>
145 152 \ No newline at end of file
... ...
frontend/views/performer/_gallery_list_view.php
... ... @@ -2,7 +2,7 @@
2 2 use yii\helpers\Html;
3 3 ?>
4 4 <div class="gallery-box">
5   - <a href="#" class="gallery-box-min"><?= Html::img($model->cover)?></a>
  5 + <a href="#" class="gallery-box-min" title="<?=$model->name?>"><?= Html::img($model->cover)?></a>
6 6 <div class="gallery-box-hidden">
7 7 <div class="gallery-box-preview">
8 8 <?php foreach($model->ShowGallery($model->photo ) as $image):?>
... ...
frontend/views/tender/view.php
... ... @@ -381,4 +381,11 @@ $this-&gt;title = &#39;My Yii Application&#39;;
381 381 </div>
382 382 </div>
383 383 </div>
384   -</div>
385 384 \ No newline at end of file
  385 +</div>
  386 +<script>
  387 + $('div.rating, div.rating-new').rating({
  388 + fx: 'full',
  389 + readOnly: 'true',
  390 + url: 'rating.php'
  391 + });
  392 +</script>
386 393 \ No newline at end of file
... ...