Commit 1b56164e1040f0cf486f6f7c3aa24a3173ea0ec3

Authored by Yarik
1 parent af52e881

test

common/models/Portfolio.php
... ... @@ -142,6 +142,7 @@
142 142 {
143 143 return $this->getSpecializations()
144 144 ->asArray()
  145 + ->indexBy('specialization_id')
145 146 ->column();
146 147 }
147 148  
... ...
common/models/Vacancy.php
... ... @@ -5,6 +5,7 @@
5 5 use Yii;
6 6 use yii\behaviors\BlameableBehavior;
7 7 use yii\behaviors\TimestampBehavior;
  8 + use yii\db\ActiveQuery;
8 9 use yii\db\Expression;
9 10  
10 11 /**
... ... @@ -19,6 +20,9 @@
19 20 * @property string $user_name
20 21 * @property string $city
21 22 * @property string $description
  23 + * @property string $phone
  24 + * @property string $salary
  25 + * @property integer $salary_currency
22 26 * @property Employment[] $employments
23 27 * @property VacancyEmployment[] $vacancyEmployments
24 28 */
... ... @@ -68,7 +72,7 @@
68 72 'string',
69 73 ],
70 74 [
71   - [ 'employmentInput' ],
  75 + [ 'employmentInput', 'specializationInput' ],
72 76 'safe',
73 77 ],
74 78 [
... ... @@ -106,6 +110,9 @@
106 110 'city' => Yii::t('app', 'Город'),
107 111 'description' => Yii::t('app', 'Описание'),
108 112 'employmentInput' => Yii::t('app', 'Вид занятости'),
  113 + 'phone' => Yii::t('app', 'Телефон'),
  114 + 'salary' => Yii::t('app', 'Заработная плата'),
  115 + 'salary_currency' => Yii::t('app', 'Валюта'),
109 116 ];
110 117 }
111 118  
... ... @@ -140,4 +147,35 @@
140 147 return Fields::getData($this->vacancy_id, Vacancy::className(), 'requirements');
141 148 }
142 149  
  150 + /**
  151 + * @return ActiveQuery
  152 + */
  153 + public function getSpecializations()
  154 + {
  155 + return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ])
  156 + ->viaTable('vacancy_specialization', [ 'vacancy_id' => 'vacancy_id' ]);
  157 + }
  158 +
  159 + /**
  160 + * Return array of Vacancy's specialization IDs
  161 + * @return integer[]
  162 + */
  163 + public function getSpecializationInput()
  164 + {
  165 + return $this->getSpecializations()
  166 + ->asArray()
  167 + ->indexBy('specialization_id')
  168 + ->column();
  169 + }
  170 +
  171 + /**
  172 + * Setter which allow to set Vacancy's specializations for further saving to the DB.
  173 + *
  174 + * @param integer[] $value
  175 + */
  176 + public function setSpecializationInput($value)
  177 + {
  178 + $this->specializationInput = $value;
  179 + }
  180 +
143 181 }
... ...
console/migrations/m160217_092739_currency_table.php
... ... @@ -25,7 +25,7 @@
25 25 'code',
26 26 'rate',
27 27 'is_default',
28   - 'string',
  28 + 'label',
29 29 ], [
30 30 [
31 31 1,
... ...
console/migrations/m160217_145813_add_fields_february.php
... ... @@ -20,6 +20,7 @@
20 20  
21 21 /* Add phone column to vacancy */
22 22 $this->addColumn('{{%vacancy}}', 'phone', $this->string());
  23 + $this->addColumn('{{%vacancy}}', 'salary', $this->string());
23 24 }
24 25  
25 26 public function down()
... ... @@ -28,6 +29,7 @@
28 29 $this->dropForeignKey('vacancy_specialization_specialization', '{{%vacancy_specialization}}');
29 30  
30 31 $this->dropColumn('{{%vacancy}}', 'phone');
  32 + $this->dropColumn('{{%vacancy}}', 'salary');
31 33  
32 34 $this->dropTable('{{%vacancy_specialization}}');
33 35 }
... ...
frontend/controllers/AccountsController.php
... ... @@ -75,12 +75,10 @@
75 75  
76 76 /**
77 77 * Page of additional skills, consist:
78   - *
79 78 * * working with programs;
80 79 * * education;
81 80 * * own developments and patents;
82 81 * * courses and trainings;
83   - *
84 82 * @return string
85 83 */
86 84 public function actionAddSkills()
... ... @@ -94,7 +92,6 @@
94 92  
95 93 /**
96 94 * Page of blog grid view
97   - *
98 95 * @return string
99 96 */
100 97 public function actionBlog()
... ... @@ -110,7 +107,6 @@
110 107  
111 108 /**
112 109 * Page of creating one record of blog.
113   - *
114 110 * @return string|\yii\web\Response Page html / Redirect
115 111 */
116 112 public function actionBlogCreate()
... ... @@ -175,11 +171,9 @@
175 171  
176 172 /**
177 173 * Page of contacts. Consist:
178   - *
179 174 * * phones;
180 175 * * social pages;
181 176 * * sites;
182   - *
183 177 * @return string page html
184 178 */
185 179 public function actionContacts()
... ... @@ -199,7 +193,6 @@
199 193  
200 194 /**
201 195 * Page of description. Consist of information about User.
202   - *
203 196 * @return string page html
204 197 */
205 198 public function actionDescription()
... ... @@ -219,11 +212,9 @@
219 212  
220 213 /**
221 214 * Page of seniority. Consist:
222   - *
223 215 * * current job;
224 216 * * year of the beginning of designing
225 217 * * previous jobs
226   - *
227 218 * @return string page html
228 219 */
229 220 public function actionEmployment()
... ... @@ -278,7 +269,6 @@
278 269  
279 270 /**
280 271 * Page of User's image galleries
281   - *
282 272 * @return string
283 273 */
284 274 public function actionGallery()
... ... @@ -294,7 +284,6 @@
294 284  
295 285 /**
296 286 * Page of User's videos
297   - *
298 287 * @return string
299 288 */
300 289 public function actionGalleryVideo()
... ... @@ -302,23 +291,20 @@
302 291  
303 292 $user = \Yii::$app->user->identity;
304 293  
305   - $video = Fields::getData($user->id,Gallery::className(),'youtube');
  294 + $video = Fields::getData($user->id, Gallery::className(), 'youtube');
