@sasindi/labmanagement 1.0.8 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/529.js +1 -1
- package/dist/529.js.map +1 -1
- package/dist/674.js +1 -0
- package/dist/674.js.map +1 -0
- package/dist/{293.js → 724.js} +1 -1
- package/dist/{293.js.map → 724.js.map} +1 -1
- package/dist/935.js +1 -0
- package/dist/935.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-labmanagement.js.buildmanifest.json +77 -52
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/labtestmaster.component.tsx +355 -0
- package/src/root.component.tsx +3 -0
- package/src/routes.json +0 -5
- package/dist/340.js +0 -1
- package/dist/340.js.map +0 -1
|
@@ -94,32 +94,6 @@
|
|
|
94
94
|
"hash": "f9337b736fcdc74b",
|
|
95
95
|
"childrenByOrder": {}
|
|
96
96
|
},
|
|
97
|
-
{
|
|
98
|
-
"type": "chunk",
|
|
99
|
-
"rendered": true,
|
|
100
|
-
"initial": false,
|
|
101
|
-
"entry": false,
|
|
102
|
-
"size": 32023,
|
|
103
|
-
"sizes": {
|
|
104
|
-
"javascript": 32023
|
|
105
|
-
},
|
|
106
|
-
"names": [],
|
|
107
|
-
"idHints": [
|
|
108
|
-
""
|
|
109
|
-
],
|
|
110
|
-
"runtime": [
|
|
111
|
-
"@sasindi/labmanagement",
|
|
112
|
-
"main"
|
|
113
|
-
],
|
|
114
|
-
"files": [
|
|
115
|
-
"293.js"
|
|
116
|
-
],
|
|
117
|
-
"auxiliaryFiles": [
|
|
118
|
-
"293.js.map"
|
|
119
|
-
],
|
|
120
|
-
"hash": "e37a3390d019bf55",
|
|
121
|
-
"childrenByOrder": {}
|
|
122
|
-
},
|
|
123
97
|
{
|
|
124
98
|
"type": "chunk",
|
|
125
99
|
"rendered": true,
|
|
@@ -167,30 +141,6 @@
|
|
|
167
141
|
"hash": "8827a9640a66d0ab",
|
|
168
142
|
"childrenByOrder": {}
|
|
169
143
|
},
|
|
170
|
-
{
|
|
171
|
-
"type": "chunk",
|
|
172
|
-
"rendered": true,
|
|
173
|
-
"initial": false,
|
|
174
|
-
"entry": false,
|
|
175
|
-
"size": 518,
|
|
176
|
-
"sizes": {
|
|
177
|
-
"javascript": 518
|
|
178
|
-
},
|
|
179
|
-
"names": [],
|
|
180
|
-
"idHints": [],
|
|
181
|
-
"runtime": [
|
|
182
|
-
"@sasindi/labmanagement",
|
|
183
|
-
"main"
|
|
184
|
-
],
|
|
185
|
-
"files": [
|
|
186
|
-
"340.js"
|
|
187
|
-
],
|
|
188
|
-
"auxiliaryFiles": [
|
|
189
|
-
"340.js.map"
|
|
190
|
-
],
|
|
191
|
-
"hash": "4aae2fa9ef632cc2",
|
|
192
|
-
"childrenByOrder": {}
|
|
193
|
-
},
|
|
194
144
|
{
|
|
195
145
|
"type": "chunk",
|
|
196
146
|
"rendered": false,
|
|
@@ -387,7 +337,7 @@
|
|
|
387
337
|
"auxiliaryFiles": [
|
|
388
338
|
"529.js.map"
|
|
389
339
|
],
|
|
390
|
-
"hash": "
|
|
340
|
+
"hash": "9406fec2b5bac79a",
|
|
391
341
|
"childrenByOrder": {}
|
|
392
342
|
},
|
|
393
343
|
{
|
|
@@ -516,6 +466,57 @@
|
|
|
516
466
|
"hash": "15d3051c35b67e87",
|
|
517
467
|
"childrenByOrder": {}
|
|
518
468
|
},
|
|
469
|
+
{
|
|
470
|
+
"type": "chunk",
|
|
471
|
+
"rendered": true,
|
|
472
|
+
"initial": false,
|
|
473
|
+
"entry": false,
|
|
474
|
+
"reason": "split chunk (cache group: defaultVendors)",
|
|
475
|
+
"size": 21521,
|
|
476
|
+
"sizes": {
|
|
477
|
+
"javascript": 21521
|
|
478
|
+
},
|
|
479
|
+
"names": [],
|
|
480
|
+
"idHints": [
|
|
481
|
+
"vendors"
|
|
482
|
+
],
|
|
483
|
+
"runtime": [
|
|
484
|
+
"@sasindi/labmanagement",
|
|
485
|
+
"main"
|
|
486
|
+
],
|
|
487
|
+
"files": [
|
|
488
|
+
"674.js"
|
|
489
|
+
],
|
|
490
|
+
"auxiliaryFiles": [
|
|
491
|
+
"674.js.map"
|
|
492
|
+
],
|
|
493
|
+
"hash": "0ecef229b44518b3",
|
|
494
|
+
"childrenByOrder": {}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"type": "chunk",
|
|
498
|
+
"rendered": true,
|
|
499
|
+
"initial": false,
|
|
500
|
+
"entry": false,
|
|
501
|
+
"size": 32023,
|
|
502
|
+
"sizes": {
|
|
503
|
+
"javascript": 32023
|
|
504
|
+
},
|
|
505
|
+
"names": [],
|
|
506
|
+
"idHints": [],
|
|
507
|
+
"runtime": [
|
|
508
|
+
"@sasindi/labmanagement",
|
|
509
|
+
"main"
|
|
510
|
+
],
|
|
511
|
+
"files": [
|
|
512
|
+
"724.js"
|
|
513
|
+
],
|
|
514
|
+
"auxiliaryFiles": [
|
|
515
|
+
"724.js.map"
|
|
516
|
+
],
|
|
517
|
+
"hash": "f5b528871a708426",
|
|
518
|
+
"childrenByOrder": {}
|
|
519
|
+
},
|
|
519
520
|
{
|
|
520
521
|
"type": "chunk",
|
|
521
522
|
"rendered": false,
|
|
@@ -613,7 +614,7 @@
|
|
|
613
614
|
"auxiliaryFiles": [
|
|
614
615
|
"main.js.map"
|
|
615
616
|
],
|
|
616
|
-
"hash": "
|
|
617
|
+
"hash": "2660c79b54b092f4",
|
|
617
618
|
"childrenByOrder": {}
|
|
618
619
|
},
|
|
619
620
|
{
|
|
@@ -662,6 +663,30 @@
|
|
|
662
663
|
"hash": "15360e97a238acac",
|
|
663
664
|
"childrenByOrder": {}
|
|
664
665
|
},
|
|
666
|
+
{
|
|
667
|
+
"type": "chunk",
|
|
668
|
+
"rendered": true,
|
|
669
|
+
"initial": false,
|
|
670
|
+
"entry": false,
|
|
671
|
+
"size": 28750,
|
|
672
|
+
"sizes": {
|
|
673
|
+
"javascript": 28750
|
|
674
|
+
},
|
|
675
|
+
"names": [],
|
|
676
|
+
"idHints": [],
|
|
677
|
+
"runtime": [
|
|
678
|
+
"@sasindi/labmanagement",
|
|
679
|
+
"main"
|
|
680
|
+
],
|
|
681
|
+
"files": [
|
|
682
|
+
"935.js"
|
|
683
|
+
],
|
|
684
|
+
"auxiliaryFiles": [
|
|
685
|
+
"935.js.map"
|
|
686
|
+
],
|
|
687
|
+
"hash": "1a022236ed08544b",
|
|
688
|
+
"childrenByOrder": {}
|
|
689
|
+
},
|
|
665
690
|
{
|
|
666
691
|
"type": "chunk",
|
|
667
692
|
"rendered": true,
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","pages":[{"route":"labmanagement","component":"root","online":true,"offline":true},{"route":"addresults","component":"root","online":true,"offline":true},{"route":"approvetestresults","component":"root","online":true}
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","pages":[{"route":"labmanagement","component":"root","online":true,"offline":true},{"route":"addresults","component":"root","online":true,"offline":true},{"route":"approvetestresults","component":"root","online":true}],"extensions":[],"version":"1.0.11"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { ArrowLeft, Search, Plus, Trash2, CheckCircle2, AlertCircle, BookOpen } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
interface LabTest {
|
|
6
|
+
id: string;
|
|
7
|
+
testName: string;
|
|
8
|
+
shortCode: string;
|
|
9
|
+
category: string;
|
|
10
|
+
unit: string;
|
|
11
|
+
normalRange: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const LabTestMaster: React.FC = () => {
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
17
|
+
const [showForm, setShowForm] = useState(false);
|
|
18
|
+
const [saveStatus, setSaveStatus] = useState<'idle' | 'success' | 'error'>('idle');
|
|
19
|
+
const [testName, setTestName] = useState('');
|
|
20
|
+
const [shortCode, setShortCode] = useState('');
|
|
21
|
+
const [category, setCategory] = useState('');
|
|
22
|
+
const [unit, setUnit] = useState('');
|
|
23
|
+
const [normalRange, setNormalRange] = useState('');
|
|
24
|
+
|
|
25
|
+
const navigateTo = (url: string) => {
|
|
26
|
+
window.history.pushState({}, '', url);
|
|
27
|
+
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const [tests, setTests] = useState<LabTest[]>([
|
|
31
|
+
{ id: '1', testName: 'Full Blood Count (FBC)', shortCode: 'FBC', category: 'Haematology', unit: 'cells/µL', normalRange: '4.5–11.0 × 10⁹/L' },
|
|
32
|
+
{ id: '2', testName: 'Serum Creatinine', shortCode: 'SCr', category: 'Biochemistry', unit: 'mg/dL', normalRange: '0.6–1.2 mg/dL' },
|
|
33
|
+
{ id: '3', testName: 'Lipid Profile', shortCode: 'LP', category: 'Biochemistry', unit: 'mg/dL', normalRange: 'LDL < 100 mg/dL' },
|
|
34
|
+
{ id: '4', testName: 'Urine Full Report', shortCode: 'UFR', category: 'Microbiology', unit: '—', normalRange: 'No abnormalities' },
|
|
35
|
+
{ id: '5', testName: 'Blood Glucose Fasting', shortCode: 'FBG', category: 'Biochemistry', unit: 'mg/dL', normalRange: '70–100 mg/dL' },
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
const filteredTests = tests.filter(test =>
|
|
39
|
+
test.testName.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
|
40
|
+
test.shortCode.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
|
41
|
+
test.category.toLowerCase().includes(searchQuery.toLowerCase())
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const handleAdd = (e: React.FormEvent) => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
if (!testName.trim() || !shortCode.trim()) {
|
|
47
|
+
setSaveStatus('error');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const newTest: LabTest = {
|
|
51
|
+
id: Date.now().toString(),
|
|
52
|
+
testName,
|
|
53
|
+
shortCode,
|
|
54
|
+
category,
|
|
55
|
+
unit,
|
|
56
|
+
normalRange
|
|
57
|
+
};
|
|
58
|
+
setTests(prev => [...prev, newTest]);
|
|
59
|
+
setSaveStatus('success');
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
setSaveStatus('idle');
|
|
62
|
+
setShowForm(false);
|
|
63
|
+
setTestName('');
|
|
64
|
+
setShortCode('');
|
|
65
|
+
setCategory('');
|
|
66
|
+
setUnit('');
|
|
67
|
+
setNormalRange('');
|
|
68
|
+
}, 1500);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const handleDelete = (id: string) => {
|
|
72
|
+
setTests(prev => prev.filter(t => t.id !== id));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const categoryColors: Record<string, { bg: string; color: string }> = {
|
|
76
|
+
Haematology: { bg: '#fce7f3', color: '#be185d' },
|
|
77
|
+
Biochemistry: { bg: '#dbeafe', color: '#1d4ed8' },
|
|
78
|
+
Microbiology: { bg: '#d1fae5', color: '#065f46' },
|
|
79
|
+
Immunology: { bg: '#ede9fe', color: '#6d28d9' },
|
|
80
|
+
Radiology: { bg: '#fed7aa', color: '#b45309' },
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const getCategoryStyle = (cat: string) =>
|
|
84
|
+
categoryColors[cat] ?? { bg: '#f1f5f9', color: '#475569' };
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div style={{
|
|
88
|
+
padding: '40px 24px',
|
|
89
|
+
maxWidth: '1200px',
|
|
90
|
+
margin: '0 auto',
|
|
91
|
+
fontFamily: 'Inter, system-ui, sans-serif',
|
|
92
|
+
color: '#1e293b'
|
|
93
|
+
}}>
|
|
94
|
+
{/* Header */}
|
|
95
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '32px' }}>
|
|
96
|
+
<button
|
|
97
|
+
onClick={() => navigateTo('/openmrs/spa/labmanagement')}
|
|
98
|
+
style={{
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
background: '#ffffff',
|
|
101
|
+
border: '1px solid #cbd5e1',
|
|
102
|
+
borderRadius: '12px',
|
|
103
|
+
width: '44px',
|
|
104
|
+
height: '44px',
|
|
105
|
+
display: 'flex',
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
boxShadow: '0 1px 2px rgba(0,0,0,0.05)',
|
|
109
|
+
transition: 'all 0.2s'
|
|
110
|
+
}}
|
|
111
|
+
onMouseEnter={(e) => {
|
|
112
|
+
e.currentTarget.style.borderColor = '#94a3b8';
|
|
113
|
+
e.currentTarget.style.background = '#f8fafc';
|
|
114
|
+
}}
|
|
115
|
+
onMouseLeave={(e) => {
|
|
116
|
+
e.currentTarget.style.borderColor = '#cbd5e1';
|
|
117
|
+
e.currentTarget.style.background = '#ffffff';
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<ArrowLeft style={{ width: '20px', height: '20px', color: '#64748b' }} />
|
|
121
|
+
</button>
|
|
122
|
+
<div style={{ flex: 1 }}>
|
|
123
|
+
<h1 style={{ fontSize: '28px', fontWeight: '700', margin: 0, letterSpacing: '-0.02em' }}>
|
|
124
|
+
{t('labTestMasterHeading', 'Lab Test Master')}
|
|
125
|
+
</h1>
|
|
126
|
+
<p style={{ fontSize: '14px', color: '#64748b', margin: '4px 0 0 0' }}>
|
|
127
|
+
Manage the master list of laboratory tests, short codes, and reference ranges.
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
<button
|
|
131
|
+
onClick={() => { setShowForm(true); setSaveStatus('idle'); }}
|
|
132
|
+
style={{
|
|
133
|
+
cursor: 'pointer',
|
|
134
|
+
display: 'flex',
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
gap: '8px',
|
|
137
|
+
background: '#8b5cf6',
|
|
138
|
+
color: '#ffffff',
|
|
139
|
+
border: 'none',
|
|
140
|
+
borderRadius: '14px',
|
|
141
|
+
padding: '12px 20px',
|
|
142
|
+
fontWeight: '600',
|
|
143
|
+
fontSize: '14px',
|
|
144
|
+
boxShadow: '0 4px 12px rgba(139,92,246,0.25)',
|
|
145
|
+
transition: 'background 0.2s'
|
|
146
|
+
}}
|
|
147
|
+
onMouseEnter={(e) => e.currentTarget.style.background = '#7c3aed'}
|
|
148
|
+
onMouseLeave={(e) => e.currentTarget.style.background = '#8b5cf6'}
|
|
149
|
+
>
|
|
150
|
+
<Plus style={{ width: '18px', height: '18px' }} />
|
|
151
|
+
Add Test
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{/* Add Test Form */}
|
|
156
|
+
{showForm && (
|
|
157
|
+
<div style={{
|
|
158
|
+
background: '#ffffff',
|
|
159
|
+
borderRadius: '24px',
|
|
160
|
+
padding: '28px',
|
|
161
|
+
border: '1px solid #e2e8f0',
|
|
162
|
+
boxShadow: '0 4px 16px rgba(0,0,0,0.06)',
|
|
163
|
+
marginBottom: '32px'
|
|
164
|
+
}}>
|
|
165
|
+
<h2 style={{ fontSize: '18px', fontWeight: '600', margin: '0 0 20px 0' }}>
|
|
166
|
+
New Lab Test
|
|
167
|
+
</h2>
|
|
168
|
+
<form onSubmit={handleAdd} style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '16px' }}>
|
|
169
|
+
<div>
|
|
170
|
+
<label style={{ display: 'block', fontSize: '13px', fontWeight: '600', color: '#475569', marginBottom: '6px' }}>
|
|
171
|
+
Test Name <span style={{ color: '#ef4444' }}>*</span>
|
|
172
|
+
</label>
|
|
173
|
+
<input
|
|
174
|
+
type="text"
|
|
175
|
+
placeholder="e.g. Full Blood Count"
|
|
176
|
+
value={testName}
|
|
177
|
+
onChange={(e) => setTestName(e.target.value)}
|
|
178
|
+
style={{ width: '100%', padding: '11px', borderRadius: '10px', border: '1px solid #cbd5e1', fontSize: '14px', outline: 'none' }}
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
<div>
|
|
182
|
+
<label style={{ display: 'block', fontSize: '13px', fontWeight: '600', color: '#475569', marginBottom: '6px' }}>
|
|
183
|
+
Short Code <span style={{ color: '#ef4444' }}>*</span>
|
|
184
|
+
</label>
|
|
185
|
+
<input
|
|
186
|
+
type="text"
|
|
187
|
+
placeholder="e.g. FBC"
|
|
188
|
+
value={shortCode}
|
|
189
|
+
onChange={(e) => setShortCode(e.target.value)}
|
|
190
|
+
style={{ width: '100%', padding: '11px', borderRadius: '10px', border: '1px solid #cbd5e1', fontSize: '14px', outline: 'none' }}
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
<div>
|
|
194
|
+
<label style={{ display: 'block', fontSize: '13px', fontWeight: '600', color: '#475569', marginBottom: '6px' }}>
|
|
195
|
+
Category
|
|
196
|
+
</label>
|
|
197
|
+
<select
|
|
198
|
+
value={category}
|
|
199
|
+
onChange={(e) => setCategory(e.target.value)}
|
|
200
|
+
style={{ width: '100%', padding: '11px', borderRadius: '10px', border: '1px solid #cbd5e1', fontSize: '14px', outline: 'none', background: '#fff' }}
|
|
201
|
+
>
|
|
202
|
+
<option value="">Select category</option>
|
|
203
|
+
<option value="Haematology">Haematology</option>
|
|
204
|
+
<option value="Biochemistry">Biochemistry</option>
|
|
205
|
+
<option value="Microbiology">Microbiology</option>
|
|
206
|
+
<option value="Immunology">Immunology</option>
|
|
207
|
+
<option value="Radiology">Radiology</option>
|
|
208
|
+
</select>
|
|
209
|
+
</div>
|
|
210
|
+
<div>
|
|
211
|
+
<label style={{ display: 'block', fontSize: '13px', fontWeight: '600', color: '#475569', marginBottom: '6px' }}>
|
|
212
|
+
Unit
|
|
213
|
+
</label>
|
|
214
|
+
<input
|
|
215
|
+
type="text"
|
|
216
|
+
placeholder="e.g. mg/dL"
|
|
217
|
+
value={unit}
|
|
218
|
+
onChange={(e) => setUnit(e.target.value)}
|
|
219
|
+
style={{ width: '100%', padding: '11px', borderRadius: '10px', border: '1px solid #cbd5e1', fontSize: '14px', outline: 'none' }}
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
<div style={{ gridColumn: '1 / -1' }}>
|
|
223
|
+
<label style={{ display: 'block', fontSize: '13px', fontWeight: '600', color: '#475569', marginBottom: '6px' }}>
|
|
224
|
+
Normal Range
|
|
225
|
+
</label>
|
|
226
|
+
<input
|
|
227
|
+
type="text"
|
|
228
|
+
placeholder="e.g. 4.5–11.0 × 10⁹/L"
|
|
229
|
+
value={normalRange}
|
|
230
|
+
onChange={(e) => setNormalRange(e.target.value)}
|
|
231
|
+
style={{ width: '100%', padding: '11px', borderRadius: '10px', border: '1px solid #cbd5e1', fontSize: '14px', outline: 'none' }}
|
|
232
|
+
/>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
{saveStatus === 'success' && (
|
|
236
|
+
<div style={{ gridColumn: '1 / -1', display: 'flex', alignItems: 'center', gap: '8px', background: '#f0fdf4', color: '#15803d', padding: '12px', borderRadius: '10px', fontSize: '14px' }}>
|
|
237
|
+
<CheckCircle2 style={{ width: '18px', height: '18px' }} />
|
|
238
|
+
Lab test added successfully!
|
|
239
|
+
</div>
|
|
240
|
+
)}
|
|
241
|
+
{saveStatus === 'error' && (
|
|
242
|
+
<div style={{ gridColumn: '1 / -1', display: 'flex', alignItems: 'center', gap: '8px', background: '#fef2f2', color: '#b91c1c', padding: '12px', borderRadius: '10px', fontSize: '14px' }}>
|
|
243
|
+
<AlertCircle style={{ width: '18px', height: '18px' }} />
|
|
244
|
+
Test Name and Short Code are required.
|
|
245
|
+
</div>
|
|
246
|
+
)}
|
|
247
|
+
|
|
248
|
+
<div style={{ gridColumn: '1 / -1', display: 'flex', gap: '12px', justifyContent: 'flex-end' }}>
|
|
249
|
+
<button
|
|
250
|
+
type="button"
|
|
251
|
+
onClick={() => setShowForm(false)}
|
|
252
|
+
style={{ cursor: 'pointer', background: '#f1f5f9', border: '1px solid #e2e8f0', borderRadius: '12px', padding: '11px 20px', fontWeight: '600', fontSize: '14px', color: '#475569', transition: 'background 0.2s' }}
|
|
253
|
+
onMouseEnter={(e) => e.currentTarget.style.background = '#e2e8f0'}
|
|
254
|
+
onMouseLeave={(e) => e.currentTarget.style.background = '#f1f5f9'}
|
|
255
|
+
>
|
|
256
|
+
Cancel
|
|
257
|
+
</button>
|
|
258
|
+
<button
|
|
259
|
+
type="submit"
|
|
260
|
+
style={{ cursor: 'pointer', background: '#8b5cf6', color: '#ffffff', border: 'none', borderRadius: '12px', padding: '11px 24px', fontWeight: '600', fontSize: '14px', boxShadow: '0 4px 12px rgba(139,92,246,0.2)', transition: 'background 0.2s' }}
|
|
261
|
+
onMouseEnter={(e) => e.currentTarget.style.background = '#7c3aed'}
|
|
262
|
+
onMouseLeave={(e) => e.currentTarget.style.background = '#8b5cf6'}
|
|
263
|
+
>
|
|
264
|
+
Save Test
|
|
265
|
+
</button>
|
|
266
|
+
</div>
|
|
267
|
+
</form>
|
|
268
|
+
</div>
|
|
269
|
+
)}
|
|
270
|
+
|
|
271
|
+
{/* Search & Table */}
|
|
272
|
+
<div style={{ background: '#ffffff', borderRadius: '24px', padding: '28px', border: '1px solid #e2e8f0', boxShadow: '0 4px 6px -1px rgba(0,0,0,0.05)' }}>
|
|
273
|
+
{/* Search */}
|
|
274
|
+
<div style={{ position: 'relative', marginBottom: '24px', maxWidth: '400px' }}>
|
|
275
|
+
<input
|
|
276
|
+
type="text"
|
|
277
|
+
placeholder="Search by name, code or category..."
|
|
278
|
+
value={searchQuery}
|
|
279
|
+
onChange={(e) => setSearchQuery(e.target.value)}
|
|
280
|
+
style={{ width: '100%', padding: '12px 16px 12px 44px', borderRadius: '14px', border: '1px solid #cbd5e1', fontSize: '14px', outline: 'none' }}
|
|
281
|
+
/>
|
|
282
|
+
<Search style={{ position: 'absolute', left: '16px', top: '50%', transform: 'translateY(-50%)', width: '18px', height: '18px', color: '#94a3b8' }} />
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
{/* Table */}
|
|
286
|
+
<div style={{ overflowX: 'auto' }}>
|
|
287
|
+
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '14px' }}>
|
|
288
|
+
<thead>
|
|
289
|
+
<tr style={{ borderBottom: '2px solid #f1f5f9' }}>
|
|
290
|
+
{['Test Name', 'Short Code', 'Category', 'Unit', 'Normal Range', ''].map((h) => (
|
|
291
|
+
<th key={h} style={{ textAlign: 'left', padding: '12px 16px', fontWeight: '600', color: '#64748b', fontSize: '12px', textTransform: 'uppercase', letterSpacing: '0.05em' }}>
|
|
292
|
+
{h}
|
|
293
|
+
</th>
|
|
294
|
+
))}
|
|
295
|
+
</tr>
|
|
296
|
+
</thead>
|
|
297
|
+
<tbody>
|
|
298
|
+
{filteredTests.map((test, idx) => {
|
|
299
|
+
const catStyle = getCategoryStyle(test.category);
|
|
300
|
+
return (
|
|
301
|
+
<tr
|
|
302
|
+
key={test.id}
|
|
303
|
+
style={{ borderBottom: '1px solid #f8fafc', background: idx % 2 === 0 ? '#ffffff' : '#fafafa', transition: 'background 0.15s' }}
|
|
304
|
+
onMouseEnter={(e) => (e.currentTarget.style.background = '#f1f5f9')}
|
|
305
|
+
onMouseLeave={(e) => (e.currentTarget.style.background = idx % 2 === 0 ? '#ffffff' : '#fafafa')}
|
|
306
|
+
>
|
|
307
|
+
<td style={{ padding: '14px 16px', fontWeight: '500', color: '#1e293b' }}>
|
|
308
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
|
|
309
|
+
<div style={{ width: '36px', height: '36px', borderRadius: '10px', background: '#f3e8ff', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
310
|
+
<BookOpen style={{ width: '18px', height: '18px', color: '#8b5cf6' }} />
|
|
311
|
+
</div>
|
|
312
|
+
{test.testName}
|
|
313
|
+
</div>
|
|
314
|
+
</td>
|
|
315
|
+
<td style={{ padding: '14px 16px' }}>
|
|
316
|
+
<span style={{ fontFamily: 'monospace', fontWeight: '600', color: '#8b5cf6', background: '#f3e8ff', padding: '3px 8px', borderRadius: '6px', fontSize: '13px' }}>
|
|
317
|
+
{test.shortCode}
|
|
318
|
+
</span>
|
|
319
|
+
</td>
|
|
320
|
+
<td style={{ padding: '14px 16px' }}>
|
|
321
|
+
<span style={{ background: catStyle.bg, color: catStyle.color, padding: '3px 10px', borderRadius: '6px', fontSize: '12px', fontWeight: '600' }}>
|
|
322
|
+
{test.category || '—'}
|
|
323
|
+
</span>
|
|
324
|
+
</td>
|
|
325
|
+
<td style={{ padding: '14px 16px', color: '#475569' }}>{test.unit || '—'}</td>
|
|
326
|
+
<td style={{ padding: '14px 16px', color: '#475569' }}>{test.normalRange || '—'}</td>
|
|
327
|
+
<td style={{ padding: '14px 16px' }}>
|
|
328
|
+
<button
|
|
329
|
+
onClick={() => handleDelete(test.id)}
|
|
330
|
+
style={{ cursor: 'pointer', background: '#fef2f2', border: 'none', borderRadius: '8px', padding: '6px 8px', display: 'flex', alignItems: 'center', transition: 'background 0.2s' }}
|
|
331
|
+
onMouseEnter={(e) => e.currentTarget.style.background = '#fee2e2'}
|
|
332
|
+
onMouseLeave={(e) => e.currentTarget.style.background = '#fef2f2'}
|
|
333
|
+
>
|
|
334
|
+
<Trash2 style={{ width: '16px', height: '16px', color: '#ef4444' }} />
|
|
335
|
+
</button>
|
|
336
|
+
</td>
|
|
337
|
+
</tr>
|
|
338
|
+
);
|
|
339
|
+
})}
|
|
340
|
+
{filteredTests.length === 0 && (
|
|
341
|
+
<tr>
|
|
342
|
+
<td colSpan={6} style={{ textAlign: 'center', padding: '60px', color: '#94a3b8' }}>
|
|
343
|
+
No lab tests found.
|
|
344
|
+
</td>
|
|
345
|
+
</tr>
|
|
346
|
+
)}
|
|
347
|
+
</tbody>
|
|
348
|
+
</table>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
export default LabTestMaster;
|
package/src/root.component.tsx
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
3
3
|
import Labmanagement from './labmanagement.component';
|
|
4
|
+
import AddResults from './addresults.component';
|
|
5
|
+
import LabTestMaster from './labtestmaster.component';
|
|
4
6
|
|
|
5
7
|
const Root: React.FC = () => (
|
|
6
8
|
<BrowserRouter basename={window.getOpenmrsSpaBase()}>
|
|
7
9
|
<Routes>
|
|
8
10
|
<Route path="labmanagement" element={<Labmanagement />} />
|
|
11
|
+
<Route path="addresults" element={<AddResults />} />
|
|
9
12
|
</Routes>
|
|
10
13
|
</BrowserRouter>
|
|
11
14
|
);
|
package/src/routes.json
CHANGED
package/dist/340.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_sasindi_labmanagement=globalThis.webpackChunk_sasindi_labmanagement||[]).push([["340"],{1759(e,a,n){n.r(a),n.d(a,{default:()=>r});var t=n(8670),l=n.n(t),s=n(1969),m=n(9196);let r=function(){return l().createElement(s.BrowserRouter,{basename:window.getOpenmrsSpaBase()},l().createElement(s.Routes,null,l().createElement(s.Route,{path:"labmanagement",element:l().createElement(m.default,null)})))}}}]);
|
package/dist/340.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"340.js","sources":["webpack://@sasindi/labmanagement/./src/root.component.tsx"],"names":["BrowserRouter","window","Routes","Route","Labmanagement"],"mappings":"mNAYA,MARuB,W,OACrB,kBAACA,EAAAA,aAAaA,CAAAA,CAAC,SAAUC,OAAO,iBAAiB,E,EAC/C,kBAACC,EAAAA,MAAMA,CAAAA,KACL,kBAACC,EAAAA,KAAKA,CAAAA,CAAC,KAAK,gBAAgB,QAAS,kBAACC,EAAAA,OAAaA,CAAAA,K"}
|