2021-12-06 10:07:08 +00:00
|
|
|
<!--
|
|
|
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
|
|
|
// Copyright © 2021 Hardcore Engineering Inc.
|
2021-12-10 09:46:08 +00:00
|
|
|
//
|
2021-12-06 10:07:08 +00:00
|
|
|
// 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
|
2021-12-10 09:46:08 +00:00
|
|
|
//
|
2021-12-06 10:07:08 +00:00
|
|
|
// 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.
|
2021-12-10 09:46:08 +00:00
|
|
|
//
|
2021-12-06 10:07:08 +00:00
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2021-12-15 09:15:43 +00:00
|
|
|
import { createEventDispatcher, onMount } from 'svelte'
|
2021-12-10 09:46:08 +00:00
|
|
|
import { getCurrentAccount, Ref, Space } from '@anticrm/core'
|
2022-05-14 09:47:00 +00:00
|
|
|
import { EditBox, createFocusManager, FocusHandler } from '@anticrm/ui'
|
2022-01-31 09:06:30 +00:00
|
|
|
import { getClient, createQuery } from '@anticrm/presentation'
|
2021-12-10 09:46:08 +00:00
|
|
|
import setting from '@anticrm/setting'
|
|
|
|
import { IntegrationType } from '@anticrm/setting'
|
2021-12-06 10:07:08 +00:00
|
|
|
import contact from '../plugin'
|
|
|
|
import { Organization } from '@anticrm/contact'
|
|
|
|
import Company from './icons/Company.svelte'
|
2022-01-31 09:06:30 +00:00
|
|
|
import ChannelsEditor from './ChannelsEditor.svelte'
|
2021-12-06 10:07:08 +00:00
|
|
|
|
2021-12-15 09:15:43 +00:00
|
|
|
export let object: Organization
|
2021-12-06 10:07:08 +00:00
|
|
|
|
|
|
|
const client = getClient()
|
|
|
|
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
|
2021-12-07 09:05:52 +00:00
|
|
|
function nameChange () {
|
2021-12-06 10:07:08 +00:00
|
|
|
client.updateDoc(object._class, object.space, object._id, { name: object.name })
|
|
|
|
}
|
2021-12-10 09:46:08 +00:00
|
|
|
|
|
|
|
const accountId = getCurrentAccount()._id
|
|
|
|
let integrations: Set<Ref<IntegrationType>> = new Set<Ref<IntegrationType>>()
|
|
|
|
const settingsQuery = createQuery()
|
2022-04-29 05:27:17 +00:00
|
|
|
$: settingsQuery.query(
|
|
|
|
setting.class.Integration,
|
|
|
|
{ space: accountId as string as Ref<Space>, disabled: false },
|
|
|
|
(res) => {
|
|
|
|
integrations = new Set(res.map((p) => p.type))
|
|
|
|
}
|
|
|
|
)
|
2021-12-15 09:15:43 +00:00
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
dispatch('open', { ignoreKeys: ['comments', 'name', 'channels'] })
|
|
|
|
})
|
2022-05-14 09:47:00 +00:00
|
|
|
|
|
|
|
const manager = createFocusManager()
|
2021-12-06 10:07:08 +00:00
|
|
|
</script>
|
|
|
|
|
2022-05-14 09:47:00 +00:00
|
|
|
<FocusHandler {manager} />
|
|
|
|
|
2021-12-06 10:07:08 +00:00
|
|
|
{#if object !== undefined}
|
2021-12-15 09:15:43 +00:00
|
|
|
<div class="flex-row-center">
|
|
|
|
<div class="mr-8 flex-center logo">
|
|
|
|
<Company size={'large'} />
|
|
|
|
</div>
|
|
|
|
<div class="flex-grow flex-col">
|
|
|
|
<div class="name">
|
2022-04-29 05:27:17 +00:00
|
|
|
<EditBox
|
|
|
|
placeholder={contact.string.PersonFirstNamePlaceholder}
|
|
|
|
maxWidth="20rem"
|
|
|
|
bind:value={object.name}
|
|
|
|
on:change={nameChange}
|
2022-05-14 09:47:00 +00:00
|
|
|
focus
|
|
|
|
focusIndex={1}
|
2022-04-29 05:27:17 +00:00
|
|
|
/>
|
2021-12-07 09:05:52 +00:00
|
|
|
</div>
|
2022-05-11 05:37:13 +00:00
|
|
|
<div class="separator" />
|
|
|
|
<div class="flex-row-center">
|
2022-05-14 09:47:00 +00:00
|
|
|
<ChannelsEditor attachedTo={object._id} attachedClass={object._class} {integrations} focusIndex={10} on:click />
|
2021-12-15 09:15:43 +00:00
|
|
|
</div>
|
2021-12-07 09:05:52 +00:00
|
|
|
</div>
|
2021-12-15 09:15:43 +00:00
|
|
|
</div>
|
2021-12-06 10:07:08 +00:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.logo {
|
|
|
|
width: 5rem;
|
|
|
|
height: 5rem;
|
|
|
|
color: var(--primary-button-color);
|
|
|
|
background-color: var(--primary-button-enabled);
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 1.25rem;
|
|
|
|
color: var(--theme-caption-color);
|
|
|
|
}
|
2022-05-11 05:37:13 +00:00
|
|
|
.separator {
|
|
|
|
margin: 1rem 0;
|
|
|
|
height: 1px;
|
|
|
|
background-color: var(--divider-color);
|
2021-12-06 10:07:08 +00:00
|
|
|
}
|
|
|
|
</style>
|