306 295  
307   -
308   -
309   - if(!empty(Yii::$app->request->post('Fields'))) {
  296 + if(!empty( Yii::$app->request->post('Fields') )) {
310 297 Fields::saveFieldVideoData(Yii::$app->request->post('Fields'), $user->id, Gallery::className(), 'ru');
311 298 }
312 299  
313 300 return $this->render('gallery-video', [
314   - 'video' => $video,
  301 + 'video' => $video,
315 302 'user' => $user,
316 303 ]);
317 304 }
318 305  
319 306 /**
320 307 * Page of creating a photo gallery
321   - *
322 308 * @return string|\yii\web\Response
323 309 */
324 310 public function actionGalleryCreate()
... ... @@ -411,7 +397,6 @@
411 397 * </ul>
412 398 * </li>
413 399 * </ul>
414   - *
415 400 * @return string page html
416 401 */
417 402 public function actionGeneral()
... ... @@ -458,14 +443,13 @@
458 443  
459 444 /**
460 445 * Page of User's portfolio
461   - *
462 446 * @return string
463 447 */
464 448 public function actionPortfolio()
465 449 {
466 450 $searchModel = new PortfolioSearch();
467 451 $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
468   - $dataProvider->pagination->pageSize=5;
  452 + $dataProvider->pagination->pageSize = 5;
469 453 return $this->render('portfolio', [
470 454 'searchModel' => $searchModel,
471 455 'dataProvider' => $dataProvider,
... ... @@ -474,13 +458,15 @@
474 458  
475 459 /**
476 460 * Page of creating User's portfolio records.
477   - *
478 461 * @return string|\yii\web\Response
479 462 */
480 463 public function actionPortfolioCreate()
481 464 {
482 465 $portfolio = new Portfolio();
483   - $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
  466 + $specializations = Specialization::find()
  467 + ->where([ 'specialization_pid' => 0 ])
  468 + ->orderBy('specialization_id')
  469 + ->all();
484 470 $post = \Yii::$app->request->post();
485 471 if(!empty( $post )) {
486 472 $portfolio->load($post);
... ... @@ -489,16 +475,13 @@
489 475 $portfolio->save();
490 476 $portfolio->unlinkAll('specializations', true);
491 477 foreach($portfolio->specializationInput as $one_specialization) {
492   - if($one_specialization){
493   -
494   - $portfolio->link('specializations', Specialization::findOne($one_specialization));
495   - }
  478 + $portfolio->link('specializations', Specialization::findOne($one_specialization));
496 479 }
497 480 return $this->redirect('portfolio');
498 481 }
499 482 }
500 483 return $this->render('_portfolio_form', [
501   - 'portfolio' => $portfolio,
  484 + 'portfolio' => $portfolio,
502 485 'specializations' => $specializations,
503 486 ]);
504 487 }
... ... @@ -521,7 +504,10 @@
521 504 throw new NotFoundHttpException('Запись не найдена');
522 505 }
523 506  
524   - $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
  507 + $specializations = Specialization::find()
  508 + ->where([ 'specialization_pid' => 0 ])
  509 + ->orderBy('specialization_id')
  510 + ->all();
525 511  
526 512 $post = \Yii::$app->request->post();
527 513  
... ... @@ -531,18 +517,15 @@
531 517 if(!$portfolio->hasErrors()) {
532 518 $portfolio->save();
533 519 $portfolio->unlinkAll('specializations', true);
534   -
535 520 foreach($portfolio->specializationInput as $one_specialization) {
536   - if($one_specialization){
537 521 $portfolio->link('specializations', Specialization::findOne($one_specialization));
538   - }
539 522 }
540 523 return $this->redirect('portfolio');
541 524 }
542 525 }
543 526  
544 527 return $this->render('_portfolio_form', [
545   - 'portfolio' => $portfolio,
  528 + 'portfolio' => $portfolio,
546 529 'specializations' => $specializations,
547 530 ]);
548 531 }
... ... @@ -570,7 +553,6 @@
570 553  
571 554 /**
572 555 * Page of User's projects.
573   - *
574 556 * @return string
575 557 */
576 558 public function actionProjects()
... ... @@ -586,14 +568,16 @@
586 568  
587 569 /**
588 570 * Page of creating User's project.
589   - *
590 571 * @return string|\yii\web\Response
591 572 */
592 573 public function actionProjectsCreate()
593 574 {
594 575 $project = new Project();
595 576  
596   - $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
  577 + $specializations = Specialization::find()
  578 + ->where([ 'specialization_pid' => 0 ])
  579 + ->orderBy('specialization_id')
  580 + ->all();
597 581  
598 582 $payment = Payment::find()
599 583 ->select([
... ... @@ -645,10 +629,10 @@
645 629 }
646 630 }
647 631 return $this->render('_projects_form', [
648   - 'project' => $project,
  632 + 'project' => $project,
649 633 'specializations' => $specializations,
650   - 'payment' => $payment,
651   - 'projects' => $projects,
  634 + 'payment' => $payment,
  635 + 'projects' => $projects,
652 636 ]);
653 637 }
654 638  
... ... @@ -669,7 +653,10 @@
669 653 if(!$project instanceof ActiveRecord) {
670 654 throw new NotFoundHttpException('Запись не найдена');
671 655 }
672   - $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
  656 + $specializations = Specialization::find()
  657 + ->where([ 'specialization_pid' => 0 ])
  658 + ->orderBy('specialization_id')
  659 + ->all();
