mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
respect vacancy selector in create application
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
e5b1814e25
commit
3fb14190f9
@ -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>
|
||||
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user