@extends('site.index')
@section('content')
@php
use App\Models\ProductUnits;
use App\Models\Countris;
use App\Models\Wishlist;
use App\Models\Compare;
use App\Models\ItemsGroups;
use App\Models\Coins;
    if(empty(session()->get('ChangeCountryy'))) {
    
         $Coin=Coins::where('Draw',1)->first();
    $Country=Countris::where('Coin',$Coin->id)->first();
    session()->put('ChangeCountryy',$Country->id);  
      }
$Ses=Countris::find(session()->get('ChangeCountryy'));

use App\Models\MainEComDesign;
use App\Models\SupPagesPartTwoEComDesign;
$main=MainEComDesign::orderBy('id','desc')->first();
$sub=SupPagesPartTwoEComDesign::orderBy('id','desc')->first();
@endphp


 <style>
.page-title-area {
    background-color: {{$main->Breadcumb_BG_Color}} !important;
}
     
    .shop-area {
      background-color: {{$main->Sub_Page_BG_Color}} !important;
} 
     
     
     .single-shop-products {
         background: {{$sub->Shop_Product_BG_Color}} !important;
     }
     
     
     .single-shop-products .shop-products-image .tag {

    background: {{$sub->Shop_Product_Group_BG_Color}} !important;
    color:{{$sub->Shop_Product_Group_Txt_Color}} !important;
         
     }
     
          .single-shop-products .shop-products-image .tag:hover {

    background: {{$sub->Shop_Product_Group_Hover_BG_Color}} !important;
    color:{{$sub->Shop_Product_Group_Hover_Txt_Color}} !important;
         
     }
     
     
     .single-shop-products .shop-products-image .shop-action li a i {

    background: {{$sub->Shop_Product_Icon_BG_Color}} !important;
    color:{{$sub->Shop_Product_Icon_Txt_Color}} !important;
         
     }
     
         .single-shop-products .shop-products-image .shop-action li a i:hover {

    background: {{$sub->Shop_Product_Icon_Hover_BG_Color}} !important;
    color:{{$sub->Shop_Product_Icon_Hover_Txt_Color}} !important;
         
     }
     
     
         .single-shop-products .shop-products-image .shop-action li i {

    color:{{$sub->Shop_Product_Icon_Txt_Color}} !important;
         
     }
     
     .single-shop-products .shop-products-content h3 a{
           color:{{$sub->Shop_Product_Txt_Color}} !important;
         
     }
     
     .single-shop-products .shop-products-content .rating li i {
         
             color:{{$sub->Shop_Product_Rate_Color}} !important;
     }
     
     .single-shop-products .shop-products-content span{
         
           color:{{$sub->Shop_Product_Price_Color}} !important;
     }
     
          .single-shop-products .shop-products-content span del{
         
           color:{{$sub->Shop_Product_Price_Color}} !important;
     }
     
     .widget-area .widget_search form .search-field {
    background-color: {{$sub->Shop_Filter_Search_BG_Color}} !important;
    border: 1px solid {{$sub->Shop_Filter_Title_Color}} !important;
     }
     
     .widget-area .widget_search form button {

    background-color: {{$sub->Shop_Filter_Search_Icon_BG_Color}} !important;
    color: {{$sub->Shop_Filter_Search_Icon_Txt_Color}} !important;
     }
     
          .widget-area .widget_search form button:hover {

    background-color: {{$sub->Shop_Filter_Search_Icon_BG_Hover_Color}} !important;
    color: {{$sub->Shop_Filter_Search_Icon_Txt_Hover_Color}} !important;
     }
     
     .widget-area .widget .widget-title {

    color: {{$sub->Shop_Filter_Title_Color}} !important;
    border-bottom: 1px solid {{$sub->Shop_Filter_Title_Color}} !important;
     }
     
     .widget-area .widget .widget-title::before {

    background: {{$sub->Shop_Filter_Title_Color}} !important;
     }
     
     .widget-area .widget_categories .categories li a {
    color: {{$sub->Shop_Filter_Txt_Color}} !important;
    border: 1px solid {{$sub->Shop_Filter_Txt_Color}} !important;
     }
     
     .widget-area .widget_best-seller-products .item .info .title a{
         
           color:{{$sub->Shop_Product_Txt_Color}} !important; 
     }
     
         .widget-area .widget_best-seller-products .item .info .title a:hover{
         
           color:{{$sub->Shop_Product_Txt_Color}} !important; 
     }
     
     .widget-area .widget_best-seller-products .item .info span{
         
       
    color:{{$sub->Shop_Product_Price_Color}} !important;
     }
     
          
     .widget-area .widget_best-seller-products .item .info span del{
         
       
    color:{{$sub->Shop_Product_Price_Color}} !important;
     }
     
     .widget-area .widget_best-seller-products .item .info .rating li i{
       color:{{$sub->Shop_Product_Rate_Color}} !important;   
     }
     
         
     .widget-area .widget_categories .categories li a::before {
    background-color: {{$sub->Shop_Product_Group_BG_Color}} !important;  
     }
