implemented quick filter on task index
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let filter = $state(null);
|
||||
let lower_filter = $derived(filter.toLowerCase());
|
||||
let inverted_filter = $state(false);
|
||||
let projects = $state({});
|
||||
let router = useTinyRouter();
|
||||
let tasks = $state(null);
|
||||
@@ -46,7 +48,16 @@
|
||||
}
|
||||
|
||||
function filterApplies(task){
|
||||
return true;
|
||||
if (!filter) return !inverted_filter;
|
||||
if (task.name.toLowerCase().includes(lower_filter)) return !inverted_filter;
|
||||
if (task.description.source.toLowerCase().includes(lower_filter)) return !inverted_filter;
|
||||
if (projects[task.project_id].name.toLowerCase().includes(lower_filter)) return !inverted_filter;
|
||||
if (task.parent_task_id){
|
||||
const parent = map[task.parent_task_id];
|
||||
if (parent && parent.name.toLowerCase().includes(lower_filter)) return !inverted_filter;
|
||||
}
|
||||
|
||||
return inverted_filter;
|
||||
}
|
||||
|
||||
function go(module, id){
|
||||
@@ -112,6 +123,12 @@
|
||||
<label>
|
||||
{t('filter')}: <input type="text" bind:value={filter} >
|
||||
</label>
|
||||
{#if filter}
|
||||
<label>
|
||||
<input type="checkbox" bind:checked={inverted_filter} />
|
||||
{t('invert_filter')}
|
||||
</label>
|
||||
{/if}
|
||||
</div>
|
||||
{#if tasks}
|
||||
<table>
|
||||
@@ -148,7 +165,7 @@
|
||||
<td>
|
||||
<button class="symbol" onclick={() => edit(task.id)} title={t('edit')} ></button>
|
||||
<button class="symbol" onclick={() => postpone(idx)} title={t('postpone')} ></button>
|
||||
<button class="symbol" onclick={() => open(idx)} title={t('open')}></button>
|
||||
<button class="symbol" onclick={() => open(idx)} title={t('state_open')}></button>
|
||||
<button class="symbol" onclick={() => start(idx)} title={t('start')} ></button>
|
||||
<button class="symbol" onclick={() => complete(idx)} title={t('complete')} ></button>
|
||||
<button class="symbol" onclick={() => abort(idx)} title={t('abort')} ></button>
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
"impersonate": "zu Nutzer wechseln",
|
||||
"IMPERSONATE": "Nutzer wechseln",
|
||||
"index_page": "Aufgabenübersicht",
|
||||
"invert_filter": "Filter umkehren",
|
||||
"invoice": "Rechnung",
|
||||
"item": "Artikel",
|
||||
"items": "Artikel",
|
||||
|
||||
@@ -119,7 +119,9 @@
|
||||
"impersonate": "impersonate",
|
||||
"IMPERSONATE": "impersonate",
|
||||
"index_page": "task overview",
|
||||
"invert_filter": "Filter umkehren",
|
||||
"invoice": "invoice",
|
||||
"item": "Item",
|
||||
"items": "items",
|
||||
|
||||
"join_objects" : "join {objects}",
|
||||
|
||||
Reference in New Issue
Block a user