@inject ('toolbarHelper', 'Webkul\Product\Helpers\Toolbar')

@php
    $showWishlist = core()->getConfigData('general.content.shop.wishlist_option') == "1" ? true : false;
    //dd($product->getTypeInstance()->totalQuantity());
@endphp

@if ($product->haveSufficientQuantity(1) > 0) 
    <div class="item-gallery-cart">

        <form class="add-to-cart-form" action="{{ route('cart.add', $product->product_id) }}" method="POST">
            @csrf
            <input type="hidden" name="product_id" value="{{ $product->product_id }}">
            <input type="hidden" name="quantity" value="1">
            <button type="submit" class="btn btn-lg btn-primary addtocart" {{ $product->isSaleable() ? '' : 'disabled' }}>
                <div class="item-gallery-cart-img">
                    <img src="{{ bagisto_asset('icons/icon (cart) 2.svg') }}" alt="cart" />
                </div>
                <span class="item-gallery-cart-text">
                    {{ ($product->type == 'booking') ?  __('shop::app.products.book-now') :  __('shop::app.products.add-to-cart') }}
                </span>
            </button>
        </form>

        @if ($showWishlist)
            @include('shop::products.wishlist') 
        @endif

    </div>
@else
    <button class="empty-button">{{__('shop::app.products.out-of-stock')}}</button>
@endif
