2021-09-27 10:32:36 +00:00
|
|
|
<!--
|
|
|
|
// Copyright © 2020 Anticrm Platform Contributors.
|
|
|
|
//
|
|
|
|
// 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 } from 'svelte'
|
2021-11-29 11:32:17 +00:00
|
|
|
import type { Ref } from '@anticrm/core'
|
|
|
|
import { createQuery } from '@anticrm/presentation'
|
2021-09-27 10:32:36 +00:00
|
|
|
import { Panel } from '@anticrm/panel'
|
2021-10-31 09:54:56 +00:00
|
|
|
import type { Candidate, Applicant, Vacancy } from '@anticrm/recruit'
|
2021-12-07 09:05:52 +00:00
|
|
|
import { Attachments } from '@anticrm/attachment-resources'
|
2021-09-27 10:32:36 +00:00
|
|
|
import Contact from './icons/Contact.svelte'
|
2021-10-31 09:54:56 +00:00
|
|
|
import CandidateCard from './CandidateCard.svelte'
|
|
|
|
import VacancyCard from './VacancyCard.svelte'
|
2021-09-27 10:32:36 +00:00
|
|
|
|
|
|
|
import recruit from '../plugin'
|
2021-10-31 09:54:56 +00:00
|
|
|
import { formatName } from '@anticrm/contact'
|
2021-11-29 11:32:17 +00:00
|
|
|
import ApplicantHeader from './ApplicantHeader.svelte'
|
2021-09-27 10:32:36 +00:00
|
|
|
|
|
|
|
export let _id: Ref<Applicant>
|
|
|
|
let object: Applicant
|
|
|
|
let candidate: Candidate
|
2021-10-31 09:54:56 +00:00
|
|
|
let vacancy: Vacancy
|
2021-09-27 10:32:36 +00:00
|
|
|
|
|
|
|
const query = createQuery()
|
|
|
|
$: query.query(recruit.class.Applicant, { _id }, result => { object = result[0] })
|
|
|
|
|
|
|
|
const candidateQuery = createQuery()
|
2021-10-30 10:13:55 +00:00
|
|
|
$: if (object !== undefined) candidateQuery.query(recruit.class.Candidate, { _id: object.attachedTo }, result => { candidate = result[0] })
|
2021-09-27 10:32:36 +00:00
|
|
|
|
2021-10-31 09:54:56 +00:00
|
|
|
const vacancyQuery = createQuery()
|
|
|
|
$: if (object !== undefined) vacancyQuery.query(recruit.class.Vacancy, { _id: object.space }, result => { vacancy = result[0] })
|
|
|
|
|
2021-09-27 10:32:36 +00:00
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if object !== undefined && candidate !== undefined}
|
2021-10-01 12:28:52 +00:00
|
|
|
<Panel icon={Contact} title={formatName(candidate.name)} {object} on:close={() => { dispatch('close') }}>
|
2021-11-29 11:32:17 +00:00
|
|
|
<ApplicantHeader {object} slot="subtitle" />
|
2021-09-27 10:32:36 +00:00
|
|
|
|
2021-10-31 09:54:56 +00:00
|
|
|
<div class="grid-cards">
|
|
|
|
<CandidateCard {candidate}/>
|
|
|
|
<VacancyCard {vacancy}/>
|
2021-09-27 10:32:36 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="attachments">
|
2021-12-07 09:05:52 +00:00
|
|
|
<Attachments objectId={object._id} _class={object._class} space={object.space} />
|
2021-09-27 10:32:36 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</Panel>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.attachments {
|
|
|
|
margin-top: 3.5rem;
|
|
|
|
}
|
|
|
|
|
2021-10-31 09:54:56 +00:00
|
|
|
.grid-cards {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
column-gap: 1.5rem;
|
|
|
|
}
|
2021-09-27 10:32:36 +00:00
|
|
|
</style>
|