Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dysTOS committed Dec 11, 2023
1 parent e8b7e8e commit 13b6698
Show file tree
Hide file tree
Showing 24 changed files with 182 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@
></mkj-text-input>
</div>
<div class="p-field col-12 lg:col-3 md:col-6">
<p-colorPicker
<mkj-color-picker
label="Farbe"
formControlName="color"
></p-colorPicker>
></mkj-color-picker>
</div>
<div class="p-field col-12 lg:col-3 md:col-6">
<mkj-dropdown
label="Gruppe"
dataKey="id"
formControlName="gruppe_id"
[options]="GruppeDropdown"
></mkj-dropdown>
</div>
<div class="p-field col-12 lg:col-3 md:col-6">
<mkj-text-area-input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Component } from "@angular/core";
import { FormControl, FormGroup } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { UiDropdownOption } from "src/app/interfaces/UiConfigurations";
import { Gruppe } from "src/app/models/Gruppe";
import { Kassabuch } from "src/app/models/Kassabuch";
import { PermissionMap } from "src/app/models/User";
import { GruppenApiService } from "src/app/services/api/gruppen-api.service";
import { KassabuchApiService } from "src/app/services/api/kassabuch-api.service";
import { InfoService } from "src/app/services/info.service";
import { AbstractFormComponent } from "src/app/utilities/form-components/_abstract-form-component.class";
Expand All @@ -13,14 +17,41 @@ import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.ser
styleUrls: ["./kassabuch-edit.component.scss"],
})
export class KassabuchEditComponent extends AbstractFormComponent<Kassabuch> {
protected navigateBackRouteString = "../../list";
protected navigateBackOnSave = false;

public GruppeDropdown: UiDropdownOption<string>[] = [];

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 {
Expand All @@ -34,6 +65,7 @@ export class KassabuchEditComponent extends AbstractFormComponent<Kassabuch> {
name: new FormControl<string>(null),
aktiv: new FormControl<boolean>(false),
color: new FormControl<string>(null),
gruppe_id: new FormControl<string>(null),
anmerkungen: new FormControl<string>(null),
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ 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",
templateUrl: "./kassabuchung-edit.component.html",
styleUrls: ["./kassabuchung-edit.component.scss"],
})
export class KassabuchungEditComponent extends AbstractFormComponent<Kassabuchung> {
protected navigateBackOnSave = true;

public readonly typOptions =
UtilFunctions.getDropdownOptionsFromEnum(KassabuchungTyp);
private _subSink = new SubSink();

constructor(
toolbarService: MkjToolbarService,
Expand All @@ -33,17 +33,8 @@ export class KassabuchungEditComponent extends AbstractFormComponent<Kassabuchun
router: Router
) {
super(toolbarService, apiService, infoService, route, router);
this.toolbarService.buttons = [
{
label: "Löschen",
icon: "pi pi-trash",
click: () => {
this.delete();
},
permissions: [PermissionMap.KASSABUCHUNG_DELETE],
},
];
this._subSink.add(

this.subs.add(
this.formGroup.controls.anschrift.valueChanges.subscribe(
(anschrift) => {
if (anschrift.id) {
Expand All @@ -58,6 +49,20 @@ export class KassabuchungEditComponent extends AbstractFormComponent<Kassabuchun
);
}

protected initToolbar(): void {
this.toolbarService.buttons = [
{
label: "Löschen",
icon: "pi pi-trash",
hidden: this.getId() === "new",
click: () => {
this.delete();
},
permissions: [PermissionMap.KASSABUCHUNG_DELETE],
},
];
}

protected initFormGroup(): FormGroup<any> {
const buchId = this.route.snapshot.paramMap.get("buchId");
return new FormGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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 = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions src/app/interfaces/UiConfigurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T = any> {
label: string;
value: string;
value: T;
}
4 changes: 2 additions & 2 deletions src/app/interfaces/api-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?: {
Expand All @@ -22,7 +22,7 @@ export interface GetCollectionApiCallInput {
}>;
}

export interface GetCollectionApiCallOutput<T> {
export interface GetListOutput<T> {
totalCount: number;
values: Array<T>;
}
Expand Down
1 change: 1 addition & 0 deletions src/app/models/Kassabuch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Kassabuch {
kassastand: number;
color?: string;
anmerkungen?: string;
gruppe_id?: string;
gruppe?: Gruppe;
kassabuchungen?: Kassabuchung[];
}
Expand Down
10 changes: 4 additions & 6 deletions src/app/services/api/_abstract-crud-api-service.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -14,10 +14,8 @@ export abstract class AbstractCrudApiService<T> {

constructor(private http: HttpClient) {}

public getList(
input?: GetCollectionApiCallInput
): Observable<GetCollectionApiCallOutput<T>> {
return this.http.post<GetCollectionApiCallOutput<T>>(
public getList(input?: GetListInput): Observable<GetListOutput<T>> {
return this.http.post<GetListOutput<T>>(
this._baseApiUrl + this.controllerApiUrlKey + "/list",
input,
StandardHttpOptions
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/api/gruppen-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 4 additions & 7 deletions src/app/services/api/termine-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -38,10 +35,10 @@ export class TermineApiService {
}

public getTermineFiltered(
filterInput: GetCollectionApiCallInput
): Observable<GetCollectionApiCallOutput<Termin>> {
filterInput: GetListInput
): Observable<GetListOutput<Termin>> {
const url = this.apiURL + "ausrueckungenfiltered";
return this.http.post<GetCollectionApiCallOutput<Termin>>(
return this.http.post<GetListOutput<Termin>>(
url,
filterInput,
httpOptions
Expand Down
Loading

0 comments on commit 13b6698

Please sign in to comment.