completed user-defined states
This commit is contained in:
@@ -19,10 +19,9 @@
|
||||
let project = $state(null);
|
||||
let ready = $state(false);
|
||||
let router = useTinyRouter();
|
||||
let states = $state(null);
|
||||
let tasks = $state({});
|
||||
let users = {};
|
||||
let columns = $derived(states?Object.keys(states).length+1:1);
|
||||
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
|
||||
|
||||
async function create(name,user_id,state){
|
||||
var url = api('task/add');
|
||||
@@ -85,7 +84,6 @@
|
||||
|
||||
async function load(){
|
||||
await loadProject();
|
||||
await loadStates();
|
||||
await loadTasks({project_id:+id,parent_task_id:0});
|
||||
ready = true;
|
||||
loadTags();
|
||||
@@ -107,17 +105,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function loadStates(){
|
||||
const url = api(`project/${id}/states`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
states = await resp.json();
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadTag(task){
|
||||
const url = api(`tags/task/${task.id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
@@ -194,14 +181,14 @@
|
||||
{t('filter')}
|
||||
</span>
|
||||
<div class="head">{t('user')}</div>
|
||||
{#if states}
|
||||
{#each Object.entries(states) as [sid,state]}
|
||||
<div class="head">{t('state_'+state.toLowerCase())}</div>
|
||||
{#if project.allowed_states}
|
||||
{#each Object.entries(project.allowed_states) as [sid,state]}
|
||||
<div class="head">{sid%10?state:t('state_'+state.toLowerCase())}</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{#each Object.entries(tasks) as [uid,stateList]}
|
||||
<div class="user">{users[uid]}</div>
|
||||
{#each Object.entries(states) as [state,name]}
|
||||
{#each Object.entries(project.allowed_states) as [state,name]}
|
||||
<div class={['state_'+state, highlight.user == uid && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,uid,state)} ondrop={ev => drop(uid,state)} >
|
||||
{#if stateList[state]}
|
||||
{#each Object.values(stateList[state]).sort((a,b) => a.name.localeCompare(b.name)) as task}
|
||||
|
||||
Reference in New Issue
Block a user