working on custom states for projects
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
</td>
|
||||
<td class="state" onclick={() => show(project.id)} >
|
||||
|
||||
{t("state_"+project.status.name.toLowerCase())}
|
||||
{t("state_"+project.allowed_states[project.status].toLowerCase())}
|
||||
</td>
|
||||
<td class="members" onclick={() => show(project.id)} >
|
||||
{#each Object.entries(project.members) as [uid,member]}
|
||||
@@ -104,7 +104,7 @@
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button class="edit symbol" title={t('edit')}></button>
|
||||
{#if project.status.code < 60}
|
||||
{#if project.status < 60}
|
||||
<button class="complete symbol" title={t('complete')} onclick={() => setState(project.id,'COMPLETE')} ></button>
|
||||
<button class="abort symbol" title={t('abort')} onclick={() => setState(project.id,'CANCELLED')} ></button>
|
||||
{:else}
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
<tr>
|
||||
<th>{t('state')}</th>
|
||||
<td>
|
||||
<StateSelector selected={project.status.code} onchange={val => update({status:val})} project_id={id} />
|
||||
<StateSelector selected={project.status} onchange={val => update({status:val})} project_id={id} />
|
||||
</td>
|
||||
</tr>
|
||||
{#if project.company}
|
||||
@@ -205,7 +205,7 @@
|
||||
</th>
|
||||
<td class="tasks">
|
||||
{#if tasks}
|
||||
<TaskList {tasks} {estimated_time} show_closed={project.show_closed} />
|
||||
<TaskList {tasks} {estimated_time} states={project.allowed_states} show_closed={project.show_closed} />
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
estimated_time,
|
||||
show_closed,
|
||||
siblings,
|
||||
states = {},
|
||||
task
|
||||
} = $props();
|
||||
let children = $state(null);
|
||||
@@ -117,24 +118,24 @@
|
||||
</script>
|
||||
|
||||
{#if !deleted}
|
||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {task.status.name.toLowerCase()}">
|
||||
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status].toLowerCase()}">
|
||||
<LineEditor bind:value={task.name} onclick={openTask} editable={true} onSet={setName} type="a" />
|
||||
{#if task.estimated_time}
|
||||
<span class="estimated_time">({+task.estimated_time} h)</span>
|
||||
{/if}
|
||||
{#if task.status.name != 'PENDING'}
|
||||
{#if states[task.status] != 'PENDING'}
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'PENDING'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'OPEN'}
|
||||
{#if states[task.status] != 'OPEN'}
|
||||
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'OPEN'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'STARTED'}
|
||||
{#if states[task.status] != 'STARTED'}
|
||||
<button class="symbol" title={t('started')} onclick={() => patchTask({status:'STARTED'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'COMPLETE'}
|
||||
{#if states[task.status] != 'COMPLETE'}
|
||||
<button class="symbol" title={t('complete')} onclick={() => patchTask({status:'COMPLETE'})}></button>
|
||||
{/if}
|
||||
{#if task.status.name != 'CANCELLED'}
|
||||
{#if states[task.status] != 'CANCELLED'}
|
||||
<button class="symbol" title={t('abort')} onclick={() => patchTask({status:'CANCELLED'})} ></button>
|
||||
{/if}
|
||||
<button class="symbol" title={t('delete_task')} onclick={deleteTask} ></button>
|
||||
@@ -143,7 +144,7 @@
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
{#if children}
|
||||
<TaskList tasks={children} {estimated_time} {show_closed} />
|
||||
<TaskList {states} tasks={children} {estimated_time} {show_closed} />
|
||||
{/if}
|
||||
</li>
|
||||
{/if}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import ListTask from './ListTask.svelte';
|
||||
|
||||
let { estimated_time, show_closed, tasks } = $props();
|
||||
let { estimated_time, show_closed, states = {}, tasks } = $props();
|
||||
|
||||
let sortedTasks = $derived.by(() => Object.values(tasks).sort((a, b) => a.name.localeCompare(b.name)));
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
<ul>
|
||||
{#each sortedTasks as task}
|
||||
<ListTask {task} siblings={tasks} {estimated_time} show_closed={show_closed || task.show_closed} />
|
||||
<ListTask {states} {task} siblings={tasks} {estimated_time} show_closed={show_closed || task.show_closed} />
|
||||
{/each}
|
||||
</ul>
|
||||
@@ -181,7 +181,7 @@
|
||||
<tr>
|
||||
<th>{t('state')}</th>
|
||||
<td>
|
||||
<StateSelector selected={task.status.code} onchange={val => update({status:val})} project_id={task.project_id} />
|
||||
<StateSelector selected={task.status} onchange={val => update({status:val})} project_id={task.project_id} />
|
||||
</td>
|
||||
</tr>
|
||||
{#if task.description}
|
||||
|
||||
Reference in New Issue
Block a user