working on user-defined states
This commit is contained in:
@@ -110,6 +110,13 @@
|
||||
patchTask({name:newName});
|
||||
}
|
||||
|
||||
function map_state(tx){
|
||||
for (let [code,name] of Object.entries(states)){
|
||||
if (tx == name) return {status:+code};
|
||||
}
|
||||
return {state:0};
|
||||
}
|
||||
|
||||
if (task.estimated_time){
|
||||
estimated_time.sum += task.estimated_time;
|
||||
}
|
||||
@@ -118,25 +125,25 @@
|
||||
</script>
|
||||
|
||||
{#if !deleted}
|
||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status].toLowerCase()}">
|
||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status]?.toLowerCase()}">
|
||||
<LineEditor bind:value={task.name} onclick={openTask} editable={true} onSet={setName} type="a" />
|
||||
{#if task.estimated_time}
|
||||
<span class="estimated_time">({+task.estimated_time} h)</span>
|
||||
{/if}
|
||||
{#if states[task.status] != 'PENDING'}
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'PENDING'})}></button>
|
||||
<button class="symbol" title={t('postpone')} onclick={() => patchTask(map_state('PENDING'))}></button>
|
||||
{/if}
|
||||
{#if states[task.status] != 'OPEN'}
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'OPEN'})}></button>
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask(map_state('OPEN'))}></button>
|
||||
{/if}
|
||||
{#if states[task.status] != 'STARTED'}
|
||||
<button class="symbol" title={t('started')} onclick={() => patchTask({status:'STARTED'})}></button>
|
||||
<button class="symbol" title={t('started')} onclick={() => patchTask(map_state('STARTED'))}></button>
|
||||
{/if}
|
||||
{#if states[task.status] != 'COMPLETE'}
|
||||
<button class="symbol" title={t('complete')} onclick={() => patchTask({status:'COMPLETE'})}></button>
|
||||
<button class="symbol" title={t('complete')} onclick={() => patchTask(map_state('COMPLETE'))}></button>
|
||||
{/if}
|
||||
{#if states[task.status] != 'CANCELLED'}
|
||||
<button class="symbol" title={t('abort')} onclick={() => patchTask({status:'CANCELLED'})} ></button>
|
||||
<button class="symbol" title={t('abort')} onclick={() => patchTask(map_state('CANCELED'))} ></button>
|
||||
{/if}
|
||||
<button class="symbol" title={t('delete_task')} onclick={deleteTask} ></button>
|
||||
<button class="symbol" title={t('add_subtask')} onclick={addSubtask}></button>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
|
||||
function updateOn(id){
|
||||
task = null;
|
||||
loadTask();
|
||||
}
|
||||
|
||||
@@ -162,13 +163,17 @@
|
||||
{#if project}
|
||||
<tr>
|
||||
<th>{t('project')}</th>
|
||||
<td class="project"><a href="" onclick={gotoProject}>{project.name}</a></td>
|
||||
<td class="project">
|
||||
<a href="#" onclick={gotoProject}>{project.name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{#if task.parent}
|
||||
<tr>
|
||||
<th>{t('parent_task')}</th>
|
||||
<td class="parent" onclick={gotoParent}>{task.parent.name}</td>
|
||||
<td class="parent">
|
||||
<a href="#" onclick={gotoParent}>{task.parent.name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
@@ -282,7 +287,7 @@
|
||||
</th>
|
||||
<td class="children">
|
||||
{#if children}
|
||||
<TaskList tasks={children} {estimated_time} show_closed={task.show_closed} />
|
||||
<TaskList states={project?.allowed_states} tasks={children} {estimated_time} show_closed={task.show_closed} />
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user