feat(subscription): implement feature gating for subscription-based access in admin panel
This commit is contained in:
@@ -15,6 +15,8 @@ import Modal from '../components/ui/Modal';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
import PageHeader from '../components/ui/PageHeader';
|
||||
import { useAuthStore } from '../stores/authStore';
|
||||
import { useSubscription } from '../hooks/useSubscription';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
// ── Default permissions & labels ──────────────────────────────────────────
|
||||
|
||||
@@ -143,6 +145,7 @@ export default function MySecretariesPage() {
|
||||
const { doctorUuid, dbUuid, primaryRole } = useAuthStore();
|
||||
|
||||
const isClinic = primaryRole === 'clinic';
|
||||
const { maxSecretaries } = useSubscription();
|
||||
|
||||
// for clinic: selected doctor to add secretary for
|
||||
const [selectedDoctorUuid, setSelectedDoctorUuid] = useState<string>('');
|
||||
@@ -309,10 +312,16 @@ export default function MySecretariesPage() {
|
||||
title="منشیان من"
|
||||
description="مدیریت منشیان و دسترسیهای آنها"
|
||||
action={
|
||||
<button className="btn primary sm" onClick={handleCreateOpen} disabled={isClinic && !selectedDoctorUuid}>
|
||||
<PlusIcon style={{ width: 16 }} />
|
||||
افزودن منشی
|
||||
</button>
|
||||
secretaries.length >= maxSecretaries ? (
|
||||
<Link to="/admin/subscription" className="btn sm" style={{ textDecoration: 'none', opacity: 0.8 }} title={`حداکثر ${maxSecretaries} منشی مجاز است`}>
|
||||
ارتقاء پنل برای افزودن منشی
|
||||
</Link>
|
||||
) : (
|
||||
<button className="btn primary sm" onClick={handleCreateOpen} disabled={isClinic && !selectedDoctorUuid}>
|
||||
<PlusIcon style={{ width: 16 }} />
|
||||
افزودن منشی
|
||||
</button>
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user