diff --git a/ui/hv2-ui/src/app/account/account.component.css b/ui/hv2-ui/src/app/account/account.component.css new file mode 100644 index 0000000..3e7f76f --- /dev/null +++ b/ui/hv2-ui/src/app/account/account.component.css @@ -0,0 +1,23 @@ +table { + width: 75%; +} + +.spacer { + flex: 1 1 auto; +} + +#addEntryfield { + margin-right: 15px; +} + +#divider { + margin-top: 20px; +} + +#firstblock { + margin-bottom: 20px; +} + +#secondblock { + margin-top: 20px; +} \ No newline at end of file diff --git a/ui/hv2-ui/src/app/account/account.component.html b/ui/hv2-ui/src/app/account/account.component.html new file mode 100644 index 0000000..e61aecc --- /dev/null +++ b/ui/hv2-ui/src/app/account/account.component.html @@ -0,0 +1,59 @@ + + + + {{account?.description}} ({{account?.id}}) + + + + + + + + Kontoübersicht + + + + +
+
+ + Datum + + + + + + Betrag (€) + + + + Beschreibung + + + +
+
+
+ + + + + + + + + + + + + + + +
Beschreibung{{element.description}}Betrag{{element.amount}} €Datum{{element.created_at}}
+
+
+
+ +
+
diff --git a/ui/hv2-ui/src/app/account/account.component.spec.ts b/ui/hv2-ui/src/app/account/account.component.spec.ts new file mode 100644 index 0000000..bb03b11 --- /dev/null +++ b/ui/hv2-ui/src/app/account/account.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AccountComponent } from './account.component'; + +describe('AccountComponent', () => { + let component: AccountComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AccountComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(AccountComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/hv2-ui/src/app/account/account.component.ts b/ui/hv2-ui/src/app/account/account.component.ts new file mode 100644 index 0000000..d18c7d1 --- /dev/null +++ b/ui/hv2-ui/src/app/account/account.component.ts @@ -0,0 +1,54 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { MatTableDataSource } from '@angular/material/table'; +import { AccountEntryService, AccountService } from '../data-object-service'; +import { Account, AccountEntry, NULL_AccountEntry } from '../data-objects'; +import { MessageService } from '../message.service'; + +@Component({ + selector: 'app-account', + templateUrl: './account.component.html', + styleUrls: ['./account.component.css'] +}) +export class AccountComponent implements OnInit { + + @Input() selectedAccountId: number + + account: Account + accountEntries: AccountEntry[] + accountEntriesDataSource: MatTableDataSource + accountEntriesDisplayedColumns: string[] = [ "description", "amount", "createdAt" ] + + newAccountEntry: AccountEntry = NULL_AccountEntry + + + constructor( + private accountService: AccountService, + private accountEntryService: AccountEntryService, + private messageService: MessageService + ) { } + + async getAccountAndEntries(): Promise { + try { + if (this.selectedAccountId) { + this.messageService.add(`Trying to load account ${this.selectedAccountId} and entries`) + this.account = await this.accountService.getAccount(this.selectedAccountId) + this.messageService.add(`Account: ${JSON.stringify(this.account, undefined, 4)}`) + this.accountEntries = await this.accountEntryService.getAccountEntrysByAccount(this.selectedAccountId) + this.messageService.add(`AccountEntries: ${JSON.stringify(this.accountEntries, undefined, 4)}`) + this.accountEntriesDataSource = new MatTableDataSource(this.accountEntries) + } + } catch (err) { + this.messageService.add(`Error in getAccountAndEntries: ${JSON.stringify(err, undefined, 4)}`) + } + } + + addAccountEntry() { + + } + + ngOnInit(): void { + this.messageService.add(`AccountComponent.ngOnInit, account: ${this.selectedAccountId}`) + this.getAccountAndEntries() + } + +} diff --git a/ui/hv2-ui/src/app/app.module.ts b/ui/hv2-ui/src/app/app.module.ts index 358d485..a64ed18 100644 --- a/ui/hv2-ui/src/app/app.module.ts +++ b/ui/hv2-ui/src/app/app.module.ts @@ -40,7 +40,8 @@ import { MatDatepickerModule } from '@angular/material/datepicker' import { MatNativeDateModule } from '@angular/material/core'; import { FeeListComponent } from './fee-list/fee-list.component'; import { FeeDetailsComponent } from './fee-details/fee-details.component'; -import { MatExpansionModule } from '@angular/material/expansion' +import { MatExpansionModule } from '@angular/material/expansion'; +import { AccountComponent } from './account/account.component' @NgModule({ declarations: [ @@ -63,7 +64,8 @@ import { MatExpansionModule } from '@angular/material/expansion' OverheadAdvanceListComponent, OverheadAdvanceDetailsComponent, FeeListComponent, - FeeDetailsComponent + FeeDetailsComponent, + AccountComponent ], imports: [ BrowserModule, diff --git a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.html b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.html index 8d3ab4e..f7e4bf9 100644 --- a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.html +++ b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.html @@ -173,7 +173,7 @@ Typ - {{element.fee_type}} € + {{element.fee_type}} Beginn @@ -203,4 +203,6 @@ + + diff --git a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts index dd48160..897787a 100644 --- a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts +++ b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts @@ -23,6 +23,7 @@ interface DN_Tenancy { export class TenantDetailsComponent implements OnInit { tenant: Tenant = NULL_Tenant + tenantId: number account: Account = NULL_Account @@ -64,6 +65,7 @@ export class TenantDetailsComponent implements OnInit { try { const id = +this.route.snapshot.paramMap.get('id') if (id != 0) { + this.tenantId = id this.tenant = await this.tenantService.getTenant(id) this.account = await this.accountService.getAccount(this.tenant.account) this.getTenancies()