From 1eb8977a6ca1079d191be8bc382464666504b76b Mon Sep 17 00:00:00 2001 From: Denis Bykhov <bykhov.denis@gmail.com> Date: Thu, 16 Jan 2025 21:03:47 +0500 Subject: [PATCH] Set due date when create application (#7683) Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> --- .../calendar/DueDatePresenter.svelte | 2 ++ .../src/components/CreateApplication.svelte | 7 ++---- .../src/components/DueDateEditor.svelte | 23 +++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/packages/ui/src/components/calendar/DueDatePresenter.svelte b/packages/ui/src/components/calendar/DueDatePresenter.svelte index 4190131e72..fa1dba5047 100644 --- a/packages/ui/src/components/calendar/DueDatePresenter.svelte +++ b/packages/ui/src/components/calendar/DueDatePresenter.svelte @@ -16,6 +16,7 @@ import { Timestamp } from '@hcengineering/core' import DueDatePopup from './DueDatePopup.svelte' import { tooltip } from '../../tooltips' + import ui from '../../plugin' import DatePresenter from './DatePresenter.svelte' import { getDaysDifference, getDueDateIconModifier, getFormattedDate } from './internal/DateUtils' import { ButtonKind, ButtonSize } from '../../types' @@ -67,6 +68,7 @@ : undefined} > <DatePresenter + labelNull={ui.string.DueDate} {value} {editable} {iconModifier} diff --git a/plugins/recruit-resources/src/components/CreateApplication.svelte b/plugins/recruit-resources/src/components/CreateApplication.svelte index c3f4100bb5..82b97be5d8 100644 --- a/plugins/recruit-resources/src/components/CreateApplication.svelte +++ b/plugins/recruit-resources/src/components/CreateApplication.svelte @@ -18,7 +18,7 @@ import type { Contact, Employee, Person } from '@hcengineering/contact' import contact from '@hcengineering/contact' import { EmployeeBox, ExpandRightDouble, UserBox } from '@hcengineering/contact-resources' - import { + import core, { Account, AccountRole, Class, @@ -160,10 +160,7 @@ status: selectedState._id, number, identifier: `APP-${number}`, - assignee: doc.assignee, rank: makeRank(lastOne?.rank, undefined), - startDate: null, - dueDate: null, kind }, doc._id @@ -430,7 +427,7 @@ <InlineAttributeBar _class={recruit.class.Applicant} object={doc} - toClass={task.class.Task} + toClass={core.class.AttachedDoc} ignoreKeys={['assignee', 'status']} extraProps={{ showNavigate: false, space: vacancy._id }} /> diff --git a/plugins/task-resources/src/components/DueDateEditor.svelte b/plugins/task-resources/src/components/DueDateEditor.svelte index fd8f3e4e75..e67d6ccd89 100644 --- a/plugins/task-resources/src/components/DueDateEditor.svelte +++ b/plugins/task-resources/src/components/DueDateEditor.svelte @@ -10,6 +10,7 @@ export let size: ButtonSize = 'medium' export let kind: ButtonKind = 'link' export let editable: boolean = true + export let onChange: ((value: any) => void) | undefined const client = getClient() $: status = $statusStore.byId.get(object.status) @@ -21,15 +22,19 @@ return } - await client.updateCollection( - object._class, - object.space, - object._id, - object.attachedTo, - object.attachedToClass, - object.collection, - { dueDate: newDueDate } - ) + if (onChange !== undefined) { + onChange(newDueDate) + } else { + await client.updateCollection( + object._class, + object.space, + object._id, + object.attachedTo, + object.attachedToClass, + object.collection, + { dueDate: newDueDate } + ) + } } </script>