|
@ -35,6 +35,7 @@ import stuffLogClient from "../clients/stufflog"; |
|
|
let failedTasks: TaskResult[] = []; |
|
|
let failedTasks: TaskResult[] = []; |
|
|
let nonHiddenTasks: TaskResult[] = []; |
|
|
let nonHiddenTasks: TaskResult[] = []; |
|
|
let toggling = false; |
|
|
let toggling = false; |
|
|
|
|
|
let canComplete = false; |
|
|
|
|
|
|
|
|
function toggleFavorite() { |
|
|
function toggleFavorite() { |
|
|
if (toggling) { |
|
|
if (toggling) { |
|
@ -53,6 +54,24 @@ import stuffLogClient from "../clients/stufflog"; |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function markCompleted() { |
|
|
|
|
|
if (toggling) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
toggling = true |
|
|
|
|
|
|
|
|
|
|
|
stuffLogClient.updateProject(project.id, { |
|
|
|
|
|
statusTag: "completed", |
|
|
|
|
|
active: false, |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
markStale("project"); |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.warn("Failed to mark completed:", err); |
|
|
|
|
|
}).finally(() => { |
|
|
|
|
|
toggling = false; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$: mdAddTask = {name:"task.add", project}; |
|
|
$: mdAddTask = {name:"task.add", project}; |
|
|
$: mdProjectEdit = {name:"project.edit", project}; |
|
|
$: mdProjectEdit = {name:"project.edit", project}; |
|
|
$: mdProjectDelete = {name:"project.delete", project}; |
|
|
$: mdProjectDelete = {name:"project.delete", project}; |
|
@ -69,6 +88,8 @@ import stuffLogClient from "../clients/stufflog"; |
|
|
nonHiddenTasks = [...activeTasks, ...todoTasks, ...onholdTasks]; |
|
|
nonHiddenTasks = [...activeTasks, ...todoTasks, ...onholdTasks]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$: canComplete = project.active && completedTasks.length + failedTasks.length === project.tasks.length; |
|
|
|
|
|
|
|
|
$: linkTarget = IS_MOBILE ? `/projects#${project.id}` : `/questlog#${project.id}` |
|
|
$: linkTarget = IS_MOBILE ? `/projects#${project.id}` : `/questlog#${project.id}` |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
@ -95,6 +116,9 @@ import stuffLogClient from "../clients/stufflog"; |
|
|
<Option open={mdAddTask}>Add Task</Option> |
|
|
<Option open={mdAddTask}>Add Task</Option> |
|
|
<Option open={mdProjectEdit}>Edit</Option> |
|
|
<Option open={mdProjectEdit}>Edit</Option> |
|
|
<Option open={mdProjectDelete}>Delete</Option> |
|
|
<Option open={mdProjectDelete}>Delete</Option> |
|
|
|
|
|
{#if canComplete} |
|
|
|
|
|
<Option disabled={!toggling} green on:click={markCompleted}>Complete Project</Option> |
|
|
|
|
|
{/if} |
|
|
</OptionRow> |
|
|
</OptionRow> |
|
|
{/if} |
|
|
{/if} |
|
|
{#if hideInactive} |
|
|
{#if hideInactive} |
|
|