mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 08:48:01 +00:00
Minor hr fixes (#5972)
This commit is contained in:
parent
8d6b583628
commit
91a0cae632
@ -341,7 +341,7 @@ export function createModel (builder: Builder): void {
|
|||||||
component: hr.component.CreateDepartment,
|
component: hr.component.CreateDepartment,
|
||||||
element: 'top',
|
element: 'top',
|
||||||
fillProps: {
|
fillProps: {
|
||||||
_id: 'space'
|
_id: 'parent'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
label: hr.string.CreateDepartment,
|
label: hr.string.CreateDepartment,
|
||||||
@ -357,9 +357,9 @@ export function createModel (builder: Builder): void {
|
|||||||
createAction(
|
createAction(
|
||||||
builder,
|
builder,
|
||||||
{
|
{
|
||||||
action: view.actionImpl.Archive,
|
action: view.actionImpl.Delete,
|
||||||
label: view.string.Archive,
|
label: view.string.Delete,
|
||||||
icon: view.icon.Archive,
|
icon: view.icon.Delete,
|
||||||
input: 'any',
|
input: 'any',
|
||||||
category: hr.category.HR,
|
category: hr.category.HR,
|
||||||
keyBinding: ['Meta + Backspace'],
|
keyBinding: ['Meta + Backspace'],
|
||||||
@ -369,7 +369,7 @@ export function createModel (builder: Builder): void {
|
|||||||
},
|
},
|
||||||
target: hr.class.Department,
|
target: hr.class.Department,
|
||||||
context: { mode: ['context', 'browser'], group: 'tools' },
|
context: { mode: ['context', 'browser'], group: 'tools' },
|
||||||
override: [view.action.Archive, view.action.Delete]
|
override: [view.action.Delete]
|
||||||
},
|
},
|
||||||
hr.action.ArchiveDepartment
|
hr.action.ArchiveDepartment
|
||||||
)
|
)
|
||||||
|
@ -36,9 +36,8 @@ export function createModel (builder: Builder): void {
|
|||||||
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
|
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
|
||||||
trigger: serverHr.trigger.OnDepartmentRemove,
|
trigger: serverHr.trigger.OnDepartmentRemove,
|
||||||
txMatch: {
|
txMatch: {
|
||||||
_class: core.class.TxCollectionCUD,
|
objectClass: hr.class.Department,
|
||||||
'tx.objectClass': hr.class.Department,
|
_class: core.class.TxRemoveDoc
|
||||||
'tx._class': core.class.TxRemoveDoc
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
import { Employee } from '@hcengineering/contact'
|
import { Employee } from '@hcengineering/contact'
|
||||||
import { EmployeeBox } from '@hcengineering/contact-resources'
|
import { EmployeeBox } from '@hcengineering/contact-resources'
|
||||||
import core, { Ref } from '@hcengineering/core'
|
import core, { Ref } from '@hcengineering/core'
|
||||||
|
import { Department } from '@hcengineering/hr'
|
||||||
import { Card, getClient } from '@hcengineering/presentation'
|
import { Card, getClient } from '@hcengineering/presentation'
|
||||||
import { Button, EditBox, FocusHandler, createFocusManager } from '@hcengineering/ui'
|
import { Button, EditBox, FocusHandler, createFocusManager } from '@hcengineering/ui'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import hr from '../plugin'
|
import hr from '../plugin'
|
||||||
import DepartmentEditor from './DepartmentEditor.svelte'
|
import DepartmentEditor from './DepartmentEditor.svelte'
|
||||||
|
|
||||||
export let parent = hr.ids.Head
|
export let parent: Ref<Department> = hr.ids.Head
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -164,6 +164,11 @@ export async function OnDepartmentRemove (tx: Tx, control: TriggerControl): Prom
|
|||||||
|
|
||||||
const department = control.removedMap.get(ctx.objectId) as Department
|
const department = control.removedMap.get(ctx.objectId) as Department
|
||||||
if (department === undefined) return []
|
if (department === undefined) return []
|
||||||
|
const res: Tx[] = []
|
||||||
|
const nested = await control.findAll(hr.class.Department, { parent: department._id })
|
||||||
|
for (const dep of nested) {
|
||||||
|
res.push(control.txFactory.createTxRemoveDoc(dep._class, dep.space, dep._id))
|
||||||
|
}
|
||||||
const targetAccounts = await control.modelDb.findAll(contact.class.PersonAccount, {
|
const targetAccounts = await control.modelDb.findAll(contact.class.PersonAccount, {
|
||||||
_id: { $in: department.members }
|
_id: { $in: department.members }
|
||||||
})
|
})
|
||||||
@ -173,7 +178,6 @@ export async function OnDepartmentRemove (tx: Tx, control: TriggerControl): Prom
|
|||||||
_id: { $in: employeeIds }
|
_id: { $in: employeeIds }
|
||||||
})
|
})
|
||||||
const removed = await buildHierarchy(department._id, control)
|
const removed = await buildHierarchy(department._id, control)
|
||||||
const res: Tx[] = []
|
|
||||||
employee.forEach((em) => {
|
employee.forEach((em) => {
|
||||||
res.push(control.txFactory.createTxMixin(em._id, em._class, em.space, hr.mixin.Staff, { department: undefined }))
|
res.push(control.txFactory.createTxMixin(em._id, em._class, em.space, hr.mixin.Staff, { department: undefined }))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user