mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
Fix Event source (#2258)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
93ebcce50d
commit
2ea4f3f93a
@ -36,6 +36,7 @@
|
||||
"NoReminders": "No reminders",
|
||||
"AllDay": "All day",
|
||||
"AndMore": "And {count} more",
|
||||
"CreateEvent": "Create event"
|
||||
"CreateEvent": "Create event",
|
||||
"EventFor": "Event for: "
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@
|
||||
"NoReminders": "Нет напоминаний",
|
||||
"AllDay": "Весь день",
|
||||
"AndMore": "И еще {count}",
|
||||
"CreateEvent": "Создать событие"
|
||||
"CreateEvent": "Создать событие",
|
||||
"EventFor": "Событие для: "
|
||||
}
|
||||
}
|
@ -14,13 +14,16 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Event } from '@anticrm/calendar'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import { Doc, WithLookup } from '@anticrm/core'
|
||||
import { createQuery, getClient } from '@anticrm/presentation'
|
||||
import { StyledTextBox } from '@anticrm/text-editor'
|
||||
import { StylishEdit } from '@anticrm/ui'
|
||||
import { AnyComponent, Component, Label, StylishEdit } from '@anticrm/ui'
|
||||
import ObjectPresenter from '@anticrm/view-resources/src/components/ObjectPresenter.svelte'
|
||||
import { getObjectPreview } from '@anticrm/view-resources/src/utils'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import calendar from '../plugin'
|
||||
|
||||
export let object: Event
|
||||
export let object: WithLookup<Event>
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const client = getClient()
|
||||
@ -31,9 +34,43 @@
|
||||
ignoreMixins: [calendar.mixin.Reminder]
|
||||
})
|
||||
})
|
||||
|
||||
const query = createQuery()
|
||||
let doc: Doc | undefined
|
||||
|
||||
$: if (object.attachedTo !== undefined && object.attachedToClass !== undefined) {
|
||||
query.query(object.attachedToClass, { _id: object.attachedTo }, (res) => {
|
||||
doc = res.shift()
|
||||
})
|
||||
}
|
||||
|
||||
let presenter: AnyComponent | undefined
|
||||
async function updatePreviewPresenter (doc?: Doc): Promise<void> {
|
||||
if (doc === undefined) {
|
||||
return
|
||||
}
|
||||
presenter = doc !== undefined ? await getObjectPreview(client, doc._class) : undefined
|
||||
}
|
||||
|
||||
$: updatePreviewPresenter(doc)
|
||||
</script>
|
||||
|
||||
{#if object !== undefined}
|
||||
{#if object.attachedTo && object.attachedToClass}
|
||||
<div class="mb-4">
|
||||
<div class="flex-row-center p-1">
|
||||
<Label label={calendar.string.EventFor} />
|
||||
<div class="ml-2">
|
||||
<ObjectPresenter _class={object.attachedToClass} objectId={object.attachedTo} value={doc} />
|
||||
</div>
|
||||
</div>
|
||||
{#if presenter !== undefined && doc}
|
||||
<div class="antiPanel p-4">
|
||||
<Component is={presenter} props={{ object: doc }} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="mb-2">
|
||||
<div class="mb-4">
|
||||
<StylishEdit
|
||||
|
@ -41,6 +41,7 @@ export default mergeIds(calendarId, calendar, {
|
||||
NoReminders: '' as IntlString,
|
||||
AllDay: '' as IntlString,
|
||||
AndMore: '' as IntlString,
|
||||
CreateEvent: '' as IntlString
|
||||
CreateEvent: '' as IntlString,
|
||||
EventFor: '' as IntlString
|
||||
}
|
||||
})
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
export let objectId: Ref<Doc>
|
||||
export let _class: Ref<Class<Doc>>
|
||||
export let value: Doc | undefined
|
||||
export let value: Doc | undefined = undefined
|
||||
export let props: Record<string, any> = {}
|
||||
|
||||
const client = getClient()
|
||||
|
Loading…
Reference in New Issue
Block a user