TSK-753: Open user's department in schedule by default (#3001)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-04-17 21:28:44 +05:00 committed by GitHub
parent f13c501eec
commit 4d7dd1ff18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,9 +15,9 @@
<script lang="ts">
import { CalendarMode } from '@hcengineering/calendar-resources'
import calendar from '@hcengineering/calendar-resources/src/plugin'
import { DocumentQuery, Ref } from '@hcengineering/core'
import { DocumentQuery, getCurrentAccount, Ref } from '@hcengineering/core'
import { Department, Staff } from '@hcengineering/hr'
import { createQuery, SpaceSelector } from '@hcengineering/presentation'
import { createQuery, getClient, SpaceSelector } from '@hcengineering/presentation'
import {
Button,
Icon,
@ -32,8 +32,14 @@
import view from '@hcengineering/view'
import hr from '../plugin'
import ScheduleView from './ScheduleView.svelte'
import { EmployeeAccount } from '@hcengineering/contact'
import { employeeByIdStore } from '@hcengineering/contact-resources'
let department = hr.ids.Head
const hierarchy = getClient().getHierarchy()
const accountEmployee = $employeeByIdStore.get((getCurrentAccount() as EmployeeAccount).employee)
const accountStaff = accountEmployee !== undefined ? hierarchy.as(accountEmployee, hr.mixin.Staff) : undefined
let department = accountStaff !== undefined ? accountStaff.department : hr.ids.Head
let currentDate: Date = new Date()
let search = ''