</style>






    <title>{{trans('admin.Shop')}}</title>



        <!-- Start Page Banner -->
        <div class="page-title-area">
            <div class="container">
                <div class="page-title-content">
                    <h2 style="color: {{$main->Breadcumb_Txt_Color}} !important">{{trans('admin.Shop')}}</h2>

                    <ul>
                        <li><a style="color: {{$main->Breadcumb_Txt_Color}} !important" href="{{url('/')}}">{{trans('admin.Home')}}</a></li>
                        <li style="color: {{$main->Breadcumb_Txt_Color}} !important">{{trans('admin.Shop')}}</li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- End Page Banner -->

        <!-- Start Shop Area -->
        <section class="shop-area bg-ffffff pt-50 pb-50">
            <div class="container">
                <div class="row">
                    <div class="col-lg-4 col-md-12">
                        <aside class="widget-area">
                            <div class="widget widget_search">
                                <form class="search-form" action="{{url('ShopFilterName')}}" method="get">
                                    <label>
                                        <span class="screen-reader-text">Search for:</span>
                                        <input type="search" name="search" class="search-field" placeholder="{{trans('admin.Search_For_Products')}}">
                                    </label>
                                    <button type="submit">
                                        <i class='bx bx-search-alt'></i>
                                    </button>
                                </form>
                            </div>
                    
                            <div class="widget widget_categories">
                                <h3 class="widget-title">{{trans('admin.Brands')}}</h3>
      

  
                                <ul class="categories">
                                    

     
                                        @foreach($Brands as $brand)
                                    <li>
                                        <a href="{{url('ShopFilterBrand/'.$brand->id)}}" class="nav-link">
                                            <i class="bx bx-certification"></i>
                                      {{app()->getLocale() == 'ar' ?$brand->Name :$brand->NameEn}} 
                                        </a>
                                    </li>
                                    @endforeach
                                
                                </ul>
                            </div>
                            
                            
                                   <div class="widget widget_categories">
                                <h3 class="widget-title">{{trans('admin.Categories')}}</h3>
    
                                <ul class="categories">
                                                  @foreach($Groups as $group)
                                    <li>
                                        <a href="{{url('FilterShopCat/'.$group->id)}}" class="nav-link">
                                            <i class="bx bx-certification"></i>
                                        {{app()->getLocale() == 'ar' ?$group->Name :$group->NameEn}}  
                                        </a>
                                    </li>
                                    @endforeach
                                
                                </ul>
                            </div>
                            
                            
           

                            <div class="widget widget_best-seller-products">
                                <h3 class="widget-title">{{trans('admin.New_Arrivals')}}</h3>

                                @foreach($ProductsNew as $pro)
                                <article class="item">
                                  

                                    <a href="{{url('ProductDetails/'.$pro->id)}}" class="thumb">
                                        <span class="fullimage cover bg1" role="img" style="background-image: url({{URL::to($pro->Image)}})"></span>
                                    </a>
                                    <div class="info">
                                        <h4 class="title usmall">
                                            <a href="{{url('ProductDetails/'.$pro->id)}}"> {{app()->getLocale() == 'ar' ?$pro->P_Ar_Name :$pro->P_En_Name}}  </a>
                                        </h4>
                                                   <span>
                                
     @php  $Price=ProductUnits::where('Product',$pro->id)->where('Def',1)->first();   @endphp  
     @if($pro->Offer == 1)
