mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
Hide archived spaces from dialogs
Closes #858 Closes #865 Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
e848480ef3
commit
2fbbfab597
@ -18,7 +18,7 @@
|
||||
import type { IntlString } from '@anticrm/platform'
|
||||
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { Ref, Class, Space } from '@anticrm/core'
|
||||
import type { Ref, Class, Space, DocumentQuery } from '@anticrm/core'
|
||||
|
||||
import { Button, Label } from '@anticrm/ui'
|
||||
import SpaceSelect from './SpaceSelect.svelte'
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
export let spaceClass: Ref<Class<Space>> | undefined = undefined
|
||||
export let space: Ref<Space>
|
||||
export let spaceQuery: DocumentQuery<Space> | undefined = { archived: false }
|
||||
export let spaceLabel: IntlString | undefined = undefined
|
||||
export let spacePlaceholder: IntlString | undefined = undefined
|
||||
export let label: IntlString
|
||||
@ -52,7 +53,7 @@
|
||||
{#if spaceClass && spaceLabel && spacePlaceholder}
|
||||
<div class="flex-col pool">
|
||||
<div class="separator" />
|
||||
<SpaceSelect _class={spaceClass} label={spaceLabel} placeholder={spacePlaceholder} bind:value={space} />
|
||||
<SpaceSelect _class={spaceClass} spaceQuery={spaceQuery} label={spaceLabel} placeholder={spacePlaceholder} bind:value={space} />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="footer">
|
||||
|
@ -20,9 +20,10 @@
|
||||
import { Label, showPopup, IconFolder } from '@anticrm/ui'
|
||||
import SpacesPopup from './SpacesPopup.svelte'
|
||||
|
||||
import type { Ref, Class, Space } from '@anticrm/core'
|
||||
import type { Ref, Class, Space, DocumentQuery } from '@anticrm/core'
|
||||
|
||||
export let _class: Ref<Class<Space>>
|
||||
export let spaceQuery: DocumentQuery<Space> | undefined = { archived: false }
|
||||
export let label: IntlString
|
||||
export let placeholder: IntlString
|
||||
export let value: Ref<Space>
|
||||
@ -33,8 +34,8 @@
|
||||
|
||||
const client = getClient()
|
||||
|
||||
async function updateSelected(value: Ref<Space>) {
|
||||
selected = await client.findOne(_class, { _id: value })
|
||||
async function updateSelected (value: Ref<Space>) {
|
||||
selected = await client.findOne(_class, { ...(spaceQuery ?? {}), _id: value })
|
||||
}
|
||||
|
||||
$: updateSelected(value)
|
||||
@ -50,7 +51,7 @@
|
||||
<div class="flex-col cursor-pointer"
|
||||
bind:this={btn}
|
||||
on:click|preventDefault={() => {
|
||||
showPopup(SpacesPopup, { _class }, btn, (result) => {
|
||||
showPopup(SpacesPopup, { _class, spaceQuery }, btn, (result) => {
|
||||
if (result) {
|
||||
value = result._id
|
||||
}
|
||||
|
@ -18,17 +18,18 @@
|
||||
import ui, { Label, EditWithIcon, IconSearch } from '@anticrm/ui'
|
||||
import SpaceInfo from './SpaceInfo.svelte'
|
||||
|
||||
import type { Ref, Class, Space } from '@anticrm/core'
|
||||
import type { Ref, Class, Space, DocumentQuery } from '@anticrm/core'
|
||||
import { createQuery } from '../utils'
|
||||
|
||||
export let _class: Ref<Class<Space>>
|
||||
export let spaceQuery: DocumentQuery<Space> | undefined
|
||||
|
||||
let search: string = ''
|
||||
let objects: Space[] = []
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const query = createQuery()
|
||||
$: query.query(_class, {}, result => { objects = result })
|
||||
$: query.query(_class, { ...(spaceQuery ?? {}) }, result => { objects = result })
|
||||
afterUpdate(() => { dispatch('update', Date.now()) })
|
||||
</script>
|
||||
|
||||
|
@ -122,6 +122,7 @@
|
||||
okAction={createApplication}
|
||||
canSave={status.severity === Severity.OK}
|
||||
spaceClass={recruit.class.Vacancy}
|
||||
spaceQuery={{ archived: false }}
|
||||
spaceLabel={recruit.string.Vacancy}
|
||||
spacePlaceholder={recruit.string.SelectVacancy}
|
||||
bind:space={doc.space}
|
||||
|
Loading…
Reference in New Issue
Block a user