diff --git a/assets/admin/components/layout/PurchaseSubscriptionSidebar.test.tsx b/assets/admin/components/layout/PurchaseSubscriptionSidebar.test.tsx new file mode 100644 index 00000000..8faf5335 --- /dev/null +++ b/assets/admin/components/layout/PurchaseSubscriptionSidebar.test.tsx @@ -0,0 +1,22 @@ +import { describe, it, expect } from 'vitest'; +import { screen } from '@testing-library/react'; +import { renderWithProviders } from '../../test/utils'; +import PurchaseSubscriptionSidebar from './PurchaseSubscriptionSidebar'; + +describe('PurchaseSubscriptionSidebar — settings menu', () => { + it('lists secretary and staff management (moved out of the main nav)', () => { + renderWithProviders(, { route: '/admin/staff' }); + + const secretary = screen.getByRole('link', { name: 'مدیریت منشی' }); + const staff = screen.getByRole('link', { name: 'پرسنل' }); + + expect(secretary).toHaveAttribute('href', '/admin/my-secretaries'); + expect(staff).toHaveAttribute('href', '/admin/staff'); + }); + + it('highlights the active item (aria-current) for staff', () => { + renderWithProviders(, { route: '/admin/staff' }); + expect(screen.getByRole('link', { name: 'پرسنل' })).toHaveAttribute('aria-current', 'page'); + expect(screen.getByRole('link', { name: 'مدیریت منشی' })).not.toHaveAttribute('aria-current'); + }); +}); diff --git a/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx b/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx index 99ff1d16..7539c671 100644 --- a/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx +++ b/assets/admin/components/layout/PurchaseSubscriptionSidebar.tsx @@ -23,6 +23,8 @@ const NAV_ITEMS: NavItem[] = [ { key: 'tags', label: 'تگ ها', to: '/admin/tags-settings' }, { key: 'sms', label: 'پیامک ها', to: '/admin/sms-wallet' }, { key: 'clinic', label: 'مدیریت مطب', to: '/admin/my-clinic' }, + { key: 'secretary', label: 'مدیریت منشی', to: '/admin/my-secretaries' }, + { key: 'staff', label: 'پرسنل', to: '/admin/staff' }, { key: 'account', label: 'حساب کاربری', to: '/admin/account-settings' }, { key: 'security', label: 'تنظیمات' }, ]; diff --git a/assets/admin/components/layout/SettingsLayout.tsx b/assets/admin/components/layout/SettingsLayout.tsx index b914345d..8e2084fe 100644 --- a/assets/admin/components/layout/SettingsLayout.tsx +++ b/assets/admin/components/layout/SettingsLayout.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { CreditCardIcon, UserIcon, CalendarDaysIcon, BuildingOffice2Icon, WrenchScrewdriverIcon, BanknotesIcon, UsersIcon, ShieldCheckIcon, - TagIcon, ChatBubbleLeftRightIcon, UserCircleIcon, + TagIcon, ChatBubbleLeftRightIcon, UserCircleIcon, UserPlusIcon, } from '@heroicons/react/24/outline'; import PurchaseSubscriptionSidebar from './PurchaseSubscriptionSidebar'; @@ -27,6 +27,7 @@ export const SETTINGS_MENU: SettingsMenuItem[] = [ { key: 'services', label: 'خدمات', icon: WrenchScrewdriverIcon, to: '/admin/clinic-services' }, { key: 'payment', label: 'مدیریت پرداخت', icon: BanknotesIcon, to: '/admin/my-financial' }, { key: 'secretary', label: 'مدیریت منشی', icon: UsersIcon, to: '/admin/my-secretaries' }, + { key: 'staff', label: 'پرسنل', icon: UserPlusIcon, to: '/admin/staff' }, { key: 'insurance', label: 'مدیریت بیمه', icon: ShieldCheckIcon, to: '/admin/insurance-pricing' }, { key: 'tags', label: 'برچسب‌ها', icon: TagIcon, to: '/admin/tags-settings' }, { key: 'sms', label: 'پیامک‌ها', icon: ChatBubbleLeftRightIcon, to: '/admin/sms-wallet' }, diff --git a/assets/admin/components/layout/Sidebar.tsx b/assets/admin/components/layout/Sidebar.tsx index 6780986f..f33691e3 100644 --- a/assets/admin/components/layout/Sidebar.tsx +++ b/assets/admin/components/layout/Sidebar.tsx @@ -13,7 +13,6 @@ import { DocumentTextIcon, FolderOpenIcon, HeartIcon, - IdentificationIcon, KeyIcon, LockClosedIcon, ShieldCheckIcon, @@ -21,7 +20,6 @@ import { TagIcon, UserCircleIcon, UserGroupIcon, - UserPlusIcon, UsersIcon, } from "@heroicons/react/24/outline"; import { NavLink, useNavigate } from "react-router-dom"; @@ -224,12 +222,6 @@ function buildSections( label: "مطالبات بیمه", feature: "insurance", }, - { to: "/admin/staff", icon: UserPlusIcon, label: "پرسنل" }, - { - to: "/admin/my-secretaries", - icon: IdentificationIcon, - label: "منشی ها", - }, ], }, { @@ -294,12 +286,6 @@ function buildSections( label: "مطالبات بیمه", feature: "insurance", }, - { to: "/admin/staff", icon: UserPlusIcon, label: "پرسنل" }, - { - to: "/admin/my-secretaries", - icon: IdentificationIcon, - label: "منشی ها", - }, ], }, { diff --git a/assets/admin/pages/StaffPage.tsx b/assets/admin/pages/StaffPage.tsx index 40298b9f..43f5ef62 100644 --- a/assets/admin/pages/StaffPage.tsx +++ b/assets/admin/pages/StaffPage.tsx @@ -13,6 +13,7 @@ import DataTable, { type Column } from '../components/ui/DataTable'; import Modal from '../components/ui/Modal'; import ConfirmDialog from '../components/ui/ConfirmDialog'; import PageHeader from '../components/ui/PageHeader'; +import SettingsLayout from '../components/layout/SettingsLayout'; import { ActiveBadge } from '../components/ui/StatusBadge'; const schema = z.object({ @@ -155,7 +156,7 @@ export default function StaffPage() { ]; return ( - <> + setToggleTarget(null)} loading={toggleMutation.isPending} /> - + ); }