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 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;
|
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<>());
|
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/:project_id/add_task" component={AddTask} />
|
||||||
<Route path="/project/:id/view" component={ViewPrj} />
|
<Route path="/project/:id/view" component={ViewPrj} />
|
||||||
<Route path="/search" component={Search} />
|
<Route path="/search" component={Search} />
|
||||||
|
<Route path="/task/:parent_task_id/add_subtask" component={AddTask} />
|
||||||
<Route path="/task/:id/view" component={ViewTask} />
|
<Route path="/task/:id/view" component={ViewTask} />
|
||||||
<Route path="/user" component={User} />
|
<Route path="/user" component={User} />
|
||||||
<Route path="/user/create" component={EditUser} />
|
<Route path="/user/create" component={EditUser} />
|
||||||
|
|||||||
@@ -8,10 +8,11 @@
|
|||||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||||
import MemberEditor from '../../Components/MemberEditor.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 error = $state(null);
|
||||||
let project = $state(null);
|
let project = $state(null);
|
||||||
let extendedSettings = $state(false);
|
let extendedSettings = $state(false);
|
||||||
|
let parent_task = $state(null);
|
||||||
let task = $state({
|
let task = $state({
|
||||||
name : '',
|
name : '',
|
||||||
description : { source : '', rendered : '' },
|
description : { source : '', rendered : '' },
|
||||||
@@ -24,7 +25,8 @@
|
|||||||
});
|
});
|
||||||
let router = useTinyRouter();
|
let router = useTinyRouter();
|
||||||
|
|
||||||
function load(){
|
async function load(){
|
||||||
|
if (parent_task_id) await loadParent();
|
||||||
if (project_id) loadProject();
|
if (project_id) loadProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +39,21 @@
|
|||||||
console.log({drop:member.user.id});
|
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(){
|
async function loadProject(){
|
||||||
var url = api(`project/${project_id}`);
|
var url = api(`project/${project_id}`);
|
||||||
const resp = await fetch(url,{credentials:'include'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
@@ -103,6 +120,17 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if parent_task}
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{t('parent_task')}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
{parent_task.name}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
{t('description')}
|
{t('description')}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
loadTask();
|
loadTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addChild(){
|
||||||
|
router.navigate(`/task/${id}/add_subtask`);
|
||||||
|
}
|
||||||
|
|
||||||
async function loadChildren(){
|
async function loadChildren(){
|
||||||
const url = api('task/list');
|
const url = api('task/list');
|
||||||
var data = {
|
var data = {
|
||||||
@@ -127,6 +131,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{t('subtasks')}</th>
|
<th>{t('subtasks')}</th>
|
||||||
<td class="task children">
|
<td class="task children">
|
||||||
|
<button onclick={addChild} >{t('add_subtask')}</button>
|
||||||
<TaskList tasks={children} {estimated_time} />
|
<TaskList tasks={children} {estimated_time} />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"add_new": "{0} hinzufügen",
|
"add_new": "{0} hinzufügen",
|
||||||
"add_member": "Mitarbeiter hinzufügen",
|
"add_member": "Mitarbeiter hinzufügen",
|
||||||
"add_position": "hinzufügen",
|
"add_position": "hinzufügen",
|
||||||
|
"add_subtask": "Unteraufgabe hinzufügen",
|
||||||
"add_task": "Aufgabe hinzufügen",
|
"add_task": "Aufgabe hinzufügen",
|
||||||
"advertisement" : "Umbrella ist ein Produkt von {0}.",
|
"advertisement" : "Umbrella ist ein Produkt von {0}.",
|
||||||
"amount": "Menge",
|
"amount": "Menge",
|
||||||
@@ -142,6 +143,7 @@
|
|||||||
"oidc_Login" : "Anmeldung mit OIDC",
|
"oidc_Login" : "Anmeldung mit OIDC",
|
||||||
"old_password": "altes Passwort",
|
"old_password": "altes Passwort",
|
||||||
|
|
||||||
|
"parent_task": "übergeordnete Aufgabe",
|
||||||
"password" : "Passwort",
|
"password" : "Passwort",
|
||||||
"permission": {
|
"permission": {
|
||||||
"EDIT": "lesen/schreiben",
|
"EDIT": "lesen/schreiben",
|
||||||
|
|||||||
Reference in New Issue
Block a user