implemented changing set of selected times, display of closed times
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
let router = useTinyRouter();
|
||||
|
||||
let times = $state(null);
|
||||
let closed = $state(false);
|
||||
let tasks = {};
|
||||
let projects = {};
|
||||
let project_filter = $state(null);
|
||||
@@ -94,9 +95,11 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function loadTimes(){
|
||||
const url = api('time');
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
const resp = await post(url,{closed:closed});
|
||||
if (resp.ok){
|
||||
var json = await resp.json();
|
||||
times = json.times;
|
||||
@@ -160,6 +163,10 @@
|
||||
router.navigate(`/task/${tid}/view`);
|
||||
}
|
||||
|
||||
function reload(ev){
|
||||
loadTimes();
|
||||
}
|
||||
|
||||
function toggleRange(range){
|
||||
let affected = sortedTimes.filter(time => time.start.startsWith(range));
|
||||
if (ranges[range]){
|
||||
@@ -217,6 +224,12 @@
|
||||
<button class="symbol" title={t('complete')} onclick={e => multi_update({state:'Complete'})} ></button>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="switch">
|
||||
<label>
|
||||
<input type="checkbox" bind:checked={closed} onchange={reload} />
|
||||
{t('show_closed')}
|
||||
</label>
|
||||
</div>
|
||||
<table class="timetracks">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -235,12 +248,12 @@
|
||||
{#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))}>
|
||||
<td class="year" rowspan={timeMap.years[line]} onclick={e => toggleRange(time.start.substring(0,4))} title={time.start.substring(0,4)} >
|
||||
{time.start.substring(0,4)}
|
||||
</td>
|
||||
{/if}
|
||||
{#if timeMap.months[line]}
|
||||
<td class="month" rowspan={timeMap.months[line]} onclick={e => toggleRange(time.start.substring(0,7))}>
|
||||
<td class="month" rowspan={timeMap.months[line]} onclick={e => toggleRange(time.start.substring(0,7))} title={time.start.substring(5,7)} >
|
||||
{time.start.substring(5,7)}
|
||||
</td>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user