673 660 $payment = Payment::find()
674 661 ->select([
675 662 'name',
... ... @@ -719,10 +706,10 @@
719 706 }
720 707 }
721 708 return $this->render('_projects_form', [
722   - 'project' => $project,
  709 + 'project' => $project,
723 710 'specializations' => $specializations,
724   - 'payment' => $payment,
725   - 'projects' => $projects,
  711 + 'payment' => $payment,
  712 + 'projects' => $projects,
726 713 ]);
727 714 }
728 715  
... ... @@ -738,8 +725,8 @@
738 725 {
739 726 $user = \Yii::$app->user->identity;
740 727 $project = $user->getProjects()
741   - ->where([ 'project_id' => $id ])
742   - ->one();
  728 + ->where([ 'project_id' => $id ])
  729 + ->one();
743 730 if(!$project instanceof ActiveRecord) {
744 731 throw new NotFoundHttpException('Запись не найдена');
745 732 }
... ... @@ -759,7 +746,6 @@
759 746 * * delivery of materials;
760 747 * * minimal prepayment;
761 748 * * payment types;
762   - *
763 749 * @return string
764 750 */
765 751 public function actionService()
... ... @@ -769,7 +755,10 @@
769 755 if(empty( $user_info )) {
770 756 $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]);
771 757 }
772   - $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
  758 + $specializations = Specialization::find()
  759 + ->where([ 'specialization_pid' => 0 ])
  760 + ->orderBy('specialization_id')
  761 + ->all();
773 762 $payment = Payment::find()
774 763 ->select([
775 764 'name',
... ... @@ -778,7 +767,7 @@
778 767 ->indexBy('payment_id')
779 768 ->asArray()
780 769 ->column();
781   - $currencies =
  770 + $currencies = Currency::getCurrencyDropdown();
782 771 $post = \Yii::$app->request->post();
783 772 if(!empty( $post )) {
784 773 $user_info->load($post);
... ... @@ -797,17 +786,17 @@
797 786 }
798 787 }
799 788 return $this->render('service', [
800   - 'user' => $user,
801   - 'user_info' => $user_info,
  789 + 'user' => $user,
  790 + 'user_info' => $user_info,
802 791 'specializations' => $specializations,
803   - 'payment' => $payment,
  792 + 'payment' => $payment,
  793 + 'currencies' => $currencies,
804 794 ]);
805 795 }
806 796  
807 797 /**
808 798 * Page of account setting. Consist of:
809 799 * * changing password;
810   - *
811 800 * @return string
812 801 */
813 802 public function actionSetting()
... ... @@ -847,7 +836,6 @@
847 836  
848 837 /**
849 838 * Page of company's team
850   - *
851 839 * @return string
852 840 */
853 841 public function actionTeam()
... ... @@ -863,7 +851,6 @@
863 851  
864 852 /**
865 853 * Page of creating company's team member
866   - *
867 854 * @return string|\yii\web\Response
868 855 */
869 856 public function actionTeamCreate()
... ... @@ -966,7 +953,6 @@
966 953  
967 954 /**
968 955 * Page of company's vacancies
969   - *
970 956 * @return string
971 957 */
972 958 public function actionVacancy()
... ... @@ -982,7 +968,6 @@
982 968  
983 969 /**
984 970 * Page of creating company's vacancies.
985   - *
986 971 * @return string|\yii\web\Response
987 972 */
988 973 public function actionVacancyCreate()
... ... @@ -996,6 +981,11 @@
996 981 ->indexBy('employment_id')
997 982 ->asArray()
998 983 ->column();
  984 + $specializations = Specialization::find()
  985 + ->where([ 'specialization_pid' => 0 ])
  986 + ->orderBy('specialization_id')
  987 + ->all();
  988 + $currencies = Currency::getCurrencyDropdown();
