Commit 3c47052980f6da460644c71e5dd35efce6a6d78e

Authored by Виталий
2 parents fa403e14 b3ef6f91

Merge remote-tracking branch 'origin/master'

common/models/CompanyInfo.php
... ... @@ -11,7 +11,6 @@
11 11 * @property integer $staff
12 12 * @property string $street
13 13 * @property string $house
14   - * @property integer $hide_mail
15 14 */
16 15 class CompanyInfo extends \yii\db\ActiveRecord
17 16 {
... ... @@ -45,10 +44,6 @@
45 44 'string',
46 45 ],
47 46 [
48   - [ 'hide_mail' ],
49   - 'integer',
50   - ],
51   - [
52 47 [ 'staff' ],
53 48 'default',
54 49 'value' => 1,
... ... @@ -72,7 +67,6 @@
72 67 'staff' => Yii::t('app', 'Количество сотрудников'),
73 68 'street' => Yii::t('app', 'Улица'),
74 69 'house' => Yii::t('app', 'Дом'),
75   - 'hide_mail' => Yii::t('app', 'не публиковать Email'),
76 70 ];
77 71 }
78 72 }
... ...
common/models/UserInfo.php
... ... @@ -30,6 +30,7 @@
30 30 * @property string $geography
31 31 * @property integer $salary_currency
32 32 * @property string $email
  33 + * @property integer $hide_mail
33 34 */
34 35 class UserInfo extends \yii\db\ActiveRecord
35 36 {
... ... @@ -215,6 +216,17 @@
215 216 ],
216 217 'email',
217 218 ],
  219 + [
  220 + [ 'hide_mail' ],
  221 + 'integer',
  222 + 'min' => 0,
  223 + 'max' => 1,
  224 + ],
  225 + [
  226 + ['hide_mail'],
  227 + 'default',
  228 + 'value' => 0,
  229 + ]
218 230 ];
219 231 }
220 232  
... ... @@ -268,6 +280,7 @@
268 280 'salary_currency' => Yii::t('app', 'Валюта'),
269 281 'is_customer' => '',
270 282 'is_freelancer' => '',
  283 + 'hide_mail' => Yii::t('app', 'не публиковать Email'),
271 284  
272 285 ];
273 286 }
... ...
console/migrations/m160309_124241_add_vacancy_status.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160309_124241_add_vacancy_status extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->addColumn('{{%vacancy}}', 'status', $this->integer()->defaultValue(1));
  10 + }
  11 +
  12 + public function down()
  13 + {
  14 + $this->dropColumn('{{%vacancy}}', 'status');
  15 + }
  16 +}
... ...
console/migrations/m160310_080610_hide_email_to_user_info.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160310_080610_hide_email_to_user_info extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->dropColumn('{{%company_info}}', 'hide_mail');
  10 + $this->addColumn('{{%user_info}}', 'hide_mail', $this->smallInteger()->defaultValue(0));
  11 + }
  12 +
  13 + public function down()
  14 + {
  15 + $this->dropColumn('{{%user_info}}', 'hide_mail');
  16 + $this->addColumn('{{%company_info}}', 'hide_mail', $this->smallInteger()->defaultValue(0));
  17 + }
  18 +}
... ...
frontend/views/accounts/_vacancy_form.php
1 1 <?php
2 2 /**
3   - * @var Vacancy $vacancy
4   - * @var Employment[] $employment
5   - * @var string[] $currencies
  3 + * @var Vacancy $vacancy
  4 + * @var Employment[] $employment
  5 + * @var string[] $currencies
6 6 * @var Specialization[] $specializations
7   - * @var User $user
  7 + * @var User $user
8 8 */
9 9 use common\components\Request;
10 10 use common\models\Employment;
... ... @@ -30,47 +30,70 @@
30 30 <div class="input-blocks-wrapper">
31 31 <div class="input-blocks">
32 32 <?= $form->field($vacancy, 'name')
33   - ->textInput (['class'=> 'custom-input-2']); ?>
  33 + ->textInput([ 'class' => 'custom-input-2' ]); ?>
