catalog.blade.php 17.6 KB
@extends('layout.site', ['title' => 'Каталог RentTorg'])

@section('filter')
   @include('part.filter.catalog')
@endsection

@section('custom_js')
    @include('js.filter_value')
    <script>
        $(document).on('click', '.js_sort_group_item', function() {
                var val = $(this).data('val');
                var sort_price_val = '';
                var sort_area_val = '';
                var sort_new_val = '';

                $('.sort-price').each(function() {
                    var this_ = $(this);
                    var v = $(this).data('val');
                    if (this_.hasClass('active'))
                        sort_price_val = v;
                });

                $('.sort-new').each(function() {
                    var v = $(this).data('val');
                    var this_ = $(this);
                    if (this_.hasClass('active'))
                        sort_new_val = v;
                });

                $('.sort-area').each(function() {
                    var v = $(this).data('val');
                    var this_ = $(this);
                    if (this_.hasClass('active'))
                        sort_area_val = v;

                });

                console.log('-----Загрузка ajax аренда---------');
                $.ajax({
                    type: "GET",
                    url: "{{ route('catalog') }}",
                    data: "view=arenda&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
                          "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
                          "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
                          "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
                    success: function(data) {
                        console.log('Успешно обновлены данные АРЕНДА таблиц ');
                        $('#arenda_block').html(data);
                    },
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    error: function(data) {
                        console.log('Error: '+ data);
                    }
                });

                console.log('---ajax продажи---');
                $.ajax({
                    type: "GET",
                    url: "{{ route('catalog') }}",
                    data: "view=prodaja&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
                          "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
                          "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
                          "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
                    success: function(data) {
                        console.log('Успешно обновлены данные ПРОДАЖА таблиц ');
                        $('#prodaja_block').html(data);
                    },
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    error: function(data) {
                        console.log('Error: '+ data);
                    }
                });

                console.log('---ajax бизнес---');
                $.ajax({
                    type: "GET",
                    url: "{{ route('catalog') }}",
                    data: "view=bissnes&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
                            "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
                            "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
                            "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
                    success: function(data) {
                        console.log('Успешно обновлены данные БИЗНЕС таблиц ');
                        $('#bissnes_block').html(data);
                    },
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    error: function(data) {
                        console.log('Error: '+ data);
                    }
                });

                console.log('---ajax арендованные---');
                $.ajax({
                    type: "GET",
                    url: "{{ route('catalog') }}",
                    data: "view=arendovannie&sort_price="+sort_price_val+"&sort_new="+sort_new_val+"&sort_area="+sort_area_val+""+
                            "&area=<?if (isset($_GET['area'])) echo $_GET['area'];?>&type_area=<?if (isset($_GET['type_area'])) echo $_GET['type_area'];?>&format_area=<? if (isset($_GET['format_area'])) echo $_GET['format_area'];?>"+
                            "&area_m2_min=<? if (isset($_GET['area_m2_min'])) echo $_GET['area_m2_min'];?>&area_m2_max=<? if (isset($_GET['area_m2_max'])) echo $_GET['area_m2_max'];?>"+
                            "&price_min=<? if (isset($_GET['price_min'])) echo $_GET['price_min'];?>&price_max=<? if (isset($_GET['price_max'])) echo $_GET['price_max'];?>&address=<? if (isset($_GET['address'])) echo $_GET['address'];?>",
                    success: function(data) {
                        console.log('Успешно обновлены данные таблиц АРЕНДОВАННЫЕ ');
                        $('#arendovannie_block').html(data);
                        //.append(data);
                    },
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    error: function(data) {
                        console.log('Error: '+ data);
                    }
                });

            }
        );
    </script>
@endsection

