@extends('layouts.app')
@section('contentSection')
    <section class="our-listing pb0 pt30">
        <div class="container-fluid">
            <div class="row {{ $slug->gallery ? 'mb320' : '' }}">
                <div class="col-md-8">
                    <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>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="fp_footer text-right">
                        @if ($slug->brochure)
                            <a href="/{{ $slug->brochure }}" target="_blank" class="btn theme-btn">
                                <i class="fa fa-download"></i>
                            </a>
                        @endif
                        <div class="share-button" id="share">
                            <button class="clear dropdown-toggle btn" title="Share" data-toggle="dropdown"
                                    type="button">
                                <i class="fa fa-share-alt" aria-hidden="true"></i>
                            </button>
                            <div class="dropdown-menu share-menu pull-right" role="menu">
                                <div class="wrap">
                                    <!-- Begin Share -->
                                    <div class="share">
                                        <a target="_blank"
                                           href="https://api.whatsapp.com/send?text={{ request()->fullUrl() }}"></a>
                                        <a target="_blank"
                                           href="https://www.facebook.com/sharer/sharer.php?u={{ request()->fullUrl() }}"></a>
                                        <a target="_blank"
                                           href="https://twitter.com/intent/tweet?url={{ request()->fullUrl() }}"></a>
                                        <a target="_blank"
                                           href="https://www.pinterest.com/pin/create/button/?url={{ request()->fullUrl() }}"></a>
                                        <a target="_blank"
                                           href="https://www.linkedin.com/shareArticle?url={{ request()->fullUrl() }}"></a>
                                        <a target="_blank" href="mailto:?body={{ request()->fullUrl() }}"></a>
                                    </div>
                                    <!-- End Share -->

                                    <!-- Begin Link -->
                                    <div class="link">
                                        <input class="c-form-control" id="share-embed" name="link" type="text"
                                               readonly="" value="{{ request()->fullUrl() }}">

                                        <button class="share-btn copy-link" title="Copy to Clipboard" type="button"
                                                data-copytarget="#share-embed">
                                            <i class="fa fa-copy"></i>
                                        </button>

                                        <button class="share-btn no-link" title="Back" type="button">
                                            <i class="fa fa-arrow-up"></i>
                                        </button>
                                    </div>
                                    <!-- End Link -->

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <section class="listing-title-area pt0 pb0">
        <div class="container-fluid">
            @if ($slug->gallery)
                @php
                    $gallery = json_decode($slug->gallery, true);
                @endphp
                <div class="row">
                    <div class="col-sm-7 col-lg-8">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="spls_style_two zoom_main_img mb30">
                                    <a class="popup-img" href="/{{ $gallery[0]['path'] }}">
                                        <img class="img-fluid w100" src="/{{ $gallery[0]['path'] }}">
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-5 col-lg-4">
                        <div class="row">
                            @foreach ($gallery as $key => $file)
                                @if ($key != 0)
                                    <div class="col-sm-6 col-lg-6 {{ $key >= 7 ? 'dn' : '' }}">
                                        @if ($key == 6)
                                            @if (count($gallery) == 7)
                                                <div class="spls_style_two mb30 img_grid_container">
                                                    <a class="popup-img" href="/{{ $file['path'] }}"><img
                                                            class="img-fluid w100" src="/{{ $file['path'] }}"></a>
                                                </div>
                                            @else
                                                <div class="spls_style_two img_grid_container end_style mb30">
                                                    <img class="img-fluid w100" src="/{{ $file['path'] }}">
                                                    <h3 class="title">
                                                        <a class="popup-img" href="/{{ $file['path'] }}">
                                                            +{{ count($gallery) > 7 ? count($gallery) - 7 : '' }}
                                                            More
                                                        </a>
                                                    </h3>
                                                </div>
                                            @endif
                                        @else
                                            <div class="spls_style_two mb30 img_grid_container">
                                                <a class="popup-img" href="/{{ $file['path'] }}"><img
                                                        class="img-fluid w100" src="/{{ $file['path'] }}"></a>
                                            </div>
                                        @endif
                                    </div>
                                @endif
                            @endforeach
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </section>

    <section class="listing-title-area pt0 pb30">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="single_property_title property_details_top"
                         style="{{ $slug->purpose_id == 38 ? 'border: 1px solid #d19c15' : '' }}">
                        @if ($slug->purpose_id == 38)
                            <div class="row">
                                <div class="col-md-2">
                                    <p class="ne">{{ $slug->p_id }}</p>
                                    <p>Property ID</p>
                                </div>
                                @if ($slug->beds)
                                    <div class="col-md-2">
                                         <p class="ne"><i class="fa fa-bed"></i>
                                            {{ $slug->beds }}{{ $slug->max_beds ? '-' . $slug->max_beds : '' }}</p>
                                        <p>Bedrooms</p>
                                    </div>
                                @endif
                                @if ($slug->baths)
                                    <div class="col-md-2">
                                        <p class="ne"><i class="fa fa-bath"></i>
                                            {{ $slug->baths }}{{ $slug->max_baths ? '-' . $slug->max_baths : '' }}</p>
                                        <p>Bathrooms</p>
                                    </div>
                                @endif
                                @if ($slug->area)
                                    <div class="col-md-2">
                                         <p class="ne"><i class="fa fa-area-chart"></i>
                                            {{ number_format($slug->area) }}{{ $slug->max_area ? '-' . number_format($slug->max_area) : '' }}
                                        </p>
                                        <p>Area (Sqft)</p>
                                    </div>
                                @endif
                                @if ($slug->project_completion_date)
                                    <div class="col-md-2">
                                        <p class="ne">{{ $slug->project_completion_date }}</p>
                                        <p>Project completion Date</p>
                                    </div>
                                @endif
                                @if ($slug->unit_type)
                                    <div class="col-md-2">
                                         <p class="ne">{{ $slug->unit_type->name }}</p>
                                        <p>Unit type</p>
                                    </div>
                                @endif
                            </div>
                        @else
                            <div class="row">
                                <div class="col-md-3">
                                     <p class="ne">{{ $slug->p_id }}</p>
                                    <p>Property ID</p>
                                </div>
                                @if ($slug->beds)
                                    <div class="col-md-3">
                                         <p class="ne"><i class="fa fa-bed"></i>
                                            {{ $slug->beds }}{{ $slug->max_beds ? '-' . $slug->max_beds : '' }}</p>
                                        <p>Bedrooms</p>
                                    </div>
                                @endif
                                @if ($slug->baths)
                                    <div class="col-md-3">
                                         <p class="ne"><i class="fa fa-bath"></i>
                                            {{ $slug->baths }}{{ $slug->max_baths ? '-' . $slug->max_baths : '' }}</p>
                                        <p>Bathrooms</p>
                                    </div>
                                @endif
                                @if ($slug->area)
                                    <div class="col-md-3">
                                         <p class="ne"><i class="fa fa-area-chart"></i>
                                            {{ number_format($slug->area) }}{{ $slug->max_area ? '-' . number_format($slug->max_area) : '' }}
                                        </p>
                                        <p>Area (Sqft)</p>
                                    </div>
                                @endif
                            </div>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="listing-title-area pt0">
        <div class="container-fluid">
            <div class="row {{ $slug->purpose_id == 38 ? 'is_offplan' : '' }}">
                <div class="col-md-7">
                    <div class="single_property_title mt30-767">
                        <h1 class="no">{{ $slug->title }}</h1>
                        @if ($slug->getHK())
                            <p class="fw900 m0"><span class="flaticon-placeholder"></span>
                                {!! $slug->getHK() !!}
                            </p>
                        @endif
                    </div>
                </div>

                <div class="col-md-5">
                    <div class="single_property_title mt30-767 text-right">
                        @if ($slug->price)
                            <h2>AED
                                {{ number_format($slug->price) }}
                                @if ($slug->purpose && $slug->purpose->id == 37 && $slug->rent_frequency)
                                    / {{ $slug->rent_frequency->name }}
                                @endif
                            </h2>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Agent Single Grid View -->
    <section class="our-agent-single bgc-f7 pb30-991 pt30">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12 col-lg-8">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="listing_single_description">
                                <h3 class="mb20">Description</h3>
                                {!! $slug->full_desc !!}
                            </div>
                        </div>
                        @if ($slug->features)
                            <div class="col-lg-12">
                                <div class="application_statics mt30 mb30">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <h4 class="mb10">Features / Amenities</h4><br>
                                        </div>
                                        @foreach ($features as $parentName => $attributes)
                                            <div class="col-md-12">
                                                <h4 class="m0">{{ $parentName }}</h4>
                                            </div>
                                            @foreach ($attributes as $attribute)
                                                <div class="col-md-4">
                                                    <ul class="order_list list-inline-item">
                                                        <li><a
                                                                style="color: #{{ $slug->purpose_id == 38 ? 'd19c15' : '2fa1c6' }};font-size: 14px;font-weight: bold;"><i
                                                                    class="fa fa-check-circle"></i>
                                                                {{ $attribute->name }}</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            @endforeach
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        @endif
                        <div class="col-lg-12">
                            <div class="additional_details">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <h3 class="mb15">Details</h4>
                                    </div>
                                    <div class="col-md-6">
                                        <ul class="list-inline-item">
                                            <li>
                                                <p>Bedroom:</p>
                                            </li>
                                            <li>
                                                <p>Purpose:</p>
                                            </li>
                                            <li>
                                                <p>Verified property::</p>
                                            </li>
                                            @if($slug->cheque)
                                                <li>
                                                    <p>Cheque's:</p>
                                                </li>
                                            @endif
                                        </ul>
                                        <ul class="list-inline-item">
                                            <li>
                                                <p><span>
                                                        @if ($slug->beds)
                                                            {{ $slug->beds }}{{ $slug->max_beds ? '-' . $slug->max_beds : '' }}
                                                        @else
                                                            N/A
                                                        @endif
                                                    </span></p>
                                            </li>
                                            <li>
                                                <p><span>{{ $slug->purpose ? $slug->purpose->name : 'N/A' }}</span></p>
                                            </li>
                                            <li>
                                                <p>
                                                    <span>{{ $slug->is_verified == 1 ? 'Verified' : 'Unverified' }}</span>
                                                </p>
                                            </li>
                                            @if($slug->cheque)
                                                <li>
                                                    <p><span>{{$slug->cheque->name}}</span>
                                                    </p>
                                                </li>
                                            @endif
                                        </ul>
                                    </div>
                                    <div class="col-md-6">
                                        <ul class="list-inline-item">
                                            <li>
                                                <p>Bathrooms :</p>
                                            </li>
                                            <li>
                                                <p>Property type :</p>
                                            </li>
                                            <li>
                                                <p>Ownership Status :</p>
                                            </li>
                                        </ul>
                                        <ul class="list-inline-item">
                                            <li>
                                                <p><span>
                                                        @if ($slug->baths)
                                                            {{ $slug->baths }}{{ $slug->max_baths ? '-' . $slug->max_baths : '' }}
                                                        @else
                                                            N/A
                                                        @endif
                                                    </span></p>
                                            </li>
                                            <li>
                                                <p>
                                                    <span>{{ $slug->property_type ? $slug->property_type->name : 'N/A' }}</span>
                                                </p>
                                            </li>
                                            <li>
                                                <p>
                                                    <span>{{ $slug->ownership_status ? $slug->ownership_status->name : 'N/A' }}</span>
                                                </p>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        @if ($slug->listing_details)
                            <div class="col-lg-12">
                                <div class="additional_details mt30">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <h3 class="mb15">Additional Details</h4>
                                        </div>
                                        <div class="ui_kit_table col-lg-12 table-responsive">
                                            <table class="table">
                                                <thead class="thead-light">
                                                <tr>
                                                    <th scope="col">Title</th>
                                                    <th scope="col">Starting From</th>
                                                    <th scope="col">Min. Beds</th>
                                                    <th scope="col">Max. Beds</th>
                                                    <th scope="col">Min. Area</th>
                                                    <th scope="col">Max. Area</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                @php
                                                    $lds = json_decode($slug->listing_details, true);
                                                @endphp
                                                @foreach ($lds as $ld)
                                                    <tr>
                                                        <td>{{ $ld['title'] }}</td>
                                                        <td>AED {{ number_format($ld['price']) }}</td>
                                                        <td>{{ $ld['minBeds'] }}</td>
                                                        <td>{{ $ld['maxBeds'] }}</td>
                                                        <td>{{ number_format($ld['minArea']) }} (sqft)</td>
                                                        <td>{{ number_format($ld['maxArea']) }} (sqft)</td>
                                                    </tr>
                                                @endforeach
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        @endif
                        @if ($slug->purpose_id == 36)
                            <div class="col-lg-12">
                                <div class="additional_details mt30">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <h3 class="mb15">Mortgage Calculator</h4>
                                        </div>
                                        <div class="col-lg-12">
                                            <div class="property-mortgage-calculator-wrap property-section-wrap"
                                                 id="property-mortgage-calculator-wrap">
                                                <div class="block-wrap">
                                                    <div class="block-content-wrap">
                                                        <div class="d-flex align-items-center flex-column flex-md-row">
                                                            <div class="mortgage-calculator-chart flex-fill">
                                                                <div class="mortgage-calculator-monthly-payment-wrap">
                                                                    <div id="m_monthly_val"
                                                                         class="mortgage-calculator-monthly-payment">
                                                                    </div>
                                                                    <div class="mortgage-calculator-monthly-requency">
                                                                        Monthly
                                                                    </div>
                                                                </div>

                                                                <canvas id="mortgage-calculator-chart" width="300"
                                                                        height="300" style="display: block;"></canvas>


                                                            </div><!-- mortgage-calculator-chart -->
                                                            <div class="mortgage-calculator-data flex-fill p0">
                                                                <ul class="list-unstyled">
                                                                    <li class="mortgage-calculator-data-1 stats-data-01">
                                                                        <i class="fa fa-circle mr-1"></i>
                                                                        <strong>Down Payment</strong>
                                                                        <span id="downPaymentResult"></span>
                                                                    </li>

                                                                    <li class="mortgage-calculator-data-1 stats-data-01">
                                                                        <i class="fa fa-circle mr-1"></i>
                                                                        <strong>Loan Amount</strong>
                                                                        <span id="loadAmountResult"></span>
                                                                    </li>

                                                                    <li class="mortgage-calculator-data-1 stats-data-1">
                                                                        <i class="fa fa-circle mr-1"></i>
                                                                        <strong>Monthly Payment</strong>
                                                                        <span id="monthlyMortgagePaymentResult"></span>
                                                                    </li>

                                                                </ul>
                                                            </div><!-- mortgage-calculator-data -->
                                                        </div><!-- d-flex -->

                                                        <form id="houzez-calculator-form" method="post">
                                                            <div class="row">
                                                                <div class="col-md-4">
                                                                    <div class="form-group">
                                                                        <label>Total Amount</label>
                                                                        <div class="input-group">
                                                                            <div class="input-group-prepend">
                                                                                <div class="input-group-text">AED</div>
                                                                            </div><!-- input-group-prepend -->
                                                                            <input id="homePrice" type="text"
                                                                                   class="form-control"
                                                                                   placeholder="Total Amount"
                                                                                   value="{{ $slug->price }}">
                                                                        </div><!-- input-group -->
                                                                    </div><!-- form-group -->
                                                                </div><!-- col-md-4 -->
                                                                <div class="col-md-4">
                                                                    <div class="form-group">
                                                                        <label>Down Payment</label>
                                                                        <div class="input-group">
                                                                            <div class="input-group-prepend">
                                                                                <div class="input-group-text">%</div>
                                                                            </div><!-- input-group-prepend -->
                                                                            <input id="downPaymentPercentage"
                                                                                   type="text" class="form-control"
                                                                                   placeholder="Down Payment"
                                                                                   value="40">
                                                                        </div><!-- input-group -->
                                                                    </div><!-- form-group -->
                                                                </div><!-- col-md-4 -->
                                                                <div class="col-md-4">
                                                                    <div class="form-group">
                                                                        <label>Interest Rate</label>
                                                                        <div class="input-group">
                                                                            <div class="input-group-prepend">
                                                                                <div class="input-group-text">%</div>
                                                                            </div><!-- input-group-prepend -->
                                                                            <input id="annualInterestRate" type="text"
                                                                                   class="form-control"
                                                                                   placeholder="Interest Rate"
                                                                                   value="3.5">
                                                                        </div><!-- input-group -->
                                                                    </div><!-- form-group -->
                                                                </div><!-- col-md-4 -->
                                                                <div class="col-md-4">
                                                                    <div class="form-group">
                                                                        <label>Loan Terms (Years)</label>
                                                                        <div class="input-group">
                                                                            <div class="input-group-prepend">
                                                                                <div class="input-group-text">
                                                                                    <i class="fa fa-calendar"></i>
                                                                                </div>
                                                                            </div><!-- input-group-prepend -->
                                                                            <input id="loanTermInYears" type="text"
                                                                                   class="form-control"
                                                                                   placeholder="Loan Terms (Years)"
                                                                                   value="20">
                                                                        </div><!-- input-group -->
                                                                    </div><!-- form-group -->
                                                                </div><!-- col-md-4 -->
                                                            </div><!-- row -->
                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        @endif

                        @if ($slug->project)
                            <div class="col-lg-12">
                                <div class="application_statics mt30 mb30">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <h4>Address</h4>
                                        </div>
                                        <div class="col-md-6 text-right">
                                            <a target="_blank" class="btn theme-btn-inverse"
                                               href="http://maps.google.com/?q={{ $slug->getHK() }}"><i
                                                    class="fa fa-map"></i>
                                                Open on Google Maps</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        @endif
                    </div>

                    <div id="listV" class="row mt0">
                        <div class="col-md-12">
                            <h3 class="mb30">Similar Listings</h3>
                        </div>
                        @foreach (App\Models\Listing::where('id', '!=', $slug->id)->where(['status' => 1, 'city_id' => $slug->city_id, 'purpose_id' => $slug->purpose_id])->latest()->take(5)->get() as $listing)
                            @if ($slug->purpose_id == 38)
                                <div class="col-lg-12 new-search-result offplan-search">
                                    <div data-listing-id="{{ $listing->p_id }}"
                                         data-listing-img="{{ $listing->getThumbImagePublicUrlAttribute() }}"
                                         data-listing-price="{{ $listing->price }}"
                                         data-listing-title="{{ $listing->title }}"
                                         class="feat_property feat_property_cus home7 style4 list">
                                        <div class="thumb m-0 w-100">
                                            <img class="img-whp view-property"
                                                 src="{{ $listing->getThumbImagePublicUrlAttribute() }}"
                                                 alt="{{ $listing->title }}">
                                            <div class="dtls_headr feature-tag">
                                                <ul class="tag">
                                                    @if ($listing->is_featured == 1)
                                                        <li class="list-inline-item">Featured</li>
                                                    @endif
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="details view-property w-100">
                                            <div class="view-property-inner">
                                                <div class="d-flex flex-column justify-content-between">
                                                    <h4 class="font-weight-bold">{!! $listing->title !!}</h4>
                                                    @if ($listing->getHK())
                                                        <p><span class="flaticon-placeholder"></span>
                                                            {{ $listing->getHK() }}
                                                        </p>
                                                    @endif
                                                </div>
                                                <div
                                                    class="d-flex flex-column align-itemsm-md-end justify-content-between">
                                                    @if ($listing->area)
                                                        <p class="fp_price"><span class="font-weight-bold">Area:</span>
                                                            {{ number_format($listing->area) }}{{ $listing->max_area ? '-' . number_format($listing->max_area) : '' }}
                                                        </p>
                                                    @endif
                                                    <div class="">
                                                        <div class="dtls_headr d-flex justify-content-sm-end">
                                                            @if ($listing->price)
                                                                <a class="fp_price float-right ">
                                                                    Starting From<br>
                                                                    AED
                                                                    {{ number_format($listing->price) }}
                                                                    @if ($listing->purpose && $listing->purpose->id == 37 && $listing->rent_frequency)
                                                                        / {{ $listing->rent_frequency->name }}
                                                                    @endif
                                                                </a>
                                                            @endif
                                                        </div>
                                                        <div class="fp_footer p-0">
                                                            <div class="fp_pdate float-right">
                                                                <a
                                                                    class="btn theme-btn-inverse cursor-pointer text-white font-weight-bold">Details</a>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            @else
                                <div class="col-lg-12 new-search-result">
                                    <div data-listing-id="{{ $listing->p_id }}"
                                         data-listing-img="{{ $listing->getThumbImagePublicUrlAttribute() }}"
                                         data-listing-price="{{ $listing->price }}"
                                         data-listing-title="{{ $listing->title }}"
                                         class="feat_property feat_property_cus home7 style4 list">
                                        <div class="thumb m-0">
                                            <img class="img-whp view-property p-0"
                                                 src="{{ $listing->getThumbImagePublicUrlAttribute() }}"
                                                 alt="{{ $listing->title }}">
                                            <div class="dtls_headr feature-tag">
                                                <ul class="tag">
                                                    @if ($listing->is_featured == 1)
                                                        <li class="list-inline-item">Featured</li>
                                                    @endif
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="details view-property">
                                            <div class="view-property-inner">
                                                <div class="d-flex flex-column gap-3">
                                                    <h4 class="font-weight-bold mb-0">{!! $listing->title !!}</h4>

                                                    <ul class="prop_details mb0">
                                                        @if ($listing->property_type)
                                                            <li class="list-inline-item font-weight-bold">
                                                                {{ $listing->property_type->name }}
                                                            </li>
                                                        @endif
                                                        @if ($listing->beds)
                                                            <li class="list-inline-item">
                                                                <i class="fa fa-bed"></i>
                                                                {{ $listing->beds }}{{ $listing->max_beds ? '-' . $listing->max_beds : '' }}
                                                            </li>
                                                        @endif
                                                        @if ($listing->baths)
                                                            <li class="list-inline-item">
                                                                <i class="fa fa-bath"></i>
                                                                {{ $listing->baths }}{{ $listing->max_baths ? '-' . $listing->max_baths : '' }}
                                                            </li>
                                                        @endif
                                                        @if ($listing->area)
                                                            <li class="list-inline-item"><span
                                                                    class="font-weight-bold text-black">Area:</span>
                                                                {{ number_format($listing->area) }}{{ $listing->max_area ? '-' . number_format($listing->max_area) : '' }}
                                                                sqft
                                                            </li>
                                                        @endif
                                                    </ul>
                                                    @if ($listing->getHK())
                                                        <p><span class="flaticon-placeholder"></span>
                                                            {{ $listing->getHK() }}
                                                        </p>
                                                    @endif
                                                </div>
                                                <div class="dtls_headr">
                                                    @if ($listing->price)
                                                        <a class="fp_price">
                                                            AED
                                                            {{ number_format($listing->price) }}
                                                            @if ($listing->purpose && $listing->purpose->id == 37 && $listing->rent_frequency)
                                                                / {{ $listing->rent_frequency->name }}
                                                            @endif
                                                        </a>
                                                    @endif
                                                </div>
                                            </div>
                                            <div class="fp_footer p-0">
                                                <div class="fp_pdate float-right">
                                                    <a class="btn theme-btn-inverse cursor-pointer text-white">Details</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            @endif
                        @endforeach
                    </div>
                </div>
                @if ($slug->added_by)
                    <div class="col-lg-4 col-xl-4">
                        <div class="sidebar_listing_list sticky-sec">
                            <div class="sidebar_advanced_search_widget">
                                <div class="sl_creator">
                                    <h4 class="mb25">Make an Enquiry</h4>
                                </div>
                                <form class="contact_form" action="/contact-inquiry" method="post">
                                    @csrf
                                    <input type="hidden" name="page_ref"
                                           value="{{ env('APP_URL') . '/property/' . $slug->p_id }}">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <input required maxlength="30" name="contact_name" class="form-control"
                                                       type="text" placeholder="Name">
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <input onkeypress="return onlyNumberKey(event)" maxlength="20"
                                                       name="contact_phone" class="form-control required phone" required
                                                       type="phone" placeholder="Phone">
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <input maxlength="30" name="contact_email"
                                                       class="form-control required email" required type="email"
                                                       placeholder="Email">
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <select required name="contact_type" class="form-control">
                                                    <option value="Tenant">I'm a Tenant</option>
                                                    <option value="Agent">I'm an Agent</option>
                                                    <option value="Investor">I'm an Investor</option>
                                                    <option value="Buyer">I'm a Buyer</option>
                                                    <option value="Seller">I'm a Seller</option>
                                                    <option value="Other">Other</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <div class="g-recaptcha" data-sitekey="{{ env('RECAPTCHA_SITE_KEY') }}">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group mb0">
                                                <button type="submit" class="btn btn-lg theme-btn-inverse btn-block">
                                                    Send
                                                    Message
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                @endif
            </div>
        </div>
    </section>
@endsection

@section('pageSpecificScripts')
    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
    @if ($slug->purpose_id == 36)
        <script type="text/javascript" src="{{ asset('assets/js/chart.min.js') }}"></script>
        <script type="text/javascript" src="{{ asset('assets/js/mortgage.js?v=1') }}"></script>
    @endif
    <script src="{{ asset('assets/js/sweetalert.min.js') }}"></script>
    @if (Session::has('cerrors'))
        <script type="text/javascript">
            swal({
                html: "true",
                title: "",
                text: "<ul style='text-align: left;list-style: disc;margin-left: 15px;'>@foreach (Session::get('cerrors') as $error) <li>{{ $error }}</li> @endforeach</ul>",
                type: "error"
            });
        </script>
    @endif
    @if (Session::has('csuccess'))
        <script type="text/javascript">
            swal({
                title: "",
                text: 'Message sent successfully.',
                type: "success"
            });
        </script>
    @endif
@endsection