999 989 $post = \Yii::$app->request->post();
1000 990 if(!empty( $post )) {
1001 991 $vacancy->load($post);
... ... @@ -1007,6 +997,10 @@
1007 997 foreach($vacancy->employmentInput as $one_employment) {
1008 998 $vacancy->link('employments', Employment::findOne($one_employment));
1009 999 }
  1000 + $vacancy->unlinkAll('specializations', true);
  1001 + foreach($vacancy->specializationInput as $one_specialization) {
  1002 + $vacancy->link('specializations', Specialization::findOne($one_specialization));
  1003 + }
1010 1004 return $this->redirect([
1011 1005 'vacancy-update',
1012 1006 'id' => $vacancy->vacancy_id,
... ... @@ -1014,8 +1008,10 @@
1014 1008 }
1015 1009 }
1016 1010 return $this->render('_vacancy_form', [
1017   - 'vacancy' => $vacancy,
1018   - 'employment' => $employment,
  1011 + 'vacancy' => $vacancy,
  1012 + 'employment' => $employment,
  1013 + 'currencies' => $currencies,
  1014 + 'specializations' => $specializations,
1019 1015 ]);
1020 1016 }
1021 1017  
... ... @@ -1031,8 +1027,8 @@
1031 1027 {
1032 1028 $user = \Yii::$app->user->identity;
1033 1029 $vacancy = $user->getVacancies()
1034   - ->where([ 'vacancy_id' => $id ])
1035   - ->one();
  1030 + ->where([ 'vacancy_id' => $id ])
  1031 + ->one();
1036 1032 if(!$vacancy instanceof ActiveRecord) {
1037 1033 throw new NotFoundHttpException('Запись не найдена');
1038 1034 }
... ... @@ -1044,6 +1040,11 @@
1044 1040 ->indexBy('employment_id')
1045 1041 ->asArray()
1046 1042 ->column();
  1043 + $specializations = Specialization::find()
  1044 + ->where([ 'specialization_pid' => 0 ])
  1045 + ->orderBy('specialization_id')
  1046 + ->all();
  1047 + $currencies = Currency::getCurrencyDropdown();
1047 1048 $post = \Yii::$app->request->post();
1048 1049 if(!empty( $post )) {
1049 1050 $vacancy->load($post);
... ... @@ -1055,6 +1056,10 @@
1055 1056 foreach($vacancy->employmentInput as $one_employment) {
1056 1057 $vacancy->link('employments', Employment::findOne($one_employment));
1057 1058 }
  1059 + $vacancy->unlinkAll('specializations', true);
  1060 + foreach($vacancy->specializationInput as $one_specialization) {
  1061 + $vacancy->link('specializations', Specialization::findOne($one_specialization));
  1062 + }
1058 1063 return $this->redirect([
1059 1064 'vacancy-update',
1060 1065 'id' => $vacancy->vacancy_id,
... ... @@ -1062,8 +1067,10 @@
1062 1067 }
1063 1068 }
1064 1069 return $this->render('_vacancy_form', [
1065   - 'vacancy' => $vacancy,
1066   - 'employment' => $employment,
  1070 + 'vacancy' => $vacancy,
  1071 + 'employment' => $employment,
  1072 + 'currencies' => $currencies,
  1073 + 'specializations' => $specializations,
1067 1074 ]);
1068 1075 }
1069 1076  
... ... @@ -1079,8 +1086,8 @@
1079 1086 {
1080 1087 $user = \Yii::$app->user->identity;
1081 1088 $vacancy = $user->getVacancies()
1082   - ->where([ 'vacancy_id' => $id ])
1083   - ->one();
  1089 + ->where([ 'vacancy_id' => $id ])
  1090 + ->one();
1084 1091 if(!$vacancy instanceof ActiveRecord) {
1085 1092 throw new NotFoundHttpException('Запись не найдена');
1086 1093  
... ...
frontend/views/accounts/_portfolio_form.php
1 1 <?php
2 2 /**
3 3 * @var Portfolio $portfolio
  4 + * @var integer[] $specializations
4 5 */
5 6 use common\models\Option;
6 7 use common\models\Portfolio;
... ... @@ -42,34 +43,42 @@ use yii\web\JsExpression;
42 43 </div>
43 44 </div>
44 45  
45   -
46   -<div class="input-blocks-wrapper">
47   - <ul class="content-menu-first">
48   - <?php foreach($specializations as $specialization):?>
49   - <li data-img="<?= $specialization->image?>">
50   - <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name?></a>
51   - <ul>
52   - <?php foreach($specialization->children as $child_first):?>
53   -
54   - <?php if($child_first instanceof Specialization):?>
55   - <li>
56   - <a href="#"><?= $child_first->specialization_name?></a>
57   - <ul>
58   - <?php foreach($child_first->children as $child_second):?>
59   - <?php if($child_first instanceof Specialization): ?>
60   - <li><a href="#"><?= Html::checkbox('Portfolio[specializationInput][]', in_array($child_second->specialization_id, ArrayHelper::getColumn($portfolio->specializations,'specialization_id')),['value' => $child_second->specialization_id, 'label' =>$child_second->specialization_name])?></a></li>
61   - <?php endif;?>
62   - <?php endforeach; ?>
63   - </ul>
64   - </li>
65   - <?php endif; ?>
66   - <?php endforeach; ?>
67   -
68   - </ul>
69   - </li>
70   - <?php endforeach; ?>
71   - </ul>
72   -</div>
  46 + <div class="input-blocks-wrapper">
  47 + <ul class="content-menu-first">
  48 + <?php foreach($specializations as $specialization): ?>
  49 + <li data-img="<?= $specialization->image ?>">
  50 + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a>
  51 + <ul>
  52 + <?php foreach($specialization->children as $child_first): ?>
  53 +
  54 + <?php if($child_first instanceof Specialization): ?>
  55 + <li>
  56 + <a href="#"><?= $child_first->specialization_name ?></a>
  57 + <ul>
  58 + <?php foreach($child_first->children as $child_second): ?>
  59 + <?php if($child_first instanceof Specialization): ?>
  60 + <li>
  61 + <a href="#">
  62 + <?= $form->field($portfolio, "specializationInput[{$child_second->specialization_id}]")
  63 + ->checkbox([
  64 + 'value' => $child_second->specialization_id,
  65 + 'label' => $child_second->specialization_name,
  66 + 'uncheck' => NULL,
  67 + ]) ?>
  68 + </a>
  69 + </li>
  70 + <?php endif; ?>
  71 + <?php endforeach; ?>
  72 + </ul>
  73 + </li>
  74 + <?php endif; ?>
  75 + <?php endforeach; ?>
  76 +
  77 + </ul>
  78 + </li>
  79 + <?php endforeach; ?>
  80 + </ul>
  81 + </div>
73 82  
74 83  
75 84  
... ...
frontend/views/accounts/_vacancy_form.php
... ... @@ -2,11 +2,13 @@
2 2 /**
3 3 * @var Vacancy $vacancy
4 4 * @var Employment[] $employment
  5 + * @var string[] $currencies
  6 + * @var Specialization[] $specializations
5 7 */
6 8 use common\models\Employment;
  9 + use common\models\Specialization;
7 10 use common\models\Vacancy;
8 11 use common\widgets\FieldEditor;
9   - use common\widgets\ImageUploader;
10 12 use kartik\select2\Select2;
11 13 use mihaildev\ckeditor\CKEditor;
12 14 use yii\helpers\Html;
... ... @@ -29,8 +31,6 @@
29 31 </div>
30 32 </div>
31 33  
32   -
33   -
34 34 <div class="input-blocks-wrapper">
35 35 <div class="input-blocks">
36 36 <?= $form->field($vacancy, 'link')
... ... @@ -48,8 +48,8 @@
48 48  
49 49 <div class="input-blocks-wrapper">
50 50 <div class="input-blocks">
51   - <span style="color: red">сюда нужен инпут телефон</span>
52   -
  51 + <?= $form->field($vacancy, 'phone')
  52 + ->textInput (['class'=> 'custom-input-2']); ?>
53 53 <span class="admin-hint-vacancy-contact">Ваш</span>
54 54 </div>
55 55 </div>
... ... @@ -77,6 +77,52 @@
77 77 </div>
78 78 </div>
79 79  
  80 +<div class="input-blocks-wrapper">
  81 + <div class="input-blocks">
  82 + <?= $form->field($vacancy, 'salary')
  83 + ->textInput (['class'=> 'custom-input-2']); ?>
  84 + <?= $form->field($vacancy, 'salary_currency')
  85 + ->label(false)->dropDownList($currencies); ?>
  86 + </div>
  87 +</div>
  88 +
  89 +<div class="input-blocks-wrapper">
  90 + <ul class="content-menu-first">
  91 + <?php foreach($specializations as $specialization): ?>
  92 + <li data-img="<?= $specialization->image ?>">
  93 + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a>
  94 + <ul>
  95 + <?php foreach($specialization->children as $child_first): ?>
  96 +
  97 + <?php if($child_first instanceof Specialization): ?>
  98 + <li>
  99 + <a href="#"><?= $child_first->specialization_name ?></a>
  100 + <ul>
  101 + <?php foreach($child_first->children as $child_second): ?>
  102 + <?php if($child_first instanceof Specialization): ?>
  103 + <li>
  104 + <a href="#">
  105 + <?= $form->field($vacancy, "specializationInput[{$child_second->specialization_id}]")
  106 + ->checkbox([
  107 + 'value' => $child_second->specialization_id,
  108 + 'label' => $child_second->specialization_name,
  109 + 'uncheck' => NULL,
  110 + ]) ?>
  111 + </a>
  112 + </li>
  113 + <?php endif; ?>
  114 + <?php endforeach; ?>
  115 + </ul>
  116 + </li>
  117 + <?php endif; ?>
  118 + <?php endforeach; ?>
  119 +
  120 + </ul>
  121 + </li>
  122 + <?php endforeach; ?>
  123 + </ul>
  124 +</div>
  125 +
80 126 <div class="input-blocks-wrapper admin-vacancy-check" style="margin-top: 29px">
81 127 <div class="input-blocks">
82 128 <?= $form->field($vacancy, 'employmentInput')
... ...
frontend/views/accounts/employment.php
... ... @@ -109,7 +109,7 @@
109 109  
110 110 <div class="input-blocks-wrapper">
111 111 <div class="input-blocks">
112   - <?= $form->field ($current, '[0]date_start')
  112 + <?= $form->field ($job_model, '['. ($index + 1) .']date_start')
113 113 ->label ('Дата начала работы')
114 114 ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]);
115 115 ?>
... ... @@ -179,7 +179,6 @@
179 179 var lastindex;
180 180 if(result != null) {
181 181 lastindex = result[1];
182   - console.log('111111111')
183 182 } else {
184 183 lastindex = 1;
185 184 $('.prev_job_container').removeClass('none-job-inputs')
... ...
frontend/views/accounts/service.php
1 1 <?php
2 2 /**
3   - * @var User $user
4   - * @var UserInfo $user_info
5   - * @var string[] $specialization
6   - * @var string[] $payment
  3 + * @var User $user
  4 + * @var UserInfo $user_info
  5 + * @var string[] $specialization
  6 + * @var string[] $payment
  7 + * @var string[] $currecnies
7 8 */
8 9 use common\models\Currency;
9 10 use common\models\Specialization;
... ... @@ -32,39 +33,46 @@
32 33 ?>
33 34 <div class="input-blocks-wrapper">
34 35 <div class="input-blocks">
35   - <?=
36   - $form->field($user_info, 'salary_currency')->label(false)->dropDownList(Currency::getCurrencyDropdown());
37   - ?>
  36 + <?= $form->field($user_info, 'salary_currency')
  37 + ->label(false)
  38 + ->dropDownList($currencies); ?>
38 39 <?= $form->field($user_info, 'salary', [
39 40 'template' => "{label}<br /><span class='admn-input-txt'>от</span>{input}<span class='admn-input-txt'>за час</span>\n{hint}\n{error}",
40 41 'options' => [ 'class' => 'form-inline' ],
41 42 ])
42   - ->label('Стоимость работ')
43   - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
44   - ?>
  43 + ->label('Стоимость работ')
  44 + ->textInput([
  45 + 'class' => 'custom-input-2 custom-input-2-date',
  46 + 'type' => 'number',
  47 + ]); ?>
45 48 </div>
46 49 </div>
47 50  
48 51 <div class="input-blocks-wrapper">
49 52 <ul class="content-menu-first">
50   - <?php foreach($specializations as $specialization):?>
51   - <li data-img="<?= $specialization->image?>">
52   - <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name?></a>
  53 + <?php foreach($specializations as $specialization): ?>
  54 + <li data-img="<?= $specialization->image ?>">
  55 + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a>
53 56 <ul>
54   - <?php foreach($specialization->children as $child_first):?>
  57 + <?php foreach($specialization->children as $child_first): ?>
55 58  
56   - <?php if($child_first instanceof Specialization):?>
  59 + <?php if($child_first instanceof Specialization): ?>
57 60 <li>
58   - <a href="#"><?= $child_first->specialization_name?></a>
  61 + <a href="#"><?= $child_first->specialization_name ?></a>
59 62 <ul>
60   - <?php foreach($child_first->children as $child_second):?>
  63 + <?php foreach($child_first->children as $child_second): ?>
61 64 <?php if($child_first instanceof Specialization): ?>
62 65 <li>
63 66 <a href="#">
64   - <?= $form->field($user, "specializationInput[{$child_second->specialization_id}]")->checkbox(['value' => $child_second->specialization_id, 'label' => $child_second->specialization_name, 'uncheck' => null, 'checked' => 'checked']) ?>
  67 + <?= $form->field($user, "specializationInput[{$child_second->specialization_id}]")
  68 + ->checkbox([
  69 + 'value' => $child_second->specialization_id,
  70 + 'label' => $child_second->specialization_name,
  71 + 'uncheck' => NULL,
  72 + ]) ?>
65 73 </a>
66 74 </li>
67   - <?php endif;?>
  75 + <?php endif; ?>
68 76 <?php endforeach; ?>
69 77 </ul>
70 78 </li>
... ... @@ -78,23 +86,25 @@
78 86 </div>
79 87 <div class="input-blocks-wrapper">
80 88 <div class="input-blocks">
81   - <?=
82   - $form->field($user_info, 'geographies')->widget(Select2::classname(), [
83   - 'options' => ['placeholder' => 'Выбор города ...', 'multiple' => true],
84   - 'pluginOptions' => [
85   - 'allowClear' => true,
86   - 'minimumInputLength' => 3,
87   - 'ajax' => [
88   - 'url' => \yii\helpers\Url::to(['site/city']),
89   - 'dataType' => 'json',
90   - 'data' => new JsExpression('function(params) { return {q:params.term}; }')
91   - ],
92   - 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
93   - 'templateResult' => new JsExpression('function(city) { return city.text; }'),
94   - 'templateSelection' => new JsExpression('function (city) { return city.text; }'),
95   - ],
96   - ]);
97   - ?>
  89 + <?= $form->field($user_info, 'geographies')
  90 + ->widget(Select2::classname(), [
  91 + 'options' => [
  92 + 'placeholder' => 'Выбор города ...',
  93 + 'multiple' => true,
  94 + ],
  95 + 'pluginOptions' => [
  96 + 'allowClear' => true,
  97 + 'minimumInputLength' => 3,
  98 + 'ajax' => [
  99 + 'url' => \yii\helpers\Url::to([ 'site/city' ]),
  100 + 'dataType' => 'json',
  101 + 'data' => new JsExpression('function(params) { return {q:params.term}; }'),
  102 + ],
  103 + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
  104 + 'templateResult' => new JsExpression('function(city) { return city.text; }'),
  105 + 'templateSelection' => new JsExpression('function (city) { return city.text; }'),
  106 + ],
  107 + ]); ?>
98 108 </div>
99 109 </div>
100 110 <div class="input-blocks-wrapper">
... ... @@ -103,92 +113,94 @@
103 113 'template' => "{label}<br />{input}<span class='admn-input-txt'>лет</span>\n{hint}\n{error}",
104 114 'options' => [ 'class' => 'form-inline' ],
105 115 ])
106   - ->label('Гарантия качества работ')
107   - ->textInput (['class'=> 'custom-input-2 custom-input-2-date custom-input-2-margin-r','type'=>'number']) ?>
  116 + ->label('Гарантия качества работ')
  117 + ->textInput([
  118 + 'class' => 'custom-input-2 custom-input-2-date custom-input-2-margin-r',
  119 + 'type' => 'number',
  120 + ]) ?>
