Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dysTOS committed Jan 18, 2024
1 parent b17676b commit 1838d88
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 75 deletions.
16 changes: 5 additions & 11 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AppErrorComponent } from "./pages/app.error.component";
import { AppAccessdeniedComponent } from "./pages/app.accessdenied.component";
import { AppInvoiceComponent } from "./pages/app.invoice.component";
import { AppHelpComponent } from "./pages/app.help.component";
import { AusrueckungSingleComponent } from "./components/ausrueckungen/ausrueckung-single/ausrueckung-single.component";
import { TerminDetailsComponent } from "./components/termine/termin-details/termin-details.component";
import { RouteGuard } from "./guards/route.guard";
import { MitgliederEditComponent } from "./components/mitglieder/mitglieder-edit/mitglieder-edit.component";
import { NotenOverviewComponent } from "./components/archiv/noten/noten-overview/noten-overview.component";
Expand Down Expand Up @@ -69,13 +69,13 @@ import { RouterOutletWrapperComponent } from "./components/router-outlet-wrapper
canActivate: [RouteGuard],
},
{
path: "ausrueckungen",
path: "termine",
component: RouterOutletWrapperComponent,
canActivate: [RouteGuard],
title: environment.appTitle + " - TERMINE",
children: [
{
path: "aktuell",
path: "liste",
component: TermineOverviewComponent,
canActivate: [RouteGuard],
},
Expand All @@ -84,12 +84,6 @@ import { RouterOutletWrapperComponent } from "./components/router-outlet-wrapper
component: KalenderaboComponent,
canActivate: [RouteGuard],
},
{
path: "neu",
component: TerminEditComponent,
canActivate: [RouteGuard],
canDeactivate: [EditDeactivateGuard],
},
{
path: ":id",
component: TerminEditComponent,
Expand All @@ -98,12 +92,12 @@ import { RouterOutletWrapperComponent } from "./components/router-outlet-wrapper
},
{
path: "details/:id",
component: AusrueckungSingleComponent,
component: TerminDetailsComponent,
canActivate: [RouteGuard],
},
{
path: "",
redirectTo: "aktuell",
redirectTo: "liste",
pathMatch: "full",
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class AppMainComponent implements OnInit, AfterViewInit, OnDestroy {
this.activeTabIndex = MenuLabels.DASHBOARD;
} else if (first === "noten") {
this.activeTabIndex = MenuLabels.NOTEN;
} else if (first === "ausrueckungen") {
} else if (first === "termine") {
this.activeTabIndex = MenuLabels.TERMINE;
} else if (first === "mitglieder") {
this.activeTabIndex = MenuLabels.MITGLIEDER;
Expand Down
8 changes: 4 additions & 4 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ import { NotenOverviewComponent } from "./components/archiv/noten/noten-overview
import { NotenmappeEditComponent } from "./components/archiv/notenmappen/notenmappe-edit/notenmappe-edit.component";
import { NotenmappenOverviewComponent } from "./components/archiv/notenmappen/notenmappen-overview/notenmappen-overview.component";
import { TerminEditComponent } from "./components/termine/termin-edit/termin-edit.component";
import { AnwesenheitsListeComponent } from "./components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component";
import { AusrueckungSingleComponent } from "./components/ausrueckungen/ausrueckung-single/ausrueckung-single.component";
import { TeilnahmenOverviewComponent } from "./components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component";
import { AnwesenheitsListeComponent } from "./components/termine/anwesenheits-liste/anwesenheits-liste.component";
import { TerminDetailsComponent } from "./components/termine/termin-details/termin-details.component";
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";
Expand Down Expand Up @@ -312,7 +312,7 @@ registerLocaleData(localeDe);
AppErrorComponent,
AppAccessdeniedComponent,
MkjListCellComponent,
AusrueckungSingleComponent,
TerminDetailsComponent,
MkjDatePipe,
MkjDashboardComponent,
SignupComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
</ng-template>

<ng-template #rowexpansion let-value>
<div class="col-12 card flex justify-content-center">
<div class="col-12 card flex gap-2 justify-content-center">
<button
*ngIf="hasSavePermission"
pButton
icon="pi pi-link"
label="Bearbeiten"
class="p-button-text ml-2"
class="p-button-text"
(click)="navigateToNoten(value)"
></button>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Component, Input, OnChanges, SimpleChanges } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { Noten } from "src/app/models/Noten";
import { PermissionMap } from "src/app/models/User";
import { NotenmappenApiService } from "src/app/services/api/notenmappen-api.service";
import { AppConfigService } from "src/app/services/app-config.service";
import { UserService } from "src/app/services/authentication/user.service";
import { InfoService } from "src/app/services/info.service";
import { NotenAutoCompleteConfigiguration } from "src/app/utilities/_autocomplete-configurations/noten-autocomplete-config.class";
import { NotenListDatasource } from "src/app/utilities/_list-datasources/noten-list-datasource.class";
import { MappeNotenListConfig } from "./mappe-noten-list-config.class";
import { MappeNotenListDatasource } from "./mappe-noten-list-datasource.class";
import { UserService } from "src/app/services/authentication/user.service";
import { ActivatedRoute, Router } from "@angular/router";
import { NotenListDatasource } from "src/app/utilities/_list-datasources/noten-list-datasource.class";
import { AppConfigService } from "src/app/services/app-config.service";
import { AutoCompleteConfiguration } from "src/app/utilities/_autocomplete-configurations/_autocomplete-configuration.class";
import { NotenAutoCompleteConfigiguration } from "src/app/utilities/_autocomplete-configurations/noten-autocomplete-config.class";

@Component({
selector: "mkj-notenmappe-noten-list",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<span>Nächster Termin:</span>
</p>
<div *ngIf="nextAusrueckung" class="next-ausrueckung">
<a routerLink="../ausrueckungen/details/{{ nextAusrueckung?.id }}">
<a routerLink="../termine/details/{{ nextAusrueckung?.id }}">
<h4 pRipple>
{{ nextAusrueckung?.name }}
</h4>
Expand Down Expand Up @@ -54,7 +54,7 @@ <h4 pRipple>
pButton
label="Alle Termine"
icon="pi pi-calendar"
routerLink="../ausrueckungen"
routerLink="../termine"
class="p-button-secondary p-button-rounded p-button-raised mt-2"
></button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div
*ngIf="!gruppenMitglieder || !presentMitglieder"
class="flex justify-content-center"
class="flex flex-1 justify-content-center"
>
<i class="pi pi-spin pi-spinner" style="font-size: 2rem"></i>
</div>
Expand All @@ -12,11 +12,10 @@
[multiple]="true"
[group]="true"
[checkbox]="true"
[filter]="true"
placeholder="Filtern"
[showToggleAll]="false"
dataKey="id"
(onChange)="onMitgliederChange($event)"
[listStyle]="{ 'min-height': '300rem' }"
[disabled]="saving"
>
<ng-template pTemplate="header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@
responsiveLayout="scroll"
styleClass="p-datatable-sm p-datatable-striped"
>
<ng-template pTemplate="caption"
><div class="col-12 flex justify-content-center">
<app-mkj-notensuche
(notenSelect)="attachNoten($event.noten)"
></app-mkj-notensuche></div
<ng-template pTemplate="caption">
<mkj-autocomplete
[value]="selectedNoten"
[datasource]="notenDatasource"
[listConfig]="notenAutoCompleteConfig"
[label]="
configService.appNaming.Noten + ' hinzufügen'
"
(valueChange)="attachNoten($event)"
></mkj-autocomplete
></ng-template>
<ng-template pTemplate="body" let-noten>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,23 @@ import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.ser
import { NotenApiService } from "../../../services/api/noten-api.service";
import { TermineApiService } from "../../../services/api/termine-api.service";
import { ExportService } from "../../../services/export.service";
import { NotenListDatasource } from "src/app/utilities/_list-datasources/noten-list-datasource.class";
import { NotenAutoCompleteConfigiguration } from "src/app/utilities/_autocomplete-configurations/noten-autocomplete-config.class";
import { AppConfigService } from "src/app/services/app-config.service";

@Component({
selector: "app-ausrueckung-single",
templateUrl: "./ausrueckung-single.component.html",
styleUrls: ["./ausrueckung-single.component.scss"],
selector: "app-termin-details",
templateUrl: "./termin-details.component.html",
providers: [NotenListDatasource],
})
export class AusrueckungSingleComponent implements OnInit {
export class TerminDetailsComponent implements OnInit {
termin: Termin;

loading: boolean = true;
notenLoading: boolean = true;

gespielteNoten: Noten[] = [];
selectedNoten: Noten;
searchNotenResult: Noten[];

mitglieder: Mitglied[];
Expand All @@ -40,9 +44,14 @@ export class AusrueckungSingleComponent implements OnInit {

@ViewChild("exportMenu") exportMenu: Menu;

public readonly notenAutoCompleteConfig =
new NotenAutoCompleteConfigiguration();

constructor(
public notenDatasource: NotenListDatasource,
public configService: AppConfigService,
private route: ActivatedRoute,
private ausrueckungenService: TermineApiService,
private termineApiService: TermineApiService,
private infoService: InfoService,
private notenService: NotenApiService,
private calExport: ExportService,
Expand All @@ -54,7 +63,7 @@ export class AusrueckungSingleComponent implements OnInit {

ngOnInit(): void {
this.route.params.subscribe((e) => {
this.ausrueckungenService.getById(e.id).subscribe(
this.termineApiService.getById(e.id).subscribe(
(ausrueckung) => {
this.termin = ausrueckung;
this.updateToolbarButtons();
Expand Down Expand Up @@ -90,15 +99,18 @@ export class AusrueckungSingleComponent implements OnInit {
}

attachNoten(noten: Noten) {
if (!noten) return;
this.notenLoading = true;
this.notenService
.attachNotenToAusrueckung(noten.id, this.termin.id)
.subscribe({
next: (res) => {
this.gespielteNoten = [noten, ...this.gespielteNoten];
this.selectedNoten = null;
this.notenLoading = false;
this.getGespielteNoten();
},
error: (error) => {
this.selectedNoten = null;
this.infoService.error(error);
this.notenLoading = false;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.ser
providers: [TermineListDatasource, TermineListConfig],
})
export class TermineOverviewComponent {
ausrueckungenArray: Termin[];
ausrueckungFilterInput: GetListInput<Termin>;
filteredRows: Termin[];
// ausrueckungFilterInput: GetListInput<Termin>;
// filteredRows: Termin[];

actualDate = moment(new Date()).format("YYYY-MM-DD");
filterFromDate = moment(new Date())
.subtract(1, "week")
.format("YYYY-MM-DD");
// actualDate = moment(new Date()).format("YYYY-MM-DD");
// filterFromDate = moment(new Date())
// .subtract(1, "week")
// .format("YYYY-MM-DD");

@ViewChild("exportMenu") exportMenu: Menu;

selectedRow: any;
public selectedRow: Termin;
public hasAktionenPermissions: boolean = false;

public rowMenuItems: MenuItem[] = [
Expand Down Expand Up @@ -104,11 +103,11 @@ export class TermineOverviewComponent {
PermissionMap.TERMIN_GRUPPENLEITER_SAVE,
],
},
{
icon: "pi pi-download",
click: ($event) => this.exportMenu.show($event),
label: "Export",
},
// {
// icon: "pi pi-download",
// click: ($event) => this.exportMenu.show($event),
// label: "Export",
// },
];
}

Expand All @@ -121,7 +120,6 @@ export class TermineOverviewComponent {

this.termineApiService.create(duplicateAusrueckung).subscribe({
next: (res) => {
this.ausrueckungenArray = [res, ...this.ausrueckungenArray];
this.navigateEditor(res);
this.infoService.success("Termin dupliziert!");
},
Expand Down Expand Up @@ -158,23 +156,23 @@ export class TermineOverviewComponent {
{ title: "Spielbeginn", dataKey: "vonZeit" },
{ title: "Infos", dataKey: "infosMusiker" },
];
const rows = this.filteredRows.map((e) => {
const ausr = { ...e };
ausr.status = _.startCase(ausr.status);
ausr.vonDatum = this.mkjDatePipe.transform(
ausr.vonDatum,
"E d. MMM YYYY"
);
if (e.gruppe?.name) {
ausr.name = ausr.name + " (" + e.gruppe.name + ")";
}
return ausr;
});
// const rows = this.filteredRows.map((e) => {
// const ausr = { ...e };
// ausr.status = _.startCase(ausr.status);
// ausr.vonDatum = this.mkjDatePipe.transform(
// ausr.vonDatum,
// "E d. MMM YYYY"
// );
// if (e.gruppe?.name) {
// ausr.name = ausr.name + " (" + e.gruppe.name + ")";
// }
// return ausr;
// });

this.exportService.savePDF(columns, rows, "Termine");
// this.exportService.savePDF(columns, rows, "Termine");
}

public exportExcel() {
this.exportService.exportExcel(this.filteredRows, "Ausrückungen");
// this.exportService.exportExcel(this.filteredRows, "Ausrückungen");
}
}
4 changes: 2 additions & 2 deletions src/app/services/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export class MenuService implements OnDestroy {
{
label: "Terminübersicht",
icon: "pi pi-fw pi-calendar",
routerLink: "ausrueckungen/aktuell",
routerLink: "termine/liste",
},
{
label: "Kalenderabo",
icon: "pi pi-fw pi-calendar",
routerLink: "ausrueckungen/kalenderabo",
routerLink: "termine/kalenderabo",
},
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<span class="p-float-label" [class.p-input-icon-right]="loading">
<span class="p-float-label" [class.p-input-icon-left]="loading">
<i *ngIf="loading" class="pi pi-spin pi-spinner"></i>
<p-autoComplete
[(ngModel)]="internalModel"
Expand Down
4 changes: 2 additions & 2 deletions src/configurations/changeLogVersion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const MkjAppVersion = "0.9.1 - BETA";
export const MkjAppVersion = "0.9.2 - BETA";

export interface MkjAppChangeLog {
date: string;
Expand All @@ -9,7 +9,7 @@ export interface MkjAppChangeLog {
export const MkjAppChangeLog: MkjAppChangeLog[] = [
{
date: "01.01.2024",
version: "0.9.1 - BETA",
version: "0.9.2 - BETA",
changes: {
Environments:
"Die App kann nun automatisiert für verschiedene Umgebungen/Vereine/Bands ausgeliefert werden.",
Expand Down

0 comments on commit 1838d88

Please sign in to comment.