working on form to add subtask
This commit is contained in:
@@ -25,11 +25,6 @@
|
||||
});
|
||||
let router = useTinyRouter();
|
||||
|
||||
async function load(){
|
||||
if (parent_task_id) await loadParent();
|
||||
if (project_id) loadProject();
|
||||
}
|
||||
|
||||
function addMember(member){
|
||||
for (let uid of Object.keys(member)) task.members[uid] = project.members[uid];
|
||||
}
|
||||
@@ -39,6 +34,11 @@
|
||||
console.log({drop:member.user.id});
|
||||
}
|
||||
|
||||
async function load(){
|
||||
if (parent_task_id) await loadParent();
|
||||
if (project_id) loadProject();
|
||||
}
|
||||
|
||||
async function loadParent(){
|
||||
const url = api(`task/${parent_task_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
@@ -60,7 +60,7 @@
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
task.project_id = +project_id;
|
||||
task.members = JSON.parse(JSON.stringify(project.members)); // deep copy
|
||||
task.members = JSON.parse(JSON.stringify(parent_task?parent_task.members:project.members)); // deep copy
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
@@ -68,7 +68,8 @@
|
||||
}
|
||||
|
||||
async function getCandidates(text){
|
||||
const candidates = Object.values(project.members)
|
||||
const origin = parent_task ? parent_task.members : project.members;
|
||||
const candidates = Object.values(origin)
|
||||
.filter(member => member.user.name.toLowerCase().includes(text.toLowerCase()))
|
||||
.map(member => [member.user.id,member.user.name]);
|
||||
return Object.fromEntries(candidates);
|
||||
@@ -107,7 +108,7 @@
|
||||
{t('name')}
|
||||
</th>
|
||||
<td>
|
||||
<input bind:value={task.name}>
|
||||
<input bind:value={task.name} autofocus>
|
||||
</td>
|
||||
</tr>
|
||||
{#if project}
|
||||
|
||||
Reference in New Issue
Block a user