implemented adding sub tasks
This commit is contained in:
@@ -51,9 +51,10 @@
|
||||
<Route path="/message/settings" component={Messages} />
|
||||
<Route path="/project" component={ProjectList} />
|
||||
<Route path="/project/add" component={ProjectAdd} />
|
||||
<Route path="/project/:project_id/add_task" component={AddTask} />
|
||||
<Route path="/project/:project_id/add_task" component={AddTask} />
|
||||
<Route path="/project/:id/view" component={ViewPrj} />
|
||||
<Route path="/search" component={Search} />
|
||||
<Route path="/task/:parent_task_id/add_subtask" component={AddTask} />
|
||||
<Route path="/task/:id/view" component={ViewTask} />
|
||||
<Route path="/user" component={User} />
|
||||
<Route path="/user/create" component={EditUser} />
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
|
||||
let { project_id = null } = $props();
|
||||
let { project_id = null, parent_task_id } = $props();
|
||||
let error = $state(null);
|
||||
let project = $state(null);
|
||||
let extendedSettings = $state(false);
|
||||
let parent_task = $state(null);
|
||||
let task = $state({
|
||||
name : '',
|
||||
description : { source : '', rendered : '' },
|
||||
@@ -24,7 +25,8 @@
|
||||
});
|
||||
let router = useTinyRouter();
|
||||
|
||||
function load(){
|
||||
async function load(){
|
||||
if (parent_task_id) await loadParent();
|
||||
if (project_id) loadProject();
|
||||
}
|
||||
|
||||
@@ -37,6 +39,21 @@
|
||||
console.log({drop:member.user.id});
|
||||
}
|
||||
|
||||
async function loadParent(){
|
||||
const url = api(`task/${parent_task_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
parent_task = await resp.json();
|
||||
task.parent_task_id = +parent_task_id;
|
||||
project_id = parent_task.project_id;
|
||||
console.log({prj:project_id});
|
||||
error = null;
|
||||
project = null; // TODO
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProject(){
|
||||
var url = api(`project/${project_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
@@ -103,6 +120,17 @@
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{#if parent_task}
|
||||
<tr>
|
||||
<th>
|
||||
{t('parent_task')}
|
||||
</th>
|
||||
<td>
|
||||
{parent_task.name}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
{t('description')}
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
loadTask();
|
||||
}
|
||||
|
||||
function addChild(){
|
||||
router.navigate(`/task/${id}/add_subtask`);
|
||||
}
|
||||
|
||||
async function loadChildren(){
|
||||
const url = api('task/list');
|
||||
var data = {
|
||||
@@ -127,6 +131,7 @@
|
||||
<tr>
|
||||
<th>{t('subtasks')}</th>
|
||||
<td class="task children">
|
||||
<button onclick={addChild} >{t('add_subtask')}</button>
|
||||
<TaskList tasks={children} {estimated_time} />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user