+
{#each formData.Tests as test, index (test.TestSiteID)}
-
-
-
- {index + 1}
-
-
-
Test Site ID
-
{test.TestSiteID}
-
+
+
+ {#if test.TestSiteCode}
+ {test.TestSiteCode}
+ {:else}
+ ID:{test.TestSiteID}
+ {/if}
+
+ {test.TestSiteName || `Test #${test.TestSiteID}`}
+
{/each}
{:else}
-
+
No tests added yet
-
Enter a Test Site ID and click Add
+
Search and select tests above
{/if}
@@ -462,3 +516,10 @@
{/snippet}
+
+
+
diff --git a/src/routes/(app)/reports/+page.svelte b/src/routes/(app)/reports/+page.svelte
new file mode 100644
index 0000000..53abe47
--- /dev/null
+++ b/src/routes/(app)/reports/+page.svelte
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+ Lab Reports
+
+
+ Total: {totalItems} orders
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {#if loading}
+
+
+
+ {:else if orders.length === 0}
+
+ {:else}
+
+
+
+
+ | Order ID |
+ Patient ID |
+ Visit ID |
+ Status |
+ Priority |
+ Created |
+ Actions |
+
+
+
+ {#each orders as order}
+
+ | {order.OrderID} |
+ {order.InternalPID || '-'} |
+ {order.PatVisitID || '-'} |
+
+
+ {getStatusLabel(order.OrderStatus)}
+
+ |
+
+ {#if order.Priority === 'U'}
+ Urgent
+ {:else if order.Priority === 'S'}
+ Stat
+ {:else}
+ Routine
+ {/if}
+ |
+
+ {order.CreateDate ? new Date(order.CreateDate).toLocaleDateString() : '-'}
+ |
+
+
+
+
+
+ |
+
+ {/each}
+
+
+
+
+
+ {#if totalPages > 1}
+
+
+
+
+ Page {currentPage} of {totalPages}
+
+
+
+
+ {/if}
+ {/if}
+
+
+
+
+
+
+
Order Status Pipeline
+
+ {#each orderStatuses as status}
+
+ {status.label}
+
+ {/each}
+
+
+
+
+
+
+{#if showReportModal && selectedOrderId}
+
+{/if}
diff --git a/src/routes/(app)/reports/ReportViewerModal.svelte b/src/routes/(app)/reports/ReportViewerModal.svelte
new file mode 100644
index 0000000..192b507
--- /dev/null
+++ b/src/routes/(app)/reports/ReportViewerModal.svelte
@@ -0,0 +1,137 @@
+
+
+
+ {#snippet children()}
+
+
+
+
+
+ Order: {orderId}
+
+
+
+
+
+
+ {#if loading}
+
+ {/if}
+
+ {#if error}
+
+
+
+
+
+
Report Error
+
{error}
+
Note: Reports are only available for orders that have been reported (REP status)
+
+
+ {:else}
+
+ {/if}
+
+
+ {/snippet}
+
+ {#snippet footer()}
+
+
+ {/snippet}
+
diff --git a/src/routes/(app)/results/+page.svelte b/src/routes/(app)/results/+page.svelte
new file mode 100644
index 0000000..9459bc3
--- /dev/null
+++ b/src/routes/(app)/results/+page.svelte
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+
+ Results Entry
+
+
+ Total: {totalItems} orders
+
+
+
+
+
+
+
+
+ Order ID
+
+
+
+
+ Patient ID
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {#if loading}
+
+
+
+ {:else if orders.length === 0}
+
+ {:else}
+
+
+
+
+ | Order ID |
+ Patient |
+ Order Date |
+ Status |
+ Priority |
+ Tests |
+ Actions |
+
+
+
+ {#each orders as order (order.OrderID)}
+ {@const statusInfo = getStatusInfo(order.OrderStatus)}
+ {@const priorityInfo = getPriorityInfo(order.Priority)}
+ {@const testCount = order.Tests?.length || 0}
+ {@const pendingCount = order.Tests?.filter(t => !t.Result || t.Result === '').length || 0}
+
+ | {order.OrderID} |
+
+
+ {order.PatientName || '-'}
+ ID: {order.InternalPID}
+
+ |
+
+ {order.OrderDateTime ? new Date(order.OrderDateTime).toLocaleDateString() : '-'}
+ |
+
+ {statusInfo.label}
+ |
+
+ {priorityInfo.label}
+ |
+
+
+ {testCount}
+ {#if pendingCount > 0}
+ ({pendingCount} pending)
+ {:else}
+
+ {/if}
+
+ |
+
+
+ |
+
+ {/each}
+
+
+
+
+
+ {#if totalPages > 1}
+
+
+
+
+ Page {currentPage} of {totalPages}
+
+
+
+
+ {/if}
+ {/if}
+
+
+
+
+
+{#if showEntryModal && selectedOrder}
+
+{/if}
diff --git a/src/routes/(app)/results/ResultEntryModal.svelte b/src/routes/(app)/results/ResultEntryModal.svelte
new file mode 100644
index 0000000..bceceea
--- /dev/null
+++ b/src/routes/(app)/results/ResultEntryModal.svelte
@@ -0,0 +1,301 @@
+
+
+
+ {#snippet children()}
+
+
+
+
+
+
+
+ {order?.PatientName || 'Unknown'}
+ (ID: {order?.InternalPID})
+
+
+
+ {order?.Tests?.length || 0} tests
+
+
+
+ {#if pendingCount > 0}
+ {pendingCount} pending
+ {/if}
+ {#if savedCount > 0}
+ {savedCount} saved
+ {/if}
+
+
+
+
+
+
+
+
+
+
+ H
+ High
+
+
+ L
+ Low
+
+
+
+ Normal
+
+
+ Press Enter to move to next field
+
+
+
+
+ {#if formLoading && saveProgress.total > 0}
+
+
+ Saving {saveProgress.current} of {saveProgress.total}...
+
+ {/if}
+
+ {/snippet}
+
+ {#snippet footer()}
+
+
+ {/snippet}
+
diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte
index 3862bb2..3ffb95f 100644
--- a/src/routes/login/+page.svelte
+++ b/src/routes/login/+page.svelte
@@ -62,7 +62,13 @@
try {
const response = await login(username, password);
- auth.login(response.token, response.user);
+
+ // Cookie is set by backend, now fetch user data
+ const isAuthenticated = await auth.checkAuth();
+
+ if (!isAuthenticated) {
+ throw new Error('Failed to verify authentication');
+ }
if (rememberMe) {
localStorage.setItem('clqms_username', username);
@@ -72,7 +78,7 @@
localStorage.setItem('clqms_remember', 'false');
}
- goto('/dashboard');
+ await goto('/dashboard');
} catch (err) {
error = err.message || 'Login failed. Please try again.';
} finally {