@php $agencyObj = $agency ?? $interior ?? ($evData ?? null); $custObj = $customer ?? null; if (!$agencyObj && \Illuminate\Support\Facades\Schema::hasTable('wb_agency_settings')) { try { if ($custObj && !empty($custObj->id)) { $agencyObj = \App\Models\WebsiteBuilder\WbAgencySetting::getDefaults($custObj->id); } else { $agencyObj = \App\Models\WebsiteBuilder\WbAgencySetting::getDemoDefaults(); } } catch (\Throwable $e) {} } $isCallWhatsappAllowed = true; if ($agencyObj && method_exists($agencyObj, 'isFeatureEnabled')) { $isCallWhatsappAllowed = $agencyObj->isFeatureEnabled('call_whatsapp', $custObj); } $rawEnableCall = $agencyObj->enable_call_btn ?? null; $enableCall = ($rawEnableCall !== null) ? filter_var($rawEnableCall, FILTER_VALIDATE_BOOLEAN) : true; $callNumber = !empty($agencyObj->call_phone_number) ? trim($agencyObj->call_phone_number) : (!empty($agencyObj->phone) ? trim($agencyObj->phone) : ''); $callPos = (!empty($agencyObj->call_btn_position) && in_array($agencyObj->call_btn_position, ['left', 'right'])) ? $agencyObj->call_btn_position : 'right'; $rawEnableWa = $agencyObj->enable_whatsapp_btn ?? null; $enableWa = ($rawEnableWa !== null) ? filter_var($rawEnableWa, FILTER_VALIDATE_BOOLEAN) : true; $waNumber = !empty($agencyObj->whatsapp_number) ? trim($agencyObj->whatsapp_number) : (!empty($agencyObj->phone) ? trim($agencyObj->phone) : '919876543210'); $cleanWaNumber = preg_replace('/[^0-9]/', '', (string)$waNumber); if (empty($cleanWaNumber)) { $cleanWaNumber = '919876543210'; } // Display based on enable switch toggles $shouldShowCall = $enableCall && !empty($callNumber); $shouldShowWa = $enableWa && !empty($cleanWaNumber); $waPos = (!empty($agencyObj->whatsapp_btn_position) && in_array($agencyObj->whatsapp_btn_position, ['left', 'right'])) ? $agencyObj->whatsapp_btn_position : 'left'; $waMsg = $agencyObj->whatsapp_default_msg ?? 'Hello! I am interested in your services.'; $siteTitle = $agencyObj->site_title ?? 'Support Team'; $waHeaderTitle = $agencyObj->whatsapp_header_title ?? ($siteTitle . ' Customer Support'); $waPopupMsg = $agencyObj->whatsapp_popup_message ?? ('Hi there! 👋 Welcome to ' . $siteTitle . '. How can we help you today? Type your message below or pick an option:'); $callUrl = !empty($callNumber) ? 'tel:' . preg_replace('/[^0-9\+]/', '', (string)$callNumber) : '#'; // Smart vertical stacking when both buttons are positioned on the same side $isSameSide = ($shouldShowWa && $shouldShowCall && $waPos === $callPos); $callBottom = $isSameSide ? '92px' : '24px'; @endphp @if($isCallWhatsappAllowed && ($shouldShowCall || $shouldShowWa)) @php $waIcon = $agencyObj->whatsapp_icon ?? 'fa-brands fa-whatsapp'; $waAvatar = $agencyObj->whatsapp_avatar_image ?? null; $presets = $agencyObj->whatsapp_presets_data ?? [ ['icon' => 'fa-solid fa-tag', 'title' => 'Ask about Pricing & Packages', 'msg' => 'Hello! I would like to inquire about your pricing and packages.'], ['icon' => 'fa-solid fa-calendar-check', 'title' => 'Book a Service / Appointment', 'msg' => 'Hi! I need help with booking a service / appointment.'], ['icon' => 'fa-solid fa-headset', 'title' => 'Connect with Customer Agent', 'msg' => 'Hello! I would like to speak directly with a representative.'] ]; @endphp @if($shouldShowWa) @endif @if($shouldShowCall) @endif @if($shouldShowWa)
@if(!empty($waAvatar)) Avatar @else @endif
{{ $waHeaderTitle }}

Online • Typically replies instantly

Today
{{ $waHeaderTitle }}
{!! nl2br(e($waPopupMsg)) !!}
{{ date('h:i A') }}
@foreach($presets as $p) @if(!empty($p['title'])) @endif @endforeach
@endif @endif