From e4b7575147e5cedfed1ef7173c654c25a0b72458 Mon Sep 17 00:00:00 2001 From: Anna No Date: Mon, 23 May 2022 14:28:41 +0700 Subject: [PATCH] Board: Update card (#1826) Signed-off-by: Anna No --- dev/generator/src/recruit.ts | 4 +- dev/tool/src/importer.ts | 4 +- models/board/src/index.ts | 40 ++--- models/board/src/plugin.ts | 1 - models/task/src/index.ts | 6 + models/task/src/plugin.ts | 27 +--- packages/theme/styles/_layouts.scss | 1 + packages/ui/lang/en.json | 2 +- plugins/board-assets/lang/en.json | 8 +- plugins/board-assets/lang/ru.json | 8 +- .../src/components/CreateCard.svelte | 4 +- .../src/components/EditCard.svelte | 101 +++++++------ .../src/components/KanbanCard.svelte | 9 +- .../src/components/TableView.svelte | 3 +- .../src/components/UserBoxList.svelte | 2 +- .../src/components/add-card/AddCard.svelte | 4 +- .../src/components/editor/CardActions.svelte | 141 ++++++++++-------- .../components/editor/CardAttachments.svelte | 63 -------- .../components/editor/CardChecklist.svelte | 31 ++-- .../src/components/editor/CardDetails.svelte | 122 --------------- .../src/components/editor/CardLabels.svelte | 2 +- .../src/components/popups/AddChecklist.svelte | 2 +- .../src/components/popups/CopyCard.svelte | 4 +- .../components/popups/DateRangePicker.svelte | 73 ++++----- .../components/popups/EditAttachment.svelte | 50 ------- .../src/components/popups/EditMember.svelte | 46 ------ .../components/popups/RemoveAttachment.svelte | 46 ------ .../presenters/AttachmentPresenter.svelte | 109 -------------- .../presenters/DatePresenter.svelte | 17 +-- .../presenters/MemberPresenter.svelte | 29 ---- plugins/board-resources/src/index.ts | 10 +- plugins/board-resources/src/plugin.ts | 8 +- .../board-resources/src/utils/CardUtils.ts | 4 +- plugins/board/src/index.ts | 19 +-- .../src/components/CreateLead.svelte | 4 +- .../src/components/CreateApplication.svelte | 12 +- plugins/task-assets/lang/en.json | 2 + plugins/task-assets/lang/ru.json | 2 + plugins/task/src/index.ts | 34 ++++- 39 files changed, 289 insertions(+), 765 deletions(-) delete mode 100644 plugins/board-resources/src/components/editor/CardAttachments.svelte delete mode 100644 plugins/board-resources/src/components/editor/CardDetails.svelte delete mode 100644 plugins/board-resources/src/components/popups/EditAttachment.svelte delete mode 100644 plugins/board-resources/src/components/popups/EditMember.svelte delete mode 100644 plugins/board-resources/src/components/popups/RemoveAttachment.svelte delete mode 100644 plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte delete mode 100644 plugins/board-resources/src/components/presenters/MemberPresenter.svelte diff --git a/dev/generator/src/recruit.ts b/dev/generator/src/recruit.ts index cefb6ef3fa..ab3129d47d 100644 --- a/dev/generator/src/recruit.ts +++ b/dev/generator/src/recruit.ts @@ -156,7 +156,9 @@ async function genApplicant ( assignee: faker.random.arrayElement(emoloyeeIds), state: faker.random.arrayElement(states), doneState: null, - rank: rank as string + rank: rank as string, + startDate: null, + dueDate: null } // Update or create candidate diff --git a/dev/tool/src/importer.ts b/dev/tool/src/importer.ts index cfeb066a53..3b35859c39 100644 --- a/dev/tool/src/importer.ts +++ b/dev/tool/src/importer.ts @@ -251,7 +251,9 @@ async function createApplicant ( assignee: null, state, doneState: null, - rank: calcRank(lastOne, undefined) + rank: calcRank(lastOne, undefined), + startDate: null, + dueDate: null } // Update or create candidate diff --git a/models/board/src/index.ts b/models/board/src/index.ts index 691e266da4..d881c81dd4 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -14,9 +14,9 @@ // // To help typescript locate view plugin properly -import type { Board, Card, CardDate, CardLabel, MenuPage, CommonBoardPreference } from '@anticrm/board' +import type { Board, Card, CardLabel, MenuPage, CommonBoardPreference } from '@anticrm/board' import type { Employee } from '@anticrm/contact' -import { DOMAIN_MODEL, IndexKind, Markup, Ref, Timestamp, Type } from '@anticrm/core' +import { DOMAIN_MODEL, IndexKind, Markup, Ref } from '@anticrm/core' import { ArrOf, Builder, @@ -33,7 +33,7 @@ import { import attachment from '@anticrm/model-attachment' import chunter from '@anticrm/model-chunter' import contact from '@anticrm/model-contact' -import core, { TAttachedDoc, TDoc, TObj } from '@anticrm/model-core' +import core, { TAttachedDoc, TDoc } from '@anticrm/model-core' import task, { TSpaceWithStates, TTask } from '@anticrm/model-task' import view, { actionTemplates, createAction } from '@anticrm/model-view' import workbench, { Application } from '@anticrm/model-workbench' @@ -42,13 +42,6 @@ import type { AnyComponent } from '@anticrm/ui' import preference, { TPreference } from '@anticrm/model-preference' import board from './plugin' -/** - * @public - */ -export function TypeCardDate (): Type { - return { _class: board.class.CardDate, label: board.string.Dates } -} - @Model(board.class.Board, task.class.SpaceWithStates) @UX(board.string.Board, board.icon.Board) export class TBoard extends TSpaceWithStates implements Board { @@ -56,14 +49,6 @@ export class TBoard extends TSpaceWithStates implements Board { background!: string } -@Model(board.class.CardDate, core.class.Obj, DOMAIN_MODEL) -@UX(board.string.Dates) -export class TCardDate extends TObj implements CardDate { - dueDate?: Timestamp - isChecked?: boolean - startDate?: Timestamp -} - @Model(board.class.CardLabel, core.class.AttachedDoc, DOMAIN_MODEL) @UX(board.string.Labels) export class TCardLabel extends TAttachedDoc implements CardLabel { @@ -90,9 +75,6 @@ export class TCard extends TTask implements Card { @Prop(TypeBoolean(), board.string.IsArchived) isArchived?: boolean - @Prop(TypeCardDate(), board.string.Dates) - date?: CardDate - @Prop(TypeMarkup(), board.string.Description) @Index(IndexKind.FullText) description!: Markup @@ -125,7 +107,7 @@ export class TMenuPage extends TDoc implements MenuPage { } export function createModel (builder: Builder): void { - builder.createModel(TBoard, TCard, TCardLabel, TCardDate, TMenuPage, TCommonBoardPreference) + builder.createModel(TBoard, TCard, TCardLabel, TMenuPage, TCommonBoardPreference) builder.createDoc(board.class.MenuPage, core.space.Model, { component: board.component.Archive, @@ -228,10 +210,6 @@ export function createModel (builder: Builder): void { presenter: board.component.CardLabelPresenter }) - builder.mixin(board.class.CardDate, core.class.Class, view.mixin.AttributePresenter, { - presenter: board.component.CardDatePresenter - }) - builder.mixin(board.class.Board, core.class.Class, view.mixin.AttributePresenter, { presenter: board.component.BoardPresenter }) @@ -269,6 +247,16 @@ export function createModel (builder: Builder): void { board.viewlet.Table ) + builder.createDoc( + task.class.WonState, + core.space.Model, + { + title: board.string.Completed, + rank: '0' + }, + board.state.Completed + ) + // card actions createAction( builder, diff --git a/models/board/src/plugin.ts b/models/board/src/plugin.ts index b43e9c55bc..71578750dd 100644 --- a/models/board/src/plugin.ts +++ b/models/board/src/plugin.ts @@ -29,7 +29,6 @@ export default mergeIds(boardId, board, { KanbanCard: '' as AnyComponent, CardPresenter: '' as AnyComponent, CardLabelPresenter: '' as AnyComponent, - CardDatePresenter: '' as AnyComponent, BoardPresenter: '' as AnyComponent, TemplatesIcon: '' as AnyComponent, Cards: '' as AnyComponent, diff --git a/models/task/src/index.ts b/models/task/src/index.ts index 8875ee0022..c75cd66851 100644 --- a/models/task/src/index.ts +++ b/models/task/src/index.ts @@ -113,6 +113,12 @@ export class TTask extends TAttachedDoc implements Task { // @Prop(TypeRef(contact.class.Employee), task.string.TaskAssignee) assignee!: Ref | null + @Prop(TypeDate(), task.string.DueDate) + dueDate!: Timestamp | null + + @Prop(TypeDate(), task.string.StartDate) + startDate!: Timestamp | null + declare rank: string @Prop(Collection(task.class.TodoItem), task.string.Todos) diff --git a/models/task/src/plugin.ts b/models/task/src/plugin.ts index 9b3c50887b..de1284adaa 100644 --- a/models/task/src/plugin.ts +++ b/models/task/src/plugin.ts @@ -16,7 +16,7 @@ import type { Ref, Space } from '@anticrm/core' import { ObjectSearchCategory, ObjectSearchFactory } from '@anticrm/model-presentation' -import type { IntlString, Resource } from '@anticrm/platform' +import type { Resource } from '@anticrm/platform' import { mergeIds } from '@anticrm/platform' import { KanbanTemplate, taskId } from '@anticrm/task' import task from '@anticrm/task-resources/src/plugin' @@ -58,31 +58,6 @@ export default mergeIds(taskId, task, { StatusTableView: '' as AnyComponent, TaskHeader: '' as AnyComponent }, - string: { - TaskState: '' as IntlString, - TaskStateTitle: '' as IntlString, - TaskStateDone: '' as IntlString, - TaskNumber: '' as IntlString, - Todo: '' as IntlString, - TaskDone: '' as IntlString, - TaskDueTo: '' as IntlString, - TaskParent: '' as IntlString, - IssueName: '' as IntlString, - TaskComments: '' as IntlString, - TaskLabels: '' as IntlString, - StateTemplateTitle: '' as IntlString, - StateTemplateColor: '' as IntlString, - KanbanTemplateTitle: '' as IntlString, - Rank: '' as IntlString, - EditStates: '' as IntlString, - MarkAsDone: '' as IntlString, - MarkAsUndone: '' as IntlString, - Kanban: '' as IntlString, - ApplicationLabelTask: '' as IntlString, - Projects: '' as IntlString, - SearchTask: '' as IntlString, - ManageProjectStatues: '' as IntlString - }, space: { TasksPublic: '' as Ref }, diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index b9e9fa0546..b5ebf73725 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -451,6 +451,7 @@ input.search { .w-9 { width: 2.25rem; } .w-14 { width: 3.5rem; } .w-16 { width: 4rem; } +.w-22 { width: 5.5rem; } .w-24 { width: 6rem; } .w-60 { width: 15rem; } .w-85 { width: 21.25rem; } diff --git a/packages/ui/lang/en.json b/packages/ui/lang/en.json index f918675cd1..6e8b1b3250 100644 --- a/packages/ui/lang/en.json +++ b/packages/ui/lang/en.json @@ -7,7 +7,7 @@ "Minutes": "{minutes, plural, =0 {less than a minute ago} =1 {a minute ago} other {# minutes ago}}", "Hours": "{hours, plural, =0 {less than an hour ago} =1 {an hour ago} other {# hours ago}}", "Days": "{days, plural, =0 {today} =1 {yesterday} other {# days ago}}", - "Months": "{months, plural, =0 {this month} =1 {a month aago} other {# months ago}}", + "Months": "{months, plural, =0 {this month} =1 {a month ago} other {# months ago}}", "Years": "{years, plural, =0 {this year} =1 {a year ago} other {# years ago}}", "ShowMore": "Show more", "ShowLess": "Show less", diff --git a/plugins/board-assets/lang/en.json b/plugins/board-assets/lang/en.json index cc13fb0ae9..9d47fb8199 100644 --- a/plugins/board-assets/lang/en.json +++ b/plugins/board-assets/lang/en.json @@ -1,5 +1,6 @@ { "string": { + "Completed": "Completed", "Name": "Name", "CreateBoard": "Create board", "OpenCard": "Open Card", @@ -28,17 +29,14 @@ "IsArchived": "Archived", "BoardCreateLabel": "Board", "Settings": "Settings", - "InList": "in list", "Suggested": "Suggested", - "AddToCard": "Add to card", "Labels": "Labels", "CreateLabel": "Create a new label", "SearchLabels": "Search labels...", "SelectColor": "Select a color", "NoColor": "No color.", "NoColorInfo": "This won't show up on the front of cards.", - "Checklist": "Checklist", - "AddChecklistItem": "Add an item", + "Checklists": "Checklists", "ChecklistDropdownNone": "(none)", "ShowDoneChecklistItems": "Show checked items ({done})", "HideDoneChecklistItems": "Hide checked items", @@ -80,8 +78,6 @@ "List": "List", "Position": "Position", "Current": "{label} (current)", - "StartDate": "Start date", - "DueDate": "Due date", "Save": "Save", "Remove": "Remove", "NullDate": "M/D/YYYY", diff --git a/plugins/board-assets/lang/ru.json b/plugins/board-assets/lang/ru.json index 9e696c9aea..0a18a2f52c 100644 --- a/plugins/board-assets/lang/ru.json +++ b/plugins/board-assets/lang/ru.json @@ -1,5 +1,6 @@ { "string": { + "Completed": "Завершено", "Name": "Название", "CreateBoard": "Создать", "OpenCard": "Открыть", @@ -28,17 +29,14 @@ "IsArchived": "Архивировано", "BoardCreateLabel": "Board", "Settings": "Настройки", - "InList": "в списке", "Suggested": "Предложенное", - "AddToCard": "Добавить", "Labels": "Метки", "CreateLabel": "Создать", "SearchLabels": "Поиск...", "SelectColor": "Выберите цвет", "NoColor": "Без цвета.", "NoColorInfo": "Не будет показываться на доске.", - "Checklist": "Списки", - "AddChecklistItem": "Добавить", + "Checklists": "Списки", "ChecklistDropdownNone": "(не выбрано)", "ShowDoneChecklistItems": "Показать отмеченные ({done})", "HideDoneChecklistItems": "Скрыть отмеченные", @@ -80,8 +78,6 @@ "List": "Список", "Position": "Позиция", "Current": "{label} (текущий)", - "StartDate": "Начало", - "DueDate": "Срок", "Save": "Сохранить", "Remove": "Удалить", "NullDate": "М/Д/ГГГГ", diff --git a/plugins/board-resources/src/components/CreateCard.svelte b/plugins/board-resources/src/components/CreateCard.svelte index d00c3c2b6b..9c95e618fb 100644 --- a/plugins/board-resources/src/components/CreateCard.svelte +++ b/plugins/board-resources/src/components/CreateCard.svelte @@ -66,7 +66,9 @@ description: '', members: [], labels: [], - location: '' + location: '', + startDate: null, + dueDate: null } await client.addCollection(board.class.Card, _space, space, board.class.Board, 'cards', value, cardId) diff --git a/plugins/board-resources/src/components/EditCard.svelte b/plugins/board-resources/src/components/EditCard.svelte index 107e90797d..3d1baa7f0f 100644 --- a/plugins/board-resources/src/components/EditCard.svelte +++ b/plugins/board-resources/src/components/EditCard.svelte @@ -14,23 +14,24 @@ // limitations under the License. --> @@ -178,9 +175,9 @@
- {#if object.date && hasDate(object)} + {#if hasDate(object)}
- +
{/if} {#if object.description} diff --git a/plugins/board-resources/src/components/TableView.svelte b/plugins/board-resources/src/components/TableView.svelte index 045101c609..67f36533e8 100644 --- a/plugins/board-resources/src/components/TableView.svelte +++ b/plugins/board-resources/src/components/TableView.svelte @@ -24,7 +24,8 @@ 'title', '$lookup.state', { key: '', presenter: board.component.CardLabels, label: board.string.Labels }, - 'date', + 'startDate', + 'dueDate', { key: 'members', presenter: board.component.UserBoxList, label: board.string.Members, sortingKey: '' }, 'modifiedOn' ]} diff --git a/plugins/board-resources/src/components/UserBoxList.svelte b/plugins/board-resources/src/components/UserBoxList.svelte index ba11bccd81..05db87207f 100644 --- a/plugins/board-resources/src/components/UserBoxList.svelte +++ b/plugins/board-resources/src/components/UserBoxList.svelte @@ -8,4 +8,4 @@ export let value: Ref[] - + diff --git a/plugins/board-resources/src/components/add-card/AddCard.svelte b/plugins/board-resources/src/components/add-card/AddCard.svelte index 18f1b351ee..0f7cc32ec6 100644 --- a/plugins/board-resources/src/components/add-card/AddCard.svelte +++ b/plugins/board-resources/src/components/add-card/AddCard.svelte @@ -53,7 +53,9 @@ description: '', members: [], labels: [], - location: '' + location: '', + startDate: null, + dueDate: null } return client.addCollection(board.class.Card, space, space, board.class.Board, 'cards', value, newCardId) diff --git a/plugins/board-resources/src/components/editor/CardActions.svelte b/plugins/board-resources/src/components/editor/CardActions.svelte index 15753c8055..7731b5194f 100644 --- a/plugins/board-resources/src/components/editor/CardActions.svelte +++ b/plugins/board-resources/src/components/editor/CardActions.svelte @@ -15,78 +15,101 @@ --> {#if value} -
-
-
{/if} diff --git a/plugins/board-resources/src/components/editor/CardAttachments.svelte b/plugins/board-resources/src/components/editor/CardAttachments.svelte deleted file mode 100644 index f4e7d51f76..0000000000 --- a/plugins/board-resources/src/components/editor/CardAttachments.svelte +++ /dev/null @@ -1,63 +0,0 @@ - - - -{#if value !== undefined && value.attachments !== undefined && value.attachments > 0} -
-
-
- -
-
-
-
-
-
-
- {#each attachments as attach} - - {/each} -
-
-
-
-
-{/if} diff --git a/plugins/board-resources/src/components/editor/CardChecklist.svelte b/plugins/board-resources/src/components/editor/CardChecklist.svelte index 541371f621..a4d5fe93af 100644 --- a/plugins/board-resources/src/components/editor/CardChecklist.svelte +++ b/plugins/board-resources/src/components/editor/CardChecklist.svelte @@ -21,7 +21,8 @@ Button, CheckBox, TextAreaEditor, - Icon, + IconAdd, + IconDelete, IconMoreH, Progress, showPopup, @@ -131,9 +132,6 @@ {#if value !== undefined}
-
- -
{#if isEditingName}
{#if done > 0} -
-
+
@@ -254,8 +251,6 @@ }} />
- {:else} -
diff --git a/plugins/board-resources/src/components/editor/CardDetails.svelte b/plugins/board-resources/src/components/editor/CardDetails.svelte deleted file mode 100644 index b2ad9ee1bf..0000000000 --- a/plugins/board-resources/src/components/editor/CardDetails.svelte +++ /dev/null @@ -1,122 +0,0 @@ - - - -{#if value} - {#if members && members.length > 0} -
-
-
-
- {#each members as member} - - {/each} -
-
- {/if} - {#if value.labels && value.labels.length > 0} -
-
-
- -
- {/if} - {#if value.date && hasDate(value)} -
-
-
- {#key value.date} - - {/key} -
- {/if} -{/if} diff --git a/plugins/board-resources/src/components/editor/CardLabels.svelte b/plugins/board-resources/src/components/editor/CardLabels.svelte index 4b1edb8bc2..a8aa946a69 100644 --- a/plugins/board-resources/src/components/editor/CardLabels.svelte +++ b/plugins/board-resources/src/components/editor/CardLabels.svelte @@ -68,7 +68,7 @@ } -{#if labels && labels.length > 0} +{#if labels}
-
diff --git a/plugins/board-resources/src/components/popups/CopyCard.svelte b/plugins/board-resources/src/components/popups/CopyCard.svelte index 0a9142f39f..36b25bf97b 100644 --- a/plugins/board-resources/src/components/popups/CopyCard.svelte +++ b/plugins/board-resources/src/components/popups/CopyCard.svelte @@ -52,7 +52,9 @@ description: '', members: [], location: '', - labels: labels ?? [] + labels: labels ?? [], + startDate: value.startDate, + dueDate: value.dueDate } await client.addCollection( diff --git a/plugins/board-resources/src/components/popups/DateRangePicker.svelte b/plugins/board-resources/src/components/popups/DateRangePicker.svelte index 5dbbb4c4fd..2d6d52a974 100644 --- a/plugins/board-resources/src/components/popups/DateRangePicker.svelte +++ b/plugins/board-resources/src/components/popups/DateRangePicker.svelte @@ -1,35 +1,37 @@
@@ -39,35 +41,19 @@
-
-
-
- { - startDate = startDateEnabled ? savedStartDate : undefined - }} - /> +
+
- +
-
-
-
- { - dueDate = dueDateEnabled ? savedDueDate : undefined - }} - /> +
+
- +
-
diff --git a/plugins/board-resources/src/components/popups/EditMember.svelte b/plugins/board-resources/src/components/popups/EditMember.svelte deleted file mode 100644 index 901cab73f6..0000000000 --- a/plugins/board-resources/src/components/popups/EditMember.svelte +++ /dev/null @@ -1,46 +0,0 @@ - - -
-
- -
-
- -
- {#if menuItems && menuItems.length > 0} - {#each menuItems as menuSubgroup, i} - {#each menuSubgroup as menuItem} - - {/each} - {#if i + 1 < menuItems.length} -
- {/if} - {/each} - {/if} -
- - diff --git a/plugins/board-resources/src/components/popups/RemoveAttachment.svelte b/plugins/board-resources/src/components/popups/RemoveAttachment.svelte deleted file mode 100644 index e4a4577193..0000000000 --- a/plugins/board-resources/src/components/popups/RemoveAttachment.svelte +++ /dev/null @@ -1,46 +0,0 @@ - - -
-
-
-
-
-
- { - dispatch('close') - }} - /> -
-
-
-
-
- -
diff --git a/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte b/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte deleted file mode 100644 index 2b1f8678cc..0000000000 --- a/plugins/board-resources/src/components/presenters/AttachmentPresenter.svelte +++ /dev/null @@ -1,109 +0,0 @@ - - - -
- {#if openEmbedded(value.type)} -
- {#if showPreview(value.type)} - {value.name} - {:else} - {iconLabel(value.name)} - {/if} -
- {:else} - -
- {iconLabel(value.name)} -
-
- {/if} -
-
{trimFilename(value.name)}
-
- -
-
-
- - diff --git a/plugins/board-resources/src/components/presenters/DatePresenter.svelte b/plugins/board-resources/src/components/presenters/DatePresenter.svelte index 8fb5833f94..afc05c99bd 100644 --- a/plugins/board-resources/src/components/presenters/DatePresenter.svelte +++ b/plugins/board-resources/src/components/presenters/DatePresenter.svelte @@ -1,26 +1,15 @@ {#if value}
- {#if value.dueDate} - - {/if}
{#if value.startDate} diff --git a/plugins/board-resources/src/components/presenters/MemberPresenter.svelte b/plugins/board-resources/src/components/presenters/MemberPresenter.svelte deleted file mode 100644 index 97e32b89b9..0000000000 --- a/plugins/board-resources/src/components/presenters/MemberPresenter.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - -{#if value} - -{/if} diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts index cc7564f71e..7dadd1bea4 100644 --- a/plugins/board-resources/src/index.ts +++ b/plugins/board-resources/src/index.ts @@ -16,7 +16,6 @@ import { Resources } from '@anticrm/platform' import { TodoItem } from '@anticrm/task' import { getClient } from '@anticrm/presentation' -import board from '@anticrm/board' import BoardPresenter from './components/BoardPresenter.svelte' import CardPresenter from './components/CardPresenter.svelte' @@ -29,7 +28,6 @@ import CardLabelsPopup from './components/popups/CardLabelsPopup.svelte' import MoveCard from './components/popups/MoveCard.svelte' import CopyCard from './components/popups/CopyCard.svelte' import DateRangePicker from './components/popups/DateRangePicker.svelte' -import CardDatePresenter from './components/presenters/DatePresenter.svelte' import CardLabelPresenter from './components/presenters/LabelPresenter.svelte' import TemplatesIcon from './components/TemplatesIcon.svelte' import BoardHeader from './components/BoardHeader.svelte' @@ -46,15 +44,12 @@ async function ConvertToCard (object: TodoItem): Promise { const client = getClient() const todoItemCard = await getCardFromTodoItem(client, object) if (todoItemCard === undefined) return - const date = - object.dueTo === null - ? {} - : { date: { _class: board.class.CardDate, dueDate: object.dueTo, isChecked: object.done } } await createCard(client, todoItemCard.space, todoItemCard.state, { title: object.name, assignee: object.assignee, - ...date + dueDate: object.dueTo }) + await client.remove(object) } @@ -65,7 +60,6 @@ export default async (): Promise => ({ EditCard, KanbanCard, CardPresenter, - CardDatePresenter, CardLabelPresenter, TemplatesIcon, KanbanView, diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts index bdce511ded..0d4b9fc029 100644 --- a/plugins/board-resources/src/plugin.ts +++ b/plugins/board-resources/src/plugin.ts @@ -19,6 +19,7 @@ import type { AnyComponent } from '@anticrm/ui' export default mergeIds(boardId, board, { string: { + Completed: '' as IntlString, Name: '' as IntlString, BoardName: '' as IntlString, MakePrivate: '' as IntlString, @@ -49,17 +50,14 @@ export default mergeIds(boardId, board, { IsArchived: '' as IntlString, BoardCreateLabel: '' as IntlString, Settings: '' as IntlString, - InList: '' as IntlString, Suggested: '' as IntlString, - AddToCard: '' as IntlString, Labels: '' as IntlString, CreateLabel: '' as IntlString, SearchLabels: '' as IntlString, SelectColor: '' as IntlString, NoColor: '' as IntlString, NoColorInfo: '' as IntlString, - Checklist: '' as IntlString, - AddChecklistItem: '' as IntlString, + Checklists: '' as IntlString, ChecklistDropdownNone: '' as IntlString, ShowDoneChecklistItems: '' as IntlString, HideDoneChecklistItems: '' as IntlString, @@ -101,8 +99,6 @@ export default mergeIds(boardId, board, { List: '' as IntlString, Position: '' as IntlString, Current: '' as IntlString, - StartDate: '' as IntlString, - DueDate: '' as IntlString, Save: '' as IntlString, Remove: '' as IntlString, NullDate: '' as IntlString, diff --git a/plugins/board-resources/src/utils/CardUtils.ts b/plugins/board-resources/src/utils/CardUtils.ts index 80f546a570..02d5a54182 100644 --- a/plugins/board-resources/src/utils/CardUtils.ts +++ b/plugins/board-resources/src/utils/CardUtils.ts @@ -31,6 +31,8 @@ export async function createCard ( title: '', state, doneState: null, + startDate: null, + dueDate: null, number: (incResult as any).object.sequence, rank: calcRank(lastOne, undefined), assignee: null, @@ -95,7 +97,7 @@ export function hasCover (card: Card): boolean { } export function hasDate (card: Card): boolean { - return card.date !== undefined && (card.date.dueDate !== undefined || card.date.startDate !== undefined) + return card.dueDate !== undefined || card.startDate !== undefined } export function addCurrentUser (card: Card, client: Client): Promise | undefined { diff --git a/plugins/board/src/index.ts b/plugins/board/src/index.ts index d250277946..a5e6b97a65 100644 --- a/plugins/board/src/index.ts +++ b/plugins/board/src/index.ts @@ -15,11 +15,11 @@ // import { Employee } from '@anticrm/contact' -import type { AttachedDoc, Class, Doc, Markup, Ref, Timestamp, Obj } from '@anticrm/core' +import type { AttachedDoc, Class, Doc, Markup, Ref } from '@anticrm/core' import type { Asset, IntlString, Plugin } from '@anticrm/platform' import { plugin } from '@anticrm/platform' import type { Preference } from '@anticrm/preference' -import type { KanbanTemplateSpace, SpaceWithStates, Task } from '@anticrm/task' +import type { DoneState, KanbanTemplateSpace, SpaceWithStates, Task } from '@anticrm/task' import type { AnyComponent } from '@anticrm/ui' import { Action, ActionCategory } from '@anticrm/view' @@ -49,15 +49,6 @@ export interface CardLabel extends AttachedDoc { isHidden?: boolean } -/** - * @public - */ -export interface CardDate extends Obj { - dueDate?: Timestamp - isChecked?: boolean - startDate?: Timestamp -} - /** * @public */ @@ -72,8 +63,6 @@ export interface CardCover { */ export interface Card extends Task { title: string - - date?: CardDate description: Markup isArchived?: boolean @@ -120,7 +109,6 @@ const boards = plugin(boardId, { class: { Board: '' as Ref>, Card: '' as Ref>, - CardDate: '' as Ref>, CardLabel: '' as Ref>, MenuPage: '' as Ref>, CommonBoardPreference: '' as Ref> @@ -128,6 +116,9 @@ const boards = plugin(boardId, { category: { Card: '' as Ref }, + state: { + Completed: '' as Ref + }, action: { Cover: '' as Ref, Dates: '' as Ref, diff --git a/plugins/lead-resources/src/components/CreateLead.svelte b/plugins/lead-resources/src/components/CreateLead.svelte index 658cc92366..7028c1a7dc 100644 --- a/plugins/lead-resources/src/components/CreateLead.svelte +++ b/plugins/lead-resources/src/components/CreateLead.svelte @@ -64,7 +64,9 @@ number: (incResult as any).object.sequence, title: title, rank: calcRank(lastOne, undefined), - assignee: null + assignee: null, + startDate: null, + dueDate: null } const customerInstance = await client.findOne(contact.class.Contact, { _id: customer! }) diff --git a/plugins/recruit-resources/src/components/CreateApplication.svelte b/plugins/recruit-resources/src/components/CreateApplication.svelte index 2d2f3d170d..a6625a06d5 100644 --- a/plugins/recruit-resources/src/components/CreateApplication.svelte +++ b/plugins/recruit-resources/src/components/CreateApplication.svelte @@ -56,7 +56,9 @@ _id: generateId(), collection: 'applications', modifiedOn: Date.now(), - modifiedBy: '' as Ref + modifiedBy: '' as Ref, + startDate: null, + dueDate: null } const dispatch = createEventDispatcher() @@ -109,7 +111,9 @@ doneState: null, number: (incResult as any).object.sequence, assignee: doc.assignee, - rank: calcRank(lastOne, undefined) + rank: calcRank(lastOne, undefined), + startDate: null, + dueDate: null } ) @@ -128,7 +132,9 @@ _id: generateId(), collection: 'applications', modifiedOn: Date.now(), - modifiedBy: '' as Ref + modifiedBy: '' as Ref, + startDate: null, + dueDate: null } } } diff --git a/plugins/task-assets/lang/en.json b/plugins/task-assets/lang/en.json index 8ee0962b49..60aefbea55 100644 --- a/plugins/task-assets/lang/en.json +++ b/plugins/task-assets/lang/en.json @@ -1,5 +1,7 @@ { "string": { + "StartDate": "Start date", + "DueDate": "Due date", "TaskState": "State", "TaskStateTitle": "Title", "TaskStateDone": "Done", diff --git a/plugins/task-assets/lang/ru.json b/plugins/task-assets/lang/ru.json index f15a88c45f..ee95a21f4c 100644 --- a/plugins/task-assets/lang/ru.json +++ b/plugins/task-assets/lang/ru.json @@ -1,5 +1,7 @@ { "string": { + "StartDate": "Начало", + "DueDate": "Срок", "TaskState": "Статус", "TaskStateTitle": "Заголовок", "TaskStateDone": "Завершен", diff --git a/plugins/task/src/index.ts b/plugins/task/src/index.ts index 688144093c..6469b1ee34 100644 --- a/plugins/task/src/index.ts +++ b/plugins/task/src/index.ts @@ -81,7 +81,8 @@ export interface Task extends AttachedDoc, DocWithRank { doneState: Ref | null number: number assignee: Ref | null - + dueDate: Timestamp | null + startDate: Timestamp | null todoItems?: number } @@ -196,6 +197,34 @@ const task = plugin(taskId, { interface: { DocWithRank: '' as Ref> }, + string: { + StartDate: '' as IntlString, + DueDate: '' as IntlString, + TaskState: '' as IntlString, + TaskStateTitle: '' as IntlString, + TaskStateDone: '' as IntlString, + TaskNumber: '' as IntlString, + Todo: '' as IntlString, + TaskDone: '' as IntlString, + TaskDueTo: '' as IntlString, + TaskParent: '' as IntlString, + IssueName: '' as IntlString, + TaskComments: '' as IntlString, + TaskLabels: '' as IntlString, + StateTemplateTitle: '' as IntlString, + StateTemplateColor: '' as IntlString, + KanbanTemplateTitle: '' as IntlString, + Rank: '' as IntlString, + EditStates: '' as IntlString, + MarkAsDone: '' as IntlString, + MarkAsUndone: '' as IntlString, + Kanban: '' as IntlString, + ApplicationLabelTask: '' as IntlString, + Projects: '' as IntlString, + SearchTask: '' as IntlString, + ManageProjectStatues: '' as IntlString, + TodoItems: '' as IntlString + }, class: { Issue: '' as Ref>, Project: '' as Ref>, @@ -239,9 +268,6 @@ const task = plugin(taskId, { KanbanTemplateEditor: '' as AnyComponent, KanbanTemplateSelector: '' as AnyComponent, TodoItemsPopup: '' as AnyComponent - }, - string: { - TodoItems: '' as IntlString } })