Merge branch 'main' into dev
This commit is contained in:
@@ -14,8 +14,9 @@
|
||||
let map = $state({});
|
||||
let hidden = $state({});
|
||||
|
||||
async function changeState(tid,state){
|
||||
const task = tasks[tid];
|
||||
async function changeState(idx,state){
|
||||
const task = tasks[idx];
|
||||
const tid = task.id;
|
||||
const prj = projects[task.project_id];
|
||||
const stat = Object.keys(prj.allowed_states).find(k => prj.allowed_states[k] === state);
|
||||
const url = api(`task/${tid}`);
|
||||
@@ -25,18 +26,18 @@
|
||||
body : JSON.stringify({status:stat})
|
||||
});
|
||||
if (resp.ok){
|
||||
tasks[tid] = await resp.json();
|
||||
tasks[idx] = await resp.json();
|
||||
} else {
|
||||
error(resp);
|
||||
}
|
||||
}
|
||||
|
||||
function abort(tid){
|
||||
changeState(tid,'CANCELLED');
|
||||
function abort(idx){
|
||||
changeState(idx,'CANCELLED');
|
||||
}
|
||||
|
||||
function complete(tid){
|
||||
changeState(tid,'COMPLETE');
|
||||
function complete(idx){
|
||||
changeState(idx,'COMPLETE');
|
||||
}
|
||||
|
||||
function edit(tid){
|
||||
@@ -81,16 +82,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
function open(tid){
|
||||
changeState(tid,'OPEN');
|
||||
function open(idx){
|
||||
changeState(idx,'OPEN');
|
||||
}
|
||||
|
||||
function postpone(tid){
|
||||
changeState(tid,'PENDING');
|
||||
function postpone(idx){
|
||||
changeState(idx,'PENDING');
|
||||
}
|
||||
|
||||
function start(tid){
|
||||
changeState(tid,'STARTED');
|
||||
function start(idx){
|
||||
changeState(idx,'STARTED');
|
||||
}
|
||||
|
||||
onMount(load);
|
||||
@@ -115,7 +116,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each tasks as task (task.id)}
|
||||
{#each tasks as task,idx}
|
||||
{#if task.status > 10 && task.status < 60 && !task.no_index && projects[task.project_id]?.status < 60 && !hidden[task.id]}
|
||||
<tr>
|
||||
<td onclick={() => go('task',task.id)}>{task.name}</td>
|
||||
@@ -136,11 +137,11 @@
|
||||
</td>
|
||||
<td>
|
||||
<button class="symbol" onclick={() => edit(task.id)} title={t('edit')} ></button>
|
||||
<button class="symbol" onclick={() => postpone(task.id)} title={t('postpone')} ></button>
|
||||
<button class="symbol" onclick={() => open(task.id)} title={t('open')}></button>
|
||||
<button class="symbol" onclick={() => start(task.id)} title={t('start')} ></button>
|
||||
<button class="symbol" onclick={() => complete(task.id)} title={t('complete')} ></button>
|
||||
<button class="symbol" onclick={() => abort(task.id)} title={t('abort')} ></button>
|
||||
<button class="symbol" onclick={() => postpone(idx)} title={t('postpone')} ></button>
|
||||
<button class="symbol" onclick={() => open(idx)} title={t('open')}></button>
|
||||
<button class="symbol" onclick={() => start(idx)} title={t('start')} ></button>
|
||||
<button class="symbol" onclick={() => complete(idx)} title={t('complete')} ></button>
|
||||
<button class="symbol" onclick={() => abort(idx)} title={t('abort')} ></button>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user