Spaces:
Running
Running
File size: 8,181 Bytes
ea5a464 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | "use client"
import { useState, useEffect } from "react"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Button } from "@/components/ui/button"
import { RichTextEditor } from "./rich-text-editor"
import { FormNavigation } from "./form-navigation"
import { User, Activity, ClipboardList, Heart, FileText } from "lucide-react"
export function ProgressNotesForm() {
const [activeSection, setActiveSection] = useState("basic-info")
const [formData, setFormData] = useState({
basicInfo: "",
vitals: "",
assessment: "",
plan: "",
notes: "",
})
const sections = [
{ id: "basic-info", label: "Basic Info", icon: <User className="w-4 h-4" /> },
{ id: "vitals", label: "Vitals", icon: <Activity className="w-4 h-4" /> },
{ id: "assessment", label: "Assessment", icon: <ClipboardList className="w-4 h-4" /> },
{ id: "plan", label: "Plan", icon: <Heart className="w-4 h-4" /> },
{ id: "notes", label: "Notes", icon: <FileText className="w-4 h-4" /> },
]
useEffect(() => {
const handleScroll = () => {
const sectionElements = sections.map((section) => ({
id: section.id,
element: document.getElementById(section.id),
}))
const currentSection = sectionElements.find(({ element }) => {
if (!element) return false
const rect = element.getBoundingClientRect()
return rect.top <= 100 && rect.bottom >= 100
})
if (currentSection) {
setActiveSection(currentSection.id)
}
}
window.addEventListener("scroll", handleScroll)
return () => window.removeEventListener("scroll", handleScroll)
}, [])
const updateFormData = (field: string, value: string) => {
setFormData((prev) => ({ ...prev, [field]: value }))
}
return (
<div className="relative">
<FormNavigation sections={sections} activeSection={activeSection} onSectionChange={setActiveSection} />
<div className="max-w-4xl mx-auto space-y-6 pl-0 md:pl-16">
{/* Basic Info Section */}
<Card id="basic-info" className="scroll-mt-20">
<CardHeader className="bg-blue-50 border-b">
<CardTitle className="flex items-center gap-2 text-blue-800">
<User className="w-5 h-5" />
Basic Information
</CardTitle>
</CardHeader>
<CardContent className="p-6 space-y-4">
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<Label htmlFor="date">Date</Label>
<Input id="date" type="date" />
</div>
<div>
<Label htmlFor="time">Time</Label>
<Input id="time" type="time" />
</div>
<div>
<Label htmlFor="day-post-op">Day Post-Op</Label>
<Input id="day-post-op" placeholder="e.g., POD #3" />
</div>
</div>
<div>
<Label htmlFor="subjective">Subjective (Patient's Complaints)</Label>
<RichTextEditor
value={formData.basicInfo}
onChange={(value) => updateFormData("basicInfo", value)}
placeholder="Patient's subjective complaints and symptoms..."
fieldType="chief-complaints"
showAutofill={true}
autofillSource="Patient Interview"
autofillTimestamp="2024-01-15, 10:30 AM"
/>
</div>
</CardContent>
</Card>
{/* Vitals Section */}
<Card id="vitals" className="scroll-mt-20">
<CardHeader className="bg-green-50 border-b">
<CardTitle className="flex items-center gap-2 text-green-800">
<Activity className="w-5 h-5" />
Vital Signs & Objective Findings
</CardTitle>
</CardHeader>
<CardContent className="p-6 space-y-4">
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
<div>
<Label htmlFor="bp">Blood Pressure</Label>
<Input id="bp" placeholder="120/80" />
</div>
<div>
<Label htmlFor="pulse">Pulse</Label>
<Input id="pulse" placeholder="72 bpm" />
</div>
<div>
<Label htmlFor="temp">Temperature</Label>
<Input id="temp" placeholder="98.6°F" />
</div>
<div>
<Label htmlFor="resp">Respiratory Rate</Label>
<Input id="resp" placeholder="16/min" />
</div>
</div>
<div>
<Label htmlFor="objective">Objective Findings</Label>
<RichTextEditor
value={formData.vitals}
onChange={(value) => updateFormData("vitals", value)}
placeholder="Physical examination findings, lab results, imaging..."
fieldType="assessment"
rows={5}
showAutofill={true}
autofillSource="Nursing Station"
autofillTimestamp="2024-01-15, 11:00 AM"
/>
</div>
</CardContent>
</Card>
{/* Assessment Section */}
<Card id="assessment" className="scroll-mt-20">
<CardHeader className="bg-red-50 border-b">
<CardTitle className="flex items-center gap-2 text-red-800">
<ClipboardList className="w-5 h-5" />
Assessment
</CardTitle>
</CardHeader>
<CardContent className="p-6 space-y-4">
<div>
<Label htmlFor="clinical-assessment">Clinical Assessment</Label>
<RichTextEditor
value={formData.assessment}
onChange={(value) => updateFormData("assessment", value)}
placeholder="Current clinical status, progress, complications..."
fieldType="assessment"
rows={6}
/>
</div>
</CardContent>
</Card>
{/* Plan Section */}
<Card id="plan" className="scroll-mt-20">
<CardHeader className="bg-indigo-50 border-b">
<CardTitle className="flex items-center gap-2 text-indigo-800">
<Heart className="w-5 h-5" />
Plan
</CardTitle>
</CardHeader>
<CardContent className="p-6 space-y-4">
<div>
<Label htmlFor="treatment-plan">Treatment Plan</Label>
<RichTextEditor
value={formData.plan}
onChange={(value) => updateFormData("plan", value)}
placeholder="Treatment modifications, new orders, discharge planning..."
fieldType="plan"
rows={6}
/>
</div>
</CardContent>
</Card>
{/* Additional Notes Section */}
<Card id="notes" className="scroll-mt-20">
<CardHeader className="bg-gray-50 border-b">
<CardTitle className="flex items-center gap-2 text-gray-800">
<FileText className="w-5 h-5" />
Additional Notes
</CardTitle>
</CardHeader>
<CardContent className="p-6 space-y-4">
<div>
<Label htmlFor="additional-notes">Additional Notes</Label>
<RichTextEditor
value={formData.notes}
onChange={(value) => updateFormData("notes", value)}
placeholder="Any additional observations, communications, or instructions..."
fieldType="general"
rows={4}
/>
</div>
</CardContent>
</Card>
{/* Form Actions */}
<div className="flex justify-end gap-4 py-6">
<Button variant="outline">Save Draft</Button>
<Button variant="outline">Print</Button>
<Button>Submit Progress Note</Button>
</div>
</div>
</div>
)
}
|