mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-13 05:07:43 +02:00
Fillable templates (#2667)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -44,6 +44,7 @@ import StringTypeEditor from './components/typeEditors/StringTypeEditor.svelte'
|
||||
import WorkspaceSettings from './components/WorkspaceSettings.svelte'
|
||||
import InviteSetting from './components/InviteSetting.svelte'
|
||||
import setting from './plugin'
|
||||
import { getOwnerName, getValue } from './utils'
|
||||
|
||||
export { ClassSetting }
|
||||
|
||||
@@ -101,5 +102,9 @@ export default async (): Promise<Resources> => ({
|
||||
},
|
||||
actionImpl: {
|
||||
DeleteMixin
|
||||
},
|
||||
function: {
|
||||
GetOwnerName: getOwnerName,
|
||||
GetValue: getValue
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import contact, { EmployeeAccount, formatName } from '@hcengineering/contact'
|
||||
import { Class, Doc, Hierarchy, Ref } from '@hcengineering/core'
|
||||
import setting from '@hcengineering/setting'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import setting, { Integration } from '@hcengineering/setting'
|
||||
import { TemplateDataProvider } from '@hcengineering/templates'
|
||||
|
||||
function isEditable (hierarchy: Hierarchy, p: Class<Doc>): boolean {
|
||||
let ancestors = [p._id]
|
||||
@@ -45,3 +48,19 @@ export function filterDescendants (
|
||||
|
||||
return _classes.map((p) => p._id)
|
||||
}
|
||||
|
||||
export async function getValue (provider: TemplateDataProvider): Promise<string | undefined> {
|
||||
const value = provider.get(setting.templateFieldCategory.Integration) as Integration
|
||||
if (value === undefined) return
|
||||
return value.value
|
||||
}
|
||||
|
||||
export async function getOwnerName (provider: TemplateDataProvider): Promise<string | undefined> {
|
||||
const value = provider.get(setting.templateFieldCategory.Integration) as Integration
|
||||
if (value === undefined) return
|
||||
const client = getClient()
|
||||
const employeeAccount = await client.findOne(contact.class.EmployeeAccount, {
|
||||
_id: value.modifiedBy as Ref<EmployeeAccount>
|
||||
})
|
||||
return employeeAccount != null ? formatName(employeeAccount.name) : undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user