@props(['active' => 'dashboard']) {{-- Operator-console sidebar (matches ui/dash/dashboard-v3). Shown only when the admin picks the "sidebar" user-dashboard layout. Colour is admin-set (Appearance → Sidebar colour); ALL text/icons/panels auto-adapt to the chosen background's brightness (dark bg → light text, light bg → dark text) via CSS variables, so any colour stays readable. --}} @php $groups = \App\Support\UserNav::groups(); $u = auth()->user(); $ws = $u?->currentWorkspace; $wsName = $ws?->name ?: brand_name(); $wsInitials = \Illuminate\Support\Str::of($wsName)->trim()->limit(2, '')->upper()->__toString(); $planLabel = $ws?->billingPackage()?->pname ?: __('Free'); $walletMoney = \App\Support\FormatSettings::display((int) round(((int) ($u->wallet_credits ?? 0)) * \App\Services\MessageCreditRate::minorPerCredit()) / 100); // Per-workspace white-label logo wins over the platform logo — mirrors the // header (header.blade.php), so a workspace's uploaded logo shows in the // sidebar too, not just the header. $logoUrl = ($ws && $ws->brand_logo_path) ? asset('storage/' . $ws->brand_logo_path) : \App\Support\Brand::logoUrl(\App\Support\Brand::activeTheme()); // White-label tenant domain: locked to one workspace — no switch targets/create. $__lockWs = ($isTenantDomain ?? false); $allWorkspaces = ($u && !$__lockWs) ? $u->workspaces()->orderByDesc('last_active_at')->get() : collect(); $canCreateWorkspace = ($u && !$__lockWs) ? $u->canCreateWorkspace() : false; // Admin-customisable rail colour + auto contrast. $railBg = (string) \App\Models\SystemSetting::get('user_sidebar_color', '') ?: '#06100E'; $__hex = ltrim($railBg, '#'); if (strlen($__hex) === 3) { $__hex = $__hex[0].$__hex[0].$__hex[1].$__hex[1].$__hex[2].$__hex[2]; } $__lum = 0.05; if (strlen($__hex) === 6 && ctype_xdigit($__hex)) { $__r = hexdec(substr($__hex, 0, 2)); $__g = hexdec(substr($__hex, 2, 2)); $__b = hexdec(substr($__hex, 4, 2)); $__lum = (0.299 * $__r + 0.587 * $__g + 0.114 * $__b) / 255; } $light = $__lum > 0.6; // light background → use dark text (auto) // Optional admin overrides. $textColor = (string) \App\Models\SystemSetting::get('user_sidebar_text_color', ''); $accentColor = (string) \App\Models\SystemSetting::get('user_sidebar_accent_color', '') ?: '#25D366'; // hex → "r,g,b" helper for building translucent tokens. $rgb = function (string $hex): string { $h = ltrim($hex, '#'); if (strlen($h) === 3) { $h = $h[0].$h[0].$h[1].$h[1].$h[2].$h[2]; } if (strlen($h) !== 6 || !ctype_xdigit($h)) { return '255,255,255'; } return hexdec(substr($h, 0, 2)) . ',' . hexdec(substr($h, 2, 2)) . ',' . hexdec(substr($h, 4, 2)); }; if ($textColor !== '' && preg_match('/^#[0-9A-Fa-f]{6}$/', $textColor)) { // Explicit text colour → derive the whole scale from it. $t = $rgb($textColor); $vars = [ '--rfg' => "rgba($t,0.72)", '--rfgs' => $textColor, '--rfgm' => "rgba($t,0.5)", '--rcap' => "rgba($t,0.42)", '--rhover' => "rgba($t,0.08)", '--rpanel' => "rgba($t,0.06)", '--rpanelbd' => "rgba($t,0.14)", '--rdot' => "rgba($t,0.07)", '--rscroll' => "rgba($t,0.2)", ]; } else { $vars = [ '--rfg' => $light ? 'rgba(11,31,28,0.68)' : 'rgba(255,255,255,0.62)', '--rfgs' => $light ? '#0B1F1C' : '#FBFAF6', '--rfgm' => $light ? 'rgba(11,31,28,0.5)' : 'rgba(255,255,255,0.45)', '--rcap' => $light ? 'rgba(11,31,28,0.42)' : 'rgba(255,255,255,0.32)', '--rhover' => $light ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.06)', '--rpanel' => $light ? 'rgba(0,0,0,0.045)' : 'rgba(255,255,255,0.05)', '--rpanelbd' => $light ? 'rgba(0,0,0,0.10)' : 'rgba(255,255,255,0.10)', '--rdot' => $light ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.06)', '--rscroll' => $light ? 'rgba(0,0,0,0.18)' : 'rgba(255,255,255,0.15)', ]; } $vars['--racc'] = $accentColor; $vars['--racc-tint'] = 'rgba(' . $rgb($accentColor) . ',0.16)'; // A custom background is a fixed inline colour (overrides theme). Without one, // the CSS below drives the background AND the text/panel colours per active // theme, so the rail live-switches light↔dark like the admin sidebar (the app // themes paper/bright/doodle are LIGHT, only `dark` is dark). $hasCustomBg = trim((string) \App\Models\SystemSetting::get('user_sidebar_color', '')) !== ''; $applyInlineText = $hasCustomBg || ($textColor !== '' && preg_match('/^#[0-9A-Fa-f]{6}$/', $textColor)); $styleVars = $hasCustomBg ? ('background:' . $railBg . ';') : ''; foreach ($vars as $k => $v) { // Accent (brand) always applies inline; text/panel vars only when a custom // colour is configured — otherwise the theme CSS below owns them so the // rail adapts to light/dark on its own. if ($k === '--racc' || $k === '--racc-tint' || $applyInlineText) { $styleVars .= $k . ':' . $v . ';'; } } @endphp
{{-- Mobile close (X) --}} {{-- Brand --}} @if ($logoUrl) {{ brand_name() }} @else
{{ brand_name() }}
{{ __('console') }}
@endif
{{-- Nav (min-h-0 so flex-1 + overflow-y-auto actually scrolls, not expands) --}} @php // Active highlighting: match the passed nav-key OR the current URL path. // Many pages set nav-key="more" (for the topbar's overflow menu), which // never matches a sidebar item key — so fall back to the URL so the right // item lights up in sidebar mode without touching every page's nav-key. // Both sides must be compared in the SAME base. On a sub-folder install // (app served from /public) the two disagree by that prefix: // url('/dashboard') -> /public/dashboard (URL::forceRootUrl adds it) // request()->path() -> dashboard (framework already stripped it) // so no item ever matched and nothing highlighted. Strip the base off // both and a root-domain install is unaffected (base is empty there). $navBase = '/' . trim((string) wd_base(), '/'); if ($navBase === '/') { $navBase = ''; } $navStrip = function (string $p) use ($navBase) { $p = '/' . trim($p, '/'); if ($navBase !== '' && ($p === $navBase || str_starts_with($p, $navBase . '/'))) { $p = '/' . trim(substr($p, strlen($navBase)), '/'); } return $p; }; $curPath = $navStrip(request()->path()); $isItemActive = function ($item) use ($active, $curPath, $navStrip) { if ($active !== null && $active === ($item['key'] ?? null)) { return true; } $itemPath = $navStrip((string) (parse_url((string) ($item['href'] ?? ''), PHP_URL_PATH) ?: '')); if ($itemPath === '/' ) { return false; } return $curPath === $itemPath || str_starts_with($curPath, $itemPath . '/'); }; @endphp @php // Sidebar icons, keyed by each nav item's own key. 'l' = Lucide glyph // (ISC, UI), 'b' = brand logo (Simple Icons, CC0). Any item NOT listed // here keeps its original inline SVG (the fallback below), so the nav can // never render blank while the set is being filled out. $iconMap = [ 'dashboard' => ['l' => 'layout-dashboard'], 'analytics' => ['l' => 'chart-column'], 'notifications' => ['l' => 'bell'], 'team-inbox' => ['l' => 'inbox'], 'chat' => ['l' => 'message-circle'], 'call-logs' => ['l' => 'phone'], 'team-members' => ['l' => 'users'], 'contacts' => ['l' => 'contact-round'], 'attributes' => ['l' => 'tags'], 'lead-finder' => ['l' => 'user-search'], 'deals' => ['l' => 'handshake'], 'wa-campaigns' => ['l' => 'megaphone'], 'broadcasts' => ['l' => 'send'], 'scheduled' => ['l' => 'calendar-clock'], 'drip' => ['l' => 'droplets'], 'templates' => ['l' => 'layout-template'], 'wa-forms' => ['l' => 'clipboard-list'], 'waba-groups' => ['l' => 'users-round'], 'message-history' => ['l' => 'history'], 'flows' => ['l' => 'workflow'], 'flow-analytics' => ['l' => 'chart-line'], 'ai-assistants' => ['l' => 'bot'], 'auto-reply' => ['l' => 'reply'], 'appointments' => ['l' => 'calendar-check'], 'ai-training' => ['l' => 'brain'], 'ai-usage' => ['l' => 'gauge'], 'chatbot-widgets' => ['l' => 'message-square-text'], 'warmer' => ['l' => 'flame'], 'devices' => ['l' => 'plug'], 'waba-tools' => ['l' => 'wrench'], 'metaads' => ['b' => 'meta'], 'openaiads' => ['l' => 'sparkles'], 'lead-ads' => ['l' => 'target'], 'social-posts' => ['l' => 'layout-grid'], 'social-calendar' => ['l' => 'calendar-days'], 'instagram-posts' => ['b' => 'instagram'], 'facebook-posts' => ['b' => 'facebook'], 'facebook-setup' => ['b' => 'messenger'], 'facebook-broadcasts' => ['b' => 'messenger'], 'facebook-comment-rules' => ['b' => 'facebook'], 'tiktok-accounts' => ['b' => 'tiktok'], 'tiktok-posts' => ['b' => 'tiktok'], 'telegram' => ['b' => 'telegram'], 'sms' => ['l' => 'smartphone'], 'line' => ['b' => 'line'], 'viber' => ['b' => 'viber'], 'wechat' => ['b' => 'wechat'], 'email' => ['l' => 'mail'], 'threads-posts' => ['b' => 'threads'], 'wa-links' => ['l' => 'link'], 'crm-dashboard' => ['l' => 'kanban'], 'sdr' => ['l' => 'headset'], 'store' => ['l' => 'store'], 'catalog' => ['l' => 'shopping-bag'], 'shopify' => ['b' => 'shopify'], 'woocommerce' => ['b' => 'woocommerce'], 'integrations' => ['l' => 'blocks'], 'google-account' => ['b' => 'google'], 'developers' => ['l' => 'code'], 'webhooks' => ['l' => 'webhook'], 'n8n' => ['b' => 'n8n'], 'support' => ['l' => 'life-buoy'], ]; @endphp {{-- Wallet card --}}
{{ __('Wallet') }}
{{ $planLabel }}
{{ $walletMoney }}
{{ __('Top up') }} →