<?php

use WpBookingPro\Factory;
use WpBookingPro\Language\Text;
use WpBookingProFrontend\app\helpers\ConfigHelper as ConfigHelperAlias;
use WpBookingProFrontend\app\helpers\FrontendHelper;

$page_service_detail = ConfigHelperAlias::get_page_service_detail();
$this->page_service_detail = get_page_link($page_service_detail);

$check_user_demo = FrontendHelper::checkUserDemo();
$uploads = wp_upload_dir();

?>
<div class="block_top_service">
    <div class="contain">
        <div id="owl-carousel" class="owl-carousel owl-theme">
            <?php foreach ($list_service as $item) { ?>
                <?php if ($item->rating_avg>=4){?>
                    <div class="list-service">
                        <div class="item">
                            <?php $check_image_size = FrontendHelper::checkImageData($uploads['baseurl'], $item->image)?>
                            <?php if($check_user_demo['is_demo']) {?>
                                <?php if($check_image_size) {?>
                                    <img class="image lazy" data-src="<?php echo (esc_url($uploads['baseurl'].'/'.$item->image)) ?>">
                                <?php } else {?>
                                    <img class="image lazy" data-src="<?php echo (esc_url(Factory::getRootUrlPlugin().$item->image)) ?>">
                                <?php } ?>
                            <?php } else {?>
                                <img class="image lazy" data-src="<?php echo (esc_url(Factory::getRootUrlPlugin().$item->image)) ?>">
                            <?php } ?>

                            <div class="layer-blur"></div>
                            <h2 class="name-service">
                                <a href="<?php echo($this->page_service_detail.'?service_id='.$item->id); ?>" title="<?php esc_html_e($item->name); ?>"><?php esc_html_e($item->name); ?></a>
                            </h2>
                        </div>
                    </div>
               <?php } ?>
            <?php } ?>
        </div>
    </div>
</div>

<?php
$doc = Factory::getDocument();
$doc->addLessStyleSheet('frontend/blocks/block_top_service/assets/less/block_top_service.less');
$doc->addStyleSheet('frontend/app/assets/nb-font-icon/nb-font-icon.css');
$doc->addScriptApplySelector('.block_top_service','block_top_service',array(),'frontend/blocks/block_top_service/assets/js/block_top_service.js');
