mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 23:00:13 +00:00
add resume to existing candidate
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
5455507e1f
commit
eb2fa1aad1
@ -25,7 +25,7 @@ import IconCopy from './icons/Copy.svelte'
|
|||||||
|
|
||||||
import contact from '@anticrm/contact'
|
import contact from '@anticrm/contact'
|
||||||
|
|
||||||
export let value: Channel[] | undefined
|
export let value: Channel[] | null
|
||||||
|
|
||||||
interface Item {
|
interface Item {
|
||||||
label: IntlString,
|
label: IntlString,
|
||||||
@ -60,7 +60,7 @@ async function update(value: Channel[]) {
|
|||||||
displayItems = result
|
displayItems = result
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (value !== undefined) update(value)
|
$: if (value) update(value)
|
||||||
|
|
||||||
let displayItems: Item[] = []
|
let displayItems: Item[] = []
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import { EditBox, Button, CircleButton, Grid, Label, Link, showPopup, Component, IconFile as FileIcon } from '@anticrm/ui'
|
import { EditBox, Button, CircleButton, Grid, Label, Link, showPopup, Component, IconFile as FileIcon } from '@anticrm/ui'
|
||||||
import type { AnyComponent } from '@anticrm/ui'
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
import { getClient } from '@anticrm/presentation'
|
import { getClient } from '@anticrm/presentation'
|
||||||
|
import type { Attachment } from '@anticrm/chunter'
|
||||||
|
|
||||||
import AvatarEditor from './AvatarEditor.svelte'
|
import AvatarEditor from './AvatarEditor.svelte'
|
||||||
import FileUpload from './icons/FileUpload.svelte'
|
import FileUpload from './icons/FileUpload.svelte'
|
||||||
@ -87,13 +88,16 @@
|
|||||||
async function createAttachment(file: File) {
|
async function createAttachment(file: File) {
|
||||||
loading = true
|
loading = true
|
||||||
try {
|
try {
|
||||||
const id = generateId()
|
const id = generateId<Attachment>()
|
||||||
resume.uuid = await uploadFile(id, space, file)
|
resume.uuid = await uploadFile(id, space, file)
|
||||||
resume.id = id
|
resume.id = id
|
||||||
resume.name = file.name
|
resume.name = file.name
|
||||||
resume.size = file.size
|
resume.size = file.size
|
||||||
resume.type = file.type
|
resume.type = file.type
|
||||||
|
|
||||||
|
newValue.resume = id
|
||||||
|
isChanged()
|
||||||
|
|
||||||
console.log('uploaded file uuid', resume.uuid)
|
console.log('uploaded file uuid', resume.uuid)
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
import type { Candidate } from '@anticrm/recruit'
|
import type { Candidate } from '@anticrm/recruit'
|
||||||
import DialogHeader from './DialogHeader.svelte'
|
import DialogHeader from './DialogHeader.svelte'
|
||||||
|
|
||||||
|
import chunter from '@anticrm/chunter'
|
||||||
|
|
||||||
import recruit from '../plugin'
|
import recruit from '../plugin'
|
||||||
|
|
||||||
export let object: Candidate
|
export let object: Candidate
|
||||||
@ -40,12 +42,27 @@
|
|||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
|
|
||||||
|
if (resume.id !== undefined) {
|
||||||
|
// create attachment
|
||||||
|
console.log('creaing attachment space', space)
|
||||||
|
client.createDoc(chunter.class.Attachment, space, {
|
||||||
|
attachmentTo: object._id,
|
||||||
|
collection: 'resume',
|
||||||
|
name: resume.name,
|
||||||
|
file: resume.uuid,
|
||||||
|
type: resume.type,
|
||||||
|
size: resume.size,
|
||||||
|
}, resume.id)
|
||||||
|
}
|
||||||
|
|
||||||
const attributes: Record<string, any> = {}
|
const attributes: Record<string, any> = {}
|
||||||
for (const key in object) {
|
for (const key in newValue) {
|
||||||
if ((newValue as any)[key] !== (object as any)[key]) {
|
if ((newValue as any)[key] !== (object as any)[key]) {
|
||||||
attributes[key] = (newValue as any)[key]
|
attributes[key] = (newValue as any)[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('update attributes', attributes)
|
||||||
await client.updateDoc(recruit.class.Candidate, object.space, object._id, attributes)
|
await client.updateDoc(recruit.class.Candidate, object.space, object._id, attributes)
|
||||||
|
|
||||||
dispatch('close')
|
dispatch('close')
|
||||||
|
Loading…
Reference in New Issue
Block a user