mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-23 10:05:01 +02:00
Team members (#2712)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import contact, { Employee, EmployeeAccount } from '@hcengineering/contact'
|
||||
import { AttachedData, Ref } from '@hcengineering/core'
|
||||
import { AssigneeBox, getClient } from '@hcengineering/presentation'
|
||||
import { Issue, IssueTemplateData } from '@hcengineering/tracker'
|
||||
@@ -34,11 +34,16 @@
|
||||
let prevAssigned: Ref<Employee>[] = []
|
||||
let projectLead: Ref<Employee> | undefined = undefined
|
||||
let projectMembers: Ref<Employee>[] = []
|
||||
let members: Ref<Employee>[] = []
|
||||
|
||||
$: getPreviousAssignees(value).then((res) => {
|
||||
prevAssigned = res
|
||||
})
|
||||
|
||||
function hasSpace (issue: Issue | AttachedData<Issue> | IssueTemplateData): issue is Issue {
|
||||
return (issue as Issue).space !== undefined
|
||||
}
|
||||
|
||||
async function updateProjectMembers (issue: Issue | AttachedData<Issue> | IssueTemplateData) {
|
||||
if (issue.project) {
|
||||
const project = await client.findOne(tracker.class.Project, { _id: issue.project })
|
||||
@@ -48,6 +53,17 @@
|
||||
projectLead = undefined
|
||||
projectMembers = []
|
||||
}
|
||||
if (hasSpace(issue)) {
|
||||
const team = await client.findOne(tracker.class.Team, { _id: issue.space })
|
||||
if (team !== undefined) {
|
||||
const accounts = await client.findAll(contact.class.EmployeeAccount, {
|
||||
_id: { $in: team.members as Ref<EmployeeAccount>[] }
|
||||
})
|
||||
members = accounts.map((p) => p.employee)
|
||||
} else {
|
||||
members = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: updateProjectMembers(value)
|
||||
@@ -73,6 +89,7 @@
|
||||
{prevAssigned}
|
||||
{projectLead}
|
||||
{projectMembers}
|
||||
{members}
|
||||
titleDeselect={tracker.string.Unassigned}
|
||||
{size}
|
||||
{kind}
|
||||
|
||||
Reference in New Issue
Block a user