This commit is contained in:
2021-10-31 21:47:53 +01:00
parent 8c4dbe7d71
commit 2b883aee02
9 changed files with 101 additions and 8 deletions

View File

@ -8,7 +8,7 @@
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Kategorie</mat-label>
<mat-select [(ngModel)]="newAccountEntry.account_entry_category" name="category" disabled="shallBeRentPayment">
<mat-select [(ngModel)]="newAccountEntry.account_entry_category" name="category" [disabled]="shallBeRentPayment">
<mat-option *ngFor="let p of accountEntryCategories" [value]="p.id">{{p.description}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -1,5 +1,5 @@
export const serviceBaseUrl = "https://api.hv.nober.de";
// export const serviceBaseUrl = "https://api.hv.nober.de";
// export const serviceBaseUrl = "http://172.16.10.38:5000";
// export const serviceBaseUrl = "http://localhost:8080"
export const serviceBaseUrl = "http://localhost:8080"
export const authserviceBaseUrl = "https://authservice.hottis.de"
export const applicationId = "hv2"

View File

@ -6,7 +6,7 @@ import { MessageService } from './message.service';
import { serviceBaseUrl } from './config';
import { Fee, OverheadAdvance } from './data-objects';
import { Account, Fee, OverheadAdvance } from './data-objects';
import { Saldo, Tenant_with_Saldo } from './ext-data-objects';
@ -19,6 +19,11 @@ export class ExtApiService {
return this.http.get<OverheadAdvance[]>(`${serviceBaseUrl}/v1/overhead_advances/flat/${id}`).toPromise()
}
async getAccountByDescription(description: string): Promise<Account> {
this.messageService.add(`ExtApiService: get account by description ${description}`);
return this.http.get<Account>(`${serviceBaseUrl}/v1/accounts/bydescription/${description}`).toPromise()
}
async getFeeByTenancies(id: number): Promise<Fee[]> {
this.messageService.add(`ExtApiService: get fees by flat ${id}`);
return this.http.get<Fee[]>(`${serviceBaseUrl}/v1/fees/tenancy/${id}`).toPromise()

View File

@ -1 +1,12 @@
<p>ledger works!</p>
<mat-card class="defaultCard">
<mat-card-header>
<mat-card-title>
Buchführung
</mat-card-title>
</mat-card-header>
<mat-card-content>
<app-account [selectedAccountId]="accountId" [shallBeRentPayment]="false"></app-account>
</mat-card-content>
</mat-card>

View File

@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { AccountService } from '../data-object-service';
import { Account } from '../data-objects';
import { ExtApiService } from '../ext-data-object-service';
import { MessageService } from '../message.service';
@Component({
selector: 'app-ledger',
@ -7,9 +11,27 @@ import { Component, OnInit } from '@angular/core';
})
export class LedgerComponent implements OnInit {
constructor() { }
account: Account
accountId: number
ngOnInit(): void {
constructor(
private extApiService: ExtApiService,
private messageService: MessageService
) { }
async getAccount(): Promise<void> {
try {
this.messageService.add("Trying to load ledger account")
this.account = await this.extApiService.getAccountByDescription('Ledger')
this.messageService.add("Account loaded")
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
}
async ngOnInit(): Promise<void> {
await this.getAccount()
this.accountId = this.account.id
}
}