mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03: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,
|
||||
element: 'top',
|
||||
fillProps: {
|
||||
_id: 'space'
|
||||
_id: 'parent'
|
||||
}
|
||||
},
|
||||
label: hr.string.CreateDepartment,
|
||||
@ -357,9 +357,9 @@ export function createModel (builder: Builder): void {
|
||||
createAction(
|
||||
builder,
|
||||
{
|
||||
action: view.actionImpl.Archive,
|
||||
label: view.string.Archive,
|
||||
icon: view.icon.Archive,
|
||||
action: view.actionImpl.Delete,
|
||||
label: view.string.Delete,
|
||||
icon: view.icon.Delete,
|
||||
input: 'any',
|
||||
category: hr.category.HR,
|
||||
keyBinding: ['Meta + Backspace'],
|
||||
@ -369,7 +369,7 @@ export function createModel (builder: Builder): void {
|
||||
},
|
||||
target: hr.class.Department,
|
||||
context: { mode: ['context', 'browser'], group: 'tools' },
|
||||
override: [view.action.Archive, view.action.Delete]
|
||||
override: [view.action.Delete]
|
||||
},
|
||||
hr.action.ArchiveDepartment
|
||||
)
|
||||
|
@ -36,9 +36,8 @@ export function createModel (builder: Builder): void {
|
||||
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
|
||||
trigger: serverHr.trigger.OnDepartmentRemove,
|
||||
txMatch: {
|
||||
_class: core.class.TxCollectionCUD,
|
||||
'tx.objectClass': hr.class.Department,
|
||||
'tx._class': core.class.TxRemoveDoc
|
||||
objectClass: hr.class.Department,
|
||||
_class: core.class.TxRemoveDoc
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -16,13 +16,14 @@
|
||||
import { Employee } from '@hcengineering/contact'
|
||||
import { EmployeeBox } from '@hcengineering/contact-resources'
|
||||
import core, { Ref } from '@hcengineering/core'
|
||||
import { Department } from '@hcengineering/hr'
|
||||
import { Card, getClient } from '@hcengineering/presentation'
|
||||
import { Button, EditBox, FocusHandler, createFocusManager } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import hr from '../plugin'
|
||||
import DepartmentEditor from './DepartmentEditor.svelte'
|
||||
|
||||
export let parent = hr.ids.Head
|
||||
export let parent: Ref<Department> = hr.ids.Head
|
||||
|
||||
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
|
||||
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, {
|
||||
_id: { $in: department.members }
|
||||
})
|
||||
@ -173,7 +178,6 @@ export async function OnDepartmentRemove (tx: Tx, control: TriggerControl): Prom
|
||||
_id: { $in: employeeIds }
|
||||
})
|
||||
const removed = await buildHierarchy(department._id, control)
|
||||
const res: Tx[] = []
|
||||
employee.forEach((em) => {
|
||||
res.push(control.txFactory.createTxMixin(em._id, em._class, em.space, hr.mixin.Staff, { department: undefined }))
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user