fix(discount): move Discount Management tab to the /admin/subscription page

The discount tab was wired into AdminSubscriptionPage (route
/admin/admin-subscription, admin-only) but /admin/subscription renders the
doctor/clinic SubscriptionPage. Since discount rules are owner-scoped, add
the segmented «مدیریت تخفیف‌ها» tab there and revert AdminSubscriptionPage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-17 12:14:48 +03:30
co-authored by Claude Fable 5
parent 2691751e70
commit 07c9600991
2 changed files with 17 additions and 9 deletions
+6 -9
View File
@@ -13,7 +13,6 @@ import Modal from '../components/ui/Modal';
import ConfirmDialog from '../components/ui/ConfirmDialog';
import PageHeader from '../components/ui/PageHeader';
import Pagination from '../components/ui/Pagination';
import DiscountTab from '../components/DiscountTab';
// ── Types ─────────────────────────────────────────────────────────────────
@@ -436,21 +435,19 @@ function ReportTab() {
// ── Main ──────────────────────────────────────────────────────────────────
export default function AdminSubscriptionPage() {
const [tab, setTab] = useState<'plans' | 'report' | 'discounts'>('plans');
const [tab, setTab] = useState<'plans' | 'report'>('plans');
return (
<>
<PageHeader title="مدیریت اشتراک‌ها" description="تعریف پلن‌ها، دوره‌ها، تخفیف‌ها و گزارش فروش" />
<PageHeader title="مدیریت اشتراک‌ها" description="تعریف پلن‌ها، دوره‌ها و گزارش فروش" />
<div className="seg" style={{ marginBottom: 20 }}>
<button className={tab === 'plans' ? 'on' : ''} onClick={() => setTab('plans')}>پلنها و دورهها</button>
<button className={tab === 'discounts' ? 'on' : ''} onClick={() => setTab('discounts')}>مدیریت تخفیفها</button>
<button className={tab === 'report' ? 'on' : ''} onClick={() => setTab('report')}>گزارش فروش</button>
<button className={tab === 'plans' ? 'on' : ''} onClick={() => setTab('plans')}>پلنها و دورهها</button>
<button className={tab === 'report' ? 'on' : ''} onClick={() => setTab('report')}>گزارش فروش</button>
</div>
{tab === 'plans' && <PlansTab />}
{tab === 'discounts' && <DiscountTab />}
{tab === 'report' && <ReportTab />}
{tab === 'plans' && <PlansTab />}
{tab === 'report' && <ReportTab />}
</>
);
}