<?php
    Theme::asset()
        ->usePath()
        ->add('leaflet-css', 'libraries/leaflet/leaflet.css');
    Theme::asset()
        ->container('footer')
        ->usePath()
        ->add('leaflet-js', 'libraries/leaflet/leaflet.js');
    Theme::asset()
        ->usePath()
        ->add('magnific-css', 'libraries/magnific/magnific-popup.css');
    Theme::asset()
        ->container('footer')
        ->usePath()
        ->add('magnific-js', 'libraries/magnific/jquery.magnific-popup.min.js');
?>
<main class="detailproject">
    <?php echo $__env->make(Theme::getThemeNamespace() . '::views.real-estate.includes.slider', ['object' => $project], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <div class="container-fluid bgmenupro">
        <div
            class="container-fluid w90 padtop30"
            style="padding: 15px 0;"
        >
            <div class="col-12">
                <h1
                    class="title"
                    style="font-size: 1.5rem; font-weight: bold; margin-bottom: 0;"
                ><?php echo BaseHelper::clean($project->name); ?></h1>
                <?php if(RealEstateHelper::isEnabledReview()): ?>
                    <p style="margin-bottom: 5px;"><?php echo $__env->make(Theme::getThemeNamespace('views.real-estate.partials.review-star'), [
                        'avgStar' => $project->reviews_avg_star,
                        'count' => $project->reviews_count,
                    ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></p>
                <?php endif; ?>
                <p class="addresshouse">
                    <?php if($address = implode(', ', array_filter([$project->city->name, $project->state->name]))): ?>
                        <span
                            class="d-inline-block"
                            style="margin-right: 10px"
                        >
                            <i class="fas fa-map-marker-alt"></i> <?php echo e($address); ?>

                        </span>
                    <?php endif; ?>
                    <?php if(setting('real_estate_display_views_count_in_detail_page', 0) == 1): ?>
                        <span
                            class="d-inline-block"
                            style="margin-right: 10px"
                        ><i class="fa fa-eye"></i> <?php echo e(number_format($project->views)); ?> <?php echo e(__('views')); ?></span>
                    <?php endif; ?>
                    <span class="d-inline-block"><i class="fa fa-calendar-alt"></i>
                        <?php echo e($project->created_at->translatedFormat('M d, Y')); ?></span>
                </p>
                <div class="d-none">
                    <?php echo Theme::partial('breadcrumb'); ?>

                </div>
            </div>
        </div>
    </div>

    <div class="container-fluid w90 padtop30 single-post">
        <?php echo apply_filters('ads_render', null, 'project_detail_before'); ?>


        <section class="general">
            <div class="row">
                <div class="col-md-8">
                    <?php echo apply_filters('before_single_content_detail', null, $project); ?>


                    <div class="head"><?php echo e(__('Overview')); ?></div>
                    <span class="line_title"></span>
                    <div class="row">
                        <div class="col-sm-6 lineheight220">
                            <?php if($lastUpdated = $project->getMetaData('last_updated', true)): ?>
                                <div><span><?php echo e(__('Last Updated')); ?>:&nbsp;</span> <strong><?php echo e(rescue(fn () => Carbon\Carbon::parse($lastUpdated)->translatedFormat('M d, Y'))); ?></strong></div>
                            <?php endif; ?>
                            <?php if($project->unique_id): ?>
                                <div><span><?php echo e(__('Project ID')); ?>:&nbsp;</span> <strong><?php echo e($project->unique_id); ?></strong></div>
                            <?php endif; ?>
                            <div><span><?php echo e(__('Status')); ?>:&nbsp;</span> <?php echo BaseHelper::clean($project->status_html); ?></div>
                            <?php if($project->categories->isNotEmpty()): ?>
                                <div><span><?php echo e(__('Category')); ?>:&nbsp;</span>
                                    <strong>
                                        <?php $__currentLoopData = $project->categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php echo e($category->name); ?>

                                            <?php if(!$loop->last): ?>
                                                ,&nbsp;
                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </strong>
                                </div>
                            <?php endif; ?>
                            <?php if($project->investor->name): ?>
                                <div><span><?php echo e(__('Investor')); ?>:&nbsp;</span> <b><?php echo e($project->investor->name); ?></b></div>
                            <?php endif; ?>
                            <?php if($project->price_from || $project->price_to): ?>
                                <div>
                                    <span><?php echo e(__('Price')); ?>:&nbsp;</span>
                                    <b><?php echo e($project->formatted_price); ?></b>
                                </div>
                            <?php endif; ?>
                        </div>
                        <div class="col-sm-6 lineheight220">
                            <?php if($project->number_block): ?>
                                <div><span><?php echo e(__('Number of blocks')); ?>:&nbsp;</span>
                                    <b><?php echo e(number_format($project->number_block)); ?></b></div>
                            <?php endif; ?>
                            <?php if($project->number_floor): ?>
                                <div><span><?php echo e(__('Number of floors')); ?>:&nbsp;</span>
                                    <b><?php echo e(number_format($project->number_floor)); ?></b></div>
                            <?php endif; ?>
                            <?php if($project->number_flat): ?>
                                <div><span><?php echo e(__('Number of flats')); ?>:&nbsp;</span>
                                    <b><?php echo e(number_format($project->number_flat)); ?></b></div>
                            <?php endif; ?>
                        </div>
                        <?php $__currentLoopData = $project->customFields; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customField): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-sm-6 lineheight220">
                                <div><span><?php echo BaseHelper::clean($customField->name); ?>:&nbsp;</span> <strong><?php echo BaseHelper::clean($customField->value); ?></strong>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>

                    <div class="head"><?php echo e(__('Description')); ?></div>
                    <?php if($project->content): ?>
                        <div class="ck-content">
                            <?php echo BaseHelper::clean($project->content); ?>

                        </div>
                    <?php endif; ?>
                    <?php if($project->features->count()): ?>
                        <br>
                        <div class="head"><?php echo e(__('Features')); ?></div>
                        <div class="row">
                            <?php $project->features->loadMissing('metadata'); ?>
                            <?php $__currentLoopData = $project->features; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="col-sm-4">
                                    <?php if($feature->getMetaData('icon_image', true)): ?>
                                        <p><i><img
                                                    src="<?php echo e(RvMedia::getImageUrl($feature->getMetaData('icon_image', true))); ?>"
                                                    alt="<?php echo e($feature->name); ?>"
                                                    style="vertical-align: top; margin-top: 3px;"
                                                    width="18"
                                                    height="18"
                                                ></i> <?php echo e($feature->name); ?></p>
                                    <?php else: ?>
                                        <p><i
                                                class="<?php if($feature->icon): ?> <?php echo e($feature->icon); ?> <?php else: ?> fas fa-check <?php endif; ?> text-orange text0i"></i>
                                            <?php echo e($feature->name); ?></p>
                                    <?php endif; ?>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    <?php endif; ?>
                    <br>
                    <?php if($project->facilities->isNotEmpty()): ?>
                        <div class="row">
                            <div class="col-sm-12">
                                <h5 class="headifhouse"><?php echo e(__('Distance key between facilities')); ?></h5>
                                <div class="row">
                                    <?php $project->facilities->loadMissing('metadata'); ?>
                                    <?php $__currentLoopData = $project->facilities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $facility): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="col-sm-4">
                                            <?php if($facility->getMetaData('icon_image', true)): ?>
                                                <p><i><img
                                                            src="<?php echo e(RvMedia::getImageUrl($facility->getMetaData('icon_image', true))); ?>"
                                                            alt="<?php echo e($facility->name); ?>"
                                                            style="vertical-align: top; margin-top: 3px;"
                                                            width="18"
                                                            height="18"
                                                        ></i> <?php echo e($facility->name); ?> - <?php echo e($facility->pivot->distance); ?>

                                                </p>
                                            <?php else: ?>
                                                <p><i
                                                        class="<?php if($facility->icon): ?> <?php echo e($facility->icon); ?> <?php else: ?> fas fa-check <?php endif; ?> text-orange text0i"></i>
                                                    <?php echo e($facility->name); ?> - <?php echo e($facility->pivot->distance); ?></p>
                                            <?php endif; ?>
                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                    <br>
                    <?php if($project->latitude && $project->longitude): ?>
                        <?php echo Theme::partial('real-estate.elements.traffic-map-modal', ['location' => $project->location]); ?>


                        <div class="d-none d-print-block">
                            <a
                                class="text-decoration-none"
                                href="https://maps.google.com/?ll=<?php echo e($project->latitude); ?>,<?php echo e($project->longitude); ?>"
                            >
                                <?php echo e($project->location ?: $address); ?>

                            </a>
                        </div>
                    <?php else: ?>
                        <?php echo Theme::partial('real-estate.elements.gmap-canvas', ['location' => $project->location]); ?>


                        <div class="d-none d-print-block">
                            <a
                                class="text-decoration-none"
                                href="https://www.google.com/maps/search/<?php echo e(urlencode($project->location)); ?>"
                            >
                                <?php echo e($project->location ?: $address); ?>

                            </a>
                        </div>
                    <?php endif; ?>

                    <br>

                    <?php if($project->video_url): ?>
                        <?php echo Theme::partial('real-estate.elements.video', ['object' => $project, 'title' => __('Project video')]); ?>

                    <?php endif; ?>

                    <?php echo apply_filters('after_single_content_detail', null, $project); ?>


                    <br>
                    <?php echo Theme::partial('share', ['title' => __('Share this project'), 'description' => $project->description]); ?>

                    <div class="clearfix"></div>
                    <?php echo apply_filters(
                        BASE_FILTER_PUBLIC_COMMENT_AREA,
                        theme_option('facebook_comment_enabled_in_project', 'yes') == 'yes' ? Theme::partial('comments') : null,
                    ); ?>

                    <br>
                    <?php if(RealEstateHelper::isEnabledReview()): ?>
                        <?php echo $__env->make(Theme::getThemeNamespace('views.real-estate.partials.reviews'), [
                            'model' => $project,
                        ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    <?php endif; ?>
                </div>
                <div class="col-md-4 padtop10">
                    <?php echo apply_filters('ads_render', null, 'project_detail_sidebar_before'); ?>


                    <?php echo apply_filters('project_right_details_info', null, $project); ?>


                    <div class="boxright p-3">
                        <?php echo Theme::partial('consult-form', ['type' => 'project', 'data' => $project]); ?>

                    </div>

                    <?php echo apply_filters('ads_render', null, 'project_detail_sidebar_after'); ?>

                </div>
            </div>

            <div class="projecthome mb-2">
                <?php
                    $propertiesForSale = app(\Botble\RealEstate\Repositories\Interfaces\PropertyInterface::class)->getPropertiesByConditions(
                        [
                            're_properties.project_id' => $project->id,
                            're_properties.type' => \Botble\RealEstate\Enums\PropertyTypeEnum::SALE,
                        ],
                        8,
                        \Botble\RealEstate\Facades\RealEstateHelper::getPropertyRelationsQuery(),
                    );
                ?>

                <?php if($propertiesForSale->isNotEmpty()): ?>
                    <h3 class="headifhouse"><?php echo e(__('Properties For Sale')); ?></h3>
                    <div class="row rowm10">
                        <?php $__currentLoopData = $propertiesForSale; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $propertyForSale): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-sm-6 col-lg-4 col-xl-3 colm10">
                                <?php echo Theme::partial('real-estate.properties.item', ['property' => $propertyForSale]); ?>

                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                <?php endif; ?>
            </div>

            <div class="projecthome mb-2">
                <?php
                    $propertiesForRent = app(\Botble\RealEstate\Repositories\Interfaces\PropertyInterface::class)->getPropertiesByConditions(
                        [
                            're_properties.project_id' => $project->id,
                            're_properties.type' => \Botble\RealEstate\Enums\PropertyTypeEnum::RENT,
                        ],
                        theme_option('number_of_related_projects', 8),
                        \Botble\RealEstate\Facades\RealEstateHelper::getPropertyRelationsQuery(),
                    );
                ?>

                <?php if($propertiesForRent->isNotEmpty()): ?>
                    <h3 class="headifhouse"><?php echo e(__('Properties For Rent')); ?></h3>
                    <div class="row rowm10">
                        <?php $__currentLoopData = $propertiesForRent; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $propertyForRent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="col-sm-6 col-lg-4 col-xl-3 colm10">
                                <?php echo Theme::partial('real-estate.properties.item', ['property' => $propertyForRent]); ?>

                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                <?php endif; ?>
            </div>
        </section>

        <?php echo apply_filters('ads_render', null, 'project_detail_after'); ?>

    </div>
</main>

<script id="traffic-popup-map-template" type="text/x-custom-template">
    <?php echo Theme::partial('real-estate.projects.map', ['project' => $project]); ?>

</script>
<?php /**PATH /home/gyannewsoftware/public_html/realestate13_FlexHome/platform/themes/flex-home/views/real-estate/project.blade.php ENDPATH**/ ?>