Commit 272ce2898cac07f38663a4902940f47f254a3d70

Authored by Yarik
1 parent 4a3f5562

test

frontend/controllers/CompanyController.php
... ... @@ -39,6 +39,19 @@
39 39 $company_id = $action->controller->actionParams[ 'company_id' ];
40 40 $user = User::findOne($company_id);
41 41 if(!empty( $user->userInfo )) {
  42 + if($user->userInfo->is_freelancer xor $user->userInfo->is_customer) {
  43 + $type = $action->controller->actionParams['type'];
  44 + $get = \Yii::$app->request->get();
  45 + if(!empty($type)) {
  46 + if($user->userInfo->is_freelancer && $type == 'customer') {
  47 + $get['type'] = 'implementer';
  48 + $this->redirect(array_merge([$action->id], $get));
  49 + } elseif($user->userInfo->is_customer && $type == 'implementer') {
  50 + $get['type'] = 'customer';
  51 + $this->redirect(array_merge([$action->id], $get));
  52 + }
  53 + }
  54 + }
42 55 $user->userInfo->updateCounters([ 'view_count' => 1 ]);
43 56 }
44 57 }
... ...
frontend/controllers/PerformerController.php
... ... @@ -37,6 +37,19 @@
37 37 $performer_id = $action->controller->actionParams[ 'performer_id' ];
38 38 $user = User::findOne($performer_id);
39 39 if(!empty( $user->userInfo )) {
  40 + if($user->userInfo->is_freelancer xor $user->userInfo->is_customer) {
  41 + $type = $action->controller->actionParams['type'];
  42 + $get = \Yii::$app->request->get();
  43 + if(!empty($type)) {
  44 + if($user->userInfo->is_freelancer && $type == 'customer') {
  45 + $get['type'] = 'implementer';
  46 + $this->redirect(array_merge([$action->id], $get));
  47 + } elseif($user->userInfo->is_customer && $type == 'implementer') {
  48 + $get['type'] = 'customer';
  49 + $this->redirect(array_merge([$action->id], $get));
  50 + }
  51 + }
  52 + }
40 53 $user->userInfo->updateCounters([ 'view_count' => 1 ]);
41 54 }
42 55 }
... ...
frontend/views/layouts/performer.php
... ... @@ -139,39 +139,49 @@
139 139 <ul>
140 140 <li class="activejob">
141 141 <?php
142   - if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
143   - echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
144   - } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
145   - echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  142 + if($this->params[ 'user' ]->userInfo->is_freelancer xor $this->params[ 'user' ]->userInfo->is_customer) {
  143 + if($this->params[ 'type' ] == 'customer') {
  144 + echo Html::tag('span', 'Заказчик', [ 'class' => 'activejob_span' ]);
  145 + } else {
  146 + echo Html::tag('span', 'Исполнитель', [ 'class' => 'activejob_span' ]);
  147 + }
146 148 } else {
147   - echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  149 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  150 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  151 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  152 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  153 + } else {
  154 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  155 + }
  156 + ?>
  157 + <div class="sidebar-droped-wr style">
  158 + <ul>
  159 + <li>
  160 + <?php
  161 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  162 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  163 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  164 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  165 + } else {
  166 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  167 + }
  168 + ?>
  169 + </li>
  170 + <li style="display: none">
  171 + <?php
  172 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  173 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  174 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  175 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  176 + } else {
  177 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  178 + }
  179 + ?>
  180 + </ul>
  181 + </div>
  182 + <?php
148 183 }
149 184 ?>
150   - <div class="sidebar-droped-wr style">
151   - <ul>
152   - <li>
153   - <?php
154   - if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
155   - echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
156   - } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
157   - echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
158   - } else {
159   - echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
160   - }
161   - ?>
162   - </li>
163   - <li style="display: none">
164   - <?php
165   - if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
166   - echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
167   - } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
168   - echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
169   - } else {
170   - echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
171   - }
172   - ?>
173   - </ul>
174   - </div>
175 185 </li>
176 186 </ul>
177 187 </div>
... ...
frontend/web/css/style.css
... ... @@ -2421,6 +2421,14 @@ input[type=file]::-webkit-file-upload-button {
2421 2421 margin-top: -1px;
2422 2422 }
2423 2423  
  2424 +.performance-vacancy-sidebar-company-job ul li span.activejob_span {
  2425 + text-decoration: underline;
  2426 + color: #69d34b;
  2427 + position: relative;
  2428 + height: 22px;
  2429 + line-height: 22px;
  2430 +}
  2431 +
2424 2432 .sidebar-droped-wr a {
2425 2433 color: inherit !important;
2426 2434 text-decoration: none !important;
... ...