refactor: move secretary and staff management from main nav to settings menu
Remove پرسنل (/admin/staff) and منشی ها (/admin/my-secretaries) from the clinic and doctor main sidebars; surface them under the settings menu instead (PurchaseSubscriptionSidebar + SETTINGS_MENU). Wrap StaffPage in SettingsLayout so it renders inside the settings shell like MySecretariesPage already does. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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(<PurchaseSubscriptionSidebar active="staff" />, { 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(<PurchaseSubscriptionSidebar active="staff" />, { route: '/admin/staff' });
|
||||
expect(screen.getByRole('link', { name: 'پرسنل' })).toHaveAttribute('aria-current', 'page');
|
||||
expect(screen.getByRole('link', { name: 'مدیریت منشی' })).not.toHaveAttribute('aria-current');
|
||||
});
|
||||
});
|
||||
@@ -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: 'تنظیمات' },
|
||||
];
|
||||
|
||||
@@ -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' },
|
||||
|
||||
@@ -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: "منشی ها",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<SettingsLayout active="staff">
|
||||
<PageHeader
|
||||
title="مدیریت پرسنل"
|
||||
description="لیست پرسنل کلینیک / مطب"
|
||||
@@ -239,7 +240,7 @@ export default function StaffPage() {
|
||||
onCancel={() => setToggleTarget(null)}
|
||||
loading={toggleMutation.isPending}
|
||||
/>
|
||||
</>
|
||||
</SettingsLayout>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user