fix(subscription): settings sidebar items match tauri source

Give the subscription sidebar its own nav list copied from clinic-pro-tauri's
PurchaseSubscription navItems (order and labels), dropping 'مدیریت پزشک' (it
belongs in the main nav). Items are shown ungated to mirror the source; the
'تنظیمات' (security) section has no doctor/clinic route yet so it renders
disabled. SETTINGS_MENU / SettingsLayout (other pages) are left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-14 15:04:18 +03:30
co-authored by Claude Opus 4.8
parent b6e702700a
commit 9bb7f411d2
@@ -1,23 +1,37 @@
import React, { useMemo, useState } from 'react';
import { Link } from 'react-router-dom';
import { useAuthStore } from '../../stores/authStore';
import { menuForRole } from './SettingsLayout';
import { SearchHeaderP } from '../../pages/subscriptionIcons';
/**
* PurchaseSubscriptionSidebar — settings sub-navigation styled after
* clinic-pro-tauri's `PurchaseSubscriptionSidebar.jsx` (title + search + tab
* list, orange active pill #f17732). Desktop-only, like the rest of the
* clinicpro settings area (mobile nav is owned by the standalone settings list
* page). Each item is a real admin route (SETTINGS_MENU / menuForRole) so the
* routing architecture is preserved. `active` marks the open section.
* Settings sub-navigation for the subscription page — item list and order copied
* verbatim from clinic-pro-tauri's `PurchaseSubscription.jsx` navItems, minus
* "مدیریت پزشک" (that lives in the main nav / doctor profile, not here). Shown
* ungated to mirror the tauri source. Each entry maps to a real admin route; the
* "تنظیمات" (security) section has no doctor/clinic route yet → disabled.
*
* This list is intentionally separate from SETTINGS_MENU (SettingsLayout) so the
* other settings pages are not affected.
*/
type NavItem = { key: string; label: string; to?: string };
const NAV_ITEMS: NavItem[] = [
{ key: 'subscription', label: 'خرید اشتراک', to: '/admin/subscription' },
{ 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' },
{ key: 'account', label: 'حساب کاربری', to: '/admin/account-settings' },
{ key: 'security', label: 'تنظیمات' },
];
export default function PurchaseSubscriptionSidebar({ active }: { active: string }) {
const primaryRole = useAuthStore((s) => s.primaryRole);
const [query, setQuery] = useState('');
const items = useMemo(
() => menuForRole(primaryRole).filter((i) => i.label.includes(query.trim())),
[primaryRole, query],
() => NAV_ITEMS.filter((i) => i.label.includes(query.trim())),
[query],
);
return (