preparing to create new task from kanban using tasks/Add form

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-02-03 09:21:22 +01:00
parent 1942f377b8
commit 0f902e3efa
3 changed files with 30 additions and 6 deletions

View File

@@ -10,6 +10,7 @@
import Card from './KanbanCard.svelte'; import Card from './KanbanCard.svelte';
import LineEditor from '../../Components/LineEditor.svelte'; import LineEditor from '../../Components/LineEditor.svelte';
import MarkdownEditor from '../../Components/MarkdownEditor.svelte'; import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
import TaskForm from '../task/Add.svelte';
let eventSource = null; let eventSource = null;
let connectionStatus = 'disconnected'; let connectionStatus = 'disconnected';
@@ -26,7 +27,7 @@
let users = []; let users = [];
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1); let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
let info = $state(null); let info = $state(null);
let task_form = $state(false);
let stateList = {}; let stateList = {};
$effect(() => updateUrl(filter_input)); $effect(() => updateUrl(filter_input));
@@ -249,6 +250,10 @@
} }
} }
function show_task_form(project_id,assignee,state_id){
console.log({project_id,assignee,state_id});
task_form = {project_id,assignee,state_id};
}
function updateUrl(){ function updateUrl(){
let url = window.location.origin + window.location.pathname; let url = window.location.origin + window.location.pathname;
@@ -267,6 +272,12 @@
</svelte:head> </svelte:head>
{#if project} {#if project}
{#if task_form}
<div class="overlay">
<TaskForm project_id={task_form.project_id} user_id={task_form.user_id} state={task_form.state} />
</div>
{/if} <!-- task form -->
<h1 onclick={ev => router.navigate(`/project/${project.id}/view`)}>{project.name}</h1> <h1 onclick={ev => router.navigate(`/project/${project.id}/view`)}>{project.name}</h1>
{/if} {/if}
{#if info} {#if info}
@@ -300,8 +311,8 @@
<Card onclick={e => openTask(task.id)} ondragstart={ev => dragged=task} {task} tag_colors={project.tag_colors} /> <Card onclick={e => openTask(task.id)} ondragstart={ev => dragged=task} {task} tag_colors={project.tag_colors} />
{/if} {/if}
{/each} {/each}
<div class="add_task"> <div class="add_task" onclick={ev => show_task_form(project.id,u.id,+state)}>
<LineEditor value={t('add_object',{object:t('task')})} editable={true} onSet={(name) => create(name,u.id,state)}/> {t('add_object',{object:t('task')})}
</div> </div>
</div> </div>
{/each} {/each}
@@ -310,4 +321,4 @@
<div class="archive {highlight.archive?'hover':''}" ondragover={hover_archive} ondragleave={e => delete highlight.archive} ondrop={do_archive} > <div class="archive {highlight.archive?'hover':''}" ondragover={hover_archive} ondragleave={e => delete highlight.archive} ondrop={do_archive} >
{t('hide')} {t('hide')}
</div> </div>
{/if} {/if} <!-- project -->

View File

@@ -11,7 +11,7 @@
import PermissionEditor from '../../Components/PermissionEditor.svelte'; import PermissionEditor from '../../Components/PermissionEditor.svelte';
import Tags from '../tags/TagList.svelte'; import Tags from '../tags/TagList.svelte';
let { project_id = null, parent_task_id } = $props(); let { project_id = null, parent_task_id = null, assignee = null, state_id = null } = $props();
let project = $state(null); let project = $state(null);
let extendedSettings = $state(false); let extendedSettings = $state(false);
let parent_task = $state(null); let parent_task = $state(null);
@@ -44,6 +44,8 @@
async function load(){ async function load(){
if (parent_task_id) await loadParent(); if (parent_task_id) await loadParent();
if (project_id) loadProject(); if (project_id) loadProject();
if (assignee) task.assignee = +assignee;
if (state_id) task.state = +state_id;
loadTags(); loadTags();
} }
@@ -53,7 +55,7 @@
if (resp.ok){ if (resp.ok){
parent_task = await resp.json(); parent_task = await resp.json();
task.parent_task_id = +parent_task_id; task.parent_task_id = +parent_task_id;
project_id = parent_task.project_id; project_id = +parent_task.project_id;
yikes(); yikes();
project = null; // TODO project = null; // TODO
} else { } else {

View File

@@ -183,6 +183,17 @@ td, tr{
padding: 3px; padding: 3px;
} }
.overlay {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
padding: 40px 10px 10px;
background: rgba(0,0,0,0.9);
z-index: 50;
}
.warn { .warn {
padding: 5px; padding: 5px;
border-radius: 6px; border-radius: 6px;