@section('content')
    <section class="catalog">
        <div class="container">
            <div class="catalog__top top-catalog">
                <div class="top-catalog__inner">
                    <h2 class="top-catalog__title title">Каталог коммерческой недвижимости</h2>
                    <div class="top-catalog__result">Найдено объектов по Вашему запросу: <span><?=$house_arenda->count()+$house_prodaja->count()+$house_bissnes->count()+$house_arendovannie->count(); ?></span></div>
                </div>
                <form class="top-catalog__sorts">
                    <div class="top-catalog__sort-group sort-group js_sort_group">
                        <input class="js_sort_group_input" type="hidden">
                        <div class="sort-group__current js_sort_group_current">Сначала дешевле</div>
                        <ul class="sort-group__list js_sort_group_list">
                            <li class="sort-price sort-group__item js_sort_group_item active" data-val="1">Сначала дешевле</li>
                            <li class="sort-price sort-group__item js_sort_group_item" data-val="2">Сначала дороже</li>
                        </ul>
                    </div>
                    <div class="top-catalog__sort-group sort-group js_sort_group">
                        <input class="js_sort_group_input" type="hidden">
                        <div class="sort-group__current js_sort_group_current">Сначала новые</div>
                        <ul class="sort-group__list js_sort_group_list">
                            <li class="sort-new sort-group__item js_sort_group_item active" data-val="1">Сначала новые</li>
                            <li class="sort-new sort-group__item js_sort_group_item" data-val="2">Сначала старые</li>
                        </ul>
                    </div>
                    <div class="top-catalog__sort-group sort-group sort-group--wide js_sort_group">
                        <input class="js_sort_group_input" type="hidden">
                        <div class="sort-group__current js_sort_group_current">Сначала с большей площадью</div>
                        <ul class="sort-group__list js_sort_group_list">
                            <li class="sort-area sort-group__item js_sort_group_item active" data-val="1">Сначала с большей площадью</li>
                            <li class="sort-area sort-group__item js_sort_group_item" data-val="2">Сначала с меньшей площадью</li>
                        </ul>
                    </div>
                </form>
            </div>
        </div>
        <div class="complex__sliders">
            <section class="slider">
                <div class="container">
                    <div class="slider__wrap">
                        <div class="slider__top">
                            <h2 class="slider__title title">Аренда торговых помещений</h2><a class="slider__more" href="{{ route('category', ['cat'=>'arenda']) }}">Показать все объекты</a>
                            <div class="slider__control">
                                <div class="swiper-button-prev">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                                <div class="swiper-button-next">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                            </div>
                        </div>
                        <div class="slider__swiper swiper">
                            <div class="swiper-wrapper" id="arenda_block">
                                @if ($house_arenda->count())
                                    @foreach ($house_arenda as $house1)
                                        @include('catalogs.elemhouse', ['house' => $house1])
                                    @endforeach
                                @else
                                    <h3>Здесь пока что нет предложений</h3>
                            @endif

                            </div>
                        </div>
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
            </section>
            <section class="slider">
                <div class="container">
                    <div class="slider__wrap">
                        <div class="slider__top">
                            <h2 class="slider__title title">Продажа торговых помещений</h2><a class="slider__more" href="{{ route('category', ['cat'=>'sale']) }}">Показать все объекты</a>
                            <div class="slider__control">
                                <div class="swiper-button-prev">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                                <div class="swiper-button-next">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                            </div>
                        </div>
                        <div class="slider__swiper swiper">
                            <div class="swiper-wrapper" id="prodaja_block">
                                @if ($house_prodaja->count())
                                    @foreach ($house_prodaja as $house2)
                                        @include('catalogs.elemhouse', ['house' => $house2])
                                    @endforeach
                                @else
                                    <h3>Здесь пока что нет предложений</h3>
                            @endif
                            </div>
                        </div>
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
            </section>
            <section class="slider">
                <div class="container">
                    <div class="slider__wrap">
                        <div class="slider__top">
                            <h2 class="slider__title title">Арендный бизнес</h2><a class="slider__more" href="{{ route('category', ['cat'=>'bussiness']) }}">Показать все объекты</a>
                            <div class="slider__control">
                                <div class="swiper-button-prev">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                                <div class="swiper-button-next">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                            </div>
                        </div>
                        <div class="slider__swiper swiper">
                            <div class="swiper-wrapper" id="bissnes_block">
                                @if ($house_bissnes->count())
                                    @foreach ($house_bissnes as $house3)
                                        @include('catalogs.elemhouse', ['house' => $house3])
                                    @endforeach
                                @else
                                    <h3>Здесь пока что нет предложений</h3>
                            @endif
                            </div>
                        </div>
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
            </section>
            <section class="slider">
                <div class="container">
                    <div class="slider__wrap">
                        <div class="slider__top">
                            <h2 class="slider__title title">Арендованные</h2><a class="slider__more" href="{{ route('category', ['cat'=>'arendovannie']) }}">Показать все объекты</a>
                            <div class="slider__control">
                                <div class="swiper-button-prev">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                                <div class="swiper-button-next">
                                    <svg width="10" height="17">
                                        <use xlink:href="{{ asset('images/sprite.svg#slider-arrow') }}"></use>
                                    </svg>
                                </div>
                            </div>
                        </div>
                        <div class="slider__swiper swiper">
                            <div class="swiper-wrapper" id="arendovannie_block">
                                @if ($house_arendovannie->count())
                                    @foreach ($house_arendovannie as $house1)
                                        @include('catalogs.elemhouse', ['house' => $house1])
                                    @endforeach
                                @else
                                    <h3>Здесь пока что нет предложений</h3>
                            @endif

                            </div>
                        </div>
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
            </section>
        </div>
    </section>
@endsection

@section('form_feedback')
    <!-- Форма обратной связи -->
    @include('form.form_feedback')
@endsection