mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
checkpoint
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
b514235ad0
commit
d7e02d99e9
@ -59,6 +59,8 @@ export class TAttachment extends TDoc implements Attachment {
|
||||
collection!: string
|
||||
name!: string
|
||||
file!: string
|
||||
size!: number
|
||||
type!: string
|
||||
}
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
|
@ -53,6 +53,8 @@ export interface Attachment extends Doc {
|
||||
collection: string
|
||||
name: string
|
||||
file: string
|
||||
size: number
|
||||
type: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import type { Ref, Space, Doc } from '@anticrm/core'
|
||||
import { TextArea, EditBox, Dialog, Tabs, Section, Grid } from '@anticrm/ui'
|
||||
import File from './icons/File.svelte'
|
||||
import Address from './icons/Address.svelte'
|
||||
@ -25,28 +25,53 @@
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
|
||||
import recruit from '../plugin'
|
||||
import chunter from '@anticrm/chunter'
|
||||
import { Candidate } from '@anticrm/recruit'
|
||||
|
||||
export let space: Ref<Space>
|
||||
|
||||
const object: Candidate = {
|
||||
lastName: '',
|
||||
firstName: '',
|
||||
city: ''
|
||||
} as Candidate
|
||||
const newValue = Object.assign({}, object)
|
||||
|
||||
let resumeId: Ref<Doc>
|
||||
let resumeName: string | undefined
|
||||
let resumeUuid: string
|
||||
let resumeSize: number
|
||||
let resumeType: string
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let firstName: string = ''
|
||||
let lastName: string = ''
|
||||
let email: string = ''
|
||||
let phone: string = ''
|
||||
let city: string = ''
|
||||
|
||||
const client = getClient()
|
||||
|
||||
function createCandidate() {
|
||||
client.createDoc(recruit.class.Candidate, space, {
|
||||
firstName,
|
||||
lastName,
|
||||
email,
|
||||
phone,
|
||||
city,
|
||||
async function createCandidate() {
|
||||
console.log(newValue)
|
||||
// create candidate
|
||||
const candidateId = await client.createDoc(recruit.class.Candidate, space, {
|
||||
firstName: newValue.firstName,
|
||||
lastName: newValue.lastName,
|
||||
email: '',
|
||||
phone: '',
|
||||
city: newValue.city,
|
||||
})
|
||||
|
||||
if (resumeName !== undefined) {
|
||||
// create attachment
|
||||
client.createDoc(chunter.class.Attachment, space, {
|
||||
attachmentTo: candidateId,
|
||||
collection: 'resume',
|
||||
name: resumeName,
|
||||
file: resumeUuid,
|
||||
type: resumeType,
|
||||
size: resumeSize,
|
||||
}, resumeId)
|
||||
}
|
||||
|
||||
dispatch('close')
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<DialogHeader {space}/>
|
||||
<DialogHeader {space} {object} {newValue} {resumeId} {resumeName} {resumeUuid} {resumeSize} {resumeType} on:save={createCandidate}/>
|
||||
|
@ -16,11 +16,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { getMetadata } from '@anticrm/platform'
|
||||
import type { Ref, Space, Doc } from '@anticrm/core'
|
||||
import { generateId } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
import { createQuery, getClient } from '@anticrm/presentation'
|
||||
|
||||
import { EditBox, Button, CircleButton, Grid, Label, showModal } from '@anticrm/ui'
|
||||
import AvatarEditor from './AvatarEditor.svelte'
|
||||
@ -29,26 +26,20 @@
|
||||
import Twitter from './icons/Twitter.svelte'
|
||||
import User from './icons/User.svelte'
|
||||
|
||||
import chunter from '@anticrm/chunter'
|
||||
import recruit from '../plugin'
|
||||
|
||||
import { uploadFile } from '../utils'
|
||||
import { Candidate } from '@anticrm/recruit'
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
export let space: Ref<Space>
|
||||
export let object: Candidate
|
||||
export let newValue: Candidate
|
||||
|
||||
let firstName = ''
|
||||
let lastName = ''
|
||||
let city = ''
|
||||
|
||||
let resumeId: Ref<Doc>
|
||||
let resumeName: string | undefined
|
||||
let resumeUuid: string
|
||||
let resumeSize: number
|
||||
let resumeType: string
|
||||
|
||||
const client = getClient()
|
||||
export let resumeId: Ref<Doc>
|
||||
export let resumeName: string | undefined
|
||||
export let resumeUuid: string
|
||||
export let resumeSize: number
|
||||
export let resumeType: string
|
||||
|
||||
let dragover = false
|
||||
let loading = false
|
||||
@ -69,29 +60,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function createCandidate() {
|
||||
// create candidate
|
||||
const candidateId = await client.createDoc(recruit.class.Candidate, space, {
|
||||
firstName,
|
||||
lastName,
|
||||
email: '',
|
||||
phone: '',
|
||||
city,
|
||||
})
|
||||
|
||||
if (resumeName !== undefined) {
|
||||
// create attachment
|
||||
client.createDoc(chunter.class.Attachment, space, {
|
||||
attachmentTo: candidateId,
|
||||
collection: 'resume',
|
||||
name: resumeName,
|
||||
file: resumeUuid
|
||||
}, resumeId)
|
||||
}
|
||||
|
||||
dispatch('close')
|
||||
}
|
||||
|
||||
function drop(event: DragEvent) {
|
||||
dragover = false
|
||||
const droppedFile = event.dataTransfer?.files[0]
|
||||
@ -116,10 +84,10 @@
|
||||
<div class="avatar" on:click|stopPropagation={() => showModal(AvatarEditor, { label: 'Profile photo' })}><User /></div>
|
||||
<div class="flex-col">
|
||||
<div class="name">
|
||||
<EditBox placeholder="John" bind:value={firstName}/>
|
||||
<EditBox placeholder="Appleseed" bind:value={lastName}/>
|
||||
<EditBox placeholder="John" bind:value={newValue.firstName}/>
|
||||
<EditBox placeholder="Appleseed" bind:value={newValue.lastName}/>
|
||||
</div>
|
||||
<div class="title"><EditBox placeholder="Los Angeles" bind:value={city}/></div>
|
||||
<div class="title"><EditBox placeholder="Los Angeles" bind:value={newValue.city}/></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="abs-lb-content">
|
||||
@ -131,7 +99,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="abs-rb-content">
|
||||
<Button label={'Save'} size={'small'} transparent on:click={createCandidate}/>
|
||||
<Button label={'Create'} size={'small'} transparent on:click={ () => { dispatch('save') } }/>
|
||||
</div>
|
||||
<div class="abs-rt-content">
|
||||
<Grid column={2} columnGap={.5}>
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { Ref, Space } from '@anticrm/core'
|
||||
import type { Ref, Space, Doc } from '@anticrm/core'
|
||||
import { Dialog, Tabs } from '@anticrm/ui'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import type { Candidate } from '@anticrm/recruit'
|
||||
@ -26,11 +26,18 @@
|
||||
export let object: Candidate
|
||||
export let space: Ref<Space>
|
||||
|
||||
const newValue = Object.assign({}, object)
|
||||
|
||||
let resumeId: Ref<Doc>
|
||||
let resumeName: string | undefined
|
||||
let resumeUuid: string
|
||||
let resumeSize: number
|
||||
let resumeType: string
|
||||
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const client = getClient()
|
||||
|
||||
const newValue = Object.assign({}, object)
|
||||
|
||||
async function save() {
|
||||
const attributes: Record<string, any> = {}
|
||||
for (const key in object) {
|
||||
@ -42,14 +49,14 @@
|
||||
}
|
||||
|
||||
const tabModel = [
|
||||
{
|
||||
label: 'General',
|
||||
component: 'recruit:component:CandidateGeneral',
|
||||
props: {
|
||||
object,
|
||||
newValue,
|
||||
}
|
||||
},
|
||||
// {
|
||||
// label: 'General',
|
||||
// component: 'recruit:component:CandidateGeneral',
|
||||
// props: {
|
||||
// object,
|
||||
// newValue,
|
||||
// }
|
||||
// },
|
||||
{
|
||||
label: 'Activity',
|
||||
component: 'chunter:component:Activity',
|
||||
@ -74,7 +81,7 @@
|
||||
okLabel={recruit.string.CreateCandidate}
|
||||
okAction={save}
|
||||
on:close={() => { dispatch('close') }}>
|
||||
<DialogHeader />
|
||||
<DialogHeader {space} {object} {newValue} {resumeId} {resumeName} {resumeUuid} {resumeSize} {resumeType}/>
|
||||
<Tabs model={tabModel}/>
|
||||
</Dialog>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user