Implement changes from TaskService.

This commit is contained in:
themodrnhakr 2025-09-29 21:13:26 -05:00
parent 5bc27f6061
commit 9c219054d3
2 changed files with 60 additions and 46 deletions

View File

@ -1,36 +1,36 @@
<script lang="ts"> <script lang="ts">
import type { PageProps } from "./$types"; import type { PageProps } from "./$types";
let { data }: PageProps = $props(); let { data }: PageProps = $props();
</script> </script>
{#if data.tasks.status === "ok" && data.tasks.tasks !== undefined} {#if data.tasks.status === "ok" && data.tasks.data !== undefined}
<p>{data.tasks.tasks.length} total records.</p> <p>{data.tasks.data.length} total records.</p>
<table> <table>
<thead> <thead>
<tr> <tr>
<td><strong>Id</strong></td> <td><strong>Id</strong></td>
<td><strong>Description</strong></td> <td><strong>Description</strong></td>
<td><strong>Status</strong></td> <td><strong>Status</strong></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{#each data.tasks.tasks as task (task.id)} {#each data.tasks.data as task (task.id)}
<tr> <tr>
<td> <td>
<a <a href={`/tasks/${task.type.prefix}${task.taskId}`}>
href={`/tasks/${task.type.prefix}${task.taskId}`} {
> task.type?.prefix
{task.type?.prefix + + task.taskId
task.taskId} }
</a> </a>
</td> </td>
<td>{task.description}</td> <td>{task.description}</td>
<td>{task.status}</td> <td>{task.status}</td>
</tr> </tr>
{/each} {/each}
</tbody> </tbody>
</table> </table>
{:else} {:else}
<p>There was an error accessing the database.</p> <p>There was an error accessing the database.</p>
{/if} {/if}

View File

@ -1,23 +1,37 @@
<script lang="ts"> <script lang="ts">
import type { PageProps } from "./$types"; import type { PageProps } from "./$types";
let { data }: PageProps = $props(); let { data }: PageProps = $props();
const task = data.task.tasks[0];
</script> </script>
<h1>{`[[${task.type.prefix}${task.taskId}]] - ${task.description}`}</h1> {#if data.task.status === "ok"}
<div class="container"> {@const task = data.task.data[0]}
<p><strong>{task.status}</strong></p> {#if task}
<p><strong>{task.priority}</strong></p> <h1>
</div> {`[[${task.type.prefix}${task.taskId}]] - ${task.description}`}
<div> </h1>
<h2>Body</h2> <div class="container">
<p>{task.body}</p> <p><strong>{task.status}</strong></p>
</div> <p><strong>{task.priority}</strong></p>
</div>
<div>
<h2>Body</h2>
<p>{task.body}</p>
</div>
{:else}
<p>Task not found.</p>
{/if}
{:else if data.task.status === "failure"}
<h2>Error Loading Task</h2>
<p>{data.task.error}</p>
{#if data.task.code}
<p>Error code: {data.task.code}</p>
{/if}
{/if}
<style> <style>
.container { .container {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
} }
</style> </style>