<?php
    $model = $model ?? $property ?? null;
    $isProject = $model instanceof \Botble\RealEstate\Models\Project;
?>

<div class="<?php echo \Illuminate\Support\Arr::toCssClasses(['widget-box single-property-contact', $class ?? null]); ?>">
    <?php if(! RealEstateHelper::hideAgentInfoInPropertyDetailPage() && ($account = $model->author) && $account->exists): ?>
        <div class="h7 title fw-7"><?php echo e(__('Contact Agency')); ?></div>

        <div class="box-avatar">
            <div class="avatar avt-100 round">
                <a href="<?php echo e($account->url); ?>" class="d-block">
                    <?php echo e(RvMedia::image($account->avatar?->url ?: $account->avatar_url, $account->name)); ?>

                </a>
            </div>
            <div class="info line-clamp-1">
                <div class="text-1 name">
                    <a href="<?php echo e($account->url); ?>"><?php echo e($account->name); ?> <?php echo $account->badge; ?></a>
                </div>
                <?php if($account->phone && ! setting('real_estate_hide_agency_phone', false) && ! $account->hide_phone): ?>
                    <a href="tel:<?php echo e($account->phone); ?>" class="info-item"><?php echo e($account->phone); ?></a>
                <?php elseif($hotline = theme_option('hotline')): ?>
                    <a href="tel:<?php echo e($hotline); ?>" class="info-item"><?php echo e($hotline); ?></a>
                <?php endif; ?>
                <?php if($account->email && ! setting('real_estate_hide_agency_email', false) && ! $account->hide_email): ?>
                    <a href="mailto:<?php echo e($account->email); ?>" class="info-item"><?php echo e($account->email); ?></a>
                <?php endif; ?>
            </div>
        </div>
    <?php else: ?>
        <div class="h7 title fw-7"><?php echo e(__('Contact')); ?></div>
    <?php endif; ?>

    <?php if($isProject): ?>
        <?php echo apply_filters('project_right_details_info', null, $model); ?>

    <?php else: ?>
        <?php echo apply_filters('property_right_details_info', null, $model); ?>

    <?php endif; ?>

    <?php if(RealEstateHelper::isEnabledConsultForm()): ?>
        <?php echo apply_filters('before_consult_form', null, $model); ?>


        <?php echo \Botble\RealEstate\Forms\Fronts\ConsultForm::create()
            ->formClass('contact-form')
            ->setFormInputWrapperClass('ip-group')
            ->modify('content', 'textarea', ['attr' => ['class' => 'form-control']])
            ->modify('submit', 'submit', ['attr' => ['class' => 'tf-btn primary w-100']])
            ->add('type', 'hidden', ['attr' => ['value' => $isProject ? 'project' : 'property']])
            ->add('data_id', 'hidden', ['attr' => ['value' => $model->getKey()]])
            ->addBefore('content', 'data_name', 'text', ['label' => false, 'attr' => ['value' => $model->name, 'disabled' => true, 'aria-label' => $isProject ? __('Project name') : __('Property name')]])
            ->renderForm(); ?>


        <?php echo apply_filters('after_consult_form', null, $model); ?>

    <?php endif; ?>

    <?php
        $whatsappNumber = null;

        if (! RealEstateHelper::hideAgentInfoInPropertyDetailPage() && ($account = $model->author) && $account->exists && $account->whatsapp) {
            $whatsappNumber = $account->whatsapp;
        } elseif ($globalWhatsapp = theme_option('whatsapp_phone_number')) {
            $whatsappNumber = $globalWhatsapp;
        }
    ?>

    <?php if($whatsappNumber && theme_option('enable_whatsapp_button', 'yes') === 'yes'): ?>
        <?php
            $whatsappMessage = theme_option('whatsapp_inquiry_message', __('Hi, I have an inquiry about this property: [property_url]'));
            $whatsappMessage = str_replace('[property_url]', $model->url, $whatsappMessage);
        ?>
        <div class="whatsapp-contact-section mt-4 pt-4" style="border-top: 1px solid #e4e4e4;">
            <div class="text-center mb-3">
                <p class="mb-2" style="color: #666; font-size: 14px;"><?php echo e(__('Or get instant response via WhatsApp')); ?></p>
            </div>
            <div class="text-center">
                <a href="https://wa.me/<?php echo e(preg_replace('/[^0-9]/', '', $whatsappNumber)); ?>?text=<?php echo e(urlencode($whatsappMessage)); ?>" target="_blank" class="contact-whatsapp-btn justify-content-center">
                    <?php if (isset($component)) { $__componentOriginal73995948b3bd877b76251b40caf28170 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal73995948b3bd877b76251b40caf28170 = $attributes; } ?>
<?php $component = Botble\Icon\View\Components\Icon::resolve(['name' => 'ti ti-brand-whatsapp'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('core::icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Botble\Icon\View\Components\Icon::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal73995948b3bd877b76251b40caf28170)): ?>
<?php $attributes = $__attributesOriginal73995948b3bd877b76251b40caf28170; ?>
<?php unset($__attributesOriginal73995948b3bd877b76251b40caf28170); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal73995948b3bd877b76251b40caf28170)): ?>
<?php $component = $__componentOriginal73995948b3bd877b76251b40caf28170; ?>
<?php unset($__componentOriginal73995948b3bd877b76251b40caf28170); ?>
<?php endif; ?>
                    <span><?php echo e(__('Chat on WhatsApp')); ?></span>
                </a>
            </div>
        </div>
    <?php endif; ?>
</div>

<?php /**PATH /home/agriwurd/capitalpropertiesandresidence.com/platform/themes/homzen/views/real-estate/single-layouts/partials/contact.blade.php ENDPATH**/ ?>