108 121 </div>
109 122 </div>
110 123  
111 124 <div class="input-blocks-wrapper">
112 125 <div class="input-blocks">
113 126 <?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ])
114   - ->label('Работа по договору')
115   - ->radioList([
116   - 1 => 'Да',
117   - 0 => 'Нет',
118   - ],
119   - [
120   - 'item' => function($index, $label, $name, $checked, $value) {
121   - $return = '<div class="admin-who-check">';
122   - $return .= '<input class="custom-radio" id="select_admin_doc'.$value.'" type="radio" name="' . $name . '" value="' . $value . '" '.($checked ? "checked" :"").' >';
123   - $return .= '<label for="select_admin_doc'.$value.'" >';
124   - $return .= '<span></span>' . ucwords($label);
125   - $return .= '</label>';
126   - $return .= '</div>';
127   - return $return;
128   - }
129   - ]) ?>
  127 + ->label('Работа по договору')
  128 + ->radioList([
  129 + 1 => 'Да',
  130 + 0 => 'Нет',
  131 + ], [
  132 + 'item' => function($index, $label, $name, $checked, $value) {
  133 + $return = '<div class="admin-who-check">';
  134 + $return .= '<input class="custom-radio" id="select_admin_doc' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
  135 + $return .= '<label for="select_admin_doc' . $value . '" >';
  136 + $return .= '<span></span>' . ucwords($label);
  137 + $return .= '</label>';
  138 + $return .= '</div>';
  139 + return $return;
  140 + },
  141 + ]) ?>
