Commit 5f49082a7972ca75f201b2c247de72dacfd1b807
1 parent
04b7173a
test
Showing
9 changed files
with
480 additions
and
288 deletions
Show diff stats
backend/web/js/option.js
... | ... | @@ -19,10 +19,11 @@ function checkboxerInit() { |
19 | 19 | } |
20 | 20 | function accountRedraw() { |
21 | 21 | var type = $('input[name="User[type]"]:checked').val(); |
22 | + console.log(type); | |
22 | 23 | if(type == 2) { |
23 | - $('#form_definition').addClass('form_for_company'); | |
24 | - } else { | |
25 | 24 | $('#form_definition').removeClass('form_for_company'); |
25 | + } else { | |
26 | + $('#form_definition').addClass('form_for_company'); | |
26 | 27 | } |
27 | 28 | } |
28 | 29 | $(function() { | ... | ... |
common/config/.gitignore
frontend/assets/AppAsset.php
... | ... | @@ -19,7 +19,7 @@ class AppAsset extends AssetBundle |
19 | 19 | public $css = [ |
20 | 20 | 'css/style.css', |
21 | 21 | '/admin/css/flags32.css', |
22 | - 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', | |
22 | + //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', | |
23 | 23 | ]; |
24 | 24 | public $js = [ |
25 | 25 | '/js/script.js', | ... | ... |
frontend/controllers/AccountsController.php
1 | 1 | <?php |
2 | -namespace frontend\controllers; | |
3 | - | |
4 | -use common\models\CompanyInfo; | |
5 | -use common\models\Fields; | |
6 | -use common\models\Job; | |
7 | -use common\models\Language; | |
8 | -use Yii; | |
9 | -use common\models\User; | |
10 | -use common\models\UserInfo; | |
11 | - | |
12 | -use yii\filters\AccessControl; | |
13 | -use yii\web\Controller; | |
14 | -use yii\web\NotFoundHttpException; | |
15 | - | |
16 | - | |
17 | -/** | |
18 | - * Site controller | |
19 | - */ | |
20 | -class AccountsController extends Controller | |
21 | -{ | |
2 | + namespace frontend\controllers; | |
3 | + | |
4 | + use common\models\CompanyInfo; | |
5 | + use common\models\Fields; | |
6 | + use common\models\Job; | |
7 | + use common\models\Language; | |
8 | + use common\models\Payment; | |
9 | + use common\models\Specialization; | |
10 | + use common\models\UserPayment; | |
11 | + use common\models\UserSpecialization; | |
12 | + use Yii; | |
13 | + use common\models\User; | |
14 | + use common\models\UserInfo; | |
15 | + | |
16 | + use yii\filters\AccessControl; | |
17 | + use yii\web\Controller; | |
18 | + use yii\web\NotFoundHttpException; | |
22 | 19 | |
20 | + /** | |
21 | + * Site controller | |
22 | + */ | |
23 | + class AccountsController extends Controller | |
24 | + { | |
23 | 25 | |
24 | - public $layout = 'admin'; | |
26 | + public $layout = 'admin'; | |
25 | 27 | |
26 | - public function behaviors() | |
27 | - { | |
28 | - return [ | |
29 | - 'access' => [ | |
30 | - 'class' => AccessControl::className(), | |
31 | - 'rules' => [ | |
32 | - [ | |
33 | - //'actions' => ['cabinet','change-password', 'bookmarks', 'projects'], | |
34 | - 'allow' => true, | |
35 | - 'roles' => ['@'], | |
28 | + public function behaviors() | |
29 | + { | |
30 | + return [ | |
31 | + 'access' => [ | |
32 | + 'class' => AccessControl::className(), | |
33 | + 'rules' => [ | |
34 | + [ | |
35 | + //'actions' => ['cabinet','change-password', 'bookmarks', 'projects'], | |
36 | + 'allow' => true, | |
37 | + 'roles' => [ '@' ], | |
38 | + ], | |
36 | 39 | ], |
37 | 40 | ], |
38 | - ], | |
39 | - ]; | |
40 | - } | |
41 | - | |
41 | + ]; | |
42 | + } | |
42 | 43 | |
43 | - public function actionCabinet() | |
44 | - { | |
44 | + public function actionCabinet() | |
45 | + { | |
45 | 46 | |
47 | + $user = $this->findUser(Yii::$app->user->identity->id); | |
46 | 48 | |
47 | - $user = $this->findUser(Yii::$app->user->identity->id); | |
49 | + $langs = Language::getActiveLanguages(); | |
48 | 50 | |
49 | - $langs = Language::getActiveLanguages(); | |
51 | + if($user->load(Yii::$app->request->post()) && $user->save()) { | |
52 | + $user->userInfo->load(Yii::$app->request->post()); | |
53 | + $user->userInfo->save(); | |
54 | + Fields::saveFieldData(Yii::$app->request->post('Fields'), $user->id, $user::className(), 'ru'); | |
55 | + return $this->render('cabinet', [ | |
56 | + 'user' => $user, | |
57 | + 'user_info' => $user->userInfo, | |
58 | + 'langs' => $langs, | |
59 | + ]); | |
50 | 60 | |
51 | - if ($user->load(Yii::$app->request->post()) && $user->save()) { | |
52 | - $user->userInfo->load(Yii::$app->request->post()); | |
53 | - $user->userInfo->save(); | |
54 | - Fields::saveFieldData( Yii::$app->request->post('Fields'), $user->id, $user::className(),'ru'); | |
55 | - return $this->render('cabinet', [ | |
56 | - 'user' => $user, | |
57 | - 'user_info' => $user->userInfo, | |
58 | - 'langs' => $langs, | |
59 | - ]); | |
61 | + } else { | |
60 | 62 | |
61 | - } else { | |
63 | + return $this->render('cabinet', [ | |
64 | + 'user' => $user, | |
65 | + 'user_info' => $user->userInfo, | |
66 | + 'langs' => $langs, | |
67 | + ]); | |
62 | 68 | |
63 | - return $this->render('cabinet', [ | |
64 | - 'user' => $user, | |
65 | - 'user_info' => $user->userInfo, | |
66 | - 'langs' => $langs, | |
67 | - ]); | |
69 | + } | |
68 | 70 | |
69 | 71 | } |
70 | 72 | |
73 | + public function actionBookmarks() | |
74 | + { | |
75 | + return $this->render('bookmarks'); | |
76 | + } | |
71 | 77 | |
72 | - } | |
73 | - | |
74 | - public function actionBookmarks() | |
75 | - { | |
76 | - return $this->render('bookmarks'); | |
77 | - } | |
78 | - | |
79 | - public function actionGeneral() | |
80 | - { | |
81 | - $user_info = UserInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); | |
82 | - $company_info = CompanyInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); | |
83 | - $user = \Yii::$app->user->identity; | |
84 | - if(empty($user_info)) | |
78 | + public function actionGeneral() | |
85 | 79 | { |
86 | - $user_info = new UserInfo(['user_id' => \Yii::$app->user->getId()]); | |
80 | + $user_info = UserInfo::find() | |
81 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
82 | + ->one(); | |
83 | + $company_info = CompanyInfo::find() | |
84 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
85 | + ->one(); | |
86 | + $user = \Yii::$app->user->identity; | |
87 | + if(empty( $user_info )) { | |
88 | + $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); | |
89 | + } | |
90 | + if(empty( $company_info )) { | |
91 | + $company_info = new CompanyInfo([ 'user_id' => \Yii::$app->user->getId() ]); | |
92 | + } | |
93 | + $post = \Yii::$app->request->post(); | |
94 | + if(!empty( $post )) { | |
95 | + $user_info->load($post); | |
96 | + $company_info->load($post); | |
97 | + $user->load($post); | |
98 | + if($user_info->save() && $user->save() && $company_info->save()) { | |
99 | + \Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена'); | |
100 | + } else { | |
101 | + \Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму'); | |
102 | + } | |
103 | + } | |
104 | + return $this->render('general', [ | |
105 | + 'user_info' => $user_info, | |
106 | + 'user' => $user, | |
107 | + 'company_info' => $company_info, | |
108 | + ]); | |
87 | 109 | } |
88 | - if(empty($company_info)) | |
110 | + | |
111 | + public function actionPortfolio() | |
89 | 112 | { |
90 | - $company_info = new CompanyInfo(['user_id' => \Yii::$app->user->getId()]); | |
113 | + | |
91 | 114 | } |
92 | - $post = \Yii::$app->request->post(); | |
93 | - if(!empty($post)) | |
115 | + | |
116 | + /** | |
117 | + * $user User | |
118 | + */ | |
119 | + public function actionSetting() | |
94 | 120 | { |
95 | - $user_info->load($post); | |
96 | - $company_info->load($post); | |
97 | - $user->load($post); | |
98 | - if($user_info->save() && $user->save() && $company_info->save()) | |
99 | - { | |
100 | - \Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена'); | |
101 | - } else { | |
102 | - \Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму'); | |
121 | + $user = \Yii::$app->user->identity; | |
122 | + $post = \Yii::$app->request->post('User'); | |
123 | + if(!empty( $post )) { | |
124 | + if(empty( $post[ 'new_password' ] )) { | |
125 | + $user->addError('new_password', 'Введите новый пароль'); | |
126 | + } else { | |
127 | + $user->new_password = $post[ 'new_password' ]; | |
128 | + } | |
129 | + if(empty( $post[ 'old_password' ] )) { | |
130 | + $user->addError('old_password', 'Введите новый пароль'); | |
131 | + } else { | |
132 | + $user->old_password = $post[ 'old_password' ]; | |
133 | + } | |
134 | + if(empty( $post[ 'password_reply' ] ) || $post[ 'password_reply' ] !== $post[ 'new_password' ]) { | |
135 | + $user->addError('password_reply', 'Неправильный повтор пароля'); | |
136 | + } else { | |
137 | + $user->password_reply = $post[ 'password_reply' ]; | |
138 | + } | |
139 | + if(!$user->hasErrors()) { | |
140 | + if($user->validatePassword($user->old_password)) { | |
141 | + $user->setPassword($user->new_password); | |
142 | + $user->generateAuthKey(); | |
143 | + if($user->save()) { | |
144 | + \Yii::$app->session->setFlash('passwordupdate', 'Пароль успешно обновлен'); | |
145 | + } | |
146 | + } else { | |
147 | + $user->addError('old_password', 'Неправильный старый пароль'); | |
148 | + } | |
149 | + } | |
103 | 150 | } |
151 | + return $this->render('setting', [ 'user' => $user ]); | |
104 | 152 | } |
105 | - return $this->render('general', ['user_info' => $user_info, 'user' => $user, 'company_info' => $company_info]); | |
106 | - } | |
107 | - | |
108 | - public function actionPortfolio() | |
109 | - { | |
110 | - | |
111 | - } | |
112 | 153 | |
113 | - /** | |
114 | - * $user User | |
115 | - */ | |
116 | - public function actionSetting() | |
117 | - { | |
118 | - $user = \Yii::$app->user->identity; | |
119 | - $post = \Yii::$app->request->post('User'); | |
120 | - if(!empty($post)) { | |
121 | - if(empty($post['new_password'])) { | |
122 | - $user->addError('new_password', 'Введите новый пароль'); | |
123 | - } else { | |
124 | - $user->new_password = $post['new_password']; | |
154 | + public function actionContacts() | |
155 | + { | |
156 | + $user_info = UserInfo::find() | |
157 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
158 | + ->one(); | |
159 | + if(empty( $user_info )) { | |
160 | + $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); | |
125 | 161 | } |
126 | - if(empty($post['old_password'])) { | |
127 | - $user->addError('old_password', 'Введите новый пароль'); | |
128 | - } else { | |
129 | - $user->old_password = $post['old_password']; | |
162 | + if(!empty( \Yii::$app->request->post() )) { | |
163 | + Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); | |
164 | + $user_info->load(\Yii::$app->request->post()); | |
165 | + $user_info->save(); | |
130 | 166 | } |
131 | - if(empty($post['password_reply']) || $post['password_reply'] !== $post['new_password']) { | |
132 | - $user->addError('password_reply', 'Неправильный повтор пароля'); | |
133 | - } else { | |
134 | - $user->password_reply = $post['password_reply']; | |
167 | + return $this->render('contacts', [ 'user_info' => $user_info ]); | |
168 | + } | |
169 | + | |
170 | + public function actionService() | |
171 | + { | |
172 | + $user_info = UserInfo::find() | |
173 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
174 | + ->one(); | |
175 | + if(empty( $user_info )) { | |
176 | + $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); | |
135 | 177 | } |
136 | - if(!$user->hasErrors()) { | |
137 | - if($user->validatePassword($user->old_password)) { | |
138 | - $user->setPassword($user->new_password); | |
139 | - $user->generateAuthKey(); | |
140 | - if($user->save()) { | |
141 | - \Yii::$app->session->setFlash('passwordupdate', 'Пароль успешно обновлен'); | |
142 | - } | |
143 | - } else { | |
144 | - $user->addError('old_password', 'Неправильный старый пароль'); | |
178 | + $post = \Yii::$app->request->post(); | |
179 | + if(!empty( $post )) { | |
180 | + $user_info->load($post); | |
181 | + $user_info->save(); | |
182 | + $user_specialization_values = [ ]; | |
183 | + $user_payment_values = [ ]; | |
184 | + UserSpecialization::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); | |
185 | + UserPayment::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); | |
186 | + foreach($post[ 'UserSpecialization' ][ 'specialization_id' ] as $index => $value) { | |
187 | + $user_specialization_values[] = (new UserSpecialization([ 'user_id' => \Yii::$app->user->getId(), | |
188 | + 'specialization_id' => $value, | |
189 | + ]))->save(); | |
190 | + } | |
191 | + foreach($post[ 'UserPayment' ][ 'payment_id' ] as $index => $value) { | |
192 | + $user_payment_values[] = (new UserPayment([ 'user_id' => \Yii::$app->user->getId(), | |
193 | + 'payment_id' => $value, | |
194 | + ]))->save(); | |
145 | 195 | } |
146 | 196 | } |
197 | + $user_specialization = UserSpecialization::find() | |
198 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
199 | + ->select([ 'specialization_id' ]) | |
200 | + ->column(); | |
201 | + $user_payment = UserPayment::find() | |
202 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
203 | + ->select([ 'payment_id' ]) | |
204 | + ->column(); | |
205 | + $user_specialization_input = new UserSpecialization([ 'user_id' => \Yii::$app->user->getId() ]); | |
206 | + $user_payment_input = new UserPayment([ 'user_id' => \Yii::$app->user->getId() ]); | |
207 | + $specialization = Specialization::find() | |
208 | + ->select([ | |
209 | + 'specialization_name', | |
210 | + 'specialization_id', | |
211 | + ]) | |
212 | + ->indexBy('specialization_id') | |
213 | + ->asArray() | |
214 | + ->column(); | |
215 | + $payment = Payment::find() | |
216 | + ->select([ | |
217 | + 'name', | |
218 | + 'payment_id', | |
219 | + ]) | |
220 | + ->indexBy('payment_id') | |
221 | + ->asArray() | |
222 | + ->column(); | |
223 | + return $this->render('service', [ | |
224 | + 'user_info' => $user_info, | |
225 | + 'specialization' => $specialization, | |
226 | + 'user_specialization' => $user_specialization, | |
227 | + 'user_specialization_input' => $user_specialization_input, | |
228 | + 'payment' => $payment, | |
229 | + 'user_payment' => $user_payment, | |
230 | + 'user_payment_input' => $user_payment_input, | |
231 | + ]); | |
147 | 232 | } |
148 | - return $this->render('setting', ['user' => $user]); | |
149 | - } | |
150 | 233 | |
151 | - public function actionContacts() | |
152 | - { | |
153 | - $user_info = UserInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); | |
154 | - if(empty($user_info)) { | |
155 | - $user_info = new UserInfo(['user_id' => \Yii::$app->user->getId()]); | |
156 | - } | |
157 | - if(!empty(\Yii::$app->request->post())) { | |
158 | - Fields::saveFieldData( Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(),'ru'); | |
159 | - $user_info->load(\Yii::$app->request->post()); | |
160 | - $user_info->save(); | |
161 | - $user_info; | |
234 | + public function actionAddSkills() | |
235 | + { | |
236 | + return $this->render('add-skills'); | |
162 | 237 | } |
163 | - return $this->render('contacts', ['user_info' => $user_info]); | |
164 | - } | |
165 | - | |
166 | - public function actionService() | |
167 | - { | |
168 | - return $this->render('service'); | |
169 | - } | |
170 | - | |
171 | - public function actionAddSkills() | |
172 | - { | |
173 | 238 | |
174 | - } | |
175 | - | |
176 | - public function actionEmployment() | |
177 | - { | |
178 | - $post = \Yii::$app->request->post(); | |
179 | - if(!empty($post)) { | |
180 | - $job = []; | |
181 | - for($i = 0; $i < count($post['Job']); $i++) { | |
182 | - $job[$i] = new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 0]); | |
239 | + public function actionDescription() | |
240 | + { | |
241 | + $user_info = UserInfo::find() | |
242 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
243 | + ->one(); | |
244 | + if(empty( $user_info )) { | |
245 | + $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); | |
246 | + } | |
247 | + $post = \Yii::$app->request->post(); | |
248 | + if(!empty($post)) { | |
249 | + $user_info->load($post); | |
250 | + $user_info->save(); | |
183 | 251 | } |
184 | - if(Job::loadMultiple($job, $post)) { | |
185 | - $job[0]->current = 1; | |
186 | - if(Job::validateMultiple($job)) { | |
187 | - Job::deleteAll(['user_id' => \Yii::$app->user->getId()]); | |
188 | - foreach($job as $onejob) { | |
189 | - $onejob->save(false); | |
252 | + return $this->render('description', [ 'user_info' => $user_info ]); | |
253 | + } | |
254 | + | |
255 | + public function actionEmployment() | |
256 | + { | |
257 | + $post = \Yii::$app->request->post(); | |
258 | + if(!empty( $post )) { | |
259 | + $job = [ ]; | |
260 | + for($i = 0; $i < count($post[ 'Job' ]); $i++) { | |
261 | + $job[ $i ] = new Job([ | |
262 | + 'user_id' => \Yii::$app->user->getId(), | |
263 | + 'current' => 0, | |
264 | + ]); | |
265 | + } | |
266 | + if(Job::loadMultiple($job, $post)) { | |
267 | + $job[ 0 ]->current = 1; | |
268 | + if(Job::validateMultiple($job)) { | |
269 | + Job::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); | |
270 | + foreach($job as $onejob) { | |
271 | + $onejob->save(false); | |
272 | + } | |
190 | 273 | } |
191 | 274 | } |
275 | + } else { | |
276 | + $job = Job::find() | |
277 | + ->where([ 'user_id' => \Yii::$app->user->getId() ]) | |
278 | + ->orderBy([ 'current' => SORT_DESC ]) | |
279 | + ->all(); | |
280 | + if(empty( $job )) { | |
281 | + $job[] = new Job([ | |
282 | + 'user_id' => \Yii::$app->user->getId(), | |
283 | + 'current' => 0, | |
284 | + ]); | |
285 | + } | |
286 | + if(!$job[ 0 ]->current) { | |
287 | + array_unshift($job, new Job([ | |
288 | + 'user_id' => \Yii::$app->user->getId(), | |
289 | + 'current' => 1, | |
290 | + ])); | |
291 | + } | |
192 | 292 | } |
193 | - } else { | |
194 | - $job = Job::find()->where(['user_id' => \Yii::$app->user->getId()])->orderBy(['current' => SORT_DESC])->all(); | |
195 | - if(empty($job)) { | |
196 | - $job[] = new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 0]); | |
197 | - } | |
198 | - if(!$job[0]->current) { | |
199 | - array_unshift($job, new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 1])); | |
200 | - } | |
293 | + return $this->render('employment', [ 'job' => $job ]); | |
201 | 294 | } |
202 | - return $this->render('employment', ['job' => $job]); | |
203 | - } | |
204 | - | |
205 | - public function actionProjects() | |
206 | - { | |
207 | - return $this->render('projects'); | |
208 | - } | |
209 | - | |
210 | - public function actionGallery() | |
211 | - { | |
212 | 295 | |
213 | - } | |
296 | + public function actionProjects() | |
297 | + { | |
298 | + return $this->render('projects'); | |
299 | + } | |
214 | 300 | |
215 | - public function actionGetForm($lastindex) | |
216 | - { | |
217 | - return $this->renderAjax('_job_form', ['index' => $lastindex+1]); | |
218 | - } | |
301 | + public function actionGallery() | |
302 | + { | |
219 | 303 | |
220 | - /** | |
221 | - * @param $id | |
222 | - * @return User | |
223 | - * @throws NotFoundHttpException | |
224 | - */ | |
225 | - protected function findUser($id) | |
226 | - { | |
304 | + } | |
227 | 305 | |
228 | - if ($model = User::findOne(["id"=>$id])) { | |
229 | - return $model; | |
230 | - } else { | |
231 | - throw new NotFoundHttpException('The requested page does not exist.'); | |
306 | + public function actionGetForm($lastindex) | |
307 | + { | |
308 | + return $this->renderAjax('_job_form', [ 'index' => $lastindex + 1 ]); | |
232 | 309 | } |
233 | - } | |
234 | 310 | |
311 | + /** | |
312 | + * @param $id | |
313 | + * | |
314 | + * @return User | |
315 | + * @throws NotFoundHttpException | |
316 | + */ | |
317 | + protected function findUser($id) | |
318 | + { | |
235 | 319 | |
320 | + if($model = User::findOne([ "id" => $id ])) { | |
321 | + return $model; | |
322 | + } else { | |
323 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
324 | + } | |
325 | + } | |
236 | 326 | |
237 | -} | |
327 | + } | ... | ... |
frontend/views/accounts/add-skills.php
... | ... | @@ -4,23 +4,14 @@ use yii\helpers\Html; |
4 | 4 | use yii\widgets\ActiveForm; |
5 | 5 | use \common\widgets\MultiLangForm; |
6 | 6 | |
7 | - $this->title = 'Мой профиль'; | |
7 | + $this->title = 'Дополнительные навыки'; | |
8 | 8 | $this->params['breadcrumbs'][] = $this->title; |
9 | 9 | ?> |
10 | - | |
11 | 10 | <h1><?= $this->title ?></h1> |
12 | - | |
13 | - | |
14 | - | |
15 | 11 | <?php |
16 | - | |
17 | -$form = $this->render('_form', [ | |
18 | - 'user' => $user, | |
19 | - 'user_info' => $user_info, | |
20 | -]); | |
21 | - | |
22 | -echo MultiLangForm::widget(['form'=>$form]); | |
23 | - | |
12 | + $form = ActiveForm::begin(); | |
24 | 13 | ?> |
25 | 14 | |
26 | - | |
15 | +<?php | |
16 | + $form->end(); | |
17 | +?> | |
27 | 18 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var UserInfo $user_info | |
4 | + * @var User $user | |
5 | + * @var CompanyInfo $company_info | |
6 | + */ | |
7 | + use common\models\CompanyInfo; | |
8 | + use common\models\User; | |
9 | + use common\models\UserInfo; | |
10 | + use common\widgets\ImageUploader; | |
11 | + use mihaildev\ckeditor\CKEditor; | |
12 | + use yii\helpers\Html; | |
13 | + use yii\widgets\ActiveForm; | |
14 | + | |
15 | + $this->title = 'Описание'; | |
16 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
17 | +?> | |
18 | +<h1><?= $this->title ?></h1> | |
19 | + <?php | |
20 | + $form = ActiveForm::begin(); | |
21 | + ?> | |
22 | + <?= $form->field($user_info, 'about')->label(false)->widget(CKEditor::className()) ?> | |
23 | + <?= Html::submitButton('Обновить', [ 'class' => 'btn btn-primary' ]) ?> | |
24 | + <?php | |
25 | + $form->end(); | |
26 | + ?> | ... | ... |
frontend/views/accounts/general.php
... | ... | @@ -5,90 +5,101 @@ |
5 | 5 | * @var CompanyInfo $company_info |
6 | 6 | */ |
7 | 7 | use common\models\CompanyInfo; |
8 | - use common\models\Option; | |
9 | 8 | use common\models\User; |
10 | 9 | use common\models\UserInfo; |
11 | 10 | use common\widgets\ImageUploader; |
12 | 11 | use yii\helpers\Html; |
13 | 12 | use yii\widgets\ActiveForm; |
14 | - use \common\widgets\MultiLangForm; | |
15 | 13 | |
16 | 14 | $this->title = 'Учетные данные'; |
17 | - $this->params['breadcrumbs'][] = $this->title; | |
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
18 | 16 | ?> |
19 | 17 | <h1><?= $this->title ?></h1> |
20 | 18 | <div class="" id="form_definition"> |
21 | 19 | <?php |
22 | - | |
23 | - $form = ActiveForm::begin (); | |
24 | - echo $form->field ($user, 'isPerformer', ['template' => "{label}:\n{input}\n{hint}\n{error}"]) | |
25 | - ->label ('<span></span>Я - исполнитель') | |
26 | - ->hint ('Отображается если указать специализации услуг в личном кабинете.') | |
27 | - ->checkbox ([], false); | |
28 | - echo $form->field ($user, 'isCustomer', ['template' => "{label}:\n{input}\n{hint}\n{error}"]) | |
29 | - ->label ('Я - заказчик') | |
30 | - ->hint ('Отображается если созданы заказы.') | |
31 | - ->checkbox ([], false); | |
32 | - echo $form->field ($user, 'type') | |
33 | - ->label ('Кто вы') | |
34 | - ->radioList ([1 => 'Частное лицо', 2 => 'Компания']); | |
35 | - echo $form->field ($company_info, 'name', ['options' => ['class' => 'form-group company_info']]) | |
36 | - ->label ('Название компании') | |
37 | - ->textInput (); | |
38 | - echo $form->field ($company_info, 'staff', ['options' => ['class' => 'form-group company_info']]) | |
39 | - ->label ('Количество сотрудников') | |
40 | - ->input ('number'); | |
41 | - echo '<div class="company_info">Контакты представителя</div>'; | |
42 | - echo $form->field ($user, 'lastname') | |
43 | - ->label ('Фамилия') | |
44 | - ->textInput (); | |
45 | - echo $form->field ($user, 'firstname') | |
46 | - ->label ('Имя') | |
47 | - ->textInput (); | |
48 | - echo $form->field ($user_info, 'country') | |
49 | - ->label ('Ваша страна') | |
50 | - ->textInput (); | |
51 | - echo $form->field ($user_info, 'city') | |
52 | - ->label ('Ваш город') | |
53 | - ->textInput (); | |
54 | - echo $form->field ($company_info, 'street', ['options' => ['class' => 'form-group company_info']]) | |
55 | - ->label ('Улица') | |
56 | - ->textInput (); | |
57 | - echo $form->field ($company_info, 'house', ['options' => ['class' => 'form-group company_info']]) | |
58 | - ->label ('Дом') | |
59 | - ->textInput (); | |
60 | - echo $form->field ($user, 'email') | |
61 | - ->label ('Email') | |
62 | - ->textInput (['disabled' => 'disabled']); | |
63 | - echo $form->field ($company_info, 'hide_mail', ['options' => ['class' => 'form-group company_info'], 'template' => "{input}{label}\n{hint}\n{error}"]) | |
64 | - ->label ('Не публиковать Email') | |
65 | - ->checkbox ([], false); | |
66 | - echo $form->field ($user_info, 'busy') | |
67 | - ->label ('Статус') | |
68 | - ->radioList ([0 => 'Свободен', 1 => 'Занят']); | |
69 | - echo $form->field ($user_info, 'member') | |
70 | - ->label ('Членство в МФП') | |
71 | - ->hint ('Выберите если хотите стать членом МФП и наш менеджер свяжется с Вами.') | |
72 | - ->radioList ([0 => 'Не хочу', 1 => 'Хочу стать']); | |
73 | - echo ImageUploader::widget([ | |
74 | - 'model'=> $user_info, | |
75 | - 'field'=>'image', | |
76 | - 'width'=>100, | |
77 | - 'height'=>100, | |
78 | - 'multi'=>false, | |
79 | - 'gallery' =>$user_info->image, | |
80 | - 'name' => 'Загрузить аватар' | |
81 | - ]); | |
82 | - echo ImageUploader::widget([ | |
83 | - 'model'=> $user_info, | |
84 | - 'field'=>'poster', | |
85 | - 'width'=>1200, | |
86 | - 'height'=>600, | |
87 | - 'multi'=>false, | |
88 | - 'gallery' =>$user_info->poster, | |
89 | - 'name' => 'Загрузить постер' | |
90 | - ]); | |
91 | - echo Html::submitButton('Обновить', ['class' => 'btn btn-primary']); | |
92 | - $form->end (); | |
20 | + $form = ActiveForm::begin(); | |
21 | + ?> | |
22 | + <?= $form->field($user, 'isPerformer', [ 'template' => "{label}:\n{input}\n{hint}\n{error}" ]) | |
23 | + ->label('<span></span>Я - исполнитель') | |
24 | + ->hint('Отображается если указать специализации услуг в личном кабинете.') | |
25 | + ->checkbox([ ], false) ?> | |
26 | + <?= $form->field($user, 'isCustomer', [ 'template' => "{label}:\n{input}\n{hint}\n{error}" ]) | |
27 | + ->label('Я - заказчик') | |
28 | + ->hint('Отображается если созданы заказы.') | |
29 | + ->checkbox([ ], false) ?> | |
30 | + <?= $form->field($user, 'type') | |
31 | + ->label('Кто вы') | |
32 | + ->radioList([ | |
33 | + 1 => 'Частное лицо', | |
34 | + 2 => 'Компания', | |
35 | + ]) ?> | |
36 | + <?= $form->field($company_info, 'name', [ 'options' => [ 'class' => 'form-group company_info' ] ]) | |
37 | + ->label('Название компании') | |
38 | + ->textInput() ?> | |
39 | + <?= $form->field($company_info, 'staff', [ 'options' => [ 'class' => 'form-group company_info' ] ]) | |
40 | + ->label('Количество сотрудников') | |
41 | + ->input('number') ?> | |
42 | + <div class="company_info">Контакты представителя</div> | |
43 | + <?= $form->field($user, 'lastname') | |
44 | + ->label('Фамилия') | |
45 | + ->textInput() ?> | |
46 | + <?= $form->field($user, 'firstname') | |
47 | + ->label('Имя') | |
48 | + ->textInput() ?> | |
49 | + <?= $form->field($user_info, 'country') | |
50 | + ->label('Ваша страна') | |
51 | + ->textInput() ?> | |
52 | + <?= $form->field($user_info, 'city') | |
53 | + ->label('Ваш город') | |
54 | + ->textInput() ?> | |
55 | + <?= $form->field($company_info, 'street', [ 'options' => [ 'class' => 'form-group company_info' ] ]) | |
56 | + ->label('Улица') | |
57 | + ->textInput() ?> | |
58 | + <?= $form->field($company_info, 'house', [ 'options' => [ 'class' => 'form-group company_info' ] ]) | |
59 | + ->label('Дом') | |
60 | + ->textInput() ?> | |
61 | + <?= $form->field($user, 'email') | |
62 | + ->label('Email') | |
63 | + ->textInput([ 'disabled' => 'disabled' ]) ?> | |
64 | + <?= $form->field($company_info, 'hide_mail', [ | |
65 | + 'options' => [ 'class' => 'form-group company_info' ], | |
66 | + 'template' => "{input}{label}\n{hint}\n{error}", | |
67 | + ]) | |
68 | + ->label('Не публиковать Email') | |
69 | + ->checkbox([ ], false) ?> | |
70 | + <?= $form->field($user_info, 'busy') | |
71 | + ->label('Статус') | |
72 | + ->radioList([ | |
73 | + 0 => 'Свободен', | |
74 | + 1 => 'Занят', | |
75 | + ]) ?> | |
76 | + <?= $form->field($user_info, 'member') | |
77 | + ->label('Членство в МФП') | |
78 | + ->hint('Выберите если хотите стать членом МФП и наш менеджер свяжется с Вами.') | |
79 | + ->radioList([ | |
80 | + 0 => 'Не хочу', | |
81 | + 1 => 'Хочу стать', | |
82 | + ]) ?> | |
83 | + <?= ImageUploader::widget([ | |
84 | + 'model' => $user_info, | |
85 | + 'field' => 'image', | |
86 | + 'width' => 100, | |
87 | + 'height' => 100, | |
88 | + 'multi' => false, | |
89 | + 'gallery' => $user_info->image, | |
90 | + 'name' => 'Загрузить аватар', | |
91 | + ]) ?> | |
92 | + <?= ImageUploader::widget([ | |
93 | + 'model' => $user_info, | |
94 | + 'field' => 'poster', | |
95 | + 'width' => 1200, | |
96 | + 'height' => 600, | |
97 | + 'multi' => false, | |
98 | + 'gallery' => $user_info->poster, | |
99 | + 'name' => 'Загрузить постер', | |
100 | + ]) ?> | |
101 | + <?= Html::submitButton('Обновить', [ 'class' => 'btn btn-primary' ]) ?> | |
102 | + <?php | |
103 | + $form->end(); | |
93 | 104 | ?> |
94 | 105 | </div> | ... | ... |
frontend/views/accounts/service.php
1 | 1 | <?php |
2 | + /** | |
3 | + * @var UserInfo $user_info | |
4 | + * @var string[] $specialization | |
5 | + * @var integer[] $user_specialization | |
6 | + * @var UserSpecialization $user_specialization_input | |
7 | + * @var string[] $payment | |
8 | + * @var integer[] $user_payment | |
9 | + * @var UserPayment $user_payment_input | |
10 | + */ | |
11 | + use common\models\UserInfo; | |
12 | + use common\models\UserPayment; | |
13 | + use common\models\UserSpecialization; | |
14 | + use yii\helpers\Html; | |
15 | + use yii\widgets\ActiveForm; | |
16 | + | |
2 | 17 | $this->title = 'Мой профиль'; |
3 | - $this->params['breadcrumbs'][] = $this->title; | |
18 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
19 | + $user_specialization_input->specialization_id = $user_specialization; | |
20 | + $user_payment_input->payment_id = $user_payment; | |
4 | 21 | ?> |
5 | - | |
6 | 22 | <h1><?= $this->title ?></h1> |
7 | - | |
8 | - | |
9 | - | |
10 | - | |
23 | +<p>Рекомендуем детально заполнить для исполнителя. Это сильно влияет на количество заказов.</p> | |
24 | +<?php | |
25 | + $form = ActiveForm::begin(); | |
26 | +?> | |
27 | +<?= $form->field($user_info, 'salary', [ | |
28 | + 'template' => "{label}: от {input} за час\n{hint}\n{error}", | |
29 | + 'options' => [ 'class' => 'form-inline' ], | |
30 | +]) | |
31 | + ->label('Стоимость работ') | |
32 | + ->textInput() ?> | |
33 | +<?= $form->field($user_specialization_input, 'specialization_id') | |
34 | + ->label('Специализация услуг') | |
35 | + ->checkboxList($specialization) ?> | |
36 | +<?= $form->field($user_info, 'guarantee', [ | |
37 | + 'template' => "{label}: {input} лет\n{hint}\n{error}", | |
38 | + 'options' => [ 'class' => 'form-inline' ], | |
39 | +]) | |
40 | + ->label('Гарантия качества работ') | |
41 | + ->textInput() ?> | |
42 | +<?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ]) | |
43 | + ->label('Работа по договору') | |
44 | + ->radioList([ | |
45 | + 0 => 'Да', | |
46 | + 1 => 'Нет', | |
47 | + ], [ 'class' => 'form-control-static' ]) ?> | |
48 | +<?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ]) | |
49 | + ->label('Предоставляете смету') | |
50 | + ->radioList([ | |
51 | + 0 => 'Да', | |
52 | + 1 => 'Нет', | |
53 | + ], [ 'class' => 'form-control-static' ]) ?> | |
54 | +<?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ]) | |
55 | + ->label('Делаете сами закупку материалов') | |
56 | + ->radioList([ | |
57 | + 0 => 'Да', | |
58 | + 1 => 'Нет', | |
59 | + ], [ 'class' => 'form-control-static' ]) ?> | |
60 | +<?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ]) | |
61 | + ->label('Занимаетесь сами доставкой материалов') | |
62 | + ->radioList([ | |
63 | + 0 => 'Да', | |
64 | + 1 => 'Нет', | |
65 | + ], [ 'class' => 'form-control-static' ]) ?> | |
66 | +<?= $form->field($user_info, 'prepayment', [ | |
67 | + 'template' => "{label}: {input} %\n{hint}\n{error}", | |
68 | + 'options' => [ 'class' => 'form-inline' ], | |
69 | +]) | |
70 | + ->label('Минимальная предоплата за работы') | |
71 | + ->textInput() ?> | |
72 | +<?= $form->field($user_payment_input, 'payment_id') | |
73 | + ->label('Способы оплаты') | |
74 | + ->checkboxList($payment) ?> | |
75 | +<?= Html::submitButton('Обновить') ?> | |
76 | +<?php | |
77 | + $form->end(); | |
78 | +?> | ... | ... |
frontend/views/layouts/admin.php
... | ... | @@ -28,6 +28,10 @@ $this->beginContent('@app/views/layouts/main.php'); |
28 | 28 | 'url' => ['accounts/general'], |
29 | 29 | ], |
30 | 30 | [ |
31 | + 'label' => 'Описание', | |
32 | + 'url' => ['accounts/description'], | |
33 | + ], | |
34 | + [ | |
31 | 35 | 'label' => 'Портфолио', |
32 | 36 | 'url' => ['accounts/portfolio'], |
33 | 37 | ], | ... | ... |