@extends('shop::layouts.master')

@section('page_title')
    {{ __('shop::app.search.page-title') }}
@endsection

@push('css')
    <link rel="stylesheet" href="{{bagisto_asset('styles/reviews.css')}}">
    <link rel="stylesheet" href="{{bagisto_asset('styles/categories-tv.css')}}">
@endpush

@section('content-wrapper')
<!-- BREADCRUMB ======================================================================== -->
<section class="breadcrumb">
    <div class="container">

        <div class="breadcrumb-container">
            <ul class="breadcrumb">
                <li><a href="/">{{__('shop::app.home.page-title')}}</a></li>
                <li><a href="#" class="current">{{__('shop::app.review.reviews')}}</a></li>
            </ul>
        </div>
    </div>
</section>
<!-- BREADCRUMB end ==================================================================== -->

<section class="navigation-section">
    <div class="container">
        <div class="navigation-inner">
        <h2 class="navigation-title">{{__('shop::app.review.reviews-about-us')}}</h2>
        </div>
    </div>
</section>

<section class="reviews-section">
    <div class="container">
        <div class="reviews-inner">
 
            @foreach($websiteReviews as $vol)
                <div class="review-block">
                    <h3 class="review-block-title">{{ $vol->customer->first_name }}</h3>
                    <div class="review-block-details">
                        <div class="review-block-rating">
                            @for ($i = 1; $i <= 5; $i++)
                                <svg class="review-block-star {{ $i <= $vol->rating ? 'star-active' : '' }}" data-index="{{ $i }}" width="32" height="29" viewBox="0 0 32 29" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path d="M16 0L19.5922 11.0557H31.2169L21.8123 17.8885L25.4046 28.9443L16 22.1115L6.59544 28.9443L10.1877 17.8885L0.783095 11.0557H12.4078L16 0Z" fill="currentColor"></path>
                                </svg>
                            @endfor
                        </div>
                        <span class="review-block-date">{{ $vol->created_at->format('d.m.Y') }} г.</span>
                    </div>
                    <p class="review-block-text">
                        {{ $vol->review_text }}
                    </p>
                </div>
            @endforeach

        </div>
    </div>
</section>

@php
    $currentPage = $websiteReviews->currentPage();
    $totalPages = $websiteReviews->lastPage();
@endphp

<section>
    <div class="container">
        <div class="product-section-pagination-wrapper">
            <div class="product-section-pagination">
                <div class="pagination-buttons">
                    @if ($currentPage > 1)
                    <a href="{{ $websiteReviews->url($currentPage - 1) }}">
                        <button class="pagination-button pagination-button-left">
                            <div>
                                <img src="../assets/icons/arrow-down-sign-to-navigate.svg" alt="">
                            </div>
                        </button>
                    </a>
                    @endif

                    <span class="mid-button-text">{{ $currentPage }}</span>

                    @if ($currentPage < $totalPages)
                    <a href="{{ $websiteReviews->url($currentPage + 1) }}">
                        <button class="pagination-button pagination-button-right">
                            <div>
                                <img src="../assets/icons/arrow-down-sign-to-navigate.svg" alt="">
                            </div>
                        </button>
                    </a>
                    @endif
                </div>
                <span class="page-count">{{__('shop::app.review.total')}} {{ $totalPages }} {{__('shop::app.review.pages')}}</span>
            </div>
        </div>
    </div>
</section>

@endsection

@push('scripts')
@endpush