Browse Source

working on time tracking index

feature/brute_force_protection
Stephan Richter 3 months ago
parent
commit
ad3634e811
  1. 1
      core/src/main/java/de/srsoftware/umbrella/core/Constants.java
  2. 1
      core/src/main/java/de/srsoftware/umbrella/core/model/Time.java
  3. 26
      frontend/src/routes/time/Index.svelte

1
core/src/main/java/de/srsoftware/umbrella/core/Constants.java

@ -154,6 +154,7 @@ public class Constants { @@ -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";

1
core/src/main/java/de/srsoftware/umbrella/core/model/Time.java

@ -107,6 +107,7 @@ public class Time implements Mappable{ @@ -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;
}
}

26
frontend/src/routes/time/Index.svelte

@ -4,11 +4,13 @@ @@ -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();
}
@ -21,3 +23,27 @@ @@ -21,3 +23,27 @@
{#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}
Loading…
Cancel
Save