implemented adding sub tasks
This commit is contained in:
@@ -65,7 +65,7 @@ public record Task(long id, long projectId, Long parentTaskId, String name, Stri
|
||||
var showClosed = json.has(SHOW_CLOSED) && json.get(SHOW_CLOSED) instanceof Boolean sc ? sc : false;
|
||||
var noIndex = json.has(NO_INDEX) && json.get(NO_INDEX) instanceof Boolean ni ? ni : false;
|
||||
|
||||
if (!(json.has(MEMBERS) && json.get(MEMBERS) instanceof JSONObject members)) throw missingFieldException(MEMBERS);
|
||||
if (!(json.has(MEMBERS) && json.get(MEMBERS) instanceof JSONObject)) throw missingFieldException(MEMBERS);
|
||||
return new Task(0,prjId.longValue(),parentTaskId,name,description,status,estimatedTime,startDate,dueDate,showClosed,noIndex,new HashMap<>());
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<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>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"add_new": "{0} hinzufügen",
|
||||
"add_member": "Mitarbeiter hinzufügen",
|
||||
"add_position": "hinzufügen",
|
||||
"add_subtask": "Unteraufgabe hinzufügen",
|
||||
"add_task": "Aufgabe hinzufügen",
|
||||
"advertisement" : "Umbrella ist ein Produkt von {0}.",
|
||||
"amount": "Menge",
|
||||
@@ -142,6 +143,7 @@
|
||||
"oidc_Login" : "Anmeldung mit OIDC",
|
||||
"old_password": "altes Passwort",
|
||||
|
||||
"parent_task": "übergeordnete Aufgabe",
|
||||
"password" : "Passwort",
|
||||
"permission": {
|
||||
"EDIT": "lesen/schreiben",
|
||||
|
||||
Reference in New Issue
Block a user