feat(services): add services menu item to sidebar and update related components

This commit is contained in:
hamed
2026-07-15 16:35:02 +03:30
parent 704e69f05f
commit 5c15a4dd7f
5 changed files with 37 additions and 11 deletions
@@ -19,7 +19,6 @@ const NAV_ITEMS: NavItem[] = [
{ key: 'payment', label: 'مدیریت پرداخت', to: '/admin/my-financial' },
{ key: 'appointment', label: 'مدیریت نوبت دهی', to: '/admin/appointment-settings' },
{ key: 'insurance', label: 'مدیریت بیمه', to: '/admin/insurance-pricing' },
{ key: 'services', label: 'خدمات', to: '/admin/clinic-services' },
{ key: 'tags', label: 'تگ ها', to: '/admin/tags-settings' },
{ key: 'sms', label: 'پیامک ها', to: '/admin/sms-wallet' },
{ key: 'clinic', label: 'مدیریت مطب', to: '/admin/my-clinic' },
@@ -1,7 +1,7 @@
import React from 'react';
import {
CreditCardIcon, UserIcon, CalendarDaysIcon, BuildingOffice2Icon,
WrenchScrewdriverIcon, BanknotesIcon, UsersIcon, ShieldCheckIcon,
BanknotesIcon, UsersIcon, ShieldCheckIcon,
TagIcon, ChatBubbleLeftRightIcon, UserCircleIcon, UserPlusIcon,
} from '@heroicons/react/24/outline';
import PurchaseSubscriptionSidebar from './PurchaseSubscriptionSidebar';
@@ -24,7 +24,6 @@ export const SETTINGS_MENU: SettingsMenuItem[] = [
{ key: 'doctor', label: 'مدیریت پزشک', icon: UserIcon, to: '/admin/profile', roles: ['doctor'] },
{ key: 'appointment', label: 'مدیریت نوبت دهی', icon: CalendarDaysIcon, to: '/admin/appointment-settings', roles: ['doctor'] },
{ key: 'clinic', label: 'مدیریت مطب', icon: BuildingOffice2Icon, to: '/admin/my-clinic', roles: ['clinic'] },
{ 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' },
@@ -41,3 +41,23 @@ describe('Sidebar — expandable نوبت‌ها menu', () => {
expect(screen.getByText('نوبت های تایید شده')).toBeInTheDocument();
});
});
describe('Sidebar — خدمات در منوی اصلی (نه تنظیمات)', () => {
it('shows خدمات in the clinic main menu linking to /admin/clinic-services', () => {
useAuthStore.setState({
primaryRole: 'clinic', dbUuid: 'c1', userName: 'کلینیک',
availableContexts: [], context: null,
} as any);
renderWithProviders(<Sidebar />, { route: '/admin/dashboard' });
expect(screen.getByText('سرویس ها').closest('a')).toHaveAttribute('href', '/admin/clinic-services');
});
it('shows خدمات in the doctor main menu linking to /admin/clinic-services', () => {
useAuthStore.setState({
primaryRole: 'doctor', dbUuid: null, userName: 'پزشک',
availableContexts: [], context: null,
} as any);
renderWithProviders(<Sidebar />, { route: '/admin/dashboard' });
expect(screen.getByText('سرویس ها').closest('a')).toHaveAttribute('href', '/admin/clinic-services');
});
});
+13 -2
View File
@@ -22,6 +22,7 @@ import {
StarIcon,
TagIcon,
UserCircleIcon,
WrenchScrewdriverIcon,
UserGroupIcon,
UsersIcon,
} from "@heroicons/react/24/outline";
@@ -242,10 +243,15 @@ function buildSections(
icon: ArchiveBoxIcon,
label: "انبارداری",
},
{
to: "/admin/clinic-services",
icon: WrenchScrewdriverIcon,
label: "سرویس ها",
},
],
},
{
// مدیریت بیمه / سرویس‌ها / کیف پول پیامک زیر همین «تنظیمات» است
// مدیریت بیمه / کیف پول پیامک زیر همین «تنظیمات» است
// (منوی داخل صفحهٔ اشتراک)، نه در سایدبار اصلی.
label: "تنظیمات",
items: [
@@ -312,10 +318,15 @@ function buildSections(
icon: ArchiveBoxIcon,
label: "انبارداری",
},
{
to: "/admin/clinic-services",
icon: WrenchScrewdriverIcon,
label: "سرویس ها",
},
],
},
{
// مدیریت بیمه / سرویس‌ها / کیف پول پیامک زیر همین «تنظیمات» است
// مدیریت بیمه / کیف پول پیامک زیر همین «تنظیمات» است
// (منوی داخل صفحهٔ اشتراک)، نه در سایدبار اصلی.
label: "تنظیمات",
items: [
+3 -6
View File
@@ -6,7 +6,6 @@ import {
EllipsisHorizontalIcon, CheckCircleIcon, XCircleIcon, ChevronRightIcon,
XMarkIcon, UsersIcon, ClockIcon,
} from '@heroicons/react/24/outline';
import SettingsLayout from '../components/layout/SettingsLayout';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
@@ -611,10 +610,8 @@ function ClinicServicesPageInner() {
export default function ClinicServicesPage() {
return (
<SettingsLayout active="services">
<FeatureGate feature="services">
<ClinicServicesPageInner />
</FeatureGate>
</SettingsLayout>
<FeatureGate feature="services">
<ClinicServicesPageInner />
</FeatureGate>
);
}