diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 348c1d3f..8a97597e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -122,7 +122,6 @@ import { TerminDetailsComponent } from "./components/termine/termin-details/term import { TeilnahmenOverviewComponent } from "./components/termine/teilnahmen-overview/teilnahmen-overview.component"; import { TermineOverviewComponent } from "./components/termine/termine-overview/termine-overview.component"; import { KalenderaboComponent } from "./components/termine/kalenderabo/kalenderabo.component"; -import { TerminCardComponent } from "./components/termine/termin-card/termin-card.component"; import { LokaleEinstellungenComponent } from "./components/einstellungen/lokale-einstellungen/lokale-einstellungen.component"; import { MitgliedPersonalEditComponent } from "./components/einstellungen/mitglied-personal-edit/mitglied-personal-edit.component"; import { RollenEditComponent } from "./components/einstellungen/rollen-edit/rollen-edit.component"; @@ -348,7 +347,6 @@ registerLocaleData(localeDe); MkjColorPickerComponent, NotenmappeEditComponent, NextTerminComponent, - TerminCardComponent, StatistikTermineComponent, StatistikNotenComponent, StatistikOverviewComponent, diff --git a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html index e5cdb0af..ea969055 100644 --- a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html +++ b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html @@ -2,10 +2,25 @@ [datasource]="datasource" [configuration]="listConfig" [templateMap]="{ - rowexpansion: null, + rowexpansion: rowexpansion, }" (onDoubleClick)="navigateToEdit($event)" > - + + +
+ +
+
diff --git a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts index 3347b76e..ea1b0fc2 100644 --- a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts +++ b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts @@ -2,7 +2,9 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { Anschrift } from "src/app/models/Anschrift"; import { PermissionKey } from "src/app/models/User"; +import { displayModel } from "src/app/providers/display-model"; import { UserService } from "src/app/services/authentication/user.service"; +import { AnschriftDisplayModel } from "src/app/utilities/_display-model-configurations/anschrift-display-model.class"; import { AnschriftenListConfig } from "src/app/utilities/_list-configurations/anschriften-list-config.class"; import { AnschriftenListDatasource } from "src/app/utilities/_list-datasources/anschriften-list-datasource.class"; import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; @@ -11,9 +13,15 @@ import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.ser selector: "app-anschriften-overview", templateUrl: "./anschriften-overview.component.html", styleUrl: "./anschriften-overview.component.scss", - providers: [AnschriftenListConfig, AnschriftenListDatasource], + providers: [ + AnschriftenListConfig, + AnschriftenListDatasource, + displayModel(AnschriftDisplayModel), + ], }) export class AnschriftenOverviewComponent { + public readonly PermissionMap = PermissionKey; + constructor( public datasource: AnschriftenListDatasource, public listConfig: AnschriftenListConfig, diff --git a/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.html b/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.html index c090b8eb..f9addea2 100644 --- a/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.html +++ b/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.html @@ -2,10 +2,25 @@ [datasource]="datasource" [configuration]="listConfig" [templateMap]="{ - rowexpansion: null, + rowexpansion: rowexpansion, }" (onDoubleClick)="navigateEditor($event)" > - + + +
+ +
+
diff --git a/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.ts b/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.ts index d93f024b..c1f22851 100644 --- a/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.ts +++ b/src/app/components/archiv/instrumente/instrumente-overview/instrumente-overview.component.ts @@ -7,14 +7,22 @@ import { UserService } from "src/app/services/authentication/user.service"; import { InstrumenteListConfig } from "src/app/utilities/_list-configurations/instrumente-list-config.class"; import { InstrumenteListDatasource } from "src/app/utilities/_list-datasources/instrumente-list-datasource.class"; import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; +import { displayModel } from "src/app/providers/display-model"; +import { InstrumentDisplayModel } from "src/app/utilities/_display-model-configurations/instrument-display-model.class"; @Component({ selector: "app-instrumente-overview", templateUrl: "./instrumente-overview.component.html", styleUrls: ["./instrumente-overview.component.scss"], - providers: [InstrumenteListDatasource, InstrumenteListConfig], + providers: [ + InstrumenteListDatasource, + InstrumenteListConfig, + displayModel(InstrumentDisplayModel), + ], }) export class InstrumenteOverviewComponent { + public readonly PermissionMap = PermissionKey; + constructor( public datasource: InstrumenteListDatasource, public listConfig: InstrumenteListConfig, diff --git a/src/app/components/archiv/noten/noten-overview/noten-overview.component.html b/src/app/components/archiv/noten/noten-overview/noten-overview.component.html index 802718ce..ee753b82 100644 --- a/src/app/components/archiv/noten/noten-overview/noten-overview.component.html +++ b/src/app/components/archiv/noten/noten-overview/noten-overview.component.html @@ -19,7 +19,7 @@ pRipple label="Bearbeiten" icon="pi pi-pencil" - class="p-button-outlined p-button-sm p-button-info mr-1" + class="p-button-secondary p-button-rounded p-button-raised" (click)="navigateToEditView(noten)" > diff --git a/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.html b/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.html index 6ac2e545..fa2efc9b 100644 --- a/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.html +++ b/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.html @@ -17,14 +17,19 @@ -
+ @if(mitglied){ + + } +
diff --git a/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.ts b/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.ts index 0c76aa56..c8af1f7d 100644 --- a/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.ts +++ b/src/app/components/mitglieder/mitglied-overview/mitglieder-overview.component.ts @@ -7,12 +7,18 @@ import { UserService } from "src/app/services/authentication/user.service"; import { MitgliederListConfig } from "src/app/utilities/_list-configurations/mitglieder-list-config.class"; import { MitgliederListDatasource } from "src/app/utilities/_list-datasources/mitglieder-list-datasource.class"; import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; +import { displayModel } from "src/app/providers/display-model"; +import { MitgliedDisplayModel } from "src/app/utilities/_display-model-configurations/mitglied-display-model.class"; @Component({ selector: "app-mitglieder-overview", templateUrl: "./mitglieder-overview.component.html", styleUrls: ["./mitglieder-overview.component.scss"], - providers: [MitgliederListDatasource, MitgliederListConfig], + providers: [ + MitgliederListDatasource, + MitgliederListConfig, + displayModel(MitgliedDisplayModel), + ], }) export class MitgliederOverviewComponent { public readonly PermissionMap = PermissionKey; diff --git a/src/app/components/mkj-dashboard/next-termin/next-termin.component.html b/src/app/components/mkj-dashboard/next-termin/next-termin.component.html index 20de8b29..52e8ef90 100644 --- a/src/app/components/mkj-dashboard/next-termin/next-termin.component.html +++ b/src/app/components/mkj-dashboard/next-termin/next-termin.component.html @@ -52,6 +52,7 @@

diff --git a/src/app/components/termine/termin-card/termin-card.component.scss b/src/app/components/termine/termin-card/termin-card.component.scss deleted file mode 100644 index 7fa05ef2..00000000 --- a/src/app/components/termine/termin-card/termin-card.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.gruppentermin { - color: var(--gruppe-color) !important; -} diff --git a/src/app/components/termine/termin-card/termin-card.component.ts b/src/app/components/termine/termin-card/termin-card.component.ts deleted file mode 100644 index afdd7c47..00000000 --- a/src/app/components/termine/termin-card/termin-card.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Component, Input } from "@angular/core"; -import { Termin } from "src/app/models/Termin"; - -@Component({ - selector: "termin-card", - templateUrl: "./termin-card.component.html", - styleUrls: ["./termin-card.component.scss"], -}) -export class TerminCardComponent { - @Input() - public termin: Termin; -} diff --git a/src/app/components/termine/termin-details/termin-details.component.html b/src/app/components/termine/termin-details/termin-details.component.html index 813fa779..9c5bbd53 100644 --- a/src/app/components/termine/termin-details/termin-details.component.html +++ b/src/app/components/termine/termin-details/termin-details.component.html @@ -4,7 +4,7 @@
- +
- -
- - - + +
+
+ + + +
- 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); }