diff --git a/src/app/page.tsx b/src/app/page.tsx index a95a601..f796d84 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -8,6 +8,10 @@ import { INITIAL_APPOINTMENTS, INITIAL_SOAP_NOTES, INITIAL_SUPERBILLS, + INITIAL_PRODUCTS, + INITIAL_MEMBERSHIPS, + INITIAL_PACKAGES, + INITIAL_WAITLIST, } from '@/lib/mock-data'; import { ClinicTenant, @@ -15,6 +19,11 @@ import { SoapNote, Superbill, Patient, + RetailProduct, + WellnessMembership, + PrePaidPackage, + WaitlistEntry, + StaffRole, } from '@/types/clinical'; import { CalendarView } from '@/components/calendar/CalendarView'; import { SoapChartEditor } from '@/components/charting/SoapChartEditor'; @@ -22,6 +31,10 @@ import { SuperbillView } from '@/components/billing/SuperbillView'; import { RetentionView } from '@/components/retention/RetentionView'; import { PatientPortalView } from '@/components/intake/PatientPortalView'; import { SuperAdminView } from '@/components/admin/SuperAdminView'; +import { RetailInventoryView } from '@/components/pos/RetailInventoryView'; +import { MembershipsView } from '@/components/memberships/MembershipsView'; +import { TelehealthRoom } from '@/components/telehealth/TelehealthRoom'; +import { WaitlistModal } from '@/components/waitlist/WaitlistModal'; import { Calendar, FileText, @@ -32,6 +45,12 @@ import { ChevronDown, Stethoscope, Laptop, + ShoppingBag, + Repeat, + Video, + Shield, + ShieldAlert, + UserCheck, } from 'lucide-react'; export default function Home() { @@ -41,13 +60,23 @@ export default function Home() { // 'clinic' | 'patient' | 'superadmin' const [portalMode, setPortalMode] = useState<'clinic' | 'patient' | 'superadmin'>('clinic'); - // 'calendar' | 'charting' | 'billing' | 'retention' - const [clinicTab, setClinicTab] = useState<'calendar' | 'charting' | 'billing' | 'retention'>('calendar'); + // Staff Role: 'doctor' | 'front_desk' | 'billing_admin' + const [staffRole, setStaffRole] = useState('doctor'); + + // Clinic Sub-Tabs: 'calendar' | 'charting' | 'telehealth' | 'retail' | 'memberships' | 'billing' | 'retention' + const [clinicTab, setClinicTab] = useState< + 'calendar' | 'charting' | 'telehealth' | 'retail' | 'memberships' | 'billing' | 'retention' + >('calendar'); const [appointments, setAppointments] = useState(INITIAL_APPOINTMENTS); const [patients, setPatients] = useState(INITIAL_PATIENTS); const [soapNotes, setSoapNotes] = useState(INITIAL_SOAP_NOTES); const [superbills, setSuperbills] = useState(INITIAL_SUPERBILLS); + const [products, setProducts] = useState(INITIAL_PRODUCTS); + const [memberships, setMemberships] = useState(INITIAL_MEMBERSHIPS); + const [packages, setPackages] = useState(INITIAL_PACKAGES); + const [waitlist, setWaitlist] = useState(INITIAL_WAITLIST); + const [isWaitlistOpen, setIsWaitlistOpen] = useState(false); const [activePatient, setActivePatient] = useState(INITIAL_PATIENTS[0]); const [activeSoapNote, setActiveSoapNote] = useState(INITIAL_SOAP_NOTES[0]); @@ -63,7 +92,12 @@ export default function Home() { const existingSoap = soapNotes.find((s) => s.patientId === apt.patientId && s.appointmentId === apt.id); setActiveSoapNote(existingSoap); - setClinicTab('charting'); + + if (apt.isTelehealth) { + setClinicTab('telehealth'); + } else { + setClinicTab('charting'); + } }; const handleUpdateAppointmentStatus = (aptId: string, status: Appointment['status']) => { @@ -159,6 +193,24 @@ export default function Home() { setClinicTab('calendar'); }; + const handleUpdateProductStock = (productId: string, newStock: number) => { + setProducts((prev) => + prev.map((p) => (p.id === productId ? { ...p, stockQty: newStock } : p)) + ); + }; + + const handleEnrollPatientInMembership = (patientId: string, planName: string) => { + setPatients((prev) => + prev.map((p) => (p.id === patientId ? { ...p, activeMembership: planName } : p)) + ); + }; + + const handleAutoFillWaitlistPatient = (entryId: string) => { + setWaitlist((prev) => + prev.map((w) => (w.id === entryId ? { ...w, status: 'notified' } : w)) + ); + }; + return (
{/* Top Hospital Command Header */} @@ -199,6 +251,52 @@ export default function Home() {
+ + {/* Staff Role Switcher (RBAC) */} +
+ Role: + + + +
{/* Portal Switcher Tabs */} @@ -260,17 +358,65 @@ export default function Home() { Schedule & Encounters + {/* Clinical Charts - Hidden if in Front Desk HIPAA-safe mode */} + {staffRole !== 'front_desk' ? ( + + ) : ( + + HIPAA: Notes Protected + + )} + + {staffRole !== 'front_desk' && ( + + )} + + + )} @@ -311,28 +457,60 @@ export default function Home() { appointments={appointments} providers={activeProviders} activeTenant={activeTenant} + waitlistCount={waitlist.length} onSelectAppointment={handleSelectAppointment} onUpdateStatus={handleUpdateAppointmentStatus} onNewAppointmentClick={() => setPortalMode('patient')} + onOpenWaitlist={() => setIsWaitlistOpen(true)} /> )} - {clinicTab === 'charting' && ( + {clinicTab === 'charting' && staffRole !== 'front_desk' && ( setClinicTab('telehealth')} onBackToCalendar={() => setClinicTab('calendar')} /> )} + {clinicTab === 'telehealth' && staffRole !== 'front_desk' && ( + { + setClinicTab('charting'); + }} + onClose={() => setClinicTab('calendar')} + /> + )} + + {clinicTab === 'retail' && ( + + )} + + {clinicTab === 'memberships' && ( + + )} + {clinicTab === 'billing' && ( setClinicTab('charting')} + onBack={() => setClinicTab('calendar')} onMarkPaid={handleMarkPaid} /> )} @@ -369,11 +547,19 @@ export default function Home() { )} + {/* Cancellation Waitlist Modal */} + setIsWaitlistOpen(false)} + onAutoFillPatient={handleAutoFillWaitlistPatient} + /> + {/* Hospital Footer */}