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'
|
2022-03-18 06:37:49 +00:00
|
|
|
import calendar from '@anticrm/model-calendar'
|
2022-03-10 09:04:08 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2022-03-18 06:37:49 +00:00
|
|
|
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
|
2022-03-10 09:04:08 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
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(view.class.ActionTarget, core.space.Model, {
|
|
|
|
target: recruit.class.ReviewCategory,
|
|
|
|
action: task.action.ArchiveSpace,
|
|
|
|
query: {
|
|
|
|
archived: false
|
|
|
|
}
|
|
|
|
})
|
2022-03-18 16:07:42 +00:00
|
|
|
|
|
|
|
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
|
|
|
attachTo: recruit.class.Review,
|
|
|
|
descriptor: calendar.viewlet.Calendar,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
options: {
|
|
|
|
lookup: {
|
|
|
|
attachedTo: recruit.mixin.Candidate,
|
|
|
|
participants: contact.class.Employee,
|
|
|
|
company: contact.class.Organization
|
|
|
|
}
|
|
|
|
} as FindOptions<Doc>,
|
2022-03-19 04:25:45 +00:00
|
|
|
config: [
|
|
|
|
'',
|
|
|
|
'title',
|
|
|
|
'$lookup.attachedTo',
|
|
|
|
'verdict',
|
|
|
|
{ key: '', presenter: recruit.component.OpinionsPresenter, label: recruit.string.Opinions, sortingKey: 'opinions' },
|
|
|
|
{ key: '$lookup.participants', presenter: calendar.component.PersonsPresenter, label: calendar.string.Participants, sortingKey: '$lookup.participants' },
|
|
|
|
'$lookup.company',
|
|
|
|
'modifiedOn'
|
|
|
|
]
|
2022-03-18 16:07:42 +00:00
|
|
|
})
|
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,
|
2022-03-18 06:37:49 +00:00
|
|
|
participants: contact.class.Employee,
|
|
|
|
company: contact.class.Organization
|
2022-03-10 09:04:08 +00:00
|
|
|
}
|
|
|
|
} as FindOptions<Doc>,
|
|
|
|
config: [
|
|
|
|
'',
|
2022-03-18 06:37:49 +00:00
|
|
|
'title',
|
2022-03-10 09:04:08 +00:00
|
|
|
'$lookup.attachedTo',
|
2022-03-18 06:37:49 +00:00
|
|
|
'verdict',
|
2022-03-10 09:04:08 +00:00
|
|
|
{ key: '', presenter: recruit.component.OpinionsPresenter, label: recruit.string.Opinions, sortingKey: 'opinions' },
|
2022-03-18 06:37:49 +00:00
|
|
|
{ key: '$lookup.participants', presenter: calendar.component.PersonsPresenter, label: calendar.string.Participants, sortingKey: '$lookup.participants' },
|
|
|
|
'$lookup.company',
|
|
|
|
'date',
|
|
|
|
'dueDate',
|
2022-03-10 09:04:08 +00:00
|
|
|
'modifiedOn'
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
builder.mixin(recruit.class.Opinion, core.class.Class, view.mixin.AttributeEditor, {
|
|
|
|
editor: recruit.component.Opinions
|
|
|
|
})
|
|
|
|
}
|