2022-09-21 08:08:25 +00:00
|
|
|
import { FindOptions } from '@hcengineering/core'
|
|
|
|
import { Builder } from '@hcengineering/model'
|
|
|
|
import calendar from '@hcengineering/model-calendar'
|
|
|
|
import contact from '@hcengineering/model-contact'
|
|
|
|
import core from '@hcengineering/model-core'
|
|
|
|
import view, { createAction } from '@hcengineering/model-view'
|
|
|
|
import { Review } from '@hcengineering/recruit'
|
|
|
|
import { BuildModelKey } from '@hcengineering/view'
|
2022-03-10 09:04:08 +00:00
|
|
|
import recruit from './plugin'
|
2022-03-23 09:03:41 +00:00
|
|
|
|
|
|
|
export const reviewTableOptions: FindOptions<Review> = {
|
|
|
|
lookup: {
|
|
|
|
attachedTo: recruit.mixin.Candidate,
|
|
|
|
participants: contact.class.Employee,
|
|
|
|
company: contact.class.Organization
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export const reviewTableConfig: (BuildModelKey | string)[] = [
|
|
|
|
'',
|
|
|
|
'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',
|
|
|
|
{ key: '', presenter: calendar.component.DateTimePresenter, label: calendar.string.Date, sortingKey: 'date' },
|
|
|
|
'modifiedOn'
|
|
|
|
]
|
2022-03-10 09:04:08 +00:00
|
|
|
|
|
|
|
export function createReviewModel (builder: Builder): void {
|
2022-05-06 17:48:43 +00:00
|
|
|
builder.mixin(recruit.class.Review, core.class.Class, view.mixin.CollectionEditor, {
|
2022-03-10 09:04:08 +00:00
|
|
|
editor: recruit.component.Reviews
|
|
|
|
})
|
|
|
|
|
|
|
|
createTableViewlet(builder)
|
|
|
|
|
2022-05-04 08:08:12 +00:00
|
|
|
createAction(
|
|
|
|
builder,
|
2022-03-18 06:37:49 +00:00
|
|
|
{
|
|
|
|
label: recruit.string.CreateOpinion,
|
|
|
|
icon: recruit.icon.Create,
|
2022-04-19 09:38:31 +00:00
|
|
|
action: recruit.actionImpl.CreateOpinion,
|
2022-05-04 08:08:12 +00:00
|
|
|
input: 'focus',
|
|
|
|
category: recruit.category.Recruit,
|
|
|
|
target: recruit.class.Review,
|
|
|
|
context: {
|
2022-06-24 12:36:08 +00:00
|
|
|
mode: ['context', 'browser'],
|
|
|
|
group: 'create'
|
2022-05-04 08:08:12 +00:00
|
|
|
}
|
2022-03-18 06:37:49 +00:00
|
|
|
},
|
|
|
|
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.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
|
|
|
|
})
|
|
|
|
|
2022-05-04 08:08:12 +00:00
|
|
|
createAction(builder, {
|
|
|
|
action: view.actionImpl.ShowPopup,
|
|
|
|
actionProps: {
|
|
|
|
component: recruit.component.CreateReview,
|
|
|
|
element: 'top',
|
|
|
|
props: {
|
|
|
|
preserveCandidate: true
|
2022-06-24 12:36:08 +00:00
|
|
|
},
|
|
|
|
fillProps: {
|
|
|
|
space: '_space',
|
|
|
|
_id: 'candidate'
|
2022-05-04 08:08:12 +00:00
|
|
|
}
|
2022-03-10 09:04:08 +00:00
|
|
|
},
|
2022-05-04 08:08:12 +00:00
|
|
|
label: recruit.string.CreateReview,
|
|
|
|
icon: recruit.icon.Create,
|
|
|
|
input: 'focus',
|
|
|
|
category: recruit.category.Recruit,
|
|
|
|
target: recruit.mixin.Candidate,
|
2022-04-19 09:38:31 +00:00
|
|
|
context: {
|
2022-06-24 12:36:08 +00:00
|
|
|
mode: ['context', 'browser'],
|
|
|
|
group: 'associate'
|
2022-04-19 09:38:31 +00:00
|
|
|
}
|
2022-03-10 09:04:08 +00:00
|
|
|
})
|
|
|
|
|
2022-06-15 12:00:32 +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
|
|
|
|
config: [
|
|
|
|
'',
|
|
|
|
'title',
|
|
|
|
'$lookup.attachedTo',
|
|
|
|
'$lookup.company',
|
|
|
|
{ key: '', presenter: calendar.component.DateTimePresenter, label: calendar.string.Date, sortingKey: 'date' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
recruit.viewlet.CalendarReview
|
|
|
|
)
|
2022-03-10 09:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function createTableViewlet (builder: Builder): void {
|
2022-06-15 12:00:32 +00:00
|
|
|
builder.createDoc(
|
|
|
|
view.class.Viewlet,
|
|
|
|
core.space.Model,
|
|
|
|
{
|
|
|
|
attachTo: recruit.class.Review,
|
|
|
|
descriptor: view.viewlet.Table,
|
|
|
|
config: reviewTableConfig
|
|
|
|
},
|
|
|
|
recruit.viewlet.TableReview
|
|
|
|
)
|
2022-03-10 09:04:08 +00:00
|
|
|
|
2022-05-06 17:48:43 +00:00
|
|
|
builder.mixin(recruit.class.Opinion, core.class.Class, view.mixin.CollectionEditor, {
|
2022-03-10 09:04:08 +00:00
|
|
|
editor: recruit.component.Opinions
|
|
|
|
})
|
|
|
|
}
|