implemented time tracking by clicking symbol at task.
next: stop running time, display running time in header Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -26,8 +26,15 @@
|
||||
router.navigate(`/task/${task.id}/add_subtask`);
|
||||
}
|
||||
|
||||
function addTime(){
|
||||
router.navigate(`/time/add_task/${task.id}`);
|
||||
async function addTime(){
|
||||
const url = api(`time/track_task/${task.id}`);
|
||||
const resp = await fetch(url,{credentials:'include'}); // create new time or return time with assigned tasks
|
||||
if (resp.ok) {
|
||||
const track = await resp.json();
|
||||
console.log(track);
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteTask(){
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let { task_id } = $props();
|
||||
|
||||
async function addTask(){
|
||||
const url = api(`time/track_task/${task_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'}); // create new time or return time with assigned tasks
|
||||
}
|
||||
|
||||
onMount(addTask)
|
||||
</script>
|
||||
|
||||
{t('timetracking')}
|
||||
@@ -30,28 +30,29 @@
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
{#if times}
|
||||
<table>
|
||||
<table class="timetracks">
|
||||
<thead>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Object.entries(times) as [tid,time]}
|
||||
<tr>
|
||||
<td>
|
||||
{time.start_time}…{time.end_time}
|
||||
<td class="start_end">
|
||||
{time.start_time}{#if time.end_time}…{time.end_time}{/if}
|
||||
</td>
|
||||
<td>
|
||||
{time.duration} h
|
||||
<td class="duration">{#if time.duration}
|
||||
{time.duration.toFixed(3)} h
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<td class="subject">
|
||||
{time.subject}
|
||||
</td>
|
||||
<td>
|
||||
<td class="tasks">
|
||||
{#each Object.entries(time.tasks) as [tid,task]}
|
||||
<a href="#" onclick={e => openTask(tid)}>{task}</a>
|
||||
{/each}
|
||||
</td>
|
||||
<td>
|
||||
<td class="state">
|
||||
{t("state_"+time.state.name.toLowerCase())}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user