130 142 </div>
131 143 </div>
132 144  
133 145 <div class="input-blocks-wrapper">
134 146 <div class="input-blocks">
135 147 <?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ])
136   - ->label('Предоставляете смету')
137   - ->radioList([
138   - 1 => 'Да',
139   - 0 => 'Нет',
140   - ], [
141   - 'item' => function($index, $label, $name, $checked, $value) {
142   - $return = '<div class="admin-who-check">';
143   - $return .= '<input class="custom-radio" id="select_admin_estimate'.$value.'" type="radio" name="' . $name . '" value="' . $value . '" '.($checked ? "checked" :"").' >';
144   - $return .= '<label for="select_admin_estimate'.$value.'" >';
145   - $return .= '<span></span>' . ucwords($label);
146   - $return .= '</label>';
147   - $return .= '</div>';
148   - return $return;
149   - }
150   - ]) ?>
  148 + ->label('Предоставляете смету')
  149 + ->radioList([
  150 + 1 => 'Да',
  151 + 0 => 'Нет',
  152 + ], [
  153 + 'item' => function($index, $label, $name, $checked, $value) {
  154 + $return = '<div class="admin-who-check">';
  155 + $return .= '<input class="custom-radio" id="select_admin_estimate' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
  156 + $return .= '<label for="select_admin_estimate' . $value . '" >';
  157 + $return .= '<span></span>' . ucwords($label);
  158 + $return .= '</label>';
  159 + $return .= '</div>';
  160 + return $return;
  161 + },
  162 + ]) ?>
