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>
|
||||
|
||||
Reference in New Issue
Block a user