mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-23 04:42:22 +02:00
18 lines
647 B
TypeScript
18 lines
647 B
TypeScript
//
|
|
// Copyright @ 2024 Hardcore Engineering Inc.
|
|
//
|
|
|
|
import { checkMyPermission, permissionsStore } from '@hcengineering/contact-resources'
|
|
import { type Training, TrainingState } from '@hcengineering/training'
|
|
import { get } from 'svelte/store'
|
|
import training from '../plugin'
|
|
import { getCurrentEmployeeRef } from './getCurrentEmployeeRef'
|
|
|
|
export function canCreateTrainingRequest (parent: Training): boolean {
|
|
return (
|
|
parent.state === TrainingState.Released &&
|
|
(checkMyPermission(training.permission.CreateRequestOnSomeoneElsesTraining, parent.space, get(permissionsStore)) ||
|
|
parent.owner === getCurrentEmployeeRef())
|
|
)
|
|
}
|