@php
    $template = 'template' . $site_configurations->template_id;
@endphp
@extends('frontend.app')
@section('title', 'publisher_details')
@section('content')



    <!--================== publisher products start ===================-->
    <div class="pbulisher_products_area section_padding_bottom section_padding_top">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">

                    <div class="section_title">
                        <h2>{{ $pubDetails->name }} এর বই সমূহ</h2>
                        {{-- <p>
                            (Showing {{ $publisherBooks->firstItem() }} to {{ $publisherBooks->lastItem() }} of total
                            {{ $publisherBooks->total() }} books for {{ $pubDetails->name }})
                        </p> --}}
                    </div>
                </div>
            </div>
        </div>
        <div class="container section_top_space">
            <div class="row gy-3 gx-3">
                {{-- @foreach ($publisherBooks as $books)
                    @if ($books->publisher_id == null)
                        <h4>No books available right now of this publisher</h4>
                    @else
                        <div class="col-xxl-2 col-xl-2 col-lg-3 col-md-4 col-sm-4 col-6">
                            <div class="product_card">
                                <div class="product_image">
                                    <a href="{{ route('single.product', $books->slug) }}">
                                        <img src="{{ asset('storage/' . $books->thumbnail_img) }}"
                                            alt="{{ $books->name }}">
                                    </a>
                                    <div class="product_discount">
                                        <span>{{ getProductDiscountPrice($books->price, $books->sale_price) }}%</span>
                                    </div>
                                </div>
                                <div class="product_content">
                                    <div class="product_name">
                                        <a href="{{ route('single.product', $books->slug) }}"
                                            class="product_name_link">{{ $books->name }}</a>
                                    </div>
                                    <div class="product_price">
                                        <span class="product_new_price">{{ $books->sale_price }}</span>
                                        @if ($books->price > $books->sale_price)
                                            <span class="product_discount_price">{{ $books->price }} TK</span>
                                        @endif
                                    </div>
                                    <div class="product_btn">

                                        <a href="{{ route('single.product', $books->slug) }}"
                                            class="product_btn_link">Order
                                            Now</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endif
                @endforeach --}}

                @foreach ($publisherBooks as $product)
                    <div class="col-xxl-2 col-xl-2 col-lg-3 col-md-4 col-sm-4 col-6">
                        @include("frontend.components.product_content.$template", [
                            'product' => $product,
                        ])
                    </div>
                @endforeach
            </div>
            <div class="row section_top_space">
                <div class="col-12">
                    <div class="common_pagination">
                        {!! $publisherBooks->links() !!}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--================== publisher products end ===================-->


@endsection
