<?php

use WpBookingEvent\Factory;
use WpBookingEvent\Language\Text;
use WpBookingEventFrontend\app\helpers\FrontendHelper;
use WpBookingEventFrontend\app\Html\HtmlFrontend;

$service = $this->service;
$rating_avg=($service->rating_ambience + $service->rating_cleanliness + $service->rating_staff + $service->rating_value) / 4;
$list_star_sum = HtmlFrontend::get_rating_star($rating_avg);
?>
<div class="row">
    <div class="col-md-12">
        <div class="block-service-item-display-list">
            <div class="block-info-content">
                <div class="img-block">
                    <div>
                        <img class="lazy" data-src="<?php echo (Factory::getRootUrlPlugin());?><?php echo ($service->image);?>" >
                    </div>
                </div>
                <div class="block-feature">
                    <div class="label-feature <?php Text::_echo_no_translate($service->is_feature == 1?'visible':'');?>">
                        <span><?php esc_attr_e('Featured','wpbookingevent');?></span>
                    </div>
                    <i class="fas fa-heart"></i>
                </div>
            </div>
            <div class="content-infor-service">
                <p class="place-service">
                    <i class="icon-nb-pin"></i>
                    <span>
                        <?php
                        if(isset($service->location->address)){
                            echo ($service->location->address);
                        }
                        ?>
                    </span>
                </p>
                <h4 class="name-service">
                    <a href="<?php echo ($this->page_service_detail.'?service_id='.$service->id); ?>">
                        <?php echo ($service->name);?>
                    </a>
                </h4>
                <div class="block-rating">
                    <ul class="list-rating-star">
                        <?php if($rating_avg > 0) {?>
                            <?php for ($i=0; $i < $list_star_sum[0]; $i++) {?>
                                <li class="item-star"><i class="fas fa-star"></i></li>
                            <?php }?>
                            <?php for ($i=0; $i <$list_star_sum[1]; $i++) {?>
                                <li class="item-star"><i class="fas fa-star-half-alt"></i></li>
                            <?php }?>
                            <?php for ($i=0; $i <$list_star_sum[2]; $i++) {?>
                                <li class="item-star"><i class="far fa-star"></i></li>
                            <?php }?>
                        <?php }?>
                    </ul>
                    <div class="rating-review">
                        <span>2 Reviews</span>
                    </div>
                </div>
                <div class="description">
                    <?php echo ($service->description);?>
                </div>
            </div>
            <div class="content-right">
                <div class="price-service">
                    <p class="new-price">
                        <span><i class="fas fa-bolt"></i><span>from</span></span>
                        <span class="price"><?php esc_html_e(FrontendHelper::format_currency(number_format((float)$service->price,2)));?></span>
                    </p>
                </div>
                <div class="trip-time">
                    <i class="icon-nb-clock"></i>
                    <span><?php echo ($service->duration);?> <?php esc_attr_e('hours','wpbookingevent');?></span>
                </div>
                <div class="view-more">
                    <a href="<?php echo ($this->page_service_detail.'?service_id='.$service->id); ?>" class="btn btn-primary"><?php esc_attr_e('View service','wpbookingevent');?></a>
                </div>
            </div>
        </div>
    </div>
</div>
