+
+ Datum |
+ {{element.rawAccountEntry.created_at | date}} |
+
Beschreibung |
- {{element.description}} |
+ {{element.rawAccountEntry.description}} |
Betrag |
- {{element.amount | number:'1.2-2'}} € |
+ {{element.rawAccountEntry.amount | number:'1.2-2'}} € |
-
- Datum |
- {{element.created_at | date}} |
+
+ Kategorie |
+ {{element.accountEntryCategory}} |
+
+
+ BK relevant |
+ {{element.overheadRelevant}} |
diff --git a/ui/hv2-ui/src/app/account/account.component.ts b/ui/hv2-ui/src/app/account/account.component.ts
index 5d290d9..cd8f1d8 100644
--- a/ui/hv2-ui/src/app/account/account.component.ts
+++ b/ui/hv2-ui/src/app/account/account.component.ts
@@ -1,12 +1,21 @@
import { Component, Input, OnInit, OnChanges, ViewChild } from '@angular/core';
import { MatButton } from '@angular/material/button';
import { MatTableDataSource } from '@angular/material/table';
-import { AccountEntryService, AccountService } from '../data-object-service';
-import { Account, AccountEntry, NULL_AccountEntry } from '../data-objects';
+import { AccountEntryCategoryService, AccountEntryService, AccountService } from '../data-object-service';
+import { Account, AccountEntry, AccountEntryCategory, NULL_AccountEntry } from '../data-objects';
import { ExtApiService } from '../ext-data-object-service';
import { Saldo } from '../ext-data-objects';
import { MessageService } from '../message.service';
+
+
+interface DN_AccountEntry {
+ rawAccountEntry: AccountEntry
+ accountEntryCategory: string
+ overheadRelevant: boolean
+}
+
+
@Component({
selector: 'app-account',
templateUrl: './account.component.html',
@@ -15,16 +24,20 @@ import { MessageService } from '../message.service';
export class AccountComponent implements OnInit {
@Input() selectedAccountId: number
+ @Input() shallBeRentPayment: boolean
@ViewChild('addAccountEntryButton') addAccountEntryButton: MatButton
collapse: boolean = false
account: Account
- accountEntries: AccountEntry[]
- accountEntriesDataSource: MatTableDataSource
- accountEntriesDisplayedColumns: string[] = [ "description", "amount", "createdAt" ]
+ accountEntries: DN_AccountEntry[]
+ accountEntriesDataSource: MatTableDataSource
+ accountEntriesDisplayedColumns: string[] = [ "description", "amount", "createdAt", "category", "overhead_relevant" ]
saldo: Saldo
+ accountEntryCategories: AccountEntryCategory[]
+ accountEntryCategoriesMap: Map
+ accountEntryCategoriesInverseMap: Map
newAccountEntry: AccountEntry = NULL_AccountEntry
@@ -33,6 +46,7 @@ export class AccountComponent implements OnInit {
private accountService: AccountService,
private accountEntryService: AccountEntryService,
private extApiService: ExtApiService,
+ private accountEntryCategoryService: AccountEntryCategoryService,
private messageService: MessageService
) { }
@@ -51,12 +65,23 @@ export class AccountComponent implements OnInit {
async getAccountEntries(): Promise {
try {
- this.accountEntries = await this.accountEntryService.getAccountEntrysByAccount(this.selectedAccountId)
- this.accountEntries.reverse()
- this.messageService.add(`AccountEntries: ${JSON.stringify(this.accountEntries, undefined, 4)}`)
- this.accountEntriesDataSource = new MatTableDataSource(this.accountEntries)
+ const rawAccountEntries = await this.accountEntryService.getAccountEntrysByAccount(this.selectedAccountId)
+ rawAccountEntries.reverse()
+ this.messageService.add(`AccountEntries: ${JSON.stringify(rawAccountEntries, undefined, 4)}`)
+ this.accountEntries = []
+ for (let f of rawAccountEntries) {
+ this.accountEntries.push({
+ rawAccountEntry: f,
+ accountEntryCategory: this.accountEntryCategoriesMap.get(f.account_entry_category).description,
+ overheadRelevant: this.accountEntryCategoriesMap.get(f.account_entry_category).overhead_relevant
+ })
+ }
+
+ this.accountEntriesDataSource = new MatTableDataSource(this.accountEntries)
this.saldo = await this.extApiService.getAccountSaldo(this.selectedAccountId)
} catch (err) {
+ throw err
+
this.messageService.add(`Error in getAccountEntries: ${JSON.stringify(err, undefined, 4)}`)
}
}
@@ -68,7 +93,7 @@ export class AccountComponent implements OnInit {
this.messageService.add(`addAccountEntry: ${ JSON.stringify(this.newAccountEntry, undefined, 4) }`)
this.newAccountEntry = await this.accountEntryService.postAccountEntry(this.newAccountEntry)
this.messageService.add(`New accountEntry created: ${this.newAccountEntry.id}`)
- this.newAccountEntry = { 'account': this.account.id, 'amount': undefined, 'created_at': '', 'description': '', 'id': 0 }
+ this.newAccountEntry = { 'account': this.account.id, 'amount': undefined, 'created_at': '', 'description': '', 'id': 0, 'account_entry_category': 0 }
this.getAccountEntries()
} catch (err) {
this.messageService.add(`Error in addAccountEntry: ${JSON.stringify(err, undefined, 4)}`)
@@ -77,14 +102,38 @@ export class AccountComponent implements OnInit {
}
}
- ngOnInit(): void {
- this.messageService.add(`AccountComponent.ngOnInit, account: ${this.selectedAccountId}`)
+ async getAccountEntryCategories(): Promise {
+ try {
+ this.accountEntryCategories = await this.accountEntryCategoryService.getAccountEntryCategorys()
+ this.accountEntryCategoriesMap = new Map()
+ this.accountEntryCategoriesInverseMap = new Map()
+ for (let p of this.accountEntryCategories) {
+ this.accountEntryCategoriesMap.set(p.id, p)
+ this.accountEntryCategoriesInverseMap.set(p.description, p)
+ }
+
+ this.messageService.add(`getAccountEntryCategories: ${JSON.stringify(this.accountEntryCategories, undefined, 4)}`)
+ } catch (err) {
+ this.messageService.add(`Error in getAccountEntryCategories: ${JSON.stringify(err, undefined, 4)}`)
+ }
+ }
+
+ private async init(): Promise {
+ this.messageService.add(`AccountComponent.init, account: ${this.selectedAccountId}`)
this.getAccount()
+ await this.getAccountEntryCategories()
+ if (this.shallBeRentPayment) {
+ this.messageService.add('shall be rentpayment')
+ this.newAccountEntry.account_entry_category = this.accountEntryCategoriesInverseMap.get('Mietzahlung').id
+ }
+ }
+
+ ngOnInit(): void {
+ this.init()
}
ngOnChanges(): void {
- this.messageService.add(`AccountComponent.ngOnChanges, account: ${this.selectedAccountId}`)
- this.getAccount()
+ this.init()
}
}
diff --git a/ui/hv2-ui/src/app/data-object-service.ts b/ui/hv2-ui/src/app/data-object-service.ts
index b70902c..db4c594 100644
--- a/ui/hv2-ui/src/app/data-object-service.ts
+++ b/ui/hv2-ui/src/app/data-object-service.ts
@@ -24,6 +24,7 @@ import { CommercialPremise } from './data-objects';
import { Tenancy } from './data-objects';
import { Fee } from './data-objects';
import { TenancyFeeMapping } from './data-objects';
+import { AccountEntryCategory } from './data-objects';
import { AccountEntry } from './data-objects';
import { Note } from './data-objects';
@@ -421,6 +422,31 @@ export class TenancyFeeMappingService {
}
+}
+
+@Injectable({ providedIn: 'root' })
+export class AccountEntryCategoryService {
+ constructor(private messageService: MessageService, private http: HttpClient) { }
+
+ async getAccountEntryCategorys(): Promise {
+ this.messageService.add(`AccountEntryCategoryService: get data`);
+ return this.http.get(`${serviceBaseUrl}/v1/account_entry_categorys`).toPromise()
+ }
+
+ async getAccountEntryCategory(id: number): Promise {
+ this.messageService.add(`AccountEntryCategoryService: get data for ${id}`);
+ return this.http.get(`${serviceBaseUrl}/v1/account_entry_categorys/${id}`).toPromise()
+ }
+
+ async postAccountEntryCategory(item: AccountEntryCategory): Promise {
+ let itemStr: string = JSON.stringify(item, undefined, 4)
+ this.messageService.add(`AccountEntryCategoryService: post data for ${itemStr}`);
+ return this.http.post(`${serviceBaseUrl}/v1/account_entry_categorys`, item).toPromise()
+ }
+
+
+
+
}
@Injectable({ providedIn: 'root' })
@@ -450,6 +476,11 @@ export class AccountEntryService {
return this.http.get(`${serviceBaseUrl}/v1/account_entrys/account/${id}`).toPromise()
}
+ async getAccountEntrysByAccountEntryCategory(id: number): Promise {
+ this.messageService.add(`AccountEntryService: get data by AccountEntryCategory ${id}`);
+ return this.http.get(`${serviceBaseUrl}/v1/account_entrys/account_entry_category/${id}`).toPromise()
+ }
+
}
diff --git a/ui/hv2-ui/src/app/data-objects.ts b/ui/hv2-ui/src/app/data-objects.ts
index db5ed57..d8fa3fc 100644
--- a/ui/hv2-ui/src/app/data-objects.ts
+++ b/ui/hv2-ui/src/app/data-objects.ts
@@ -173,12 +173,24 @@ export const NULL_TenancyFeeMapping: TenancyFeeMapping = {
,fee: undefined
}
+export interface AccountEntryCategory {
+ id: number
+ description: string
+ overhead_relevant: boolean
+}
+export const NULL_AccountEntryCategory: AccountEntryCategory = {
+ id: 0
+ ,description: ''
+ ,overhead_relevant: false
+}
+
export interface AccountEntry {
id: number
description: string
account: number
created_at: string
amount: number
+ account_entry_category: number
}
export const NULL_AccountEntry: AccountEntry = {
id: 0
@@ -186,6 +198,7 @@ export const NULL_AccountEntry: AccountEntry = {
,account: undefined
,created_at: ''
,amount: undefined
+ ,account_entry_category: undefined
}
export interface Note {
diff --git a/ui/hv2-ui/src/app/data-objects.ts.tmpl b/ui/hv2-ui/src/app/data-objects.ts.tmpl
index 1fce557..9ee519c 100644
--- a/ui/hv2-ui/src/app/data-objects.ts.tmpl
+++ b/ui/hv2-ui/src/app/data-objects.ts.tmpl
@@ -17,6 +17,8 @@ export const NULL_$JsNameConverter($table.name): $JsNameConverter($table.name) =
''
#else if $column.jstype == "number"
undefined
+#else if $column.jstype == "boolean"
+ false
#end if
#end for
}
diff --git a/ui/hv2-ui/src/app/flat-details/flat-details.component.html b/ui/hv2-ui/src/app/flat-details/flat-details.component.html
index 2eed563..d273646 100644
--- a/ui/hv2-ui/src/app/flat-details/flat-details.component.html
+++ b/ui/hv2-ui/src/app/flat-details/flat-details.component.html
@@ -25,11 +25,11 @@
Fläche
-
+
Wohnungsnummer
-
+
diff --git a/ui/hv2-ui/src/app/flat-details/flat-details.component.ts b/ui/hv2-ui/src/app/flat-details/flat-details.component.ts
index f7e7ac2..61ead57 100644
--- a/ui/hv2-ui/src/app/flat-details/flat-details.component.ts
+++ b/ui/hv2-ui/src/app/flat-details/flat-details.component.ts
@@ -4,7 +4,7 @@ import { MatSelect } from '@angular/material/select';
import { MatTableDataSource } from '@angular/material/table';
import { ActivatedRoute, Router } from '@angular/router';
import { FlatService, OverheadAdvanceFlatMappingService, OverheadAdvanceService, PremiseService } from '../data-object-service';
-import { Flat, OverheadAdvance, OverheadAdvanceFlatMapping, Premise } from '../data-objects';
+import { Flat, NULL_Flat, NULL_Premise, OverheadAdvance, OverheadAdvanceFlatMapping, Premise } from '../data-objects';
import { ExtApiService } from '../ext-data-object-service';
import { MessageService } from '../message.service';
@@ -15,21 +15,9 @@ import { MessageService } from '../message.service';
})
export class FlatDetailsComponent implements OnInit {
- flat: Flat = {
- id: 0,
- description: '',
- premise: 0,
- area: 0.0,
- flat_no: 0
- }
+ flat: Flat = NULL_Flat
- premise: Premise = {
- id: 0,
- description: '',
- street: '',
- zip: '',
- city: ''
- }
+ premise: Premise = NULL_Premise
premises: Premise[]
mappedOverheadAdvances: OverheadAdvance[]
diff --git a/ui/hv2-ui/src/app/my-flats/my-flats.component.css b/ui/hv2-ui/src/app/my-flats/my-flats.component.css
index 732345b..e69de29 100644
--- a/ui/hv2-ui/src/app/my-flats/my-flats.component.css
+++ b/ui/hv2-ui/src/app/my-flats/my-flats.component.css
@@ -1,3 +0,0 @@
-table {
- width: 75%;
-}
diff --git a/ui/hv2-ui/src/app/my-flats/my-flats.component.html b/ui/hv2-ui/src/app/my-flats/my-flats.component.html
index b49aa55..bb3bc55 100644
--- a/ui/hv2-ui/src/app/my-flats/my-flats.component.html
+++ b/ui/hv2-ui/src/app/my-flats/my-flats.component.html
@@ -20,7 +20,7 @@
Wohnfläche |
- {{element.flat.area}} |
+ {{element.flat.area | number:'1.2-2'}} |
Wohnungsnummer |
diff --git a/ui/hv2-ui/src/app/my-parkings/my-parkings.component.css b/ui/hv2-ui/src/app/my-parkings/my-parkings.component.css
index 732345b..e69de29 100644
--- a/ui/hv2-ui/src/app/my-parkings/my-parkings.component.css
+++ b/ui/hv2-ui/src/app/my-parkings/my-parkings.component.css
@@ -1,3 +0,0 @@
-table {
- width: 75%;
-}
diff --git a/ui/hv2-ui/src/app/my-premises/my-premises.component.css b/ui/hv2-ui/src/app/my-premises/my-premises.component.css
index 469ba71..e69de29 100644
--- a/ui/hv2-ui/src/app/my-premises/my-premises.component.css
+++ b/ui/hv2-ui/src/app/my-premises/my-premises.component.css
@@ -1,8 +0,0 @@
-table {
- width: 75%;
-}
-
-.spacer {
- flex: 1 1 auto;
-}
-
\ No newline at end of file
diff --git a/ui/hv2-ui/src/app/my-tenants/my-tenants.component.css b/ui/hv2-ui/src/app/my-tenants/my-tenants.component.css
index 469ba71..e69de29 100644
--- a/ui/hv2-ui/src/app/my-tenants/my-tenants.component.css
+++ b/ui/hv2-ui/src/app/my-tenants/my-tenants.component.css
@@ -1,8 +0,0 @@
-table {
- width: 75%;
-}
-
-.spacer {
- flex: 1 1 auto;
-}
-
\ No newline at end of file
diff --git a/ui/hv2-ui/src/app/navigation/navigation.component.css b/ui/hv2-ui/src/app/navigation/navigation.component.css
index 214606d..c278346 100644
--- a/ui/hv2-ui/src/app/navigation/navigation.component.css
+++ b/ui/hv2-ui/src/app/navigation/navigation.component.css
@@ -16,10 +16,6 @@
z-index: 1;
}
-.spacer {
- flex: 1 1 auto;
-}
-
.gittagversion {
font-size: x-small;
margin-right: 5em;
diff --git a/ui/hv2-ui/src/app/note/note.component.css b/ui/hv2-ui/src/app/note/note.component.css
index c047311..9e93355 100644
--- a/ui/hv2-ui/src/app/note/note.component.css
+++ b/ui/hv2-ui/src/app/note/note.component.css
@@ -1,11 +1,3 @@
-table {
- width: 75%;
-}
-
-.spacer {
- flex: 1 1 auto;
-}
-
#addEntryfield {
margin-right: 15px;
}
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
index 469ba71..e69de29 100644
--- 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
@@ -1,8 +0,0 @@
-table {
- width: 75%;
-}
-
-.spacer {
- flex: 1 1 auto;
-}
-
\ No newline at end of file
diff --git a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.css b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.css
index ece0220..670ba54 100644
--- a/ui/hv2-ui/src/app/tenant-details/tenant-details.component.css
+++ b/ui/hv2-ui/src/app/tenant-details/tenant-details.component.css
@@ -1,11 +1,3 @@
-table {
- width: 75%;
-}
-
-.spacer {
- flex: 1 1 auto;
-}
-
#setenddatefield {
margin-right: 15px;
}
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 44474ab..6bc34f5 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
@@ -208,6 +208,6 @@
-
+
diff --git a/ui/hv2-ui/src/styles.css b/ui/hv2-ui/src/styles.css
index 7be00f3..7a61b43 100644
--- a/ui/hv2-ui/src/styles.css
+++ b/ui/hv2-ui/src/styles.css
@@ -3,7 +3,16 @@
html, body { height: 100%; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
+table {
+ width: 75%;
+ border-spacing: 20px;
+}
+
+.spacer {
+ flex: 1 1 auto;
+}
+
.defaultCard {
margin: 5px;
}
\ No newline at end of file