2021-08-07 17:03:06 +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-09-15 17:03:34 +00:00
|
|
|
import type { Ref, Space, Doc, Class } from '@anticrm/core'
|
2021-09-12 22:01:18 +00:00
|
|
|
import { CircleButton, EditBox, Link, showPopup, IconFile as FileIcon } from '@anticrm/ui'
|
2021-09-12 14:47:49 +00:00
|
|
|
import type { Attachment } from '@anticrm/chunter'
|
2021-09-12 06:45:16 +00:00
|
|
|
import FileUpload from './icons/FileUpload.svelte'
|
2021-09-15 17:51:22 +00:00
|
|
|
import { getClient, createQuery, Channels, AttributeEditor, PDFViewer } from '@anticrm/presentation'
|
2021-09-11 19:09:39 +00:00
|
|
|
import { Panel } from '@anticrm/panel'
|
2021-09-15 17:51:22 +00:00
|
|
|
import type { Candidate } from '@anticrm/recruit'
|
2021-09-11 18:33:51 +00:00
|
|
|
import Contact from './icons/Contact.svelte'
|
2021-09-12 06:45:16 +00:00
|
|
|
import Avatar from './icons/Avatar.svelte'
|
|
|
|
import Attachments from './Attachments.svelte'
|
2021-09-12 22:01:18 +00:00
|
|
|
import Edit from './icons/Edit.svelte'
|
|
|
|
import SocialEditor from './SocialEditor.svelte'
|
2021-10-04 14:32:27 +00:00
|
|
|
import AttributesBar from './AttributesBar.svelte'
|
2021-09-09 14:00:47 +00:00
|
|
|
|
|
|
|
import chunter from '@anticrm/chunter'
|
2021-08-18 10:57:06 +00:00
|
|
|
|
2021-08-07 17:03:06 +00:00
|
|
|
import recruit from '../plugin'
|
2021-10-01 12:28:52 +00:00
|
|
|
import { combineName, formatName, getFirstName, getLastName } from '@anticrm/contact'
|
2021-08-07 17:03:06 +00:00
|
|
|
|
2021-09-15 17:03:34 +00:00
|
|
|
export let _id: Ref<Candidate>
|
|
|
|
let object: Candidate
|
2021-08-07 17:03:06 +00:00
|
|
|
|
2021-10-01 12:28:52 +00:00
|
|
|
let firstName = ''
|
|
|
|
let lastName = ''
|
|
|
|
|
2021-08-07 17:03:06 +00:00
|
|
|
const client = getClient()
|
|
|
|
|
2021-09-15 17:03:34 +00:00
|
|
|
const query = createQuery()
|
2021-10-01 12:28:52 +00:00
|
|
|
$: query.query(recruit.class.Candidate, { _id }, result => { object = result[0]; firstName = getFirstName(result[0].name); lastName = getLastName(result[0].name)})
|
2021-09-15 17:03:34 +00:00
|
|
|
|
2021-09-12 14:47:49 +00:00
|
|
|
const dispatch = createEventDispatcher()
|
2021-09-12 06:45:16 +00:00
|
|
|
|
2021-09-12 22:01:18 +00:00
|
|
|
function saveChannels(result: any) {
|
|
|
|
object.channels = result
|
|
|
|
client.updateDoc(recruit.class.Candidate, object.space, object._id, { channels: result })
|
|
|
|
}
|
|
|
|
|
2021-10-01 12:28:52 +00:00
|
|
|
function firstNameChange() {
|
|
|
|
client.updateDoc(recruit.class.Candidate, object.space, object._id, { name: combineName(firstName, getLastName(object.name)) })
|
|
|
|
}
|
|
|
|
|
|
|
|
function lastNameChange() {
|
|
|
|
client.updateDoc(recruit.class.Candidate, object.space, object._id, { name: combineName(getFirstName(object.name), lastName) })
|
|
|
|
}
|
|
|
|
|
2021-08-07 17:03:06 +00:00
|
|
|
</script>
|
|
|
|
|
2021-09-15 17:03:34 +00:00
|
|
|
{#if object !== undefined}
|
2021-10-01 12:28:52 +00:00
|
|
|
<Panel icon={Contact} title={formatName(object.name)} {object} on:close={() => { dispatch('close') }}>
|
2021-10-04 14:32:27 +00:00
|
|
|
<AttributesBar slot="subtitle" />
|
|
|
|
<!-- <svelte:fragment slot="subtitle">
|
2021-09-12 22:12:43 +00:00
|
|
|
<div class="flex-between flex-reverse" style="width: 100%">
|
2021-09-12 06:45:16 +00:00
|
|
|
</div>
|
2021-10-04 14:32:27 +00:00
|
|
|
</svelte:fragment> -->
|
2021-09-12 06:45:16 +00:00
|
|
|
|
2021-09-12 16:06:39 +00:00
|
|
|
<div class="flex-row-center">
|
2021-09-12 06:45:16 +00:00
|
|
|
<div class="avatar">
|
|
|
|
<div class="border"/>
|
|
|
|
<Avatar />
|
|
|
|
</div>
|
|
|
|
<div class="flex-col">
|
2021-10-01 12:28:52 +00:00
|
|
|
<div class="name"><EditBox placeholder="John" maxWidth="20rem" bind:value={firstName} on:change={ firstNameChange }/></div>
|
|
|
|
<div class="name"><EditBox placeholder="Appleseed" maxWidth="20rem" bind:value={lastName} on:change={ lastNameChange }/></div>
|
2021-09-28 12:09:43 +00:00
|
|
|
<div class="title"><AttributeEditor maxWidth="20rem" _class={recruit.class.Candidate} {object} key="title"/></div>
|
2021-10-04 15:08:08 +00:00
|
|
|
<!-- <div class="city"><AttributeEditor maxWidth="20rem" _class={recruit.class.Candidate} {object} key="city"/></div> -->
|
|
|
|
<Channels value={object.channels}/>
|
|
|
|
<CircleButton icon={Edit} label={'Edit'} on:click={(ev) => showPopup(SocialEditor, { values: object.channels ?? [] }, ev.target, (result) => { saveChannels(result) })} />
|
2021-09-12 06:45:16 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="attachments">
|
2021-09-15 17:03:34 +00:00
|
|
|
<Attachments objectId={object._id} _class={object._class} space={object.space} {object}/>
|
2021-09-12 06:45:16 +00:00
|
|
|
</div>
|
2021-09-11 18:33:51 +00:00
|
|
|
|
|
|
|
</Panel>
|
2021-09-15 17:03:34 +00:00
|
|
|
{/if}
|
2021-08-30 13:37:49 +00:00
|
|
|
|
|
|
|
<style lang="scss">
|
2021-09-12 06:45:16 +00:00
|
|
|
@import '../../../../packages/theme/styles/mixins.scss';
|
|
|
|
|
|
|
|
.avatar {
|
|
|
|
flex-shrink: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-right: 1.5rem;
|
|
|
|
width: 6rem;
|
|
|
|
height: 6rem;
|
|
|
|
border-radius: 50%;
|
|
|
|
filter: drop-shadow(0px 14px 44px rgba(28, 23, 22, .8));
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: '';
|
|
|
|
@include bg-layer(var(--theme-avatar-hover), .5);
|
|
|
|
z-index: -1;
|
|
|
|
}
|
|
|
|
&::before {
|
|
|
|
content: '';
|
|
|
|
@include bg-layer(var(--theme-avatar-bg), .1);
|
|
|
|
backdrop-filter: blur(25px);
|
|
|
|
z-index: -2;
|
|
|
|
}
|
|
|
|
.border {
|
|
|
|
@include bg-fullsize;
|
|
|
|
border: 2px solid var(--theme-avatar-border);
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.name {
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 1.25rem;
|
|
|
|
color: var(--theme-caption-color);
|
|
|
|
}
|
2021-09-12 15:01:11 +00:00
|
|
|
.title, .city {
|
2021-09-12 06:45:16 +00:00
|
|
|
font-weight: 500;
|
|
|
|
font-size: .75rem;
|
|
|
|
color: var(--theme-content-color);
|
|
|
|
}
|
2021-09-12 15:01:11 +00:00
|
|
|
.title { margin-top: .75rem; }
|
2021-09-12 06:45:16 +00:00
|
|
|
.resume a {
|
|
|
|
font-size: .75rem;
|
|
|
|
color: var(--theme-content-dark-color);
|
|
|
|
&:hover { color: var(--theme-content-color); }
|
|
|
|
}
|
|
|
|
|
|
|
|
.attachments {
|
|
|
|
margin-top: 3.5rem;
|
|
|
|
}
|
|
|
|
|
2021-09-11 18:33:51 +00:00
|
|
|
// .container {
|
|
|
|
// display: flex;
|
|
|
|
// flex-direction: column;
|
|
|
|
// height: 100%;
|
|
|
|
// background-color: var(--theme-bg-color);
|
|
|
|
// border-radius: 1.25rem;
|
|
|
|
// box-shadow: 0px 3.125rem 7.5rem rgba(0, 0, 0, .4);
|
|
|
|
|
|
|
|
// .tabs-container {
|
|
|
|
// flex-grow: 1;
|
|
|
|
// display: flex;
|
|
|
|
// flex-direction: column;
|
|
|
|
// height: fit-content;
|
|
|
|
// padding: 0 2.5rem 2.5rem;
|
|
|
|
// }
|
|
|
|
// }
|
2021-08-30 13:37:49 +00:00
|
|
|
</style>
|