implemented extended settings on task
This commit is contained in:
@@ -23,8 +23,8 @@ public class Task implements Mappable {
|
||||
private String name;
|
||||
private String description;
|
||||
private Status status;
|
||||
private final Double estimatedTime;
|
||||
private final LocalDate start, dueDate;
|
||||
private Double estimatedTime;
|
||||
private LocalDate dueDate, start;
|
||||
private boolean showClosed;
|
||||
private final boolean noIndex;
|
||||
private final Map<Long, Member> members;
|
||||
@@ -137,8 +137,11 @@ public class Task implements Mappable {
|
||||
for (var key : json.keySet()){
|
||||
switch (key){
|
||||
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 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;
|
||||
default: {
|
||||
key = null;
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
let { estimated_time, show_closed, tasks } = $props();
|
||||
|
||||
let sortedTasks = $derived.by(() => Object.values(tasks).sort((a, b) => a.name.localeCompare(b.name)));
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -95,6 +95,10 @@
|
||||
router.navigate(`/task/${task.parent_task_id}/view`)
|
||||
}
|
||||
|
||||
function toggleSettings(){
|
||||
showSettings = !showSettings;
|
||||
}
|
||||
|
||||
async function update(data){
|
||||
const url = api(`task/${id}`);
|
||||
const resp = await fetch(url,{
|
||||
@@ -104,13 +108,16 @@
|
||||
});
|
||||
if (resp.ok){
|
||||
error = null;
|
||||
//task = await resp.json();
|
||||
return true;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateClosed(){
|
||||
if (update({show_closed:task.show_closed})) setTimeout(loadTask,50);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
@@ -135,7 +142,7 @@
|
||||
<th>{t('task')}</th>
|
||||
<td class="name">
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -181,6 +188,43 @@
|
||||
</ul>
|
||||
</td>
|
||||
</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})} /> h
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<th>
|
||||
{t('subtasks')}
|
||||
@@ -188,7 +232,7 @@
|
||||
</th>
|
||||
<td class="children">
|
||||
{#if children}
|
||||
<TaskList tasks={children} {estimated_time} />
|
||||
<TaskList tasks={children} {estimated_time} show_closed={task.show_closed} />
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
"gross_sum": "Brutto-Summe",
|
||||
|
||||
"head": "Kopf-Text",
|
||||
"hide_closed": "geschlossene ausblenden",
|
||||
"hide_on_index_page": "Nicht in der Aufgabenübersicht anzeigen",
|
||||
"hours": "Stunden",
|
||||
|
||||
|
||||
@@ -137,3 +137,8 @@ li.task:hover{
|
||||
li.task:hover > button{
|
||||
display: initial;
|
||||
}
|
||||
textarea{
|
||||
color: white;
|
||||
background: #333;
|
||||
font-weight: black;
|
||||
}
|
||||
Reference in New Issue
Block a user