getUri(); $n = $uriObj->getTotalSegments(); $uri = $n >= 2 ? $uriObj->getSegment(2) : ''; $seg3 = $n >= 3 ? $uriObj->getSegment(3) : ''; $mbLevel = (int) session()->get('mb_level'); $isSuperAdmin = ($mbLevel === \Config\Roles::LEVEL_SUPER_ADMIN); $effectiveLgIdx = admin_effective_lg_idx(); $effectiveLgName = null; if ($effectiveLgIdx) { $lgRow = model(\App\Models\LocalGovernmentModel::class)->find($effectiveLgIdx); $effectiveLgName = $lgRow ? $lgRow->lg_name : null; } $currentPath = trim((string) $uriObj->getPath(), '/'); if (str_starts_with($currentPath, 'index.php/')) { $currentPath = substr($currentPath, strlen('index.php/')); } $adminNavTree = get_admin_nav_tree(); $isActive = static function (string $path) use ($uri, $seg3, $currentPath, $adminNavTree) { if (! empty($adminNavTree)) { return $currentPath === trim($path, '/'); } if ($path === 'admin' || $path === '') return $uri === ''; if ($path === 'users') return $uri === 'users'; if ($path === 'login-history') return $uri === 'access' && $seg3 === 'login-history'; if ($path === 'approvals') return $uri === 'access' && $seg3 === 'approvals'; if ($path === 'roles') return $uri === 'roles'; if ($path === 'menus') return $uri === 'menus'; if ($path === 'local-governments') return $uri === 'local-governments'; if ($path === 'select-local-government') return $uri === 'select-local-government'; if ($path === 'designated-shops') return $uri === 'designated-shops'; return false; }; ?>
= esc($err) ?>