From 1838d88ea2e4a0772f7f7062cb6bcd15bedcaf96 Mon Sep 17 00:00:00 2001 From: dysTOS Date: Thu, 18 Jan 2024 15:30:10 +0100 Subject: [PATCH] refactoring --- src/app/app-routing.module.ts | 16 ++---- src/app/app.main.component.ts | 2 +- src/app/app.module.ts | 8 +-- .../notenmappe-noten-list.component.html | 4 +- .../notenmappe-noten-list.component.ts | 11 ++-- .../ausrueckung-single.component.scss | 1 - .../next-termin/next-termin.component.html | 4 +- .../anwesenheits-liste.component.html | 5 +- .../anwesenheits-liste.component.scss | 0 .../anwesenheits-liste.component.ts | 0 .../teilnahmen-overview.component.html | 0 .../teilnahmen-overview.component.scss | 0 .../teilnahmen-overview.component.ts | 0 .../termin-details.component.html} | 15 ++++-- .../termin-details.component.ts} | 26 ++++++--- .../termine-overview.component.ts | 54 +++++++++---------- src/app/services/menu.service.ts | 4 +- .../mkj-autocomplete.component.html | 2 +- src/configurations/changeLogVersion.ts | 4 +- 19 files changed, 81 insertions(+), 75 deletions(-) delete mode 100644 src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.scss rename src/app/components/{ausrueckungen/ausrueckung-single => termine}/anwesenheits-liste/anwesenheits-liste.component.html (86%) rename src/app/components/{ausrueckungen/ausrueckung-single => termine}/anwesenheits-liste/anwesenheits-liste.component.scss (100%) rename src/app/components/{ausrueckungen/ausrueckung-single => termine}/anwesenheits-liste/anwesenheits-liste.component.ts (100%) rename src/app/components/{ausrueckungen/ausrueckung-single => termine}/teilnahmen-overview/teilnahmen-overview.component.html (100%) rename src/app/components/{ausrueckungen/ausrueckung-single => termine}/teilnahmen-overview/teilnahmen-overview.component.scss (100%) rename src/app/components/{ausrueckungen/ausrueckung-single => termine}/teilnahmen-overview/teilnahmen-overview.component.ts (100%) rename src/app/components/{ausrueckungen/ausrueckung-single/ausrueckung-single.component.html => termine/termin-details/termin-details.component.html} (87%) rename src/app/components/{ausrueckungen/ausrueckung-single/ausrueckung-single.component.ts => termine/termin-details/termin-details.component.ts} (79%) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b82327c..70c0412 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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"; @@ -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], }, @@ -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, @@ -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", }, ], diff --git a/src/app/app.main.component.ts b/src/app/app.main.component.ts index d4c007b..6bb0789 100644 --- a/src/app/app.main.component.ts +++ b/src/app/app.main.component.ts @@ -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; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 52370b5..ca58f71 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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"; @@ -312,7 +312,7 @@ registerLocaleData(localeDe); AppErrorComponent, AppAccessdeniedComponent, MkjListCellComponent, - AusrueckungSingleComponent, + TerminDetailsComponent, MkjDatePipe, MkjDashboardComponent, SignupComponent, diff --git a/src/app/components/archiv/notenmappen/notenmappe-noten-list/notenmappe-noten-list.component.html b/src/app/components/archiv/notenmappen/notenmappe-noten-list/notenmappe-noten-list.component.html index 6ea6a66..3bab79e 100644 --- a/src/app/components/archiv/notenmappen/notenmappe-noten-list/notenmappe-noten-list.component.html +++ b/src/app/components/archiv/notenmappen/notenmappe-noten-list/notenmappe-noten-list.component.html @@ -27,13 +27,13 @@ -
+ diff --git a/src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.html b/src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.html similarity index 86% rename from src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.html rename to src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.html index d4efa53..79bcfc0 100644 --- a/src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.html +++ b/src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.html @@ -1,6 +1,6 @@
@@ -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" > diff --git a/src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.scss b/src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.scss similarity index 100% rename from src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.scss rename to src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.scss diff --git a/src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.ts b/src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.ts similarity index 100% rename from src/app/components/ausrueckungen/ausrueckung-single/anwesenheits-liste/anwesenheits-liste.component.ts rename to src/app/components/termine/anwesenheits-liste/anwesenheits-liste.component.ts diff --git a/src/app/components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component.html b/src/app/components/termine/teilnahmen-overview/teilnahmen-overview.component.html similarity index 100% rename from src/app/components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component.html rename to src/app/components/termine/teilnahmen-overview/teilnahmen-overview.component.html diff --git a/src/app/components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component.scss b/src/app/components/termine/teilnahmen-overview/teilnahmen-overview.component.scss similarity index 100% rename from src/app/components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component.scss rename to src/app/components/termine/teilnahmen-overview/teilnahmen-overview.component.scss diff --git a/src/app/components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component.ts b/src/app/components/termine/teilnahmen-overview/teilnahmen-overview.component.ts similarity index 100% rename from src/app/components/ausrueckungen/ausrueckung-single/teilnahmen-overview/teilnahmen-overview.component.ts rename to src/app/components/termine/teilnahmen-overview/teilnahmen-overview.component.ts diff --git a/src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.html b/src/app/components/termine/termin-details/termin-details.component.html similarity index 87% rename from src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.html rename to src/app/components/termine/termin-details/termin-details.component.html index 8aa43e2..813fa77 100644 --- a/src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.html +++ b/src/app/components/termine/termin-details/termin-details.component.html @@ -65,11 +65,16 @@ responsiveLayout="scroll" styleClass="p-datatable-sm p-datatable-striped" > -
-
+
diff --git a/src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.ts b/src/app/components/termine/termin-details/termin-details.component.ts similarity index 79% rename from src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.ts rename to src/app/components/termine/termin-details/termin-details.component.ts index 8709d58..c8c83f7 100644 --- a/src/app/components/ausrueckungen/ausrueckung-single/ausrueckung-single.component.ts +++ b/src/app/components/termine/termin-details/termin-details.component.ts @@ -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[]; @@ -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, @@ -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(); @@ -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; }, diff --git a/src/app/components/termine/termine-overview/termine-overview.component.ts b/src/app/components/termine/termine-overview/termine-overview.component.ts index 7524db3..8a57ee2 100644 --- a/src/app/components/termine/termine-overview/termine-overview.component.ts +++ b/src/app/components/termine/termine-overview/termine-overview.component.ts @@ -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; - filteredRows: Termin[]; + // ausrueckungFilterInput: GetListInput; + // 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[] = [ @@ -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", + // }, ]; } @@ -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!"); }, @@ -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"); } } diff --git a/src/app/services/menu.service.ts b/src/app/services/menu.service.ts index b12431b..b0fc709 100644 --- a/src/app/services/menu.service.ts +++ b/src/app/services/menu.service.ts @@ -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", }, ], }, diff --git a/src/app/utilities/form-input-components/mkj-autocomplete/mkj-autocomplete.component.html b/src/app/utilities/form-input-components/mkj-autocomplete/mkj-autocomplete.component.html index a996237..61d0320 100644 --- a/src/app/utilities/form-input-components/mkj-autocomplete/mkj-autocomplete.component.html +++ b/src/app/utilities/form-input-components/mkj-autocomplete/mkj-autocomplete.component.html @@ -1,4 +1,4 @@ - +