2022-03-10 09:04:08 +00:00
|
|
|
import { Doc, FindOptions } from '@anticrm/core'
|
|
|
|
import { Builder } from '@anticrm/model'
|
|
|
|
import contact from '@anticrm/model-contact'
|
|
|
|
import core from '@anticrm/model-core'
|
|
|
|
import task from '@anticrm/model-task'
|
|
|
|
import view from '@anticrm/model-view'
|
|
|
|
import workbench from '@anticrm/model-workbench'
|
|
|
|
import recruit from './plugin'
|
|
|
|
|
|
|
|
export function createReviewModel (builder: Builder): void {
|
|
|
|
builder.mixin(recruit.class.ReviewCategory, core.class.Class, workbench.mixin.SpaceView, {
|
|
|
|
view: {
|
|
|
|
class: recruit.class.Review,
|
2022-03-14 09:04:41 +00:00
|
|
|
createItemDialog: recruit.component.CreateReview,
|
|
|
|
createItemLabel: recruit.string.ReviewCreateLabel
|
2022-03-10 09:04:08 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.AttributeEditor, {
|
|
|
|
editor: recruit.component.Reviews
|
|
|
|
})
|
|
|
|
|
|
|
|
createTableViewlet(builder)
|
|
|
|
createKanbanViewlet(builder)
|
|
|
|
createStatusTableViewlet(builder)
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, task.mixin.KanbanCard, {
|
|
|
|
card: recruit.component.KanbanReviewCard
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.ObjectEditor, {
|
|
|
|
editor: recruit.component.EditReview
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.AttributePresenter, {
|
|
|
|
presenter: recruit.component.ReviewPresenter
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.ObjectValidator, {
|
|
|
|
validator: recruit.validator.ReviewValidator
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Opinion, core.class.Class, view.mixin.AttributePresenter, {
|
|
|
|
presenter: recruit.component.OpinionPresenter
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.ObjectEditor, {
|
|
|
|
editor: recruit.component.EditReview
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.createDoc(
|
|
|
|
view.class.Action,
|
|
|
|
core.space.Model,
|
|
|
|
{
|
|
|
|
label: recruit.string.CreateReview,
|
|
|
|
icon: recruit.icon.Create,
|
|
|
|
action: recruit.actionImpl.CreateReview
|
|
|
|
},
|
|
|
|
recruit.action.CreateReview
|
|
|
|
)
|
|
|
|
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
|
|
|
target: recruit.class.Applicant,
|
|
|
|
action: recruit.action.CreateReview
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.createDoc(
|
|
|
|
task.class.KanbanTemplateSpace,
|
|
|
|
core.space.Model,
|
|
|
|
{
|
|
|
|
name: recruit.string.ReviewCategory,
|
|
|
|
description: task.string.ManageStatusesWithin,
|
|
|
|
icon: recruit.component.TemplatesIcon
|
|
|
|
},
|
|
|
|
recruit.space.ReviewTemplates
|
|
|
|
)
|
|
|
|
|
|
|
|
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
|
|
|
target: recruit.class.ReviewCategory,
|
|
|
|
action: task.action.ArchiveSpace,
|
|
|
|
query: {
|
|
|
|
archived: false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
function createStatusTableViewlet (builder: Builder): void {
|
|
|
|
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
|
|
|
attachTo: recruit.class.Review,
|
|
|
|
descriptor: task.viewlet.StatusTable,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
options: {
|
|
|
|
lookup: {
|
|
|
|
attachedTo: recruit.mixin.Candidate,
|
|
|
|
state: task.class.State,
|
|
|
|
assignee: contact.class.Employee,
|
2022-03-14 09:05:02 +00:00
|
|
|
doneState: task.class.DoneState,
|
|
|
|
participants: contact.class.Employee
|
2022-03-10 09:04:08 +00:00
|
|
|
}
|
|
|
|
} as FindOptions<Doc>,
|
|
|
|
config: [
|
|
|
|
'',
|
|
|
|
'$lookup.attachedTo',
|
2022-03-14 09:05:02 +00:00
|
|
|
{ key: '$lookup.participants', presenter: recruit.component.PersonsPresenter, label: recruit.string.Participants, sortingKey: '$lookup.participants' },
|
2022-03-10 09:04:08 +00:00
|
|
|
// 'location',
|
|
|
|
'company',
|
|
|
|
'dueDate',
|
|
|
|
{ key: '', presenter: recruit.component.OpinionsPresenter, label: recruit.string.Opinions, sortingKey: 'opinions' },
|
|
|
|
'$lookup.state',
|
|
|
|
'$lookup.doneState',
|
2022-03-14 09:05:02 +00:00
|
|
|
// { presenter: attachment.component.AttachmentsPresenter, label: attachment.string.Files, sortingKey: 'attachments' },
|
|
|
|
// { presenter: chunter.component.CommentsPresenter, label: chunter.string.Comments, sortingKey: 'comments' },
|
2022-03-10 09:04:08 +00:00
|
|
|
'modifiedOn'
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.createDoc(
|
|
|
|
view.class.Action,
|
|
|
|
core.space.Model,
|
|
|
|
{
|
|
|
|
label: recruit.string.CreateOpinion,
|
|
|
|
icon: recruit.icon.Create,
|
|
|
|
action: recruit.actionImpl.CreateOpinion
|
|
|
|
},
|
|
|
|
recruit.action.CreateOpinion
|
|
|
|
)
|
|
|
|
|
|
|
|
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
|
|
|
target: recruit.class.Review,
|
|
|
|
action: recruit.action.CreateOpinion
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function createKanbanViewlet (builder: Builder): void {
|
|
|
|
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
|
|
|
attachTo: recruit.class.Review,
|
|
|
|
descriptor: task.viewlet.Kanban,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
options: {
|
|
|
|
lookup: {
|
|
|
|
attachedTo: recruit.mixin.Candidate,
|
2022-03-14 09:05:02 +00:00
|
|
|
state: task.class.State,
|
|
|
|
assignee: contact.class.Employee,
|
|
|
|
participants: contact.class.Employee
|
2022-03-10 09:04:08 +00:00
|
|
|
}
|
|
|
|
} as FindOptions<Doc>,
|
2022-03-14 09:05:02 +00:00
|
|
|
config: ['$lookup.attachedTo', '$lookup.state', '$lookup.participants', '$lookup.assignee']
|
2022-03-10 09:04:08 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function createTableViewlet (builder: Builder): void {
|
|
|
|
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
|
|
|
attachTo: recruit.class.Review,
|
|
|
|
descriptor: view.viewlet.Table,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
options: {
|
|
|
|
lookup: {
|
|
|
|
attachedTo: recruit.mixin.Candidate,
|
|
|
|
state: task.class.State,
|
|
|
|
assignee: contact.class.Employee,
|
2022-03-14 09:05:02 +00:00
|
|
|
doneState: task.class.DoneState,
|
|
|
|
participants: contact.class.Employee
|
2022-03-10 09:04:08 +00:00
|
|
|
}
|
|
|
|
} as FindOptions<Doc>,
|
|
|
|
config: [
|
|
|
|
'',
|
|
|
|
'$lookup.attachedTo',
|
2022-03-14 09:05:02 +00:00
|
|
|
{ key: '$lookup.participants', presenter: recruit.component.PersonsPresenter, label: recruit.string.Participants, sortingKey: '$lookup.participants' },
|
2022-03-10 09:04:08 +00:00
|
|
|
// 'location',
|
|
|
|
'company',
|
|
|
|
'dueDate',
|
|
|
|
{ key: '', presenter: recruit.component.OpinionsPresenter, label: recruit.string.Opinions, sortingKey: 'opinions' },
|
|
|
|
'$lookup.state',
|
|
|
|
'$lookup.doneState',
|
2022-03-14 09:05:02 +00:00
|
|
|
// { presenter: attachment.component.AttachmentsPresenter, label: attachment.string.Files, sortingKey: 'attachments' },
|
|
|
|
// { presenter: chunter.component.CommentsPresenter, label: chunter.string.Comments, sortingKey: 'comments' },
|
2022-03-10 09:04:08 +00:00
|
|
|
'modifiedOn'
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Opinion, core.class.Class, view.mixin.AttributeEditor, {
|
|
|
|
editor: recruit.component.Opinions
|
|
|
|
})
|
|
|
|
}
|