From bd3c683cde02c9d12a28462c94227f86c531dbc6 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Fri, 12 May 2023 10:42:15 +0500 Subject: [PATCH] TSK-1429: rework dueDate to ignore overdue in applicants, kanban and right panel (#3169) Signed-off-by: Vyacheslav Tumanov --- models/task/src/index.ts | 2 +- packages/presentation/src/utils.ts | 7 ++++ .../src/components/KanbanCard.svelte | 1 + .../src/components/DueDateEditor.svelte | 37 +++++++++++++++++++ plugins/task-resources/src/index.ts | 4 +- plugins/task-resources/src/plugin.ts | 3 +- .../components/issues/DueDateEditor.svelte | 17 +++++++-- 7 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 plugins/task-resources/src/components/DueDateEditor.svelte diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 1f82497795..97a7741a97 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -102,7 +102,7 @@ export class TTask extends TAttachedDoc implements Task { // @Prop(TypeRef(contact.class.Employee), task.string.TaskAssignee) assignee!: Ref | null - @Prop(TypeDate(), task.string.DueDate) + @Prop(TypeDate(), task.string.DueDate, { editor: task.component.DueDateEditor }) dueDate!: Timestamp | null @Prop(TypeDate(), task.string.StartDate) diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index a895879614..09d3e03d2f 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -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) { diff --git a/plugins/recruit-resources/src/components/KanbanCard.svelte b/plugins/recruit-resources/src/components/KanbanCard.svelte index 5561ce16f0..0595bc0e05 100644 --- a/plugins/recruit-resources/src/components/KanbanCard.svelte +++ b/plugins/recruit-resources/src/components/KanbanCard.svelte @@ -95,6 +95,7 @@ { await client.update(object, { dueDate: e }) }} diff --git a/plugins/task-resources/src/components/DueDateEditor.svelte b/plugins/task-resources/src/components/DueDateEditor.svelte new file mode 100644 index 0000000000..7d6bdbf5f0 --- /dev/null +++ b/plugins/task-resources/src/components/DueDateEditor.svelte @@ -0,0 +1,37 @@ + + +{#if object} + handleDueDateChanged(e)} + {shouldIgnoreOverdue} + /> +{/if} diff --git a/plugins/task-resources/src/index.ts b/plugins/task-resources/src/index.ts index 920f93e6e8..5a5e8b2418 100644 --- a/plugins/task-resources/src/index.ts +++ b/plugins/task-resources/src/index.ts @@ -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 => ({ AssignedTasks, DoneStateRefPresenter, StateRefPresenter, - TodoItemsPopup + TodoItemsPopup, + DueDateEditor }, actionImpl: { EditStatuses: editStatuses diff --git a/plugins/task-resources/src/plugin.ts b/plugins/task-resources/src/plugin.ts index 0607192c78..b718f5ee25 100644 --- a/plugins/task-resources/src/plugin.ts +++ b/plugins/task-resources/src/plugin.ts @@ -76,6 +76,7 @@ export default mergeIds(taskId, task, { }, component: { TodoStatePresenter: '' as AnyComponent, - AssignedTasks: '' as AnyComponent + AssignedTasks: '' as AnyComponent, + DueDateEditor: '' as AnyComponent } }) diff --git a/plugins/tracker-resources/src/components/issues/DueDateEditor.svelte b/plugins/tracker-resources/src/components/issues/DueDateEditor.svelte index c8781f3cfe..dcaade3a08 100644 --- a/plugins/tracker-resources/src/components/issues/DueDateEditor.svelte +++ b/plugins/tracker-resources/src/components/issues/DueDateEditor.svelte @@ -14,13 +14,17 @@ --> {#if value} - handleDueDateChanged(e)} /> + handleDueDateChanged(e)} + {shouldIgnoreOverdue} + /> {/if}