- New lab_rx_template table with sortOrder and Prisma migrations - Backend CRUD + reorder routes at /api/lab-rx/templates - Auto-seeds 3 Highland Dental Studio defaults on first use per user - LabRxModal: template picker, inline rename, up/down reorder, full template form with sections (Template Name / Lab Info / Case Details) - RX popup: Tooth Number, Shade, Due Date, Doctor (from NPI providers), Instructions pre-filled with "Please make / Thank you!", print output - lab-rx-templates.ts config file for future git-managed additions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
85 lines
2.6 KiB
TypeScript
85 lines
2.6 KiB
TypeScript
import { useState } from "react";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
import { PatientTable } from "@/components/patients/patient-table";
|
|
import { BarcodeModal } from "@/components/chart/barcode-modal";
|
|
import { LabRxModal } from "@/components/chart/lab-rx-modal";
|
|
import { Barcode, FileText } from "lucide-react";
|
|
import { Patient } from "@repo/db/types";
|
|
|
|
export function LabManagementTab() {
|
|
const [selectedPatient, setSelectedPatient] = useState<Patient | null>(null);
|
|
const [barcodeOpen, setBarcodeOpen] = useState(false);
|
|
const [labRxOpen, setLabRxOpen] = useState(false);
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
{/* Action buttons */}
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Lab Actions</CardTitle>
|
|
<CardDescription>
|
|
{selectedPatient
|
|
? `Selected patient: ${selectedPatient.firstName} ${selectedPatient.lastName}`
|
|
: "Select a patient below to get started."}
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<div className="flex gap-4">
|
|
<Button
|
|
variant="outline"
|
|
className="gap-2"
|
|
disabled={!selectedPatient}
|
|
onClick={() => setBarcodeOpen(true)}
|
|
>
|
|
<Barcode className="h-4 w-4" />
|
|
Create a Barcode
|
|
</Button>
|
|
<Button
|
|
variant="outline"
|
|
className="gap-2"
|
|
disabled={!selectedPatient}
|
|
onClick={() => setLabRxOpen(true)}
|
|
>
|
|
<FileText className="h-4 w-4" />
|
|
Lab RX
|
|
</Button>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
{/* Patient search / selection */}
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Patient Records</CardTitle>
|
|
<CardDescription>Select a patient by clicking the checkbox.</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<PatientTable
|
|
allowView={true}
|
|
allowDelete={false}
|
|
allowCheckbox={true}
|
|
allowEdit={false}
|
|
onSelectPatient={setSelectedPatient}
|
|
/>
|
|
</CardContent>
|
|
</Card>
|
|
|
|
{selectedPatient && (
|
|
<>
|
|
<BarcodeModal
|
|
open={barcodeOpen}
|
|
onClose={() => setBarcodeOpen(false)}
|
|
patient={selectedPatient}
|
|
/>
|
|
<LabRxModal
|
|
open={labRxOpen}
|
|
onClose={() => setLabRxOpen(false)}
|
|
patient={selectedPatient}
|
|
/>
|
|
</>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|