{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\User\\\\Downloads\\\\medora5\\\\frontend\\\\src\\\\pages\\\\patients\\\\PatientDetail.js\",\n _s = $RefreshSig$();\nimport React, { useState, useEffect } from 'react';\nimport { useParams, Link, useNavigate } from 'react-router-dom';\nimport { patientService } from '../../services/patientService';\nimport Loading from '../../components/Loading';\nimport ErrorAlert from '../../components/ErrorAlert';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nfunction PatientDetail() {\n _s();\n const user = JSON.parse(localStorage.getItem('user') || '{}');\n const isAdmin = user.role === 'ADMIN';\n const isLabTechnician = user.role === 'LAB_TECHNICIAN';\n const {\n id\n } = useParams();\n const navigate = useNavigate();\n const [patient, setPatient] = useState(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(null);\n useEffect(() => {\n const fetchPatient = async () => {\n try {\n setLoading(true);\n const response = await patientService.getPatientById(id);\n setPatient(response.data);\n } catch (err) {\n setError('Failed to fetch patient details');\n console.error(err);\n } finally {\n setLoading(false);\n }\n };\n fetchPatient();\n }, [id]);\n if (loading) return /*#__PURE__*/_jsxDEV(Loading, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 23\n }, this);\n if (!patient) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: /*#__PURE__*/_jsxDEV(ErrorAlert, {\n message: \"Patient not found\",\n onClose: () => navigate('/patients')\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 39,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 38,\n columnNumber: 7\n }, this);\n }\n return /*#__PURE__*/_jsxDEV(\"div\", {\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"flex justify-between items-center mb-6\",\n children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n className: \"text-3xl font-bold\",\n style: {\n color: '#7c3aed'\n },\n children: [patient.firstName, \" \", patient.lastName]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 47,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"space-x-2\",\n children: [isAdmin && /*#__PURE__*/_jsxDEV(Link, {\n to: `/patients/${id}/edit`,\n className: \"bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700\",\n children: \"Edit\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n onClick: () => navigate('/patients'),\n className: \"bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400\",\n children: \"Back\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 48,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 46,\n columnNumber: 7\n }, this), error && /*#__PURE__*/_jsxDEV(ErrorAlert, {\n message: error,\n onClose: () => setError(null)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"grid grid-cols-1 md:grid-cols-2 gap-6\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"bg-white rounded-lg shadow p-6\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"text-xl font-bold mb-4\",\n children: \"Personal Information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"space-y-3\",\n children: [/*#__PURE__*/_jsxDEV(InfoRow, {\n label: \"EMBG\",\n value: patient.embg\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 66,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(InfoRow, {\n label: \"Email\",\n value: patient.emailAddress\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 67,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(InfoRow, {\n label: \"Phone\",\n value: patient.phoneNumber\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 68,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(InfoRow, {\n label: \"Date of Birth\",\n value: patient.dateOfBirth\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 69,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(InfoRow, {\n label: \"Gender\",\n value: patient.gender\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 70,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(InfoRow, {\n label: \"Blood Type\",\n value: patient.bloodType\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 65,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 9\n }, this), !isLabTechnician && /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"bg-white rounded-lg shadow p-6\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"text-xl font-bold mb-4\",\n children: \"Quick Links\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 77,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"space-y-2\",\n children: [/*#__PURE__*/_jsxDEV(Link, {\n to: `/appointments?patientId=${id}`,\n className: \"block p-3 bg-blue-50 hover:bg-purple-100 rounded text-purple-600\",\n children: \"View Appointments\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 79,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(Link, {\n to: `/medical-records?patientId=${id}`,\n className: \"block p-3 bg-green-50 hover:bg-green-100 rounded text-green-600\",\n children: \"View Medical Records\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 82,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(Link, {\n to: `/billing?patientId=${id}`,\n className: \"block p-3 bg-purple-50 hover:bg-purple-100 rounded text-purple-600\",\n children: \"View Billing History\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 5\n }, this);\n}\n_s(PatientDetail, \"AX1v2hOUTs6JLVigprMFXK1YTiE=\", false, function () {\n return [useParams, useNavigate];\n});\n_c = PatientDetail;\nfunction InfoRow({\n label,\n value\n}) {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"flex justify-between\",\n children: [/*#__PURE__*/_jsxDEV(\"span\", {\n className: \"font-semibold text-gray-600\",\n children: [label, \":\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"span\", {\n className: \"text-gray-800\",\n children: value || 'N/A'\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 5\n }, this);\n}\n_c2 = InfoRow;\nexport default PatientDetail;\nvar _c, _c2;\n$RefreshReg$(_c, \"PatientDetail\");\n$RefreshReg$(_c2, \"InfoRow\");","map":{"version":3,"names":["React","useState","useEffect","useParams","Link","useNavigate","patientService","Loading","ErrorAlert","jsxDEV","_jsxDEV","PatientDetail","_s","user","JSON","parse","localStorage","getItem","isAdmin","role","isLabTechnician","id","navigate","patient","setPatient","loading","setLoading","error","setError","fetchPatient","response","getPatientById","data","err","console","fileName","_jsxFileName","lineNumber","columnNumber","children","message","onClose","className","style","color","firstName","lastName","to","onClick","InfoRow","label","value","embg","emailAddress","phoneNumber","dateOfBirth","gender","bloodType","_c","_c2","$RefreshReg$"],"sources":["C:/Users/User/Downloads/medora5/frontend/src/pages/patients/PatientDetail.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { useParams, Link, useNavigate } from 'react-router-dom';\nimport { patientService } from '../../services/patientService';\nimport Loading from '../../components/Loading';\nimport ErrorAlert from '../../components/ErrorAlert';\n\nfunction PatientDetail() {\n const user = JSON.parse(localStorage.getItem('user') || '{}');\n const isAdmin = user.role === 'ADMIN';\n const isLabTechnician = user.role === 'LAB_TECHNICIAN';\n const { id } = useParams();\n const navigate = useNavigate();\n const [patient, setPatient] = useState(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState(null);\n\n useEffect(() => {\n const fetchPatient = async () => {\n try {\n setLoading(true);\n const response = await patientService.getPatientById(id);\n setPatient(response.data);\n } catch (err) {\n setError('Failed to fetch patient details');\n console.error(err);\n } finally {\n setLoading(false);\n }\n };\n\n fetchPatient();\n }, [id]);\n\n if (loading) return