@extends('web.layouts.layout')
@section('content')

    <main>
        <!-- Start section -->
    @include('web.layouts.header')


        <section class="products_sec section">
            <div class="container">
                @if(count($products) == 0)
                    <div class="row justify-content-center">
                        <div class="col-lg-7">
                            <div class="alert alert-light py-4 text-center" role="alert">
                                @isset($fav) {{__('web.not_exist_products_fav')}} @else {{__('web.not_exist_products_search')}} @endisset
                            </div>
                        </div>
                    </div>
                @else
                    <div class="row">
                        @foreach($products as $row)
                            <div class="col-lg-2 col-md-4 col-6">
                                @include('web.pages.components.product.product',['product'=>$row])
                            </div>
                        @endforeach
                    </div>
                @endif
            </div>
        </section>


    <!-- Start section -->
        @include('web.layouts.newsletter')
    </main>
@section('inject_js')
    <script>
        let url_fetch_subAttr = "{{route('fetch.attributeSub')}}"
        function showSubAttribute()
        {
            let data = $('#filter').serialize();
            $.ajax
            ({
                url : url_fetch_subAttr,
                type: 'GET',
                data: data,
                success:function(data)
                {
                    $('.sub_attributes').html('');
                    $.each( data.data, function( key, value ) {
                        $('#sub_attribute_'+key).html(value);
                    });
                }
            })
        }
    </script>
@endsection
@stop
