mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-11 12:57:59 +00:00
initial AttachmentPresenter
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
c728103e68
commit
ac87b6c82a
File diff suppressed because it is too large
Load Diff
@ -110,4 +110,8 @@ export function createModel (builder: Builder): void {
|
|||||||
private: false,
|
private: false,
|
||||||
members: []
|
members: []
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.mixin(chunter.class.Attachment, core.class.Class, view.mixin.AttributePresenter, {
|
||||||
|
presenter: chunter.component.AttachmentPresenter
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,12 @@ import type { IntlString } from '@anticrm/platform'
|
|||||||
import { mergeIds } from '@anticrm/platform'
|
import { mergeIds } from '@anticrm/platform'
|
||||||
import type { Ref } from '@anticrm/core'
|
import type { Ref } from '@anticrm/core'
|
||||||
import { ViewletDescriptor } from '@anticrm/view'
|
import { ViewletDescriptor } from '@anticrm/view'
|
||||||
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
|
|
||||||
export default mergeIds(chunterId, chunter, {
|
export default mergeIds(chunterId, chunter, {
|
||||||
|
component: {
|
||||||
|
AttachmentPresenter: '' as AnyComponent
|
||||||
|
},
|
||||||
string: {
|
string: {
|
||||||
ApplicationLabelChunter: '' as IntlString
|
ApplicationLabelChunter: '' as IntlString
|
||||||
},
|
},
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
"@anticrm/model-workbench": "~0.6.1",
|
"@anticrm/model-workbench": "~0.6.1",
|
||||||
"@anticrm/model-contact": "~0.6.0",
|
"@anticrm/model-contact": "~0.6.0",
|
||||||
"@anticrm/recruit": "~0.6.0",
|
"@anticrm/recruit": "~0.6.0",
|
||||||
"@anticrm/recruit-resources": "~0.6.0"
|
"@anticrm/recruit-resources": "~0.6.0",
|
||||||
|
"@anticrm/chunter": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,15 @@ import { Builder, Model, UX, Prop, TypeString } from '@anticrm/model'
|
|||||||
import type { Ref, FindOptions, Doc, Domain } from '@anticrm/core'
|
import type { Ref, FindOptions, Doc, Domain } from '@anticrm/core'
|
||||||
import core, { TSpace, TDoc } from '@anticrm/model-core'
|
import core, { TSpace, TDoc } from '@anticrm/model-core'
|
||||||
import type { Vacancy, Candidates, Candidate, Applicant } from '@anticrm/recruit'
|
import type { Vacancy, Candidates, Candidate, Applicant } from '@anticrm/recruit'
|
||||||
|
import type { Attachment } from '@anticrm/chunter'
|
||||||
|
|
||||||
import workbench from '@anticrm/model-workbench'
|
import workbench from '@anticrm/model-workbench'
|
||||||
|
|
||||||
import view from '@anticrm/model-view'
|
import view from '@anticrm/model-view'
|
||||||
import contact, { TPerson } from '@anticrm/model-contact'
|
import contact, { TPerson } from '@anticrm/model-contact'
|
||||||
import recruit from './plugin'
|
import recruit from './plugin'
|
||||||
import { Person } from '@anticrm/contact'
|
import chunter from '@anticrm/chunter'
|
||||||
|
import type { Person } from '@anticrm/contact'
|
||||||
|
|
||||||
export const DOMAIN_RECRUIT = 'recruit' as Domain
|
export const DOMAIN_RECRUIT = 'recruit' as Domain
|
||||||
|
|
||||||
@ -38,7 +40,10 @@ export class TCandidates extends TSpace implements Candidates {}
|
|||||||
|
|
||||||
@Model(recruit.class.Candidate, contact.class.Person)
|
@Model(recruit.class.Candidate, contact.class.Person)
|
||||||
@UX('Candidate' as IntlString)
|
@UX('Candidate' as IntlString)
|
||||||
export class TCandidate extends TPerson implements Candidate {}
|
export class TCandidate extends TPerson implements Candidate {
|
||||||
|
@Prop(TypeString(), 'Resume' as IntlString)
|
||||||
|
resume?: Ref<Attachment>
|
||||||
|
}
|
||||||
|
|
||||||
@Model(recruit.class.Applicant, core.class.Doc, DOMAIN_RECRUIT)
|
@Model(recruit.class.Applicant, core.class.Doc, DOMAIN_RECRUIT)
|
||||||
export class TApplicant extends TDoc implements Applicant {
|
export class TApplicant extends TDoc implements Applicant {
|
||||||
@ -94,7 +99,13 @@ export function createModel (builder: Builder): void {
|
|||||||
attachTo: recruit.class.Candidate,
|
attachTo: recruit.class.Candidate,
|
||||||
descriptor: view.viewlet.Table,
|
descriptor: view.viewlet.Table,
|
||||||
open: recruit.component.EditCandidate,
|
open: recruit.component.EditCandidate,
|
||||||
config: ['', 'channels', 'city']
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
|
options: {
|
||||||
|
lookup: {
|
||||||
|
resume: chunter.class.Attachment
|
||||||
|
}
|
||||||
|
} as FindOptions<Doc>, // TODO: fix
|
||||||
|
config: ['', '$lookup.resume', 'channels', 'city']
|
||||||
})
|
})
|
||||||
|
|
||||||
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
||||||
@ -106,7 +117,7 @@ export function createModel (builder: Builder): void {
|
|||||||
lookup: {
|
lookup: {
|
||||||
candidate: recruit.class.Candidate
|
candidate: recruit.class.Candidate
|
||||||
}
|
}
|
||||||
} as FindOptions<Doc>,
|
} as FindOptions<Doc>, // TODO: fix
|
||||||
config: ['$lookup.candidate', '$lookup.candidate.email', '$lookup.candidate.city']
|
config: ['$lookup.candidate', '$lookup.candidate.email', '$lookup.candidate.city']
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,9 @@ export class MemDb extends TxProcessor {
|
|||||||
const result: LookupData<T> = {}
|
const result: LookupData<T> = {}
|
||||||
for (const key in lookup) {
|
for (const key in lookup) {
|
||||||
const id = (doc as any)[key] as Ref<Doc>
|
const id = (doc as any)[key] as Ref<Doc>
|
||||||
(result as any)[key] = this.getObject(id)
|
if (id !== undefined) {
|
||||||
|
(result as any)[key] = this.getObject(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
withLookup.push(Object.assign({}, doc, { $lookup: result }))
|
withLookup.push(Object.assign({}, doc, { $lookup: result }))
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||||
|
// Copyright © 2021 Hardcore Engineering Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License. You may
|
||||||
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
//
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
|
||||||
|
import type { Attachment } from '@anticrm/chunter'
|
||||||
|
|
||||||
|
export let value: Attachment
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
attachment: {#if value}{value.name}{:else}nothing{/if}
|
||||||
|
|
||||||
|
|
@ -16,11 +16,13 @@
|
|||||||
import CreateChannel from './components/CreateChannel.svelte'
|
import CreateChannel from './components/CreateChannel.svelte'
|
||||||
import ChannelView from './components/ChannelView.svelte'
|
import ChannelView from './components/ChannelView.svelte'
|
||||||
import Activity from './components/Activity.svelte'
|
import Activity from './components/Activity.svelte'
|
||||||
|
import AttachmentPresenter from './components/AttachmentPresenter.svelte'
|
||||||
|
|
||||||
export default async () => ({
|
export default async () => ({
|
||||||
component: {
|
component: {
|
||||||
CreateChannel,
|
CreateChannel,
|
||||||
ChannelView,
|
ChannelView,
|
||||||
Activity
|
Activity,
|
||||||
|
AttachmentPresenter
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -16,17 +16,14 @@
|
|||||||
<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 { TextArea, EditBox, Dialog, Tabs, Section, Grid } from '@anticrm/ui'
|
|
||||||
import File from './icons/File.svelte'
|
|
||||||
import Address from './icons/Address.svelte'
|
|
||||||
import Attachment from './icons/Attachment.svelte'
|
|
||||||
import DialogHeader from './DialogHeader.svelte'
|
import DialogHeader from './DialogHeader.svelte'
|
||||||
|
|
||||||
import { getClient } from '@anticrm/presentation'
|
import { getClient } from '@anticrm/presentation'
|
||||||
|
|
||||||
import recruit from '../plugin'
|
import recruit from '../plugin'
|
||||||
import chunter from '@anticrm/chunter'
|
import chunter from '@anticrm/chunter'
|
||||||
import { Candidate } from '@anticrm/recruit'
|
import type { Candidate } from '@anticrm/recruit'
|
||||||
|
import type { Attachment } from '@anticrm/chunter'
|
||||||
|
|
||||||
export let space: Ref<Space>
|
export let space: Ref<Space>
|
||||||
|
|
||||||
@ -38,7 +35,7 @@
|
|||||||
const newValue = Object.assign({}, object)
|
const newValue = Object.assign({}, object)
|
||||||
|
|
||||||
let resume = {} as {
|
let resume = {} as {
|
||||||
id: Ref<Doc> | undefined
|
id: Ref<Attachment> | undefined
|
||||||
name: string
|
name: string
|
||||||
uuid: string
|
uuid: string
|
||||||
size: number
|
size: number
|
||||||
@ -54,9 +51,8 @@
|
|||||||
const candidateId = await client.createDoc(recruit.class.Candidate, space, {
|
const candidateId = await client.createDoc(recruit.class.Candidate, space, {
|
||||||
firstName: newValue.firstName,
|
firstName: newValue.firstName,
|
||||||
lastName: newValue.lastName,
|
lastName: newValue.lastName,
|
||||||
email: '',
|
|
||||||
phone: '',
|
|
||||||
city: newValue.city,
|
city: newValue.city,
|
||||||
|
channels: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('resume name', resume.name)
|
console.log('resume name', resume.name)
|
||||||
@ -72,6 +68,10 @@
|
|||||||
type: resume.type,
|
type: resume.type,
|
||||||
size: resume.size,
|
size: resume.size,
|
||||||
}, resume.id)
|
}, resume.id)
|
||||||
|
|
||||||
|
client.updateDoc(recruit.class.Candidate, space, candidateId, {
|
||||||
|
resume: resume.id
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch('close')
|
dispatch('close')
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anticrm/platform":"~0.6.5",
|
"@anticrm/platform":"~0.6.5",
|
||||||
"@anticrm/core":"~0.6.11",
|
"@anticrm/core":"~0.6.11",
|
||||||
"@anticrm/contact":"~0.6.0"
|
"@anticrm/contact":"~0.6.0",
|
||||||
|
"@anticrm/chunter":"~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import { plugin } from '@anticrm/platform'
|
|||||||
import type { Plugin, Asset } from '@anticrm/platform'
|
import type { Plugin, Asset } from '@anticrm/platform'
|
||||||
import type { Space, Doc, Ref } from '@anticrm/core'
|
import type { Space, Doc, Ref } from '@anticrm/core'
|
||||||
import type { Person } from '@anticrm/contact'
|
import type { Person } from '@anticrm/contact'
|
||||||
|
import type { Attachment } from '@anticrm/chunter'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -31,7 +32,9 @@ export interface Candidates extends Space {}
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface Candidate extends Person {}
|
export interface Candidate extends Person {
|
||||||
|
resume?: Ref<Attachment>
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user