Commit 62b5fbaa58ca44172761de569dec2cbc6b36092d
Merge conflict
Showing
11 changed files
with
309 additions
and
151 deletions
Show diff stats
common/config/main.php
frontend/assets/AppAsset.php
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | public $baseUrl = '@web'; | 13 | public $baseUrl = '@web'; |
14 | public $css = [ | 14 | public $css = [ |
15 | 'css/style.css', | 15 | 'css/style.css', |
16 | - '//fonts.googleapis.com/css?family=Ubuntu:400,500,700&subset=cyrillic,cyrillic-ext,latin-ext' | 16 | +// '//fonts.googleapis.com/css?family=Ubuntu:400,500,700&subset=cyrillic,cyrillic-ext,latin-ext' |
17 | ]; | 17 | ]; |
18 | public $js = [ | 18 | public $js = [ |
19 | 'js/script.js', | 19 | 'js/script.js', |
frontend/config/main.php
@@ -192,7 +192,7 @@ | @@ -192,7 +192,7 @@ | ||
192 | document.getElementById("comment-form").reset(); | 192 | document.getElementById("comment-form").reset(); |
193 | var data = $("#comment-form").data(\'yiiActiveForm\'); | 193 | var data = $("#comment-form").data(\'yiiActiveForm\'); |
194 | $("#comment-form").find(".submit-close-c-a span").click(); | 194 | $("#comment-form").find(".submit-close-c-a span").click(); |
195 | - $("#comment-form").parent().parent().parent().find(".service-c-a-btns").after("<p>Ваш отзыв появиться после проверки модератором</p>") | 195 | + $("#comment-form").parent().parent().parent().find(".service-c-a-btns").after("<p>Ваш отзыв появится после проверки модератором</p>") |
196 | data.validated = false; | 196 | data.validated = false; |
197 | }', | 197 | }', |
198 | 198 |
frontend/controllers/ServiceController.php
@@ -20,14 +20,14 @@ | @@ -20,14 +20,14 @@ | ||
20 | public function actionView($id){ | 20 | public function actionView($id){ |
21 | $model = $this->findModel($id); | 21 | $model = $this->findModel($id); |
22 | if ($model->parent_id == null){ | 22 | if ($model->parent_id == null){ |
23 | - $others = Service::find()->where(['parent_id' => $model->id])->with('services.language.alias')->all(); | 23 | + $others = Service::find()->where(['parent_id' => $model->id])->with(['services.language.alias', 'language.alias'])->all(); |
24 | if (empty($others)){ | 24 | if (empty($others)){ |
25 | - $others = Service::find()->where(['parent_id' => null, 'status' => true])->all(); | 25 | + $others = Service::find()->where(['parent_id' => null, 'status' => true])->with(['services.language.alias', 'language.alias'])->all(); |
26 | } | 26 | } |
27 | }elseif ($model->level == 1){ | 27 | }elseif ($model->level == 1){ |
28 | - $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services.language.alias')->all(); | 28 | + $others = Service::find()->where(['parent_id' => $model->parent_id])->with(['services.language.alias', 'language.alias'])->all(); |
29 | }else{ | 29 | }else{ |
30 | - $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with('services.language.alias')->all(); | 30 | + $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with(['services.language.alias', 'language.alias'])->all(); |
31 | } | 31 | } |
32 | 32 | ||
33 | 33 | ||
@@ -82,13 +82,13 @@ | @@ -82,13 +82,13 @@ | ||
82 | $model = Service::find() | 82 | $model = Service::find() |
83 | ->where(['id' => $id, 'status' => true]) | 83 | ->where(['id' => $id, 'status' => true]) |
84 | ->with(['language.alias', 'prices' => function (ActiveQuery $query){ | 84 | ->with(['language.alias', 'prices' => function (ActiveQuery $query){ |
85 | - $query->where(['status' => true])->orderBy('sort'); | 85 | + $query->where(['status' => true])->with('language')->orderBy('sort'); |
86 | }, 'comments' => function (ActiveQuery $query){ | 86 | }, 'comments' => function (ActiveQuery $query){ |
87 | $query->where(['status' => true]); | 87 | $query->where(['status' => true]); |
88 | }, 'questions' => function (ActiveQuery $query){ | 88 | }, 'questions' => function (ActiveQuery $query){ |
89 | $query->where(['status' => true])->with('doctor'); | 89 | $query->where(['status' => true])->with('doctor'); |
90 | },'packages' => function (ActiveQuery $query){ | 90 | },'packages' => function (ActiveQuery $query){ |
91 | - $query->with(['image', 'language'])->where(['status' => true]); | 91 | + $query->with(['image', 'language.alias'])->where(['status' => true]); |
92 | }])->one(); | 92 | }])->one(); |
93 | if (empty($model)){ | 93 | if (empty($model)){ |
94 | throw new NotFoundHttpException('Model not found'); | 94 | throw new NotFoundHttpException('Model not found'); |
frontend/controllers/SiteController.php
1 | <?php | 1 | <?php |
2 | + | ||
2 | namespace frontend\controllers; | 3 | namespace frontend\controllers; |
3 | 4 | ||
4 | use artbox\core\models\Alias; | 5 | use artbox\core\models\Alias; |
@@ -15,13 +16,11 @@ | @@ -15,13 +16,11 @@ | ||
15 | use yii\db\ActiveQuery; | 16 | use yii\db\ActiveQuery; |
16 | use yii\db\Expression; | 17 | use yii\db\Expression; |
17 | use yii\filters\VerbFilter; | 18 | use yii\filters\VerbFilter; |
18 | - use yii\helpers\ArrayHelper; | ||
19 | use yii\helpers\Json; | 19 | use yii\helpers\Json; |
20 | use yii\swiftmailer\Mailer; | 20 | use yii\swiftmailer\Mailer; |
21 | use yii\web\BadRequestHttpException; | 21 | use yii\web\BadRequestHttpException; |
22 | use yii\web\Controller; | 22 | use yii\web\Controller; |
23 | use yii\web\Response; | 23 | use yii\web\Response; |
24 | - use yii\helpers\VarDumper as d; | ||
25 | 24 | ||
26 | /** | 25 | /** |
27 | * Site controller | 26 | * Site controller |
@@ -62,34 +61,70 @@ | @@ -62,34 +61,70 @@ | ||
62 | */ | 61 | */ |
63 | public function actionIndex() | 62 | public function actionIndex() |
64 | { | 63 | { |
65 | - $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->with('language.image')->all(); | ||
66 | - $services = Service::find()->where(['is not' ,'image_id', NULL])->andWhere( | 64 | + $slides = Slide::find() |
65 | + ->with('language') | ||
66 | + ->where([ 'status' => true ]) | ||
67 | + ->orderBy('sort') | ||
68 | + ->with('language.image') | ||
69 | + ->all(); | ||
70 | + $services = Service::find() | ||
71 | + ->where( | ||
72 | + [ | ||
73 | + 'is not', | ||
74 | + 'image_id', | ||
75 | + null, | ||
76 | + ] | ||
77 | + ) | ||
78 | + ->andWhere( | ||
79 | + [ | ||
80 | + 'status' => true, | ||
81 | + 'level' => 0, | ||
82 | + ] | ||
83 | + ) | ||
84 | + ->with( | ||
85 | + [ | ||
86 | + 'image', | ||
87 | + 'language.alias', | ||
88 | + 'services' => function (ActiveQuery $query) { | ||
89 | + $query->where([ 'status' => true ]) | ||
90 | + ->with([ 'language.alias' ]); | ||
91 | + }, | ||
92 | + ] | ||
93 | + ) | ||
94 | + ->orderBy([ new Expression('sort ASC NULLS LAST') ]) | ||
95 | + ->all(); | ||
96 | + $comments = Comment::find() | ||
97 | + ->where( | ||
98 | + [ | ||
99 | + 'status' => true, | ||
100 | + 'on_main' => true, | ||
101 | + ] | ||
102 | + ) | ||
103 | + ->limit(6) | ||
104 | + ->all(); | ||
105 | + | ||
106 | + $package = Package::find() | ||
107 | + ->with( | ||
108 | + [ | ||
109 | + 'language.alias', | ||
110 | + 'image', | ||
111 | + ] | ||
112 | + ) | ||
113 | + ->where([ 'status' => true ]) | ||
114 | + ->orderBy('sort') | ||
115 | + ->limit(3) | ||
116 | + ->all(); | ||
117 | + $settings = Settings::getInstance(); | ||
118 | + return $this->render( | ||
119 | + 'index', | ||
67 | [ | 120 | [ |
68 | - 'status' => true, | ||
69 | - 'level' => 0, | 121 | + 'slides' => $slides, |
122 | + 'services' => $services, | ||
123 | + 'comments' => $comments, | ||
124 | + 'settings' => $settings, | ||
125 | + 'package' => $package, | ||
70 | ] | 126 | ] |
71 | - ) | ||
72 | - ->with( | ||
73 | - [ | ||
74 | - 'image', | ||
75 | - 'language.alias', | ||
76 | - 'services' => function (ActiveQuery $query) { | ||
77 | - $query->where(['status' => true])->with(['language.alias']); | ||
78 | - }, | ||
79 | - ] | ||
80 | - )->orderBy([ new Expression('sort ASC NULLS LAST') ]) | ||
81 | - ->all(); | ||
82 | - $comments = Comment::find()->where(['status' => true, 'on_main' => true])->limit(6)->all(); | ||
83 | - | ||
84 | - $package = Package::find()->with(['language.alias'])->where(['status' => true])->orderBy('sort')->limit(3)->all(); | ||
85 | - $settings = Settings::getInstance(); | ||
86 | - return $this->render('index', [ | ||
87 | - 'slides' => $slides, | ||
88 | - 'services' => $services, | ||
89 | - 'comments' => $comments, | ||
90 | - 'settings' => $settings, | ||
91 | - 'package' => $package | ||
92 | - ]); | 127 | + ); |
93 | } | 128 | } |
94 | 129 | ||
95 | /** | 130 | /** |
@@ -104,8 +139,8 @@ | @@ -104,8 +139,8 @@ | ||
104 | return $this->render( | 139 | return $this->render( |
105 | 'contact', | 140 | 'contact', |
106 | [ | 141 | [ |
107 | - 'contact' => $contact, | ||
108 | - 'settings' => $settings | 142 | + 'contact' => $contact, |
143 | + 'settings' => $settings, | ||
109 | ] | 144 | ] |
110 | ); | 145 | ); |
111 | } | 146 | } |
@@ -186,115 +221,157 @@ | @@ -186,115 +221,157 @@ | ||
186 | } | 221 | } |
187 | } | 222 | } |
188 | } | 223 | } |
189 | - public function actionPrices(){ | ||
190 | - $services = Service::find()->innerJoinWith(['prices' => function (ActiveQuery $query){ | ||
191 | - $query->where(['price.status' => true]); | ||
192 | - }])->all(); | 224 | + public function actionPrices() |
225 | + { | ||
226 | + $services = Service::find() | ||
227 | + ->innerJoinWith( | ||
228 | + [ | ||
229 | + 'prices' => function (ActiveQuery $query) { | ||
230 | + $query->where([ 'price.status' => true ]) | ||
231 | + ->with('language'); | ||
232 | + }, | ||
233 | + ] | ||
234 | + ) | ||
235 | + ->with('language.alias') | ||
236 | + ->all(); | ||
193 | 237 | ||
194 | - return $this->render('prices', [ | ||
195 | - 'services' => $services, | ||
196 | - ]); | 238 | + return $this->render( |
239 | + 'prices', | ||
240 | + [ | ||
241 | + 'services' => $services, | ||
242 | + ] | ||
243 | + ); | ||
197 | } | 244 | } |
198 | 245 | ||
199 | - | ||
200 | - public function actionPage1(){ | 246 | + public function actionPage1() |
247 | + { | ||
201 | return $this->render('page1'); | 248 | return $this->render('page1'); |
202 | } | 249 | } |
203 | - | ||
204 | - public function actionPage2(){ | 250 | + |
251 | + public function actionPage2() | ||
252 | + { | ||
205 | return $this->render('page2'); | 253 | return $this->render('page2'); |
206 | } | 254 | } |
207 | - | ||
208 | - public function actionPage22(){ | 255 | + |
256 | + public function actionPage22() | ||
257 | + { | ||
209 | return $this->render('page2-2'); | 258 | return $this->render('page2-2'); |
210 | } | 259 | } |
211 | - | ||
212 | - public function actionPage23(){ | 260 | + |
261 | + public function actionPage23() | ||
262 | + { | ||
213 | return $this->render('page2-3'); | 263 | return $this->render('page2-3'); |
214 | } | 264 | } |
215 | - | ||
216 | - public function actionPage3(){ | 265 | + |
266 | + public function actionPage3() | ||
267 | + { | ||
217 | return $this->render('page3'); | 268 | return $this->render('page3'); |
218 | } | 269 | } |
219 | - | ||
220 | - public function actionPage4(){ | 270 | + |
271 | + public function actionPage4() | ||
272 | + { | ||
221 | return $this->render('page4'); | 273 | return $this->render('page4'); |
222 | } | 274 | } |
223 | - | ||
224 | - public function actionPage5(){ | 275 | + |
276 | + public function actionPage5() | ||
277 | + { | ||
225 | return $this->render('page5'); | 278 | return $this->render('page5'); |
226 | } | 279 | } |
227 | - | ||
228 | - public function actionPage6(){ | 280 | + |
281 | + public function actionPage6() | ||
282 | + { | ||
229 | return $this->render('page6'); | 283 | return $this->render('page6'); |
230 | } | 284 | } |
231 | - | ||
232 | 285 | ||
233 | - | ||
234 | # Вопрос/ответ | 286 | # Вопрос/ответ |
235 | - public function actionQuestions($service_id = null){ | 287 | + public function actionQuestions($service_id = null) |
288 | + { | ||
236 | Language::getCurrent(); | 289 | Language::getCurrent(); |
237 | 290 | ||
238 | - if (\Yii::$app->request->isAjax){ | 291 | + if (\Yii::$app->request->isAjax) { |
239 | Yii::$app->response->format = Response::FORMAT_JSON; | 292 | Yii::$app->response->format = Response::FORMAT_JSON; |
240 | $model = new Question(); | 293 | $model = new Question(); |
241 | $model->scenario = Question::SCENARIO_QUESTION; | 294 | $model->scenario = Question::SCENARIO_QUESTION; |
242 | - if ($model->load(\Yii::$app->request->post()) and $model->save()){ | 295 | + if ($model->load(\Yii::$app->request->post()) and $model->save()) { |
243 | return [ | 296 | return [ |
244 | - 'status' => true, | ||
245 | - 'message' => 'Спасибо за Ваш вопрос' | 297 | + 'status' => true, |
298 | + 'message' => 'Спасибо за Ваш вопрос', | ||
246 | ]; | 299 | ]; |
247 | - }else{ | 300 | + } else { |
248 | return [ | 301 | return [ |
249 | - 'status' => false, | ||
250 | - 'message' => 'Ошибка' | 302 | + 'status' => false, |
303 | + 'message' => 'Ошибка', | ||
251 | ]; | 304 | ]; |
252 | } | 305 | } |
253 | } | 306 | } |
254 | - $dataProvider = new ActiveDataProvider([ | ||
255 | - 'query' => Question::find()->where(['status' => true])->andFilterWhere(['service_id' => $service_id])->with(['doctor.language']), | ||
256 | - 'pagination' => [ | ||
257 | - 'pageSize' => 10, | ||
258 | - ], | ||
259 | - ]); | ||
260 | - $services = Service::find()->where(['status' => true])->andWhere(['parent_id' => null])->all(); | 307 | + $dataProvider = new ActiveDataProvider( |
308 | + [ | ||
309 | + 'query' => Question::find() | ||
310 | + ->where([ 'status' => true ]) | ||
311 | + ->andFilterWhere([ 'service_id' => $service_id ]) | ||
312 | + ->with([ 'doctor.language' ]), | ||
313 | + 'pagination' => [ | ||
314 | + 'pageSize' => 10, | ||
315 | + ], | ||
316 | + ] | ||
317 | + ); | ||
318 | + $services = Service::find() | ||
319 | + ->where([ 'status' => true ]) | ||
320 | + ->andWhere([ 'parent_id' => null ]) | ||
321 | + ->with('language') | ||
322 | + ->all(); | ||
261 | $route = []; | 323 | $route = []; |
262 | - foreach ($services as $service){ | ||
263 | - $route[] = Json::encode(['site/questions', 'service_id' => $service->id]); | 324 | + foreach ($services as $service) { |
325 | + $route[] = Json::encode( | ||
326 | + [ | ||
327 | + 'site/questions', | ||
328 | + 'service_id' => $service->id, | ||
329 | + ] | ||
330 | + ); | ||
264 | } | 331 | } |
265 | $route [] = '{"0":"site/questions"}'; | 332 | $route [] = '{"0":"site/questions"}'; |
266 | - $alias = Alias::find()->where(['route' => $route])->andWhere(['language_id' => Language::getCurrent()->id])->indexBy('route')->asArray()->all(); | ||
267 | - return $this->render('questions', [ | ||
268 | - 'dataProvider' => $dataProvider, | ||
269 | - 'services' => $services, | ||
270 | - 'service_id' => $service_id, | ||
271 | - 'alias' => $alias | ||
272 | - ]); | 333 | + $alias = Alias::find() |
334 | + ->where([ 'route' => $route ]) | ||
335 | + ->andWhere([ 'language_id' => Language::getCurrent()->id ]) | ||
336 | + ->indexBy('route') | ||
337 | + ->asArray() | ||
338 | + ->all(); | ||
339 | + return $this->render( | ||
340 | + 'questions', | ||
341 | + [ | ||
342 | + 'dataProvider' => $dataProvider, | ||
343 | + 'services' => $services, | ||
344 | + 'service_id' => $service_id, | ||
345 | + 'alias' => $alias, | ||
346 | + ] | ||
347 | + ); | ||
273 | } | 348 | } |
274 | - | ||
275 | - public function actionComments($service_id = null){ | ||
276 | - | ||
277 | - if (\Yii::$app->request->isAjax){ | 349 | + |
350 | + public function actionComments($service_id = null) | ||
351 | + { | ||
352 | + | ||
353 | + if (\Yii::$app->request->isAjax) { | ||
278 | Yii::$app->response->format = Response::FORMAT_JSON; | 354 | Yii::$app->response->format = Response::FORMAT_JSON; |
279 | $model = new Comment(); | 355 | $model = new Comment(); |
280 | #if ($model->load(\Yii::$app->request->post()) and $model->save()){ | 356 | #if ($model->load(\Yii::$app->request->post()) and $model->save()){ |
281 | - if ($model->load(\Yii::$app->request->post())){ | ||
282 | - if(!$model->entity_id)$model->entity_id=0; | ||
283 | - $model->entity=Service::className(); | 357 | + if ($model->load(\Yii::$app->request->post())) { |
358 | + if (!$model->entity_id) { | ||
359 | + $model->entity_id = 0; | ||
360 | + } | ||
361 | + $model->entity = Service::className(); | ||
284 | $model->save(); | 362 | $model->save(); |
285 | return [ | 363 | return [ |
286 | - 'status' => true, | ||
287 | - 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появиться на сайте' | 364 | + 'status' => true, |
365 | + 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появится на сайте', | ||
288 | ]; | 366 | ]; |
289 | - }else{ | 367 | + } else { |
290 | return [ | 368 | return [ |
291 | - 'status' => false, | ||
292 | - 'message' => 'Ошибка' | 369 | + 'status' => false, |
370 | + 'message' => 'Ошибка', | ||
293 | ]; | 371 | ]; |
294 | } | 372 | } |
295 | } | 373 | } |
296 | - | ||
297 | - | 374 | + |
298 | # подкоректировал логику для сохранрения в БД/выдачи вопросов с категории "Общие вопросы" | 375 | # подкоректировал логику для сохранрения в БД/выдачи вопросов с категории "Общие вопросы" |
299 | # закрепил за ними entity_id=0 | 376 | # закрепил за ними entity_id=0 |
300 | if($service_id==null)$service_id=0; | 377 | if($service_id==null)$service_id=0; |
frontend/views/layouts/main.php
@@ -55,7 +55,14 @@ | @@ -55,7 +55,14 @@ | ||
55 | [ | 55 | [ |
56 | 'language.alias', | 56 | 'language.alias', |
57 | 'services' => function (ActiveQuery $query) { | 57 | 'services' => function (ActiveQuery $query) { |
58 | - $query->where(['status' => true])->with(['language.alias']); | 58 | + $query->where(['status' => true])->with( |
59 | + [ | ||
60 | + 'language.alias', | ||
61 | + 'services' => function (ActiveQuery $query) { | ||
62 | + $query->where(['status' => true])->with(['language.alias']); | ||
63 | + }, | ||
64 | + ] | ||
65 | + ); | ||
59 | }, | 66 | }, |
60 | ] | 67 | ] |
61 | )->orderBy('sort') | 68 | )->orderBy('sort') |
@@ -133,39 +140,56 @@ $this->registerMetaTag( | @@ -133,39 +140,56 @@ $this->registerMetaTag( | ||
133 | <?php $this->beginPage() ?> | 140 | <?php $this->beginPage() ?> |
134 | <!DOCTYPE html > | 141 | <!DOCTYPE html > |
135 | <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>"> | 142 | <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>"> |
136 | - <head> | 143 | + <head> |
144 | + | ||
145 | + <script type="text/javascript"> | ||
146 | + WebFontConfig = { | ||
147 | + google: {families: [ 'Ubuntu:400,500,700' ]} | ||
148 | + }; | ||
149 | + (function() { | ||
150 | + var wf = document.createElement('script'); | ||
151 | + wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js'; | ||
152 | + wf.type = 'text/javascript'; | ||
153 | + wf.async = 'true'; | ||
154 | + var s = document.getElementsByTagName('script')[ 0 ]; | ||
155 | + s.parentNode.insertBefore(wf, s); | ||
156 | + })(); </script> | ||
157 | + | ||
158 | + <script> | ||
137 | 159 | ||
138 | - <meta charset="utf-8"> | ||
139 | <!-- Global site tag (gtag.js) - Google Analytics --> | 160 | <!-- Global site tag (gtag.js) - Google Analytics --> |
140 | <script async src="https://www.googletagmanager.com/gtag/js?id=UA-120861020-1"></script> | 161 | <script async src="https://www.googletagmanager.com/gtag/js?id=UA-120861020-1"></script> |
141 | - <script> | ||
142 | - window.dataLayer = window.dataLayer || []; | ||
143 | - function gtag(){dataLayer.push(arguments);} | ||
144 | - gtag('js', new Date()); | ||
145 | - | ||
146 | - gtag('config', 'UA-120861020-1'); | ||
147 | - </script> | ||
148 | - <!-- Google Tag Manager --> | ||
149 | - <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
150 | - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
151 | - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
152 | - 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
153 | - })(window,document,'script','dataLayer','GTM-N6R7982');</script> | ||
154 | - <!-- End Google Tag Manager --> | ||
155 | - <meta charset="<?= \Yii::$app->charset ?>"> | ||
156 | - <meta name="viewport" content="width=device-width"> | ||
157 | - <link type="image/x-icon" href="favicon.ico" rel="icon"> | ||
158 | - <?= Html::csrfMetaTags() ?> | ||
159 | - <title><?=Html::encode($seo->title)?></title> | ||
160 | - <div class="row" itemscope itemtype="http://schema.org"> | ||
161 | - <?php $this->head() ?> | ||
162 | - </head> | 162 | + <script> |
163 | + window.dataLayer = window.dataLayer || []; | ||
164 | + function gtag(){dataLayer.push(arguments);} | ||
165 | + gtag('js', new Date()); | ||
166 | + | ||
167 | + gtag('config', 'UA-120861020-1'); | ||
168 | + </script> | ||
169 | + <!-- Google Tag Manager --> | ||
170 | + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
171 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
172 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
173 | + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
174 | + })(window,document,'script','dataLayer','GTM-N6R7982');</script> | ||
175 | + <!-- End Google Tag Manager --> | ||
176 | + <meta charset="<?= \Yii::$app->charset ?>"> | ||
177 | + <meta name="viewport" content="width=device-width"> | ||
178 | + <link type="image/x-icon" href="favicon.ico" rel="icon"> | ||
179 | + <?= Html::csrfMetaTags() ?> | ||
180 | + <title><?=Html::encode($seo->title)?></title> | ||
181 | + <?php $this->head() ?> | ||
182 | + </head> | ||
163 | <body id="body"> | 183 | <body id="body"> |
164 | <!-- Google Tag Manager (noscript) --> | 184 | <!-- Google Tag Manager (noscript) --> |
165 | <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982" | 185 | <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982" |
166 | height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | 186 | height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> |
167 | <!-- End Google Tag Manager (noscript) --> | 187 | <!-- End Google Tag Manager (noscript) --> |
168 | <?php $this->beginBody() ?> | 188 | <?php $this->beginBody() ?> |
189 | + <!-- Google Tag Manager (noscript) --> | ||
190 | + <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982" | ||
191 | + height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | ||
192 | + <!-- End Google Tag Manager (noscript) --> | ||
169 | <div class="transition-loader"> | 193 | <div class="transition-loader"> |
170 | <div class="transition-loader-inner"> | 194 | <div class="transition-loader-inner"> |
171 | <label></label> | 195 | <label></label> |
frontend/views/package/view.php
@@ -4,10 +4,21 @@ | @@ -4,10 +4,21 @@ | ||
4 | * @var \yii\web\View $this; | 4 | * @var \yii\web\View $this; |
5 | */ | 5 | */ |
6 | use common\models\Package; | 6 | use common\models\Package; |
7 | + use yii\web\View; | ||
8 | + | ||
7 | $seo = \Yii::$app->get('seo'); | 9 | $seo = \Yii::$app->get('seo'); |
8 | $this->params[ 'entity'] = Package::className(); | 10 | $this->params[ 'entity'] = Package::className(); |
9 | $this->params['entity_id'] = $package->id; | 11 | $this->params['entity_id'] = $package->id; |
10 | $this->params['breadcrumbs'][] = (!empty($seo->h1)) ? $seo->h1 :$package->title; | 12 | $this->params['breadcrumbs'][] = (!empty($seo->h1)) ? $seo->h1 :$package->title; |
13 | + | ||
14 | + $js = <<<JS | ||
15 | + $(document).on('beforeSubmit', '#visit-form', function() { | ||
16 | + dataLayer.push({'event': 'formsend_package'}); | ||
17 | + console.log('push'); | ||
18 | + return true; | ||
19 | + }); | ||
20 | +JS; | ||
21 | + $this->registerJs($js, View::POS_LOAD); | ||
11 | ?> | 22 | ?> |
12 | 23 | ||
13 | 24 |
frontend/views/service/view.php
@@ -9,11 +9,10 @@ | @@ -9,11 +9,10 @@ | ||
9 | */ | 9 | */ |
10 | use artbox\core\helpers\ImageHelper; | 10 | use artbox\core\helpers\ImageHelper; |
11 | use artbox\core\helpers\Url; | 11 | use artbox\core\helpers\Url; |
12 | - use common\models\Service; | ||
13 | use artbox\core\models\Alias; | 12 | use artbox\core\models\Alias; |
14 | - use artbox\core\models\Language; | ||
15 | - | ||
16 | - | 13 | + use common\models\Service; |
14 | + use yii\web\View; | ||
15 | + | ||
17 | $seo = \Yii::$app->get('seo'); | 16 | $seo = \Yii::$app->get('seo'); |
18 | $this->params['entity'] = Service::className(); | 17 | $this->params['entity'] = Service::className(); |
19 | $this->params['entity_id'] = $model->id; | 18 | $this->params['entity_id'] = $model->id; |
@@ -49,7 +48,53 @@ | @@ -49,7 +48,53 @@ | ||
49 | } | 48 | } |
50 | 49 | ||
51 | 50 | ||
51 | + | ||
52 | $aliases = Alias::find()->where(['route' => '{"0":"site/questions"}'])->indexBy('route')->andWhere(['language_id' => Language::getCurrent()->id])->asArray()->all(); | 52 | $aliases = Alias::find()->where(['route' => '{"0":"site/questions"}'])->indexBy('route')->andWhere(['language_id' => Language::getCurrent()->id])->asArray()->all(); |
53 | + | ||
54 | + | ||
55 | + $js = <<<JS | ||
56 | + $(document).on('beforeSubmit', '#comment-form', function() { | ||
57 | + dataLayer.push({'event': 'formsend_review'}); | ||
58 | + console.log('push'); | ||
59 | + return true; | ||
60 | + }); | ||
61 | + | ||
62 | +$(document).on('beforeSubmit', '#question-form', function() { | ||
63 | + dataLayer.push({'event': 'formsend_question'}); | ||
64 | + console.log('push'); | ||
65 | + return true; | ||
66 | + }); | ||
67 | + | ||
68 | + | ||
69 | + $(document).on('beforeSubmit', '#visit-form', function() { | ||
70 | + var service_id = {$model->id}; | ||
71 | + var parent_id = {$model->parent_id}; | ||
72 | + if (service_id == 4 || parent_id == 4){ | ||
73 | + window.dataLayer.push({'event': 'formsend_dermatologiya'}); | ||
74 | + } | ||
75 | + if (service_id == 16 || parent_id == 16){ | ||
76 | + dataLayer.push({'event': 'formsend_vedenie-beremennosti'}); | ||
77 | + } | ||
78 | + if (service_id == 22 || parent_id == 22){ | ||
79 | + dataLayer.push({'event': 'formsend_lechenie-besplodiya'}); | ||
80 | + } | ||
81 | + if (service_id == 21 || parent_id == 21){ | ||
82 | + dataLayer.push({'event': 'formsend_labioplastika'}); | ||
83 | + } | ||
84 | + if (service_id == 19 || parent_id == 19){ | ||
85 | + dataLayer.push({'event': 'formsend_zabolevaniya-sheyki-matki'}); | ||
86 | + } | ||
87 | + if (service_id == 20 || parent_id == 20){ | ||
88 | + dataLayer.push({'event': 'formsend_polovye-infekcii'}); | ||
89 | + } | ||
90 | + console.log('push'); | ||
91 | + return true; | ||
92 | + }); | ||
93 | +JS; | ||
94 | + | ||
95 | + $this->registerJs($js, View::POS_LOAD); | ||
96 | + | ||
97 | + | ||
53 | $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; | 98 | $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title; |
54 | ?> | 99 | ?> |
55 | <?=$microdata;?> | 100 | <?=$microdata;?> |
frontend/views/site/index.php
@@ -76,7 +76,7 @@ JS; | @@ -76,7 +76,7 @@ JS; | ||
76 | <!--размер img 1920x556--> | 76 | <!--размер img 1920x556--> |
77 | <?=ImageHelper::set($slide->language->image->getPath()) | 77 | <?=ImageHelper::set($slide->language->image->getPath()) |
78 | ->cropResize(1920, 556) | 78 | ->cropResize(1920, 556) |
79 | - ->quality(84) | 79 | + ->quality(82) |
80 | ->renderImage()?> | 80 | ->renderImage()?> |
81 | </a> | 81 | </a> |
82 | </div> | 82 | </div> |
@@ -98,9 +98,8 @@ JS; | @@ -98,9 +98,8 @@ JS; | ||
98 | <!--263x146px--> | 98 | <!--263x146px--> |
99 | <?=ImageHelper::set($service->image->getPath()) | 99 | <?=ImageHelper::set($service->image->getPath()) |
100 | ->cropResize(263, 146) | 100 | ->cropResize(263, 146) |
101 | - ->quality(84) | ||
102 | - ->renderImage(['alt'=>ucfirst($service->title).' - Консультация врача и лечение заболеваний', | ||
103 | - 'title'=>ucfirst($service->title).' - Консультация врача и лечение заболеваний'])?> | 101 | + ->quality(82) |
102 | + ->renderImage()?> | ||
104 | </div> | 103 | </div> |
105 | <div class="style categories-home-links-wr"> | 104 | <div class="style categories-home-links-wr"> |
106 | <div class="style categories-home-links-title"> | 105 | <div class="style categories-home-links-title"> |
@@ -162,16 +161,14 @@ JS; | @@ -162,16 +161,14 @@ JS; | ||
162 | <div class="row"> | 161 | <div class="row"> |
163 | <?php foreach ($package as $item){?> | 162 | <?php foreach ($package as $item){?> |
164 | <div class="col-xs-12 col-sm-4 package-offers-wr"> | 163 | <div class="col-xs-12 col-sm-4 package-offers-wr"> |
165 | - <a href="<?=Url::to(['alias' => $item->alias])?>"> | ||
166 | - <div class="img"> | ||
167 | - <?php #die(var_dump($item->language->attributes)); ?> | ||
168 | - <?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) | 164 | + <a href="<?=Url::to(['alias' => $item->language->alias])?>"> |
165 | + <div class="img"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) | ||
169 | ->cropResize(388, 240) | 166 | ->cropResize(388, 240) |
170 | - ->quality(84) | 167 | + ->quality(82) |
171 | ->renderImage()?></div> | 168 | ->renderImage()?></div> |
172 | <div class="rotate"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) | 169 | <div class="rotate"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null) |
173 | ->cropResize(388, 240) | 170 | ->cropResize(388, 240) |
174 | - ->quality(84) | 171 | + ->quality(82) |
175 | ->renderImage()?></div> | 172 | ->renderImage()?></div> |
176 | <p><?=$item->title?></p> | 173 | <p><?=$item->title?></p> |
177 | <span class="btn_"><?=\Yii::t('app','Buy')?></span> | 174 | <span class="btn_"><?=\Yii::t('app','Buy')?></span> |
frontend/web/js/script.js
@@ -143,24 +143,21 @@ $(document).ready(function() { | @@ -143,24 +143,21 @@ $(document).ready(function() { | ||
143 | }) | 143 | }) |
144 | 144 | ||
145 | } | 145 | } |
146 | - | 146 | + |
147 | 147 | ||
148 | 148 | ||
149 | function phoneMask() { | 149 | function phoneMask() { |
150 | var phoneInput = '.phones_mask input' | 150 | var phoneInput = '.phones_mask input' |
151 | 151 | ||
152 | - if($('body').find('.phones_mask').find('input').length>0){ | ||
153 | - $(phoneInput).mask('(000) 000-00-00',{placeholder:'(0__)___-__-__'}); | 152 | + if($('body').find(phoneInput).length>0){ |
153 | + $(phoneInput).mask('+38(000)000-00-00',{placeholder:'+38(000)000-00-00'}); | ||
154 | $(phoneInput).focus(function () { | 154 | $(phoneInput).focus(function () { |
155 | - | ||
156 | - var text = $(this).val(); | ||
157 | - $(this).val(text); | ||
158 | - if(($(this).val())== '') {$(this).val('(0')} | ||
159 | - }); | 155 | + if(($(this).val())== '') {$(this).val('+38(0')} |
156 | + }) | ||
160 | $(phoneInput).focusout(function () { | 157 | $(phoneInput).focusout(function () { |
161 | var phoneVal = $(this).val() | 158 | var phoneVal = $(this).val() |
162 | //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')} | 159 | //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')} |
163 | - if(phoneVal.length <15) {$(this).val('')} | 160 | + if(phoneVal.length <17) {$(this).val('')} |
164 | }) | 161 | }) |
165 | } | 162 | } |
166 | } | 163 | } |
@@ -381,7 +378,7 @@ $(document).ready(function() { | @@ -381,7 +378,7 @@ $(document).ready(function() { | ||
381 | $('.categories-home .img').click(function () { | 378 | $('.categories-home .img').click(function () { |
382 | var link = $(this).parent().find('.categories-home-links-title a').attr('href'); | 379 | var link = $(this).parent().find('.categories-home-links-title a').attr('href'); |
383 | document.location.href = link; | 380 | document.location.href = link; |
384 | - }) | 381 | + }); |
385 | var scrollPos = $(window).scrollTop(); | 382 | var scrollPos = $(window).scrollTop(); |
386 | var windHeight = $(window).height(); | 383 | var windHeight = $(window).height(); |
387 | var bl = $('.section-box-2'); | 384 | var bl = $('.section-box-2'); |
@@ -460,6 +457,13 @@ $(document).ready(function() { | @@ -460,6 +457,13 @@ $(document).ready(function() { | ||
460 | var form = $(this); | 457 | var form = $(this); |
461 | var id = form.attr('id'); | 458 | var id = form.attr('id'); |
462 | var url = form.attr('action'); | 459 | var url = form.attr('action'); |
460 | + if (id == 'total_question_form'){ | ||
461 | + dataLayer.push({'event': 'formsend_question'}); | ||
462 | + console.log('formsend_question'); | ||
463 | + }else{ | ||
464 | + dataLayer.push({'event': 'formsend_review'}); | ||
465 | + console.log('formsend_review'); | ||
466 | + } | ||
463 | $.post( | 467 | $.post( |
464 | $(this).attr("action"), $(this).serialize(), function(data) { | 468 | $(this).attr("action"), $(this).serialize(), function(data) { |
465 | document.getElementById(id).reset(); | 469 | document.getElementById(id).reset(); |
No preview for this file type