diff --git a/packages/ui/lang/en.json b/packages/ui/lang/en.json
index bcdcbf56667..b7d853ffa12 100644
--- a/packages/ui/lang/en.json
+++ b/packages/ui/lang/en.json
@@ -39,6 +39,7 @@
"NoActionsDefined": "No actions applicable",
"Incoming": "Incoming",
"HoursLabel": "Hours",
- "Back": "Back"
+ "Back": "Back",
+ "DropdownDefaultLabel": "Select Item"
}
}
diff --git a/packages/ui/lang/ru.json b/packages/ui/lang/ru.json
index 064351c5b64..0309f5a695f 100644
--- a/packages/ui/lang/ru.json
+++ b/packages/ui/lang/ru.json
@@ -39,6 +39,7 @@
"NoActionsDefined": "Нет доступных действий",
"Incoming": "Входящие",
"HoursLabel": "Часы",
- "Back": "Назад"
+ "Back": "Назад",
+ "DropdownDefaultLabel": "Выберите Элемент"
}
}
diff --git a/packages/ui/src/components/DropdownLabelsIntl.svelte b/packages/ui/src/components/DropdownLabelsIntl.svelte
index 11eba54e5ec..9675aff9aa3 100644
--- a/packages/ui/src/components/DropdownLabelsIntl.svelte
+++ b/packages/ui/src/components/DropdownLabelsIntl.svelte
@@ -22,9 +22,10 @@
import Button from './Button.svelte'
import DropdownLabelsPopupIntl from './DropdownLabelsPopupIntl.svelte'
import Label from './Label.svelte'
+ import ui from '../plugin'
export let icon: Asset | AnySvelteComponent | undefined = undefined
- export let label: IntlString
+ export let label: IntlString = ui.string.DropdownDefaultLabel
export let items: DropdownIntlItem[]
export let selected: DropdownIntlItem['id'] | undefined = undefined
export let disabled: boolean = false
@@ -33,12 +34,13 @@
export let justify: 'left' | 'center' = 'center'
export let width: string | undefined = undefined
export let labelDirection: TooltipAlignment | undefined = undefined
+ export let shouldUpdateUndefined: boolean = true
let container: HTMLElement
let opened: boolean = false
$: selectedItem = items.find((x) => x.id === selected)
- $: if (selected === undefined && items[0] !== undefined) {
+ $: if (shouldUpdateUndefined && selected === undefined && items[0] !== undefined) {
selected = items[0].id
dispatch('selected', selected)
}
diff --git a/packages/ui/src/components/EditBox.svelte b/packages/ui/src/components/EditBox.svelte
index 87153efa25d..7f5d4ae4289 100644
--- a/packages/ui/src/components/EditBox.svelte
+++ b/packages/ui/src/components/EditBox.svelte
@@ -117,7 +117,8 @@
{
input.focus()
}}
diff --git a/packages/ui/src/plugin.ts b/packages/ui/src/plugin.ts
index 0a749dc8f18..5edf3046c81 100644
--- a/packages/ui/src/plugin.ts
+++ b/packages/ui/src/plugin.ts
@@ -64,7 +64,8 @@ export const uis = plugin(uiId, {
NoActionsDefined: '' as IntlString,
Incoming: '' as IntlString,
HoursLabel: '' as IntlString,
- Back: '' as IntlString
+ Back: '' as IntlString,
+ DropdownDefaultLabel: '' as IntlString
},
metadata: {
DefaultApplication: '' as Metadata
,
diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json
index f71b99238eb..67bc774f7d1 100644
--- a/plugins/tracker-assets/lang/en.json
+++ b/plugins/tracker-assets/lang/en.json
@@ -245,7 +245,11 @@
"SaveProcess": "Save Process",
"NoIssueTemplate": "No Process",
"TemplateReplace": "You you replace applied process?",
- "TemplateReplaceConfirm": "All changes to template values will be lost."
+ "TemplateReplaceConfirm": "All changes to template values will be lost.",
+
+ "WorkDayCurrent": "Current Working Day",
+ "WorkDayPrevious": "Previous Working Day",
+ "WorkDayLabel": "Select Working Day Type"
},
"status": {}
}
diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json
index c7e4022be5c..069f622145c 100644
--- a/plugins/tracker-assets/lang/ru.json
+++ b/plugins/tracker-assets/lang/ru.json
@@ -245,7 +245,11 @@
"SaveProcess": "Сохранить процесс",
"NoIssueTemplate": "Без процесса",
"TemplateReplace": "Вы хотите заменить выбранный процесс?",
- "TemplateReplaceConfirm": "Все внесенные изменения в задачу будут потеряны"
+ "TemplateReplaceConfirm": "Все внесенные изменения в задачу будут потеряны",
+
+ "WorkDayCurrent": "Текущий Рабочий День",
+ "WorkDayPrevious": "Предыдущий Рабочий День",
+ "WorkDayLabel": "Выберите Тип Рабочего Дня"
},
"status": {}
}
diff --git a/plugins/tracker-resources/src/components/issues/timereport/TimeSpendReportPopup.svelte b/plugins/tracker-resources/src/components/issues/timereport/TimeSpendReportPopup.svelte
index 4f1ab3f7133..b9ee0e8e93f 100644
--- a/plugins/tracker-resources/src/components/issues/timereport/TimeSpendReportPopup.svelte
+++ b/plugins/tracker-resources/src/components/issues/timereport/TimeSpendReportPopup.svelte
@@ -20,6 +20,8 @@
import { Issue, TimeSpendReport } from '@hcengineering/tracker'
import { DatePresenter, EditBox } from '@hcengineering/ui'
import tracker from '../../../plugin'
+ import { getWorkDate, WorkDaysType } from '../../../utils'
+ import WorkDaysDropdown from './WorkDaysDropdown.svelte'
export let issueId: Ref
export let issueClass: Ref>
@@ -34,7 +36,7 @@
}
const data = {
- date: value?.date ?? Date.now(),
+ date: value?.date ?? getWorkDate(WorkDaysType.PREVIOUS),
description: value?.description ?? '',
value: value?.value,
employee: value?.employee ?? assignee ?? null
@@ -86,6 +88,7 @@
bind:value={data.employee}
showNavigate={false}
/>
+
diff --git a/plugins/tracker-resources/src/components/issues/timereport/WorkDaysDropdown.svelte b/plugins/tracker-resources/src/components/issues/timereport/WorkDaysDropdown.svelte
new file mode 100644
index 00000000000..1a9bb8a0415
--- /dev/null
+++ b/plugins/tracker-resources/src/components/issues/timereport/WorkDaysDropdown.svelte
@@ -0,0 +1,46 @@
+
+
+
+ (dateTimestamp = getWorkDate(detail))}
+/>
diff --git a/plugins/tracker-resources/src/components/issues/timereport/WorkDaysIcon.svelte b/plugins/tracker-resources/src/components/issues/timereport/WorkDaysIcon.svelte
new file mode 100644
index 00000000000..41de5e046d9
--- /dev/null
+++ b/plugins/tracker-resources/src/components/issues/timereport/WorkDaysIcon.svelte
@@ -0,0 +1,19 @@
+
+
+
diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts
index 9bd1dfbcf9e..3b7eb790f0c 100644
--- a/plugins/tracker-resources/src/plugin.ts
+++ b/plugins/tracker-resources/src/plugin.ts
@@ -261,7 +261,11 @@ export default mergeIds(trackerId, tracker, {
SaveProcess: '' as IntlString,
NoIssueTemplate: '' as IntlString,
TemplateReplace: '' as IntlString,
- TemplateReplaceConfirm: '' as IntlString
+ TemplateReplaceConfirm: '' as IntlString,
+
+ WorkDayCurrent: '' as IntlString,
+ WorkDayPrevious: '' as IntlString,
+ WorkDayLabel: '' as IntlString
},
component: {
NopeComponent: '' as AnyComponent,
diff --git a/plugins/tracker-resources/src/types.ts b/plugins/tracker-resources/src/types.ts
index 32bbc72aaae..5f599a9dbf6 100644
--- a/plugins/tracker-resources/src/types.ts
+++ b/plugins/tracker-resources/src/types.ts
@@ -104,3 +104,8 @@ export const issuesGroupBySorting: Record> =
[IssuesGrouping.Sprint]: { '$lookup.sprint.label': SortingOrder.Ascending },
[IssuesGrouping.NoGrouping]: {}
}
+
+export enum WorkDaysType {
+ CURRENT = 'current',
+ PREVIOUS = 'previous'
+}
diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts
index cda914b0cec..35d62efe96e 100644
--- a/plugins/tracker-resources/src/utils.ts
+++ b/plugins/tracker-resources/src/utils.ts
@@ -33,12 +33,19 @@ import { ViewOptionModel } from '@hcengineering/view-resources'
import {
AnyComponent,
AnySvelteComponent,
+ areDatesEqual,
getMillisecondsInMonth,
isWeekend,
MILLISECONDS_IN_WEEK
} from '@hcengineering/ui'
import tracker from './plugin'
-import { defaultPriorities, defaultProjectStatuses, defaultSprintStatuses, issuePriorities } from './types'
+import {
+ defaultPriorities,
+ defaultProjectStatuses,
+ defaultSprintStatuses,
+ issuePriorities,
+ WorkDaysType
+} from './types'
export * from './types'
@@ -641,3 +648,29 @@ export async function moveIssuesToAnotherSprint (
return false
}
}
+
+export function getWorkDate (type: WorkDaysType): number {
+ const date = new Date(Date.now())
+ if (type === WorkDaysType.PREVIOUS) {
+ date.setDate(date.getDate() - 1)
+ }
+
+ // if currentDate is day off then set date to last working day
+ while (isWeekend(date)) {
+ date.setDate(date.getDate() - 1)
+ }
+
+ return date.valueOf()
+}
+
+export function getWorkDayType (timestamp: number): WorkDaysType | undefined {
+ const date = new Date(timestamp)
+ const currentWorkDate = new Date(getWorkDate(WorkDaysType.CURRENT))
+ const previousWorkDate = new Date(getWorkDate(WorkDaysType.PREVIOUS))
+
+ if (areDatesEqual(date, currentWorkDate)) {
+ return WorkDaysType.CURRENT
+ } else if (areDatesEqual(date, previousWorkDate)) {
+ return WorkDaysType.PREVIOUS
+ }
+}