mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
UBER-1143: setting for skill import, redirect to talents from skillsView (#3925)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
987764fc5b
commit
d7089dae74
@ -119,7 +119,8 @@
|
||||
"ShowApplications": "Show applications",
|
||||
"GetTalentIds": "Get talents' ids",
|
||||
"HideDoneState": "Hide complete applications",
|
||||
"HideArchivedVacancies": "Hide from archived Vacancies"
|
||||
"HideArchivedVacancies": "Hide from archived Vacancies",
|
||||
"CreateNewSkills": "Create new skills if existing not found"
|
||||
},
|
||||
"status": {
|
||||
"ApplicationExists": "Application already exists",
|
||||
|
@ -119,7 +119,8 @@
|
||||
"ShowApplications": "Показать кандидатов",
|
||||
"GetTalentIds": "Получить ID талантов",
|
||||
"HideDoneState": "Скрыть завершенных кандидатов",
|
||||
"HideArchivedVacancies": "Скрыть архивные вакансии"
|
||||
"HideArchivedVacancies": "Скрыть архивные вакансии",
|
||||
"CreateNewSkills": "Создать навыки, если не найдены существующие"
|
||||
},
|
||||
"status": {
|
||||
"ApplicationExists": "Кандидат уже существует",
|
||||
|
@ -57,7 +57,8 @@
|
||||
IconInfo,
|
||||
Label,
|
||||
showPopup,
|
||||
Spinner
|
||||
Spinner,
|
||||
MiniToggle
|
||||
} from '@hcengineering/ui'
|
||||
import { createEventDispatcher, onDestroy } from 'svelte'
|
||||
import recruit from '../plugin'
|
||||
@ -136,6 +137,7 @@
|
||||
let inputFile: HTMLInputElement
|
||||
let loading = false
|
||||
let dragover = false
|
||||
let shouldCreateNewSkills = false
|
||||
|
||||
let avatar: File | undefined = draft?.avatar
|
||||
|
||||
@ -349,7 +351,7 @@
|
||||
for (const s of doc.skills ?? []) {
|
||||
const title = s.trim().toLowerCase()
|
||||
let e = namedElements.get(title)
|
||||
if (e === undefined) {
|
||||
if (e === undefined && shouldCreateNewSkills) {
|
||||
// No yet tag with title
|
||||
const category = findTagCategory(s, categories)
|
||||
const cinstance = categoriesMap.get(category)
|
||||
@ -366,18 +368,20 @@
|
||||
elements.set(e._id, e)
|
||||
newElements.push(e)
|
||||
}
|
||||
newSkills.push(
|
||||
TxProcessor.createDoc2Doc(
|
||||
client.txFactory.createTxCreateDoc(tags.class.TagReference, tags.space.Tags, {
|
||||
title: e.title,
|
||||
color: e.color,
|
||||
tag: e._id,
|
||||
attachedTo: '' as Ref<Doc>,
|
||||
attachedToClass: recruit.mixin.Candidate,
|
||||
collection: 'skills'
|
||||
})
|
||||
if (e !== undefined) {
|
||||
newSkills.push(
|
||||
TxProcessor.createDoc2Doc(
|
||||
client.txFactory.createTxCreateDoc(tags.class.TagReference, tags.space.Tags, {
|
||||
title: e.title,
|
||||
color: e.color,
|
||||
tag: e._id,
|
||||
attachedTo: '' as Ref<Doc>,
|
||||
attachedToClass: recruit.mixin.Candidate,
|
||||
collection: 'skills'
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
object.skills = [...object.skills, ...newSkills]
|
||||
} catch (err: any) {
|
||||
@ -705,6 +709,9 @@
|
||||
{/if}
|
||||
<input bind:this={inputFile} type="file" name="file" id="file" style="display: none" on:change={fileSelected} />
|
||||
{/if}
|
||||
<div class="ml-1">
|
||||
<MiniToggle bind:on={shouldCreateNewSkills} label={recruit.string.CreateNewSkills} />
|
||||
</div>
|
||||
</div>
|
||||
{#if matches.length > 0}
|
||||
<div class="flex-col-stretch flex-grow error-color">
|
||||
|
@ -2,14 +2,33 @@
|
||||
import tags, { selectedTagElements, TagElement } from '@hcengineering/tags'
|
||||
import { Component, getCurrentResolvedLocation, navigate } from '@hcengineering/ui'
|
||||
import recruit from '../plugin'
|
||||
import { buildFilterKey, setFilters } from '@hcengineering/view-resources'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Filter } from '@hcengineering/view'
|
||||
|
||||
function onTag (tag: TagElement): void {
|
||||
function setFilterTag (tag: TagElement) {
|
||||
const client = getClient()
|
||||
const hierarchy = client.getHierarchy()
|
||||
const attribute = hierarchy.getAttribute(recruit.mixin.Candidate, 'skills')
|
||||
const key = buildFilterKey(hierarchy, recruit.mixin.Candidate, '_class', attribute)
|
||||
const filter = {
|
||||
key,
|
||||
value: [tag._id],
|
||||
props: { level: 0 },
|
||||
modes: [tags.filter.FilterTagsIn, tags.filter.FilterTagsNin],
|
||||
mode: tags.filter.FilterTagsIn,
|
||||
index: 1
|
||||
} as Filter
|
||||
setFilters([filter])
|
||||
}
|
||||
async function onTag (tag: TagElement): Promise<void> {
|
||||
selectedTagElements.set([tag._id])
|
||||
const loc = getCurrentResolvedLocation()
|
||||
loc.path[2] = 'recruit'
|
||||
loc.path[3] = 'candidates'
|
||||
loc.path[3] = 'talents'
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
setTimeout(() => setFilterTag(tag), 50)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -131,7 +131,8 @@ export default mergeIds(recruitId, recruit, {
|
||||
Apply: '' as IntlString,
|
||||
OpenVacancyList: '' as IntlString,
|
||||
Export: '' as IntlString,
|
||||
GetTalentIds: '' as IntlString
|
||||
GetTalentIds: '' as IntlString,
|
||||
CreateNewSkills: '' as IntlString
|
||||
},
|
||||
space: {
|
||||
CandidatesPublic: '' as Ref<Space>
|
||||
|
Loading…
Reference in New Issue
Block a user