diff --git a/hv-ui/src/app/app.component.html b/hv-ui/src/app/app.component.html index df17cd8..7ed031e 100644 --- a/hv-ui/src/app/app.component.html +++ b/hv-ui/src/app/app.component.html @@ -1,8 +1,3 @@ -

{{title}}

- - - - \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/hv-ui/src/app/app.module.ts b/hv-ui/src/app/app.module.ts index 0c66718..a62e5c6 100644 --- a/hv-ui/src/app/app.module.ts +++ b/hv-ui/src/app/app.module.ts @@ -11,6 +11,21 @@ import { WohnungenComponent } from './wohnungen/wohnungen.component'; import { MieterDetailComponent } from './mieter-detail/mieter-detail.component'; import { FormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { NavigationComponent } from './navigation/navigation.component'; +import { LayoutModule } from '@angular/cdk/layout'; +import { MatToolbarModule } from '@angular/material/toolbar'; +import { MatButtonModule } from '@angular/material/button'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatIconModule } from '@angular/material/icon'; +import { MatListModule } from '@angular/material/list'; +import { MatTableModule } from '@angular/material/table'; +import { MatPaginatorModule } from '@angular/material/paginator'; +import { MatSortModule } from '@angular/material/sort'; +import { MatCardModule } from '@angular/material/card'; +import { MatGridListModule } from '@angular/material/grid-list' +import { MatFormFieldModule } from '@angular/material/form-field' +import { MatDatepickerModule } from '@angular/material/datepicker' +import { MatInputModule } from '@angular/material/input' @NgModule({ declarations: [ @@ -19,14 +34,29 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; ObjekteComponent, MietersComponent, WohnungenComponent, - MieterDetailComponent + MieterDetailComponent, + NavigationComponent ], imports: [ BrowserModule, FormsModule, AppRoutingModule, HttpClientModule, - BrowserAnimationsModule + BrowserAnimationsModule, + LayoutModule, + MatToolbarModule, + MatButtonModule, + MatSidenavModule, + MatIconModule, + MatListModule, + MatTableModule, + MatPaginatorModule, + MatSortModule, + MatCardModule, + MatGridListModule, + MatFormFieldModule, + MatDatepickerModule, + MatInputModule ], providers: [], bootstrap: [AppComponent] diff --git a/hv-ui/src/app/forderung.service.spec.ts b/hv-ui/src/app/forderung.service.spec.ts deleted file mode 100644 index 8d32b83..0000000 --- a/hv-ui/src/app/forderung.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { ForderungService } from './forderung.service'; - -describe('ForderungService', () => { - let service: ForderungService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(ForderungService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/hv-ui/src/app/forderung.service.ts b/hv-ui/src/app/forderung.service.ts deleted file mode 100644 index 2acbe50..0000000 --- a/hv-ui/src/app/forderung.service.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Observable, of } from 'rxjs'; -import { HttpClient, HttpHeaders } from '@angular/common/http'; - -import { Forderung } from './forderung'; -import { MessageService } from './message.service'; -import { serviceBaseUrl } from './config'; - -@Injectable({ - providedIn: 'root' -}) -export class ForderungService { - constructor(private messageService: MessageService, private http: HttpClient) { } - - getForderungenByMieter(mieterId: number): Promise { - this.messageService.add(`ForderungService: fetched forderungen by mieter ${mieterId}`); - return this.http.get(`${serviceBaseUrl}/hv/mieter/${mieterId}/forderungen`).toPromise() - } - - getForderung(id: number): Promise { - this.messageService.add(`ForderungService: fetch forderung id=${id}`); - return this.http.get(`${serviceBaseUrl}/hv/forderung/${id}`).toPromise() - } -} diff --git a/hv-ui/src/app/messages/messages.component.html b/hv-ui/src/app/messages/messages.component.html index d3afd53..7e4368a 100644 --- a/hv-ui/src/app/messages/messages.component.html +++ b/hv-ui/src/app/messages/messages.component.html @@ -1,7 +1,11 @@ -
- -

Messages

- -
{{message}}
- -
\ No newline at end of file +
+ + + Messages + + + +
{{message}}
+
+
+
\ No newline at end of file diff --git a/hv-ui/src/app/mieter-detail/mieter-detail.component.css b/hv-ui/src/app/mieter-detail/mieter-detail.component.css index e69de29..33642d6 100644 --- a/hv-ui/src/app/mieter-detail/mieter-detail.component.css +++ b/hv-ui/src/app/mieter-detail/mieter-detail.component.css @@ -0,0 +1,36 @@ +.label { + font-weight: bold; + margin-right: 10px; + text-align: left; + width: 50%; +} +.content::after { + content: "\A"; + white-space: pre; +} +.content { + text-align: right; + width: 50%; +} +.details { + width: 30%; +} +table { + width: 100%; +} +#wrapper { + width: 100%; + overflow: auto; + } +#first { + float: left; + width: 35%; +} +#second { + float: left; + width: 20%; +} +#third { + float: left; + width: 35% +} diff --git a/hv-ui/src/app/mieter-detail/mieter-detail.component.html b/hv-ui/src/app/mieter-detail/mieter-detail.component.html index 4dab37c..95bee8d 100644 --- a/hv-ui/src/app/mieter-detail/mieter-detail.component.html +++ b/hv-ui/src/app/mieter-detail/mieter-detail.component.html @@ -1,38 +1,114 @@ -

Mieter: {{mieter.vorname}} {{mieter.nachname}} ({{mieter.id}})

+
+ + + + {{mieter?.vorname}} {{mieter?.nachname}} + + + ID: {{mieter?.id}} + + + +
+ Objekt{{mieter?.objekt_shortname}} ({{mieter?.objekt}}) + Wohnung{{mieter?.wohnung_shortname}} ({{mieter?.wohnung}}) + Anrede{{mieter?.anrede}} + Strasse{{mieter?.strasse}} + PLZ{{mieter?.plz}} + Ort{{mieter?.ort}} + Telefon{{mieter?.telefon}} + Einzug{{mieter?.einzug}} + Auszug{{mieter?.auszug}} +
+
+
- - - - - - - - - - - - -
Objekt:{{mieter.objekt_shortname}} ({{mieter.objekt}})
Wohnung:{{mieter.wohnung_shortname}} ({{mieter.wohnung}})
Vorname:{{mieter.vorname}}
Nachname:{{mieter.nachname}}
Anrede:{{mieter.anrede}}
Strasse:{{mieter.strasse}}
PLZ:{{mieter.plz}}
Ort:{{mieter.ort}}
Telefon:{{mieter.telefon}}
Einzug:{{mieter.einzug}}
Auszug:{{mieter.auszug}}
+ + + + Forderungen und Zahlungen + + + +
+
+ + + Jahr + + + +
+
+
+ Forderungen{{saldo?.forderungen}} + Zahlungen{{saldo?.zahlungen}} + Saldo{{saldo?.saldo}} +
+
+
-
- -
+ + + Datum soll + + + + Datum ist + + + Betrag Zahlung + + + Kommentar + + +
+
+
+
- - - - - - - - - - - - - - - -
Datum sollDatum istForderungZahlungKommentar
{{zahlungForderung.datum_soll}}{{zahlungForderung.datum_ist}}{{zahlungForderung.betrag_forderung}}{{zahlungForderung.betrag_zahlung}}{{zahlungForderung.kommentar}}
\ No newline at end of file + + + + + + Forderungen und Zahlungen - Übersicht + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Datum soll{{element.datum_soll}}Datum ist{{element.datum_ist}}Datum Forderung{{element.betrag_forderung}}Zahlung{{element.betrag_zahlung}}Kommentar{{element.kommentar}}
+
+
+
+
\ No newline at end of file diff --git a/hv-ui/src/app/mieter-detail/mieter-detail.component.ts b/hv-ui/src/app/mieter-detail/mieter-detail.component.ts index 658a3cc..e8b03e8 100644 --- a/hv-ui/src/app/mieter-detail/mieter-detail.component.ts +++ b/hv-ui/src/app/mieter-detail/mieter-detail.component.ts @@ -1,12 +1,15 @@ -import { Component, OnInit } from '@angular/core' +import { Component, Input, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' import { Location } from '@angular/common' import { Mieter } from '../mieter' import { ZahlungForderung } from '../zahlung-forderung' +import { Saldo } from '../saldo' + import { MieterService} from '../mieter.service' import { ZahlungForderungService} from '../zahlung-forderung.service' import { MessageService } from '../message.service' +import { MatTableDataSource } from '@angular/material/table' @Component({ selector: 'app-mieter-detail', @@ -18,7 +21,10 @@ export class MieterDetailComponent implements OnInit { mieter: Mieter year: string zahlungenForderungen : ZahlungForderung[] + saldo: Saldo + displayedColumns: string[] = ["datum_soll", "datum_ist", "betrag_forderung", "betrag_zahlung", "kommentar"] + dataSource: MatTableDataSource constructor( private mieterService: MieterService, @@ -28,27 +34,29 @@ export class MieterDetailComponent implements OnInit { private location: Location ) { } - async getMieter() { + async getMieter(): Promise { const id = +this.route.snapshot.paramMap.get('id') try { this.mieter = await this.mieterService.getMieter(id) - this.zahlungenForderungen = await this.zahlungForderungService.getZahlungenForderungenByMieterAndYear(id, +this.year) + await this.getZahlungenForderungen() } catch (err) { this.messageService.add(JSON.stringify(err, undefined, 4)) } } - async getZahlungenForderungen() { + async getZahlungenForderungen(): Promise { const id = this.mieter?.id ?? 0 try { this.zahlungenForderungen = await this.zahlungForderungService.getZahlungenForderungenByMieterAndYear(id, +this.year) + this.saldo = await this.zahlungForderungService.getSaldoByMieterAndYear(id, +this.year) } catch (err) { this.messageService.add(JSON.stringify(err, undefined, 4)) } } - onYearInput(): void { - this.getZahlungenForderungen() + async onYearInput(): Promise { + await this.getZahlungenForderungen() + this.dataSource = new MatTableDataSource(this.zahlungenForderungen) } async ngOnInit(): Promise { diff --git a/hv-ui/src/app/mieters/mieters.component.html b/hv-ui/src/app/mieters/mieters.component.html index c7e3991..bafc604 100644 --- a/hv-ui/src/app/mieters/mieters.component.html +++ b/hv-ui/src/app/mieters/mieters.component.html @@ -1,3 +1,4 @@ +

Meine Mieter

  • {{mieter.vorname}} {{mieter.nachname}}
+
\ No newline at end of file diff --git a/hv-ui/src/app/navigation/navigation.component.css b/hv-ui/src/app/navigation/navigation.component.css new file mode 100644 index 0000000..f4bad0f --- /dev/null +++ b/hv-ui/src/app/navigation/navigation.component.css @@ -0,0 +1,17 @@ +.sidenav-container { + height: 100%; +} + +.sidenav { + width: 200px; +} + +.sidenav .mat-toolbar { + background: inherit; +} + +.mat-toolbar.mat-primary { + position: sticky; + top: 0; + z-index: 1; +} diff --git a/hv-ui/src/app/navigation/navigation.component.html b/hv-ui/src/app/navigation/navigation.component.html new file mode 100644 index 0000000..b3cf4c4 --- /dev/null +++ b/hv-ui/src/app/navigation/navigation.component.html @@ -0,0 +1,30 @@ +
+ + + Menu + + Meine Objekte + Meine Mieter + + + + + + Hausverwaltung + + + + + + +
\ No newline at end of file diff --git a/hv-ui/src/app/navigation/navigation.component.spec.ts b/hv-ui/src/app/navigation/navigation.component.spec.ts new file mode 100644 index 0000000..cf90c6e --- /dev/null +++ b/hv-ui/src/app/navigation/navigation.component.spec.ts @@ -0,0 +1,40 @@ +import { LayoutModule } from '@angular/cdk/layout'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatListModule } from '@angular/material/list'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatToolbarModule } from '@angular/material/toolbar'; + +import { NavigationComponent } from './navigation.component'; + +describe('NavigationComponent', () => { + let component: NavigationComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [NavigationComponent], + imports: [ + NoopAnimationsModule, + LayoutModule, + MatButtonModule, + MatIconModule, + MatListModule, + MatSidenavModule, + MatToolbarModule, + ] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NavigationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should compile', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/hv-ui/src/app/navigation/navigation.component.ts b/hv-ui/src/app/navigation/navigation.component.ts new file mode 100644 index 0000000..6419fb0 --- /dev/null +++ b/hv-ui/src/app/navigation/navigation.component.ts @@ -0,0 +1,21 @@ +import { Component } from '@angular/core'; +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; +import { Observable } from 'rxjs'; +import { map, shareReplay } from 'rxjs/operators'; + +@Component({ + selector: 'app-navigation', + templateUrl: './navigation.component.html', + styleUrls: ['./navigation.component.css'] +}) +export class NavigationComponent { + + isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) + .pipe( + map(result => result.matches), + shareReplay() + ); + + constructor(private breakpointObserver: BreakpointObserver) {} + +} diff --git a/hv-ui/src/app/objekte/objekte.component.html b/hv-ui/src/app/objekte/objekte.component.html index f91e2e0..fa7ddf3 100644 --- a/hv-ui/src/app/objekte/objekte.component.html +++ b/hv-ui/src/app/objekte/objekte.component.html @@ -1,3 +1,4 @@ +

Meine Objekte

  • {{objekt.shortname}}
+
\ No newline at end of file diff --git a/hv-ui/src/app/saldo.ts b/hv-ui/src/app/saldo.ts new file mode 100644 index 0000000..d56462f --- /dev/null +++ b/hv-ui/src/app/saldo.ts @@ -0,0 +1,5 @@ +export interface Saldo { + forderungen: number + zahlungen: number + saldo: number +} \ No newline at end of file diff --git a/hv-ui/src/app/wohnungen/wohnungen.component.html b/hv-ui/src/app/wohnungen/wohnungen.component.html index 5a64c77..58cea71 100644 --- a/hv-ui/src/app/wohnungen/wohnungen.component.html +++ b/hv-ui/src/app/wohnungen/wohnungen.component.html @@ -1,3 +1,4 @@ +

Meine Wohnungen

Objekt: {{objekt.shortname}}

@@ -8,3 +9,4 @@ {{wohnung.shortname}}: {{wohnung.flaeche}}m² +

\ No newline at end of file diff --git a/hv-ui/src/app/zahlung-forderung.service.ts b/hv-ui/src/app/zahlung-forderung.service.ts index 1654370..f57edbc 100644 --- a/hv-ui/src/app/zahlung-forderung.service.ts +++ b/hv-ui/src/app/zahlung-forderung.service.ts @@ -4,6 +4,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http' import { ZahlungForderung } from './zahlung-forderung' import { Forderung } from './forderung' +import { Saldo } from './saldo' import { MessageService } from './message.service' import { serviceBaseUrl } from './config' @@ -22,4 +23,10 @@ export class ZahlungForderungService { this.messageService.add(`ZahlungForderungService: fetch forderung id=${id}`) return this.http.get(`${serviceBaseUrl}/hv/forderung/${id}`).toPromise() } + + getSaldoByMieterAndYear(mieterId: number, year: number): Promise { + this.messageService.add(`ZahlungForderungService: fetched saldo by mieter ${mieterId} and year ${year}`) + return this.http.get(`${serviceBaseUrl}/hv/mieter/${mieterId}/saldo/${year}`).toPromise() + } + } diff --git a/hv-ui/src/styles.css b/hv-ui/src/styles.css index dda6814..0d16c19 100644 --- a/hv-ui/src/styles.css +++ b/hv-ui/src/styles.css @@ -1,3 +1,8 @@ +/* @import '@angular/material/prebuilt-themes/deeppurple-amber.css'; */ html, body { height: 100%; } body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } + +.defaultCard { + margin: 5px; +} \ No newline at end of file