platform/plugins/recruit-resources/src/components/EditApplication.svelte
Andrey Sobolev 5d24970bf6
Candidate mixins (#745)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
2022-01-06 12:38:40 +01:00

67 lines
2.1 KiB
Svelte

<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { createEventDispatcher, onMount } from 'svelte'
import { createQuery } from '@anticrm/presentation'
import type { Candidate, Applicant, Vacancy } from '@anticrm/recruit'
import CandidateCard from './CandidateCard.svelte'
import VacancyCard from './VacancyCard.svelte'
import ExpandRightDouble from './icons/ExpandRightDouble.svelte'
import recruit from '../plugin'
import { Ref } from '@anticrm/core'
export let object: Applicant
let candidate: Candidate
let vacancy: Vacancy
const candidateQuery = createQuery()
$: if (object !== undefined) {
candidateQuery.query(recruit.mixin.Candidate, { _id: object.attachedTo as Ref<Candidate> }, (result) => {
candidate = result[0]
})
}
const vacancyQuery = createQuery()
$: if (object !== undefined) {
vacancyQuery.query(recruit.class.Vacancy, { _id: object.space }, (result) => {
vacancy = result[0]
})
}
const dispatch = createEventDispatcher()
onMount(() => {
dispatch('open', { ignoreKeys: ['comments', 'number'] })
})
</script>
{#if object !== undefined && candidate !== undefined}
<div class="flex-between">
<div class="card"><CandidateCard {candidate} /></div>
<div class="arrows"><ExpandRightDouble /></div>
<div class="card"><VacancyCard {vacancy} /></div>
</div>
{/if}
<style lang="scss">
.card {
align-self: stretch;
width: calc(50% - 3.5rem);
}
.arrows { width: 4rem; }
</style>