@extends('layouts.front')

@section('content')

        <!-- Page Title -->
    <section class="page-title">
        <div class="auto-container">
			<h2>Product Page</h2>
			<ul class="bread-crumb clearfix">
				<li><a href="{{ route('user.home') }}">Home</a></li>
				<li>Pages</li>
				<li>Product Page</li>
			</ul>
        </div>
    </section>
    <!-- End Page Title -->
	
	<!-- Sidebar Page Container -->
    <div class="sidebar-page-container">
    	<div class="auto-container">
        	<div class="row clearfix">
				
				<!-- Content Side -->
                <div class="content-side col-lg-9 col-md-12 col-sm-12">
					<!-- Filter Box -->
					<!--<div class="filter-box">-->
					<!--	<div class="d-flex justify-content-between align-items-center flex-wrap">-->
							<!-- Left Box -->
					<!--		<div class="left-box d-flex align-items-center">-->
					<!--			<div class="results">Showing 1–12 of 54 results</div>-->
					<!--		</div>-->
							
					<!--		<div class="right-box d-flex">-->
					<!--			<div class="form-group">-->
					<!--				<select name="currency" class="custom-select-box">-->
					<!--					<option>Recently Added</option>-->
					<!--					<option>Added 01</option>-->
					<!--					<option>Added 02</option>-->
					<!--					<option>Added 03</option>-->
					<!--					<option>Added 04</option>-->
					<!--				</select>-->
					<!--			</div>-->
					<!--			<ul class="pages-list">-->
					<!--				<li><a class="flaticon-list" href="#"></a></li>-->
					<!--				<li><a class="flaticon-menu-2" href="#"></a></li>-->
					<!--			</ul>-->
					<!--		</div>-->
					<!--	</div>-->
					<!--</div>-->
					<!-- End Filter Box -->
					
					<div class="shops-outer">
						<div class="row clearfix">
							
							@if($product)
				            @foreach($product as $key => $value)
							<!-- Shop Item -->
							<div class="shop-item col-lg-4 col-md-4 col-sm-12">
								<div class="inner-box">
									<div class="image">
										<a href="{{ route('product.details', $value->slug) }}"><img src="{{ url('/') }}/public/product/{{ $value->image }}" alt="" /></a>
										<div class="options-box">
											<ul class="option-list">
												<!--<li><a class="flaticon-resize" href="shop-detail.html"></a></li>-->
												<!--<li><a class="flaticon-heart" href="shop-detail.html"></a></li>-->
												<li><a class="flaticon-shopping-cart-2" href="{{ route('product.details', $value->slug) }}"></a></li>
											</ul>
										</div>
									</div>
									<div class="lower-content">
										<h6><a href="{{ route('product.details', $value->slug) }}">{{ $value->name }}</a></h6>
										<div class="d-flex justify-content-between align-items-center">
										    @if($value->discount_amount) <div class="price">AED {{ $value->discount_amount }} <span>AED {{ $value->original_amount }}</span></div> @endif
										</div>
									</div>
								</div>
							</div>
							@endforeach
							@endif
							
						</div>
					
						<!-- Styled Pagination -->
						<!--<ul class="styled-pagination text-center">-->
						<!--	<li class="next"><a href="#"><span class="fa fa-angle-double-left"></span></a></li>-->
						<!--	<li><a href="#" class="active">1</a></li>-->
						<!--	<li><a href="#">2</a></li>-->
						<!--	<li><a href="#">3</a></li>-->
						<!--	<li class="next"><a href="#"><span class="fa fa-angle-double-right"></span></a></li>-->
						<!--</ul>-->
						<!-- End Styled Pagination -->
					
					</div>
					
				</div>
				
				<!-- Sidebar Side -->
                <div class="sidebar-side col-lg-3 col-md-12 col-sm-12">
                	<aside class="sidebar sticky-top">
						
						<!-- Category Widget -->
						<div class="sidebar-widget category-widget">
							<div class="widget-content">
								<!-- Sidebar Title -->
								<div class="sidebar-title">
									<h6>Product Catagories</h6>
								</div>
								<!-- Category List -->
								<ul class="category-list">
								    
								    @if($category)
								    @foreach($category as $key => $value1)
								    <?php
								        // dd($value1);
								        $total_product = \App\Models\Product::where('category_id', $value1->id)->get();
								    ?>
									    <li><a href="{{ route('user.category', $value1->image) }}">{{ $value1->name }} <span>({{ count($total_product) }})</span></a></li>
									@endforeach
									@endif
									
								</ul>
								
							</div>
						</div>
						
					</aside>
				</div>
				
			</div>
		</div>
	</div>

@endsection