@extends("Front::Layout.master")

@section("title")
   سبد خرید
@endsection


@section("meta")
    <meta name="robots" content="nofollow, noindex">
@endsection

@section("content")
        <div class="container">
            <div class="rows">
                @if(!empty($cart_products))
                    @if($cart_products->isNotEmpty())
                        @includeIf("Front::cart_use_wallet")
                        @includeIf("Front::cart_use_club")

                    <div class="cart_page">
                    <div class="cart-top">

                        <p>سبد خرید
                            <span>{{ $cart_products_total_number }}</span>
                        </p>
                    </div>
                    <div class="row" style="    align-items: flex-start;">
                        <form class="woocommerce-cart-form col-md-9" method="post">

                            <div class="c-checkout__header c-checkout__header--express">
                                <span class="c-checkout__header-title">ارسال عادی</span><span class="c-checkout__header-extra-info">
                                ({{$cart_products_total_number}}                                 کالا)
                            </span></div>


                            <table class="shop_table shop_table_responsive cart " cellspacing="0">

                                <thead>

                                            <tr>
                                                <th class="product-name">محصول</th>
                                                <th class="product-price">قیمت</th>
                                                <th class="product-quantity">تعداد</th>
                                                <th class="product-subtotal">جمع جزء</th>
                                            </tr>
                                </thead>

                                <tbody>
                                @foreach($cart_products as $cart_product)
                                    <tr class="cart-form__cart-item cart_item">



                                        <td class="product-thumbnail">
                                            <div class="col-md-3">
                                                <a href="{{ $cart_product->url }}">
                                                    <img  src="{{ asset(store_image_link($cart_product->media_id)) }}" >
                                                </a>
                                            </div>
                                            <div class="col-md-9">
                                                <div class="product-name" data-title="محصول">
                                                    <a href="{{ $cart_product->url }}">{{ $cart_product->title }}
                                                    </a>
                                                    @if(isset($cart[$cart_product->id]["variation"]))
                                                        {!! $cart_product->get_variation_by_value($cart[$cart_product->id]["variation"]) !!}
                                                    @endif
                                                </div>

                                                <div class="product-quantity" data-title="تعداد">

                                                    <div class="quantity">
                                                        <label class="screen-reader-text" >{{ $cart_product->title }}  عدد</label>
                                                        <input type="number" class="input-text qty text" step="1" min="0" max="" name="cart_item_quantity[{{ $cart_product->id }}]" value="{{  $cart[$cart_product->id]["quantity"]  }}" title="تعداد" size="4" inputmode="numeric">
                                                    </div>
                                                    <div class="iformation-p">

                                                    </div>
                                                    <div class="row" style="    align-items: center;">
                                                        <div class="quantity2 ">
                                                            <a href="{{ route("increase_cart",["id"=>$cart_product->id,"variation"=>isset($cart[$cart_product->id]["variation"]) ?$cart[$cart_product->id]["variation"] : '' ])  }}">
                                                                <div id="btn1" ><i class="fa fa-plus"></i></div>
                                                            </a>

                                                            <div id="btn2" class="ssdsdsdsa">{{  $cart[$cart_product->id]["quantity"]  }}</div>

                                                            <a href="{{ route("decrease_cart",["id"=>$cart_product->id]) }}">
                                                                <div id="btn3">
                                                                    <i class="fa fa-minus" ></i>
                                                                </div>
                                                            </a>
                                                        </div>
                                                        <div class="delete-item-cart">
                                                            <a href="{{ route("delete_cart",["id"=>$cart_product->id]) }}" class="" aria-label="حذف این آیتم" >
                                                                <div id="btn4">

                                                                    <i class="fas fa-trash"></i>

                                                                </div>
                                                            </a>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="product-subtotal" data-title="جمع جزء">
                                                    @if($cart_product->product_type=="group_product")
                                                    @php($cart_product->set_parent_group_product($cart[$cart_product->id]["group_product"]))
                                                    @endif
                                                        {!! $cart_product->product_price_with_quantity($cart[$cart_product->id]["quantity"],$cart[$cart_product->id]["variation"]) !!}
                                                </div>
                                            </div>
                                        </td>


                                    </tr>
                                @endforeach

                                </tbody>
                            </table>
                        </form>


                        @includeIf("Front::cart_total_box",["cart_page"=>true])

                    </div>

                </div>
                    @endif
                @else
                    <div class="c-tab-checkout-empty__cart">
                        <section class="c-checkout-empty__container">
                            <div class="c-checkout-empty">
                                <div class="c-checkout-empty__empty-cart-icon">

                                </div>
                                <div class="c-checkout-empty__title">
                                    سبد خرید شما خالی است!
                                </div>
                                <div class="c-checkout-empty__links"><p>
                                        می&zwnj;توانید برای مشاهده محصولات بیشتر به صفحات زیر بروید
                                    </p>
                                    <div class="c-checkout-empty__link-urls">
                                        <a href="{{ route("shop.index") }}">
                                            فروشگاه
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </section>
                    </div>



                @endif
        </div>

@endsection