151 163 </div>
152 164 </div>
153 165  
154 166 <div class="input-blocks-wrapper">
155 167 <div class="input-blocks">
156 168 <?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ])
157   - ->label('Делаете сами закупку материалов')
158   - ->radioList([
159   - 1 => 'Да',
160   - 0 => 'Нет',
161   - ], [
162   - 'item' => function($index, $label, $name, $checked, $value) {
163   - $return = '<div class="admin-who-check">';
164   - $return .= '<input class="custom-radio" id="select_admin_purchase'.$value.'" type="radio" name="' . $name . '" value="' . $value . '" '.($checked ? "checked" :"").' >';
165   - $return .= '<label for="select_admin_purchase'.$value.'" >';
166   - $return .= '<span></span>' . ucwords($label);
167   - $return .= '</label>';
168   - $return .= '</div>';
169   - return $return;
170   - }
171   - ]) ?>
  169 + ->label('Делаете сами закупку материалов')
  170 + ->radioList([
  171 + 1 => 'Да',
  172 + 0 => 'Нет',
  173 + ], [
  174 + 'item' => function($index, $label, $name, $checked, $value) {
  175 + $return = '<div class="admin-who-check">';
  176 + $return .= '<input class="custom-radio" id="select_admin_purchase' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
  177 + $return .= '<label for="select_admin_purchase' . $value . '" >';
  178 + $return .= '<span></span>' . ucwords($label);
  179 + $return .= '</label>';
  180 + $return .= '</div>';
  181 + return $return;
  182 + },
  183 + ]) ?>
