feat(discount): dedicated «مدیریت تخفیفها» item in the settings menu
Add a standalone settings sidebar entry + route (/admin/discounts) rendering DiscountsPage (DiscountTab inside SettingsLayout, doctor/clinic only), and revert the temporary tab inside the subscription page. Cleaner, discoverable placement. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import SettingsLayout from '../components/layout/SettingsLayout';
|
||||
import DiscountTab from '../components/DiscountTab';
|
||||
|
||||
/** مدیریت تخفیفها — بخش تنظیمات برای تعریف قوانین تخفیف عمومی (owner-scoped). */
|
||||
export default function DiscountsPage() {
|
||||
return (
|
||||
<SettingsLayout active="discounts">
|
||||
<div
|
||||
style={{ background: 'var(--surface)', minWidth: 0 }}
|
||||
className="px-4 py-4 md:px-6 md:py-6 rounded-[var(--r-lg)]"
|
||||
>
|
||||
<h1 className="section-title" style={{ marginBottom: 16 }}>مدیریت تخفیفها</h1>
|
||||
<DiscountTab />
|
||||
</div>
|
||||
</SettingsLayout>
|
||||
);
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import { usePaymentConfig } from '../hooks/usePaymentConfig';
|
||||
import { formatRial, formatNumber } from '../lib/utils';
|
||||
import Modal from '../components/ui/Modal';
|
||||
import SettingsLayout from '../components/layout/SettingsLayout';
|
||||
import DiscountTab from '../components/DiscountTab';
|
||||
import {
|
||||
SparkleIcon, PlanCardPerson, CloseCircleFilled, GiftIcon, InfoCircleRedFilled,
|
||||
} from './subscriptionIcons';
|
||||
@@ -56,7 +55,6 @@ export const planMetaOf = (name: string) => PLAN_META[name] ?? PLAN_META.free;
|
||||
|
||||
export default function SubscriptionPage() {
|
||||
const qc = useQueryClient();
|
||||
const [tab, setTab] = useState<'plans' | 'discounts'>('plans');
|
||||
const [purchaseTarget, setPurchaseTarget] = useState<{ period: SubscriptionPeriod; planName: string } | null>(null);
|
||||
const [selectedGateway, setSelectedGateway] = useState<string>('');
|
||||
|
||||
@@ -124,14 +122,6 @@ export default function SubscriptionPage() {
|
||||
style={{ background: 'var(--surface)', minWidth: 0 }}
|
||||
className="px-4 py-4 md:px-6 md:py-6 rounded-[var(--r-lg)]"
|
||||
>
|
||||
<div className="seg" style={{ marginBottom: 20 }}>
|
||||
<button className={tab === 'plans' ? 'on' : ''} onClick={() => setTab('plans')}>اشتراک</button>
|
||||
<button className={tab === 'discounts' ? 'on' : ''} onClick={() => setTab('discounts')}>مدیریت تخفیفها</button>
|
||||
</div>
|
||||
|
||||
{tab === 'discounts' ? (
|
||||
<DiscountTab />
|
||||
) : (
|
||||
<div dir="ltr" style={{ width: '100%', display: 'flex', flexDirection: 'column', gap: 32, paddingTop: 8 }}>
|
||||
{/* ── Header: current plan (left) + title (right) ── */}
|
||||
<div style={{ display: 'flex', width: '100%', justifyContent: 'space-between', alignItems: 'center', gap: 16, flexWrap: 'wrap' }}>
|
||||
@@ -173,7 +163,6 @@ export default function SubscriptionPage() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</SettingsLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user