mirror of
https://github.com/hcengineering/platform.git
synced 2025-02-23 04:42:13 +00:00
54 lines
1.4 KiB
Svelte
54 lines
1.4 KiB
Svelte
<script lang="ts">
|
|
import { Employee } from '@anticrm/contact'
|
|
import EmployeeStatusPresenter from './EmployeeStatusPresenter.svelte'
|
|
import PersonPresenter from '../components/PersonPresenter.svelte'
|
|
import { showPopup } from '@anticrm/ui'
|
|
import EmployeePreviewPopup from './EmployeePreviewPopup.svelte'
|
|
import { WithLookup } from '@anticrm/core'
|
|
|
|
export let value: WithLookup<Employee> | null | undefined
|
|
export let shouldShowAvatar: boolean = true
|
|
export let shouldShowName: boolean = true
|
|
export let onEmployeeEdit: ((event: MouseEvent) => void) | undefined = undefined
|
|
|
|
let container: HTMLElement
|
|
|
|
const onEdit = () => {
|
|
if (value) {
|
|
showPopup(
|
|
EmployeePreviewPopup,
|
|
{
|
|
employeeId: value._id
|
|
},
|
|
container
|
|
)
|
|
}
|
|
}
|
|
|
|
$: handlePersonEdit = onEmployeeEdit ?? onEdit
|
|
</script>
|
|
|
|
<div bind:this={container} class="flex-row-center clear-mins">
|
|
<div class="over-underline" class:pr-2={shouldShowName}>
|
|
<PersonPresenter
|
|
{value}
|
|
onEdit={handlePersonEdit}
|
|
{shouldShowAvatar}
|
|
{shouldShowName}
|
|
shouldShowPlaceholder={true}
|
|
/>
|
|
</div>
|
|
{#if value?.$lookup?.statuses?.length}
|
|
<div class="status content-color">
|
|
<EmployeeStatusPresenter employee={value} />
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
<style lang="scss">
|
|
.status {
|
|
font-weight: 400;
|
|
font-size: 0.875rem;
|
|
}
|
|
</style>
|