2021-12-02 09:09:37 +00:00
|
|
|
<!--
|
|
|
|
// 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">
|
2022-02-07 09:21:32 +00:00
|
|
|
import { Attachments } from '@anticrm/attachment-resources'
|
2021-12-02 09:09:37 +00:00
|
|
|
import type { Ref } from '@anticrm/core'
|
2022-05-12 11:29:49 +00:00
|
|
|
import { Panel } from '@anticrm/panel'
|
2022-04-21 15:47:04 +00:00
|
|
|
import { AttributesBar, createQuery, getClient, Members } from '@anticrm/presentation'
|
2021-12-02 09:09:37 +00:00
|
|
|
import { Vacancy } from '@anticrm/recruit'
|
2022-02-07 09:21:32 +00:00
|
|
|
import { StyledTextBox } from '@anticrm/text-editor'
|
2022-05-12 11:29:49 +00:00
|
|
|
import { EditBox } from '@anticrm/ui'
|
2021-12-02 09:09:37 +00:00
|
|
|
import { createEventDispatcher } from 'svelte'
|
|
|
|
import recruit from '../plugin'
|
|
|
|
|
|
|
|
export let _id: Ref<Vacancy>
|
|
|
|
|
2022-04-06 10:20:35 +00:00
|
|
|
let object: Required<Vacancy>
|
2021-12-02 09:09:37 +00:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
|
|
|
|
const client = getClient()
|
|
|
|
|
|
|
|
const query = createQuery()
|
|
|
|
const clazz = client.getHierarchy().getClass(recruit.class.Vacancy)
|
2022-02-07 09:21:32 +00:00
|
|
|
|
2022-04-06 10:20:35 +00:00
|
|
|
function updateObject (_id: Ref<Vacancy>): void {
|
2022-04-29 05:27:17 +00:00
|
|
|
query.query(recruit.class.Vacancy, { _id }, (result) => {
|
2022-04-06 10:20:35 +00:00
|
|
|
object = result[0] as Required<Vacancy>
|
2022-02-07 09:21:32 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
$: updateObject(_id)
|
2021-12-02 09:09:37 +00:00
|
|
|
|
2022-05-12 11:29:49 +00:00
|
|
|
// const tabs: IntlString[] = [recruit.string.General, recruit.string.Members, activity.string.Activity]
|
2021-12-02 09:09:37 +00:00
|
|
|
|
2022-04-29 05:27:17 +00:00
|
|
|
function onChange (key: string, value: any): void {
|
2021-12-02 09:09:37 +00:00
|
|
|
client.updateDoc(object._class, object.space, object._id, { [key]: value })
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-05-12 11:29:49 +00:00
|
|
|
{#if object}
|
|
|
|
<Panel
|
|
|
|
title={object.name}
|
|
|
|
subtitle={object.description}
|
|
|
|
icon={clazz.icon}
|
|
|
|
isHeader={false}
|
|
|
|
isAside={true}
|
|
|
|
{object}
|
|
|
|
on:close={() => {
|
|
|
|
dispatch('close')
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<svelte:fragment slot="attributes" let:direction={dir}>
|
|
|
|
{#if dir === 'column'}
|
|
|
|
<div class="ac-subtitle">
|
|
|
|
<div class="ac-subtitle-content">
|
|
|
|
<AttributesBar {object} keys={['dueTo', 'location', 'company']} vertical={dir === 'column'} />
|
2022-04-29 05:27:17 +00:00
|
|
|
</div>
|
2021-12-02 09:09:37 +00:00
|
|
|
</div>
|
2022-05-12 11:29:49 +00:00
|
|
|
{/if}
|
|
|
|
</svelte:fragment>
|
|
|
|
|
|
|
|
<EditBox
|
|
|
|
label={recruit.string.VacancyName}
|
|
|
|
bind:value={object.name}
|
|
|
|
placeholder={recruit.string.VacancyPlaceholder}
|
|
|
|
maxWidth="39rem"
|
|
|
|
focus
|
|
|
|
on:change={() => {
|
|
|
|
if (object.name.trim().length > 0) {
|
|
|
|
onChange('name', object.name)
|
|
|
|
} else {
|
|
|
|
// Revert previos object.name
|
|
|
|
updateObject(_id)
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<EditBox
|
|
|
|
label={recruit.string.Description}
|
|
|
|
bind:value={object.description}
|
|
|
|
placeholder={recruit.string.VacancyDescription}
|
|
|
|
maxWidth="39rem"
|
|
|
|
focus
|
|
|
|
on:change={() => {
|
|
|
|
onChange('description', object.description)
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<div class="mt-10">
|
|
|
|
<span class="title">Details</span>
|
|
|
|
<div class="description-container">
|
|
|
|
<StyledTextBox
|
|
|
|
bind:content={object.fullDescription}
|
|
|
|
on:value={(evt) => {
|
|
|
|
onChange('fullDescription', evt.detail)
|
2022-04-29 05:27:17 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
2021-12-02 09:09:37 +00:00
|
|
|
</div>
|
2022-05-12 11:29:49 +00:00
|
|
|
<div class="mt-14">
|
|
|
|
<Attachments objectId={object._id} _class={object._class} space={object.space} />
|
2021-12-02 09:09:37 +00:00
|
|
|
</div>
|
2022-05-12 11:29:49 +00:00
|
|
|
<div class="mt-14">
|
2022-04-21 15:47:04 +00:00
|
|
|
<Members space={object} />
|
2022-05-12 11:29:49 +00:00
|
|
|
</div>
|
|
|
|
</Panel>
|
|
|
|
{/if}
|
2021-12-02 09:09:37 +00:00
|
|
|
|
|
|
|
<style lang="scss">
|
2022-02-08 09:02:57 +00:00
|
|
|
.description-container {
|
|
|
|
display: flex;
|
2022-04-29 05:27:17 +00:00
|
|
|
margin-top: 0.5rem;
|
2022-02-08 09:02:57 +00:00
|
|
|
padding: 1rem;
|
|
|
|
height: 12rem;
|
|
|
|
background-color: var(--theme-bg-accent-color);
|
|
|
|
border: 1px solid var(--theme-bg-accent-color);
|
2022-04-29 05:27:17 +00:00
|
|
|
border-radius: 0.25rem;
|
2022-02-08 09:02:57 +00:00
|
|
|
}
|
2022-02-07 09:39:23 +00:00
|
|
|
</style>
|