diff --git a/models/hr/src/index.ts b/models/hr/src/index.ts index 43ca82faf0..901bba2bf6 100644 --- a/models/hr/src/index.ts +++ b/models/hr/src/index.ts @@ -93,7 +93,7 @@ export class TDepartment extends TSpace implements Department { export class TDepartmentMember extends TEmployeeAccount implements DepartmentMember {} @Mixin(hr.mixin.Staff, contact.class.Employee) -@UX(hr.string.Staff, hr.icon.HR) +@UX(hr.string.Staff, hr.icon.HR, 'STFF', 'name') export class TStaff extends TEmployee implements Staff { @Prop(TypeRef(hr.class.Department), hr.string.Department) department!: Ref diff --git a/plugins/hr-assets/lang/en.json b/plugins/hr-assets/lang/en.json index 36801afbe1..3e29eed449 100644 --- a/plugins/hr-assets/lang/en.json +++ b/plugins/hr-assets/lang/en.json @@ -47,6 +47,9 @@ "Description": "Description", "MarkAsPublicHoliday": "Mark as public holiday", "EditPublicHoliday": "Edit public holiday", - "Managers": "Managers" + "Managers": "Managers", + "Export": "Export", + "Separator": "Separator", + "ChooseSeparator": "Choose separator" } } diff --git a/plugins/hr-assets/lang/ru.json b/plugins/hr-assets/lang/ru.json index 8e20704141..b51b17aa75 100644 --- a/plugins/hr-assets/lang/ru.json +++ b/plugins/hr-assets/lang/ru.json @@ -47,6 +47,9 @@ "PublicHoliday": "Праздничный день", "MarkAsPublicHoliday": "Отметить как праздничный день", "EditPublicHoliday": "Редактировать праздничный день", - "Managers": "Менеджера" + "Managers": "Менеджера", + "Export": "Экспортировать", + "Separator": "Разделитель", + "ChooseSeparator": "Выберите разделитель" } } diff --git a/plugins/hr-resources/src/components/schedule/ExportPopup.svelte b/plugins/hr-resources/src/components/schedule/ExportPopup.svelte new file mode 100644 index 0000000000..64073257fb --- /dev/null +++ b/plugins/hr-resources/src/components/schedule/ExportPopup.svelte @@ -0,0 +1,38 @@ + + + + dispatch('close', selectedSeparator)} + canSave + on:close +> +
+
+
diff --git a/plugins/hr-resources/src/components/schedule/MonthTableView.svelte b/plugins/hr-resources/src/components/schedule/MonthTableView.svelte index 8c9be531c9..525b571a89 100644 --- a/plugins/hr-resources/src/components/schedule/MonthTableView.svelte +++ b/plugins/hr-resources/src/components/schedule/MonthTableView.svelte @@ -18,7 +18,7 @@ import type { Request, RequestType, Staff } from '@hcengineering/hr' import { getEmbeddedLabel } from '@hcengineering/platform' import { createQuery, getClient } from '@hcengineering/presentation' - import { Button, Label, Loading, Scroller, tableSP, tableToCSV } from '@hcengineering/ui' + import { Button, Label, Loading, Scroller, showPopup, tableSP, tableToCSV } from '@hcengineering/ui' import view, { BuildModelKey, Viewlet, ViewletPreference } from '@hcengineering/view' import { getViewOptions, @@ -42,6 +42,7 @@ import StatPresenter from './StatPresenter.svelte' import ReportPresenter from './ReportPresenter.svelte' import HolidayPresenter from './HolidayPresenter.svelte' + import ExportPopup from './ExportPopup.svelte' import { Department } from '@hcengineering/hr' export let currentDate: Date = new Date() @@ -355,7 +356,44 @@ } return result } - + function exportTable (evt: Event) { + const items = [ + { + id: '0', + label: getEmbeddedLabel(', (csv)'), + separator: ',' + }, + { + id: '1', + label: getEmbeddedLabel('; (MS Excel)'), + separator: ';' + } + ] + showPopup( + ExportPopup, + { + items + }, + evt.target as HTMLElement, + (res) => { + if (res !== undefined) { + const filename = 'exportStaff' + new Date().toLocaleDateString() + '.csv' + const link = document.createElement('a') + link.style.display = 'none' + link.setAttribute('target', '_blank') + link.setAttribute( + 'href', + 'data:text/csv;charset=utf-8,%EF%BB%BF' + + encodeURIComponent(tableToCSV('exportableData', items[res].separator)) + ) + link.setAttribute('download', filename) + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } + } + ) + } $: viewOptions = getViewOptions(descr, $viewOptionStore) @@ -370,25 +408,7 @@
-