Harden workstation UX and seed placeholder scans after Playwright QA.
CI / backend (push) Failing after 38s
CI / frontend (push) Successful in 9m35s

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:
2026-10-06 15:07:15 +08:00
parent 7d7332641f
commit 3c7bf5bccb
47 changed files with 1160 additions and 140 deletions
+46 -3
View File
@@ -1,5 +1,48 @@
# Vue 3 + TypeScript + Vite
# VigilCare Records — Web
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Vue 3 + TypeScript + Vite workstation UI for digitization intake, entry, verification, and clinical approval.
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
## Scripts
```bash
npm install
npm run dev # http://localhost:3028
npm run build
npm run test:run
npm run test:e2e # Playwright smoke (requires app + API)
```
## API proxy
Vite proxies `/api` and `/fhir` to a backend. By default that is `http://localhost:5217`.
To point the local UI at a remote API (e.g. production or staging) without changing `vite.config.ts`:
```bash
VITE_API_PROXY=https://vigilcare-records.vectur45.com npm run dev
```
Auth cookies/tokens are same-origin to the Vite host; the proxy forwards `/api/v1/*` to the target.
## Playwright smoke
`e2e/smoke.spec.ts` covers viewports **375 / 768 / 1280**:
1. Login as a role user
2. Land on role home
3. Open one workstation batch when available
4. Use **Back to queue** (mobile/tablet) when the rail is hidden
```bash
npx playwright install chromium # once
BASE_URL=http://127.0.0.1:3028 npm run test:e2e
```
Optional env:
| Variable | Default | Purpose |
|----------|---------|---------|
| `BASE_URL` | `http://127.0.0.1:3028` | App under test |
| `E2E_USER` | `entry1` | Login username |
| `E2E_PASSWORD` | `password` | Login password |
| `E2E_ROLES` | `entry1,verifier1,approver1,intake1` | Comma-separated role smoke users |
+101
View File
@@ -0,0 +1,101 @@
import { test, expect, type Page } from '@playwright/test'
const password = process.env.E2E_PASSWORD ?? 'password'
const roleUsers = (process.env.E2E_ROLES ?? 'entry1,verifier1,approver1,intake1')
.split(',')
.map((s) => s.trim())
.filter(Boolean)
const viewports = [
{ name: 'mobile', width: 375, height: 812 },
{ name: 'tablet', width: 768, height: 1024 },
{ name: 'desktop', width: 1280, height: 800 },
] as const
const roleHome: Record<string, string> = {
entry1: '/entry',
verifier1: '/verification',
approver1: '/approval',
intake1: '/intake',
admin1: '/dashboard',
}
async function dismissTourIfPresent(page: Page) {
const skip = page.getByTestId('tour-skip')
if (await skip.isVisible({ timeout: 1500 }).catch(() => false)) {
await skip.click()
await expect(page.getByTestId('tour-overlay')).toBeHidden({ timeout: 5000 })
}
}
async function login(page: Page, username: string) {
await page.goto('/login')
await page.getByLabel('Username').fill(username)
await page.getByLabel('Password').fill(password)
await page.getByRole('button', { name: 'Sign In' }).click()
await expect(page).not.toHaveURL(/\/login$/, { timeout: 15_000 })
await dismissTourIfPresent(page)
}
async function openFirstQueueBatch(page: Page) {
await dismissTourIfPresent(page)
const row = page.locator('[data-testid="workstation-queue"] table tbody tr').first()
if ((await row.count()) === 0) {
const fallback = page.locator('main table tbody tr.cursor-pointer, main table tbody tr[class*="cursor-pointer"]').first()
if ((await fallback.count()) === 0) return false
await fallback.click({ force: true })
} else {
await row.click()
}
await page.waitForTimeout(500)
return /\/(entry|verification|approval)\/[^/]+/.test(page.url())
}
test.describe('Viewport smoke matrix', () => {
for (const vp of viewports) {
test(`entry1 @ ${vp.name} (${vp.width}x${vp.height})`, async ({ page }) => {
await page.setViewportSize({ width: vp.width, height: vp.height })
await login(page, 'entry1')
await expect(page).toHaveURL(new RegExp(roleHome.entry1))
const opened = await openFirstQueueBatch(page)
if (!opened) {
test.info().annotations.push({ type: 'note', description: 'No entry queue items' })
return
}
if (vp.width < 1280) {
const back = page.getByTestId('workstation-mobile-nav').getByRole('link')
await expect(back).toBeVisible()
await back.click()
await expect(page).toHaveURL(/\/entry\/?$/)
} else {
await expect(page.getByTestId('workstation-rail')).toBeVisible()
}
})
}
})
test.describe('Role-based smoke', () => {
for (const user of roleUsers) {
test(`${user} reaches role home`, async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 })
await login(page, user)
const home = roleHome[user] ?? '/'
await expect(page).toHaveURL(new RegExp(`${home.replace('/', '\\/')}(\\/|$)`))
})
}
})
test('intake compact recent uploads (no page overflow)', async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 })
await login(page, 'admin1')
await page.goto('/intake')
await expect(page.getByRole('heading', { name: 'Intake' })).toBeVisible()
const overflow = await page.evaluate(() => {
const doc = document.documentElement
return doc.scrollWidth > doc.clientWidth + 1
})
expect(overflow).toBe(false)
})
+46
View File
@@ -15,6 +15,7 @@
"vue-router": "^4.6.4"
},
"devDependencies": {
"@playwright/test": "^1.63.0",
"@types/jsdom": "^28.0.3",
"@types/node": "^24.13.2",
"@vitejs/plugin-vue": "^6.0.7",
@@ -486,6 +487,22 @@
"node": ">=14"
}
},
"node_modules/@playwright/test": {
"version": "1.63.0",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.63.0.tgz",
"integrity": "sha512-oxMK4vllB9RK5NQ2l1pq1IfOf2AvnEuj/vYGDj0H2nMtmtZpKtCwt/l00GEO6xjGfpBNAvjovvYdCm50dRQkpQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"playwright": "1.63.0"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/@rolldown/binding-android-arm64": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.3.tgz",
@@ -3004,6 +3021,35 @@
"node": ">= 6"
}
},
"node_modules/playwright": {
"version": "1.63.0",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.63.0.tgz",
"integrity": "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.63.0"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/playwright-core": {
"version": "1.63.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.63.0.tgz",
"integrity": "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"playwright-core": "cli.js"
},
"engines": {
"node": ">=20"
}
},
"node_modules/postcss": {
"version": "8.5.26",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz",
+4 -1
View File
@@ -8,7 +8,9 @@
"build": "vue-tsc -b && vite build",
"preview": "vite preview",
"test": "vitest",
"test:run": "vitest run"
"test:run": "vitest run",
"test:e2e": "playwright test",
"test:e2e:install": "playwright install chromium"
},
"dependencies": {
"@vueuse/core": "^14.3.0",
@@ -18,6 +20,7 @@
"vue-router": "^4.6.4"
},
"devDependencies": {
"@playwright/test": "^1.63.0",
"@types/jsdom": "^28.0.3",
"@types/node": "^24.13.2",
"@vitejs/plugin-vue": "^6.0.7",
@@ -0,0 +1,20 @@
import { defineConfig, devices } from '@playwright/test'
const baseURL = process.env.BASE_URL ?? 'http://127.0.0.1:3028'
export default defineConfig({
testDir: './e2e',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
timeout: 45_000,
reporter: 'list',
use: {
baseURL,
trace: 'on-first-retry',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
],
})
@@ -236,6 +236,18 @@ describe('useBatchStore', () => {
expect(store.currentDraft).toEqual(draft)
})
it('clears draft and sets error on failure', async () => {
mockedGet.mockRejectedValueOnce(new Error('Draft missing'))
const store = useBatchStore()
store.currentDraft = { patient: null, encounter: null, observations: [] } as never
await store.getDraft('b1')
expect(store.currentDraft).toBeNull()
expect(store.error).toBe('Draft missing')
expect(store.loading).toBe(false)
})
})
describe('saveDraftPatient', () => {
@@ -0,0 +1,25 @@
import { describe, expect, it } from 'vitest'
import { batchRouteForStatus } from '@/utils/batchRoute'
describe('batchRouteForStatus', () => {
const id = 'c1000000-0000-0000-0000-000000000004'
it('routes verification statuses', () => {
expect(batchRouteForStatus('PENDING_VERIFICATION', id)).toBe(`/verification/${id}`)
})
it('routes approval statuses', () => {
expect(batchRouteForStatus('VERIFIED', id)).toBe(`/approval/${id}`)
expect(batchRouteForStatus('AWAITING_CLINICAL_APPROVAL', id)).toBe(`/approval/${id}`)
})
it('routes entry statuses including rejects', () => {
expect(batchRouteForStatus('UPLOADED', id)).toBe(`/entry/${id}`)
expect(batchRouteForStatus('IN_ENTRY', id)).toBe(`/entry/${id}`)
expect(batchRouteForStatus('REJECTED', id)).toBe(`/entry/${id}`)
})
it('defaults unknown statuses to entry', () => {
expect(batchRouteForStatus('PROMOTED', id)).toBe(`/entry/${id}`)
})
})
@@ -92,6 +92,7 @@ beforeEach(() => {
assignToUserName: null,
isUsed: false,
batchId: null,
batchStatus: null,
createdAt: '2026-06-27T12:00:00Z',
usedAt: null,
},
@@ -204,6 +204,9 @@ describe('UsersView', () => {
await flushPromises()
await wrapper.get('[data-testid="user-row-entry1"] [data-testid="users-deactivate"]').trigger('click')
expect(wrapper.find('[data-testid="confirm-dialog"]').exists()).toBe(true)
await wrapper.get('[data-testid="confirm-ok"]').trigger('click')
await flushPromises()
expect(mockedPatch).toHaveBeenCalledWith('users/u1', { isActive: false })
+2 -2
View File
@@ -92,7 +92,7 @@
@apply flex flex-col min-h-0 overflow-hidden bg-surface;
}
.workstation-scan {
@apply flex flex-col min-h-[13rem] sm:min-h-[18rem] xl:min-h-0
@apply flex flex-col min-h-[13rem] sm:min-h-[18rem] max-h-[45vh] xl:max-h-none xl:min-h-0
p-3 xl:p-4 bg-canvas border-b xl:border-b-0 xl:border-r border-line;
}
.workstation-form {
@@ -213,6 +213,6 @@
/* Phase 17 — FHIR raw JSON panel */
.fhir-json-panel {
@apply bg-navy text-[#D1E0FF] text-[13px] leading-5 font-mono
p-4 rounded-input overflow-x-auto max-h-96 border border-navy;
p-4 rounded-input overflow-x-auto overflow-y-auto max-h-[50vh] sm:max-h-96 border border-navy;
}
}
@@ -138,7 +138,10 @@
</button>
<div class="flex items-center justify-end gap-3 sm:gap-4 min-w-0 ml-auto">
<span class="text-sm text-ink-secondary truncate max-w-[9rem] sm:max-w-none">
<span
class="text-sm text-ink-secondary truncate max-w-[9rem] sm:max-w-none"
:title="auth.userFullName"
>
{{ auth.userFullName }}
</span>
<button
@@ -1,45 +1,65 @@
<template>
<div
v-if="show"
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 px-4"
>
<div class="bg-white rounded-lg p-6 max-w-md w-full">
<h3 class="text-lg font-semibold mb-4">Assign Entry Clerk</h3>
<Teleport to="body">
<div
v-if="show"
class="fixed inset-0 z-[70] flex items-center justify-center bg-black/50 p-4"
role="dialog"
aria-modal="true"
aria-labelledby="assign-clerk-title"
data-testid="assign-clerk-dialog"
@keydown.esc.prevent="emit('close')"
@click.self="emit('close')"
>
<div
class="w-full max-w-md rounded-card border border-line bg-surface p-6 shadow-dialog"
@click.stop
>
<h3 id="assign-clerk-title" class="text-lg font-semibold text-ink-strong">
Assign Entry Clerk
</h3>
<p v-if="loading" class="text-sm text-gray-500 mb-4">Loading clerks...</p>
<div v-else class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">Entry Clerk</label>
<select v-model="selectedClerkId" class="form-input">
<option value="">Select entry clerk...</option>
<option v-for="clerk in clerks" :key="clerk.id" :value="clerk.id">
{{ clerk.fullName }} ({{ clerk.username }})
</option>
</select>
</div>
<p v-if="loading" class="mt-4 text-sm text-ink-secondary">Loading clerks...</p>
<div v-else class="mt-4">
<label for="assign-clerk-select" class="block text-sm font-semibold text-ink mb-2">
Entry Clerk
</label>
<select id="assign-clerk-select" v-model="selectedClerkId" class="form-input">
<option value="">Select entry clerk...</option>
<option v-for="clerk in clerks" :key="clerk.id" :value="clerk.id">
{{ clerk.fullName }} ({{ clerk.username }})
</option>
</select>
</div>
<div v-if="errorMessage" class="text-clinical-danger text-sm mb-4">
{{ errorMessage }}
</div>
<div class="flex flex-col-reverse sm:flex-row sm:justify-end gap-4">
<button
type="button"
@click="emit('close')"
class="px-4 py-2 text-gray-600 hover:text-gray-800"
<div
v-if="errorMessage"
class="mt-4 rounded-input bg-clinical-danger-bg border border-clinical-danger/20 px-3 py-2 text-sm text-clinical-danger"
role="alert"
>
Cancel
</button>
<button
type="button"
@click="confirm"
class="btn-primary"
:disabled="!selectedClerkId || loading"
>
Assign Batch
</button>
{{ errorMessage }}
</div>
<div class="mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end">
<button
type="button"
class="px-4 py-2 text-sm text-ink-secondary hover:text-ink-strong"
:disabled="assigning"
@click="emit('close')"
>
Cancel
</button>
<button
type="button"
class="btn-primary"
:disabled="!selectedClerkId || loading || assigning"
@click="confirm"
>
{{ assigning ? 'Assigning…' : 'Assign Batch' }}
</button>
</div>
</div>
</div>
</div>
</Teleport>
</template>
<script setup lang="ts">
@@ -50,6 +70,7 @@ import type { UserSummary } from '../types'
const props = defineProps<{
show: boolean
batchId: string | null
assigning?: boolean
}>()
const emit = defineEmits<{
@@ -89,7 +110,7 @@ watch(
)
function confirm(): void {
if (!props.batchId || !selectedClerkId.value) return
if (!props.batchId || !selectedClerkId.value || props.assigning) return
emit('assigned', props.batchId, selectedClerkId.value)
}
</script>
@@ -1,5 +1,5 @@
<template>
<div class="overflow-x-auto">
<div :class="compact ? 'min-w-0' : 'overflow-x-auto'">
<InlineError
v-if="error"
title="Could not load batches"
@@ -8,7 +8,7 @@
retry-label="Retry"
@retry="$emit('retry')"
/>
<SkeletonBlock v-else-if="loading" variant="table" :rows="5" />
<SkeletonBlock v-else-if="loading" variant="table" :rows="compact ? 3 : 5" />
<EmptyState
v-else-if="batches.length === 0"
:title="emptyTitle"
@@ -18,12 +18,59 @@
<slot name="emptyAction" />
</template>
</EmptyState>
<!-- Compact stacked list for narrow side panels -->
<ul v-else-if="compact" class="divide-y divide-line min-w-0" data-testid="batch-list-compact">
<li
v-for="batch in batches"
:key="batch.id"
class="py-3 first:pt-0 last:pb-0"
>
<button
type="button"
class="w-full min-w-0 text-left rounded-input hover:bg-primary-50 -mx-1 px-1 py-1 transition-colors"
@click="$emit('select', batch.id)"
>
<div class="flex items-start justify-between gap-2 min-w-0">
<div class="min-w-0">
<p class="text-sm font-semibold text-ink-strong truncate">
{{ formatBatchType(batch.batchType) }}
</p>
<p class="mt-0.5 font-mono text-[11px] text-ink-secondary truncate">
{{ batch.id.substring(0, 8) }}…
</p>
</div>
<StatusBadge :status="batch.status" class="shrink-0" />
</div>
<div class="mt-1.5 flex flex-wrap items-center gap-2 text-xs text-ink-secondary">
<span
:class="batch.track === 'BACKFILL'
? 'bg-primary-50 text-primary-800 border border-primary-100'
: 'bg-clinical-safe-bg text-clinical-safe border border-[#ABEFC6]'"
class="status-badge"
>
{{ batch.track === 'BACKFILL' ? 'Backfill' : 'Live' }}
</span>
<span class="tabular-nums">{{ formatCompactDate(batch.createdAt) }}</span>
</div>
</button>
<button
v-if="showAssign && batch.status === 'UPLOADED'"
type="button"
class="mt-2 text-primary-600 hover:text-primary-800 text-xs font-medium"
@click="$emit('assign', batch.id)"
>
Assign clerk
</button>
</li>
</ul>
<table v-else class="w-full min-w-[36rem] text-sm">
<thead>
<tr class="border-b text-left text-ink-secondary">
<th class="py-2 px-4">ID</th>
<th class="py-2 px-4">Type</th>
<th class="py-2 px-4">Track</th>
<th class="py-2 px-4 hidden sm:table-cell">Track</th>
<th class="py-2 px-4">Status</th>
<th class="py-2 px-4">Created</th>
<th v-if="showAssign" class="py-2 px-4">Actions</th>
@@ -38,7 +85,7 @@
>
<td class="py-2 px-4 font-mono text-xs">{{ batch.id.substring(0, 8) }}...</td>
<td class="py-2 px-4">{{ formatBatchType(batch.batchType) }}</td>
<td class="py-2 px-4">
<td class="py-2 px-4 hidden sm:table-cell">
<span
:class="batch.track === 'BACKFILL'
? 'bg-primary-50 text-primary-800 border border-primary-100'
@@ -51,8 +98,9 @@
<td class="py-2 px-4">
<StatusBadge :status="batch.status" />
</td>
<td class="py-2 px-4 text-ink-secondary">
{{ new Date(batch.createdAt).toLocaleString() }}
<td class="py-2 px-4 text-ink-secondary whitespace-nowrap">
<span class="sm:hidden">{{ formatCompactDate(batch.createdAt) }}</span>
<span class="hidden sm:inline">{{ new Date(batch.createdAt).toLocaleString() }}</span>
</td>
<td v-if="showAssign" class="py-2 px-4">
<button
@@ -82,6 +130,8 @@ withDefaults(
batches: BatchDetailResponse[]
loading: boolean
showAssign?: boolean
/** Stacked list for narrow panels (e.g. Intake sidebar) */
compact?: boolean
error?: string | null
emptyTitle?: string
emptyDescription?: string
@@ -89,6 +139,7 @@ withDefaults(
{
emptyTitle: 'No batches found.',
emptyDescription: undefined,
compact: false,
}
)
@@ -101,4 +152,12 @@ defineEmits<{
function formatBatchType(type: string): string {
return type.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())
}
function formatCompactDate(value: string): string {
return new Date(value).toLocaleDateString(undefined, {
month: 'short',
day: 'numeric',
year: 'numeric',
})
}
</script>
@@ -2,12 +2,13 @@
<Teleport to="body">
<div
v-if="open"
class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"
class="fixed inset-0 z-[70] flex items-center justify-center bg-black/50 p-4"
role="dialog"
aria-modal="true"
:aria-labelledby="titleId"
data-testid="confirm-dialog"
@keydown.esc.prevent="$emit('cancel')"
@click.self="$emit('cancel')"
>
<div
class="w-full max-w-md rounded-card border border-line bg-surface p-6 shadow-dialog"
@@ -23,7 +24,8 @@
<div class="mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end">
<button
type="button"
class="px-4 py-2 text-sm text-ink-secondary hover:text-ink-strong"
class="px-4 py-2 text-sm text-ink-secondary hover:text-ink-strong disabled:opacity-50 disabled:cursor-not-allowed"
:disabled="confirmLoading"
@click="$emit('cancel')"
>
{{ cancelLabel }}
@@ -31,10 +33,10 @@
<button
type="button"
:class="variant === 'danger' ? 'btn-danger' : 'btn-primary'"
:disabled="confirmDisabled"
:disabled="confirmDisabled || confirmLoading"
@click="$emit('confirm')"
>
{{ confirmLabel }}
{{ confirmLoading ? confirmLoadingLabel : confirmLabel }}
</button>
</div>
</div>
@@ -54,12 +56,16 @@ withDefaults(
cancelLabel?: string
variant?: 'primary' | 'danger'
confirmDisabled?: boolean
confirmLoading?: boolean
confirmLoadingLabel?: string
}>(),
{
confirmLabel: 'Confirm',
cancelLabel: 'Cancel',
variant: 'primary',
confirmDisabled: false,
confirmLoading: false,
confirmLoadingLabel: 'Working…',
}
)
@@ -2,7 +2,7 @@
<Teleport to="body">
<div
v-if="open"
class="fixed inset-0 z-50 flex justify-end"
class="fixed inset-0 z-40 flex justify-end"
data-testid="help-panel"
>
<div
@@ -105,7 +105,7 @@
<iframe
v-if="isPdf"
:src="url"
class="scan-page w-[800px] h-[1100px] bg-white"
class="scan-page w-full max-w-[800px] aspect-[8/11] h-auto sm:w-[800px] sm:h-[1100px] sm:aspect-auto bg-white"
frameborder="0"
title="Scanned document"
/>
@@ -132,6 +132,7 @@
<script setup lang="ts">
import { ref, computed, watch, nextTick } from 'vue'
import { useResizeObserver } from '@vueuse/core'
import SkeletonBlock from './SkeletonBlock.vue'
import InlineError from './InlineError.vue'
import EmptyState from './EmptyState.vue'
@@ -242,6 +243,12 @@ watch(
}
}
)
useResizeObserver(viewerContainer, () => {
if (props.url && !props.loading && !props.error) {
fitWidth()
}
})
</script>
<style scoped>
@@ -1,5 +1,5 @@
<template>
<div class="fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full pointer-events-none">
<div class="fixed top-16 right-4 z-[60] sm:top-4 flex flex-col gap-2 max-w-sm w-full pointer-events-none px-2 sm:px-0">
<transition-group name="toast">
<div
v-for="toast in toasts"
@@ -4,27 +4,68 @@
data-testid="workstation-action-bar"
data-tour="workstation-action-bar"
>
<div
class="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between"
>
<div class="flex flex-wrap items-center gap-2 min-w-0">
<div class="flex flex-wrap items-center gap-2 sm:justify-between">
<details
v-if="hasSecondaryActions"
class="relative sm:hidden"
data-testid="workstation-action-bar-menu"
>
<summary
class="btn-secondary list-none cursor-pointer text-sm [&::-webkit-details-marker]:hidden"
>
More actions
</summary>
<div
class="absolute bottom-full left-0 z-20 mb-2 flex min-w-[11rem] flex-col gap-2 rounded-input border border-line bg-surface p-2 shadow-dialog"
>
<slot name="left" />
<slot name="center" />
<slot name="right" />
</div>
</details>
<div v-else class="flex flex-wrap items-center gap-2 min-w-0 sm:hidden">
<slot name="left" />
</div>
<div class="flex flex-wrap items-center gap-2 min-w-0 sm:justify-center">
<slot name="center" />
</div>
<div class="flex flex-wrap items-center gap-2 sm:justify-end">
<div class="hidden sm:flex flex-wrap items-center gap-2 min-w-0">
<slot name="left" />
<slot name="center" />
</div>
<div class="ml-auto flex flex-wrap items-center gap-2 sm:justify-end">
<slot name="primary" />
<slot name="right" />
<div class="hidden sm:contents">
<slot name="right" />
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { Comment, computed, useSlots } from 'vue'
/**
* Sticky bottom action bar for Entry / Verification / Approval workstations.
* Wire into forms in Phase 16. Slots: left (Reject), center (Save Draft),
* primary (Submit…), right (Next). Prefer btn-primary / btn-danger / btn-secondary.
* On narrow viewports, secondary actions (left/center/right) collapse into a menu;
* primary submit stays visible.
*/
const slots = useSlots()
function slotHasContent(name: 'left' | 'center' | 'right'): boolean {
const nodes = slots[name]?.() ?? []
return nodes.some(
(node) =>
node.type !== Comment &&
!(typeof node.type === 'symbol' && String(node.type).includes('v-cmt')),
)
}
const hasSecondaryActions = computed(
() =>
slotHasContent('left') ||
slotHasContent('center') ||
slotHasContent('right'),
)
</script>
@@ -23,6 +23,38 @@
>
<slot name="rail" />
</aside>
<!-- Below xl the rail is hidden; keep an explicit path back to the queue -->
<div
v-if="queuePath"
class="xl:hidden col-span-full flex flex-wrap items-center gap-3 border-b border-line bg-surface px-3 py-2 sm:px-4"
data-testid="workstation-mobile-nav"
>
<RouterLink
:to="queuePath"
class="inline-flex items-center gap-1.5 text-sm font-medium text-primary-700 hover:text-primary-800 shrink-0"
>
<span aria-hidden="true">←</span>
{{ queueLabel }}
</RouterLink>
<label
v-if="showMobileBatchSwitcher"
class="flex min-w-0 flex-1 items-center gap-2 sm:max-w-xs"
>
<span class="sr-only">Switch batch in queue</span>
<select
class="form-input min-w-0 flex-1 py-1.5 text-sm"
data-testid="workstation-mobile-batch-select"
:value="selectedBatchId"
@change="onMobileBatchChange"
>
<option v-for="item in queueBatches" :key="item.id" :value="item.id">
{{ item.label }}
</option>
</select>
</label>
</div>
<section
class="workstation-scan min-h-0 min-w-0"
data-testid="workstation-scan"
@@ -44,12 +76,50 @@
<script setup lang="ts">
import { computed, useSlots } from 'vue'
import { RouterLink } from 'vue-router'
const props = defineProps<{
/** When false, render full-width queue slot only */
hasBatch: boolean
export type WorkstationQueueBatchOption = {
id: string
label: string
}
const props = withDefaults(
defineProps<{
/** When false, render full-width queue slot only */
hasBatch: boolean
/** Queue list route shown on viewports where the rail is hidden */
queuePath?: string
queueLabel?: string
/** Compact batch switcher below xl when rail is hidden */
queueBatches?: WorkstationQueueBatchOption[]
selectedBatchId?: string
}>(),
{
queuePath: undefined,
queueLabel: 'Back to queue',
queueBatches: () => [],
selectedBatchId: undefined,
},
)
const emit = defineEmits<{
(e: 'select-batch', batchId: string): void
}>()
const slots = useSlots()
const showRail = computed(() => props.hasBatch && !!slots.rail)
const showMobileBatchSwitcher = computed(
() =>
props.hasBatch &&
!!props.selectedBatchId &&
(props.queueBatches?.length ?? 0) > 0,
)
function onMobileBatchChange(event: Event) {
const id = (event.target as HTMLSelectElement).value
if (id && id !== props.selectedBatchId) {
emit('select-batch', id)
}
}
</script>
@@ -289,13 +289,19 @@ async function assignBatch(batchId: string, entryClerkUserId: string): Promise<v
async function getDraft(batchId: string): Promise<void> {
loading.value = true
error.value = null
currentDraft.value = null
try {
const response = await get<BatchDraft>(
`digitization-batches/${batchId}/draft`
)
if (response.success && response.data) {
currentDraft.value = response.data
} else {
error.value = response.error?.message ?? 'Failed to load draft'
}
} catch (e: unknown) {
error.value = e instanceof Error ? e.message : 'Failed to load draft'
} finally {
loading.value = false
}
@@ -392,6 +398,7 @@ async function assignBatch(batchId: string, entryClerkUserId: string): Promise<v
if (response.success && response.data) {
return response.data
}
error.value = response.error?.message ?? 'Failed to load patient history'
return null
} catch (e: unknown) {
error.value = e instanceof Error ? e.message : 'Failed to load patient history'
+1
View File
@@ -223,6 +223,7 @@ export interface CoverSheetResponse {
assignToUserName: string | null
isUsed: boolean
batchId: string | null
batchStatus: string | null
createdAt: string
usedAt: string | null
}
@@ -0,0 +1,18 @@
/** Workstation route for a batch based on its pipeline status. */
export function batchRouteForStatus(status: string, batchId: string): string {
const normalized = status.toUpperCase()
switch (normalized) {
case 'PENDING_VERIFICATION':
return `/verification/${batchId}`
case 'VERIFIED':
case 'AWAITING_CLINICAL_APPROVAL':
return `/approval/${batchId}`
case 'UPLOADED':
case 'IN_ENTRY':
case 'REJECTED':
return `/entry/${batchId}`
default:
// Terminal / unknown statuses: open entry workstation (read path / draft view)
return `/entry/${batchId}`
}
}
@@ -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()
+51 -8
View File
@@ -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)
+29 -2
View File
@@ -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,
@@ -0,0 +1,4 @@
{
"status": "passed",
"failedTests": []
}
+3 -3
View File
@@ -13,13 +13,13 @@ export default defineConfig({
port: 3028,
proxy: {
'/api': {
target: 'http://localhost:5217',
target: process.env.VITE_API_PROXY ?? 'http://localhost:5217',
changeOrigin: true,
},
'/fhir': {
target: 'http://localhost:5217',
target: process.env.VITE_API_PROXY ?? 'http://localhost:5217',
changeOrigin: true,
},
},
},
})
})
+2
View File
@@ -13,5 +13,7 @@ export default defineConfig({
environment: 'jsdom',
globals: true,
setupFiles: ['./src/__tests__/setup.ts'],
exclude: ['**/node_modules/**', '**/e2e/**', '**/dist/**'],
},
})