mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 01:39:53 +00:00
TSK-1429: rework dueDate to ignore overdue in applicants, kanban and right panel (#3169)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
11ad10532d
commit
bd3c683cde
models/task/src
packages/presentation/src
plugins
recruit-resources/src/components
task-resources/src
tracker-resources/src/components/issues
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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 })
|
||||
}}
|
||||
|
37
plugins/task-resources/src/components/DueDateEditor.svelte
Normal file
37
plugins/task-resources/src/components/DueDateEditor.svelte
Normal 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}
|
@ -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
|
||||
|
@ -76,6 +76,7 @@ export default mergeIds(taskId, task, {
|
||||
},
|
||||
component: {
|
||||
TodoStatePresenter: '' as AnyComponent,
|
||||
AssignedTasks: '' as AnyComponent
|
||||
AssignedTasks: '' as AnyComponent,
|
||||
DueDateEditor: '' as AnyComponent
|
||||
}
|
||||
})
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user