diff --git a/apps/Frontend/src/components/chart/lab-management-tab.jsx b/apps/Frontend/src/components/chart/lab-management-tab.jsx index 160f69e6..fc26442d 100644 --- a/apps/Frontend/src/components/chart/lab-management-tab.jsx +++ b/apps/Frontend/src/components/chart/lab-management-tab.jsx @@ -1,258 +1,81 @@ import { useState } from "react"; import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { Textarea } from "@/components/ui/textarea"; -import { Badge } from "@/components/ui/badge"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; -import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; -import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, } from "@/components/ui/dialog"; -import { Plus, Pencil, Trash2, Package } from "lucide-react"; -const STATUS_COLORS = { - pending: "bg-yellow-100 text-yellow-700 border-yellow-200", - "in-lab": "bg-blue-100 text-blue-700 border-blue-200", - received: "bg-green-100 text-green-700 border-green-200", - delivered: "bg-gray-100 text-gray-600 border-gray-200", - cancelled: "bg-red-100 text-red-600 border-red-200", -}; -const STATUS_LABELS = { - pending: "Pending", - "in-lab": "In Lab", - received: "Received", - delivered: "Delivered", - cancelled: "Cancelled", -}; -const CASE_TYPES = [ - "Crown – PFM", - "Crown – All Ceramic", - "Crown – Zirconia", - "Crown – Gold", - "Bridge – PFM", - "Bridge – Zirconia", - "Implant Crown", - "Implant Abutment", - "Veneer", - "Inlay / Onlay", - "Full Denture (Upper)", - "Full Denture (Lower)", - "Partial Denture", - "Night Guard", - "Bleaching Tray", - "Retainer", - "Diagnostic Model", - "Other", -]; -const COMMON_LABS = [ - "Dental Arts Lab", - "National Dentex", - "Glidewell Dental", - "Henry Schein Lab", - "Affordable Dentures Lab", - "Local Lab", -]; -const SHADES = [ - "A1", "A2", "A3", "A3.5", "A4", - "B1", "B2", "B3", "B4", - "C1", "C2", "C3", "C4", - "D2", "D3", "D4", - "BL1", "BL2", "BL3", "BL4", - "Custom", -]; -let nextId = 1; -const newOrder = () => ({ - id: nextId++, - orderDate: new Date().toISOString().substring(0, 10), - dueDate: "", - tooth: "", - caseType: "", - lab: "", - shade: "", - status: "pending", - rush: false, - notes: "", - trackingNumber: "", -}); +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"; + export function LabManagementTab() { - const [orders, setOrders] = useState([]); - const [dialogOpen, setDialogOpen] = useState(false); - const [editing, setEditing] = useState(newOrder()); - const openAdd = () => { - setEditing(newOrder()); - setDialogOpen(true); - }; - const openEdit = (order) => { - setEditing({ ...order }); - setDialogOpen(true); - }; - const handleSave = () => { - setOrders((prev) => { - const idx = prev.findIndex((o) => o.id === editing.id); - if (idx >= 0) { - const next = [...prev]; - next[idx] = editing; - return next; - } - return [...prev, editing]; - }); - setDialogOpen(false); - }; - const handleDelete = (id) => { - setOrders((prev) => prev.filter((o) => o.id !== id)); - }; - const pending = orders.filter((o) => o.status === "pending" || o.status === "in-lab").length; - const rush = orders.filter((o) => o.rush && o.status !== "delivered" && o.status !== "cancelled").length; - return (
-
-
- {pending > 0 && Open orders: {pending}} - {rush > 0 && Rush: {rush}} - {orders.length === 0 && No lab orders yet} -
- -
+ const [selectedPatient, setSelectedPatient] = useState(null); + const [barcodeOpen, setBarcodeOpen] = useState(false); + const [labRxOpen, setLabRxOpen] = useState(false); -
- - - - Order Date - Tooth - Case Type - Lab - Shade - Due - Status - Actions - - - - {orders.length === 0 ? ( - -
- - No lab orders yet. Click "New Lab Order" to add one. -
-
-
) : (orders.map((order) => ( - {order.orderDate} - {order.tooth || "—"} - -
- {order.caseType} - {order.rush && ( - RUSH - )} -
- {order.notes && (

{order.notes}

)} -
- {order.lab || "—"} - {order.shade || "—"} - {order.dueDate || "—"} - - - {STATUS_LABELS[order.status]} - - - -
- - -
-
-
)))} -
-
-
- - - - - Lab Order - -
-
- - setEditing((d) => ({ ...d, orderDate: e.target.value }))} className="h-9 text-sm"/> -
-
- - setEditing((d) => ({ ...d, dueDate: e.target.value }))} className="h-9 text-sm"/> -
-
- - setEditing((d) => ({ ...d, tooth: e.target.value }))} className="h-9 text-sm"/> -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - setEditing((d) => ({ ...d, trackingNumber: e.target.value }))} className="h-9 text-sm"/> -
-
- setEditing((d) => ({ ...d, rush: e.target.checked }))} className="h-4 w-4 rounded border-gray-300"/> - -
-
- -