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:
@@ -28,7 +28,6 @@
|
||||
import TagUses from "./routes/tags/TagUses.svelte";
|
||||
import TaskList from "./routes/task/Index.svelte";
|
||||
import Times from "./routes/time/Index.svelte";
|
||||
import TimeTask from "./routes/time/AddTask.svelte";
|
||||
import User from "./routes/user/User.svelte";
|
||||
import ViewDoc from "./routes/document/View.svelte";
|
||||
import ViewPrj from "./routes/project/View.svelte";
|
||||
@@ -77,7 +76,6 @@
|
||||
<Route path="/task/:id/edit" component={ViewTask} />
|
||||
<Route path="/task/:id/view" component={ViewTask} />
|
||||
<Route path="/time" component={Times} />
|
||||
<Route path="/time/add_task/:task_id" component={TimeTask} />
|
||||
<Route path="/user" component={User} />
|
||||
<Route path="/user/create" component={EditUser} />
|
||||
<Route path="/user/login" component={User} />
|
||||
|
||||
@@ -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