mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +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
|
collection!: string
|
||||||
name!: string
|
name!: string
|
||||||
file!: string
|
file!: string
|
||||||
|
size!: number
|
||||||
|
type!: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createModel (builder: Builder): void {
|
export function createModel (builder: Builder): void {
|
||||||
|
@ -53,6 +53,8 @@ export interface Attachment extends Doc {
|
|||||||
collection: string
|
collection: string
|
||||||
name: string
|
name: string
|
||||||
file: string
|
file: string
|
||||||
|
size: number
|
||||||
|
type: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte'
|
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 { TextArea, EditBox, Dialog, Tabs, Section, Grid } from '@anticrm/ui'
|
||||||
import File from './icons/File.svelte'
|
import File from './icons/File.svelte'
|
||||||
import Address from './icons/Address.svelte'
|
import Address from './icons/Address.svelte'
|
||||||
@ -25,28 +25,53 @@
|
|||||||
import { getClient } from '@anticrm/presentation'
|
import { getClient } from '@anticrm/presentation'
|
||||||
|
|
||||||
import recruit from '../plugin'
|
import recruit from '../plugin'
|
||||||
|
import chunter from '@anticrm/chunter'
|
||||||
|
import { Candidate } from '@anticrm/recruit'
|
||||||
|
|
||||||
export let space: Ref<Space>
|
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()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let firstName: string = ''
|
|
||||||
let lastName: string = ''
|
|
||||||
let email: string = ''
|
|
||||||
let phone: string = ''
|
|
||||||
let city: string = ''
|
|
||||||
|
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
|
||||||
function createCandidate() {
|
async function createCandidate() {
|
||||||
client.createDoc(recruit.class.Candidate, space, {
|
console.log(newValue)
|
||||||
firstName,
|
// create candidate
|
||||||
lastName,
|
const candidateId = await client.createDoc(recruit.class.Candidate, space, {
|
||||||
email,
|
firstName: newValue.firstName,
|
||||||
phone,
|
lastName: newValue.lastName,
|
||||||
city,
|
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>
|
</script>
|
||||||
|
|
||||||
<DialogHeader {space}/>
|
<DialogHeader {space} {object} {newValue} {resumeId} {resumeName} {resumeUuid} {resumeSize} {resumeType} on:save={createCandidate}/>
|
||||||
|
@ -16,11 +16,8 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import { getMetadata } from '@anticrm/platform'
|
|
||||||
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 login from '@anticrm/login'
|
|
||||||
import { createQuery, getClient } from '@anticrm/presentation'
|
|
||||||
|
|
||||||
import { EditBox, Button, CircleButton, Grid, Label, showModal } from '@anticrm/ui'
|
import { EditBox, Button, CircleButton, Grid, Label, showModal } from '@anticrm/ui'
|
||||||
import AvatarEditor from './AvatarEditor.svelte'
|
import AvatarEditor from './AvatarEditor.svelte'
|
||||||
@ -29,26 +26,20 @@
|
|||||||
import Twitter from './icons/Twitter.svelte'
|
import Twitter from './icons/Twitter.svelte'
|
||||||
import User from './icons/User.svelte'
|
import User from './icons/User.svelte'
|
||||||
|
|
||||||
import chunter from '@anticrm/chunter'
|
|
||||||
import recruit from '../plugin'
|
|
||||||
|
|
||||||
import { uploadFile } from '../utils'
|
import { uploadFile } from '../utils'
|
||||||
|
import { Candidate } from '@anticrm/recruit'
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let space: Ref<Space>
|
export let space: Ref<Space>
|
||||||
|
export let object: Candidate
|
||||||
|
export let newValue: Candidate
|
||||||
|
|
||||||
let firstName = ''
|
export let resumeId: Ref<Doc>
|
||||||
let lastName = ''
|
export let resumeName: string | undefined
|
||||||
let city = ''
|
export let resumeUuid: string
|
||||||
|
export let resumeSize: number
|
||||||
let resumeId: Ref<Doc>
|
export let resumeType: string
|
||||||
let resumeName: string | undefined
|
|
||||||
let resumeUuid: string
|
|
||||||
let resumeSize: number
|
|
||||||
let resumeType: string
|
|
||||||
|
|
||||||
const client = getClient()
|
|
||||||
|
|
||||||
let dragover = false
|
let dragover = false
|
||||||
let loading = 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) {
|
function drop(event: DragEvent) {
|
||||||
dragover = false
|
dragover = false
|
||||||
const droppedFile = event.dataTransfer?.files[0]
|
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="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={firstName}/>
|
<EditBox placeholder="John" bind:value={newValue.firstName}/>
|
||||||
<EditBox placeholder="Appleseed" bind:value={lastName}/>
|
<EditBox placeholder="Appleseed" bind:value={newValue.lastName}/>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<div class="abs-lb-content">
|
<div class="abs-lb-content">
|
||||||
@ -131,7 +99,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="abs-rb-content">
|
<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>
|
||||||
<div class="abs-rt-content">
|
<div class="abs-rt-content">
|
||||||
<Grid column={2} columnGap={.5}>
|
<Grid column={2} columnGap={.5}>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte'
|
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 { Dialog, Tabs } from '@anticrm/ui'
|
||||||
import { getClient } from '@anticrm/presentation'
|
import { getClient } from '@anticrm/presentation'
|
||||||
import type { Candidate } from '@anticrm/recruit'
|
import type { Candidate } from '@anticrm/recruit'
|
||||||
@ -26,11 +26,18 @@
|
|||||||
export let object: Candidate
|
export let object: Candidate
|
||||||
export let space: Ref<Space>
|
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 dispatch = createEventDispatcher()
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
|
|
||||||
const newValue = Object.assign({}, object)
|
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const attributes: Record<string, any> = {}
|
const attributes: Record<string, any> = {}
|
||||||
for (const key in object) {
|
for (const key in object) {
|
||||||
@ -42,14 +49,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tabModel = [
|
const tabModel = [
|
||||||
{
|
// {
|
||||||
label: 'General',
|
// label: 'General',
|
||||||
component: 'recruit:component:CandidateGeneral',
|
// component: 'recruit:component:CandidateGeneral',
|
||||||
props: {
|
// props: {
|
||||||
object,
|
// object,
|
||||||
newValue,
|
// newValue,
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: 'Activity',
|
label: 'Activity',
|
||||||
component: 'chunter:component:Activity',
|
component: 'chunter:component:Activity',
|
||||||
@ -74,7 +81,7 @@
|
|||||||
okLabel={recruit.string.CreateCandidate}
|
okLabel={recruit.string.CreateCandidate}
|
||||||
okAction={save}
|
okAction={save}
|
||||||
on:close={() => { dispatch('close') }}>
|
on:close={() => { dispatch('close') }}>
|
||||||
<DialogHeader />
|
<DialogHeader {space} {object} {newValue} {resumeId} {resumeName} {resumeUuid} {resumeSize} {resumeType}/>
|
||||||
<Tabs model={tabModel}/>
|
<Tabs model={tabModel}/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user