-
-
-
+
+
-
diff --git a/src/app/components/termine/termine-overview/termine-overview.component.ts b/src/app/components/termine/termine-overview/termine-overview.component.ts
index 04d990f6..89b35913 100644
--- a/src/app/components/termine/termine-overview/termine-overview.component.ts
+++ b/src/app/components/termine/termine-overview/termine-overview.component.ts
@@ -1,18 +1,18 @@
import { Component, ViewChild } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import * as _ from "lodash";
-import * as moment from "moment";
import { MenuItem } from "primeng/api";
import { Menu } from "primeng/menu";
-import { GetListInput } from "src/app/interfaces/api-middleware";
import { Termin } from "src/app/models/Termin";
import { PermissionKey } from "src/app/models/User";
import { MkjDatePipe } from "src/app/pipes/mkj-date.pipe";
+import { displayModel } from "src/app/providers/display-model";
import { TermineApiService } from "src/app/services/api/termine-api.service";
-import { ConfigurationService } from "src/app/services/configuration.service";
import { UserService } from "src/app/services/authentication/user.service";
+import { ConfigurationService } from "src/app/services/configuration.service";
import { ExportService } from "src/app/services/export.service";
import { InfoService } from "src/app/services/info.service";
+import { TerminDisplayModel } from "src/app/utilities/_display-model-configurations/termin-display-model.class";
import { TermineListConfig } from "src/app/utilities/_list-configurations/termine-list-config.class";
import { TermineListDatasource } from "src/app/utilities/_list-datasources/termine-list-datasource.class";
import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service";
@@ -20,41 +20,16 @@ import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.ser
@Component({
templateUrl: "./termine-overview.component.html",
styleUrls: ["./termine-overview.component.scss"],
- providers: [TermineListDatasource, TermineListConfig],
+ providers: [
+ TermineListDatasource,
+ TermineListConfig,
+ displayModel(TerminDisplayModel),
+ ],
})
export class TermineOverviewComponent {
- // ausrueckungFilterInput: GetListInput
;
- // filteredRows: Termin[];
-
- // actualDate = moment(new Date()).format("YYYY-MM-DD");
- // filterFromDate = moment(new Date())
- // .subtract(1, "week")
- // .format("YYYY-MM-DD");
-
@ViewChild("exportMenu") exportMenu: Menu;
public selectedRow: Termin;
- public hasAktionenPermissions: boolean = false;
-
- public rowMenuItems: MenuItem[] = [
- {
- label: "Duplizieren",
- icon: "pi pi-copy",
- visible: this.userService.hasOneOfPermissions([
- PermissionKey.TERMIN_SAVE,
- ]),
- command: () => this.duplicateAusrueckung(this.selectedRow),
- },
- {
- label: "Bearbeiten",
- icon: "pi pi-pencil",
- visible: this.userService.hasOneOfPermissions([
- PermissionKey.TERMIN_SAVE,
- PermissionKey.TERMIN_GRUPPENLEITER_SAVE,
- ]),
- command: () => this.navigateEditor(this.selectedRow),
- },
- ];
public exportMenuItems: MenuItem[] = [
{
@@ -74,6 +49,8 @@ export class TermineOverviewComponent {
},
];
+ public readonly Permissions = PermissionKey;
+
constructor(
public datasource: TermineListDatasource,
public listConfig: TermineListConfig,
@@ -87,11 +64,6 @@ export class TermineOverviewComponent {
private namingService: ConfigurationService,
public toolbarService: MkjToolbarService
) {
- this.hasAktionenPermissions = this.userService.hasOneOfPermissions([
- PermissionKey.TERMIN_SAVE,
- PermissionKey.TERMIN_GRUPPENLEITER_SAVE,
- PermissionKey.TERMIN_DELETE,
- ]);
this.toolbarService.header = this.namingService.uiNaming.Termine;
this.toolbarService.buttons = [
{
diff --git a/src/app/pipes/full-name.pipe.ts b/src/app/pipes/full-name.pipe.ts
index 1a3906d1..90ab23c4 100644
--- a/src/app/pipes/full-name.pipe.ts
+++ b/src/app/pipes/full-name.pipe.ts
@@ -1,11 +1,12 @@
import { Pipe, PipeTransform } from "@angular/core";
import { Mitglied } from "../models/Mitglied";
+import { Anschrift } from "../models/Anschrift";
@Pipe({
name: "fullName",
})
export class FullNamePipe implements PipeTransform {
- transform(value: Mitglied): string {
+ transform(value: Mitglied | Anschrift): string {
if (!value) return "";
const name = value.vorname + " " + value.zuname;
diff --git a/src/app/utilities/_display-model-configurations/anschrift-display-model.class.ts b/src/app/utilities/_display-model-configurations/anschrift-display-model.class.ts
new file mode 100644
index 00000000..5a878a51
--- /dev/null
+++ b/src/app/utilities/_display-model-configurations/anschrift-display-model.class.ts
@@ -0,0 +1,50 @@
+import { Injectable } from "@angular/core";
+import { Anschrift } from "src/app/models/Anschrift";
+import { FullNamePipe } from "src/app/pipes/full-name.pipe";
+import {
+ DisplayModelConfiguration,
+ DisplayModelField,
+} from "./display-model-configuration.interface";
+
+@Injectable()
+export class AnschriftDisplayModel
+ implements DisplayModelConfiguration
+{
+ constructor(private namePipe: FullNamePipe) {}
+
+ public fields: DisplayModelField[] = [
+ {
+ label: "Name",
+ getValue: (model: Anschrift) => this.namePipe.transform(model),
+ },
+ {
+ label: "Firma",
+ getValue: (model: Anschrift) => model.firma,
+ },
+ {
+ label: "Adresse",
+ getValue: (model: Anschrift) =>
+ `${model.strasse} ${model.hausnummer}, ${model.plz} ${model.ort}`,
+ },
+ {
+ label: "Telefon Haupt",
+ getValue: (model: Anschrift) => model.telefonHaupt,
+ },
+ {
+ label: "Telefon Mobil",
+ getValue: (model: Anschrift) => model.telefonMobil,
+ },
+ {
+ label: "E-Mail",
+ getValue: (model: Anschrift) => model.email,
+ },
+ {
+ label: "IBAN",
+ getValue: (model: Anschrift) => model.IBAN,
+ },
+ {
+ label: "BIC",
+ getValue: (model: Anschrift) => model.BIC,
+ },
+ ];
+}
diff --git a/src/app/utilities/_display-model-configurations/instrument-display-model.class.ts b/src/app/utilities/_display-model-configurations/instrument-display-model.class.ts
new file mode 100644
index 00000000..094feb48
--- /dev/null
+++ b/src/app/utilities/_display-model-configurations/instrument-display-model.class.ts
@@ -0,0 +1,48 @@
+import { Injectable } from "@angular/core";
+import { Instrument } from "src/app/models/Instrument";
+import { FullNamePipe } from "src/app/pipes/full-name.pipe";
+import {
+ DisplayModelConfiguration,
+ DisplayModelField,
+} from "./display-model-configuration.interface";
+
+@Injectable()
+export class InstrumentDisplayModel
+ implements DisplayModelConfiguration
+{
+ constructor(private namePipe: FullNamePipe) {}
+
+ public fields: DisplayModelField[] = [
+ {
+ label: "Bezeichung",
+ getValue: (model: Instrument) => model.bezeichnung,
+ },
+ {
+ label: "Marke",
+ getValue: (model: Instrument) => model.marke,
+ },
+ {
+ label: "Aufbewahrungsort",
+ getValue: (model: Instrument) => model.aufbewahrungsort,
+ },
+ {
+ label: "Mitglied",
+ getValue: (model: Instrument) =>
+ this.namePipe.transform(model.mitglied),
+ },
+ {
+ label: "Gruppe",
+ getValue: (model: Instrument) => model.gruppe?.name,
+ },
+ {
+ label: "Schäden",
+ getValue: (model: Instrument) => model.schaeden,
+ styleClass: "md:col-6 col-12",
+ },
+ {
+ label: "Anmerkungen",
+ getValue: (model: Instrument) => model.anmerkungen,
+ styleClass: "md:col-6 col-12",
+ },
+ ];
+}
diff --git a/src/app/utilities/_display-model-configurations/mitglied-display-model.class.ts b/src/app/utilities/_display-model-configurations/mitglied-display-model.class.ts
new file mode 100644
index 00000000..0d3ecf60
--- /dev/null
+++ b/src/app/utilities/_display-model-configurations/mitglied-display-model.class.ts
@@ -0,0 +1,35 @@
+import { Injectable } from "@angular/core";
+import { Mitglied } from "src/app/models/Mitglied";
+import { FullNamePipe } from "src/app/pipes/full-name.pipe";
+import {
+ DisplayModelConfiguration,
+ DisplayModelField,
+} from "./display-model-configuration.interface";
+
+@Injectable()
+export class MitgliedDisplayModel
+ implements DisplayModelConfiguration
+{
+ constructor(private namePipe: FullNamePipe) {}
+
+ public fields: DisplayModelField[] = [
+ {
+ label: "Name",
+ getValue: (model: Mitglied) => this.namePipe.transform(model),
+ },
+ {
+ label: "Adresse",
+ getValue: (model: Mitglied) =>
+ `${model.strasse} ${model.hausnummer}, ${model.plz} ${model.ort}`,
+ },
+ {
+ label: "Telefon",
+ getValue: (model: Mitglied) =>
+ model.telefonMobil ?? model.telefonHaupt,
+ },
+ {
+ label: "E-Mail",
+ getValue: (model: Mitglied) => model.email,
+ },
+ ];
+}
diff --git a/src/app/utilities/_display-model-configurations/termin-display-model.class.ts b/src/app/utilities/_display-model-configurations/termin-display-model.class.ts
new file mode 100644
index 00000000..de05c5bd
--- /dev/null
+++ b/src/app/utilities/_display-model-configurations/termin-display-model.class.ts
@@ -0,0 +1,73 @@
+import { Injectable } from "@angular/core";
+import { Termin } from "src/app/models/Termin";
+import { MkjDatePipe } from "src/app/pipes/mkj-date.pipe";
+import {
+ DisplayModelConfiguration,
+ DisplayModelField,
+} from "./display-model-configuration.interface";
+
+@Injectable()
+export class TerminDisplayModel implements DisplayModelConfiguration {
+ constructor(private datePipe: MkjDatePipe) {}
+
+ public fields: DisplayModelField[] = [
+ {
+ label: "Gruppe",
+ getValue: (model: Termin) => model.gruppe?.name?.toUpperCase(),
+ },
+ {
+ label: "Name",
+ getValue: (model: Termin) => model.name,
+ },
+ {
+ label: "Termin",
+ getValue: (model: Termin) => {
+ const vonDatum = this.datePipe.transform(
+ model.vonDatum,
+ "d. MMMM YYYY"
+ );
+
+ if (model.treffzeit) {
+ return `${vonDatum} ${model.treffzeit}`;
+ } else if (model.vonZeit) {
+ return `${vonDatum} ${model.vonZeit}`;
+ } else {
+ return vonDatum;
+ }
+ },
+ },
+ {
+ label: "Dauert bis",
+ getValue: (model: Termin) => {
+ if (model.vonDatum === model.bisDatum) {
+ return model.bisZeit;
+ }
+
+ const bisDatum = this.datePipe.transform(
+ model.bisDatum,
+ "d. MMMM YYYY"
+ );
+
+ if (model.bisZeit) {
+ return `${bisDatum} ${model.bisZeit}`;
+ } else {
+ return bisDatum;
+ }
+ },
+ },
+ {
+ label: "Ort",
+ getValue: (model: Termin) => model.ort,
+ },
+ {
+ label: "Infos",
+ getValue: (model: Termin) => model.infoMusiker,
+ styleClass: "md:col-6 col-12",
+ },
+ {
+ label: "Öffentliche Beschreibung",
+ getValue: (model: Termin) => model.beschreibung,
+ styleClass: "md:col-6 col-12",
+ },
+ ];
+}
diff --git a/src/app/utilities/_list-datasources/_abstract-list-datasource.class.ts b/src/app/utilities/_list-datasources/_abstract-list-datasource.class.ts
index f3498329..d786ac8e 100644
--- a/src/app/utilities/_list-datasources/_abstract-list-datasource.class.ts
+++ b/src/app/utilities/_list-datasources/_abstract-list-datasource.class.ts
@@ -1,14 +1,8 @@
import { Observable } from "rxjs";
-import {
- GetListInput,
- GetListOutput,
- MkjListInputFilter,
-} from "src/app/interfaces/api-middleware";
+import { GetListInput, GetListOutput } from "src/app/interfaces/api-middleware";
import { TileValue } from "../mkj-tile-view/mkj-tile-view.component";
export abstract class AbstractListDatasource {
- protected preFilter: MkjListInputFilter;
-
public abstract getList(
input?: GetListInput
): Observable>;
diff --git a/src/app/utilities/_list-datasources/termine-list-datasource.class.ts b/src/app/utilities/_list-datasources/termine-list-datasource.class.ts
index a296e313..eb818152 100644
--- a/src/app/utilities/_list-datasources/termine-list-datasource.class.ts
+++ b/src/app/utilities/_list-datasources/termine-list-datasource.class.ts
@@ -10,20 +10,11 @@ import { AbstractListDatasource } from "./_abstract-list-datasource.class";
export class TermineListDatasource extends AbstractListDatasource {
constructor(private apiService: TermineApiService) {
super();
- // this.preFilter = {
- // field: "vonDatum",
- // operator: ">=",
- // value: "2023-01-11",
- // };
}
public getList(
input?: GetListInput
): Observable> {
- if (input && this.preFilter) {
- input.filterAnd = [this.preFilter, ...input?.filterAnd];
- }
-
return this.apiService.getList(input);
}