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'
|
|
|
|
import type { Ref, Space, Doc, Class } from '@anticrm/core'
|
|
|
|
import { CircleButton, EditBox, Link, showPopup, IconFile as FileIcon } from '@anticrm/ui'
|
|
|
|
import type { Attachment } from '@anticrm/chunter'
|
|
|
|
import FileUpload from './icons/FileUpload.svelte'
|
|
|
|
import { getClient, createQuery, Channels, AttributeEditor, PDFViewer } from '@anticrm/presentation'
|
|
|
|
import { Panel } from '@anticrm/panel'
|
2021-10-31 09:54:56 +00:00
|
|
|
import type { Candidate, Applicant, Vacancy } from '@anticrm/recruit'
|
2021-09-27 10:32:36 +00:00
|
|
|
import Contact from './icons/Contact.svelte'
|
|
|
|
import Avatar from './icons/Avatar.svelte'
|
|
|
|
import Attachments from './Attachments.svelte'
|
|
|
|
import Edit from './icons/Edit.svelte'
|
|
|
|
import SocialEditor from './SocialEditor.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 chunter from '@anticrm/chunter'
|
|
|
|
|
|
|
|
import recruit from '../plugin'
|
2021-10-31 09:54:56 +00:00
|
|
|
import { formatName } from '@anticrm/contact'
|
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 client = getClient()
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
// function saveChannels(result: any) {
|
|
|
|
// object.channels = result
|
|
|
|
// client.updateDoc(recruit.class.Candidate, object.space, object._id, { channels: result })
|
|
|
|
// }
|
|
|
|
|
|
|
|
function getVacancyName() {
|
|
|
|
return client.getModel().getObject(object.space).name
|
|
|
|
}
|
|
|
|
|
|
|
|
</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-09-27 10:32:36 +00:00
|
|
|
<!-- <svelte:fragment slot="subtitle">
|
|
|
|
<div class="flex-between flex-reverse" style="width: 100%">
|
|
|
|
<Channels value={object.channels}/>
|
|
|
|
<CircleButton icon={Edit} label={'Edit'} on:click={(ev) => showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { saveChannels(result) })} />
|
|
|
|
</div>
|
|
|
|
</svelte:fragment> -->
|
|
|
|
|
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">
|
|
|
|
<Attachments objectId={object._id} _class={object._class} space={object.space} {object}/>
|
|
|
|
</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>
|