implemented extended settings on task

This commit is contained in:
2025-07-26 20:42:18 +02:00
parent 81fb085245
commit 58986a5c59
5 changed files with 62 additions and 11 deletions

View File

@@ -23,8 +23,8 @@ public class Task implements Mappable {
private String name; private String name;
private String description; private String description;
private Status status; private Status status;
private final Double estimatedTime; private Double estimatedTime;
private final LocalDate start, dueDate; private LocalDate dueDate, start;
private boolean showClosed; private boolean showClosed;
private final boolean noIndex; private final boolean noIndex;
private final Map<Long, Member> members; private final Map<Long, Member> members;
@@ -137,8 +137,11 @@ public class Task implements Mappable {
for (var key : json.keySet()){ for (var key : json.keySet()){
switch (key){ switch (key){
case DESCRIPTION: description = json.getString(key); break; case DESCRIPTION: description = json.getString(key); break;
case DUE_DATE: dueDate = json.isNull(DUE_DATE) || json.getString(DUE_DATE).isBlank() ? null : LocalDate.parse(json.getString(DUE_DATE)); break;
case ESTIMATED_TIME: estimatedTime = json.isNull(ESTIMATED_TIME) ? null : json.getDouble(ESTIMATED_TIME); break;
case NAME: name = json.getString(key); break; case NAME: name = json.getString(key); break;
case SHOW_CLOSED: showClosed = json.getBoolean(SHOW_CLOSED); break; case SHOW_CLOSED: showClosed = json.getBoolean(SHOW_CLOSED); break;
case START_DATE: start = json.isNull(START_DATE) || json.getString(START_DATE).isBlank() ? null : LocalDate.parse(json.getString(START_DATE)); break;
case STATUS: status = json.get(key) instanceof Number number ? Status.of(number.intValue()) : Status.valueOf(json.getString(key)); break; case STATUS: status = json.get(key) instanceof Number number ? Status.of(number.intValue()) : Status.valueOf(json.getString(key)); break;
default: { default: {
key = null; key = null;

View File

@@ -5,8 +5,6 @@
let { estimated_time, show_closed, tasks } = $props(); let { estimated_time, show_closed, tasks } = $props();
let sortedTasks = $derived.by(() => Object.values(tasks).sort((a, b) => a.name.localeCompare(b.name))); let sortedTasks = $derived.by(() => Object.values(tasks).sort((a, b) => a.name.localeCompare(b.name)));
</script> </script>
<ul> <ul>

View File

@@ -95,6 +95,10 @@
router.navigate(`/task/${task.parent_task_id}/view`) router.navigate(`/task/${task.parent_task_id}/view`)
} }
function toggleSettings(){
showSettings = !showSettings;
}
async function update(data){ async function update(data){
const url = api(`task/${id}`); const url = api(`task/${id}`);
const resp = await fetch(url,{ const resp = await fetch(url,{
@@ -104,13 +108,16 @@
}); });
if (resp.ok){ if (resp.ok){
error = null; error = null;
//task = await resp.json();
return true; return true;
} else { } else {
error = await resp.text(); error = await resp.text();
return false; return false;
} }
} }
function updateClosed(){
if (update({show_closed:task.show_closed})) setTimeout(loadTask,50);
}
</script> </script>
{#if error} {#if error}
@@ -135,7 +142,7 @@
<th>{t('task')}</th> <th>{t('task')}</th>
<td class="name"> <td class="name">
<LineEditor bind:value={task.name} editable={true} onSet={val => update({name:val})} /> <LineEditor bind:value={task.name} editable={true} onSet={val => update({name:val})} />
<button class="symbol" onclick={() => showSettings = true}></button> <button class="symbol" onclick={toggleSettings}></button>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -181,6 +188,43 @@
</ul> </ul>
</td> </td>
</tr> </tr>
{#if showSettings}
<tr>
<th>
{t('extended_settings')}
</th>
<td>
<label>
<input type="checkbox" bind:checked={task.show_closed} onchange={updateClosed} />
{t('display_closed_tasks')}
</label>
</td>
</tr>
<tr>
<th>
{t('start_date')}
</th>
<td>
<input type="date" bind:value={task.start_date} onchange={() => update({start_date:task.start_date})} />
</td>
</tr>
<tr>
<th>
{t('due_date')}
</th>
<td>
<input type="date" bind:value={task.due_date} onchange={() => update({due_date:task.due_date})} />
</td>
</tr>
<tr>
<th>
{t('estimated_time')}
</th>
<td>
<input type="number" bind:value={task.estimated_time} onchange={() => update({estimated_time:task.estimated_time})} />&nbsp;h
</td>
</tr>
{/if}
<tr> <tr>
<th> <th>
{t('subtasks')} {t('subtasks')}
@@ -188,7 +232,7 @@
</th> </th>
<td class="children"> <td class="children">
{#if children} {#if children}
<TaskList tasks={children} {estimated_time} /> <TaskList tasks={children} {estimated_time} show_closed={task.show_closed} />
{/if} {/if}
</td> </td>
</tr> </tr>

View File

@@ -81,6 +81,7 @@
"gross_sum": "Brutto-Summe", "gross_sum": "Brutto-Summe",
"head": "Kopf-Text", "head": "Kopf-Text",
"hide_closed": "geschlossene ausblenden",
"hide_on_index_page": "Nicht in der Aufgabenübersicht anzeigen", "hide_on_index_page": "Nicht in der Aufgabenübersicht anzeigen",
"hours": "Stunden", "hours": "Stunden",

View File

@@ -137,3 +137,8 @@ li.task:hover{
li.task:hover > button{ li.task:hover > button{
display: initial; display: initial;
} }
textarea{
color: white;
background: #333;
font-weight: black;
}