@php $user = auth()->user(); //Organisation menu structure if ($user->isOrganization() || $user->managing_organisation) { $menuConfig = [ [ 'title' => 'Dashboard', 'icon' => 'ki-outline ki-home-2', 'link' => '/panel', 'active-url' => 'panel', ], // [ // 'title' => 'Manage Organisation', // 'icon' => 'ki-outline ki-office-bag', // 'link' => '/panel/organisations/manage', // 'active-url' => 'panel/organisations/manage', // ], [ 'title' => 'Staff Management', 'icon' => 'ki-outline ki-people', 'submenu' => [ ['title' => 'Employees', 'link' => '/panel/manage/employees'], ['title' => 'Departments', 'link' => '/panel/organisations/manage-children'], ], 'showMore' => false, 'maxShownEntries' => 3, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Training', 'icon' => 'ki-outline ki-book-square', 'submenu' => [ ['title' => 'Course Library', 'link' => '/panel/webinars'], ['title' => 'Create Course', 'link' => '/panel/webinars/new'], ['title' => 'Department Training', 'link' => '/panel/organisations/department-training'], ], 'showMore' => false, 'maxShownEntries' => 3, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Reports', 'icon' => 'ki-outline ki-chart-pie-simple', 'submenu' => [ ['title' => 'Reports Board', 'link' => '/panel/reports/board'], ['title' => 'Mandatory Training Completion Status', 'link' => '/panel/reports/mandatory-training'], ['title' => 'Certification Tracking', 'link' => '/panel/reports/certification-tracking'], ['title' => 'Expiring Certifications', 'link' => '/panel/reports/expiring-certifications'], ['title' => 'Compliance Deadline Tracking', 'link' => '/panel/reports/compliance-tracking'], ['title' => 'Department-Wise Completion Rates', 'link' => '/panel/reports/department-completion'], [ 'title' => 'License utilization (Parent Org Only)', 'link' => '/panel/reports/license-utilization', ], ], 'showMore' => false, 'maxShownEntries' => 8, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Certificates', 'icon' => 'ki-outline ki-award', 'submenu' => [ ['title' => 'Authenticate Certificates', 'link' => '/panel/certificates/authenticate'], ], 'showMore' => false, 'maxShownEntries' => 4, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Financials', 'icon' => 'ki-outline ki-dollar', 'submenu' => [ ['title' => 'Invoices', 'link' => '/panel/financial/invoices'], ], 'showMore' => false, 'maxShownEntries' => 5, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Subscriptions', 'icon' => 'ki-outline ki-dollar', 'submenu' => [ ['title' => 'Manage Subscription', 'link' => '/panel/financial/subscription/manage'], ['title' => 'View Packages', 'link' => '/panel/financial/subscription/packages'], ], 'showMore' => false, 'maxShownEntries' => 5, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], ]; $secondaryMenuConfig = [ 'title' => 'Labels', 'items' => [ ['title' => 'Google Ads', 'color' => 'primary', 'badge' => 6], ['title' => 'AirStoke App', 'color' => 'success', 'badge' => 2], ['title' => 'Internal Tasks', 'color' => 'warning', 'badge' => 37], ['title' => 'Fitnes App', 'color' => 'danger', 'badge' => 4], ], 'showMore' => true, 'maxShownEntries' => 4, 'moreText' => 'Show more', 'lessText' => 'Show less', 'collapsibleItems' => [ ['title' => 'Oppo CRM', 'color' => 'info', 'badge' => 12], ['title' => 'Finance Dispatch', 'color' => 'warning', 'badge' => 25], ], ]; } //User menu structure elseif ($user->isUser()) { $menuConfig = [ [ 'title' => 'Dashboard', 'icon' => 'ki-outline ki-home-2', 'link' => '/panel', 'active-url' => 'panel', ], [ 'title' => 'My Courses', 'icon' => 'ki-outline ki-book-square', 'link' => '/panel/webinars', ], [ 'title' => 'Certificates', 'icon' => 'ki-outline ki-award', 'submenu' => [ ['title' => 'My Certificates', 'link' => '/panel/certificates/my'], ['title' => 'Authenticate Certificates', 'link' => '/panel/certificates/authenticate'], ], 'showMore' => false, 'maxShownEntries' => 4, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Financials', 'icon' => 'ki-outline ki-dollar', 'submenu' => [ ['title' => 'Invoices', 'link' => '/panel/financial/invoices'], ], 'showMore' => false, 'maxShownEntries' => 5, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Support', 'icon' => 'ki-outline ki-question', 'submenu' => [ ['title' => 'Create Ticket', 'link' => '/panel/support/send-ticket'], ['title' => 'My Tickets', 'link' => '/panel/support/my-tickets'], ], 'showMore' => false, 'maxShownEntries' => 5, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], ]; $secondaryMenuConfig = [ 'title' => 'Labels', 'items' => [ ['title' => 'Google Ads', 'color' => 'primary', 'badge' => 6], ['title' => 'AirStoke App', 'color' => 'success', 'badge' => 2], ['title' => 'Internal Tasks', 'color' => 'warning', 'badge' => 37], ['title' => 'Fitnes App', 'color' => 'danger', 'badge' => 4], ], 'showMore' => true, 'maxShownEntries' => 4, 'moreText' => 'Show more', 'lessText' => 'Show less', 'collapsibleItems' => [ ['title' => 'Oppo CRM', 'color' => 'info', 'badge' => 12], ['title' => 'Finance Dispatch', 'color' => 'warning', 'badge' => 25], ], ]; } //Instructor menu structure elseif ($user->isTeacher()) { $menuConfig = [ [ 'title' => 'Dashboard', 'icon' => 'ki-outline ki-home-2', 'link' => '/panel', 'active-url' => 'panel', ], [ 'title' => 'My Courses', 'icon' => 'ki-outline ki-book-square', 'link' => '/panel/webinars', ], [ 'title' => 'Certificates', 'icon' => 'ki-outline ki-award', 'submenu' => [ ['title' => 'My Certificates', 'link' => '/panel/certificates/my'], ['title' => 'Badges', 'link' => '/panel/certificates/badges'], ['title' => 'Authenticate Certificates', 'link' => '/panel/certificates/authenticate'], ], 'showMore' => false, 'maxShownEntries' => 4, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Financials', 'icon' => 'ki-outline ki-dollar', 'submenu' => [ ['title' => 'Charge Account', 'link' => '/panel/financial/charge-account'], ['title' => 'Invoices', 'link' => '/panel/financial/invoices'], ], 'showMore' => false, 'maxShownEntries' => 5, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], [ 'title' => 'Support', 'icon' => 'ki-outline ki-question', 'submenu' => [ ['title' => 'Send Ticket', 'link' => '/panel/support/send-ticket'], ['title' => 'Course Support', 'link' => '/panel/support/course-support'], ['title' => 'My Tickets', 'link' => '/panel/support/my-tickets'], ], 'showMore' => false, 'maxShownEntries' => 5, 'moreText' => 'Show More', 'lessText' => 'Show Less', ], ]; $secondaryMenuConfig = [ 'title' => 'Labels', 'items' => [ ['title' => 'Google Ads', 'color' => 'primary', 'badge' => 6], ['title' => 'AirStoke App', 'color' => 'success', 'badge' => 2], ['title' => 'Internal Tasks', 'color' => 'warning', 'badge' => 37], ['title' => 'Fitnes App', 'color' => 'danger', 'badge' => 4], ], 'showMore' => true, 'maxShownEntries' => 4, 'moreText' => 'Show more', 'lessText' => 'Show less', 'collapsibleItems' => [ ['title' => 'Oppo CRM', 'color' => 'info', 'badge' => 12], ['title' => 'Finance Dispatch', 'color' => 'warning', 'badge' => 25], ], ]; } function generateMenu($menuItems, $addSegment, $level = 0) { $html = ''; foreach ($menuItems as $item) { $hasSubmenu = !empty($item['submenu']); $menuItemClass = 'menu-item fs-6' . ($hasSubmenu ? ' menu-accordion' : ''); $menuTitleClass = ''; // Check if the current item or any of its children is active $isActive = false; if (!empty($item['link'])) { $itemPath = ltrim($item['link'], '/'); // Remove leading slash $isActive = Request::path() === $itemPath; } if (!$isActive && $hasSubmenu) { $isActive = checkActiveSubmenu($item['submenu']); } if ($isActive) { $menuItemClass .= ' hover show'; $addSegment($item['title']); // $menuTitleClass .= ' text-primary'; } $menuItemClass .= $hasSubmenu ? ' menu-accordion' : ''; $html .= ''; $html .= ''; if (!empty($item['link'])) { $html .= ''; } else { $html .= ''; } if ($level === 0) { $html .= ''; } else { $html .= ''; } $html .= '' . $item['title'] . ''; if ($hasSubmenu) { $html .= ''; } $html .= ''; if (!empty($item['link'])) { $html .= ''; } $html .= ''; if ($hasSubmenu) { $html .= ''; $html .= ''; $html .= ''; } $html .= ''; } return $html; } function checkActiveSubmenu($submenu) { foreach ($submenu as $item) { if (!empty($item['link'])) { $itemPath = ltrim($item['link'], '/'); // Remove leading slash if (Request::path() === $itemPath) { return true; } } if (!empty($item['submenu'])) { if (checkActiveSubmenu($item['submenu'])) { return true; } } } return false; } function generateSecondaryMenu($config) { $html = ''; return $html; } function generateSecondaryMenuItem($item) { $html = ''; return $html; } @endphp