From 5ddc863b43a86ad89236f50ed5b487a22d463c06 Mon Sep 17 00:00:00 2001 From: dysTOS Date: Tue, 12 Dec 2023 13:02:10 +0100 Subject: [PATCH] create anschriften-components --- src/app/app-routing.module.ts | 13 +++++ src/app/app.module.ts | 4 ++ .../anschriften-edit.component.html | 3 ++ .../anschriften-edit.component.scss | 0 .../anschriften-edit.component.ts | 52 +++++++++++++++++++ .../anschriften-overview.component.html | 14 +++++ .../anschriften-overview.component.scss | 0 .../anschriften-overview.component.ts | 38 ++++++++++++++ .../kassabuchung-edit.component.html | 5 +- src/app/services/menu.service.ts | 6 +++ .../anschrift-form.component.html | 2 +- .../anschrift-form.component.ts | 17 ++++-- src/configurations/changeLogVersion.ts | 25 +++++---- 13 files changed, 163 insertions(+), 16 deletions(-) create mode 100644 src/app/components/anschriften/anschriften-edit/anschriften-edit.component.html create mode 100644 src/app/components/anschriften/anschriften-edit/anschriften-edit.component.scss create mode 100644 src/app/components/anschriften/anschriften-edit/anschriften-edit.component.ts create mode 100644 src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html create mode 100644 src/app/components/anschriften/anschriften-overview/anschriften-overview.component.scss create mode 100644 src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 42793ec..927001f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -43,6 +43,8 @@ import { FinanzenWrapperComponent } from "./components/finanzen/finanzen-wrapper import { KassabuchDetailsComponent } from "./components/finanzen/kassabuch-details/kassabuch-details.component"; import { KassabuchEditComponent } from "./components/finanzen/kassabuch-edit/kassabuch-edit.component"; import { KassabuchungEditComponent } from "./components/finanzen/kassabuchung-edit/kassabuchung-edit.component"; +import { AnschriftenOverviewComponent as AnschriftOverviewComponent } from "./components/anschriften/anschriften-overview/anschriften-overview.component"; +import { AnschriftEditComponent as AnschriftEditComponent } from "./components/anschriften/anschriften-edit/anschriften-edit.component"; @NgModule({ imports: [ @@ -226,6 +228,17 @@ import { KassabuchungEditComponent } from "./components/finanzen/kassabuchung-ed canActivate: [RouteGuard], canDeactivate: [EditDeactivateGuard], }, + { + path: "adressen", + component: AnschriftOverviewComponent, + canActivate: [RouteGuard], + }, + { + path: "adressen/:id", + component: AnschriftEditComponent, + canActivate: [RouteGuard], + canDeactivate: [EditDeactivateGuard], + }, ], }, { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b46abea..f22807d 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -191,6 +191,8 @@ import { MkjDropdownComponent } from "./utilities/form-input-components/mkj-drop import { MkjTextAreaInputComponent } from "./utilities/form-input-components/mkj-text-area-input/mkj-text-area-input.component"; import { MkjTagComponent } from "./utilities/mkj-tag/mkj-tag.component"; import { PermissionSelectedPipe } from "./components/einstellungen/rollen-edit/permission-included.pipe"; +import { AnschriftenOverviewComponent as AnschriftOverviewComponent } from "./components/anschriften/anschriften-overview/anschriften-overview.component"; +import { AnschriftEditComponent } from "./components/anschriften/anschriften-edit/anschriften-edit.component"; // FullCalendarModule.registerPlugins([ // dayGridPlugin, @@ -293,6 +295,8 @@ registerLocaleData(localeDe); declarations: [ AppComponent, PermissionSelectedPipe, + AnschriftOverviewComponent, + AnschriftEditComponent, AppMainComponent, AppTopbarComponent, AppFooterComponent, diff --git a/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.html b/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.html new file mode 100644 index 0000000..a9c112b --- /dev/null +++ b/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.html @@ -0,0 +1,3 @@ + + + diff --git a/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.scss b/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.ts b/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.ts new file mode 100644 index 0000000..740a17b --- /dev/null +++ b/src/app/components/anschriften/anschriften-edit/anschriften-edit.component.ts @@ -0,0 +1,52 @@ +import { Component } from "@angular/core"; +import { FormControl, FormGroup } from "@angular/forms"; +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 { InfoService } from "src/app/services/info.service"; +import { AbstractFormComponent } from "src/app/utilities/form-components/_abstract-form-component.class"; +import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; + +@Component({ + selector: "app-anschriften-edit", + templateUrl: "./anschriften-edit.component.html", + styleUrl: "./anschriften-edit.component.scss", +}) +export class AnschriftEditComponent extends AbstractFormComponent { + protected navigateBackOnSave = true; + + constructor( + toolbarService: MkjToolbarService, + apiService: AnschriftenApiService, + infoService: InfoService, + route: ActivatedRoute, + router: Router + ) { + super(toolbarService, apiService, infoService, route, router); + } + + protected initToolbar(): void { + this.toolbarService.backButton = true; + + if (this.getId() !== "new") { + this.toolbarService.header = "Adresse bearbeiten"; + this.toolbarService.buttons = [ + { + label: "Adresse Löschen", + icon: "pi pi-trash", + click: () => this.delete(), + permissions: [PermissionMap.ANSCHRIFTEN_DELETE], + }, + ]; + } else { + this.toolbarService.header = "Neue Adresse"; + } + } + protected initFormGroup(): FormGroup { + return new FormControl(null) as unknown as FormGroup; + } + protected getId(): string { + return this.route.snapshot.params.id; + } +} diff --git a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html new file mode 100644 index 0000000..4cb2d14 --- /dev/null +++ b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.html @@ -0,0 +1,14 @@ + +
+ {{ add.vorname }} {{ add.zuname }}{{ add.firma }} + +
+
diff --git a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.scss b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts new file mode 100644 index 0000000..c015408 --- /dev/null +++ b/src/app/components/anschriften/anschriften-overview/anschriften-overview.component.ts @@ -0,0 +1,38 @@ +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 { 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", +}) +export class AnschriftenOverviewComponent { + public adressen: Anschrift[]; + + constructor( + private apiService: AnschriftenApiService, + private toolbarService: MkjToolbarService, + private router: Router, + private route: ActivatedRoute + ) { + apiService.getList().subscribe((list) => { + this.adressen = list.values; + }); + toolbarService.header = "Adressen"; + toolbarService.buttons = [ + { + icon: "pi pi-plus", + routerLink: "/new", + click: () => + this.router.navigate(["new"], { + relativeTo: this.route, + }), + permissions: [PermissionMap.ANSCHRIFTEN_SAVE], + }, + ]; + } +} diff --git a/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.html b/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.html index 0bc5f54..7a345f3 100644 --- a/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.html +++ b/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.html @@ -55,5 +55,8 @@ - + diff --git a/src/app/services/menu.service.ts b/src/app/services/menu.service.ts index b3d736a..ae60eab 100644 --- a/src/app/services/menu.service.ts +++ b/src/app/services/menu.service.ts @@ -111,6 +111,12 @@ export class MenuService implements OnDestroy { permission: PermissionMap.KASSABUCH_READ, visible: false, }, + { + label: "Adressen", + icon: "pi pi-fw pi-users", + routerLink: "finanzen/adressen", + permission: PermissionMap.ANSCHRIFTEN_READ, + }, ], }, { diff --git a/src/app/utilities/form-input-components/anschrift-form/anschrift-form.component.html b/src/app/utilities/form-input-components/anschrift-form/anschrift-form.component.html index 3660fb1..5780536 100644 --- a/src/app/utilities/form-input-components/anschrift-form/anschrift-form.component.html +++ b/src/app/utilities/form-input-components/anschrift-form/anschrift-form.component.html @@ -108,7 +108,7 @@
implements Validator { + @Input() + public mode: "edit" | "suggest" = "edit"; + @ViewChild("op") private overlayPanel: OverlayPanel; @ViewChild("opTarget") @@ -63,10 +67,12 @@ export class AnschriftFormComponent } }), this.internalFormGroup.valueChanges.subscribe((value) => { - value.id = null; - this.internalFormGroup.controls.id.patchValue(null, { - emitEvent: false, - }); + if (this.mode === "suggest") { + value.id = null; + this.internalFormGroup.controls.id.patchValue(null, { + emitEvent: false, + }); + } this.touch(); this.change(value); }), @@ -76,6 +82,7 @@ export class AnschriftFormComponent this.internalFormGroup.controls.firma.valueChanges ) .pipe( + takeWhile(() => this.mode === "suggest"), tap((_) => { this.suggestions = []; this.overlayPanel?.hide(); diff --git a/src/configurations/changeLogVersion.ts b/src/configurations/changeLogVersion.ts index 41de4b2..0efa5fa 100644 --- a/src/configurations/changeLogVersion.ts +++ b/src/configurations/changeLogVersion.ts @@ -1,4 +1,4 @@ -export const MkjAppVersion = "0.8.3 - ALPHA"; +export const MkjAppVersion = "0.9.1 - BETA"; export interface MkjAppChangeLog { date: string; @@ -7,14 +7,21 @@ export interface MkjAppChangeLog { } export const MkjAppChangeLog: MkjAppChangeLog[] = [ - // { - // date: "x", - // version: "0.9.1 - BETA", - // changes: { - // Environments: "Die App kann nun automatisiert für verschiedene Umgebungen/Vereine/Bands ausgeliefert werden.", - // Einstellungen: "Globale Einstellungen ermöglichen dem Administrator die Konfiguration des ganzen Environments.", - // } - // }, + { + date: "01.01.2024", + version: "0.9.1 - BETA", + changes: { + Environments: + "Die App kann nun automatisiert für verschiedene Umgebungen/Vereine/Bands ausgeliefert werden.", + Einstellungen: + "Globale Einstellungen ermöglichen dem Administrator die Konfiguration der App (Benennung der Menüpunkte, Dropdown-Optionen).", + Kassabücher: + "Es können nun Kassabücher erstellt/verwaltet und Gruppen zugeordnet werden.", + Adressen: + "Es können nun beliebig viele Adressen angelegt werden. Dieser Adressen werden u.a. für die Kassabuchungen verwendet.", + UI: "Verbesserungen der Benutzeroberfläche.", + }, + }, { date: "24. Juni 2023", version: "0.8.3 - ALPHA",