172 184 </div>
173 185 </div>
174 186 <div class="input-blocks-wrapper">
175 187 <div class="input-blocks">
176 188 <?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ])
177   - ->label('Занимаетесь сами доставкой материалов')
178   - ->radioList([
179   - 1 => 'Да',
180   - 0 => 'Нет',
181   - ], [
182   - 'item' => function($index, $label, $name, $checked, $value) {
183   - $return = '<div class="admin-who-check">';
184   - $return .= '<input class="custom-radio" id="select_admin_delivery'.$value.'" type="radio" name="' . $name . '" value="' . $value . '" '.($checked ? "checked" :"").' >';
185   - $return .= '<label for="select_admin_delivery'.$value.'" >';
186   - $return .= '<span></span>' . ucwords($label);
187   - $return .= '</label>';
188   - $return .= '</div>';
189   - return $return;
190   - }
191   - ]) ?>
  189 + ->label('Занимаетесь сами доставкой материалов')
  190 + ->radioList([
  191 + 1 => 'Да',
  192 + 0 => 'Нет',
  193 + ], [
  194 + 'item' => function($index, $label, $name, $checked, $value) {
  195 + $return = '<div class="admin-who-check">';
  196 + $return .= '<input class="custom-radio" id="select_admin_delivery' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
  197 + $return .= '<label for="select_admin_delivery' . $value . '" >';
  198 + $return .= '<span></span>' . ucwords($label);
  199 + $return .= '</label>';
  200 + $return .= '</div>';
  201 + return $return;
  202 + },
  203 + ]) ?>
192 204 </div>
193 205 </div>
194 206  
... ... @@ -198,28 +210,29 @@
198 210 'template' => "{label}<br />{input}<span class='admn-input-txt'>%</span>\n{hint}\n{error}",
199 211 'options' => [ 'class' => 'form-inline' ],
200 212 ])
201   - ->label('Минимальная предоплата за работы')
202   - ->textInput (['class'=> 'custom-input-2 custom-input-2-date custom-input-2-margin-r','type'=>'number'])?>
  213 + ->label('Минимальная предоплата за работы')
  214 + ->textInput([
  215 + 'class' => 'custom-input-2 custom-input-2-date custom-input-2-margin-r',
  216 + 'type' => 'number',
  217 + ]) ?>
203 218 </div>
204 219 </div>
205 220  
206 221 <div class="input-blocks-wrapper style border-general">
207 222 <div class="input-blocks">
208 223 <?= $form->field($user, 'paymentInput', [ 'template' => "{label}\n{input}\n{error}" ])
209   - ->label('Способы оплаты')
210   - ->checkboxList($payment,
211   - [
212   - 'item' => function($index, $label, $name, $checked, $value) {
213   - $return = '<div class="admin-who-check-payment">';
214   - $return .= '<input class="custom-check" id="select_admin_payment'.$value.'" type="checkbox" name="' . $name . '" value="' . $value . '" '.($checked ? "checked" :"").' >';
215   - $return .= '<label for="select_admin_payment'.$value.'" >';
216   - $return .= '<span></span>' . ucwords($label);
217   - $return .= '</label>';
218   - $return .= '</div>';
219   - return $return;
220   - }
221   - ]
222   - ) ?>
  224 + ->label('Способы оплаты')
  225 + ->checkboxList($payment, [
  226 + 'item' => function($index, $label, $name, $checked, $value) {
  227 + $return = '<div class="admin-who-check-payment">';
  228 + $return .= '<input class="custom-check" id="select_admin_payment' . $value . '" type="checkbox" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
  229 + $return .= '<label for="select_admin_payment' . $value . '" >';
  230 + $return .= '<span></span>' . ucwords($label);
  231 + $return .= '</label>';
  232 + $return .= '</div>';
  233 + return $return;
  234 + },
  235 + ]) ?>
223 236 </div>
224 237 </div>
225 238  
... ...