show resume on Candidate Card in edit mode

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-01 10:58:24 +02:00
parent 5013109f7e
commit 7d5e2e72a7
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 20 additions and 5 deletions

View File

@ -79,4 +79,4 @@
</script> </script>
<DialogHeader {space} {object} {newValue} {resume} create={true} on:save={createCandidate} focus/> <DialogHeader {space} {object} {newValue} {resume} create={true} on:save={createCandidate}/>

View File

@ -16,11 +16,13 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import type { Ref, Space, Doc } from '@anticrm/core' import type { Ref, Space, Doc } from '@anticrm/core'
import { generateId } from '@anticrm/core' import { generateId } from '@anticrm/core'
import { EditBox, Button, CircleButton, Grid, Label, showModal, Link, showPopup } from '@anticrm/ui' import { EditBox, Button, CircleButton, Grid, Label, showModal, Link, showPopup } from '@anticrm/ui'
import type { AnyComponent } from '@anticrm/ui' import type { AnyComponent } from '@anticrm/ui'
import { getClient } from '@anticrm/presentation'
import AvatarEditor from './AvatarEditor.svelte' import AvatarEditor from './AvatarEditor.svelte'
import FileIcon from './icons/File.svelte' import FileIcon from './icons/File.svelte'
import FileUpload from './icons/FileUpload.svelte' import FileUpload from './icons/FileUpload.svelte'
@ -32,12 +34,14 @@
import { uploadFile } from '../utils' import { uploadFile } from '../utils'
import { Candidate } from '@anticrm/recruit' import { Candidate } from '@anticrm/recruit'
import chunter from '@anticrm/chunter'
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
export let space: Ref<Space> export let space: Ref<Space>
export let object: Candidate export let object: Candidate
export let newValue: Candidate export let newValue: Candidate
export let focus = false export let create = false
export let resume: { export let resume: {
id: Ref<Doc> | undefined id: Ref<Doc> | undefined
@ -47,7 +51,18 @@
type: string type: string
} }
export let create = false const client = getClient()
client.findOne(chunter.class.Attachment, { _id: newValue.resume }).then(result => {
if (result !== undefined) {
resume = {
id: result._id,
name: result.name,
uuid: result.file,
size: result.size,
type: result.type,
}
}
})
let dragover = false let dragover = false
let loading = false let loading = false
@ -105,7 +120,7 @@
<div class="avatar" on:click|stopPropagation={() => showModal(AvatarEditor, { label: 'Profile photo' })}><User /></div> <div class="avatar" on:click|stopPropagation={() => showModal(AvatarEditor, { label: 'Profile photo' })}><User /></div>
<div class="flex-col"> <div class="flex-col">
<div class="name"> <div class="name">
<EditBox placeholder="John" bind:value={newValue.firstName} on:input={isChanged} {focus}/> <EditBox placeholder="John" bind:value={newValue.firstName} on:input={isChanged} focus={create}/>
<EditBox placeholder="Appleseed" bind:value={newValue.lastName} on:input={isChanged}/> <EditBox placeholder="Appleseed" bind:value={newValue.lastName} on:input={isChanged}/>
</div> </div>
<div class="title"><EditBox placeholder="Location" bind:value={newValue.city} on:input={isChanged}/></div> <div class="title"><EditBox placeholder="Location" bind:value={newValue.city} on:input={isChanged}/></div>