@php try { $consultplusMenuItems = app(\App\Services\PublicMenuService::class)->items('main', 'consultplus'); } catch (\Throwable $e) { $consultplusMenuItems = []; } $consultplusNormalizeTitle = static fn ($value): string => strtolower(trim(preg_replace('/\s+/', ' ', (string) $value) ?: '')); $consultplusReservedActions = ['login', 'log in', 'sign in', 'register', 'registration', 'open account', 'create account']; $consultplusCleanItems = static function (array $items) use (&$consultplusCleanItems, $consultplusNormalizeTitle, $consultplusReservedActions): array { return collect($items) ->reject(static fn ($item): bool => in_array($consultplusNormalizeTitle(data_get($item, 'title')), $consultplusReservedActions, true)) ->map(static function ($item) use (&$consultplusCleanItems): array { $item = (array) $item; $item['children'] = $consultplusCleanItems((array) data_get($item, 'children', [])); return $item; }) ->values() ->all(); }; $consultplusMenuItems = $consultplusCleanItems((array) $consultplusMenuItems); if ($consultplusMenuItems === []) { $consultplusMenuItems = [ ['title' => 'Home', 'url' => route('page.home'), 'target' => '_self', 'children' => []], [ 'title' => 'Markets', 'url' => route('page.markets'), 'target' => '_self', 'children' => [ ['title' => 'Forex & Metals', 'url' => route('page.markets').'#forex-metals', 'target' => '_self', 'children' => []], ['title' => 'Indices & Shares', 'url' => route('page.markets').'#indices-shares', 'target' => '_self', 'children' => []], ['title' => 'Commodities & Crypto', 'url' => route('page.markets').'#commodities-crypto', 'target' => '_self', 'children' => []], ], ], [ 'title' => 'Accounts', 'url' => route('page.accounts'), 'target' => '_self', 'children' => [ ['title' => 'Trading Accounts', 'url' => route('page.accounts'), 'target' => '_self', 'children' => []], ['title' => 'Client Portal', 'url' => trading_login_url(), 'target' => '_self', 'children' => []], ], ], ['title' => 'MT4 Platform', 'url' => route('page.platform'), 'target' => '_self', 'children' => []], [ 'title' => 'Resources', 'url' => '#', 'target' => '_self', 'children' => [ ['title' => 'Frequently Asked Questions', 'url' => route('page.faq'), 'target' => '_self', 'children' => []], ['title' => 'Risk Disclosure', 'url' => route('page.risk'), 'target' => '_self', 'children' => []], ['title' => 'Terms & Conditions', 'url' => route('page.terms'), 'target' => '_self', 'children' => []], ], ], [ 'title' => 'Company', 'url' => route('page.about'), 'target' => '_self', 'children' => [ ['title' => 'About Us', 'url' => route('page.about'), 'target' => '_self', 'children' => []], ['title' => 'Contact', 'url' => route('page.contact'), 'target' => '_self', 'children' => []], ['title' => 'Privacy Policy', 'url' => route('page.privacy'), 'target' => '_self', 'children' => []], ['title' => 'Complaints', 'url' => route('page.complaints'), 'target' => '_self', 'children' => []], ], ], ]; } $consultplusCms = []; $consultplusCurrentUrl = rtrim(url()->current(), '/'); try { $consultplusCms = app(\App\Services\CmsSettingsService::class)->get(); $consultplusLanguageEnabled = data_get($consultplusCms, 'language_bar.enabled', 'yes') === 'yes'; } catch (\Throwable $e) { $consultplusLanguageEnabled = true; } // Resolve dropdown colors before rendering the CSS and recursive items. $cpMenuTheme = []; $cpMenuCms = (array) ($consultplusCms ?? []); try { $cpMenuTheme = (array) app(\App\Services\ThemeManager::class)->theme('consultplus'); } catch (\Throwable $e) { // First boot still gets a legible menu without database-backed settings. } // The CMS color controls save hex colors. Do not echo arbitrary CSS tokens. $cpMenuSolidHex = static function ($value, string $fallback): string { if (!is_string($value)) return $fallback; $value = trim($value); if (preg_match('/^#[0-9a-f]{3}$/i', $value)) { $value = '#'.$value[1].$value[1].$value[2].$value[2].$value[3].$value[3]; } return preg_match('/^#[0-9a-f]{6}$/i', $value) ? strtolower($value) : $fallback; }; $cpMenuRgb = static fn (string $hex): array => [ hexdec(substr($hex, 1, 2)), hexdec(substr($hex, 3, 2)), hexdec(substr($hex, 5, 2)), ]; $cpMenuLuminance = static function (string $hex) use ($cpMenuRgb): float { $channels = array_map(static function ($channel): float { $channel /= 255; return $channel <= 0.04045 ? $channel / 12.92 : (($channel + 0.055) / 1.055) ** 2.4; }, $cpMenuRgb($hex)); return 0.2126 * $channels[0] + 0.7152 * $channels[1] + 0.0722 * $channels[2]; }; $cpMenuTextFor = static function (string $background) use ($cpMenuLuminance): string { $luminance = $cpMenuLuminance($background); $inkLuminance = $cpMenuLuminance('#102a31'); $inkContrast = (max($luminance, $inkLuminance) + 0.05) / (min($luminance, $inkLuminance) + 0.05); $whiteContrast = 1.05 / ($luminance + 0.05); if ($inkContrast >= 4.5) return '#102a31'; if ($whiteContrast >= 4.5) return '#ffffff'; return '#000000'; }; $cpMenuBackground = $cpMenuSolidHex(data_get($cpMenuTheme, 'theme_meta.design.dropdown_bg'), '#ffffff'); $cpMenuPrimary = $cpMenuSolidHex(data_get($cpMenuTheme, 'primary'), '#18ba60'); if (data_get($cpMenuCms, 'colors.customized', 'no') === 'yes') { $cpMenuPrimary = $cpMenuSolidHex(data_get($cpMenuCms, 'colors.primary'), $cpMenuPrimary); } $cpMenuBaseRgb = $cpMenuRgb($cpMenuBackground); $cpMenuAccentRgb = $cpMenuRgb($cpMenuPrimary); $cpMenuHover = '#'; for ($cpMenuChannel = 0; $cpMenuChannel < 3; $cpMenuChannel++) { // Preblend the highlight: keep the hover surface opaque as well. $cpMenuHover .= sprintf('%02x', (int) round($cpMenuBaseRgb[$cpMenuChannel] * 0.88 + $cpMenuAccentRgb[$cpMenuChannel] * 0.12)); } $cpMenuText = $cpMenuTextFor($cpMenuBackground); $cpMenuHoverText = $cpMenuTextFor($cpMenuHover); // Opaque, preblended surfaces: no backdrop blur or inherited transparency. $cpMenuBlend = static function (string $base, string $tint, float $weight) use ($cpMenuRgb): string { $baseRgb = $cpMenuRgb($base); $tintRgb = $cpMenuRgb($tint); return sprintf('#%02x%02x%02x', ...array_map( static fn ($a, $b): int => (int) round($a * (1 - $weight) + $b * $weight), $baseRgb, $tintRgb )); }; $cpMenuContrast = static function (string $a, string $b) use ($cpMenuLuminance): float { $a = $cpMenuLuminance($a); $b = $cpMenuLuminance($b); return (max($a, $b) + 0.05) / (min($a, $b) + 0.05); }; $cpMenuBorder = $cpMenuBlend($cpMenuBackground, $cpMenuText, 0.14); $cpMenuMuted = $cpMenuBlend($cpMenuBackground, $cpMenuText, 0.76); $cpMenuIconBg = $cpMenuBlend($cpMenuBackground, $cpMenuPrimary, 0.08); $cpMenuIconInk = $cpMenuPrimary; // Keep decorative line icons visible even with a pale/yellow brand color. for ($cpMenuStep = 0; $cpMenuStep <= 10; $cpMenuStep++) { $cpMenuIconInk = $cpMenuBlend($cpMenuPrimary, $cpMenuText, $cpMenuStep / 10); if ($cpMenuContrast($cpMenuIconInk, $cpMenuIconBg) >= 3) break; } $cpMenuAccentInk = $cpMenuTextFor($cpMenuPrimary); @endphp @include('themes.consultplus.partials.menu-dropdown-styles')
{{ site_contact('phone_display') }} {{ site_contact('email') }} @if(site_contact('hours')){{ site_contact('hours') }}@endif
@if($consultplusLanguageEnabled)
@endif