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 TABLE_SETTINGS = "settings";
|
||||||
public static final String TAGS = "tags";
|
public static final String TAGS = "tags";
|
||||||
|
public static final String TASK_IDS = "task_ids";
|
||||||
public static final String TAX = "tax";
|
public static final String TAX = "tax";
|
||||||
public static final String TEMPLATE = "template";
|
public static final String TEMPLATE = "template";
|
||||||
public static final String TEXT = "text";
|
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(END_TIME,end.toString().replace("T"," "));
|
||||||
map.put(STATE,Map.of(STATUS_CODE,state.code,NAME,state.name()));
|
map.put(STATE,Map.of(STATUS_CODE,state.code,NAME,state.name()));
|
||||||
map.put(DURATION,Duration.between(start,end).toMinutes()/60d);
|
map.put(DURATION,Duration.between(start,end).toMinutes()/60d);
|
||||||
|
map.put(TASK_IDS,taskIds);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
let error = $state(null);
|
let error = $state(null);
|
||||||
|
let times = $state(null);
|
||||||
|
|
||||||
async function loadTimes(){
|
async function loadTimes(){
|
||||||
const url = api('time');
|
const url = api('time');
|
||||||
const resp = await fetch(url,{credentials:'include'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
|
times = await resp.json();
|
||||||
} else {
|
} else {
|
||||||
error = await resp.text();
|
error = await resp.text();
|
||||||
}
|
}
|
||||||
@@ -21,3 +23,27 @@
|
|||||||
{#if error}
|
{#if error}
|
||||||
<span class="error">{error}</span>
|
<span class="error">{error}</span>
|
||||||
{/if}
|
{/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