implemented extended settings on task
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
let { estimated_time, show_closed, tasks } = $props();
|
||||
|
||||
let sortedTasks = $derived.by(() => Object.values(tasks).sort((a, b) => a.name.localeCompare(b.name)));
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -95,6 +95,10 @@
|
||||
router.navigate(`/task/${task.parent_task_id}/view`)
|
||||
}
|
||||
|
||||
function toggleSettings(){
|
||||
showSettings = !showSettings;
|
||||
}
|
||||
|
||||
async function update(data){
|
||||
const url = api(`task/${id}`);
|
||||
const resp = await fetch(url,{
|
||||
@@ -104,13 +108,16 @@
|
||||
});
|
||||
if (resp.ok){
|
||||
error = null;
|
||||
//task = await resp.json();
|
||||
return true;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateClosed(){
|
||||
if (update({show_closed:task.show_closed})) setTimeout(loadTask,50);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
@@ -135,7 +142,7 @@
|
||||
<th>{t('task')}</th>
|
||||
<td class="name">
|
||||
<LineEditor bind:value={task.name} editable={true} onSet={val => update({name:val})} />
|
||||
<button class="symbol" onclick={() => showSettings = true}></button>
|
||||
<button class="symbol" onclick={toggleSettings}></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -181,6 +188,43 @@
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{#if showSettings}
|
||||
<tr>
|
||||
<th>
|
||||
{t('extended_settings')}
|
||||
</th>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" bind:checked={task.show_closed} onchange={updateClosed} />
|
||||
{t('display_closed_tasks')}
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
{t('start_date')}
|
||||
</th>
|
||||
<td>
|
||||
<input type="date" bind:value={task.start_date} onchange={() => update({start_date:task.start_date})} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
{t('due_date')}
|
||||
</th>
|
||||
<td>
|
||||
<input type="date" bind:value={task.due_date} onchange={() => update({due_date:task.due_date})} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
{t('estimated_time')}
|
||||
</th>
|
||||
<td>
|
||||
<input type="number" bind:value={task.estimated_time} onchange={() => update({estimated_time:task.estimated_time})} /> h
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<th>
|
||||
{t('subtasks')}
|
||||
@@ -188,7 +232,7 @@
|
||||
</th>
|
||||
<td class="children">
|
||||
{#if children}
|
||||
<TaskList tasks={children} {estimated_time} />
|
||||
<TaskList tasks={children} {estimated_time} show_closed={task.show_closed} />
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user