Commit 7445c339c8d68d1e1f0f5b58a7b0858de1a5dd7f

Authored by Volodymyr
1 parent ec957aa4

product modal js

frontend/controllers/SiteController.php
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 4
5 use artbox\core\models\Page; 5 use artbox\core\models\Page;
6 use common\models\Feedback; 6 use common\models\Feedback;
  7 + use common\models\Product;
7 use common\models\Settings; 8 use common\models\Settings;
8 use common\models\Slider; 9 use common\models\Slider;
9 use common\models\Tile; 10 use common\models\Tile;
@@ -101,7 +102,8 @@ @@ -101,7 +102,8 @@
101 ->orderBy('id') 102 ->orderBy('id')
102 ->limit(4) 103 ->limit(4)
103 ->all(); 104 ->all();
104 - 105 + $productsCompany = Product::find()->where(['!=','type',Product::TYPE_PRIVATE])->all();
  106 + $productsPrivate = Product::find()->where(['!=','type',Product::TYPE_COMPANY])->all();
105 return $this->render( 107 return $this->render(
106 'index', 108 'index',
107 [ 109 [
@@ -110,6 +112,8 @@ @@ -110,6 +112,8 @@
110 'forCompanies'=>$forCompanies, 112 'forCompanies'=>$forCompanies,
111 'forPrivate'=>$forPrivate, 113 'forPrivate'=>$forPrivate,
112 'tiles'=>$tiles, 114 'tiles'=>$tiles,
  115 + 'productsCompany'=>$productsCompany,
  116 + 'productsPrivate'=>$productsPrivate,
113 ] 117 ]
114 ); 118 );
115 } 119 }
frontend/views/site/index.php
@@ -672,7 +672,7 @@ $coordinates['lon'] = empty($settings->lon) ? 0 : $settings->lon; @@ -672,7 +672,7 @@ $coordinates['lon'] = empty($settings->lon) ? 0 : $settings->lon;
672 width="100%" height="380" style="border:0;" allowfullscreen="" loading="lazy"></iframe> 672 width="100%" height="380" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
673 </section> 673 </section>
674 </div> 674 </div>
675 -<a href="#" class="animation-hover" data-title="hhh" data-toggle="modal" data-target="#cardProduct"> 675 +<a href="#" class="animation-hover" data-boo="fffff" data-title="hhh" data-toggle="modal" data-target="#cardProduct">
676 Получить консультацию </a> 676 Получить консультацию </a>
677 <!-- Modal --> 677 <!-- Modal -->
678 <div class="modal fade" id="cardProduct" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> 678 <div class="modal fade" id="cardProduct" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
frontend/web/js/product.js
@@ -4,6 +4,10 @@ var counter = document.querySelector(&#39;#cardProduct .product-counter__input&#39;); @@ -4,6 +4,10 @@ var counter = document.querySelector(&#39;#cardProduct .product-counter__input&#39;);
4 if (phoneInput) { 4 if (phoneInput) {
5 phoneInput.addEventListener('input', phoneHandleInput); 5 phoneInput.addEventListener('input', phoneHandleInput);
6 } 6 }
  7 +$('#cardProduct').on('show.bs.modal', function (e) {
  8 + var button = $(e.relatedTarget)
  9 + console.log(button.data('boo'));
  10 +})
7 11
8 if (counter) { 12 if (counter) {
9 counterFunc(counter); 13 counterFunc(counter);