<del>{{$Ses->Coin()->first()->Symbol}}{{round($Price->Price / $Ses->Coin()->first()->Draw)}}</del>
{{$Ses->Coin()->first()->Symbol}}{{round($pro->OfferPrice / $Ses->Coin()->first()->Draw)}}
        @else
{{$Ses->Coin()->first()->Symbol}}{{round($Price->Price / $Ses->Coin()->first()->Draw)}}
        @endif     
                                
                                
                                </span>
                                        <ul class="rating">
                                                @if(empty($pro->rate))
                                                          <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 1) 
                                                          <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 2)  
                                                 <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 3) 
                                                           <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 4)  
                                                               <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 5)
                                                             <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                            @endif  
                                        </ul>
                                    </div>
                                </article>
                                @endforeach
                          
                            </div>

                         
                        </aside>
                    </div>
                    
                    <div class="col-lg-8 col-md-12">
                        <div class="products-filter-options">
                 
        
                        <div id="products-collections-filter" class="row">
                            
                               @foreach($Products as $pro)
                            <div class="col-lg-4 col-sm-6">
                                <div class="single-shop-products">
                                    <div class="shop-products-image">
                                        <a href="{{url('ProductDetails/'.$pro->id)}}"><img src="{{URL::to($pro->Image)}}" alt="image"></a>
                                        <div class="tag">             {{app()->getLocale() == 'ar' ?$pro->Group()->first()->Name :$pro->Group()->first()->NameEn}}  </div>
                                        <ul class="shop-action">
                                      <li>
                                        <a href="{{url('ProductDetails/'.$pro->id)}}">
                                            <i class="flaticon-shopping-cart"></i>
                                        </a>
                                    </li>
                                    
                                   @if(!empty(auth()->guard('client')->user()->id))            
                                    @php            
                                       $Wish=Wishlist::where('Product',$pro->id)
                                            ->where('User',auth()->guard('client')->user()->id)->first(); 
                                       
                                                       $Comp=Compare::where('Product',$pro->id)
                                            ->where('User',auth()->guard('client')->user()->id)->first(); 
                                                
                                    @endphp
          
                                    <li>
                                        
                                        @if(empty($Wish))     
                                        <a href="{{url('AddWish/'.$pro->id)}}"><i class="flaticon-heart"></i></a>
                                             @else   
                                       
                                        <i class="bx bxs-heart"></i>
                                            @endif 
                                    </li>
                                    <li>
                                       @if(empty($Comp))      
                                        <a href="{{url('AddCompare/'.$pro->id)}}"><i class="bx bx-git-compare"></i></a>
                                        @else
                                        
                                        <i class="bx bx-git-compare">  <i class="bx bx-badge-check"></i></i>
                                      
                                          @endif  
                                    </li>
                          @endif   
                                        </ul>
                                    </div>
        
                                    <div class="shop-products-content">
                                        <h3>
                                        <a href="{{url('ProductDetails/'.$pro->id)}}">   {{app()->getLocale() == 'ar' ?$pro->P_Ar_Name :$pro->P_En_Name}}     </a>
                                        </h3>
                                        <ul class="rating">
                                      @if(empty($pro->rate))
                                                          <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 1) 
                                                          <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 2)  
                                                 <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 3) 
                                                           <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 4)  
                                                               <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bx-star'></i></li>
                                            @elseif($pro->rate == 5)
                                                             <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                    <li><i class='bx bxs-star'></i></li>
                                            @endif  
               
                                        </ul>
                                                                <span>
                                
     @php  $Price=ProductUnits::where('Product',$pro->id)->where('Def',1)->first();   @endphp  
     @if($pro->Offer == 1)
<del>{{$Ses->Coin()->first()->Symbol}}{{round($Price->Price / $Ses->Coin()->first()->Draw)}}</del>
{{$Ses->Coin()->first()->Symbol}}{{round($pro->OfferPrice / $Ses->Coin()->first()->Draw)}}
        @else
{{$Ses->Coin()->first()->Symbol}}{{round($Price->Price / $Ses->Coin()->first()->Draw)}}
        @endif     
                                
                                
                                </span>
                                    </div>
                                </div>
                            </div>
                            @endforeach
                    
                           
                            
        
                            <div class="col-lg-12 col-md-12">
                                <div class="pagination-area">
                                {{$Products->Links()}}
                              
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
        </section>
        <!-- End Shop Area -->
<!-- Pagination -->
<style> 
.page-item disabled,
.page-link,
.page-item active,
.page-item
    {
    		    background: {{$main->Pagination_BG_Color}} !important;
   color: {{$main->Pagination_Txt_Color}} !important;    
    }

    .page-item.active .page-link{
          		    background: {{$main->Pagination_Active_BG_Color}} !important;
   color: {{$main->Pagination_Active_Txt_Color}} !important;    
border-color:{{$main->Pagination_Active_Txt_Color}} !important;
        
    }

</style>

@endsection