mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 04:25:03 +02:00
TSK-360: Assignee selection enhancements (#2509)
Signed-off-by: Denis Maslennikov <denis.maslennikov@gmail.com>
This commit is contained in:
@@ -15,11 +15,12 @@
|
||||
<script lang="ts">
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import { AttachedData, Ref } from '@hcengineering/core'
|
||||
import { EmployeeBox, getClient } from '@hcengineering/presentation'
|
||||
import { AssigneeBox, getClient } from '@hcengineering/presentation'
|
||||
import { Issue, IssueTemplateData } from '@hcengineering/tracker'
|
||||
import { ButtonKind, ButtonSize, TooltipAlignment } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import tracker from '../../plugin'
|
||||
import { getPreviousAssignees } from '../../utils'
|
||||
|
||||
export let value: Issue | AttachedData<Issue> | IssueTemplateData
|
||||
export let size: ButtonSize = 'large'
|
||||
@@ -30,6 +31,27 @@
|
||||
const client = getClient()
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let prevAssigned: Ref<Employee>[] = []
|
||||
let projectLead: Ref<Employee> | undefined = undefined
|
||||
let projectMembers: Ref<Employee>[] = []
|
||||
|
||||
$: getPreviousAssignees(value).then((res) => {
|
||||
prevAssigned = res
|
||||
})
|
||||
|
||||
async function updateProjectMembers (issue: Issue | AttachedData<Issue> | IssueTemplateData) {
|
||||
if (issue.project) {
|
||||
const project = await client.findOne(tracker.class.Project, { _id: issue.project })
|
||||
projectLead = project?.lead || undefined
|
||||
projectMembers = project?.members || []
|
||||
} else {
|
||||
projectLead = undefined
|
||||
projectMembers = []
|
||||
}
|
||||
}
|
||||
|
||||
$: updateProjectMembers(value)
|
||||
|
||||
const handleAssigneeChanged = async (newAssignee: Ref<Employee> | undefined) => {
|
||||
if (newAssignee === undefined || value.assignee === newAssignee) {
|
||||
return
|
||||
@@ -44,11 +66,13 @@
|
||||
</script>
|
||||
|
||||
{#if value}
|
||||
<EmployeeBox
|
||||
<AssigneeBox
|
||||
label={tracker.string.Assignee}
|
||||
placeholder={tracker.string.Assignee}
|
||||
value={value.assignee}
|
||||
allowDeselect
|
||||
{prevAssigned}
|
||||
{projectLead}
|
||||
{projectMembers}
|
||||
titleDeselect={tracker.string.Unassigned}
|
||||
{size}
|
||||
{kind}
|
||||
|
||||
+14
-16
@@ -15,7 +15,7 @@
|
||||
<script lang="ts">
|
||||
import contact from '@hcengineering/contact'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { UserBox } from '@hcengineering/presentation'
|
||||
import { AssigneeBox } from '@hcengineering/presentation'
|
||||
import { Issue, Team } from '@hcengineering/tracker'
|
||||
import { deviceOptionsStore as deviceInfo, getEventPositionElement, ListView, showPopup } from '@hcengineering/ui'
|
||||
import { ContextMenu, FixedColumn, ListSelectionProvider } from '@hcengineering/view-resources'
|
||||
@@ -60,21 +60,19 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="flex-row-center clear-mins gap-2 self-end" class:p-text={twoRows}>
|
||||
<FixedColumn key={'estimation_issue_assignee'} justify={'right'}>
|
||||
<UserBox
|
||||
width={'100%'}
|
||||
label={tracker.string.Assignee}
|
||||
_class={contact.class.Employee}
|
||||
value={issue.assignee}
|
||||
readonly
|
||||
showNavigate={false}
|
||||
/>
|
||||
</FixedColumn>
|
||||
<FixedColumn key={'estimation'} justify={'left'}>
|
||||
<EstimationEditor value={issue} kind={'list'} />
|
||||
</FixedColumn>
|
||||
</div>
|
||||
<FixedColumn key={'estimation_issue_assignee'} justify={'right'}>
|
||||
<AssigneeBox
|
||||
width={'100%'}
|
||||
label={tracker.string.Assignee}
|
||||
_class={contact.class.Employee}
|
||||
value={issue.assignee}
|
||||
readonly
|
||||
showNavigate={false}
|
||||
/>
|
||||
</FixedColumn>
|
||||
<FixedColumn key={'estimation'} justify={'left'}>
|
||||
<EstimationEditor value={issue} kind={'list'} />
|
||||
</FixedColumn>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</ListView>
|
||||
|
||||
Reference in New Issue
Block a user