Commit a86a78b083691fd8203d5f5008e8a1dd23f1d4e6

Authored by alex
2 parents 1645a556 41fb7b5b

Merge branch 'master' of gitlab.artweb.com.ua:steska/clinica

# Conflicts:
#	frontend/controllers/SiteController.php
#	frontend/views/site/index.php
frontend/assets/AppAsset.php
... ... @@ -13,7 +13,7 @@
13 13 public $baseUrl = '@web';
14 14 public $css = [
15 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 18 public $js = [
19 19 'js/script.js',
... ...
frontend/config/main.php
... ... @@ -192,7 +192,7 @@
192 192 document.getElementById("comment-form").reset();
193 193 var data = $("#comment-form").data(\'yiiActiveForm\');
194 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 196 data.validated = false;
197 197 }',
198 198  
... ...
frontend/controllers/SiteController.php
... ... @@ -16,13 +16,11 @@
16 16 use yii\db\ActiveQuery;
17 17 use yii\db\Expression;
18 18 use yii\filters\VerbFilter;
19   - use yii\helpers\ArrayHelper;
20 19 use yii\helpers\Json;
21 20 use yii\swiftmailer\Mailer;
22 21 use yii\web\BadRequestHttpException;
23 22 use yii\web\Controller;
24 23 use yii\web\Response;
25   - use yii\helpers\VarDumper as d;
26 24  
27 25 /**
28 26 * Site controller
... ... @@ -364,7 +362,7 @@
364 362 $model->save();
365 363 return [
366 364 'status' => true,
367   - 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появиться на сайте',
  365 + 'message' => 'Спасибо за Ваш отзыв. После проверки модератором он появится на сайте',
368 366 ];
369 367 } else {
370 368 return [
... ... @@ -376,34 +374,24 @@
376 374  
377 375 # подкоректировал логику для сохранрения в БД/выдачи вопросов с категории "Общие вопросы"
378 376 # закрепил за ними entity_id=0
379   - if ($service_id == null) {
380   - $service_id = 0;
381   - }
382   - $dataProvider = new ActiveDataProvider(
383   - [
384   - 'query' => Comment::find()
385   - ->where([ 'status' => true ])
386   - ->andWhere([ 'entity' => Service::className() ])
387   - ->andFilterWhere([ 'entity_id' => $service_id ]),
388   - //'SELECT * FROM \"comment\" WHERE (\"status\"=TRUE) AND (\"entity\"=\'common\\models\\Service\')'
389   - 'pagination' => [
390   - 'pageSize' => 10,
391   - ],
392   - ]
393   - );
394   - $services = Service::find()
395   - ->where([ 'status' => true ])
396   - ->andWhere([ 'parent_id' => null ])
397   - ->with('language')
398   - ->all();
399   -
400   - return $this->render(
401   - 'comments',
402   - [
403   - 'dataProvider' => $dataProvider,
404   - 'services' => $services,
405   - 'service_id' => $service_id,
406   - ]
407   - );
  377 + if($service_id==null)$service_id=0;
  378 + $dataProvider = new ActiveDataProvider([
  379 + 'query' => Comment::find()
  380 + ->where(['status' => true])
  381 + ->andWhere(['entity' => Service::className()])
  382 + ->andFilterWhere(['entity_id' => $service_id])//'SELECT * FROM \"comment\" WHERE (\"status\"=TRUE) AND (\"entity\"=\'common\\models\\Service\')'
  383 + ->orderBy(['id'=>SORT_DESC]),
  384 + 'pagination' => [
  385 + 'pageSize' => 10,
  386 + ],
  387 +
  388 + ]);
  389 + $services = Service::find()->where(['status' => true])->andWhere(['parent_id' => null])->all();
  390 +
  391 + return $this->render('comments', [
  392 + 'dataProvider' => $dataProvider,
  393 + 'services' => $services,
  394 + 'service_id' => $service_id
  395 + ]);
408 396 }
409 397 }
... ...
frontend/microdata/MicrodataFabric.php
1 1 <?php
2   -namespace frontend\microdata;
3   -
4   -use frontend\microdata\Microdata;
5   -
6   -
7   -
8   -
9   -class MicrodataFabric extends Microdata
10   -{
11   - public static function createJsonFromProduct($product)
  2 +
  3 + namespace frontend\microdata;
  4 +
  5 + use frontend\microdata\Microdata;
  6 +
  7 + class MicrodataFabric extends Microdata
12 8 {
13   - return ($product==null)?
14   - new ProductMicrodata(array_merge(['url'=>123],self::getDefaultSettings()))
15   - :
16   - new ProductMicrodata(array_merge($product,['url'=>123],self::getDefaultSettings()));
17   - }
18   - public static function createJsonFromArticle($article=null)
19   - {
20   -
21   - return ($article==null)?
22   - new ArticleMicrodata(array_merge(['url'=>123],self::getDefaultSettings()))
23   - :
24   - new ArticleMicrodata(array_merge($article,['url'=>123],self::getDefaultSettings()));
25   - }
26   - public static function createJsonFromOrganization($article=null)
27   - {
28   -
29   - return ($article==null)?
30   - new OrganizationMicrodata(array_merge(self::getDefaultSettings()))
31   - :
32   - #die(var_dump(self::getDefaultSettings()));
33   - #die(var_dump(array_merge($article,self::getDefaultSettings())));
34   - new OrganizationMicrodata(array_merge($article,
35   - self::getDefaultSettings()));
36   - }
37   -
38   -
39   -
40   -
41   -
42   -
43   - protected static function getDefaultSettings(){
44   - return [
45   - 'context'=>"http://schema.org",
46   -
47   - ];
48   -
49   -
50   -
51   - }
52   -
53   -}
54 9 \ No newline at end of file
  10 + public static function createJsonFromProduct($product)
  11 + {
  12 + return ( $product == null ) ? new ProductMicrodata(
  13 + array_merge([ 'url' => 123 ], self::getDefaultSettings())
  14 + ) : new ProductMicrodata(array_merge($product, [ 'url' => 123 ], self::getDefaultSettings()));
  15 + }
  16 + public static function createJsonFromArticle($article = null)
  17 + {
  18 +
  19 + return ( $article == null ) ? new ArticleMicrodata(
  20 + array_merge([ 'url' => 123 ], self::getDefaultSettings())
  21 + ) : new ArticleMicrodata(array_merge($article, [ 'url' => 123 ], self::getDefaultSettings()));
  22 + }
  23 + public static function createJsonFromOrganization($article = null)
  24 + {
  25 +
  26 + return ( $article == null ) ? new OrganizationMicrodata(
  27 + array_merge(self::getDefaultSettings())
  28 + ) : #die(var_dump(self::getDefaultSettings()));
  29 + #die(var_dump(array_merge($article,self::getDefaultSettings())));
  30 + new OrganizationMicrodata(
  31 + array_merge(
  32 + $article,
  33 + self::getDefaultSettings()
  34 + )
  35 + );
  36 + }
  37 +
  38 + protected static function getDefaultSettings()
  39 + {
  40 + return [
  41 + 'context' => "http://schema.org",
  42 +
  43 + ];
  44 +
  45 + }
  46 +
  47 + }
55 48 \ No newline at end of file
... ...
frontend/views/layouts/main.php
... ... @@ -140,39 +140,56 @@ $this-&gt;registerMetaTag(
140 140 <?php $this->beginPage() ?>
141 141 <!DOCTYPE html >
142 142 <html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" lang="<?= \Yii::$app->language ?>">
143   - <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>
144 159  
145   - <meta charset="utf-8">
146 160 <!-- Global site tag (gtag.js) - Google Analytics -->
147 161 <script async src="https://www.googletagmanager.com/gtag/js?id=UA-120861020-1"></script>
148   - <script>
149   - window.dataLayer = window.dataLayer || [];
150   - function gtag(){dataLayer.push(arguments);}
151   - gtag('js', new Date());
152   -
153   - gtag('config', 'UA-120861020-1');
154   - </script>
155   - <!-- Google Tag Manager -->
156   - <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
157   - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
158   - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
159   - 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
160   - })(window,document,'script','dataLayer','GTM-N6R7982');</script>
161   - <!-- End Google Tag Manager -->
162   - <meta charset="<?= \Yii::$app->charset ?>">
163   - <meta name="viewport" content="width=device-width">
164   - <link type="image/x-icon" href="favicon.ico" rel="icon">
165   - <?= Html::csrfMetaTags() ?>
166   - <title><?=Html::encode($seo->title)?></title>
167   - <div class="row" itemscope itemtype="http://schema.org">
168   - <?php $this->head() ?>
169   - </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>
170 183 <body id="body">
171 184 <!-- Google Tag Manager (noscript) -->
172 185 <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6R7982"
173 186 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
174 187 <!-- End Google Tag Manager (noscript) -->
175 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) -->
176 193 <div class="transition-loader">
177 194 <div class="transition-loader-inner">
178 195 <label></label>
... ... @@ -290,41 +307,14 @@ $this-&gt;registerMetaTag(
290 307 'url' => Url::to(['package/index']),
291 308 ];
292 309  
293   - # определяю, кому из итемов присвоить class="active'
294   - $itemKey=0;
295   - $test=[];
296   - foreach ($items as $key => $item)
297   - {
298   -
299   - if(strpos(\Yii::$app->request->url,$item['url'])!==false )
300   - {
301   - $test[$key]['label']=$item['label'];
302   - $test[$key]['options'] = [ 'class' => 'active' ];
303   - $test[$key]['url']= false;
304   -
305   -
306   - }
307   - elseif( \Yii::$app->request->url=='/' && $item['label']==\Yii::t('app', 'Prices'))
308   - {
309   - $test[$key]['label']=$item['label'];
310   - $test[$key]['options'] = [ 'class' => 'active' ];
311   - $test[$key]['url']= Url::to(['site/prices']);
312   -
313   - }
314   - else
315   - {
316   - $test[$key]['label']=$item['label'];
317   - $test[$key]['url']=$item['url'];
318   - }
319   -
320   - }
  310 +
321 311  
322 312  
323 313 ?>
324 314  
325 315 <?php echo Nav::widget(
326 316 [
327   - 'items' => $test,
  317 + 'items' => $items,
328 318 'activateItems' => false,
329 319 ]
330 320 ); ?>
... ...
frontend/views/package/view.php
... ... @@ -4,10 +4,21 @@
4 4 * @var \yii\web\View $this;
5 5 */
6 6 use common\models\Package;
  7 + use yii\web\View;
  8 +
7 9 $seo = \Yii::$app->get('seo');
8 10 $this->params[ 'entity'] = Package::className();
9 11 $this->params['entity_id'] = $package->id;
10 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,11 @@
9 9 */
10 10 use artbox\core\helpers\ImageHelper;
11 11 use artbox\core\helpers\Url;
12   - use common\models\Service;
13 12 use artbox\core\models\Alias;
14   - use artbox\core\models\Language;
15   -
16   -
  13 + use common\models\Language;
  14 + use common\models\Service;
  15 + use yii\web\View;
  16 +
17 17 $seo = \Yii::$app->get('seo');
18 18 $this->params['entity'] = Service::className();
19 19 $this->params['entity_id'] = $model->id;
... ... @@ -49,7 +49,53 @@
49 49 }
50 50  
51 51  
  52 +
52 53 $aliases = Alias::find()->where(['route' => '{"0":"site/questions"}'])->indexBy('route')->andWhere(['language_id' => Language::getCurrent()->id])->asArray()->all();
  54 +
  55 +
  56 + $js = <<<JS
  57 + $(document).on('beforeSubmit', '#comment-form', function() {
  58 + dataLayer.push({'event': 'formsend_review'});
  59 + console.log('push');
  60 + return true;
  61 + });
  62 +
  63 +$(document).on('beforeSubmit', '#question-form', function() {
  64 + dataLayer.push({'event': 'formsend_question'});
  65 + console.log('push');
  66 + return true;
  67 + });
  68 +
  69 +
  70 + $(document).on('beforeSubmit', '#visit-form', function() {
  71 + var service_id = {$model->id};
  72 + var parent_id = {$model->parent_id};
  73 + if (service_id == 4 || parent_id == 4){
  74 + window.dataLayer.push({'event': 'formsend_dermatologiya'});
  75 + }
  76 + if (service_id == 16 || parent_id == 16){
  77 + dataLayer.push({'event': 'formsend_vedenie-beremennosti'});
  78 + }
  79 + if (service_id == 22 || parent_id == 22){
  80 + dataLayer.push({'event': 'formsend_lechenie-besplodiya'});
  81 + }
  82 + if (service_id == 21 || parent_id == 21){
  83 + dataLayer.push({'event': 'formsend_labioplastika'});
  84 + }
  85 + if (service_id == 19 || parent_id == 19){
  86 + dataLayer.push({'event': 'formsend_zabolevaniya-sheyki-matki'});
  87 + }
  88 + if (service_id == 20 || parent_id == 20){
  89 + dataLayer.push({'event': 'formsend_polovye-infekcii'});
  90 + }
  91 + console.log('push');
  92 + return true;
  93 + });
  94 +JS;
  95 +
  96 + $this->registerJs($js, View::POS_LOAD);
  97 +
  98 +
53 99 $this->params[ 'breadcrumbs' ][] = (!empty($seo->h1)) ? $seo->h1 :$model->title;
54 100 ?>
55 101 <?=$microdata;?>
... ...
frontend/views/site/index.php
... ... @@ -76,7 +76,7 @@ JS;
76 76 <!--размер img 1920x556-->
77 77 <?=ImageHelper::set($slide->language->image->getPath())
78 78 ->cropResize(1920, 556)
79   - ->quality(84)
  79 + ->quality(82)
80 80 ->renderImage()?>
81 81 </a>
82 82 </div>
... ... @@ -162,18 +162,14 @@ JS;
162 162 <div class="row">
163 163 <?php foreach ($package as $item){?>
164 164 <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)
169 165 <a href="<?=Url::to(['alias' => $item->language->alias])?>">
170 166 <div class="img"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null)
171 167 ->cropResize(388, 240)
172   - ->quality(84)
  168 + ->quality(82)
