preparing addition of tasks

This commit is contained in:
2025-07-23 08:49:16 +02:00
parent c2eae076f4
commit ddeb2a8d88
9 changed files with 91 additions and 8 deletions

View File

@@ -0,0 +1,68 @@
<script>
import { t } from '../../translations.svelte.js';
import { api } from '../../urls.svelte.js';
import { onMount } from 'svelte';
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
let { project_id = null } = $props();
let error = $state(null);
let project = $state(null)
let task = $state({
name : '',
description : { source : 'new_task', rendered : '' }
});
function load(){
if (project_id) loadProject();
}
async function loadProject(){
var url = api(`project/${project_id}`);
const resp = await fetch(url,{credentials:'include'});
if (resp.ok){
project = await resp.json();
task.project_id = project_id;
error = null;
} else {
error = await resp.text();
}
}
onMount(load);
</script>
<fieldset>
<legend>Add Task</legend>
<table>
<tbody>
<tr>
<th>
{t('name')}
</th>
<td>
<input bind:value={task.name}>
</td>
</tr>
{#if project}
<tr>
<th>
{t('project')}
</th>
<td>
{project.name}
</td>
</tr>
{/if}
<tr>
<th>
{t('description')}
</th>
<td>
<MarkdownEditor bind:value={task.description} editing={true}/>
</td>
</tr>
</tbody>
</table>
</fieldset>