diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 24bc559..6f40abc 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -194,6 +194,7 @@ import { PermissionSelectedPipe } from "./components/einstellungen/rollen-edit/p import { AnschriftenOverviewComponent as AnschriftOverviewComponent } from "./components/anschriften/anschriften-overview/anschriften-overview.component"; import { AnschriftEditComponent } from "./components/anschriften/anschriften-edit/anschriften-edit.component"; import { MkjListCellComponent } from "./utilities/mkj-list/mkj-list-cell/mkj-list-cell.component"; +import { ListCellValuePipe } from "./utilities/mkj-list/mkj-list-cell/list-cell-value.pipe"; // FullCalendarModule.registerPlugins([ // dayGridPlugin, @@ -331,6 +332,7 @@ registerLocaleData(localeDe); MkjToolbarComponent, AusrueckungEditorComponent, RollenEditComponent, + ListCellValuePipe, MkjTextTransformPipe, MkjDisplayFieldComponent, AatestComponent, 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 4cb2d14..e5cdb0a 100644 --- a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html +++ b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html @@ -1,14 +1,11 @@ - -
- {{ add.vorname }} {{ add.zuname }}{{ add.firma }} - -
-
+ + + + 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 c015408..12a501b 100644 --- a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts +++ b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts @@ -2,26 +2,26 @@ import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { Anschrift } from "src/app/models/Anschrift"; import { PermissionMap } from "src/app/models/User"; -import { AnschriftenApiService } from "src/app/services/api/anschriften-api.service"; +import { UserService } from "src/app/services/authentication/user.service"; +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"; @Component({ selector: "app-anschriften-overview", templateUrl: "./anschriften-overview.component.html", styleUrl: "./anschriften-overview.component.scss", + providers: [AnschriftenListConfig, AnschriftenListDatasource], }) export class AnschriftenOverviewComponent { - public adressen: Anschrift[]; - constructor( - private apiService: AnschriftenApiService, - private toolbarService: MkjToolbarService, + public datasource: AnschriftenListDatasource, + public listConfig: AnschriftenListConfig, + toolbarService: MkjToolbarService, private router: Router, - private route: ActivatedRoute + private route: ActivatedRoute, + private userServie: UserService ) { - apiService.getList().subscribe((list) => { - this.adressen = list.values; - }); toolbarService.header = "Adressen"; toolbarService.buttons = [ { @@ -35,4 +35,12 @@ export class AnschriftenOverviewComponent { }, ]; } + + public navigateToEdit(item: Anschrift): void { + if (this.userServie.hasPermission(PermissionMap.ANSCHRIFTEN_SAVE)) { + this.router.navigate([item.id], { + relativeTo: this.route, + }); + } + } } 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 e878110..c090b8e 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 @@ -1,29 +1,11 @@ - - - - Bezeichnung - Marke - - Register - - - - - - - {{ item.bezeichnung }} - {{ item.marke }} - {{ item.gruppe?.name }} - - - - + + + + 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 0111e5d..c9000ce 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 @@ -1,48 +1,45 @@ -import { Component, OnInit } from "@angular/core"; +import { Component } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; import { Instrument } from "src/app/models/Instrument"; import { PermissionMap } from "src/app/models/User"; -import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; import { AppConfigService } from "src/app/services/app-config.service"; -import { InstrumenteApiService } from "src/app/services/api/instrumente-api.service"; +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"; @Component({ selector: "app-instrumente-overview", templateUrl: "./instrumente-overview.component.html", styleUrls: ["./instrumente-overview.component.scss"], + providers: [InstrumenteListDatasource, InstrumenteListConfig], }) -export class InstrumenteOverviewComponent implements OnInit { - public values: Instrument[]; - public readonly PermissionMap = PermissionMap; - +export class InstrumenteOverviewComponent { constructor( - private toolbarService: MkjToolbarService, - private apiService: InstrumenteApiService, + public datasource: InstrumenteListDatasource, + public listConfig: InstrumenteListConfig, private router: Router, private route: ActivatedRoute, + private userService: UserService, + toolbarService: MkjToolbarService, configService: AppConfigService ) { - this.toolbarService.header = configService.appNaming.Instrumente; - this.toolbarService.backButton = null; - this.toolbarService.buttons = [ + toolbarService.header = configService.appNaming.Instrumente; + toolbarService.buttons = [ { icon: "pi pi-plus", label: "Neu", permissions: [PermissionMap.INSTRUMENTE_SAVE], - click: () => { - this.router.navigate(["new"], { relativeTo: this.route }); - }, + click: () => this.navigateEditor(), }, ]; } - public ngOnInit(): void { - this.apiService.getList(null).subscribe((data) => { - this.values = data.values; + public navigateEditor(instrument?: Instrument): void { + if (!this.userService.hasPermission(PermissionMap.INSTRUMENTE_SAVE)) + return; + this.router.navigate([instrument?.id ?? "new"], { + relativeTo: this.route, }); } - - public navigateEditor(instrument: Instrument): void { - this.router.navigate([instrument.id], { relativeTo: this.route }); - } } 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 1371e39..1df9d92 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 @@ -4,6 +4,7 @@ [templateMap]="{ rowexpansion: rowexpansion, }" + (onDoubleClick)="navigateToEditView($event)" > diff --git a/src/app/components/archiv/noten/noten-overview/noten-overview.component.ts b/src/app/components/archiv/noten/noten-overview/noten-overview.component.ts index d944864..b0e7898 100644 --- a/src/app/components/archiv/noten/noten-overview/noten-overview.component.ts +++ b/src/app/components/archiv/noten/noten-overview/noten-overview.component.ts @@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from "@angular/router"; import { Noten } from "src/app/models/Noten"; import { PermissionMap } from "src/app/models/User"; import { AppConfigService } from "src/app/services/app-config.service"; +import { UserService } from "src/app/services/authentication/user.service"; import { NotenListConfig } from "src/app/utilities/_list-configurations/noten-list-config.class"; import { NotenListDatasource } from "src/app/utilities/_list-datasources/noten-list-datasource.class"; import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; @@ -22,7 +23,8 @@ export class NotenOverviewComponent { private toolbarService: MkjToolbarService, private router: Router, private route: ActivatedRoute, - private namingService: AppConfigService + private namingService: AppConfigService, + private userService: UserService ) { this.toolbarService.header = this.namingService.appNaming.Noten; this.toolbarService.buttons = [ @@ -36,6 +38,9 @@ export class NotenOverviewComponent { } public navigateToEditView(noten?: Noten) { + if (!this.userService.hasPermission(PermissionMap.NOTEN_SAVE)) { + return; + } this.router.navigate([noten?.id ?? "new"], { relativeTo: this.route }); } } diff --git a/src/app/components/einstellungen/rollen-edit/permission-included.pipe.ts b/src/app/components/einstellungen/rollen-edit/permission-included.pipe.ts index f54195c..c5c337f 100644 --- a/src/app/components/einstellungen/rollen-edit/permission-included.pipe.ts +++ b/src/app/components/einstellungen/rollen-edit/permission-included.pipe.ts @@ -5,7 +5,7 @@ import { Permission } from "../../../models/User"; name: "permissionIncluded", }) export class PermissionSelectedPipe implements PipeTransform { - transform(value: Permission, permissions: Permission[]) { + public transform(value: Permission, permissions: Permission[]) { return permissions?.some((p) => p.id === value.id); } } diff --git a/src/app/pages/login/login.component.html b/src/app/pages/login/login.component.html index 4254cd3..50c7cc7 100644 --- a/src/app/pages/login/login.component.html +++ b/src/app/pages/login/login.component.html @@ -1,4 +1,7 @@ - +
+ + +
diff --git a/src/app/pages/signup/signup.component.html b/src/app/pages/signup/signup.component.html index 710fb6e..26a4a45 100644 --- a/src/app/pages/signup/signup.component.html +++ b/src/app/pages/signup/signup.component.html @@ -1,4 +1,7 @@ - +
+ + +