TSK-1429: rework dueDate to ignore overdue in applicants, kanban and right panel ()

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-05-12 10:42:15 +05:00 committed by GitHub
parent 11ad10532d
commit bd3c683cde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 65 additions and 6 deletions
models/task/src
packages/presentation/src
plugins
recruit-resources/src/components
task-resources/src
tracker-resources/src/components/issues

View File

@ -102,7 +102,7 @@ export class TTask extends TAttachedDoc implements Task {
// @Prop(TypeRef(contact.class.Employee), task.string.TaskAssignee)
assignee!: Ref<Employee> | null
@Prop(TypeDate(), task.string.DueDate)
@Prop(TypeDate(), task.string.DueDate, { editor: task.component.DueDateEditor })
dueDate!: Timestamp | null
@Prop(TypeDate(), task.string.StartDate)

View File

@ -377,6 +377,13 @@ export async function getAttributeEditor (
}
}
if (attribute.editor != null) {
try {
return await getResource(attribute.editor)
} catch (ex) {
console.error(getAttributeEditorNotFoundError(_class, key, ex))
}
}
const editorMixin = hierarchy.classHierarchyMixin(presenterClass.attrClass, mixin)
if (editorMixin?.inlineEditor === undefined) {

View File

@ -95,6 +95,7 @@
<DueDatePresenter
value={object.dueDate}
shouldRender={object.dueDate !== null && object.dueDate !== undefined}
shouldIgnoreOverdue={object.doneState !== null}
onChange={async (e) => {
await client.update(object, { dueDate: e })
}}

View File

@ -0,0 +1,37 @@
<script lang="ts">
import { getClient } from '@hcengineering/presentation'
import { DueDatePresenter } from '@hcengineering/ui'
import { WithLookup } from '@hcengineering/core'
import { Task } from '@hcengineering/task'
export let object: WithLookup<Task>
const client = getClient()
$: shouldIgnoreOverdue = object.doneState != null
const handleDueDateChanged = async (newDueDate: number | undefined | null) => {
if (newDueDate === undefined || object.dueDate === newDueDate) {
return
}
await client.updateCollection(
object._class,
object.space,
object._id,
object.attachedTo,
object.attachedToClass,
object.collection,
{ dueDate: newDueDate }
)
}
</script>
{#if object}
<DueDatePresenter
kind={'link'}
value={object.dueDate}
editable
onChange={(e) => handleDueDateChanged(e)}
{shouldIgnoreOverdue}
/>
{/if}

View File

@ -38,6 +38,7 @@ import TodoStatePresenter from './components/todos/TodoStatePresenter.svelte'
import Dashboard from './components/Dashboard.svelte'
import DoneStateRefPresenter from './components/state/DoneStateRefPresenter.svelte'
import StateRefPresenter from './components/state/StateRefPresenter.svelte'
import DueDateEditor from './components/DueDateEditor.svelte'
export { default as AssigneePresenter } from './components/AssigneePresenter.svelte'
export { StateRefPresenter }
@ -69,7 +70,8 @@ export default async (): Promise<Resources> => ({
AssignedTasks,
DoneStateRefPresenter,
StateRefPresenter,
TodoItemsPopup
TodoItemsPopup,
DueDateEditor
},
actionImpl: {
EditStatuses: editStatuses

View File

@ -76,6 +76,7 @@ export default mergeIds(taskId, task, {
},
component: {
TodoStatePresenter: '' as AnyComponent,
AssignedTasks: '' as AnyComponent
AssignedTasks: '' as AnyComponent,
DueDateEditor: '' as AnyComponent
}
})

View File

@ -14,13 +14,17 @@
-->
<script lang="ts">
import { getClient } from '@hcengineering/presentation'
import { Issue } from '@hcengineering/tracker'
import tracker, { Issue } from '@hcengineering/tracker'
import { DueDatePresenter } from '@hcengineering/ui'
import { WithLookup } from '@hcengineering/core'
export let value: Issue
export let value: WithLookup<Issue>
export let width: string | undefined = undefined
const client = getClient()
$: shouldIgnoreOverdue =
value.$lookup?.status?.category === tracker.issueStatusCategory.Completed ||
value.$lookup?.status?.category === tracker.issueStatusCategory.Canceled
const handleDueDateChanged = async (newDueDate: number | undefined | null) => {
if (newDueDate === undefined || value.dueDate === newDueDate) {
@ -40,5 +44,12 @@
</script>
{#if value}
<DueDatePresenter kind={'link'} value={value.dueDate} {width} editable onChange={(e) => handleDueDateChanged(e)} />
<DueDatePresenter
kind={'link'}
value={value.dueDate}
{width}
editable
onChange={(e) => handleDueDateChanged(e)}
{shouldIgnoreOverdue}
/>
{/if}