<?php

use WpBookingEvent\Factory;
use WpBookingEventFrontend\app\helpers\ConfigHelper as ConfigHelperAlias;

$doc = Factory::getDocument();
$doc->addLessStyleSheet('frontend/app/assets/less/view_list_category.less');
$page_list_service= ConfigHelperAlias::get_page_list_service();
if($page_list_service) {
    $page_list_service = get_page_link($page_list_service);
}else{
    $page_list_service="";
}
?>
<div class="view-list-category">
    <div class="row">
        <div class="col-md-12">
            <div class="block-title">
                <h2 class="title"><?php esc_attr_e('Our category','wpbookingevent') ?></h2>
                <p class="des"><?php esc_attr_e('Exercise with the leading bodybuilding experts on the world, helping to improve the overall health','wpbookingevent'); ?></p>
            </div>
        </div>
    </div>
    <div class="row">
        <?php foreach ($this->list as $item) { ?>
            <?php
                $list_service = $item->list_service;
                $a_list_service = array_slice($list_service, 0, 3);
            ?>
            <div class="col-md-4 col-sm-6">
                <div class="wrapper-category-item">
                    <a class="div-link" href="<?php echo($page_list_service.'?category='.$item->id); ?>"><?php esc_attr_e('.','wpbookingevent') ?></a>
                    <div class="img-block">
                        <div>
                            <img src="<?php esc_html_e(Factory::getRootUrlPlugin())?>/<?php esc_html_e($item->image) ?>" alt="category-image" />
                        </div>
                    </div>
                    <h3><a href="<?php echo($page_list_service.'?category='.$item->id); ?>"><?php esc_html_e($item->name) ?></a></h3>
                    <div class="layer-content">
                        <div class="training">
                            <ul class="list-service pull-left">
                                <?php foreach ($a_list_service as $service) { ?>
                                    <li>
                                        <img class="service-image" src="<?php esc_html_e(Factory::getRootUrlPlugin()) ?>/<?php esc_html_e($service->image) ?>" alt="image-service">
                                    </li>
                                <?php } ?>
                            </ul>
                            <p><?php esc_attr_e('Service','wpbookingevent') ?>: <?php echo (count($list_service)) ?></p>
                        </div>
                    </div>
                </div>
            </div>
        <?php } ?>
    </div>
</div>