Fix integration selector (#3020)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-04-20 00:19:36 +06:00 committed by GitHub
parent e7cd05c140
commit dee07c0bce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,14 +13,15 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { Employee } from '@hcengineering/contact' import { Employee, EmployeeAccount } from '@hcengineering/contact'
import { Account, DocumentQuery, Ref } from '@hcengineering/core' import core, { Account, DocumentQuery, Ref, matchQuery } from '@hcengineering/core'
import { IntlString } from '@hcengineering/platform' import { IntlString } from '@hcengineering/platform'
import { ButtonKind, ButtonSize } from '@hcengineering/ui' import { ButtonKind, ButtonSize } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import contact from '../plugin' import contact from '../plugin'
import { employeeAccountByIdStore } from '../utils' import { employeeAccountByIdStore } from '../utils'
import UserBox from './UserBox.svelte' import UserBox from './UserBox.svelte'
import { getClient } from '@hcengineering/presentation'
export let label: IntlString = contact.string.Employee export let label: IntlString = contact.string.Employee
export let value: Ref<Account> | null | undefined export let value: Ref<Account> | null | undefined
@ -29,7 +30,14 @@
export let size: ButtonSize = 'small' export let size: ButtonSize = 'small'
export let readonly = false export let readonly = false
$: accounts = Array.from($employeeAccountByIdStore.values()) const client = getClient()
const hierarchy = client.getHierarchy()
$: accounts = matchQuery<Account>(
Array.from($employeeAccountByIdStore.values()),
docQuery,
core.class.Account,
hierarchy
) as EmployeeAccount[]
let map: Map<Ref<Employee>, Ref<Account>> = new Map() let map: Map<Ref<Employee>, Ref<Account>> = new Map()
$: map = new Map(accounts.map((p) => [p.employee, p._id])) $: map = new Map(accounts.map((p) => [p.employee, p._id]))