respect vacancy selector in create application

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-09 09:54:52 +02:00
parent e5b1814e25
commit 3fb14190f9
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 7 additions and 3 deletions

View File

@ -27,6 +27,7 @@
import SpaceSelect from './SpaceSelect.svelte'
export let spaceClass: Ref<Class<Space>>
export let space: Ref<Space>
export let label: IntlString
export let okLabel: IntlString
export let okAction: () => void
@ -44,7 +45,7 @@
<div class="content"><slot /></div>
<div class="flex-col pool">
<div class="separator" />
<SpaceSelect _class={spaceClass} label={'Title'} placeholder={'Select Project'} />
<SpaceSelect _class={spaceClass} label={'Title'} placeholder={'Select Project'} bind:value={space} />
</div>
</form>

View File

@ -34,15 +34,17 @@
export let preserveCandidate = false
let _space = space
const dispatch = createEventDispatcher()
const client = getClient()
async function createApplication() {
const state = await client.findOne(core.class.State, { space })
const state = await client.findOne(core.class.State, { space: _space })
if (state === undefined) {
throw new Error('create application: state not found')
}
await client.createDoc(recruit.class.Applicant, space, {
await client.createDoc(recruit.class.Applicant, _space, {
candidate,
state: state._id
})
@ -56,6 +58,7 @@
okAction={createApplication}
canSave={candidate !== undefined}
spaceClass={recruit.class.Vacancy}
bind:space={_space}
on:close={() => { dispatch('close') }}>
<Grid column={1} rowGap={1.75}>
{#if !preserveCandidate}