<?php

/**
 * The Footer Template
 *
 * @package Dotspice
 * @version 1.3.0
 */
?>

<?php if (!is_page_template('templates/page-full-width.php')) : ?>
      </div><!-- .container -->
<?php endif ?>
</div><!-- .content -->
</main><!-- .site-content -->

<footer class="site-footer" <?php dotspice_schema('footer'); ?>>
      <?php
      dotspice_dynamic_sidebar('footer');

      if (
            dotspice_is_live_sidebar('footer-area-1') ||
            dotspice_is_live_sidebar('footer-area-2') ||
            dotspice_is_live_sidebar('footer-area-3') ||
            dotspice_is_live_sidebar('footer-area-4')
      ) {
      ?>
            <div class="site-footer__widgets">
                  <div class="container">
                        <div class="row">
                              <?php

                              // Sidebar | Footer Area 1
                              dotspice_dynamic_sidebar('footer-area-1', '<div class="widgets-area area-1">', '</div>');

                              // Sidebar | Footer Area 2
                              dotspice_dynamic_sidebar('footer-area-2', '<div class="widgets-area area-2">', '</div>');

                              // Sidebar | Footer Area 3
                              dotspice_dynamic_sidebar('footer-area-3', '<div class="widgets-area area-3">', '</div>');

                              // Sidebar | Footer Area 4
                              dotspice_dynamic_sidebar('footer-area-4', '<div class="widgets-area area-4">', '</div>');
                              ?>
                        </div>
                  </div>
            </div>
      <?php
      }
      ?>

      <?php dotspice_dynamic_sidebar('footer-copy', '<div class="site-footer__copy"><div class="container">', '</div></div>'); ?>
</footer><!-- .site-footer -->
</div><!-- #wrapper -->

<?php if (is_product()) {
      $terms = get_the_terms($product_id, 'event_category');

      if (!empty($terms)) {
            foreach ($terms as $index => $term) {
                  if ($index == 0) {
                        $catid = $term->term_id;
                  }
            }
      }
      $catid = get_post_meta(wc_get_product()->get_id(),'_yoast_wpseo_primary_product_cat',true);
?>
      <script type="text/javascript">
            console.log("Cat: <?php echo $catid; ?>");
            fetch("https://pracownia.torebki-fabiola.pl/sscripts/getdate.php?id=<?php echo $catid; ?>")
                  .then((r) => {
                        r.text().then((d) => {
                              let CONTENT = d;
                              if (CONTENT != "0") {
                                    document.getElementsByClassName("realizacja")[0].innerHTML = "<font color='red'><b>SZACUNKOWY TERMIN REALIZACJI: " + CONTENT + "</b></font>";
				    // document.getElementById("senddate").value = CONTENT;
				    document.getElementsByName("senddate")[0].value = CONTENT;
                              }
                        })
                  })
                  .catch((error) => {
                        console.log(error)
                  });
      </script>
<?php } ?>

<?php wp_footer(); ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/smoothscroll/1.4.10/SmoothScroll.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha512-Zq2BOxyhvnRFXu0+WE6ojpZLOU2jdnqbrM1hmVdGzyeCa1DgM3X5Q4A/Is9xA1IkbUeDd7755dNNI/PzSf2Pew==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
      jQuery(function($) {
            $(window).on('load', function() {
                  var $container = $('.portfolioContainer');
                  var $filter = $('#filter');
                  $container.isotope({
                        filter: '*',
                        layoutMode: 'masonry',
                        animationOptions: {
                              duration: 750,
                              easing: 'linear'
                        }
                  });
                  $filter.find('a').click(function() {
                        var selector = $(this).attr('data-filter');
                        $filter.find('a').removeClass('active');
                        $(this).addClass('active');
                        $container.isotope({
                              filter: selector,
                              animationOptions: {
                                    animationDuration: 750,
                                    easing: 'linear',
                                    queue: false,
                              }
                        });
                        return false;
                  });
            });
      });
</script>
<script>
      var fired = false;

      window.addEventListener('scroll', () => {
            if (fired === false) {
                  fired = true;
                  setTimeout(() => {
                        /**
                         * Here put Google's own Tag Manager and Analytics, Facebook Pixel, other trackers and chat scripts etc.
                         */




                        /** */
                  }, 1000)
            }
      });
</script>
</body>

</html>
