|
|
|
@ -7,6 +7,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
import TimeEditor from '../../Components/TimeRecordEditor.svelte'; |
|
|
|
import TimeEditor from '../../Components/TimeRecordEditor.svelte'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let docLinks = $state(null); |
|
|
|
let error = $state(null); |
|
|
|
let error = $state(null); |
|
|
|
let router = useTinyRouter(); |
|
|
|
let router = useTinyRouter(); |
|
|
|
let times = $state(null); |
|
|
|
let times = $state(null); |
|
|
|
@ -85,9 +86,10 @@ |
|
|
|
const resp = await fetch(url,{credentials:'include'}); |
|
|
|
const resp = await fetch(url,{credentials:'include'}); |
|
|
|
if (resp.ok){ |
|
|
|
if (resp.ok){ |
|
|
|
var json = await resp.json(); |
|
|
|
var json = await resp.json(); |
|
|
|
times = json.times; |
|
|
|
times = json.times; |
|
|
|
tasks = json.tasks; |
|
|
|
tasks = json.tasks; |
|
|
|
projects = json.projects; |
|
|
|
projects = json.projects; |
|
|
|
|
|
|
|
docLinks = json.documents; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
error = await resp.text(); |
|
|
|
error = await resp.text(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -97,6 +99,14 @@ |
|
|
|
detail = null; |
|
|
|
detail = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onclick(e){ |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
let href = e.target.getAttribute('href'); |
|
|
|
|
|
|
|
if (href) router.navigate(href); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function onDrop(time_id){ |
|
|
|
async function onDrop(time_id){ |
|
|
|
const url = api(`time/${time_id}`); |
|
|
|
const url = api(`time/${time_id}`); |
|
|
|
const res = await fetch(url,{ |
|
|
|
const res = await fetch(url,{ |
|
|
|
@ -226,9 +236,9 @@ |
|
|
|
{#if tasks[tid]} |
|
|
|
{#if tasks[tid]} |
|
|
|
<li> |
|
|
|
<li> |
|
|
|
{#if tasks[tid] && projects[tasks[tid].project_id]} |
|
|
|
{#if tasks[tid] && projects[tasks[tid].project_id]} |
|
|
|
<a href="#" onclick={e => openProject(tasks[tid].project_id)}>{projects[tasks[tid].project_id].name}</a> / |
|
|
|
<a href="/project/{tasks[tid].project_id}/view" {onclick}>{projects[tasks[tid].project_id].name}</a> / |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
<a href="#" onclick={e => openTask(tid)}>{tasks[tid].name}</a> |
|
|
|
<a href="/task/{tid}/view" {onclick}>{tasks[tid].name}</a> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
{/each} |
|
|
|
{/each} |
|
|
|
@ -236,6 +246,15 @@ |
|
|
|
</td> |
|
|
|
</td> |
|
|
|
<td class="state" onclick={e => {detail = time.id}}> |
|
|
|
<td class="state" onclick={e => {detail = time.id}}> |
|
|
|
{t("state_"+time.state.name.toLowerCase())} |
|
|
|
{t("state_"+time.state.name.toLowerCase())} |
|
|
|
|
|
|
|
{#if time.state.name.toLowerCase() == 'pending' && docLinks[time.id]} |
|
|
|
|
|
|
|
<ul> |
|
|
|
|
|
|
|
{#each Object.entries(docLinks[time.id]) as [a,b]} |
|
|
|
|
|
|
|
<li> |
|
|
|
|
|
|
|
<a href="/document/{a}/view" {onclick}>{b}</a> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
{/each} |
|
|
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
{/if} |
|
|
|
</td> |
|
|
|
</td> |
|
|
|
{/if} |
|
|
|
{/if} |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
|