mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-30 04:05:39 +00:00
client expose getModel
; working ApplicationsPopup
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
d805f87df7
commit
473fa9ba80
@ -35,6 +35,7 @@ export type TxHander = (tx: Tx) => void
|
||||
export interface Client extends Storage {
|
||||
notify?: (tx: Tx) => void
|
||||
getHierarchy: () => Hierarchy
|
||||
getModel: () => ModelDb
|
||||
findOne: <T extends Doc>(
|
||||
_class: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
@ -50,6 +51,8 @@ class ClientImpl implements Client {
|
||||
|
||||
getHierarchy (): Hierarchy { return this.hierarchy }
|
||||
|
||||
getModel (): ModelDb { return this.model }
|
||||
|
||||
async findAll<T extends Doc>(
|
||||
_class: Ref<Class<T>>,
|
||||
query: DocumentQuery<T>,
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
import { onDestroy } from 'svelte'
|
||||
|
||||
import { Doc, Ref, Class, DocumentQuery, FindOptions, Client, Hierarchy, Tx, getCurrentAccount } from '@anticrm/core'
|
||||
import { Doc, Ref, Class, DocumentQuery, FindOptions, Client, Hierarchy, Tx, getCurrentAccount, ModelDb } from '@anticrm/core'
|
||||
import { TxOperations } from '@anticrm/core'
|
||||
import { LiveQuery as LQ } from '@anticrm/query'
|
||||
import core from '@anticrm/core'
|
||||
@ -34,6 +34,10 @@ class UIClient extends TxOperations implements Client {
|
||||
return this.client.getHierarchy()
|
||||
}
|
||||
|
||||
getModel (): ModelDb {
|
||||
return this.client.getModel()
|
||||
}
|
||||
|
||||
tx(tx: Tx): Promise<void> {
|
||||
return Promise.all([super.tx(tx), this.liveQuery.tx(tx)]) as unknown as Promise<void>
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
import {
|
||||
Ref, Class, Doc, Tx, DocumentQuery, TxCreateDoc, TxRemoveDoc, Client,
|
||||
FindOptions, TxUpdateDoc, _getOperator, TxProcessor, resultSort, SortingQuery,
|
||||
FindResult, Hierarchy, Refs, WithLookup, LookupData, TxMixin, TxPutBag
|
||||
FindResult, Hierarchy, Refs, WithLookup, LookupData, TxMixin, TxPutBag, ModelDb
|
||||
} from '@anticrm/core'
|
||||
|
||||
interface Query {
|
||||
@ -43,6 +43,10 @@ export class LiveQuery extends TxProcessor implements Client {
|
||||
return this.client.getHierarchy()
|
||||
}
|
||||
|
||||
getModel (): ModelDb {
|
||||
return this.client.getModel()
|
||||
}
|
||||
|
||||
private match (q: Query, doc: Doc): boolean {
|
||||
if (!this.getHierarchy().isDerived(doc._class, q._class)) {
|
||||
return false
|
||||
|
@ -16,23 +16,35 @@
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import type { Candidate } from '@anticrm/recruit'
|
||||
import type { Applicant, Candidate } from '@anticrm/recruit'
|
||||
import { CircleButton, Label } from '@anticrm/ui'
|
||||
import Vacancy from './icons/Vacancy.svelte'
|
||||
import { getClient, createQuery } from '@anticrm/presentation'
|
||||
|
||||
import recruit from '@anticrm/recruit'
|
||||
|
||||
export let value: Candidate
|
||||
|
||||
const apps = [{ label: 'Lead analyst', description: 'Tesla' },
|
||||
{ label: 'Principal analyst', description: 'Google' }]
|
||||
let applications: Applicant[] = []
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(recruit.class.Applicant, { candidate: value._id }, result => { applications = result })
|
||||
|
||||
const model = getClient().getModel()
|
||||
|
||||
function getApplicationLabel(app: Applicant): string {
|
||||
return model.getObject(app.space).name
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="flex-col">
|
||||
{#each apps as app}
|
||||
{#each applications as app}
|
||||
<div class="flex-row-center app">
|
||||
<div class="app-icon"><CircleButton icon={Vacancy} size={'large'} /></div>
|
||||
<div class="flex-grow flex-col">
|
||||
<div class="overflow-label label">{app.label}</div>
|
||||
<div class="overflow-label desc">{app.description}</div>
|
||||
<div class="overflow-label label">{getApplicationLabel(app)}</div>
|
||||
<div class="overflow-label desc">Cisco</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
|
@ -17,19 +17,15 @@
|
||||
<script lang="ts">
|
||||
|
||||
import type { Candidate } from '@anticrm/recruit'
|
||||
import { CircleButton, IconFile, Label, Tooltip } from '@anticrm/ui'
|
||||
import Vacancy from './icons/Vacancy.svelte'
|
||||
import { IconFile, Tooltip } from '@anticrm/ui'
|
||||
import ApplicationsPopup from './ApplicationsPopup.svelte'
|
||||
|
||||
export let value: Candidate
|
||||
|
||||
let trigger: HTMLElement
|
||||
const apps = [{ label: 'Lead analyst', description: 'Tesla' },
|
||||
{ label: 'Principal analyst', description: 'Google' }]
|
||||
</script>
|
||||
|
||||
{#if value.applications && value.applications > 0}
|
||||
<Tooltip label={'Applications'} component={ApplicationsPopup} props={{ value: value }}>
|
||||
<Tooltip label={'Applications'} component={ApplicationsPopup} props={{ value }}>
|
||||
<div class="flex-row-center">
|
||||
<IconFile size={'small'} /> {value.applications}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user