diff --git a/ui/hv2-ui/src/app/app-routing.module.ts b/ui/hv2-ui/src/app/app-routing.module.ts index 11daa0c..4e43366 100644 --- a/ui/hv2-ui/src/app/app-routing.module.ts +++ b/ui/hv2-ui/src/app/app-routing.module.ts @@ -13,6 +13,8 @@ import { PremiseDetailsComponent } from './premise-details/premise-details.compo import { FlatDetailsComponent } from './flat-details/flat-details.component'; import { ParkingDetailsComponent } from './parking-details/parking-details.component'; import { CommercialUnitDetailsComponent } from './commercial-unit-details/commercial-unit-details.component'; +import { OverheadAdvanceListComponent } from './overhead-advance-list/overhead-advance-list.component'; +import { OverheadAdvanceDetailsComponent } from './overhead-advance-details/overhead-advance-details.component'; const routes: Routes = [ @@ -31,6 +33,9 @@ const routes: Routes = [ { path: 'parking', component: ParkingDetailsComponent, canActivate: [ AuthGuardService ] }, { path: 'commercialunit/:id', component: CommercialUnitDetailsComponent, canActivate: [ AuthGuardService ] }, { path: 'commercialunit', component: CommercialUnitDetailsComponent, canActivate: [ AuthGuardService ] }, + { path: 'overheadadvances', component: OverheadAdvanceListComponent, canActivate: [ AuthGuardService ] }, + { path: 'overheadadvance/:id', component: OverheadAdvanceDetailsComponent, canActivate: [ AuthGuardService ] }, + { path: 'overheadadvance', component: OverheadAdvanceDetailsComponent, canActivate: [ AuthGuardService ] }, { path: 'logout', component: LogoutComponent }, { path: 'login', component: LoginComponent } ] diff --git a/ui/hv2-ui/src/app/app.module.ts b/ui/hv2-ui/src/app/app.module.ts index 3e61716..99aa36e 100644 --- a/ui/hv2-ui/src/app/app.module.ts +++ b/ui/hv2-ui/src/app/app.module.ts @@ -33,7 +33,13 @@ import { PremiseDetailsComponent } from './premise-details/premise-details.compo import { FlatDetailsComponent } from './flat-details/flat-details.component'; import { MatSelectModule } from '@angular/material/select'; import { ParkingDetailsComponent } from './parking-details/parking-details.component'; -import { CommercialUnitDetailsComponent } from './commercial-unit-details/commercial-unit-details.component' +import { CommercialUnitDetailsComponent } from './commercial-unit-details/commercial-unit-details.component'; +import { OverheadAdvanceListComponent } from './overhead-advance-list/overhead-advance-list.component'; +import { OverheadAdvanceDetailsComponent } from './overhead-advance-details/overhead-advance-details.component' +import { MatDatepickerModule } from '@angular/material/datepicker' +import { MatNativeDateModule } from '@angular/material/core'; + + @NgModule({ declarations: [ AppComponent, @@ -51,7 +57,9 @@ import { CommercialUnitDetailsComponent } from './commercial-unit-details/commer PremiseDetailsComponent, FlatDetailsComponent, ParkingDetailsComponent, - CommercialUnitDetailsComponent + CommercialUnitDetailsComponent, + OverheadAdvanceListComponent, + OverheadAdvanceDetailsComponent ], imports: [ BrowserModule, @@ -70,11 +78,14 @@ import { CommercialUnitDetailsComponent } from './commercial-unit-details/commer MatTableModule, MatInputModule, MatFormFieldModule, - MatSelectModule + MatSelectModule, + MatDatepickerModule, + MatNativeDateModule ], providers: [ { provide: HTTP_INTERCEPTORS, useClass: ErrorHandlerInterceptor, multi: true }, - { provide: HTTP_INTERCEPTORS, useClass: AuthHandlerInterceptor, multi: true } + { provide: HTTP_INTERCEPTORS, useClass: AuthHandlerInterceptor, multi: true }, + MatNativeDateModule ], bootstrap: [AppComponent] }) diff --git a/ui/hv2-ui/src/app/navigation/navigation.component.html b/ui/hv2-ui/src/app/navigation/navigation.component.html index d3d15f7..4f76fe5 100644 --- a/ui/hv2-ui/src/app/navigation/navigation.component.html +++ b/ui/hv2-ui/src/app/navigation/navigation.component.html @@ -5,11 +5,15 @@ [opened]="(isHandset$ | async) === false"> Menu - Meine Häuser + Meine Mieter/innen +
Meine Wohnungen Meine Garagen Meine Büros - Meine Mieter/innen +
+ Betriebskostensätze +
+ Meine Häuser diff --git a/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.css b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.css new file mode 100644 index 0000000..e69de29 diff --git a/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.html b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.html new file mode 100644 index 0000000..85d95ee --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.html @@ -0,0 +1,41 @@ +
+ + + + {{overheadAdvance?.description}} + + + ID: {{overheadAdvance?.id}} + + + +
+
+
+ + Beschreibung + + +
+ + Betrag (€) + + +
+ + Beginn + + + + + + Ende + + +
+ +
+
+
+
+
diff --git a/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.spec.ts b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.spec.ts new file mode 100644 index 0000000..d6d1903 --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OverheadAdvanceDetailsComponent } from './overhead-advance-details.component'; + +describe('OverheadAdvanceDetailsComponent', () => { + let component: OverheadAdvanceDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ OverheadAdvanceDetailsComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(OverheadAdvanceDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.ts b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.ts new file mode 100644 index 0000000..655e074 --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-details/overhead-advance-details.component.ts @@ -0,0 +1,56 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatButton } from '@angular/material/button'; +import { ActivatedRoute, Router } from '@angular/router'; +import { OverheadAdvanceService } from '../data-object-service'; +import { NULL_OverheadAdvance, OverheadAdvance } from '../data-objects'; +import { MessageService } from '../message.service'; + +@Component({ + selector: 'app-overhead-advance-details', + templateUrl: './overhead-advance-details.component.html', + styleUrls: ['./overhead-advance-details.component.css'] +}) +export class OverheadAdvanceDetailsComponent implements OnInit { + + @ViewChild('submitButton') submitButton: MatButton + + overheadAdvance: OverheadAdvance = NULL_OverheadAdvance + + constructor( + private overheadAdvanceService: OverheadAdvanceService, + private messageService: MessageService, + private route: ActivatedRoute, + private router: Router + ) { } + + async getOverheadAdvance(): Promise { + try { + const id = +this.route.snapshot.paramMap.get('id') + if (id != 0) { + this.overheadAdvance = await this.overheadAdvanceService.getOverheadAdvance(id) + } + } catch (err) { + this.messageService.add(JSON.stringify(err, undefined, 4)) + } + } + + async saveOverheadAdvance() { + this.submitButton.disabled = true + this.messageService.add("saveOverheadAdvance") + this.messageService.add(JSON.stringify(this.overheadAdvance, undefined, 4)) + if (this.overheadAdvance.id == 0) { + this.messageService.add("about to insert new overheadAdvance") + this.overheadAdvance = await this.overheadAdvanceService.postOverheadAdvance(this.overheadAdvance) + this.messageService.add(`Successfully added overheadAdvance with id ${this.overheadAdvance.id}`) + } else { + this.messageService.add("about to update existing overheadAdvance") + } + this.router.navigate(['/overheadadvances']) + // this.submitButton.disabled = false + } + + + ngOnInit(): void { + } + +} diff --git a/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.css b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.css new file mode 100644 index 0000000..469ba71 --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.css @@ -0,0 +1,8 @@ +table { + width: 75%; +} + +.spacer { + flex: 1 1 auto; +} + \ No newline at end of file diff --git a/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.html b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.html new file mode 100644 index 0000000..b163279 --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.html @@ -0,0 +1,35 @@ +
+ + + + Betriebskostensätze + + Neu anlegen + + + +
+ + + + + + + + + + + + + + + + + + + +
Beschreibung{{element.description}}Betrag{{element.amount}} €Beginn{{element.startdate}}Ende{{element.enddate}}
+
+
+
+
diff --git a/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.spec.ts b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.spec.ts new file mode 100644 index 0000000..77b702a --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OverheadAdvanceListComponent } from './overhead-advance-list.component'; + +describe('OverheadAdvanceListComponent', () => { + let component: OverheadAdvanceListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ OverheadAdvanceListComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(OverheadAdvanceListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.ts b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.ts new file mode 100644 index 0000000..4f0b39f --- /dev/null +++ b/ui/hv2-ui/src/app/overhead-advance-list/overhead-advance-list.component.ts @@ -0,0 +1,41 @@ +import { Component, OnInit } from '@angular/core'; +import { MatTableDataSource } from '@angular/material/table'; +import { OverheadAdvanceService } from '../data-object-service'; +import { OverheadAdvance } from '../data-objects'; +import { MessageService } from '../message.service'; + +@Component({ + selector: 'app-overhead-advance-list', + templateUrl: './overhead-advance-list.component.html', + styleUrls: ['./overhead-advance-list.component.css'] +}) +export class OverheadAdvanceListComponent implements OnInit { + + overheadAdvances: OverheadAdvance[] + dataSource: MatTableDataSource + displayedColumns: string[] = [ "description", "amount", "startdate", "enddate" ] + + constructor( + private overheadAdvanceService: OverheadAdvanceService, + private messageService: MessageService + ) { } + + async getOverheadAdvances(): Promise { + try { + this.messageService.add("Trying to load overheadAdvances") + this.overheadAdvances = await this.overheadAdvanceService.getOverheadAdvances() + this.messageService.add("OverheadAdvances loaded") + + this.dataSource = new MatTableDataSource(this.overheadAdvances) + } catch (err) { + this.messageService.add(`Error in getOverheadAdvances: ${ JSON.stringify(err, undefined, 4) }`) + } + } + + + ngOnInit(): void { + this.messageService.add("OverheadAdvanceListComponent.ngOnInit") + this.getOverheadAdvances() + } + +}