working on time tracking index
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let error = $state(null);
|
||||
let times = $state(null);
|
||||
|
||||
async function loadTimes(){
|
||||
const url = api('time');
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
times = await resp.json();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
@@ -20,4 +22,28 @@
|
||||
<h1>{t('timetracking')}</h1>
|
||||
{#if error}
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
{#if times}
|
||||
<table>
|
||||
<thead>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Object.entries(times) as [tid,time]}
|
||||
<tr>
|
||||
<td>
|
||||
{time.start_time}…{time.end_time}
|
||||
</td>
|
||||
<td>
|
||||
{time.subject}
|
||||
</td>
|
||||
<td>
|
||||
{#each time.task_ids as tid}
|
||||
{tid}
|
||||
{/each}
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user