feature: Shared UX Primitives
This commit is contained in:
@@ -2,17 +2,12 @@
|
||||
<div class="h-full overflow-y-auto p-4 space-y-6">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-lg font-semibold">Data Entry</h2>
|
||||
<span
|
||||
:class="statusColor"
|
||||
class="status-badge"
|
||||
>
|
||||
{{ batch?.status?.replace(/_/g, ' ') }}
|
||||
</span>
|
||||
<StatusBadge :status="batch?.status" />
|
||||
</div>
|
||||
|
||||
<div v-if="ocrConfidence" class="ocr-banner">
|
||||
Pre-filled by OCR ({{ ocrConfidence.provider }}).
|
||||
Review all values against the scan before submitting.
|
||||
Pre-filled by OCR ({{ ocrConfidence.provider }}) — review against the scan.
|
||||
OCR is assistive, not authoritative.
|
||||
</div>
|
||||
|
||||
<!-- Patient section -->
|
||||
@@ -20,7 +15,10 @@
|
||||
<legend class="text-sm font-medium text-gray-700 px-2">Patient Demographics</legend>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Full Name</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Full Name
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('patient.fullName')" :level="fieldConfidenceLevel('patient.fullName')" />
|
||||
</label>
|
||||
<input
|
||||
v-model="patient.fullName"
|
||||
@blur="savePatient"
|
||||
@@ -29,7 +27,10 @@
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Date of Birth</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Date of Birth
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('patient.dateOfBirth')" :level="fieldConfidenceLevel('patient.dateOfBirth')" />
|
||||
</label>
|
||||
<input
|
||||
v-model="patient.dateOfBirth"
|
||||
@blur="savePatient"
|
||||
@@ -38,7 +39,10 @@
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Sex</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Sex
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('patient.sex')" :level="fieldConfidenceLevel('patient.sex')" />
|
||||
</label>
|
||||
<select
|
||||
v-model="patient.sex"
|
||||
@change="savePatient"
|
||||
@@ -150,7 +154,10 @@
|
||||
<legend class="text-sm font-medium text-gray-700 px-2">Encounter Context</legend>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Admission Date</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Admission Date
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('encounter.admissionDate')" :level="fieldConfidenceLevel('encounter.admissionDate')" />
|
||||
</label>
|
||||
<input
|
||||
v-model="encounter.admissionDate"
|
||||
@blur="saveEncounter"
|
||||
@@ -159,7 +166,10 @@
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Department</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Department
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('encounter.department')" :level="fieldConfidenceLevel('encounter.department')" />
|
||||
</label>
|
||||
<select
|
||||
v-model="encounter.department"
|
||||
@change="saveEncounter"
|
||||
@@ -170,7 +180,10 @@
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Room / Bed</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Room / Bed
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('encounter.roomBed')" :level="fieldConfidenceLevel('encounter.roomBed')" />
|
||||
</label>
|
||||
<input
|
||||
v-model="encounter.roomBed"
|
||||
@blur="saveEncounter"
|
||||
@@ -179,7 +192,10 @@
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs text-gray-500">Admission Reason</label>
|
||||
<label class="flex items-center gap-2 text-xs text-gray-500">
|
||||
Admission Reason
|
||||
<OcrConfidenceBadge :label="fieldConfidenceLabel('encounter.admissionReason')" :level="fieldConfidenceLevel('encounter.admissionReason')" />
|
||||
</label>
|
||||
<input
|
||||
v-model="encounter.admissionReason"
|
||||
@blur="saveEncounter"
|
||||
@@ -217,6 +233,8 @@
|
||||
:key="obs.id"
|
||||
:observation="obs"
|
||||
:value-input-class="observationValueConfidenceClass(obs.observationCode)"
|
||||
:ocr-label="fieldConfidenceLabel(`observation.${obs.observationCode}.value`)"
|
||||
:ocr-level="fieldConfidenceLevel(`observation.${obs.observationCode}.value`)"
|
||||
@update="(field, value) => handleObsUpdate(obs.id, field, value)"
|
||||
@delete="handleObsDelete"
|
||||
/>
|
||||
@@ -249,6 +267,8 @@ import { useBatchStore } from '../stores/batches'
|
||||
import { useToast } from '../composables/useToast'
|
||||
import { useOcrFieldConfidence } from '../composables/useOcrFieldConfidence'
|
||||
import ObservationRow from '../components/ObservationRow.vue'
|
||||
import StatusBadge from '../components/StatusBadge.vue'
|
||||
import OcrConfidenceBadge from '../components/OcrConfidenceBadge.vue'
|
||||
import type { BatchDetailResponse, DraftObservation } from '../types'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -287,7 +307,11 @@ const departments = [
|
||||
|
||||
const fieldReqs = computed(() => batchStore.currentDraft?.fieldRequirements)
|
||||
const ocrConfidence = computed(() => batchStore.currentDraft?.ocrConfidence ?? null)
|
||||
const { fieldConfidenceClass } = useOcrFieldConfidence(ocrConfidence)
|
||||
const {
|
||||
fieldConfidenceClass,
|
||||
fieldConfidenceLabel,
|
||||
fieldConfidenceLevel,
|
||||
} = useOcrFieldConfidence(ocrConfidence)
|
||||
|
||||
function observationValueConfidenceClass(observationCode: string): string {
|
||||
if (!observationCode) return ''
|
||||
@@ -322,8 +346,6 @@ const encounter = reactive({
|
||||
|
||||
const observations = ref<DraftObservation[]>([])
|
||||
|
||||
const statusColor = ref('bg-gray-100 text-gray-800')
|
||||
|
||||
// Load draft data when batch changes
|
||||
watch(
|
||||
() => batchStore.currentDraft,
|
||||
|
||||
Reference in New Issue
Block a user