@php $adminNavigation = app(\App\Support\AdminNavigation::class); $currentAdmin = auth('admin')->user(); @endphp {{-- ============================================================ PRODUCT / POS SOURCE DETECTION ============================================================ --}} @php /* * Shared product pages use the same routes for: * * POS: * ?source=pos * * Website Shopping: * ?source=cart * or no source * * IMPORTANT: * If source=pos, Website Shopping must NOT become active. */ $isPosSource = request()->query('source') === 'pos'; /* * Routes shared by POS and Website Shopping */ $sharedProductRouteActive = request()->routeIs( 'admin.products.*', 'admin.product-categories.*', 'admin.product-attributes.*', 'admin.coupons.*' ); /* * ============================================================ * POS ACTIVE * ============================================================ */ /* * Products / Categories / Attributes / Coupons * are POS only when source=pos. */ $posProductActive = $isPosSource && $sharedProductRouteActive; /* * Other POS-only routes */ $posOtherActive = request()->routeIs( 'admin.pos.*' ); /* * Final POS parent active state */ $posActive = $posProductActive || $posOtherActive; /* * ============================================================ * WEBSITE SHOPPING ACTIVE * ============================================================ */ /* * Shared product routes belong to Website Shopping * ONLY when source is NOT pos. */ $websiteProductActive = !$isPosSource && $sharedProductRouteActive; /* * Website Shopping only routes */ $websiteOtherActive = request()->routeIs( 'admin.product-shipping.*', 'admin.product-tax.*', 'admin.credit-card-fees.*', 'admin.product-discount.*', 'admin.email-sms-templates.*' ); /* * Final Website Shopping parent active state */ $productActive = $websiteProductActive || $websiteOtherActive; @endphp