Fix mobile queue navigation, draft/loading states, and Intake overflow; seed MinIO demo PDFs so document viewing does not 500; add e2e smoke coverage.
117 lines
3.3 KiB
Vue
117 lines
3.3 KiB
Vue
<template>
|
|
<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="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="mt-4 rounded-input bg-clinical-danger-bg border border-clinical-danger/20 px-3 py-2 text-sm text-clinical-danger"
|
|
role="alert"
|
|
>
|
|
{{ 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>
|
|
</Teleport>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, watch } from 'vue'
|
|
import { get } from '../api/client'
|
|
import type { UserSummary } from '../types'
|
|
|
|
const props = defineProps<{
|
|
show: boolean
|
|
batchId: string | null
|
|
assigning?: boolean
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
close: []
|
|
assigned: [batchId: string, clerkUserId: string]
|
|
}>()
|
|
|
|
const clerks = ref<UserSummary[]>([])
|
|
const selectedClerkId = ref('')
|
|
const loading = ref(false)
|
|
const errorMessage = ref('')
|
|
|
|
watch(
|
|
() => props.show,
|
|
async (visible) => {
|
|
if (!visible) return
|
|
|
|
selectedClerkId.value = ''
|
|
errorMessage.value = ''
|
|
loading.value = true
|
|
|
|
try {
|
|
const response = await get<UserSummary[]>('users', { role: 'DATA_ENTRY_CLERK' })
|
|
if (response.success && response.data) {
|
|
clerks.value = response.data
|
|
} else {
|
|
clerks.value = []
|
|
errorMessage.value = response.error?.message ?? 'Failed to load entry clerks'
|
|
}
|
|
} catch (e: unknown) {
|
|
clerks.value = []
|
|
errorMessage.value = e instanceof Error ? e.message : 'Failed to load entry clerks'
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
)
|
|
|
|
function confirm(): void {
|
|
if (!props.batchId || !selectedClerkId.value || props.assigning) return
|
|
emit('assigned', props.batchId, selectedClerkId.value)
|
|
}
|
|
</script>
|