|
14 | 14 | --> |
15 | 15 | <script lang="ts"> |
16 | 16 | import contact from '@anticrm/contact' |
17 | | - import { Class, Doc, FindOptions, Ref, WithLookup } from '@anticrm/core' |
18 | | - import { Kanban } from '@anticrm/kanban' |
19 | | - import { getClient } from '@anticrm/presentation' |
20 | | - import { Issue, IssuesGrouping, Team, ViewOptions } from '@anticrm/tracker' |
21 | | - import { Button, Icon, IconAdd, showPopup, Tooltip } from '@anticrm/ui' |
| 17 | + import { Class, Doc, FindOptions, Ref, SortingOrder, WithLookup } from '@anticrm/core' |
| 18 | + import { Kanban, TypeState } from '@anticrm/kanban' |
| 19 | + import notification from '@anticrm/notification' |
| 20 | + import { createQuery, getClient } from '@anticrm/presentation' |
| 21 | + import { Issue, IssuesGrouping, IssueStatus, Team, ViewOptions } from '@anticrm/tracker' |
| 22 | + import { Button, Component, Icon, IconAdd, showPanel, showPopup, Tooltip } from '@anticrm/ui' |
22 | 23 | import { focusStore, ListSelectionProvider, SelectDirection, selectionStore } from '@anticrm/view-resources' |
23 | 24 | import ActionContext from '@anticrm/view-resources/src/components/ActionContext.svelte' |
24 | 25 | import Menu from '@anticrm/view-resources/src/components/Menu.svelte' |
25 | 26 | import { onMount } from 'svelte' |
26 | 27 | import tracker from '../../plugin' |
27 | 28 | import { getKanbanStatuses } from '../../utils' |
28 | 29 | import CreateIssue from '../CreateIssue.svelte' |
| 30 | + import ProjectEditor from '../projects/ProjectEditor.svelte' |
29 | 31 | import AssigneePresenter from './AssigneePresenter.svelte' |
| 32 | + import SubIssuesSelector from './edit/SubIssuesSelector.svelte' |
30 | 33 | import IssuePresenter from './IssuePresenter.svelte' |
31 | 34 | import PriorityEditor from './PriorityEditor.svelte' |
32 | 35 |
|
|
42 | 45 | ...query |
43 | 46 | } |
44 | 47 |
|
| 48 | + const spaceQuery = createQuery() |
| 49 | + const statusesQuery = createQuery() |
| 50 | +
|
45 | 51 | const client = getClient() |
| 52 | + let currentTeam: Team | undefined |
| 53 | + $: spaceQuery.query(tracker.class.Team, { _id: currentSpace }, (res) => { |
| 54 | + currentTeam = res.shift() |
| 55 | + }) |
| 56 | +
|
| 57 | + let issueStatuses: WithLookup<IssueStatus>[] | undefined |
| 58 | + let states: TypeState[] | undefined |
| 59 | + $: statusesQuery.query( |
| 60 | + tracker.class.IssueStatus, |
| 61 | + { attachedTo: currentSpace }, |
| 62 | + (is) => { |
| 63 | + states = is.map((status) => ({ |
| 64 | + _id: status._id, |
| 65 | + title: status.name, |
| 66 | + color: status.color ?? status.$lookup?.category?.color ?? 0, |
| 67 | + icon: status.$lookup?.category?.icon ?? undefined |
| 68 | + })) |
| 69 | + issueStatuses = is |
| 70 | + }, |
| 71 | + { |
| 72 | + lookup: { category: tracker.class.IssueStatusCategory }, |
| 73 | + sort: { rank: SortingOrder.Ascending } |
| 74 | + } |
| 75 | + ) |
46 | 76 |
|
47 | 77 | function toIssue (object: any): WithLookup<Issue> { |
48 | 78 | return object as WithLookup<Issue> |
|
51 | 81 | const options: FindOptions<Issue> = { |
52 | 82 | lookup: { |
53 | 83 | assignee: contact.class.Employee, |
54 | | - space: tracker.class.Team |
| 84 | + space: tracker.class.Team, |
| 85 | + _id: { |
| 86 | + subIssues: tracker.class.Issue |
| 87 | + } |
55 | 88 | } |
56 | 89 | } |
57 | 90 |
|
|
133 | 166 | </svelte:fragment> |
134 | 167 | <svelte:fragment slot="card" let:object> |
135 | 168 | {@const issue = toIssue(object)} |
136 | | - <div class="tracker-card"> |
| 169 | + <div |
| 170 | + class="tracker-card" |
| 171 | + on:click={() => { |
| 172 | + showPanel(tracker.component.EditIssue, object._id, object._class, 'content') |
| 173 | + }} |
| 174 | + > |
137 | 175 | <div class="flex-col mr-6"> |
138 | 176 | <IssuePresenter value={issue} /> |
139 | 177 | <span class="fs-bold caption-color mt-1 lines-limit-2"> |
|
142 | 180 | </div> |
143 | 181 | <div class="abs-rt-content"> |
144 | 182 | <AssigneePresenter |
145 | | - value={issue?.$lookup?.assignee} |
| 183 | + value={issue.$lookup?.assignee} |
| 184 | + defaultClass={contact.class.Employee} |
146 | 185 | issueId={issue._id} |
147 | 186 | {currentSpace} |
148 | 187 | isEditable={true} |
149 | | - defaultClass={contact.class.Employee} |
150 | 188 | /> |
| 189 | + <div class="flex-center mt-2"> |
| 190 | + <Component is={notification.component.NotificationPresenter} props={{ value: object }} /> |
| 191 | + </div> |
151 | 192 | </div> |
152 | 193 | <div class="buttons-group xsmall-gap mt-10px"> |
| 194 | + {#if issue && issueStatuses && issue.subIssues > 0} |
| 195 | + <SubIssuesSelector {issue} {currentTeam} {issueStatuses} /> |
| 196 | + {/if} |
153 | 197 | <PriorityEditor |
154 | 198 | value={issue} |
155 | 199 | isEditable={true} |
|
158 | 202 | justify={'center'} |
159 | 203 | width={''} |
160 | 204 | /> |
| 205 | + <ProjectEditor |
| 206 | + value={issue} |
| 207 | + isEditable={true} |
| 208 | + kind={'link-bordered'} |
| 209 | + size={'inline'} |
| 210 | + justify={'center'} |
| 211 | + width={''} |
| 212 | + /> |
161 | 213 | </div> |
162 | 214 | </div> |
163 | 215 | </svelte:fragment> |
|
0 commit comments