<?php

/**
 * Magestore
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magestore.com license that is
 * available through the world-wide-web at this URL:
 * http://www.magestore.com/license-agreement.html
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category    Magestore
 * @package     Magestore_Bannerslider
 * @copyright   Copyright (c) 2012 Magestore (http://www.magestore.com/)
 * @license     http://www.magestore.com/license-agreement.html
 */

?>
<?php
$styleSlide = $block->getSlider()->getStyleSlide();
$slider = $block->getSlider();
$banner = $block->getFirstBannerItem();
?>
<div id="magestore-bannerslider-popup-<?php echo $block->escapeHtml($slider->getId()) ?>" class="magestore-bannerslider-popup" data-mage-init='{"magestore/impress": {"url": "<?php echo $this->getUrl("bannerslider/index/impress") ?>", "slider_id": "<?php echo $block->escapeHtml($block->getSlider()->getId()) ?>"}}'>
    <div id="magestore-bannerslider-popup-close-<?php echo $slider->getId() ?>" title="Close"></div>
    <?php if ($slider->getShowTitle() == 1) :
    ?>
        <p style="text-transform: uppercase; color: #e26703; margin-bottom: 0px; background-color: rgb(255, 255, 255);">
            <strong><span><?php echo $block->escapeHtml($slider->getTitle()) ?></span></strong>
        </p>
    <?php endif; ?>
    <?php if ($banner->getId()) :
    ?>
        <a href="<?php echo $block->escapeHtml($banner->getClickUrl()) ?>" target="<?php echo $block->escapeHtml($banner->getTargetValue()) ?>" style="display:block;" data-mage-init='{"magestore/clickbanner": {"url": "<?php echo $this->getUrl("bannerslider/index/click") ?>", "slider_id": "<?php echo $block->escapeHtml($banner->getSliderId()) ?>", "banner_id": "<?php echo $block->escapeHtml($banner->getId()) ?>" }}' >
            <img class="slider-image" style="width:<?php echo $slider->getWidth() ?>px; height: <?php echo $slider->getHeight() ?>px;"  alt="<?php echo $banner->getImageAlt() ?>" src="<?php echo $block->getBannerImageUrl($banner) ?>"/>
            <img class="slider-image-mobile" style="width:<?php echo $slider->getWidth() ?>px; height: <?php echo $slider->getHeight() ?>px;"  alt="<?php echo $banner->getImageAlt() ?>" src="<?php echo $block->getBannerImageMobileUrl($banner) ?>"/>
        </a>
    <?php endif ?>
    </div>
<script type="text/javascript">
require(['jquery','magestore/popup'], function($) {
    $(document).ready(function() {
        var left = ($(window).width() - <?php echo $slider->getWidth() ?>) / 2;
        var top =  ($(window).height() - <?php echo $slider->getHeight() ?>) / 2;
        $('#magestore-bannerslider-popup-<?php echo $slider->getId() ?>').bPopup({
            position: [left, top]
        });
    });
});
</script>


