Skip to content

Commit

Permalink
Add checklists info
Browse files Browse the repository at this point in the history
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
  • Loading branch information
Dvinyanin committed May 17, 2022
1 parent b834d4c commit 1ebac2e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/board-resources/src/components/KanbanCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import DatePresenter from './presenters/DatePresenter.svelte'
import { hasDate, openCardPanel, updateCard, updateCardMembers } from '../utils/CardUtils'
import { getElementPopupAlignment } from '../utils/PopupUtils'
import CheckListsPresenter from './presenters/ChecklistsPresenter.svelte'
export let object: WithLookup<Card>
Expand Down Expand Up @@ -191,6 +192,11 @@
<CommentsPresenter value={object} />
</div>
{/if}
{#if (object.todoItems ?? 0) > 0}
<div class="float-left">
<CheckListsPresenter value={object} />
</div>
{/if}
</div>
</div>
{#if (object.members?.length ?? 0) > 0}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script lang="ts">
import { Icon } from '@anticrm/ui'
import board, { Card } from '@anticrm/board'
import { createQuery } from '@anticrm/presentation'
import task, { TodoItem } from '@anticrm/task'
import { Ref } from '@anticrm/core'
export let value: Card
export let size: 'small' | 'medium' | 'large' = 'small'
const todoListQuery = createQuery()
let todoLists: Ref<TodoItem>[]
$: todoListQuery.query(task.class.TodoItem, { space: value.space, attachedTo: value._id }, (result) => {
console.debug(result)
todoLists = result.map(({ _id }) => _id)
})
const query = createQuery()
let done: number, total: number
$: query.query(task.class.TodoItem, { space: value.space, attachedTo: { $in: todoLists } }, (result) => {
console.debug(result)
total = result.total
done = result.filter((t) => t.done).length
})
</script>

{#if value && (total ?? 0) > 0}
<div class="sm-tool-icon ml-1 mr-1">
<Icon icon={board.icon.Card} {size} />
&nbsp;{done}/{total}
</div>
{/if}

0 comments on commit 1ebac2e

Please sign in to comment.