<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo get_option('propertybase_landingpage_seo_title'); ?></title>
    <meta name="description" content="<?php echo get_option('propertybase_landingpage_seo_description'); ?>">
    <meta name="keywords" content="<?php echo get_option('propertybase_landingpage_seo_keywords'); ?>">
    <!-- Favicon -->
    <?php
    $favIcon = get_option('favicon');
    $favIconPath = '';
    if ($favIcon != '') {
        $favIconPath = 'uploads/company/' . $favIcon;
    }
    ?>
    <link rel="shortcut icon" href="<?php echo base_url($favIconPath); ?>" type="image/x-icon">

    <?php
    if (get_option('propertybase_add_no_follow_tag_for_landingpage')) {
        ?>
        <meta name="robots" content="noindex, nofollow">
        <?php
    }
    ?>

    <!-- Font awesome -->
    <link href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/font-awesome.css') ?>"
          rel="stylesheet">
    <!-- Bootstrap -->
    <link href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/bootstrap.css') ?>"
          rel="stylesheet">
    <!-- slick slider -->
    <link rel="stylesheet" type="text/css"
          href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/slick.css') ?>">
    <!-- price picker slider -->
    <link rel="stylesheet" type="text/css"
          href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/nouislider.css') ?>">
    <!-- Fancybox slider -->
    <link rel="stylesheet"
          href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/jquery.fancybox.css') ?>"
          type="text/css" media="screen"/>
    <!-- Theme color -->
    <link id="switcher"
          href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/theme-color/default-theme.css') ?>"
          rel="stylesheet">

    <!-- Main style sheet -->
    <link href="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/css/style.css') ?>"
          rel="stylesheet">

</head>
<body class="aa-price-range">
<!-- Pre Loader -->
<div id="aa-preloader-area">
    <div class="pulse"></div>
</div>
<!-- SCROLL TOP BUTTON -->
<a class="scrollToTop" href="#"><i class="fa fa-angle-double-up"></i></a>
<!-- END SCROLL TOP BUTTON -->

