mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-23 01:55:00 +02:00
TSK-1015: Bitrix Create Vacancy/Application (#2913)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -70,6 +70,12 @@
|
||||
action: (_: any, evt: MouseEvent) => {
|
||||
addMapping(evt, MappingOperation.FindReference)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: getEmbeddedLabel('Create Vacancy and application'),
|
||||
action: (_: any, evt: MouseEvent) => {
|
||||
addMapping(evt, MappingOperation.CreateHRApplication)
|
||||
}
|
||||
}
|
||||
] as Action[]
|
||||
</script>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { Label } from '@hcengineering/ui'
|
||||
import bitrix from '../plugin'
|
||||
import CopyMapping from './mappings/CopyMapping.svelte'
|
||||
import CreateAttachedDocMapping from './mappings/CreateHRApplicationMapping.svelte'
|
||||
import CreateChannelMapping from './mappings/CreateChannelMapping.svelte'
|
||||
import CreateTagMapping from './mappings/CreateTagMapping.svelte'
|
||||
import DownloadAttachmentMapping from './mappings/DownloadAttachmentMapping.svelte'
|
||||
@@ -45,5 +46,7 @@
|
||||
<DownloadAttachmentMapping {mapping} {fields} {attribute} {field} bind:this={op} />
|
||||
{:else if _kind === MappingOperation.FindReference}
|
||||
<FindReferenceMapping {mapping} {fields} {attribute} {field} bind:this={op} />
|
||||
{:else if _kind === MappingOperation.CreateHRApplication}
|
||||
<CreateAttachedDocMapping {mapping} {fields} {attribute} {field} bind:this={op} />
|
||||
{/if}
|
||||
</Card>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Button, Icon, IconArrowLeft, IconClose, Label } from '@hcengineering/ui'
|
||||
import CopyMappingPresenter from './mappings/CopyMappingPresenter.svelte'
|
||||
import CreateAttachedDocPresenter from './mappings/CreateHRApplicationPresenter.svelte'
|
||||
import CreateChannelMappingPresenter from './mappings/CreateChannelMappingPresenter.svelte'
|
||||
import CreateTagMappingPresenter from './mappings/CreateTagMappingPresenter.svelte'
|
||||
import DownloadAttachmentPresenter from './mappings/DownloadAttachmentPresenter.svelte'
|
||||
@@ -40,6 +41,8 @@
|
||||
<DownloadAttachmentPresenter {mapping} {value} />
|
||||
{:else if kind === MappingOperation.FindReference}
|
||||
<FindReferencePresenter {mapping} {value} />
|
||||
{:else if kind === MappingOperation.CreateHRApplication}
|
||||
<CreateAttachedDocPresenter {mapping} {value} />
|
||||
{/if}
|
||||
|
||||
<Button
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
BitrixEntityMapping,
|
||||
BitrixFieldMapping,
|
||||
CreateHRApplication,
|
||||
Fields,
|
||||
MappingOperation
|
||||
} from '@hcengineering/bitrix'
|
||||
import { AnyAttribute } from '@hcengineering/core'
|
||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import task from '@hcengineering/task'
|
||||
import { DropdownLabels, DropdownTextItem } from '@hcengineering/ui'
|
||||
import { ObjectBox } from '@hcengineering/view-resources'
|
||||
import bitrix from '../../plugin'
|
||||
import recruit from '@hcengineering/recruit'
|
||||
|
||||
export let mapping: BitrixEntityMapping
|
||||
export let fields: Fields = {}
|
||||
export let attribute: AnyAttribute
|
||||
export let field: BitrixFieldMapping | undefined
|
||||
|
||||
let stateField = (field?.operation as CreateHRApplication)?.stateField
|
||||
let vacancyField = (field?.operation as CreateHRApplication)?.vacancyField
|
||||
let defaultTemplate = (field?.operation as CreateHRApplication)?.defaultTemplate
|
||||
|
||||
const client = getClient()
|
||||
|
||||
export async function save (): Promise<void> {
|
||||
if (field !== undefined) {
|
||||
await client.update(field, {
|
||||
operation: {
|
||||
kind: MappingOperation.CreateHRApplication,
|
||||
stateField,
|
||||
vacancyField,
|
||||
defaultTemplate
|
||||
}
|
||||
})
|
||||
} else {
|
||||
await client.addCollection(bitrix.class.FieldMapping, mapping.space, mapping._id, mapping._class, 'fields', {
|
||||
ofClass: attribute.attributeOf,
|
||||
attributeName: attribute.name,
|
||||
operation: {
|
||||
kind: MappingOperation.CreateHRApplication,
|
||||
stateField,
|
||||
vacancyField,
|
||||
defaultTemplate
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function getItems (fields: Fields): DropdownTextItem[] {
|
||||
return Object.entries(fields).map((it) => ({
|
||||
id: it[0],
|
||||
label: `${it[1].formLabel ?? it[1].title}${it[0].startsWith('UF_') ? ' *' : ''}`
|
||||
}))
|
||||
}
|
||||
$: items = getItems(fields)
|
||||
</script>
|
||||
|
||||
<div class="flex-col flex-wrap">
|
||||
<div class="flex-row-center gap-2">
|
||||
<div class="flex-col w-120">
|
||||
<DropdownLabels minW0={false} label={getEmbeddedLabel('Vacancy field')} {items} bind:selected={vacancyField} />
|
||||
<DropdownLabels minW0={false} label={getEmbeddedLabel('State field')} {items} bind:selected={stateField} />
|
||||
<ObjectBox
|
||||
label={getEmbeddedLabel('Template')}
|
||||
searchField={'title'}
|
||||
_class={task.class.KanbanTemplate}
|
||||
docQuery={{ space: recruit.space.VacancyTemplates }}
|
||||
bind:value={defaultTemplate}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.pattern {
|
||||
margin: 0.5rem;
|
||||
padding: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
border: 1px dashed var(--accent-color);
|
||||
border-radius: 0.25rem;
|
||||
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
|
||||
// text-transform: uppercase;
|
||||
color: var(--accent-color);
|
||||
&:hover {
|
||||
color: var(--caption-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
import { BitrixEntityMapping, BitrixFieldMapping, CreateHRApplication } from '@hcengineering/bitrix'
|
||||
import task from '@hcengineering/task'
|
||||
import { ObjectPresenter } from '@hcengineering/view-resources'
|
||||
|
||||
export let mapping: BitrixEntityMapping
|
||||
export let value: BitrixFieldMapping
|
||||
|
||||
$: op = value.operation as CreateHRApplication
|
||||
</script>
|
||||
|
||||
<div class="flex flex-wrap">
|
||||
<div class="pattern flex-row-center gap-2">
|
||||
{mapping.bitrixFields[op.vacancyField]?.filterLabel} -> {mapping.bitrixFields[op.stateField]?.filterLabel}
|
||||
<span class="p-1">-></span>
|
||||
<ObjectPresenter objectId={op.defaultTemplate} _class={task.class.KanbanTemplate} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.pattern {
|
||||
margin: 0.1rem;
|
||||
padding: 0.3rem;
|
||||
flex-shrink: 0;
|
||||
border: 1px dashed var(--accent-color);
|
||||
border-radius: 0.25rem;
|
||||
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
|
||||
// text-transform: uppercase;
|
||||
color: var(--accent-color);
|
||||
&:hover {
|
||||
color: var(--caption-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user