@inject ('reviewHelper', 'Webkul\Product\Helpers\Review')
@php
    $totalReviews = $reviewHelper->getTotalReviews($product);
    $avgRatings = ceil($reviewHelper->getAverageRating($product));
    $productBaseImage = productimage()->getProductBaseImage($product);
    $discount = discount_prosent($product);
@endphp

<div class="product-block">
    <div class="product-block-img">
        <img src="{{ $productBaseImage['medium_image_url'] }}" onerror="this.src='{{ asset('vendor/webkul/ui/assets/images/product/meduim-product-placeholder.png') }}'">
    </div>
    <div class="product-description">
        <a href='#' class="product-name">{{ $productFlat->name }}</a>
        <div class="product-rating">
            <div class="product-rating-img">
                <img src="{{bagisto_asset('icons/star.svg')}}" alt="star">
            </div>
            <span class="product-rating-text">{{$avgRatings}}</span>
            <span class="product-rating-feed">{{__('shop::app.products.total-reviews',['total'=>$totalReviews])}}</span>
        </div>
        @include ('shop::products.list.attributes')
    </div>
    <div class="product-buy">

        @include('shop::products.search-add-buttons', ['product' => $productFlat])

        <span class="old-price">{{ $productFlat->max_price }}</span>
        <span class="new-price">{{ $productFlat->min_price }}</span>
    </div>
</div>
