Fix applications view (#2537)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-01-25 00:35:42 +07:00 committed by GitHub
parent e8d5739847
commit cdfb8d8e95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 14 deletions

View File

@ -207,7 +207,6 @@ export function createModel (builder: Builder): void {
label: recruit.string.Applications,
createLabel: recruit.string.ApplicationCreateLabel,
createComponent: recruit.component.CreateApplication,
descriptor: task.viewlet.StatusTable,
baseQuery: {
doneState: null
}
@ -364,6 +363,29 @@ export function createModel (builder: Builder): void {
}
]
},
recruit.viewlet.StatusTableApplicant
)
builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: recruit.class.Applicant,
descriptor: view.viewlet.Table,
config: [
'',
'attachedTo',
'assignee',
'state',
'comments',
'attachments',
'modifiedOn',
{
key: '$lookup.attachedTo.$lookup.channels',
sortingKey: ['$lookup.attachedTo.$lookup.channels.lastMessage', '$lookup.attachedTo.channels']
}
],
hiddenKeys: ['name']
},
recruit.viewlet.TableApplicant
)

View File

@ -103,6 +103,7 @@ export default mergeIds(recruitId, recruit, {
viewlet: {
TableCandidate: '' as Ref<Viewlet>,
TableVacancy: '' as Ref<Viewlet>,
StatusTableApplicant: '' as Ref<Viewlet>,
TableApplicant: '' as Ref<Viewlet>,
CalendarReview: '' as Ref<Viewlet>,
TableReview: '' as Ref<Viewlet>

View File

@ -14,7 +14,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Class, DocumentQuery, FindOptions, Ref, SortingOrder } from '@hcengineering/core'
import { Class, DocumentQuery, FindOptions, Ref, SortingOrder, Space } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import { DoneState, SpaceWithStates, State, Task } from '@hcengineering/task'
import { TabList } from '@hcengineering/ui'
@ -54,9 +54,11 @@
const doneStateQuery = createQuery()
doneStateQuery.query(
task.class.DoneState,
{
space
},
space != null
? {
space
}
: {},
(res) => {
doneStates = res
itemsDS = doneStates.map((s) => {
@ -79,10 +81,16 @@
const client = getClient()
async function updateQuery (query: DocumentQuery<Task>, selectedDoneStates: Set<Ref<DoneState>>): Promise<void> {
async function updateQuery (
query: DocumentQuery<Task>,
selectedDoneStates: Set<Ref<DoneState>>,
space?: Ref<Space>
): Promise<void> {
resConfig = updateConfig(config)
const result = client.getHierarchy().clone(query)
result.space = space
if (result.space) {
result.space = space
}
if (state) {
result.state = state
}
@ -107,17 +115,17 @@
selectedDS = ['NoDoneState']
withoutDone = true
}
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
}
function noDoneClick (): void {
withoutDone = true
selectedDS = ['NoDoneState']
selectedDoneStates.clear()
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
}
$: updateQuery(query, selectedDoneStates)
$: updateQuery(query, selectedDoneStates, space)
const handleSelect = (result: any) => {
if (result.type === 'select') {
const res = result.detail
@ -126,12 +134,12 @@
state = undefined
withoutDone = false
selectedDoneStates.clear()
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
} else if (res.id === 'DoneStates') {
doneStatusesView = true
state = undefined
selectedDoneStates.clear()
updateQuery(query, selectedDoneStates)
updateQuery(query, selectedDoneStates, space)
}
}
}
@ -157,7 +165,7 @@
{#if doneStatusesView}
<TabList items={itemsDS} bind:selected={selectedDS} multiselect on:select={handleDoneSelect} size={'small'} />
{:else}
<StatesBar bind:state {space} gap={'none'} on:change={() => updateQuery(query, selectedDoneStates)} />
<StatesBar bind:state {space} gap={'none'} on:change={() => updateQuery(query, selectedDoneStates, space)} />
{/if}
</div>
<div class="statustableview-container">

View File

@ -34,7 +34,7 @@
const statesQuery = createQuery()
statesQuery.query(
task.class.State,
{ space },
space != null ? { space } : {},
(res) => {
states = res
},