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 ff5d4c9..1ccbb1b 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
@@ -4,6 +4,7 @@ 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 { InstrumenteUiService } from "../instrumente-ui.service";
+import { AppConfigService } from "src/app/services/app-config.service";
@Component({
selector: "app-instrumente-overview",
@@ -18,9 +19,10 @@ export class InstrumenteOverviewComponent implements OnInit {
public uiService: InstrumenteUiService,
private toolbarService: MkjToolbarService,
private router: Router,
- private route: ActivatedRoute
+ private route: ActivatedRoute,
+ configService: AppConfigService
) {
- this.toolbarService.header = "Instrumente";
+ this.toolbarService.header = configService.appNaming.Instrumente;
this.toolbarService.backButton = null;
this.toolbarService.buttons = [
{
diff --git a/src/app/components/archiv/noten/notenmappen/notenmappen.component.ts b/src/app/components/archiv/noten/notenmappen/notenmappen.component.ts
index 658d819..65de83d 100644
--- a/src/app/components/archiv/noten/notenmappen/notenmappen.component.ts
+++ b/src/app/components/archiv/noten/notenmappen/notenmappen.component.ts
@@ -2,6 +2,7 @@ import { Component } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { Notenmappe } from "src/app/models/Noten";
import { PermissionMap } from "src/app/models/User";
+import { AppConfigService } from "src/app/services/app-config.service";
import { NotenmappeListDatasource } from "src/app/utilities/_list-datasources/notenmappe-list-datasource.class";
import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service";
@@ -16,9 +17,10 @@ export class NotenmappenComponent {
public datasource: NotenmappeListDatasource,
private route: ActivatedRoute,
private router: Router,
- private toolbarService: MkjToolbarService
+ private toolbarService: MkjToolbarService,
+ configService: AppConfigService
) {
- this.toolbarService.header = "Notenmappen";
+ this.toolbarService.header = configService.appNaming.Notenmappen;
this.toolbarService.buttons = [
{
icon: "pi pi-plus",
diff --git a/src/app/components/ausrueckungen/ausrueckungen-aktuell/ausrueckungen-aktuell.component.ts b/src/app/components/ausrueckungen/ausrueckungen-aktuell/ausrueckungen-aktuell.component.ts
index 2d42316..3af20fd 100644
--- a/src/app/components/ausrueckungen/ausrueckungen-aktuell/ausrueckungen-aktuell.component.ts
+++ b/src/app/components/ausrueckungen/ausrueckungen-aktuell/ausrueckungen-aktuell.component.ts
@@ -11,7 +11,7 @@ import * as moment from "moment";
import { ConfirmationService, MenuItem } from "primeng/api";
import { Menu } from "primeng/menu";
import { Table } from "primeng/table";
-import { GetCollectionApiCallInput } from "src/app/interfaces/api-middleware";
+import { GetListInput } from "src/app/interfaces/api-middleware";
import {
Termin,
TerminCsvColumnMap,
@@ -33,7 +33,7 @@ import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.ser
})
export class AusrueckungenAktuellComponent implements OnInit, AfterViewInit {
ausrueckungenArray: Termin[];
- ausrueckungFilterInput: GetCollectionApiCallInput;
+ ausrueckungFilterInput: GetListInput;
filteredRows: Termin[];
actualDate = moment(new Date()).format("YYYY-MM-DD");
diff --git a/src/app/components/finanzen/kassabuch-edit/kassabuch-edit.component.html b/src/app/components/finanzen/kassabuch-edit/kassabuch-edit.component.html
index 6899cd8..a63e0e0 100644
--- a/src/app/components/finanzen/kassabuch-edit/kassabuch-edit.component.html
+++ b/src/app/components/finanzen/kassabuch-edit/kassabuch-edit.component.html
@@ -13,10 +13,18 @@
>
+
+
{
+ protected navigateBackRouteString = "../../list";
+ protected navigateBackOnSave = false;
+
+ public GruppeDropdown: UiDropdownOption[] = [];
+
constructor(
toolbarService: MkjToolbarService,
apiService: KassabuchApiService,
+ gruppenService: GruppenApiService,
infoService: InfoService,
route: ActivatedRoute,
router: Router
) {
super(toolbarService, apiService, infoService, route, router);
+ this.subs.sink = gruppenService.getList(null).subscribe((result) => {
+ this.GruppeDropdown = result.values.map((item) => {
+ return {
+ label: item.name,
+ value: item.id,
+ };
+ });
+ });
+ }
+ protected initToolbar(): void {
+ this.toolbarService.buttons = [
+ {
+ label: "Löschen",
+ icon: "pi pi-trash",
+ hidden: this.getId() === "new",
+ click: () => {
+ this.delete();
+ },
+ permissions: [PermissionMap.KASSABUCH_DELETE],
+ },
+ ];
}
protected getId(): string {
@@ -34,6 +65,7 @@ export class KassabuchEditComponent extends AbstractFormComponent {
name: new FormControl(null),
aktiv: new FormControl(false),
color: new FormControl(null),
+ gruppe_id: new FormControl(null),
anmerkungen: new FormControl(null),
});
}
diff --git a/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.ts b/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.ts
index c8a05ad..753e43c 100644
--- a/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.ts
+++ b/src/app/components/finanzen/kassabuchung-edit/kassabuchung-edit.component.ts
@@ -13,7 +13,6 @@ import { KassabuchungenApiService } from "src/app/services/api/kassabuchungen-ap
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";
-import { SubSink } from "subsink";
@Component({
selector: "app-kassabuchung-edit",
@@ -21,9 +20,10 @@ import { SubSink } from "subsink";
styleUrls: ["./kassabuchung-edit.component.scss"],
})
export class KassabuchungEditComponent extends AbstractFormComponent {
+ protected navigateBackOnSave = true;
+
public readonly typOptions =
UtilFunctions.getDropdownOptionsFromEnum(KassabuchungTyp);
- private _subSink = new SubSink();
constructor(
toolbarService: MkjToolbarService,
@@ -33,17 +33,8 @@ export class KassabuchungEditComponent extends AbstractFormComponent {
- this.delete();
- },
- permissions: [PermissionMap.KASSABUCHUNG_DELETE],
- },
- ];
- this._subSink.add(
+
+ this.subs.add(
this.formGroup.controls.anschrift.valueChanges.subscribe(
(anschrift) => {
if (anschrift.id) {
@@ -58,6 +49,20 @@ export class KassabuchungEditComponent extends AbstractFormComponent {
+ this.delete();
+ },
+ permissions: [PermissionMap.KASSABUCHUNG_DELETE],
+ },
+ ];
+ }
+
protected initFormGroup(): FormGroup {
const buchId = this.route.snapshot.paramMap.get("buchId");
return new FormGroup(
diff --git a/src/app/components/mitglieder/gruppen/gruppen-overview/gruppen-overview.component.ts b/src/app/components/mitglieder/gruppen/gruppen-overview/gruppen-overview.component.ts
index 5a409a2..41de32a 100644
--- a/src/app/components/mitglieder/gruppen/gruppen-overview/gruppen-overview.component.ts
+++ b/src/app/components/mitglieder/gruppen/gruppen-overview/gruppen-overview.component.ts
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from "@angular/router";
import { Gruppe } from "src/app/models/Gruppe";
import { Mitglied } from "src/app/models/Mitglied";
import { PermissionMap } from "src/app/models/User";
+import { AppConfigService } from "src/app/services/app-config.service";
import { GruppeListDatasource } from "src/app/utilities/_list-datasources/gruppe-list-datasource.class";
import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service";
@@ -23,9 +24,10 @@ export class GruppenOverviewComponent {
public datasource: GruppeListDatasource,
private toolbarService: MkjToolbarService,
private router: Router,
- private route: ActivatedRoute
+ private route: ActivatedRoute,
+ configService: AppConfigService
) {
- this.toolbarService.header = "Register & Gruppen";
+ this.toolbarService.header = configService.appNaming.Gruppen;
this.toolbarService.backButton = null;
this.toolbarService.buttons = [
{
diff --git a/src/app/components/mitglieder/mitglied-list/mitglieder-list.component.ts b/src/app/components/mitglieder/mitglied-list/mitglieder-list.component.ts
index e9a565e..0c3ddc9 100644
--- a/src/app/components/mitglieder/mitglied-list/mitglieder-list.component.ts
+++ b/src/app/components/mitglieder/mitglied-list/mitglieder-list.component.ts
@@ -7,6 +7,7 @@ import { MitgliederApiService } from "src/app/services/api/mitglieder-api.servic
import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service";
import { Table } from "primeng/table";
import { UserService } from "src/app/services/authentication/user.service";
+import { AppConfigService } from "src/app/services/app-config.service";
@Component({
selector: "app-mitglieder",
@@ -39,9 +40,10 @@ export class MitgliederListComponent implements OnInit {
private router: Router,
private route: ActivatedRoute,
private infoService: InfoService,
- private toolbarService: MkjToolbarService
+ private toolbarService: MkjToolbarService,
+ appconfig: AppConfigService
) {
- this.toolbarService.header = "Mitglieder";
+ this.toolbarService.header = appconfig.appNaming.Mitglieder;
this.toolbarService.buttons = [
{
icon: "pi pi-filter",
diff --git a/src/app/interfaces/UiConfigurations.ts b/src/app/interfaces/UiConfigurations.ts
index e3ac912..cbf98af 100644
--- a/src/app/interfaces/UiConfigurations.ts
+++ b/src/app/interfaces/UiConfigurations.ts
@@ -4,15 +4,22 @@ export interface UiConfigurations {
}
export interface UiNamingConfig {
+ Archiv: string;
+ Finanzen: string;
+ Instrumente: string;
+ Statistiken: string;
+ Notenmappen: string;
+ Mitglieder: string;
Termine: string;
Noten: string;
+ Gruppen: string;
}
export interface UiTerminConfig {
terminKategorien: UiDropdownOption[];
}
-export interface UiDropdownOption {
+export interface UiDropdownOption {
label: string;
- value: string;
+ value: T;
}
diff --git a/src/app/interfaces/api-middleware.ts b/src/app/interfaces/api-middleware.ts
index 172f02b..1920f2d 100644
--- a/src/app/interfaces/api-middleware.ts
+++ b/src/app/interfaces/api-middleware.ts
@@ -3,7 +3,7 @@ import { Mitglied } from "../models/Mitglied";
import { Gruppe } from "../models/Gruppe";
import { HttpHeaders } from "@angular/common/http";
-export interface GetCollectionApiCallInput {
+export interface GetListInput {
skip?: number;
take?: number;
sort?: {
@@ -22,7 +22,7 @@ export interface GetCollectionApiCallInput {
}>;
}
-export interface GetCollectionApiCallOutput {
+export interface GetListOutput {
totalCount: number;
values: Array;
}
diff --git a/src/app/models/Kassabuch.ts b/src/app/models/Kassabuch.ts
index 7e59659..0a14517 100644
--- a/src/app/models/Kassabuch.ts
+++ b/src/app/models/Kassabuch.ts
@@ -8,6 +8,7 @@ export interface Kassabuch {
kassastand: number;
color?: string;
anmerkungen?: string;
+ gruppe_id?: string;
gruppe?: Gruppe;
kassabuchungen?: Kassabuchung[];
}
diff --git a/src/app/services/api/_abstract-crud-api-service.ts b/src/app/services/api/_abstract-crud-api-service.ts
index 282587b..463d35a 100644
--- a/src/app/services/api/_abstract-crud-api-service.ts
+++ b/src/app/services/api/_abstract-crud-api-service.ts
@@ -1,8 +1,8 @@
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";
import {
- GetCollectionApiCallInput,
- GetCollectionApiCallOutput,
+ GetListInput,
+ GetListOutput,
StandardHttpOptions,
} from "src/app/interfaces/api-middleware";
import { environment } from "src/environments/environment";
@@ -14,10 +14,8 @@ export abstract class AbstractCrudApiService {
constructor(private http: HttpClient) {}
- public getList(
- input?: GetCollectionApiCallInput
- ): Observable> {
- return this.http.post>(
+ public getList(input?: GetListInput): Observable> {
+ return this.http.post>(
this._baseApiUrl + this.controllerApiUrlKey + "/list",
input,
StandardHttpOptions
diff --git a/src/app/services/api/gruppen-api.service.ts b/src/app/services/api/gruppen-api.service.ts
index b4eb73b..909e315 100644
--- a/src/app/services/api/gruppen-api.service.ts
+++ b/src/app/services/api/gruppen-api.service.ts
@@ -3,7 +3,7 @@ import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { environment } from "src/environments/environment";
import {
- GetCollectionApiCallOutput,
+ GetListOutput,
StandardAllocationInput,
StandardHttpOptions,
StandardMessageOutput,
diff --git a/src/app/services/api/termine-api.service.ts b/src/app/services/api/termine-api.service.ts
index 755e67b..3504cf3 100644
--- a/src/app/services/api/termine-api.service.ts
+++ b/src/app/services/api/termine-api.service.ts
@@ -3,10 +3,7 @@ import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { Termin } from "../../models/Termin";
import { environment } from "../../../environments/environment";
-import {
- GetCollectionApiCallInput,
- GetCollectionApiCallOutput,
-} from "src/app/interfaces/api-middleware";
+import { GetListInput, GetListOutput } from "src/app/interfaces/api-middleware";
const httpOptions = {
headers: new HttpHeaders({
@@ -38,10 +35,10 @@ export class TermineApiService {
}
public getTermineFiltered(
- filterInput: GetCollectionApiCallInput
- ): Observable> {
+ filterInput: GetListInput
+ ): Observable> {
const url = this.apiURL + "ausrueckungenfiltered";
- return this.http.post>(
+ return this.http.post>(
url,
filterInput,
httpOptions
diff --git a/src/app/services/menu.service.ts b/src/app/services/menu.service.ts
index 02679f8..b3d736a 100644
--- a/src/app/services/menu.service.ts
+++ b/src/app/services/menu.service.ts
@@ -41,19 +41,19 @@ export class MenuService implements OnDestroy {
],
},
{
- label: "Mitglieder",
+ label: this.namingService.appNaming.Mitglieder,
icon: "pi pi-fw pi-users",
enumLabel: MenuLabels.MITGLIEDER,
permission: PermissionMap.MITGLIEDER_READ,
children: [
{
- label: "Mitglieder",
+ label: this.namingService.appNaming.Mitglieder,
icon: "pi pi-users",
routerLink: "mitglieder/liste",
permission: PermissionMap.MITGLIEDER_READ,
},
{
- label: "Register & Gruppen",
+ label: this.namingService.appNaming.Gruppen,
icon: "pi pi-folder-open",
routerLink: "mitglieder/gruppen",
permission: PermissionMap.GRUPPEN_READ,
@@ -61,7 +61,7 @@ export class MenuService implements OnDestroy {
],
},
{
- label: "Archiv",
+ label: this.namingService.appNaming.Archiv,
icon: "mdi mdi-archive-music-outline",
enumLabel: MenuLabels.ARCHIV,
visible: false,
@@ -75,14 +75,14 @@ export class MenuService implements OnDestroy {
permission: PermissionMap.NOTEN_READ,
},
{
- label: "Notenmappen",
+ label: this.namingService.appNaming.Notenmappen,
icon: "mdi mdi-book-music-outline",
routerLink: "archiv/mappen",
visible: false,
permission: PermissionMap.NOTENMAPPE_READ,
},
{
- label: "Instrumente",
+ label: this.namingService.appNaming.Instrumente,
icon: "mdi mdi-trumpet",
routerLink: "archiv/instrumente",
visible: false,
@@ -91,21 +91,21 @@ export class MenuService implements OnDestroy {
],
},
{
- label: "Statistiken",
+ label: this.namingService.appNaming.Statistiken,
icon: "pi pi-chart-line",
enumLabel: MenuLabels.STATISTIK,
visible: false,
routerLink: "statistik",
},
{
- label: "Finanzen",
+ label: this.namingService.appNaming.Finanzen,
icon: "mdi mdi-currency-eur",
enumLabel: MenuLabels.FINANZEN,
visible: false,
permission: PermissionMap.KASSABUCH_READ,
children: [
{
- label: "Kassabuch",
+ label: "Kassabücher",
icon: "mdi mdi-currency-eur",
routerLink: "finanzen/list",
permission: PermissionMap.KASSABUCH_READ,
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 a97f21d..ee6bd1b 100644
--- a/src/app/utilities/_list-datasources/_abstract-list-datasource.class.ts
+++ b/src/app/utilities/_list-datasources/_abstract-list-datasource.class.ts
@@ -1,12 +1,12 @@
import { Observable } from "rxjs";
-import { GetCollectionApiCallOutput } from "src/app/interfaces/api-middleware";
+import { GetListOutput } from "src/app/interfaces/api-middleware";
import { TileValue } from "../mkj-tile-view/mkj-tile-view.component";
export interface ListDatasource {
- getList(): Observable>;
+ getList(): Observable>;
mapToTileValue?(item: T): TileValue;
}
export abstract class AbstractListDatasource implements ListDatasource {
- public abstract getList(): Observable>;
+ public abstract getList(): Observable>;
}
diff --git a/src/app/utilities/_list-datasources/gruppe-list-datasource.class.ts b/src/app/utilities/_list-datasources/gruppe-list-datasource.class.ts
index fe4ee64..079d638 100644
--- a/src/app/utilities/_list-datasources/gruppe-list-datasource.class.ts
+++ b/src/app/utilities/_list-datasources/gruppe-list-datasource.class.ts
@@ -1,6 +1,6 @@
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
-import { GetCollectionApiCallOutput } from "src/app/interfaces/api-middleware";
+import { GetListOutput } from "src/app/interfaces/api-middleware";
import { Gruppe } from "src/app/models/Gruppe";
import { GruppenApiService } from "src/app/services/api/gruppen-api.service";
import { TileValue } from "../mkj-tile-view/mkj-tile-view.component";
@@ -12,7 +12,7 @@ export class GruppeListDatasource extends AbstractListDatasource {
super();
}
- public getList(): Observable> {
+ public getList(): Observable> {
return this.apiService.getList(null);
}
diff --git a/src/app/utilities/_list-datasources/kassabuch-list-datasource.ts b/src/app/utilities/_list-datasources/kassabuch-list-datasource.ts
index f4e5a5d..1007c7b 100644
--- a/src/app/utilities/_list-datasources/kassabuch-list-datasource.ts
+++ b/src/app/utilities/_list-datasources/kassabuch-list-datasource.ts
@@ -1,5 +1,5 @@
import { Observable } from "rxjs";
-import { GetCollectionApiCallOutput as GetCollectionApiOutput } from "src/app/interfaces/api-middleware";
+import { GetListOutput as GetCollectionApiOutput } from "src/app/interfaces/api-middleware";
import { Kassabuch } from "src/app/models/Kassabuch";
import { KassabuchApiService } from "src/app/services/api/kassabuch-api.service";
import { AbstractListDatasource } from "./_abstract-list-datasource.class";
@@ -22,6 +22,7 @@ export class KassabuchListDatasource extends AbstractListDatasource {
value: item,
color: item.color,
labelBottomLeft: item.gruppe?.name,
+ labelBottomRight: "€ " + item.kassastand,
};
}
}
diff --git a/src/app/utilities/_list-datasources/notenmappe-list-datasource.class.ts b/src/app/utilities/_list-datasources/notenmappe-list-datasource.class.ts
index 5b09f4f..89e01f9 100644
--- a/src/app/utilities/_list-datasources/notenmappe-list-datasource.class.ts
+++ b/src/app/utilities/_list-datasources/notenmappe-list-datasource.class.ts
@@ -1,7 +1,7 @@
import { Notenmappe } from "src/app/models/Noten";
import { AbstractListDatasource } from "./_abstract-list-datasource.class";
import { Injectable } from "@angular/core";
-import { GetCollectionApiCallOutput } from "src/app/interfaces/api-middleware";
+import { GetListOutput } from "src/app/interfaces/api-middleware";
import { Observable } from "rxjs";
import { NotenmappenApiService } from "src/app/services/api/notenmappen-api.service";
import { TileValue } from "../mkj-tile-view/mkj-tile-view.component";
@@ -12,7 +12,7 @@ export class NotenmappeListDatasource extends AbstractListDatasource
super();
}
- public getList(): Observable> {
+ public getList(): Observable> {
return this.apiService.getList(null);
}
diff --git a/src/app/utilities/form-components/_abstract-form-component.class.ts b/src/app/utilities/form-components/_abstract-form-component.class.ts
index b34b658..5d6e865 100644
--- a/src/app/utilities/form-components/_abstract-form-component.class.ts
+++ b/src/app/utilities/form-components/_abstract-form-component.class.ts
@@ -4,8 +4,14 @@ import { BehaviorSubject } from "rxjs";
import { AbstractCrudApiService } from "src/app/services/api/_abstract-crud-api-service";
import { InfoService } from "src/app/services/info.service";
import { MkjToolbarService } from "../mkj-toolbar/mkj-toolbar.service";
+import { Directive, OnDestroy } from "@angular/core";
+import { SubSink } from "subsink";
+
+@Directive()
+export abstract class AbstractFormComponent implements OnDestroy {
+ protected navigateBackOnSave = false;
+ protected navigateBackRouteString = "../";
-export abstract class AbstractFormComponent {
public formGroup: FormGroup;
private _loading = new BehaviorSubject(false);
@@ -15,6 +21,8 @@ export abstract class AbstractFormComponent {
private _loadedModel: T;
+ protected subs = new SubSink();
+
constructor(
protected toolbarService: MkjToolbarService,
protected apiService: AbstractCrudApiService,
@@ -23,10 +31,17 @@ export abstract class AbstractFormComponent {
protected router: Router
) {
this.toolbarService.backButton = true;
+ this.initToolbar();
this.formGroup = this.initFormGroup();
this.loadData();
}
+ public ngOnDestroy(): void {
+ this.subs.unsubscribe();
+ }
+
+ protected abstract initToolbar(): void;
+
protected abstract initFormGroup(): FormGroup;
protected abstract getId(): string | "new";
@@ -66,10 +81,25 @@ export abstract class AbstractFormComponent {
this.infoService.success("Gespeichert");
this.formGroup.patchValue(res);
this.formGroup.markAsPristine();
- // this.router.navigate([`../${(res as any).id}`], {
- // relativeTo: this.route,
- // });
this._saving.next(false);
+ if (this.navigateBackOnSave) {
+ this.router.navigate([this.navigateBackRouteString], {
+ relativeTo: this.route,
+ });
+ } else {
+ this.router
+ .navigate([`../${(res as any).id}`], {
+ relativeTo: this.route,
+ })
+ .then(() => {
+ this.toolbarService.temporaryBackRoute = {
+ backRoute: this.navigateBackRouteString,
+ route: this.route,
+ };
+ this.toolbarService.backButton = true;
+ this.initToolbar();
+ });
+ }
},
error: (err) => {
this.infoService.error(err);
@@ -94,7 +124,9 @@ export abstract class AbstractFormComponent {
.subscribe({
next: () => {
this.infoService.success("Gelöscht");
- this.router.navigate(["../"], { relativeTo: this.route });
+ this.router.navigate([this.navigateBackRouteString], {
+ relativeTo: this.route,
+ });
},
error: (err) => {
this.infoService.error(err);
diff --git a/src/app/utilities/form-input-components/abstract-control-accessor.ts b/src/app/utilities/form-input-components/abstract-control-accessor.ts
index 54e2fbc..e85dc46 100644
--- a/src/app/utilities/form-input-components/abstract-control-accessor.ts
+++ b/src/app/utilities/form-input-components/abstract-control-accessor.ts
@@ -3,17 +3,19 @@ import {
EventEmitter,
Injector,
Input,
+ OnDestroy,
Output,
} from "@angular/core";
import { ControlValueAccessor, FormControl, NgControl } from "@angular/forms";
import { BehaviorSubject, Observable, distinctUntilChanged } from "rxjs";
+import { SubSink } from "subsink";
@Component({
selector: "abstract-control-accessor",
template: "",
})
export abstract class AbstractControlAccessor
- implements ControlValueAccessor
+ implements ControlValueAccessor, OnDestroy
{
private _value = new BehaviorSubject(null);
private _disabled = new BehaviorSubject(false);
@@ -54,6 +56,8 @@ export abstract class AbstractControlAccessor
public formControl: FormControl;
+ protected subs = new SubSink();
+
constructor(private inj: Injector) {}
public ngAfterViewInit() {
@@ -61,6 +65,10 @@ export abstract class AbstractControlAccessor
?.control as FormControl;
}
+ public ngOnDestroy() {
+ this.subs.unsubscribe();
+ }
+
public change(value: T) {
this._onChange?.(value);
this.valueChange.emit(value);
diff --git a/src/app/utilities/form-input-components/mkj-dropdown/mkj-dropdown.component.ts b/src/app/utilities/form-input-components/mkj-dropdown/mkj-dropdown.component.ts
index 35eb35b..4e703f9 100644
--- a/src/app/utilities/form-input-components/mkj-dropdown/mkj-dropdown.component.ts
+++ b/src/app/utilities/form-input-components/mkj-dropdown/mkj-dropdown.component.ts
@@ -16,4 +16,7 @@ export interface MkjDropdownOption {
export class MkjDropdownComponent extends AbstractControlAccessor {
@Input()
public options: MkjDropdownOption[] = [];
+
+ @Input()
+ public dataKey: string;
}
diff --git a/src/app/utilities/mkj-toolbar/mkj-toolbar.service.ts b/src/app/utilities/mkj-toolbar/mkj-toolbar.service.ts
index c644559..38f0dad 100644
--- a/src/app/utilities/mkj-toolbar/mkj-toolbar.service.ts
+++ b/src/app/utilities/mkj-toolbar/mkj-toolbar.service.ts
@@ -1,6 +1,11 @@
import { Location } from "@angular/common";
import { Injectable, OnDestroy, OnInit, TemplateRef } from "@angular/core";
-import { ActivationStart, NavigationEnd, Router } from "@angular/router";
+import {
+ ActivatedRoute,
+ ActivationStart,
+ NavigationEnd,
+ Router,
+} from "@angular/router";
import { PermissionMap } from "src/app/models/User";
import { UserService } from "src/app/services/authentication/user.service";
import { SubSink } from "subsink";
@@ -24,6 +29,7 @@ export class MkjToolbarService implements OnInit, OnDestroy {
public header: string;
public contentSectionExpanded: boolean;
public contentSectionTemplate: TemplateRef;
+ public temporaryBackRoute: { backRoute: string; route: ActivatedRoute };
private _buttons: MkjToolbarButton[];
public get buttons(): MkjToolbarButton[] {
@@ -92,9 +98,16 @@ export class MkjToolbarService implements OnInit, OnDestroy {
}
public navigateBack(): void {
- if (this.firstNavigationHappened) {
+ if (this.temporaryBackRoute) {
+ this.router.navigate([this.temporaryBackRoute.backRoute], {
+ relativeTo: this.temporaryBackRoute.route,
+ });
+ this.temporaryBackRoute = null;
+ } else if (this.firstNavigationHappened) {
+ this.temporaryBackRoute = null;
this.location.back();
} else {
+ this.temporaryBackRoute = null;
this.router.navigateByUrl("/");
}
}
diff --git a/src/configurations/_CONFIG_MAP.ts b/src/configurations/_CONFIG_MAP.ts
index 5f3c7e1..42bb52a 100644
--- a/src/configurations/_CONFIG_MAP.ts
+++ b/src/configurations/_CONFIG_MAP.ts
@@ -16,7 +16,7 @@ export const CONFIG_MAP: AppConfig = {
// apiUrl: "https://api.gulaschmusi.at/api/",
// appTitle: "gulaschAPP",
// prefix: "mkj",
-
+ // apiUrl: "https://api.gulaschmusi.at/api/",
apiUrl: "http://localhost:8000/api/",
appTitle: "mkjLOCAL",
prefix: "mkj",