source: frontend/src/pages/lab-tests/LabTestList.js@ 6c00695

Last change on this file since 6c00695 was 6c00695, checked in by MBK <marija.karapandzova@…>, 4 months ago

Add endpoint for lab technitians to view submitted tests and implement filters

  • Property mode set to 100644
File size: 31.5 KB
Line 
1import React, { useState, useEffect } from 'react';
2import { patientService } from '../../services/patientService';
3import { labService } from '../../services/labService';
4import ErrorAlert from '../../components/ErrorAlert';
5
6function LabTestList() {
7 const user = JSON.parse(localStorage.getItem('user') || '{}');
8 const isLabTechnician = user.role === 'LAB_TECHNICIAN';
9
10 const [patient, setPatient] = useState(null);
11 const [embg, setEmbg] = useState('');
12 const [searched, setSearched] = useState(false);
13 const [loading, setLoading] = useState(false);
14 const [error, setError] = useState(null);
15
16 const [availableTests, setAvailableTests] = useState([]);
17 const [labTestRequests, setLabTestRequests] = useState([]);
18 const [labResults, setLabResults] = useState([]);
19 const [pendingTests, setPendingTests] = useState([]);
20 const [submittedTests, setSubmittedTests] = useState([]);
21 const [selectedTest, setSelectedTest] = useState(null);
22
23 const [showRequestForm, setShowRequestForm] = useState(false);
24 const [requestData, setRequestData] = useState({
25 testId: '',
26 testDate: new Date().toISOString().split('T')[0],
27 notes: '',
28 });
29
30 const [submitFormData, setSubmitFormData] = useState({
31 results: '',
32 resultDate: new Date().toISOString().split('T')[0],
33 });
34
35 // Filter states for pending tests
36 const [pendingFilters, setPendingFilters] = useState({
37 testName: '',
38 patientName: '',
39 testDate: '',
40 });
41
42 // Filter states for submitted tests
43 const [submittedFilters, setSubmittedFilters] = useState({
44 testName: '',
45 patientName: '',
46 testDate: '',
47 });
48
49 useEffect(() => {
50 if (isLabTechnician) {
51 loadLabTestsData();
52 }
53 }, [isLabTechnician]);
54
55 const loadLabTestsData = async () => {
56 try {
57 setLoading(true);
58 setError(null);
59
60 // Load pending tests
61 const pendingRes = await labService.getPendingLabTests();
62 setPendingTests(pendingRes.data || []);
63
64 // Try to load submitted tests, but don't fail if this endpoint doesn't exist
65 try {
66 const submittedRes = await labService.getAllSubmittedLabResults();
67 setSubmittedTests(submittedRes.data || []);
68 } catch (err) {
69 console.warn('Could not load submitted tests:', err);
70 setSubmittedTests([]);
71 }
72 } catch (err) {
73 setError('Failed to load pending lab tests');
74 setPendingTests([]);
75 } finally {
76 setLoading(false);
77 }
78 };
79
80 const handleSearch = async (e) => {
81 e.preventDefault();
82 setError(null);
83 setLoading(true);
84
85 try {
86 if (!embg.trim()) {
87 setError('Please enter an EMBG');
88 setLoading(false);
89 return;
90 }
91
92 const patientResponse = await patientService.getPatientByEmbg(embg);
93 setPatient(patientResponse.data);
94 setSearched(true);
95
96 // Fetch available tests
97 const testsResponse = await labService.getAllLabTests();
98 setAvailableTests(testsResponse.data);
99
100 // Fetch medical record for patient
101 const { medicalRecordService } = await import('../../services/medicalRecordService');
102 const medicalRecordRes = await medicalRecordService.getMedicalRecordByPatientId(patientResponse.data.patientId);
103
104 // Fetch existing test requests for patient
105 const requestsResponse = await labService.getLabTestRequestsForPatient(patientResponse.data.patientId);
106 setLabTestRequests(requestsResponse.data);
107
108 // Fetch lab results for medical record
109 const resultsResponse = await labService.getLabResultsForMedicalRecord(medicalRecordRes.data.recordId);
110 setLabResults(resultsResponse.data);
111 } catch (err) {
112 setError(`Patient with EMBG ${embg} not found`);
113 setPatient(null);
114 } finally {
115 setLoading(false);
116 }
117 };
118
119 const handleRequestTest = async (e) => {
120 e.preventDefault();
121 setError(null);
122
123 if (!requestData.testId) {
124 setError('Please select a test');
125 return;
126 }
127
128 if (!patient) {
129 setError('Patient not found');
130 return;
131 }
132
133 try {
134 setLoading(true);
135
136 // Get doctor ID from localStorage (set during login)
137 const doctorId = localStorage.getItem('doctorId') || 1;
138
139 const request = {
140 patientId: patient.patientId,
141 medicalRecordId: patient.patientId, // Assuming medical record ID matches patient ID
142 doctorId: parseInt(doctorId),
143 testId: parseInt(requestData.testId),
144 testDate: requestData.testDate,
145 notes: requestData.notes,
146 };
147
148 await labService.requestLabTest(request);
149
150 // Refresh the test requests
151 const requestsResponse = await labService.getLabTestRequestsForPatient(patient.patientId);
152 setLabTestRequests(requestsResponse.data);
153
154 // Reset form
155 setRequestData({
156 testId: '',
157 testDate: new Date().toISOString().split('T')[0],
158 notes: '',
159 });
160 setShowRequestForm(false);
161 setError(null);
162 } catch (err) {
163 setError('Failed to request lab test: ' + err.response?.data?.error || err.message);
164 } finally {
165 setLoading(false);
166 }
167 };
168
169 const handleSubmitResult = async (e) => {
170 e.preventDefault();
171 setError(null);
172
173 if (!submitFormData.results.trim()) {
174 setError('Please enter test results');
175 return;
176 }
177
178 if (!selectedTest) {
179 setError('No test selected');
180 return;
181 }
182
183 try {
184 setLoading(true);
185
186 const { medicalRecordService } = await import('../../services/medicalRecordService');
187 const medicalRecordRes = await medicalRecordService.getMedicalRecordByPatientId(selectedTest.patientId);
188
189 const resultData = {
190 medicalRecordId: medicalRecordRes.data.recordId,
191 testId: selectedTest.testId,
192 results: submitFormData.results,
193 resultDate: submitFormData.resultDate,
194 };
195
196 await labService.submitLabResult(resultData);
197
198 // Refresh pending tests
199 await loadLabTestsData();
200
201 // Reset form
202 setSelectedTest(null);
203 setSubmitFormData({
204 results: '',
205 resultDate: new Date().toISOString().split('T')[0],
206 });
207
208 // Show success message
209 setError(null);
210 alert('Lab result submitted successfully!');
211
212 // Refresh the lab tests data
213 await loadLabTestsData();
214
215 // Reset form
216 setSelectedTest(null);
217 setSubmitFormData({
218 results: '',
219 resultDate: new Date().toISOString().split('T')[0],
220 });
221 } catch (err) {
222 setError('Failed to submit lab result: ' + (err.response?.data?.error || err.message));
223 } finally {
224 setLoading(false);
225 }
226 };
227
228 if (isLabTechnician) {
229 return (
230 <div>
231 <h1 className="text-3xl font-bold mb-6" style={{ color: '#7c3aed' }}>Lab Tests - Submit Results</h1>
232
233 {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
234
235 {selectedTest ? (
236 // Submit Result Form
237 <div className="bg-white rounded-lg shadow p-6 mb-6">
238 <h2 className="text-xl font-bold mb-4">Submit Lab Result</h2>
239 <div className="mb-4 p-4 bg-gray-50 rounded-lg">
240 <p className="mb-2"><strong>Test:</strong> {selectedTest.testName}</p>
241 <p className="mb-2"><strong>Patient:</strong> {selectedTest.patientName}</p>
242 <p className="mb-2"><strong>Doctor:</strong> {selectedTest.doctorName}</p>
243 <p className="mb-2"><strong>Test Date:</strong> {selectedTest.testDate}</p>
244 {selectedTest.notes && <p><strong>Notes:</strong> {selectedTest.notes}</p>}
245 </div>
246
247 <form onSubmit={handleSubmitResult} className="space-y-4">
248 <div>
249 <label className="block text-sm font-semibold mb-2">Test Results *</label>
250 <textarea
251 value={submitFormData.results}
252 onChange={(e) => setSubmitFormData({ ...submitFormData, results: e.target.value })}
253 placeholder="Enter detailed test results"
254 className="w-full px-4 py-2 border rounded-lg"
255 rows="4"
256 required
257 />
258 </div>
259
260 <div>
261 <label className="block text-sm font-semibold mb-2">Result Date *</label>
262 <input
263 type="date"
264 value={submitFormData.resultDate}
265 onChange={(e) => setSubmitFormData({ ...submitFormData, resultDate: e.target.value })}
266 className="w-full px-4 py-2 border rounded-lg"
267 required
268 />
269 </div>
270
271 <div className="flex gap-4">
272 <button
273 type="submit"
274 disabled={loading}
275 style={{
276 background: loading ? '#d1d5db' : '#bfdbfe',
277 color: '#1e1035',
278 padding: '8px 24px',
279 borderRadius: '6px',
280 border: 'none',
281 cursor: loading ? 'not-allowed' : 'pointer',
282 fontSize: '14px',
283 fontWeight: '400'
284 }}
285 onMouseEnter={(e) => !loading && (e.currentTarget.style.background = '#93c5fd')}
286 onMouseLeave={(e) => !loading && (e.currentTarget.style.background = '#bfdbfe')}
287 >
288 {loading ? 'Submitting...' : 'Submit Result'}
289 </button>
290 <button
291 type="button"
292 onClick={() => {
293 setSelectedTest(null);
294 setSubmitFormData({
295 results: '',
296 resultDate: new Date().toISOString().split('T')[0],
297 });
298 }}
299 className="bg-gray-400 text-white px-6 py-2 rounded hover:bg-gray-500"
300 >
301 Cancel
302 </button>
303 </div>
304 </form>
305 </div>
306 ) : (
307 // Pending Tests List
308 <div className="bg-white rounded-lg shadow overflow-hidden">
309 <div className="p-6 border-b">
310 <h2 className="text-xl font-bold">Pending Lab Tests ({pendingTests.length})</h2>
311 </div>
312
313 {pendingTests.length === 0 ? (
314 <div className="p-6 text-center text-gray-600">
315 No pending lab tests
316 </div>
317 ) : (
318 <>
319 {/* Filters */}
320 <div className="p-6 border-b bg-gray-50">
321 <h3 className="text-sm font-semibold mb-4">Filters</h3>
322 <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
323 <div>
324 <label className="block text-sm font-semibold mb-2">Test</label>
325 <input
326 type="text"
327 placeholder="Filter by test name..."
328 value={pendingFilters.testName}
329 onChange={(e) => setPendingFilters({...pendingFilters, testName: e.target.value})}
330 className="w-full px-3 py-2 border rounded-lg text-sm"
331 />
332 </div>
333 <div>
334 <label className="block text-sm font-semibold mb-2">Patient</label>
335 <input
336 type="text"
337 placeholder="Filter by patient name..."
338 value={pendingFilters.patientName}
339 onChange={(e) => setPendingFilters({...pendingFilters, patientName: e.target.value})}
340 className="w-full px-3 py-2 border rounded-lg text-sm"
341 />
342 </div>
343 <div>
344 <label className="block text-sm font-semibold mb-2">Test Date</label>
345 <input
346 type="date"
347 value={pendingFilters.testDate}
348 onChange={(e) => setPendingFilters({...pendingFilters, testDate: e.target.value})}
349 className="w-full px-3 py-2 border rounded-lg text-sm"
350 />
351 </div>
352 </div>
353 <button
354 onClick={() => setPendingFilters({testName: '', patientName: '', testDate: ''})}
355 className="mt-4 bg-gray-300 text-gray-700 px-4 py-2 rounded text-sm hover:bg-gray-400"
356 >
357 Clear Filters
358 </button>
359 </div>
360
361 {/* Filtered Table */}
362 <table className="w-full">
363 <thead className="bg-gray-100">
364 <tr>
365 <th className="px-6 py-3 text-left text-sm font-semibold">Test</th>
366 <th className="px-6 py-3 text-left text-sm font-semibold">Patient</th>
367 <th className="px-6 py-3 text-left text-sm font-semibold">Doctor</th>
368 <th className="px-6 py-3 text-left text-sm font-semibold">Requested</th>
369 <th className="px-6 py-3 text-left text-sm font-semibold">Test Date</th>
370 <th className="px-6 py-3 text-left text-sm font-semibold">Notes</th>
371 <th className="px-6 py-3 text-left text-sm font-semibold">Action</th>
372 </tr>
373 </thead>
374 <tbody>
375 {pendingTests
376 .filter((test) => {
377 const testName = (test.testName || '').toLowerCase();
378 const patientName = (test.patientName || '').toLowerCase();
379 const testDate = (test.testDate || '');
380
381 return (
382 testName.includes(pendingFilters.testName.toLowerCase()) &&
383 patientName.includes(pendingFilters.patientName.toLowerCase()) &&
384 (pendingFilters.testDate === '' || testDate === pendingFilters.testDate)
385 );
386 })
387 .map((test, index) => (
388 <tr key={index} className="border-t hover:bg-gray-50">
389 <td className="px-6 py-3 font-medium">{test.testName}</td>
390 <td className="px-6 py-3">{test.patientName}</td>
391 <td className="px-6 py-3">{test.doctorName}</td>
392 <td className="px-6 py-3 text-green-600">{test.requestDate}</td>
393 <td className="px-6 py-3 text-purple-600">{test.testDate}</td>
394 <td className="px-6 py-3 text-gray-600 text-sm">{test.notes || '-'}</td>
395 <td className="px-6 py-3">
396 <button
397 onClick={() => setSelectedTest(test)}
398 style={{
399 background: '#bfdbfe',
400 color: '#1e1035',
401 padding: '6px 12px',
402 borderRadius: '4px',
403 border: 'none',
404 cursor: 'pointer',
405 fontSize: '12px',
406 fontWeight: '400'
407 }}
408 onMouseEnter={(e) => e.currentTarget.style.background = '#93c5fd'}
409 onMouseLeave={(e) => e.currentTarget.style.background = '#bfdbfe'}
410 >
411 Submit Result
412 </button>
413 </td>
414 </tr>
415 ))}
416 </tbody>
417 </table>
418 </>
419 )}
420 </div>
421 )}
422
423 {/* Submitted Tests History */}
424 {!selectedTest && (
425 <div className="bg-white rounded-lg shadow overflow-hidden mt-6">
426 <div className="p-6 border-b">
427 <h2 className="text-xl font-bold">Submitted Lab Results History ({submittedTests.length})</h2>
428 </div>
429
430 {submittedTests.length === 0 ? (
431 <div className="p-6 text-center text-gray-600">
432 No submitted lab results yet
433 </div>
434 ) : (
435 <>
436 {/* Filters */}
437 <div className="p-6 border-b bg-gray-50">
438 <h3 className="text-sm font-semibold mb-4">Filters</h3>
439 <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
440 <div>
441 <label className="block text-sm font-semibold mb-2">Test</label>
442 <input
443 type="text"
444 placeholder="Filter by test name..."
445 value={submittedFilters.testName}
446 onChange={(e) => setSubmittedFilters({...submittedFilters, testName: e.target.value})}
447 className="w-full px-3 py-2 border rounded-lg text-sm"
448 />
449 </div>
450 <div>
451 <label className="block text-sm font-semibold mb-2">Patient</label>
452 <input
453 type="text"
454 placeholder="Filter by patient name..."
455 value={submittedFilters.patientName}
456 onChange={(e) => setSubmittedFilters({...submittedFilters, patientName: e.target.value})}
457 className="w-full px-3 py-2 border rounded-lg text-sm"
458 />
459 </div>
460 <div>
461 <label className="block text-sm font-semibold mb-2">Test Date</label>
462 <input
463 type="date"
464 value={submittedFilters.testDate}
465 onChange={(e) => setSubmittedFilters({...submittedFilters, testDate: e.target.value})}
466 className="w-full px-3 py-2 border rounded-lg text-sm"
467 />
468 </div>
469 </div>
470 <button
471 onClick={() => setSubmittedFilters({testName: '', patientName: '', testDate: ''})}
472 className="mt-4 bg-gray-300 text-gray-700 px-4 py-2 rounded text-sm hover:bg-gray-400"
473 >
474 Clear Filters
475 </button>
476 </div>
477
478 {/* Filtered Results Table */}
479 <table className="w-full">
480 <thead className="bg-gray-100">
481 <tr>
482 <th className="px-6 py-3 text-left text-sm font-semibold">Test</th>
483 <th className="px-6 py-3 text-left text-sm font-semibold">Patient</th>
484 <th className="px-6 py-3 text-left text-sm font-semibold">Test Date</th>
485 <th className="px-6 py-3 text-left text-sm font-semibold">Result Date</th>
486 <th className="px-6 py-3 text-left text-sm font-semibold">Status</th>
487 </tr>
488 </thead>
489 <tbody>
490 {submittedTests
491 .filter((test) => {
492 const testName = (test.testName || '').toLowerCase();
493 const patientName = (test.patientName || '').toLowerCase();
494 const testDate = (test.testDate || '');
495
496 return (
497 testName.includes(submittedFilters.testName.toLowerCase()) &&
498 patientName.includes(submittedFilters.patientName.toLowerCase()) &&
499 (submittedFilters.testDate === '' || testDate === submittedFilters.testDate)
500 );
501 })
502 .map((test, index) => (
503 <tr key={index} className="border-t hover:bg-gray-50">
504 <td className="px-6 py-3 font-medium">{test.testName || test.description || 'Lab Test'}</td>
505 <td className="px-6 py-3">{test.patientName || 'N/A'}</td>
506 <td className="px-6 py-3">{test.testDate || 'N/A'}</td>
507 <td className="px-6 py-3 text-green-600">{test.resultDate || test.createdDate || 'N/A'}</td>
508 <td className="px-6 py-3">
509 <span className="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm font-semibold">
510 Submitted
511 </span>
512 </td>
513 </tr>
514 ))}
515 </tbody>
516 </table>
517 </>
518 )}
519 </div>
520 )}
521 </div>
522 );
523 }
524
525 return (
526 <div>
527 <h1 className="text-3xl font-bold mb-6" style={{ color: '#7c3aed' }}>Lab Tests</h1>
528
529 {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
530
531 {/* Search Form */}
532 <div className="bg-white rounded-lg shadow p-6 mb-6">
533 <h2 className="text-xl font-bold mb-4">Search Patient</h2>
534 <form onSubmit={handleSearch} className="space-y-4">
535 <div className="flex gap-4">
536 <div className="flex-1">
537 <label className="block text-sm font-semibold mb-2">Patient EMBG</label>
538 <input
539 type="text"
540 value={embg}
541 onChange={(e) => setEmbg(e.target.value)}
542 placeholder="e.g., 1402994123456"
543 className="w-full px-4 py-2 border rounded-lg"
544 />
545 </div>
546 <div className="flex items-end">
547 <button
548 type="submit"
549 disabled={loading}
550 className="bg-purple-600 text-white px-8 py-2 rounded-full hover:bg-purple-700 disabled:bg-gray-400"
551 >
552 {loading ? 'Searching...' : 'Search'}
553 </button>
554 </div>
555 </div>
556 </form>
557 </div>
558
559 {/* Patient Lab Tests */}
560 {searched && patient && (
561 <div className="space-y-6">
562 {/* Patient Info */}
563 <div className="bg-white rounded-lg shadow p-6">
564 <div className="flex justify-between items-start mb-4">
565 <h2 className="text-2xl font-bold">{patient.firstName} {patient.lastName}</h2>
566 {!showRequestForm && (
567 <button
568 onClick={() => setShowRequestForm(true)}
569 className="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700"
570 >
571 Request Lab Test
572 </button>
573 )}
574 </div>
575 <div className="grid grid-cols-4 gap-4">
576 <div>
577 <p className="text-sm text-gray-600">EMBG</p>
578 <p className="font-semibold">{patient.embg}</p>
579 </div>
580 <div>
581 <p className="text-sm text-gray-600">Blood Type</p>
582 <p className="font-semibold">{patient.bloodType || 'N/A'}</p>
583 </div>
584 <div>
585 <p className="text-sm text-gray-600">Date of Birth</p>
586 <p className="font-semibold">{patient.dateOfBirth}</p>
587 </div>
588 </div>
589 </div>
590
591 {/* Request Lab Test Form */}
592 {showRequestForm && (
593 <div className="bg-white rounded-lg shadow p-6">
594 <h3 className="text-xl font-bold mb-4">Request Lab Test</h3>
595 <form onSubmit={handleRequestTest} className="space-y-4">
596 <div className="grid grid-cols-2 gap-4">
597 <div>
598 <label className="block text-sm font-semibold mb-2">Test</label>
599 <select
600 value={requestData.testId}
601 onChange={(e) => setRequestData({ ...requestData, testId: e.target.value })}
602 className="w-full px-4 py-2 border rounded-lg"
603 required
604 >
605 <option value="">Select a test</option>
606 {availableTests.map((test) => (
607 <option key={test.testId} value={test.testId}>
608 {test.testName} (${test.cost})
609 </option>
610 ))}
611 </select>
612 </div>
613 <div>
614 <label className="block text-sm font-semibold mb-2">Test Date</label>
615 <input
616 type="date"
617 value={requestData.testDate}
618 onChange={(e) => setRequestData({ ...requestData, testDate: e.target.value })}
619 className="w-full px-4 py-2 border rounded-lg"
620 />
621 </div>
622 </div>
623 <div>
624 <label className="block text-sm font-semibold mb-2">Notes</label>
625 <textarea
626 value={requestData.notes}
627 onChange={(e) => setRequestData({ ...requestData, notes: e.target.value })}
628 placeholder="Additional notes for the lab technician"
629 className="w-full px-4 py-2 border rounded-lg"
630 rows="3"
631 />
632 </div>
633 <div className="flex gap-4">
634 <button
635 type="submit"
636 disabled={loading}
637 className="bg-green-600 text-white px-6 py-2 rounded hover:bg-green-700 disabled:bg-gray-400"
638 >
639 {loading ? 'Requesting...' : 'Request Test'}
640 </button>
641 <button
642 type="button"
643 onClick={() => setShowRequestForm(false)}
644 className="bg-gray-400 text-white px-6 py-2 rounded hover:bg-gray-500"
645 >
646 Cancel
647 </button>
648 </div>
649 </form>
650 </div>
651 )}
652
653 {/* Test Requests */}
654 {labTestRequests && labTestRequests.length > 0 && (
655 <div className="bg-white rounded-lg shadow p-6">
656 <h3 className="text-xl font-bold mb-4">Lab Test Requests</h3>
657 <div className="space-y-3">
658 {labTestRequests.map((request) => (
659 <div key={request.testId} className="border-l-4 border-purple-500 pl-4 py-2">
660 <p className="font-semibold text-lg">{request.testName}</p>
661 <p className="text-sm text-gray-600">Requested by: {request.doctorName}</p>
662 <p className="text-sm text-gray-600">Test Date: {request.requestDate}</p>
663 {request.notes && (
664 <p className="text-sm text-gray-600">Notes: {request.notes}</p>
665 )}
666 </div>
667 ))}
668 </div>
669 </div>
670 )}
671
672 {/* Lab Test Results */}
673 {labResults && labResults.length > 0 && (
674 <div className="bg-white rounded-lg shadow p-6">
675 <h3 className="text-xl font-bold mb-4">Lab Test Results</h3>
676 <div className="space-y-4">
677 {labResults.map((result) => (
678 <div key={result.resultId} className="border-l-4 border-green-500 pl-4 py-3 bg-green-50 rounded">
679 <p className="font-semibold text-lg text-green-700">{result.testName}</p>
680 <p className="text-sm text-gray-700 mt-2"><strong>Results:</strong> {result.results}</p>
681 <p className="text-sm text-gray-600">Result Date: {result.resultDate}</p>
682 </div>
683 ))}
684 </div>
685 </div>
686 )}
687
688 {/* Link to submit results */}
689 {labTestRequests && labTestRequests.length > 0 && (
690 <div className="bg-yellow-50 rounded-lg p-6">
691 <h3 className="text-lg font-semibold text-yellow-800 mb-3">Lab Technician: Submit Test Results</h3>
692 <p className="text-sm text-gray-700 mb-4">
693 {labTestRequests.length} test{labTestRequests.length !== 1 ? 's' : ''} awaiting results
694 </p>
695 <a
696 href="/lab-tests/results"
697 className="inline-block bg-yellow-600 text-white px-6 py-2 rounded hover:bg-yellow-700"
698 >
699 Submit Lab Results
700 </a>
701 </div>
702 )}
703
704 {/* No requests message */}
705 {!labTestRequests || labTestRequests.length === 0 && !labResults?.length && (
706 <div className="bg-blue-50 rounded-lg p-6 text-center">
707 <p className="text-gray-600">No lab test requests for this patient</p>
708 </div>
709 )}
710 </div>
711 )}
712
713 {/* No search performed */}
714 {!searched && (
715 <div className="bg-gray-50 rounded-lg p-12 text-center">
716 <p className="text-gray-600 text-lg">Enter a patient EMBG to request lab tests</p>
717 </div>
718 )}
719 </div>
720 );
721}
722
723export default LabTestList;
Note: See TracBrowser for help on using the repository browser.