mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-29 11:19:44 +02:00
* Board: use standard actions Signed-off-by: Anna No <anna.no@xored.com> * Board: use standard actions Signed-off-by: Anna No <anna.no@xored.com> * fix lint issues Signed-off-by: Anna No <anna.no@xored.com> * fix lint issues Signed-off-by: Anna No <anna.no@xored.com> * fix merge conflicts Signed-off-by: Anna No <anna.no@xored.com> * fix merge conflicts Signed-off-by: Anna No <anna.no@xored.com>
61 lines
1.9 KiB
Svelte
61 lines
1.9 KiB
Svelte
<script lang="ts">
|
|
import { Card } from '@anticrm/board'
|
|
import { DocumentQuery, SortingOrder } from '@anticrm/core'
|
|
import { createQuery, getClient } from '@anticrm/presentation'
|
|
import { Button, Label } from '@anticrm/ui'
|
|
import type { Action } from '@anticrm/view'
|
|
import { invokeAction } from '@anticrm/view-resources'
|
|
import board from '../plugin'
|
|
import { getCardActions } from '../utils/CardActionUtils'
|
|
import KanbanCard from './KanbanCard.svelte'
|
|
|
|
export let query: DocumentQuery<Card> = {}
|
|
|
|
let archivedCards: Card[]
|
|
let actions: Action[] = []
|
|
const client = getClient()
|
|
const cardQuery = createQuery()
|
|
$: cardQuery.query(
|
|
board.class.Card,
|
|
{ ...query, isArchived: true },
|
|
(result) => {
|
|
archivedCards = result
|
|
},
|
|
{ sort: { rank: SortingOrder.Descending } }
|
|
)
|
|
getCardActions(client, { _id: { $in: [board.action.SendToBoard, board.action.Delete] } }).then(async (result) => {
|
|
actions = result
|
|
})
|
|
</script>
|
|
|
|
{#if archivedCards}
|
|
{#if !archivedCards.length}
|
|
<div class="flex-center fs-title pb-4">
|
|
<Label label={board.string.NoResults} />
|
|
</div>
|
|
{/if}
|
|
{#each archivedCards as card}
|
|
<KanbanCard object={card} />
|
|
<div class="flex-center flex-gap-2 w-full">
|
|
<Button
|
|
label={board.string.SendToBoard}
|
|
on:click={(e) => {
|
|
const unarchiveAction = actions.find((a) => a._id === board.action.SendToBoard)
|
|
if (unarchiveAction) {
|
|
invokeAction(card, e, unarchiveAction.action, unarchiveAction.actionProps)
|
|
}
|
|
}}
|
|
/>
|
|
<Button
|
|
label={board.string.Delete}
|
|
on:click={async (e) => {
|
|
const deleteAction = actions.find((a) => a._id === board.action.Delete)
|
|
if (deleteAction) {
|
|
invokeAction(card, e, deleteAction.action, deleteAction.actionProps)
|
|
}
|
|
}}
|
|
/>
|
|
</div>
|
|
{/each}
|
|
{/if}
|