34 34 </div>
35 35 </div>
36 36  
37 37  
38   -
39 38 <div class="input-blocks-wrapper">
40 39 <div class="input-blocks">
41 40 <?= $form->field($vacancy, 'user_name')
42   - ->textInput (['class'=> 'custom-input-2']); ?>
43   - <span class="admin-hint-vacancy-contact form_auto_data" data-value="<?=$user->firstname.' '.$user->lastname?>">Вы</span>
  41 + ->textInput([ 'class' => 'custom-input-2' ]); ?>
  42 + <?php
  43 + if(!empty( $user->firstname ) && !empty( $user->lastname )) {
  44 + echo Html::tag('span', 'Вы', [
  45 + 'class' => 'admin-hint-vacancy-contact form_auto_data',
  46 + 'data-value' => $user->firstname . ' ' . $user->lastname,
  47 + 'title' => 'Вставить данные с Вашего личного кабинета',
  48 + ]);
  49 + }
  50 + ?>
44 51 </div>
45 52 </div>
46   -
47 53 <div class="input-blocks-wrapper">
48 54 <div class="input-blocks">
49 55 <?= $form->field($vacancy, 'phone')
50   - ->textInput (['class'=> 'custom-input-2']); ?>
  56 + ->textInput([ 'class' => 'custom-input-2' ]); ?>
  57 + <?php
  58 + if(!empty($user->getPhones()[1]['phone'])) {
  59 + echo Html::tag('span', 'Вы', [
  60 + 'class' => 'admin-hint-vacancy-contact form_auto_data',
  61 + 'data-value' => $user->getPhones()[1]['phone'],
  62 + 'title' => 'Вставить данные с Вашего личного кабинета',
  63 + ]);
  64 + }
  65 + ?>
51 66 </div>
52 67 </div>
53 68  
54 69 <div class="input-blocks-wrapper">
55 70 <div class="input-blocks">
56   - <?=
57   - $form->field($vacancy, 'city')->widget(Select2::classname(), [
58   - 'options' => ['placeholder' => 'Выбор города ...'],
59   - 'pluginOptions' => [
60   - 'allowClear' => true,
61   - 'minimumInputLength' => 3,
62   - 'ajax' => [
63   - 'url' => \yii\helpers\Url::to(['site/city']),
64   - 'dataType' => 'json',
65   - 'data' => new JsExpression('function(params) { return {q:params.term}; }')
66   - ],
67   - 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
68   - 'templateResult' => new JsExpression('function(city) { return city.text; }'),
69   - 'templateSelection' => new JsExpression('function (city) { return city.text; }'),
70   - ],
71   - ]);
  71 + <?= $form->field($vacancy, 'city')
  72 + ->hint('Город, в котором предлагается работа', ['tag' => 'span'])
  73 + ->widget(Select2::classname(), [
  74 + 'options' => [ 'placeholder' => 'Выбор города ...' ],
  75 + 'pluginOptions' => [
  76 + 'allowClear' => true,
  77 + 'minimumInputLength' => 3,
  78 + 'ajax' => [
  79 + 'url' => \yii\helpers\Url::to([ 'site/city' ]),
  80 + 'dataType' => 'json',
  81 + 'data' => new JsExpression('function(params) { return {q:params.term}; }'),
  82 + ],
  83 + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
  84 + 'templateResult' => new JsExpression('function(city) { return city.text; }'),
  85 + 'templateSelection' => new JsExpression('function (city) { return city.text; }'),
  86 + ],
  87 + ]); ?>
  88 + <?php
  89 + if(!empty( $user->userInfo->city )) {
  90 + echo Html::tag('span', 'Ваш', [
  91 + 'class' => 'admin-hint-vacancy-contact form_auto_data',
  92 + 'data-value' => $user->userInfo->city,
  93 + 'title' => 'Вставить данные с Вашего личного кабинета',
  94 + ]);
  95 + }
