{{-- Admin-area links for non-admin staff (manager, adviser, teacher), each shown only when this user has its permission and its module is on — the same idea as _staff_money_links, for the pages slices 2c/2d made delegable. Admin's own sidebar keeps its fixed blocks: admin always has every permission. $except lists hrefs the role's own block already prints (with its own placement and module flag), so they aren't shown twice. $withHeading prints an «Управление» title above the links when there is at least one; the manager's sidebar lists them inline, as it did its shop/quests/ analytics links before. --}} @php $delegatedLinks = array_values(array_filter([ [['gamification.stats.view'], null, '/admin/gamification.php', 'bi-bar-chart', __('Статистика геймификации')], [['gamification.shop.edit'], null, '/admin/shop_items.php', 'bi-shop', __('Магазин')], [['gamification.quests.edit'], null, '/admin/quests.php', 'bi-flag', __('Задания недели')], [['gamification.bonuses.give'], null, '/admin/student_bonuses.php', 'bi-gift', __('Бонусные монеты')], [['owner_dashboard.view'], null, '/admin/owner.php', 'bi-speedometer2', __('Сводка владельца')], [['analytics.view'], null, '/analytics.php', 'bi-graph-up', __('Аналитика')], [['quizzes.questions.edit', 'quizzes.manage'], null, '/quizzes.php', 'bi-patch-question', __('Квизы')], [['gamification.catalog.edit'], null, '/admin/achievements.php', 'bi-trophy', __('Достижения')], [['gamification.catalog.edit'], null, '/admin/hero_levels.php', 'bi-star', __('Уровни')], [['rooms.book'], null, '/admin/room_bookings.php', 'bi-bookmark-check', __('Бронирование кабинетов')], [['trial_ent.manage'], 'trial_ent', '/admin/trial_ent.php', 'bi-person-lines-fill', __('Запись на пробный ЕНТ')], [['schedules.edit'], null, '/admin/schedule_clashes.php', 'bi-exclamation-triangle', __('Пересечения в расписании')], [['journal.view'], null, '/admin/all_journal.php', 'bi-journal-text', __('Журнал всех уроков')], [['substitutions.view'], null, '/admin/substitutions.php', 'bi-arrow-left-right', __('Замены')], [['empty_lessons.review'], null, '/admin/empty_lessons.php', 'bi-person-dash', __('Уроки без учеников')], [['backfills.view'], 'admin_backfills', '/admin/backfills.php', 'bi-hourglass-split', __('Задним числом')], [['ent.scores.manage'], 'admin_ent_scores', '/admin/ent_scores.php', 'bi-clipboard-data', __('ЕНТ')], [['ent.variants.manage'], 'admin_ent_scores', '/admin/ent_variants.php', 'bi-ui-checks-grid', __('Ключи ЕНТ')], [['adviser_tasks.view'], 'admin_adviser_tasks_page', '/admin/adviser_tasks.php', 'bi-clipboard-check', __('Задачи кураторов')], [['churn_risk.view'], null, '/admin/churn_risk.php', 'bi-person-exclamation', __('Риск ухода')], [['leads.view'], 'admin_leads', '/admin/leads.php', 'bi-inbox', __('Заявки')], [['feedback.view'], null, '/admin/feedbacks.php', 'bi-chat-square-text', __('Все жалобы и похвалы')], [['dictionaries.edit'], null, '/admin/indexes.php', 'bi-book', __('Справочники')], [['study_plans.edit'], null, '/admin/discipline_plan.php', 'bi-list-ol', __('КТП дисциплин')], [['courses.edit'], 'courses', '/admin/courses.php', 'bi-book', __('Курсы и материалы')], [['users.view'], null, '/admin/users.php', 'bi-person-gear', __('Пользователи')], [['teachers.view'], null, '/admin/teachers.php', 'bi-person-video3', __('Преподаватели')], [['teachers.rating.view'], null, '/admin/teacher_rating.php', 'bi-award', __('Рейтинг преподавателей')], [['parents.view'], null, '/admin/parents.php', 'bi-people', __('Родители')], ], fn (array $l) => ! in_array($l[2], $except ?? [], true) && array_filter($l[0], fn (string $key) => \App\Support\Permissions::current($key)) !== [] && ($l[1] === null || \App\Support\Modules::enabled($l[1])))); @endphp @php // Folded by topic, so a user with many delegated pages gets a handful of rows // instead of up to 29. Keyed by href; a new link not listed here lands in «Прочее». $delegatedBuckets = [ 'navGroupStaffGame' => [__('Геймификация'), 'bi-controller', ['/admin/gamification.php', '/admin/shop_items.php', '/admin/quests.php', '/admin/student_bonuses.php', '/quizzes.php', '/admin/achievements.php', '/admin/hero_levels.php']], 'navGroupStaffSchedule' => [__('Расписание и журнал'), 'bi-calendar3', ['/admin/room_bookings.php', '/admin/trial_ent.php', '/admin/schedule_clashes.php', '/admin/all_journal.php', '/admin/substitutions.php', '/admin/empty_lessons.php', '/admin/backfills.php']], 'navGroupStaffEnt' => [__('ЕНТ'), 'bi-clipboard-data', ['/admin/ent_scores.php', '/admin/ent_variants.php']], 'navGroupStaffPeople' => [__('Работа с людьми'), 'bi-people', ['/admin/leads.php', '/admin/adviser_tasks.php', '/admin/churn_risk.php', '/admin/feedbacks.php', '/admin/teachers.php', '/admin/teacher_rating.php', '/admin/parents.php', '/admin/users.php']], 'navGroupStaffReports' => [__('Отчёты'), 'bi-graph-up', ['/admin/owner.php', '/analytics.php']], 'navGroupStaffIndexes' => [__('Справочники'), 'bi-book', ['/admin/indexes.php', '/admin/discipline_plan.php', '/admin/courses.php']], ]; $bucketedHrefs = array_merge(...array_column($delegatedBuckets, 2)); $delegatedBuckets['navGroupStaffOther'] = [__('Прочее'), 'bi-three-dots', array_values(array_diff(array_column($delegatedLinks, 2), $bucketedHrefs))]; @endphp @if ($delegatedLinks !== []) @if ($withHeading ?? false) @endif @foreach ($delegatedBuckets as $groupId => [$groupLabel, $groupIcon, $hrefs]) @include('layouts.partials._nav_group', [ 'id' => $groupId, 'label' => $groupLabel, 'icon' => $groupIcon, 'links' => array_map( fn (array $l) => [$l[2], $l[3], $l[4]], array_values(array_filter($delegatedLinks, fn (array $l) => in_array($l[2], $hrefs, true))) ), ]) @endforeach @endif