platform/plugins/recruit-resources/src/components/EditCandidate.svelte

150 lines
4.6 KiB
Svelte
Raw Normal View History

<!--
// 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 } 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 PDFViewer from './PDFViewer.svelte'
import { getClient, Channels, AttributeEditor } from '@anticrm/presentation'
import { Panel } from '@anticrm/panel'
import type { Candidate } from '@anticrm/recruit'
import DialogHeader from './DialogHeader.svelte'
2021-09-11 18:33:51 +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'
import chunter from '@anticrm/chunter'
import recruit from '../plugin'
export let object: Candidate
const client = getClient()
const dispatch = createEventDispatcher()
function saveChannels(result: any) {
object.channels = result
client.updateDoc(recruit.class.Candidate, object.space, object._id, { channels: result })
}
</script>
<Panel icon={Contact} title={object.firstName + ' ' + object.lastName} {object} on:close={() => { dispatch('close') }}>
<svelte:fragment slot="subtitle">
<div class="flex-row-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>
<div class="flex-row-center">
<div class="avatar">
<div class="border"/>
<Avatar />
</div>
<div class="flex-col">
<div class="name"><AttributeEditor maxWidth="20rem" _class={recruit.class.Candidate} bind:object={object} key="firstName"/></div>
<div class="name"><AttributeEditor maxWidth="20rem" _class={recruit.class.Candidate} bind:object={object} key="lastName"/></div>
<div class="title"><AttributeEditor maxWidth="20rem" _class={recruit.class.Candidate} bind:object={object} key="title"/></div>
<div class="city"><AttributeEditor maxWidth="20rem" _class={recruit.class.Candidate} bind:object={object} key="city"/></div>
</div>
</div>
<div class="attachments">
<Attachments {object}/>
</div>
2021-09-11 18:33:51 +00:00
</Panel>
<style lang="scss">
@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);
}
.title, .city {
font-weight: 500;
font-size: .75rem;
color: var(--theme-content-color);
}
.title { margin-top: .75rem; }
.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;
// }
// }
</style>