preparing for member setup during task creation
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -51,35 +51,43 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function load(){
|
async function load(){
|
||||||
|
console.log({assignee});
|
||||||
if (parent_task_id) await loadParent();
|
if (parent_task_id) await loadParent();
|
||||||
if (project_id) loadProject();
|
if (project_id) await loadProject();
|
||||||
if (state_id) task.status = { code : +state_id };
|
if (state_id) task.status = { code : +state_id };
|
||||||
loadTags();
|
await loadTags();
|
||||||
|
console.log({task:JSON.parse(JSON.stringify(task))});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadParent(){
|
async function loadParent(){
|
||||||
|
console.log('loading parent task with id = '+parent_task_id);
|
||||||
const url = api(`task/${parent_task_id}`);
|
const url = api(`task/${parent_task_id}`);
|
||||||
const resp = await get(url);
|
const resp = await get(url);
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
parent_task = await resp.json();
|
parent_task = await resp.json();
|
||||||
|
console.log(JSON.parse(JSON.stringify(parent_task)));
|
||||||
task.parent_task_id = +parent_task_id;
|
task.parent_task_id = +parent_task_id;
|
||||||
|
task.members = parent_task.members;
|
||||||
project_id = +parent_task.project_id;
|
project_id = +parent_task.project_id;
|
||||||
yikes();
|
yikes();
|
||||||
project = null; // TODO
|
project = null;
|
||||||
} else error(resp);
|
} else error(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadProject(){
|
async function loadProject(){
|
||||||
|
console.log('loading project '+project_id);
|
||||||
const url = api(`project/${project_id}`);
|
const url = api(`project/${project_id}`);
|
||||||
const resp = await get(url);
|
const resp = await get(url);
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
project = await resp.json();
|
project = await resp.json();
|
||||||
|
console.log(JSON.parse(JSON.stringify(project)));
|
||||||
task.project_id = +project_id;
|
task.project_id = +project_id;
|
||||||
|
if (Object.keys(task.members).length < 1) task.members = project.members;
|
||||||
if (assignee && project.members[assignee]){
|
if (assignee && project.members[assignee]){
|
||||||
task.members[assignee] = project.members[assignee];
|
task.members[assignee] = project.members[assignee];
|
||||||
task.members[assignee].permission = { name : "ASSIGNEE", code : 3 }
|
task.members[assignee].permission = { name : "ASSIGNEE", code : 3 }
|
||||||
}
|
}
|
||||||
if (task.taks.length < 1) task.tags = project.tags;
|
if (task.tags.length < 1) task.tags = project.tags;
|
||||||
yikes();
|
yikes();
|
||||||
} else {
|
} else {
|
||||||
error(resp);
|
error(resp);
|
||||||
@@ -87,9 +95,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadTags(){
|
async function loadTags(){
|
||||||
|
|
||||||
let url = null;
|
let url = null;
|
||||||
if (project_id) url = api(`tags/project/${project_id}`);
|
if (project_id) url = api(`tags/project/${project_id}`);
|
||||||
if (parent_task_id) url = api(`tags/task/${parent_task_id}`);
|
if (parent_task_id) url = api(`tags/task/${parent_task_id}`);
|
||||||
|
console.log('loading tags: ',url);
|
||||||
if (url) {
|
if (url) {
|
||||||
const resp = await get(url);
|
const resp = await get(url);
|
||||||
if (resp.ok) task.tags = await resp.json();
|
if (resp.ok) task.tags = await resp.json();
|
||||||
@@ -104,6 +114,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function saveTask(){
|
async function saveTask(){
|
||||||
|
console.log({task:JSON.parse(JSON.stringify(task))});
|
||||||
const url = api('task/add');
|
const url = api('task/add');
|
||||||
const resp = await post(url,task);
|
const resp = await post(url,task);
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
|
|||||||
Reference in New Issue
Block a user