From 3fb14190f94cc56ccb800e309f59a3edbebabfdc Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Thu, 9 Sep 2021 09:54:52 +0200 Subject: [PATCH] respect vacancy selector in create application Signed-off-by: Andrey Platov --- packages/presentation/src/components/Card.svelte | 3 ++- .../src/components/CreateApplication.svelte | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/presentation/src/components/Card.svelte b/packages/presentation/src/components/Card.svelte index d9e42988a6..db7831f01e 100644 --- a/packages/presentation/src/components/Card.svelte +++ b/packages/presentation/src/components/Card.svelte @@ -27,6 +27,7 @@ import SpaceSelect from './SpaceSelect.svelte' export let spaceClass: Ref> + export let space: Ref export let label: IntlString export let okLabel: IntlString export let okAction: () => void @@ -44,7 +45,7 @@
- +
diff --git a/plugins/recruit-resources/src/components/CreateApplication.svelte b/plugins/recruit-resources/src/components/CreateApplication.svelte index d4bd2ef1ac..5804ad4f1f 100644 --- a/plugins/recruit-resources/src/components/CreateApplication.svelte +++ b/plugins/recruit-resources/src/components/CreateApplication.svelte @@ -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') }}> {#if !preserveCandidate}