173 169 ->renderImage()?></div>
174 170 <div class="rotate"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null)
175 171 ->cropResize(388, 240)
176   - ->quality(84)
  172 + ->quality(82)
177 173 ->renderImage()?></div>
178 174 <p><?=$item->title?></p>
179 175 <span class="btn_"><?=\Yii::t('app','Buy')?></span>
... ...
frontend/web/js/script.js
... ... @@ -143,24 +143,21 @@ $(document).ready(function() {
143 143 })
144 144  
145 145 }
146   -
  146 +
147 147  
148 148  
149 149 function phoneMask() {
150 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 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 157 $(phoneInput).focusout(function () {
161 158 var phoneVal = $(this).val()
162 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 378 $('.categories-home .img').click(function () {
382 379 var link = $(this).parent().find('.categories-home-links-title a').attr('href');
383 380 document.location.href = link;
384   - })
  381 + });
385 382 var scrollPos = $(window).scrollTop();
386 383 var windHeight = $(window).height();
387 384 var bl = $('.section-box-2');
... ... @@ -460,6 +457,13 @@ $(document).ready(function() {
460 457 var form = $(this);
461 458 var id = form.attr('id');
462 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 467 $.post(
464 468 $(this).attr("action"), $(this).serialize(), function(data) {
465 469 document.getElementById(id).reset();
... ...
t10.gz 0 → 100644
No preview for this file type