<!-- Start Properties  -->
<section id="aa-properties">
    <div class="container">
        <div class="row">
            <div class="col-md-8">
                <div class="aa-properties-content">
                    <!-- start properties content head -->
                    <div class="aa-properties-content-head">
                        <div class="aa-properties-content-head-left">
                        </div>
                        <div class="aa-properties-content-head-right">
                            <a id="aa-grid-properties" href="#"><span class="fa fa-th"></span></a>
                            <a id="aa-list-properties" href="#"><span class="fa fa-list"></span></a>
                        </div>
                    </div>
                    <!-- Start properties content body -->
                    <div class="aa-properties-content-body">
                        <ul class="aa-properties-nav">

                            <?php
                            foreach ($properties_list as $property) {

                                $propertyTypeClass = 'for-rent';
                                $propertyTypeText = 'Rent';

                                $propertyMainImage = $property['main_image'][0]['file_name'] ?? '';

                                if ($property['property_purpose'] == 1) {
                                    $propertyTypeClass = 'for-sale';
                                    $propertyTypeText = 'Sale';
                                }

                                if ($property['property_purpose'] == 2) {
                                    $propertyTypeClass = 'for-rent';
                                    $propertyTypeText = 'Rent';
                                }

                                if ($property['property_purpose'] == 3) {
                                    $propertyTypeClass = 'for-rent';
                                    $propertyTypeText = 'Sale & Rent';
                                }

                                if ($property['property_status'] == 'sold') {
                                    $propertyTypeClass = 'sold-out';
                                    $propertyTypeText = 'Sold';
                                }

                                if ($property['property_status'] == 'rented') {
                                    $propertyTypeClass = 'sold-out';
                                    $propertyTypeText = 'Rented';
                                }

                                ?>
                                <li>
                                    <article class="aa-properties-item">
                                        <a class="aa-properties-item-img"
                                           href="<?php echo propertybase_get_property_single_page_url($property['id']); ?>">
                                            <img alt="<?php echo $property['name'] ?? 'n/a' ?>"
                                                 src="<?php echo substr(module_dir_url(PROPERTYBASE_MODULE_NAME . '/uploads/property_images/main_image/' . $property['id'] . '/' . $propertyMainImage), 0, -1); ?>">
                                        </a>
                                        <div class="aa-tag <?php echo $propertyTypeClass; ?>">
                                            <?php echo $propertyTypeText; ?>
                                        </div>
                                        <div class="aa-properties-item-content">
                                            <div class="aa-properties-info">
                                                <span><?php echo $property['rooms'] ?? 'n/a' ?> Rooms</span>
                                                <span><?php echo $property['bedrooms'] ?? 'n/a' ?> Bedrooms</span>
                                                <span><?php echo $property['bathrooms'] ?? 'n/a' ?> Bathrooms</span>
                                                <span><?php echo $property['size'] ?? 'n/a' ?> m2</span>
                                            </div>
                                            <div class="aa-properties-about">
                                                <h3>
                                                    <a href="<?php echo propertybase_get_property_single_page_url($property['id']); ?>"><?php echo $property['name'] ?? 'n/a' ?></a>
                                                </h3>
                                                <p><?php echo $property['short_description'] ?? '' ?></p>
                                            </div>
                                            <div class="aa-properties-detial">
                        <span class="aa-price">
                          <?php echo propertybase_get_property_price($property['id'], true, true) ?>
                        </span>
                                                <a class="aa-secondary-btn"
                                                   href="<?php echo propertybase_get_property_single_page_url($property['id']); ?>">View
                                                    Details</a>
                                            </div>
                                        </div>
                                    </article>
                                </li>
                                <?php
                            }
                            ?>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- Start properties sidebar -->
            <div class="col-md-4">
                <aside class="aa-properties-sidebar">
                    <!-- Start Single properties sidebar -->
                    <div class="aa-properties-single-sidebar">
                        <h3>Properties Search</h3>
                        <form action="">
                            <div class="aa-single-advance-search">
                                <?php echo render_select('category', $property_categories, ['id', 'name'], 'propertybase_property_category', $_GET['category'] ?? ''); ?>
                            </div>

                            <div class="aa-single-advance-search">
                                <?php echo render_select('country', get_all_countries(), ['country_id', ['short_name'], 'iso2'], 'propertybase_property_country', $_GET['country'] ?? ''); ?>
                            </div>

                            <div class="aa-single-advance-search">
                                <?php echo render_select('property_purpose', propertybase_property_purposes(null, true), ['id', 'purpose'], 'propertybase_property_purpose', $_GET['property_purpose'] ?? ''); ?>
                            </div>

                            <div class="aa-single-advance-search">
                                <?php echo render_select('ownership', $property_ownership_types, ['id', 'name'], 'propertybase_property_ownership', $_GET['ownership'] ?? ''); ?>
                            </div>

                            <?php hooks()->do_action('propertybase_property_index_filters_form'); ?>

                            <div class="aa-single-advance-search">
                                <input type="submit" value="Search" class="aa-search-btn">
                                <a href="<?php echo base_url(PROPERTYBASE_MODULE_NAME . '/Landingpage'); ?>"
                                   class="aa-clear-btn">Clear Search</a>
                            </div>
                        </form>
                    </div>
                    <!-- Start Single properties sidebar -->
                    <div class="aa-properties-single-sidebar">
                        <h3>Latest Properties</h3>
                        <?php
                        $latest_properties = propertybase_get_latest_properties();

                        if (!empty($latest_properties)) {
                            foreach ($latest_properties as $property) {
                                $propertyMainImage = $property['main_image'][0]['file_name'] ?? 'default.jpg';
                                $propertyUrl = propertybase_get_property_single_page_url($property['id']);
                                $propertyName = $property['name'] ?? 'No Title';
                                $propertyShortDesc = $property['short_description'] ?? 'No description available';
                                $propertyPrice = propertybase_get_property_price($property['id'], true, true);
                                $propertyMainImage = $property['main_image'][0]['file_name'] ?? '';
                                ?>
                                <div class="media">
                                    <div class="media-left">
                                        <a href="<?php echo $propertyUrl; ?>">
                                            <img class="media-object"
                                                 src="<?php echo substr(module_dir_url(PROPERTYBASE_MODULE_NAME . '/uploads/property_images/main_image/' . $property['id'] . '/' . $propertyMainImage), 0, -1); ?>">
                                        </a>
                                    </div>
                                    <div class="media-body">
                                        <h4 class="media-heading"><a
                                                    href="<?php echo $propertyUrl; ?>"><?php echo $propertyName; ?></a>
                                        </h4>
                                        <p><?php echo $propertyShortDesc; ?></p>
                                        <span><?php echo $propertyPrice; ?></span>
                                    </div>
                                </div>
                                <?php
                            }
                        } else {
                            echo '<p>No latest properties available.</p>';
                        }
                        ?>
                    </div>
                </aside>
            </div>
        </div>
    </div>
</section>
<!-- / Properties  -->

<!-- Footer -->
<footer id="aa-footer">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="aa-footer-area">
                    <div class="row">
                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <div class="aa-footer-left">
                                <p>Designed by <a rel="nofollow" href="http://www.markups.io/">MarkUps.io</a></p>
                            </div>
                        </div>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <div class="aa-footer-middle">
                                <a href="#"><i class="fa fa-facebook"></i></a>
                                <a href="#"><i class="fa fa-twitter"></i></a>
                                <a href="#"><i class="fa fa-google-plus"></i></a>
                                <a href="#"><i class="fa fa-youtube"></i></a>
                            </div>
                        </div>
                        <div class="col-md-6 col-sm-12 col-xs-12">
                            <div class="aa-footer-right">
                                <a href="#">Home</a>
                                <a href="#">Support</a>
                                <a href="#">License</a>
                                <a href="#">FAQ</a>
                                <a href="#">Privacy & Term</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>
<!-- / Footer -->


<!-- jQuery library -->
<script src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/jquery.min.js') ?>"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/bootstrap.js') ?>"></script>
<!-- slick slider -->
<script type="text/javascript"
        src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/slick.js') ?>"></script>
<!-- Price picker slider -->
<script type="text/javascript"
        src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/nouislider.js') ?>"></script>
<!-- mixit slider -->
<script type="text/javascript"
        src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/jquery.mixitup.js') ?>"></script>
<!-- Add fancyBox -->
<script type="text/javascript"
        src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/jquery.fancybox.pack.js') ?>"></script>
<!-- Custom js -->
<script src="<?php echo module_dir_url(PROPERTYBASE_MODULE_NAME, 'views/landing_page/template/default/js/custom.js') ?>"></script>

<?php echo get_option('propertybase_google_analytics_code'); ?>
</body>
</html>