@extends('layouts.app')
@section('contentSection')
    <section id="desktop-header-search" class="advanced-search advanced-search-nav " data-hidden="0" data-sticky="0">
        <div class="container">
            <form class="houzez-search-form-js advanced-search-from" method="get" autocomplete="off" action="/search-results">
                <input id="products-search-sort" type="hidden" name="sort" value="{{ request()->get('sort') }}">
                <div class="advanced-search-v1 ">
                    <div class="d-flex">
                        <div class="flex-search flex-grow-1">
                            <div class="form-group">
                                <select data-live-search="true" class="form-control selectpicker" name="location"
                                    id="userlocation">
                                    <option value="">Enter Location</option>
                                    @foreach (App\Models\Attribute::whereType('location')->orderBy('name')->get() as $attr)
                                        <option value="{{ $attr->name }}"
                                            {{ request()->has('location') && request()->input('location') == $attr->name ? 'selected' : '' }}>
                                            {{ $attr->name }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="flex-search fields-width">
                            <div class="form-group">
                                <input maxlength="10" onkeypress="return onlyNumberKey(event)" name="min_area"
                                    type="text" class="form-control"
                                    value="{{ request()->has('min_area') ? request()->input('min_area') : '' }}"
                                    placeholder="Min. Area">
                            </div>
                        </div>
                        <div class="flex-search fields-width">
                            <div class="form-group">
                                <input maxlength="10" onkeypress="return onlyNumberKey(event)" name="max_area"
                                    type="text" class="form-control"
                                    value="{{ request()->has('max_area') ? request()->input('max_area') : '' }}"
                                    placeholder="Max. Area">
                            </div>
                        </div>
                        <div class="flex-search fields-width">
                            <div class="form-group">
                                <input maxlength="10" onkeypress="return onlyNumberKey(event)" name="min_price"
                                    type="text" class="form-control"
                                    value="{{ request()->has('min_price') ? request()->input('min_price') : '' }}"
                                    placeholder="Min. Price">
                            </div>
                        </div>
                        <div class="flex-search fields-width">
                            <div class="form-group">
                                <input maxlength="10" onkeypress="return onlyNumberKey(event)" name="max_price"
                                    type="text" class="form-control"
                                    value="{{ request()->has('max_price') ? request()->input('max_price') : '' }}"
                                    placeholder="Max. Price">
                            </div>
                        </div>
                        <div class="flex-search btn-no-right-padding">
                            <button type="submit" class="btn btn-block form-control theme-btn-inverse ">Search</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </section>

    <section class="our-listing pb30-991 pt10">
        <div class="container">
            <div class="row">
                <div class="col-lg-6">
                    <div class="breadcrumb_content style2 mb0-991">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a class="theme-color" href="/">Home</a></li>
                            <li class="breadcrumb-item active text-blank" aria-current="page">{{ $slug->title }}
                            </li>
                        </ol>
                        <h2 class="breadcrumb_title">{{ $slug->title }}</h2>
                    </div>
                </div>
            </div>
            <div class="row">
                @foreach ($slug->posts as $post)
                    <div class="col-md-4">
                        <div class="item">
                            <div class="feat_property">
                                <div class="thumb">
                                    <a href="/post/{{ $post->slug }}"><img class="img-whp"
                                            src="{{ $post->getThumbImagePublicUrlAttribute() }}"
                                            alt="{{ $post->title }}"></a>
                                </div>
                                <div class="details">
                                    <div class="tc_content">
                                        <p class="text-thm">{{ $post->category ? $post->category->title : '' }}</p>
                                        <a href="/post/{{ $post->slug }}">
                                            <h4>{{ $post->title }}</h4>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
    </section>
@endsection
