<?php
    $categories = get_property_categories(['indent' => '↳', 'conditions' => ['status' => \Botble\Base\Enums\BaseStatusEnum::PUBLISHED]]);
    $backgroundImage = $shortcode->background_image ?: theme_option('home_banner');
    $enableProjectsSearch = $shortcode->enable_search_projects_on_homepage_search ? $shortcode->enable_search_projects_on_homepage_search == 'yes' : theme_option('enable_search_projects_on_homepage_search', 'yes') == 'yes';
    $defaultSearchType = $shortcode->default_home_search_type ?: theme_option('default_home_search_type', 'project');

    $images = [];
    $quantity = min((int) $shortcode->quantity, 20);
    if ($quantity) {
        for ($i = 1; $i <= $quantity; $i++) {
            $images[] = RvMedia::getImageUrl($shortcode->{'image_' . $i});
        }
    }

    $images = ! empty($images) ? array_filter($images) : [];
    $seconds = (int) $shortcode->seconds ?: 5;
    $enableChangeBackground = $shortcode->enable_change_image_background ?: 'no';

    $tabs = ['project', 'sale', 'rent'];

    if (! RealEstateHelper::isEnabledProjects() || ! $enableProjectsSearch) {
        $enableProjectsSearch = false;

        $tabs = array_filter($tabs, function ($tab) {
            return $tab !== 'project';
        });
    }

    $tabs = array_filter($tabs, function ($tab) {
        return $tab == 'project' || in_array($tab, RealEstateHelper::enabledPropertyTypes());
    });

    $tabs = array_values($tabs);
?>
<div
    class="home_banner"
    id="bannerSlider"
    data-images="<?php echo e(json_encode($images)); ?>"
    data-seconds="<?php echo e($seconds); ?>"
    data-slide="<?php echo e($enableChangeBackground); ?>"
    style="background-image: url(<?php echo e($backgroundImage ? RvMedia::getImageUrl($backgroundImage) : Theme::asset()->url('images/banner.jpg')); ?>); transition: background 3s"
>

    <div class="topsearch">
        <?php if($shortcode->title || theme_option('home_banner_description')): ?>
            <h1 class="text-center text-white mb-4 banner-text-description">
                <?php echo e($shortcode->title ?: theme_option('home_banner_description')); ?></h1>
        <?php endif; ?>
        <form
            id="frmhomesearch"
            <?php if($enableProjectsSearch && $defaultSearchType == 'project'): ?> action="<?php echo e(RealEstateHelper::getProjectsListPageUrl()); ?>"
            data-ajax-url="<?php echo e(route('public.projects')); ?>"
            <?php else: ?> action="<?php echo e(RealEstateHelper::getPropertiesListPageUrl()); ?>"
            data-ajax-url="<?php echo e(route('public.properties')); ?>" <?php endif; ?>
            method="GET"
        >
            <?php if(count($tabs) > 1): ?>
                <div
                    class="typesearch"
                    id="hometypesearch"
                >
                    <?php if(in_array('project', $tabs)): ?>
                        <a
                            data-url="<?php echo e(RealEstateHelper::getProjectsListPageUrl()); ?>"
                            data-ajax-url="<?php echo e(route('public.projects')); ?>"
                            href="<?php echo e(route('public.projects')); ?>"
                            <?php if($defaultSearchType == 'project'): ?> class="active" <?php endif; ?>
                            rel="project"
                        ><?php echo e(__('Projects')); ?></a>
                    <?php endif; ?>

                    <?php if(in_array('sale', $tabs)): ?>
                        <a
                            data-url="<?php echo e(RealEstateHelper::getPropertiesListPageUrl()); ?>"
                            data-ajax-url="<?php echo e(route('public.properties')); ?>"
                            href="<?php echo e(route('public.properties')); ?>"
                            rel="sale"
                            <?php if($defaultSearchType == 'sale'): ?> class="active" <?php endif; ?>
                        ><?php echo e(__('Sale')); ?></a>
                    <?php endif; ?>

                    <?php if(in_array('rent', $tabs)): ?>
                        <a
                            data-url="<?php echo e(RealEstateHelper::getPropertiesListPageUrl()); ?>"
                            data-ajax-url="<?php echo e(route('public.properties')); ?>"
                            href="<?php echo e(route('public.properties')); ?>"
                            rel="rent"
                            <?php if($defaultSearchType == 'rent'): ?> class="active" <?php endif; ?>
                        ><?php echo e(__('Rent')); ?></a>
                    <?php endif; ?>
                </div>
            <?php endif; ?>

            <div class="input-group input-group-lg">

                <input
                    id="txttypesearch"
                    name="type"
                    type="hidden"
                    <?php if($enableProjectsSearch && $defaultSearchType == 'project'): ?> value="project"
                    <?php else: ?> value="<?php echo e($defaultSearchType); ?>" <?php endif; ?>
                >

                <div class="input-group-prepend">
                    <span class="input-group-text"><i class="far fa-search"></i></span>
                </div>
                <div class="keyword-input">
                    <input
                        class="form-control"
                        id="txtkey"
                        name="k"
                        type="text"
                        placeholder="<?php echo e(__('Enter keyword...')); ?>"
                        autocomplete="off"
                    >
                    <div class="spinner-icon">
                        <i class="fas fa-spin fa-spinner"></i>
                    </div>
                </div>
                <div class="input-group-prepend">
                    <span class="input-group-text"><i class="far fa-location"></i></span>
                </div>
                <div
                    class="location-input"
                    data-url="<?php echo e(route('public.ajax.cities')); ?>"
                >
                    <input
                        name="city_id"
                        type="hidden"
                    >
                    <input
                        class="select-city-state form-control"
                        name="location"
                        value="<?php echo e(BaseHelper::stringify(request()->input('location'))); ?>"
                        placeholder="<?php echo e(__('City, State')); ?>"
                        autocomplete="off"
                    >
                    <div class="spinner-icon">
                        <i class="fas fa-spin fa-spinner"></i>
                    </div>
                    <div class="suggestion">

                    </div>
                </div>
                <div class="input-group-append search-button-wrapper">
                    <button
                        class="btn btn-orange"
                        type="submit"
                    ><?php echo e(__('Search')); ?></button>
                </div>

                <?php echo apply_filters(
                    'main_search_box_filters',
                    Theme::partial('real-estate.filters.search-box-filters', compact('categories', 'enableProjectsSearch')),
                    compact('categories', 'enableProjectsSearch'),
                ); ?>

            </div>
            <div class="listsuggest">

            </div>
        </form>
    </div>
</div>
<?php /**PATH /home/gyannewsoftware/public_html/realestate13_FlexHome/platform/themes/flex-home/partials/short-codes/search-box.blade.php ENDPATH**/ ?>