Merge branch 'module/timetracking' into dev
This commit is contained in:
@@ -10,12 +10,15 @@
|
||||
|
||||
import TimeEditor from '../../Components/TimeRecordEditor.svelte';
|
||||
|
||||
let detail = $state(null);
|
||||
let docLinks = $state(null);
|
||||
let router = useTinyRouter();
|
||||
|
||||
let times = $state(null);
|
||||
let tasks = {};
|
||||
let projects = {};
|
||||
let detail = $state(null);
|
||||
let project_filter = $state(null);
|
||||
if (router.hasQueryParam('project')) project_filter = router.getQueryParam('project');
|
||||
let sortedTimes = $derived.by(() => Object.values(times).map(time => ({
|
||||
...time,
|
||||
start: display(time.start_time),
|
||||
@@ -114,6 +117,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function match_prj_filter(time){
|
||||
if (!project_filter) return true;
|
||||
for (var tid of time.task_ids){
|
||||
if (project_filter == tasks[tid].project_id) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function onAbort(){
|
||||
detail = null;
|
||||
}
|
||||
@@ -217,6 +228,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each sortedTimes as time,line}
|
||||
{#if match_prj_filter(time)}
|
||||
<tr class={selected[time.id]?'selected':''}>
|
||||
{#if timeMap.years[line]}
|
||||
<td class="year" rowspan={timeMap.years[line]} onclick={e => toggleRange(time.start.substring(0,4))}>
|
||||
@@ -279,6 +291,7 @@
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user