mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 20:39:03 +00:00
Board: Add checklists info (#1772)
This commit is contained in:
parent
56c6288c07
commit
077f666619
@ -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>
|
||||
|
||||
@ -186,6 +187,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}
|
||||
|
@ -0,0 +1,29 @@
|
||||
<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) => {
|
||||
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) => {
|
||||
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} />
|
||||
{done}/{total}
|
||||
</div>
|
||||
{/if}
|
Loading…
Reference in New Issue
Block a user