Harden workstation UX and seed placeholder scans after Playwright QA.
Fix mobile queue navigation, draft/loading states, and Intake overflow; seed MinIO demo PDFs so document viewing does not 500; add e2e smoke coverage.
This commit is contained in:
@@ -12,7 +12,14 @@
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<WorkstationLayout :has-batch="!!batchId">
|
||||
<WorkstationLayout
|
||||
:has-batch="!!batchId"
|
||||
queue-path="/approval"
|
||||
queue-label="Back to approval queue"
|
||||
:queue-batches="mobileQueueBatches"
|
||||
:selected-batch-id="batchId"
|
||||
@select-batch="openBatch"
|
||||
>
|
||||
<template #queue>
|
||||
<h2 class="text-xl font-semibold mb-4 text-ink-strong">Clinical Approval Queue</h2>
|
||||
<p class="text-sm text-ink-secondary mb-4">
|
||||
@@ -50,16 +57,34 @@
|
||||
</template>
|
||||
|
||||
<template #form>
|
||||
<ApprovalForm
|
||||
v-if="batchId"
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
:draft="draft"
|
||||
@back="router.push('/approval')"
|
||||
@view-history="(patientId) => router.push(`/patients/${patientId}/history`)"
|
||||
@create-correction="createCorrection"
|
||||
@rejected="router.push('/approval')"
|
||||
/>
|
||||
<template v-if="batchId">
|
||||
<div
|
||||
v-if="batchStore.loading && !batchStore.currentDraft"
|
||||
class="flex-1 min-h-0 p-4"
|
||||
data-testid="approval-draft-loading"
|
||||
>
|
||||
<SkeletonBlock variant="block" height="min(24rem, 60vh)" width="100%" />
|
||||
</div>
|
||||
<InlineError
|
||||
v-else-if="batchStore.error && !batchStore.currentDraft"
|
||||
class="m-4"
|
||||
title="Could not load draft"
|
||||
:message="batchStore.error"
|
||||
preserved="Your place in the queue was preserved."
|
||||
retry-label="Retry"
|
||||
@retry="retryDraft"
|
||||
/>
|
||||
<ApprovalForm
|
||||
v-else-if="batchStore.currentDraft"
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
:draft="draft"
|
||||
@back="router.push('/approval')"
|
||||
@view-history="(patientId) => router.push(`/patients/${patientId}/history`)"
|
||||
@create-correction="createCorrection"
|
||||
@rejected="router.push('/approval')"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</WorkstationLayout>
|
||||
</div>
|
||||
@@ -77,6 +102,8 @@ import BatchList from '../components/BatchList.vue'
|
||||
import WorkstationLayout from '../components/WorkstationLayout.vue'
|
||||
import WorkstationQueueRail from '../components/WorkstationQueueRail.vue'
|
||||
import ApprovalForm from '../components/ApprovalForm.vue'
|
||||
import SkeletonBlock from '../components/SkeletonBlock.vue'
|
||||
import InlineError from '../components/InlineError.vue'
|
||||
|
||||
const props = defineProps<{ batchId?: string }>()
|
||||
|
||||
@@ -93,6 +120,20 @@ function openBatch(id: string) {
|
||||
router.push(`/approval/${id}`)
|
||||
}
|
||||
|
||||
const mobileQueueBatches = computed(() =>
|
||||
batchStore.batches.map((b) => ({
|
||||
id: b.id,
|
||||
label: `${formatBatchType(b.batchType)} · ${b.id.substring(0, 8)}…`,
|
||||
})),
|
||||
)
|
||||
|
||||
async function retryDraft() {
|
||||
const id = batchId.value
|
||||
if (!id) return
|
||||
await batchStore.getBatch(id)
|
||||
await batchStore.getDraft(id)
|
||||
}
|
||||
|
||||
function formatBatchType(type: string): string {
|
||||
return type.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
|
||||
}
|
||||
|
||||
@@ -242,8 +242,8 @@
|
||||
<th class="py-2 px-4 font-medium">Patient</th>
|
||||
<th class="py-2 px-4 font-medium">Assigned To</th>
|
||||
<th class="py-2 px-4 font-medium">Status</th>
|
||||
<th class="py-2 px-4 font-medium">Linked Batch</th>
|
||||
<th class="py-2 px-4 font-medium">Created</th>
|
||||
<th class="py-2 px-4 font-medium hidden lg:table-cell">Linked Batch</th>
|
||||
<th class="py-2 px-4 font-medium hidden lg:table-cell">Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -264,7 +264,7 @@
|
||||
{{ sheet.track === 'BACKFILL' ? 'Backfill' : 'Live' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="py-2 px-4">
|
||||
<td class="py-2 px-4 max-w-[10rem] truncate" :title="sheet.patientName ?? undefined">
|
||||
<template v-if="sheet.patientName">
|
||||
{{ sheet.patientName }}
|
||||
<span v-if="sheet.patientMrn" class="text-ink-secondary">
|
||||
@@ -273,23 +273,24 @@
|
||||
</template>
|
||||
<span v-else class="text-ink-disabled">—</span>
|
||||
</td>
|
||||
<td class="py-2 px-4">
|
||||
<td class="py-2 px-4 max-w-[8rem] truncate" :title="sheet.assignToUserName ?? undefined">
|
||||
{{ sheet.assignToUserName ?? '—' }}
|
||||
</td>
|
||||
<td class="py-2 px-4">
|
||||
<StatusBadge :status="sheet.isUsed ? 'USED' : 'UNUSED'" />
|
||||
</td>
|
||||
<td class="py-2 px-4">
|
||||
<td class="py-2 px-4 hidden lg:table-cell">
|
||||
<router-link
|
||||
v-if="sheet.batchId"
|
||||
:to="{ path: '/intake', query: { batchId: sheet.batchId } }"
|
||||
:to="batchRouteForStatus(sheet.batchStatus ?? 'IN_ENTRY', sheet.batchId)"
|
||||
class="font-mono text-xs text-primary-600 hover:text-primary-800"
|
||||
:title="sheet.batchId"
|
||||
>
|
||||
{{ sheet.batchId.substring(0, 8) }}…
|
||||
</router-link>
|
||||
<span v-else class="text-ink-disabled">—</span>
|
||||
</td>
|
||||
<td class="py-2 px-4 text-ink-secondary">
|
||||
<td class="py-2 px-4 text-ink-secondary hidden lg:table-cell">
|
||||
{{ formatDate(sheet.createdAt) }}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -335,6 +336,7 @@ import StatusBadge from '../components/StatusBadge.vue'
|
||||
import EmptyState from '../components/EmptyState.vue'
|
||||
import SkeletonBlock from '../components/SkeletonBlock.vue'
|
||||
import InlineError from '../components/InlineError.vue'
|
||||
import { batchRouteForStatus } from '../utils/batchRoute'
|
||||
import type { CoverSheetResponse, UserSummary } from '../types'
|
||||
|
||||
const toast = useToast()
|
||||
|
||||
@@ -12,7 +12,14 @@
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<WorkstationLayout :has-batch="!!batchId">
|
||||
<WorkstationLayout
|
||||
:has-batch="!!batchId"
|
||||
queue-path="/entry"
|
||||
queue-label="Back to entry queue"
|
||||
:queue-batches="mobileQueueBatches"
|
||||
:selected-batch-id="batchId"
|
||||
@select-batch="openBatch"
|
||||
>
|
||||
<template #queue>
|
||||
<h2 class="text-xl font-semibold mb-4 text-ink-strong">Data Entry Queue</h2>
|
||||
<BatchList
|
||||
@@ -47,13 +54,31 @@
|
||||
</template>
|
||||
|
||||
<template #form>
|
||||
<EntryForm
|
||||
v-if="batchId"
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
:next-batch-id="nextBatchId"
|
||||
@open-next="openBatch"
|
||||
/>
|
||||
<template v-if="batchId">
|
||||
<div
|
||||
v-if="batchStore.loading && !batchStore.currentDraft"
|
||||
class="flex-1 min-h-0 p-4"
|
||||
data-testid="entry-draft-loading"
|
||||
>
|
||||
<SkeletonBlock variant="block" height="min(24rem, 60vh)" width="100%" />
|
||||
</div>
|
||||
<InlineError
|
||||
v-else-if="batchStore.error && !batchStore.currentDraft"
|
||||
class="m-4"
|
||||
title="Could not load draft"
|
||||
:message="batchStore.error"
|
||||
preserved="Your place in the queue was preserved."
|
||||
retry-label="Retry"
|
||||
@retry="retryDraft"
|
||||
/>
|
||||
<EntryForm
|
||||
v-else-if="batchStore.currentDraft"
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
:next-batch-id="nextBatchId"
|
||||
@open-next="openBatch"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</WorkstationLayout>
|
||||
</div>
|
||||
@@ -71,6 +96,8 @@ import EntryForm from '../components/EntryForm.vue'
|
||||
import BatchList from '../components/BatchList.vue'
|
||||
import WorkstationLayout from '../components/WorkstationLayout.vue'
|
||||
import WorkstationQueueRail from '../components/WorkstationQueueRail.vue'
|
||||
import SkeletonBlock from '../components/SkeletonBlock.vue'
|
||||
import InlineError from '../components/InlineError.vue'
|
||||
|
||||
const props = defineProps<{ batchId?: string }>()
|
||||
|
||||
@@ -92,6 +119,22 @@ const nextBatchId = computed(() => {
|
||||
return list[idx + 1]?.id
|
||||
})
|
||||
|
||||
const mobileQueueBatches = computed(() =>
|
||||
batchStore.batches.map((b) => ({
|
||||
id: b.id,
|
||||
label: `${formatBatchType(b.batchType)} · ${b.id.substring(0, 8)}…`,
|
||||
})),
|
||||
)
|
||||
|
||||
function formatBatchType(type: string): string {
|
||||
return type.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
|
||||
}
|
||||
|
||||
function retryDraft() {
|
||||
const id = batchId.value
|
||||
if (id) void batchStore.getDraft(id)
|
||||
}
|
||||
|
||||
async function openBatch(id: string) {
|
||||
router.push(`/entry/${id}`)
|
||||
}
|
||||
|
||||
@@ -13,6 +13,21 @@
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<div
|
||||
v-if="metadataError"
|
||||
class="shrink-0 border-b border-line bg-clinical-danger-bg px-4 py-2 sm:px-6"
|
||||
role="alert"
|
||||
data-testid="fhir-metadata-error"
|
||||
>
|
||||
<InlineError
|
||||
title="Could not load CapabilityStatement"
|
||||
:message="metadataError"
|
||||
preserved="Your search results were not affected."
|
||||
retry-label="Retry"
|
||||
@retry="openMetadata"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8">
|
||||
<div class="max-w-7xl mx-auto space-y-6">
|
||||
<!-- Resource browser -->
|
||||
@@ -171,7 +186,10 @@
|
||||
:class="{ 'bg-primary-50': selectedResource?.id === entry.resource?.id }"
|
||||
@click="selectResource(entry.resource)"
|
||||
>
|
||||
<td class="py-2 px-3 font-mono text-xs text-ink-strong">
|
||||
<td
|
||||
class="py-2 px-3 font-mono text-xs text-ink-strong max-w-[12rem] truncate"
|
||||
:title="String(entry.resource?.id ?? '')"
|
||||
>
|
||||
{{ entry.resource?.id }}
|
||||
</td>
|
||||
<td v-if="resourceType === 'Patient'" class="py-2 px-3">
|
||||
@@ -354,6 +372,7 @@ const searchError = ref('')
|
||||
const searchResults = ref<FhirBundleEntry[]>([])
|
||||
const searchTotal = ref(0)
|
||||
const selectedResource = ref<FhirResource | null>(null)
|
||||
const metadataError = ref('')
|
||||
|
||||
const patientSearch = reactive({ name: '', birthdate: '', identifier: '' })
|
||||
const encounterSearch = reactive({ patient: '', status: '', date: '' })
|
||||
@@ -522,11 +541,12 @@ async function loadEverything(): Promise<void> {
|
||||
}
|
||||
|
||||
async function openMetadata(): Promise<void> {
|
||||
metadataError.value = ''
|
||||
try {
|
||||
const metadata = await fhirGet('/metadata')
|
||||
openFhirJsonInNewTab(metadata, 'capability-statement.json')
|
||||
} catch (err: unknown) {
|
||||
searchError.value = err instanceof Error ? err.message : 'Failed to load metadata'
|
||||
metadataError.value = err instanceof Error ? err.message : 'Failed to load metadata'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -316,6 +316,7 @@
|
||||
empty-title="No uploaded batches waiting for assignment."
|
||||
empty-description="New uploads appear here after a scan is submitted."
|
||||
show-assign
|
||||
compact
|
||||
@assign="openAssignDialog"
|
||||
@retry="loadRecent"
|
||||
/>
|
||||
@@ -328,6 +329,7 @@
|
||||
<AssignClerkDialog
|
||||
:show="assignDialogOpen"
|
||||
:batch-id="assignBatchId"
|
||||
:assigning="assigning"
|
||||
@close="closeAssignDialog"
|
||||
@assigned="handleAssign"
|
||||
/>
|
||||
@@ -369,6 +371,7 @@ const uploadSuccess = ref('')
|
||||
const assignError = ref('')
|
||||
const assignDialogOpen = ref(false)
|
||||
const assignBatchId = ref<string | null>(null)
|
||||
const assigning = ref(false)
|
||||
|
||||
const coverSheetCode = ref('')
|
||||
const resolvedCoverSheet = ref<CoverSheetResponse | null>(null)
|
||||
@@ -561,7 +564,9 @@ function closeAssignDialog() {
|
||||
}
|
||||
|
||||
async function handleAssign(batchId: string, clerkUserId: string) {
|
||||
if (assigning.value) return
|
||||
assignError.value = ''
|
||||
assigning.value = true
|
||||
try {
|
||||
await batchStore.assignBatch(batchId, clerkUserId)
|
||||
closeAssignDialog()
|
||||
@@ -571,6 +576,8 @@ async function handleAssign(batchId: string, clerkUserId: string) {
|
||||
const msg = e instanceof Error ? e.message : 'Assignment failed'
|
||||
assignError.value = msg
|
||||
toast.error(msg)
|
||||
} finally {
|
||||
assigning.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,17 @@
|
||||
<div class="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8">
|
||||
<div class="max-w-5xl mx-auto space-y-6">
|
||||
<!-- Mode selector -->
|
||||
<div class="flex border-b border-line" role="tablist" data-tour="live-capture-tabs">
|
||||
<div
|
||||
class="flex flex-nowrap overflow-x-auto border-b border-line"
|
||||
role="tablist"
|
||||
data-tour="live-capture-tabs"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
:aria-selected="mode === 'new'"
|
||||
@click="mode = 'new'"
|
||||
class="px-5 py-3 text-sm font-semibold border-b-2 -mb-px transition-colors"
|
||||
class="shrink-0 px-5 py-3 text-sm font-semibold border-b-2 -mb-px transition-colors"
|
||||
:class="mode === 'new'
|
||||
? 'border-primary-600 text-primary-700'
|
||||
: 'border-transparent text-ink-secondary hover:text-ink-strong'"
|
||||
@@ -31,7 +35,7 @@
|
||||
role="tab"
|
||||
:aria-selected="mode === 'existing'"
|
||||
@click="mode = 'existing'"
|
||||
class="px-5 py-3 text-sm font-semibold border-b-2 -mb-px transition-colors"
|
||||
class="shrink-0 px-5 py-3 text-sm font-semibold border-b-2 -mb-px transition-colors"
|
||||
:class="mode === 'existing'
|
||||
? 'border-primary-600 text-primary-700'
|
||||
: 'border-transparent text-ink-secondary hover:text-ink-strong'"
|
||||
@@ -279,7 +283,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { useLiveCaptureStore } from '../stores/liveCapture'
|
||||
import { useToast } from '../composables/useToast'
|
||||
import AppHeader from '../components/AppHeader.vue'
|
||||
@@ -294,6 +298,11 @@ const store = useLiveCaptureStore()
|
||||
const toast = useToast()
|
||||
|
||||
const mode = ref<'new' | 'existing'>('new')
|
||||
|
||||
watch(mode, () => {
|
||||
store.reset()
|
||||
errorMessage.value = ''
|
||||
})
|
||||
const patientId = ref<string | undefined>()
|
||||
const department = ref('')
|
||||
const roomBed = ref('')
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
autocomplete="username"
|
||||
class="form-input"
|
||||
placeholder="e.g. intake1, entry1, verifier1"
|
||||
:disabled="loading"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
@@ -78,6 +79,7 @@
|
||||
type="password"
|
||||
autocomplete="current-password"
|
||||
class="form-input"
|
||||
:disabled="loading"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
@retry="reloadHistory"
|
||||
/>
|
||||
|
||||
<EmptyState
|
||||
v-else-if="historyLoaded && !history"
|
||||
title="No history available for this patient."
|
||||
description="The patient may not exist, or digitization history could not be loaded. Try another search or retry."
|
||||
/>
|
||||
|
||||
<template v-else-if="history">
|
||||
<!-- Summary -->
|
||||
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 sm:gap-4">
|
||||
@@ -283,10 +289,13 @@ const batchStore = useBatchStore()
|
||||
const patientId = ref(props.patientId ?? (route.params.patientId as string | undefined))
|
||||
const selectedPatientId = ref<string | undefined>()
|
||||
const history = ref<PatientDigitizationHistoryResponse | null>(null)
|
||||
const historyLoaded = ref(false)
|
||||
|
||||
async function reloadHistory() {
|
||||
if (!patientId.value) return
|
||||
historyLoaded.value = false
|
||||
history.value = await batchStore.getPatientHistory(patientId.value)
|
||||
historyLoaded.value = true
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -294,9 +303,12 @@ watch(
|
||||
async (id) => {
|
||||
patientId.value = id
|
||||
if (id) {
|
||||
historyLoaded.value = false
|
||||
history.value = await batchStore.getPatientHistory(id)
|
||||
historyLoaded.value = true
|
||||
} else {
|
||||
history.value = null
|
||||
historyLoaded.value = false
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<TourHelpButton />
|
||||
<button
|
||||
type="button"
|
||||
class="text-sm font-medium text-primary-700 hover:text-primary-800"
|
||||
class="text-sm font-medium text-primary-700 hover:text-primary-800 disabled:opacity-50 disabled:pointer-events-none"
|
||||
:disabled="refreshing"
|
||||
@click="refreshData"
|
||||
>
|
||||
@@ -18,6 +18,10 @@
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<p v-if="refreshStatus" class="sr-only" aria-live="polite">
|
||||
{{ refreshStatus }}
|
||||
</p>
|
||||
|
||||
<div class="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8">
|
||||
<div class="max-w-7xl mx-auto space-y-6 lg:space-y-8">
|
||||
<InlineError
|
||||
@@ -33,7 +37,14 @@
|
||||
<div
|
||||
class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-3 sm:gap-4"
|
||||
data-tour="dashboard-metrics"
|
||||
:aria-busy="!overview && refreshing ? 'true' : undefined"
|
||||
>
|
||||
<template v-if="!overview && refreshing">
|
||||
<div v-for="n in 6" :key="n" class="card-elevated">
|
||||
<SkeletonBlock variant="row" :rows="2" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="card-elevated">
|
||||
<p class="text-xs font-semibold uppercase tracking-wide text-ink-secondary">
|
||||
Pending Entry
|
||||
@@ -93,6 +104,7 @@
|
||||
</p>
|
||||
<p class="text-xs text-ink-secondary mt-2">Target: under 24 hours</p>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Status breakdown from overview.statusCounts -->
|
||||
@@ -137,6 +149,7 @@
|
||||
:error="batchStore.error"
|
||||
empty-title="No batches in the queue."
|
||||
empty-description="Batches appear here as they move through digitization."
|
||||
@select="openBatch"
|
||||
@retry="refreshData"
|
||||
/>
|
||||
</section>
|
||||
@@ -147,7 +160,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useBatchStore } from '../stores/batches'
|
||||
import { batchRouteForStatus } from '../utils/batchRoute'
|
||||
import { get } from '../api/client'
|
||||
import AppHeader from '../components/AppHeader.vue'
|
||||
import TourHelpButton from '../components/TourHelpButton.vue'
|
||||
@@ -159,9 +174,11 @@ import InlineError from '../components/InlineError.vue'
|
||||
import type { WorkQueueOverview } from '../types'
|
||||
|
||||
const batchStore = useBatchStore()
|
||||
const router = useRouter()
|
||||
const overview = ref<WorkQueueOverview | null>(null)
|
||||
const overviewError = ref('')
|
||||
const refreshing = ref(false)
|
||||
const refreshStatus = ref('')
|
||||
|
||||
const statusEntries = computed(() => {
|
||||
const counts = overview.value?.statusCounts ?? {}
|
||||
@@ -180,8 +197,16 @@ function formatMinutes(minutes: number): string {
|
||||
return `${(minutes / 1440).toFixed(1)}d`
|
||||
}
|
||||
|
||||
function openBatch(batchId: string) {
|
||||
const batch = batchStore.batches.find((b) => b.id === batchId)
|
||||
if (batch) {
|
||||
router.push(batchRouteForStatus(batch.status, batchId))
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshData() {
|
||||
refreshing.value = true
|
||||
refreshStatus.value = ''
|
||||
overviewError.value = ''
|
||||
try {
|
||||
const response = await get<WorkQueueOverview>('work-queue/overview')
|
||||
@@ -196,6 +221,10 @@ async function refreshData() {
|
||||
|
||||
await batchStore.listBatches({ page: 1, pageSize: 50 })
|
||||
refreshing.value = false
|
||||
refreshStatus.value =
|
||||
overviewError.value || batchStore.error
|
||||
? 'Refresh finished with errors.'
|
||||
: 'Queue dashboard refreshed.'
|
||||
}
|
||||
|
||||
onMounted(refreshData)
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
type="button"
|
||||
class="text-sm font-medium text-clinical-danger hover:opacity-80"
|
||||
data-testid="users-deactivate"
|
||||
@click="deactivateUser(user)"
|
||||
@click="requestDeactivate(user)"
|
||||
>
|
||||
Deactivate
|
||||
</button>
|
||||
@@ -233,6 +233,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ConfirmDialog
|
||||
:open="!!deactivateTarget"
|
||||
title="Deactivate user"
|
||||
:body="deactivateTarget
|
||||
? `${deactivateTarget.fullName} will lose access immediately and disappear from this list.`
|
||||
: undefined"
|
||||
confirm-label="Deactivate"
|
||||
variant="danger"
|
||||
:confirm-loading="deactivating"
|
||||
confirm-loading-label="Deactivating…"
|
||||
@confirm="confirmDeactivate"
|
||||
@cancel="deactivateTarget = null"
|
||||
/>
|
||||
|
||||
<ConfirmDialog
|
||||
:open="!!resetTarget"
|
||||
title="Reset password"
|
||||
@@ -309,6 +323,9 @@ const editForm = reactive({
|
||||
role: '',
|
||||
})
|
||||
|
||||
const deactivateTarget = ref<UserSummary | null>(null)
|
||||
const deactivating = ref(false)
|
||||
|
||||
const resetTarget = ref<UserSummary | null>(null)
|
||||
const resetPasswordValue = ref('')
|
||||
const resetError = ref('')
|
||||
@@ -377,14 +394,24 @@ async function submitEdit() {
|
||||
}
|
||||
}
|
||||
|
||||
async function deactivateUser(user: UserSummary) {
|
||||
function requestDeactivate(user: UserSummary) {
|
||||
deactivateTarget.value = user
|
||||
}
|
||||
|
||||
async function confirmDeactivate() {
|
||||
if (!deactivateTarget.value) return
|
||||
const user = deactivateTarget.value
|
||||
deactivating.value = true
|
||||
try {
|
||||
await usersStore.updateUser(user.id, { isActive: false })
|
||||
toast.warning(`${user.fullName} deactivated`)
|
||||
if (editingUser.value?.id === user.id) editingUser.value = null
|
||||
deactivateTarget.value = null
|
||||
await loadUsers()
|
||||
} catch (e: unknown) {
|
||||
toast.error(e instanceof Error ? e.message : 'Failed to deactivate user')
|
||||
} finally {
|
||||
deactivating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,14 @@
|
||||
</template>
|
||||
</AppHeader>
|
||||
|
||||
<WorkstationLayout :has-batch="!!batchId">
|
||||
<WorkstationLayout
|
||||
:has-batch="!!batchId"
|
||||
queue-path="/verification"
|
||||
queue-label="Back to verification queue"
|
||||
:queue-batches="mobileQueueBatches"
|
||||
:selected-batch-id="batchId"
|
||||
@select-batch="openBatch"
|
||||
>
|
||||
<template #queue>
|
||||
<h2 class="text-xl font-semibold mb-4 text-ink-strong">Verification Queue</h2>
|
||||
<p class="text-sm text-ink-secondary mb-4">
|
||||
@@ -50,11 +57,29 @@
|
||||
</template>
|
||||
|
||||
<template #form>
|
||||
<VerificationForm
|
||||
v-if="batchId"
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
/>
|
||||
<template v-if="batchId">
|
||||
<div
|
||||
v-if="batchStore.loading && !batchStore.currentDraft"
|
||||
class="flex-1 min-h-0 p-4"
|
||||
data-testid="verification-draft-loading"
|
||||
>
|
||||
<SkeletonBlock variant="block" height="min(24rem, 60vh)" width="100%" />
|
||||
</div>
|
||||
<InlineError
|
||||
v-else-if="batchStore.error && !batchStore.currentDraft"
|
||||
class="m-4"
|
||||
title="Could not load draft"
|
||||
:message="batchStore.error"
|
||||
preserved="Your place in the queue was preserved."
|
||||
retry-label="Retry"
|
||||
@retry="retryDraft"
|
||||
/>
|
||||
<VerificationForm
|
||||
v-else-if="batchStore.currentDraft"
|
||||
:batch="currentBatch"
|
||||
:batch-id="batchId"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</WorkstationLayout>
|
||||
</div>
|
||||
@@ -72,6 +97,8 @@ import VerificationForm from '../components/VerificationForm.vue'
|
||||
import BatchList from '../components/BatchList.vue'
|
||||
import WorkstationLayout from '../components/WorkstationLayout.vue'
|
||||
import WorkstationQueueRail from '../components/WorkstationQueueRail.vue'
|
||||
import SkeletonBlock from '../components/SkeletonBlock.vue'
|
||||
import InlineError from '../components/InlineError.vue'
|
||||
|
||||
const props = defineProps<{ batchId?: string }>()
|
||||
|
||||
@@ -96,6 +123,22 @@ function openBatch(id: string) {
|
||||
router.push(`/verification/${id}`)
|
||||
}
|
||||
|
||||
const mobileQueueBatches = computed(() =>
|
||||
batchStore.batches.map((b) => ({
|
||||
id: b.id,
|
||||
label: `${formatBatchType(b.batchType)} · ${b.id.substring(0, 8)}…`,
|
||||
})),
|
||||
)
|
||||
|
||||
function formatBatchType(type: string): string {
|
||||
return type.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
|
||||
}
|
||||
|
||||
function retryDraft() {
|
||||
const id = batchId.value
|
||||
if (id) void batchStore.getDraft(id)
|
||||
}
|
||||
|
||||
async function loadQueue() {
|
||||
await batchStore.listVerificationQueue({
|
||||
page: 1,
|
||||
|
||||
Reference in New Issue
Block a user