implemented adding sub tasks
This commit is contained in:
@@ -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')}
|
||||
|
||||
Reference in New Issue
Block a user