72 96 ?>
73   - <span class="admin-hint-vacancy-contact form_auto_data" data-value="<?=$user->userInfo->city?>">Ваш</span>
74 97 </div>
75 98 </div>
76 99  
... ... @@ -80,18 +103,19 @@
80 103 'template' => "{label}<br /><span class='admn-input-txt'>от</span>{input}\n{hint}\n{error}",
81 104 'options' => [ 'class' => 'form-inline' ],
82 105 ])
83   - ->label('Заработная плата')
84   - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number', 'min' => 0]);
85   - ?>
  106 + ->label('Заработная плата')
  107 + ->textInput([
  108 + 'class' => 'custom-input-2 custom-input-2-date',
  109 + 'type' => 'number',
  110 + 'min' => 0,
  111 + ]); ?>
86 112 </div>
87 113 <div class="input-blocks admin-currency-second">
88   - <?=
89   - $form->field($vacancy, 'salary_currency', [
  114 + <?= $form->field($vacancy, 'salary_currency', [
90 115 'template' => "{input}\n{hint}\n{error}",
91 116 ])
92   - ->label(false)
93   - ->dropDownList($currencies)
94   - ?>
  117 + ->label(false)
  118 + ->dropDownList($currencies) ?>
95 119 </div>
96 120 </div>
97 121  
... ... @@ -119,15 +143,15 @@
119 143 <li>
120 144 <a href="#" title="<?= $child_second->specialization_name ?>">
121 145 <?= $form->field($vacancy, "specializationInput[{$child_second->specialization_id}]", [
122   - 'template' => '{input}{label}{hint}{error}',
  146 + 'template' => '{input}{label}{hint}{error}',
123 147 ])
124   - ->label('<span></span>' . $child_second->specialization_name)
125   - ->checkbox([
126   - 'value' => $child_second->specialization_id,
127   - 'label' => NULL,
128   - 'uncheck' => NULL,
129   - 'class' => 'custom-check',
130   - ], false) ?>
  148 + ->label('<span></span>' . $child_second->specialization_name)
  149 + ->checkbox([
  150 + 'value' => $child_second->specialization_id,
  151 + 'label' => NULL,
  152 + 'uncheck' => NULL,
  153 + 'class' => 'custom-check',
  154 + ], false) ?>
131 155 </a>
132 156 </li>
133 157 <?php endif; ?>
... ... @@ -148,65 +172,67 @@
148 172 </div>
149 173 </div>
150 174  
151   -<div class="admin-specialization-selected style"><ul></ul></div>
  175 +<div class="admin-specialization-selected style">
  176 + <ul></ul>
  177 +</div>
152 178  
153 179 <div class="input-blocks-wrapper admin-vacancy-check admin-vacancy-check-fx-marg" style="margin-top: 19px">
154 180 <div class="input-blocks">
155 181 <?= $form->field($vacancy, 'employmentInput')
156   - ->checkboxList($employment,
157   - [
158   - 'item' => function($index, $label, $name, $checked, $value) {
159   - $return = '<div class="admin-who-check-payment">';
160   - $return .= '<input class="custom-check" id="select_admin_payment'.$value.'" type="checkbox" name="' . $name . '" value="' . $value . '" '.($checked ? "checked" :"").' >';
161   - $return .= '<label for="select_admin_payment'.$value.'" >';
162   - $return .= '<span></span>' . ucwords($label);
163   - $return .= '</label>';
164   - $return .= '</div>';
165   - return $return;
166   - }
167   - ]
168   - ) ?>
  182 + ->checkboxList($employment, [
  183 + 'item' => function($index, $label, $name, $checked, $value) {
  184 + $return = '<div class="admin-who-check-payment">';
  185 + $return .= '<input class="custom-check" id="select_admin_payment' . $value . '" type="checkbox" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
  186 + $return .= '<label for="select_admin_payment' . $value . '" >';
  187 + $return .= '<span></span>' . ucwords($label);
  188 + $return .= '</label>';
  189 + $return .= '</div>';
  190 + return $return;
  191 + },
  192 + ]) ?>
169 193 </div>
170 194 </div>
171 195  
172 196 <div class="skills-admin-wrapper style">
173 197 <div class="input-blocks-wrapper skills-programs">
174 198 <div class="input-blocks">
175   - <?= FieldEditor::widget (
176   - [
177   - 'template' => 'requirements', 'item_id' => $vacancy->vacancy_id, 'model' => 'common\models\Vacancy', 'language' => 'ru',
178   - ]
179   - ); ?>
  199 + <?= FieldEditor::widget([
  200 + 'template' => 'requirements',
  201 + 'item_id' => $vacancy->vacancy_id,
  202 + 'model' => 'common\models\Vacancy',
  203 + 'language' => 'ru',
  204 + ]); ?>
180 205 </div>
181 206 </div>
182 207 </div>
183 208  
184 209 <div class="input-blocks-wrapper full-blocks admin-editor-bl">
185 210 <div class="input-blocks">
186   - <?= $form->field($vacancy, 'description')->widget(CKEditor::className()) ?>
  211 + <?= $form->field($vacancy, 'description')
  212 + ->widget(CKEditor::className()) ?>
187 213 </div>
188 214 </div>
189 215  
190 216 <div class="admin-save-btn skills-save-btn admin-add-remove-wr style">
191   - <?= Html::submitButton($vacancy->isNewRecord?'Добавить':'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
  217 + <?= Html::submitButton($vacancy->isNewRecord ? 'Добавить' : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
192 218 <div class="admin-remove-note">
193 219 <?php
194   - if(!$vacancy->isNewRecord) {
195   - echo Html::a('Удалить', [
196   - 'accounts/vacancy-delete',
197   - 'id' => $vacancy->vacancy_id,
198   - ], [
199   - 'title' => 'Удалить',
200   - 'aria-label' => 'Удалить',
201   - 'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
202   - 'data-method' => 'post',
203   - 'data-pjax' => 0,
204   - ]);
205   - }
  220 + if(!$vacancy->isNewRecord) {
  221 + echo Html::a('Удалить', [
  222 + 'accounts/vacancy-delete',
  223 + 'id' => $vacancy->vacancy_id,
  224 + ], [
  225 + 'title' => 'Удалить',
  226 + 'aria-label' => 'Удалить',
  227 + 'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
  228 + 'data-method' => 'post',
  229 + 'data-pjax' => 0,
  230 + ]);
  231 + }
206 232 ?>
207 233 </div>
208 234 <div class="admin-back-note">
209   - <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer)?\Yii::$app->request->referrer:['accounts/vacancy' ]) ?>
  235 + <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/vacancy' ]) ?>
210 236 </div>
211 237 </div>
212 238  
... ... @@ -215,14 +241,34 @@
215 241 $form->end();
216 242 ?>
217 243 <script>
218   - $(function() {
219   - $('.input-blocks.admin-currency-second select').change(function(){
220   - $(this).blur()
221   - });
222   - $(document).on('click', '.form_auto_data', function() {
223   - var value = $(this).data('value');
224   - var container = $(this).parents('.input-blocks').first();
225   - $('#vacancy-city').select2().val(value).trigger('change');
226   - });
227   - });
  244 + $(
  245 + function()
  246 + {
  247 + $('.input-blocks.admin-currency-second select').change(
  248 + function()
  249 + {
  250 + $(this).blur()
  251 + }
  252 + );
  253 + $(document).on(
  254 + 'click', '.form_auto_data', function()
  255 + {
  256 + var value = $(this).data('value');
  257 + var container = $(this).parents('.input-blocks').first();
  258 + var select = $(container).find('select[data-krajee-select2]').first();
  259 + if(select.length >= 1)
  260 + {
  261 + $(select)
  262 + .append('<option value="' + value + '" selected>' + value + '</option>');
  263 + var id = $(select).attr('id');
  264 + $(container).find('#select2-' + id + '-container').attr('title', value);
  265 + $(container).find('#select2-' + id + '-container').text(value);
  266 + } else
  267 + {
  268 + $(container).find('input, textarea').val(value);
  269 + }
  270 + }
  271 + );
  272 + }
  273 + );
228 274 </script>
229 275 \ No newline at end of file
... ...
frontend/views/accounts/general.php
... ... @@ -176,7 +176,7 @@
176 176 ?>
177 177 </div>
178 178 <div class="input-blocks hide-mail-check">
179   - <?= $form->field ($company_info, 'hide_mail', ['options' => ['class' => 'form-group', ], 'template' => "{input}{label}\n{hint}\n{error}"])
  179 + <?= $form->field ($user_info, 'hide_mail', ['options' => ['class' => 'form-group', ], 'template' => "{input}{label}\n{hint}\n{error}"])
180 180 ->label ('<span></span>не публиковать Email')
181 181 ->checkbox (['checked'=>'checked', 'class'=> 'custom-check'], false);
182 182 ?>
... ...
frontend/views/company/_vacancy_list_view.php
1 1 <?php
2   -use frontend\helpers\TextHelper;
3   -use yii\bootstrap\Html;
4   -use yii\helpers\Url;
5   -use yii\i18n\Formatter;
  2 + use frontend\helpers\TextHelper;
  3 + use yii\bootstrap\Html;
  4 + use yii\helpers\Url;
  5 + use yii\helpers\StringHelper;
6 6  
7 7 ?>
8 8  
9 9 <div class="performer-vacant-reclam-bl">
10   - <?= Html::a($model->name, Url::toRoute( ['company/vacancy-view', 'company_id' => $model->user_id,'link' => $model->link]), ['class' => 'performer-vacant-reclam-bl-title']) ?>
11   - <div class="performer-vacant-reclam-bl-title-two"> <?= $model->city ?> <?= \Yii::$app->formatter->asDatetime($model->date_add, 'Y-MM-dd') ?> <?=$model->salary ?> <?=$model->salaryCurrency->label ?> </div>
  10 + <?= Html::a($model->name, Url::toRoute([
  11 + 'company/vacancy-view',
  12 + 'company_id' => $model->user_id,
  13 + 'link' => $model->link,
  14 + ]), [ 'class' => 'performer-vacant-reclam-bl-title' ]) ?>
  15 + <div class="performer-vacant-reclam-bl-title-two">
  16 + <?= $model->city ?>
  17 + <?= \Yii::$app->formatter->asDatetime($model->date_add, 'Y-MM-dd') ?>
  18 + <?php
  19 + if(!empty( $model->salary )) {
  20 + ?>
  21 + <?= $model->salary ?>
  22 + <?= $model->salaryCurrency->label ?>
  23 + <?php
  24 + }
  25 + ?>
  26 + </div>
12 27 <div class="performer-vacant-reclam-bl-content">
13   - <span><?= TextHelper::truncateHtmlText($model->description, 200, '...') ?></span>
14   - <?= Html::a('<img src="/images/performar_vacancy/arrow-post.png" alt=""/>', ['vacancy-view', 'company_id' => $model->user_id,'vacancy_id' => $model->vacancy_id], ['class' => 'performer-vacant-reclam-bl-content-read']) ?>
  28 + <span>
  29 + <?= TextHelper::truncateHtmlText($model->description, 200, '...') ?>
  30 + </span>
  31 + <?= Html::a('<img src="/images/performar_vacancy/arrow-post.png" alt=""/>', [
  32 + 'company/vacancy-view',
  33 + 'company_id' => $model->user_id,
  34 + 'link' => $model->link,
  35 + ], [ 'class' => 'performer-vacant-reclam-bl-content-read' ]) ?>
15 36  
16 37 </div>
17 38 </div>
18 39 \ No newline at end of file
... ...
frontend/views/company/vacancy-view.php
1 1 <?php
2 2 /**
3   - * @var $this yii\web\View
4   - * @var User $company
  3 + * @var $this yii\web\View
  4 + * @var User $company
5 5 * @var Vacancy $vacancy
6 6 */
7 7  
... ... @@ -10,12 +10,15 @@
10 10 use yii\helpers\ArrayHelper;
11 11 use yii\helpers\Html;
12 12  
13   - $this->params[ 'company'] = $company;
14   -$this->title = 'My Yii Application';
  13 + $this->params[ 'company' ] = $company;
  14 + $this->title = 'My Yii Application';
15 15 ?>
16 16 <div class="performer-vacancy-list style">
17 17 <?php
18   - echo Html::a('к списку вакансий', ['vacancy-list', 'company_id' => $company->id]);
  18 + echo Html::a('к списку вакансий', [
  19 + 'vacancy-list',
  20 + 'company_id' => $company->id,
  21 + ]);
19 22 ?>
20 23 </div>
21 24 <div class="performer-vacancy-blocks-desk-wr style">
... ... @@ -24,24 +27,26 @@ $this-&gt;title = &#39;My Yii Application&#39;;
24 27 <div class="performance-vacancy-page-options style">
25 28 <ul>
26 29 <?php
27   - if(!empty($vacancy->user_name)) {
28   - echo "<li><span>Контактное лицо:</span><p>{$vacancy->user_name}</p></li>";
29   - }
  30 + if(!empty( $vacancy->user_name )) {
  31 + echo "<li><span>Контактное лицо:</span><p>{$vacancy->user_name}</p></li>";
  32 + }
  33 + if(!empty( $vacancy->phone )) {
  34 + echo "<li><span>Телефон:</span><p>{$vacancy->phone}</p></li>";
  35 + }
30 36 ?>
31   - <li><span>Телефон:</span><p>XXX XXX-XX-XX</p></li>
32 37 <?php
33   - if(!empty($vacancy->city)) {
  38 + if(!empty( $vacancy->city )) {
34 39 echo "<li><span>Город:</span><p>{$vacancy->city}</p></li>";
35 40 }
36 41 ?>
37 42 <?php
38   - if(!empty($vacancy->employments)) {
39   - echo "<li><span>Вид занятости:</span><p>".implode(', ', ArrayHelper::getColumn($vacancy->employments, 'name'))."</p></li>";
  43 + if(!empty( $vacancy->employments )) {
  44 + echo "<li><span>Вид занятости:</span><p>" . implode(', ', ArrayHelper::getColumn($vacancy->employments, 'name')) . "</p></li>";
40 45 }
41 46 ?>
42 47 <?php
43   - if(!empty($vacancy->requirements)) {
44   - echo "<li><span>Требования:</span><p>".implode(', ', ArrayHelper::getColumn($vacancy->requirements, 'requirements'))."</p></li>";
  48 + if(!empty( $vacancy->requirements )) {
  49 + echo "<li><span>Требования:</span><p>" . implode(', ', ArrayHelper::getColumn($vacancy->requirements, 'requirements')) . "</p></li>";
45 50 }
46 51 ?>
47 52 </ul>
... ... @@ -49,7 +54,7 @@ $this-&gt;title = &#39;My Yii Application&#39;;
49 54 <div class="performance-vacancy-description style">Описание вакансии</div>
50 55 <div class="performance-vacancy-desc-txt style">
51 56 <?php
52   - echo $vacancy->description;
  57 + echo $vacancy->description;
53 58 ?>
54 59 </div>
55 60 <div class="performance-vacancy-desc-form style">
... ... @@ -67,7 +72,7 @@ $this-&gt;title = &#39;My Yii Application&#39;;
67 72  
68 73 <div class="performance-vacancy-similar-blocks-wr style">
69 74 <a href="#" class="performer-vacant-reclam-bl-title">Разнорабочий (в Бровары)</a>
70   - <div class="performer-vacant-reclam-bl-title-two">Наш Дом. Киев. </div>
  75 + <div class="performer-vacant-reclam-bl-title-two">Наш Дом. Киев.</div>
71 76 </div>
72 77  
73 78 <div class="performance-vacancy-similar-blocks-wr style">
... ...