working on time tracking index

This commit is contained in:
2025-08-18 01:30:36 +02:00
parent 8bb44d0d7f
commit ad3634e811
3 changed files with 28 additions and 0 deletions

View File

@@ -154,6 +154,7 @@ public class Constants {
public static final String TABLE_SETTINGS = "settings";
public static final String TAGS = "tags";
public static final String TASK_IDS = "task_ids";
public static final String TAX = "tax";
public static final String TEMPLATE = "template";
public static final String TEXT = "text";

View File

@@ -107,6 +107,7 @@ public class Time implements Mappable{
map.put(END_TIME,end.toString().replace("T"," "));
map.put(STATE,Map.of(STATUS_CODE,state.code,NAME,state.name()));
map.put(DURATION,Duration.between(start,end).toMinutes()/60d);
map.put(TASK_IDS,taskIds);
return map;
}
}

View File

@@ -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}&nbsp;
{/each}
</td>
</tr>
{/each}
</tbody>
</table>
{/if}