working on time tracking index
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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