From caa5d9708de00c57e2f3592e3c9d2c335d01d80e Mon Sep 17 00:00:00 2001 From: Alex <41288429+Dvinyanin@users.noreply.github.com> Date: Sat, 16 Apr 2022 10:02:59 +0700 Subject: [PATCH] Add Date action (#1418) Signed-off-by: Dvinyanin Alexandr --- plugins/board-assets/lang/en.json | 8 +- plugins/board-assets/lang/ru.json | 8 +- plugins/board-resources/package.json | 1 + .../src/components/editor/CardDetails.svelte | 2 +- .../components/popups/DateRangePicker.svelte | 81 +++++++++++++++++++ .../presenters/DatePresenter.svelte | 29 +++---- plugins/board-resources/src/index.ts | 9 ++- plugins/board-resources/src/plugin.ts | 8 +- 8 files changed, 127 insertions(+), 19 deletions(-) create mode 100644 plugins/board-resources/src/components/popups/DateRangePicker.svelte diff --git a/plugins/board-assets/lang/en.json b/plugins/board-assets/lang/en.json index 75e01c6ec3..c4de339f2d 100644 --- a/plugins/board-assets/lang/en.json +++ b/plugins/board-assets/lang/en.json @@ -59,6 +59,12 @@ "Create": "Create", "CreateDescription": "If you want, we can create a card for every new line ({number}). You can also create one card with a long title.", "CreateSingle": "Just one card", - "CreateMultiple": "Create {number} cards" + "CreateMultiple": "Create {number} cards", + "StartDate": "Start date", + "DueDate": "Due date", + "Save": "Save", + "Remove": "Remove", + "Cancel": "Cancel", + "NullDate": "M/D/YYYY" } } \ No newline at end of file diff --git a/plugins/board-assets/lang/ru.json b/plugins/board-assets/lang/ru.json index 3fd205ab48..c9e2afe69b 100644 --- a/plugins/board-assets/lang/ru.json +++ b/plugins/board-assets/lang/ru.json @@ -59,6 +59,12 @@ "Create": "Создать", "CreateDescription": "Можно создать отдельные карточки для каждой строки ({number}) или одну с длинным названием.", "CreateSingle": "Создать одну", - "CreateMultiple": "Создать несколько ({number})" + "CreateMultiple": "Создать несколько ({number})", + "StartDate": "Начало", + "DueDate": "Срок", + "Save": "Сохранить", + "Remove": "Удалить", + "Cancel": "Закрыть", + "NullDate": "М/Д/ГГГГ" } } \ No newline at end of file diff --git a/plugins/board-resources/package.json b/plugins/board-resources/package.json index 065f81761a..b458984422 100644 --- a/plugins/board-resources/package.json +++ b/plugins/board-resources/package.json @@ -34,6 +34,7 @@ "@anticrm/attachment": "~0.6.1", "@anticrm/attachment-resources": "~0.6.0", "@anticrm/board": "~0.6.0", + "@anticrm/calendar": "~0.6.0", "@anticrm/chunter": "~0.6.1", "@anticrm/chunter-resources": "~0.6.0", "@anticrm/contact": "~0.6.5", diff --git a/plugins/board-resources/src/components/editor/CardDetails.svelte b/plugins/board-resources/src/components/editor/CardDetails.svelte index 972cfc35ce..d80bf33181 100644 --- a/plugins/board-resources/src/components/editor/CardDetails.svelte +++ b/plugins/board-resources/src/components/editor/CardDetails.svelte @@ -99,7 +99,7 @@
- + {/if} {/if} diff --git a/plugins/board-resources/src/components/popups/DateRangePicker.svelte b/plugins/board-resources/src/components/popups/DateRangePicker.svelte new file mode 100644 index 0000000000..e5bf490f8d --- /dev/null +++ b/plugins/board-resources/src/components/popups/DateRangePicker.svelte @@ -0,0 +1,81 @@ + + +
+
+
+
+
+
+
+
+
+ {startDate = startDateEnabled ? savedStartDate : undefined}}/> +
+
+ +
+
+
+
+
+
+ {dueDate = dueDateEnabled ? savedDueDate : undefined}}/> +
+
+ +
+
+ +
diff --git a/plugins/board-resources/src/components/presenters/DatePresenter.svelte b/plugins/board-resources/src/components/presenters/DatePresenter.svelte index ccabb91d93..40b1141e81 100644 --- a/plugins/board-resources/src/components/presenters/DatePresenter.svelte +++ b/plugins/board-resources/src/components/presenters/DatePresenter.svelte @@ -1,25 +1,26 @@ -{#if value} +{#if date}
- -
+ client.update(value, {date: {...date, isChecked}})}/> +
- {#if value.startDate && value.dueDate} - - - - - {:else if value.startDate} - - {:else if value.dueDate} - + {#if date.startDate} + + {/if} + {#if date.startDate && date.dueDate}-{/if} + {#if date.dueDate} + {/if}
diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts index c88d8931e6..33d0f75133 100644 --- a/plugins/board-resources/src/index.ts +++ b/plugins/board-resources/src/index.ts @@ -15,6 +15,8 @@ // import { Resources } from '@anticrm/platform' +import { showPopup } from '@anticrm/ui' +import { Card } from '@anticrm/board' import CardPresenter from './components/CardPresenter.svelte' import CreateBoard from './components/CreateBoard.svelte' import CreateCard from './components/CreateCard.svelte' @@ -22,8 +24,12 @@ import EditCard from './components/EditCard.svelte' import KanbanCard from './components/KanbanCard.svelte' import TemplatesIcon from './components/TemplatesIcon.svelte' import KanbanView from './components/KanbanView.svelte' +import DateRangePicker from './components/popups/DateRangePicker.svelte' import { addCurrentUser, canAddCurrentUser, isArchived, isUnarchived } from './utils/CardUtils' +async function showDatePickerPopup (object: Card): Promise { + showPopup(DateRangePicker, { object }) +} export default async (): Promise => ({ component: { CreateBoard, @@ -35,7 +41,8 @@ export default async (): Promise => ({ KanbanView }, cardActionHandler: { - Join: addCurrentUser + Join: addCurrentUser, + Dates: showDatePickerPopup }, cardActionSupportedHandler: { Join: canAddCurrentUser, diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts index 5742a886e3..bae20af484 100644 --- a/plugins/board-resources/src/plugin.ts +++ b/plugins/board-resources/src/plugin.ts @@ -80,7 +80,13 @@ export default mergeIds(boardId, board, { Create: '' as IntlString, CreateDescription: '' as IntlString, CreateSingle: '' as IntlString, - CreateMultiple: '' as IntlString + CreateMultiple: '' as IntlString, + StartDate: '' as IntlString, + DueDate: '' as IntlString, + Save: '' as IntlString, + Remove: '' as IntlString, + Cancel: '' as IntlString, + NullDate: '' as IntlString }, component: { CreateCustomer: '' as AnyComponent,