diff --git a/src/app/child-dev-project/notes/note-details/note-details.component.html b/src/app/child-dev-project/notes/note-details/note-details.component.html index 98b376fe44..01b822eb4b 100644 --- a/src/app/child-dev-project/notes/note-details/note-details.component.html +++ b/src/app/child-dev-project/notes/note-details/note-details.component.html @@ -22,6 +22,37 @@

{{ entity.date | date }}: {{ entity.subject }}

+
+ + + + +
+
@@ -125,7 +156,7 @@

{{ entity.date | date }}: {{ entity.subject }}

[(selection)]="entity.children" (selectionChange)="entityForm.form.markAsDirty()" [additionalFilter]="filterInactiveChildren" - [showEntities]="!isMeeting" + [showEntities]="!entity.category?.isMeeting" label="Participants" i18n-label="Participants of a note" placeholder="Add participant ..." @@ -143,7 +174,7 @@

{{ entity.date | date }}: {{ entity.subject }}

-
+
{ readonly INTERACTION_TYPE_CONFIG = INTERACTION_TYPE_CONFIG_ID; includeInactiveChildren: boolean = false; + /** export format for notes to be used for downloading the individual details */ + exportConfig: ExportColumnConfig[]; + + constructor(private configService: ConfigService) { + this.exportConfig = this.configService.getConfig<{ + config: EntityListConfig; + }>("view:note").config.exportConfig; + } + toggleIncludeInactiveChildren() { this.includeInactiveChildren = !this.includeInactiveChildren; // This needs to be set so that the filtering will start immediately @@ -35,8 +47,4 @@ export class NoteDetailsComponent implements ShowsEntity { } filterInactiveChildren: (Child) => boolean = (c: Child) => c.isActive; - - get isMeeting(): boolean { - return this.entity.category?.isMeeting || false; - } } diff --git a/src/app/child-dev-project/notes/notes.module.ts b/src/app/child-dev-project/notes/notes.module.ts index 7c6cf03233..94eb56d568 100644 --- a/src/app/child-dev-project/notes/notes.module.ts +++ b/src/app/child-dev-project/notes/notes.module.ts @@ -46,6 +46,7 @@ import { FontAwesomeModule } from "@fortawesome/angular-fontawesome"; import { NotesDashboardComponent } from "./dashboard-widgets/notes-dashboard/notes-dashboard.component"; import { NotesOfChildComponent } from "./notes-of-child/notes-of-child.component"; import { DashboardModule } from "../../core/dashboard/dashboard.module"; +import { ExportModule } from "../../core/export/export.module"; @NgModule({ declarations: [ @@ -103,6 +104,7 @@ import { DashboardModule } from "../../core/dashboard/dashboard.module"; FontAwesomeModule, MatMenuModule, DashboardModule, + ExportModule, ], exports: [NoteDetailsComponent], }) diff --git a/src/app/core/export/export-service/export.service.spec.ts b/src/app/core/export/export-service/export.service.spec.ts index 5ee783094a..17b9264bea 100644 --- a/src/app/core/export/export-service/export.service.spec.ts +++ b/src/app/core/export/export-service/export.service.spec.ts @@ -176,9 +176,7 @@ describe("ExportService", () => { const columnValues = rows[1].split(ExportService.SEPARATOR_COL); expect(columnValues).toHaveSize(3 + 1); // Properties + _id expect(columnValues).toContain('"' + testEnumValue.label + '"'); - expect(columnValues).toContain( - '"' + moment(new Date(testDate)).toISOString(true) + '"' - ); + expect(columnValues).toContain('"' + testDate + '"'); expect(columnValues).toContain('"true"'); }); @@ -277,11 +275,10 @@ describe("ExportService", () => { ]); }); - it("should export a date according to the local format", async () => { - // Create date at midnight on first of january 2021 + it("should export a date as YYYY-MM-dd only", async () => { const dateString = "2021-01-01"; const dateObject = new Date(dateString); - dateObject.setHours(0, 0, 0); + dateObject.setHours(10, 11, 12); const exportData = [ { @@ -294,12 +291,9 @@ describe("ExportService", () => { const csv = await service.createCsv(exportData); const results = csv.split(ExportService.SEPARATOR_ROW); - // Format: yyyy-mm-ddThh:mm:ss.mmm+hh:mm - const expectedDateFormat = - dateString + "T00:00:00.000" + getTimezoneOffset(dateObject); expect(results).toEqual([ '"date","number","string"', - `"${expectedDateFormat}","10","someString"`, + `"${dateString}","10","someString"`, ]); }); @@ -529,23 +523,4 @@ describe("ExportService", () => { return school; } - - /** - * Returns the timezone offset in hours and minutes. - * E.g. german date object => "+02:00" or "+01:00" depending on time of the year - * @param date object for which the offset should be calculated - */ - function getTimezoneOffset(date: Date): string { - // from https://usefulangle.com/post/30/javascript-get-date-time-with-offset-hours-minutes - const offset = date.getTimezoneOffset(); - - const offsetHrs = parseInt(Math.abs(offset / 60).toString(), 10); - const offsetMin = Math.abs(offset % 60); - - const hrsString = offsetHrs > 10 ? offsetHrs.toString() : "0" + offsetHrs; - const minString = offsetMin > 10 ? offsetMin.toString() : "0" + offsetMin; - - const sign = offset > 0 ? "-" : "+"; - return sign + hrsString + ":" + minString; - } }); diff --git a/src/app/core/export/export-service/export.service.ts b/src/app/core/export/export-service/export.service.ts index 76f55aa7d2..e0220e87fc 100644 --- a/src/app/core/export/export-service/export.service.ts +++ b/src/app/core/export/export-service/export.service.ts @@ -111,8 +111,9 @@ export class ExportService { const readableRow = {}; Object.keys(row).forEach((key) => { if (row[key] instanceof Date) { - // Export data according to local timezone offset - readableRow[key] = moment(row[key]).toISOString(true); + // Export data according to local timezone offset - data is loaded through Entity Schema system and thereby has the correct date in the current device's timezone + // TODO: make this output format configurable or use the different date schema types [GITHUB #1185] + readableRow[key] = moment(row[key]).format("YYYY-MM-DD"); } else { readableRow[key] = getReadableValue(row, key); } diff --git a/src/locale/messages.de.xlf b/src/locale/messages.de.xlf index 6c8d84e189..4da114a92b 100644 --- a/src/locale/messages.de.xlf +++ b/src/locale/messages.de.xlf @@ -125,7 +125,7 @@ Groups that belong to a note src/app/child-dev-project/notes/note-details/note-details.component.html - 162 + 193 @@ -134,7 +134,7 @@ Add a group to a note src/app/child-dev-project/notes/note-details/note-details.component.html - 164 + 195 @@ -154,7 +154,7 @@ Participants of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 129 + 160 @@ -163,7 +163,7 @@ Add participants of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 131 + 162 @@ -1201,6 +1201,15 @@ 22 + + Download details + Details herunterladen + + src/app/child-dev-project/notes/note-details/note-details.component.html + 51 + + Download note details as CSV + since the beginning of the week seit Anfang der Woche @@ -1228,7 +1237,7 @@ Date input src/app/child-dev-project/notes/note-details/note-details.component.html - 31 + 62 @@ -1237,7 +1246,7 @@ Status of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 44 + 75 @@ -1246,7 +1255,7 @@ Type of Interaction when adding event src/app/child-dev-project/notes/note-details/note-details.component.html - 58 + 89 @@ -1255,7 +1264,7 @@ placeholder when adding multiple authors src/app/child-dev-project/notes/note-details/note-details.component.html - 80 + 111 @@ -1264,7 +1273,7 @@ Authors of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 82 + 113 @@ -1275,7 +1284,7 @@ Placeholder src/app/child-dev-project/notes/note-details/note-details.component.html - 97 + 128 @@ -1286,7 +1295,7 @@ Placeholder src/app/child-dev-project/notes/note-details/note-details.component.html - 112 + 143 diff --git a/src/locale/messages.fr.xlf b/src/locale/messages.fr.xlf index 24e1e1d620..b39b6f2337 100644 --- a/src/locale/messages.fr.xlf +++ b/src/locale/messages.fr.xlf @@ -2118,6 +2118,15 @@ 22 + + Download details + Download details + + src/app/child-dev-project/notes/note-details/note-details.component.html + 51 + + Download note details as CSV + Date Date @@ -2125,7 +2134,7 @@ Date input src/app/child-dev-project/notes/note-details/note-details.component.html - 31 + 62 @@ -2134,7 +2143,7 @@ Status of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 44 + 75 @@ -2143,7 +2152,7 @@ Type of Interaction when adding event src/app/child-dev-project/notes/note-details/note-details.component.html - 58 + 89 @@ -2152,7 +2161,7 @@ placeholder when adding multiple authors src/app/child-dev-project/notes/note-details/note-details.component.html - 80 + 111 @@ -2161,7 +2170,7 @@ Authors of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 82 + 113 @@ -2172,7 +2181,7 @@ Placeholder src/app/child-dev-project/notes/note-details/note-details.component.html - 97 + 128 @@ -2183,7 +2192,7 @@ Placeholder src/app/child-dev-project/notes/note-details/note-details.component.html - 112 + 143 @@ -2192,7 +2201,7 @@ Participants of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 129 + 160 @@ -2201,7 +2210,7 @@ Add participants of a note src/app/child-dev-project/notes/note-details/note-details.component.html - 131 + 162 @@ -2210,7 +2219,7 @@ Groups that belong to a note src/app/child-dev-project/notes/note-details/note-details.component.html - 162 + 193 @@ -2219,7 +2228,7 @@ Add a group to a note src/app/child-dev-project/notes/note-details/note-details.component.html - 164 + 195 diff --git a/src/locale/messages.xlf b/src/locale/messages.xlf index 863537aa4f..ffb341086b 100644 --- a/src/locale/messages.xlf +++ b/src/locale/messages.xlf @@ -1894,11 +1894,19 @@ 22 + + Download details + + src/app/child-dev-project/notes/note-details/note-details.component.html + 51 + + Download note details as CSV + Date src/app/child-dev-project/notes/note-details/note-details.component.html - 31 + 62 Placeholder for a date-input Date input @@ -1907,7 +1915,7 @@ Status src/app/child-dev-project/notes/note-details/note-details.component.html - 44 + 75 Status of a note @@ -1915,7 +1923,7 @@ Type of Interaction src/app/child-dev-project/notes/note-details/note-details.component.html - 58 + 89 Type of Interaction when adding event @@ -1923,7 +1931,7 @@ Add Author... src/app/child-dev-project/notes/note-details/note-details.component.html - 80 + 111 placeholder when adding multiple authors @@ -1931,7 +1939,7 @@ Authors src/app/child-dev-project/notes/note-details/note-details.component.html - 82 + 113 Authors of a note @@ -1939,7 +1947,7 @@ Topic / Summary src/app/child-dev-project/notes/note-details/note-details.component.html - 97 + 128 Placeholder informing that this is the Topic/Summary of the note @@ -1949,7 +1957,7 @@ Notes src/app/child-dev-project/notes/note-details/note-details.component.html - 112 + 143 Placeholder informing that this is textarea the actual note can be entered into @@ -1959,7 +1967,7 @@ Participants src/app/child-dev-project/notes/note-details/note-details.component.html - 129 + 160 Participants of a note @@ -1967,7 +1975,7 @@ Add participant ... src/app/child-dev-project/notes/note-details/note-details.component.html - 131 + 162 Add participants of a note @@ -1975,7 +1983,7 @@ Groups src/app/child-dev-project/notes/note-details/note-details.component.html - 162 + 193 Groups that belong to a note @@ -1983,7 +1991,7 @@ Add group ... src/app/child-dev-project/notes/note-details/note-details.component.html - 164 + 195 Add a group to a note