added links to documents to time track list
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import TimeEditor from '../../Components/TimeRecordEditor.svelte';
|
||||
|
||||
let docLinks = $state(null);
|
||||
let error = $state(null);
|
||||
let router = useTinyRouter();
|
||||
let times = $state(null);
|
||||
@@ -85,9 +86,10 @@
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
var json = await resp.json();
|
||||
times = json.times;
|
||||
tasks = json.tasks;
|
||||
times = json.times;
|
||||
tasks = json.tasks;
|
||||
projects = json.projects;
|
||||
docLinks = json.documents;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
@@ -97,6 +99,14 @@
|
||||
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){
|
||||
const url = api(`time/${time_id}`);
|
||||
const res = await fetch(url,{
|
||||
@@ -226,9 +236,9 @@
|
||||
{#if tasks[tid]}
|
||||
<li>
|
||||
{#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}
|
||||
<a href="#" onclick={e => openTask(tid)}>{tasks[tid].name}</a>
|
||||
<a href="/task/{tid}/view" {onclick}>{tasks[tid].name}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
@@ -236,6 +246,15 @@
|
||||
</td>
|
||||
<td class="state" onclick={e => {detail = time.id}}>
|
||||
{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>
|
||||
{/if}
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user