overhead account stuff
This commit is contained in:
@ -36,6 +36,10 @@ Saldo: {{saldo?.saldo | number:'1.2-2'}} €
|
||||
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.description}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="document_no">
|
||||
<th mat-header-cell *matHeaderCellDef>Belegnummer</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.document_no}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef>Betrag</th>
|
||||
<td mat-cell *matCellDef="let element" class="rightaligned">{{element.rawAccountEntry.amount | number:'1.2-2'}} €</td>
|
||||
|
@ -7,7 +7,7 @@ import { AccountEntryCategoryService, AccountEntryService, AccountService } from
|
||||
import { Account, AccountEntry, AccountEntryCategory, NULL_AccountEntry } from '../data-objects';
|
||||
import { ErrorDialogService } from '../error-dialog.service';
|
||||
import { ExtApiService } from '../ext-data-object-service';
|
||||
import { Saldo } from '../ext-data-objects';
|
||||
import { Saldo, UniqueNumber } from '../ext-data-objects';
|
||||
import { MessageService } from '../message.service';
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ export class AccountComponent implements OnInit {
|
||||
account: Account
|
||||
accountEntries: DN_AccountEntry[]
|
||||
accountEntriesDataSource: MatTableDataSource<DN_AccountEntry>
|
||||
accountEntriesDisplayedColumns: string[] = [ "description", "amount", "createdAt", "category", "overhead_relevant" ]
|
||||
accountEntriesDisplayedColumns: string[] = [ "description", "document_no", "amount", "createdAt", "category", "overhead_relevant" ]
|
||||
saldo: Saldo
|
||||
|
||||
accountEntryCategories: AccountEntryCategory[]
|
||||
@ -92,12 +92,15 @@ export class AccountComponent implements OnInit {
|
||||
try {
|
||||
this.addAccountEntryButton.disabled = true
|
||||
this.messageService.add(`${JSON.stringify(formData.value, undefined, 4)}`)
|
||||
let uniquenumber: UniqueNumber = await this.extApiService.getUniqueNumber();
|
||||
this.messageService.add(`Got unique number as document_no: ${uniquenumber.number}`)
|
||||
let newAccountEntry: AccountEntry = {
|
||||
description: formData.value.description,
|
||||
account: this.account.id,
|
||||
created_at: formData.value.createdAt,
|
||||
amount: formData.value.amount,
|
||||
id: 0,
|
||||
document_no: uniquenumber.number,
|
||||
account_entry_category: 0
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -130,6 +130,11 @@ export class PremiseService {
|
||||
}
|
||||
|
||||
|
||||
async getPremisesByAccount(id: number): Promise<Premise[]> {
|
||||
this.messageService.add(`PremiseService: get data by Account ${id}`);
|
||||
return this.http.get<Premise[]>(`${serviceBaseUrl}/v1/premises/account/${id}`).toPromise()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ export interface Premise {
|
||||
street: string
|
||||
zip: string
|
||||
city: string
|
||||
account: number
|
||||
}
|
||||
export const NULL_Premise: Premise = {
|
||||
id: 0
|
||||
@ -59,6 +60,7 @@ export const NULL_Premise: Premise = {
|
||||
,street: ''
|
||||
,zip: ''
|
||||
,city: ''
|
||||
,account: undefined
|
||||
}
|
||||
|
||||
export interface Flat {
|
||||
@ -190,6 +192,7 @@ export interface AccountEntry {
|
||||
account: number
|
||||
created_at: string
|
||||
amount: number
|
||||
document_no: number
|
||||
account_entry_category: number
|
||||
}
|
||||
export const NULL_AccountEntry: AccountEntry = {
|
||||
@ -198,6 +201,7 @@ export const NULL_AccountEntry: AccountEntry = {
|
||||
,account: undefined
|
||||
,created_at: ''
|
||||
,amount: undefined
|
||||
,document_no: undefined
|
||||
,account_entry_category: undefined
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { serviceBaseUrl } from './config';
|
||||
|
||||
|
||||
import { Account, Fee, OverheadAdvance } from './data-objects';
|
||||
import { Saldo, Tenant_with_Saldo } from './ext-data-objects';
|
||||
import { Saldo, Tenant_with_Saldo, UniqueNumber } from './ext-data-objects';
|
||||
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@ -38,4 +38,9 @@ export class ExtApiService {
|
||||
this.messageService.add("ExtApiService: get tenants with saldo");
|
||||
return this.http.get<Tenant_with_Saldo[]>(`${serviceBaseUrl}/v1/tenants/saldo`).toPromise()
|
||||
}
|
||||
|
||||
async getUniqueNumber(): Promise<UniqueNumber> {
|
||||
this.messageService.add("ExtApiService: get unique number");
|
||||
return this.http.get<UniqueNumber>(`${serviceBaseUrl}/v1/uniquenumber`).toPromise()
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,8 @@ export interface Tenant_with_Saldo {
|
||||
lastname: string
|
||||
address1: string
|
||||
saldo: number
|
||||
}
|
||||
|
||||
export interface UniqueNumber {
|
||||
number: number
|
||||
}
|
@ -26,6 +26,10 @@
|
||||
<th mat-header-cell *matHeaderCellDef>Ort</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.city}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="account">
|
||||
<th mat-header-cell *matHeaderCellDef>Betriebskostenkonto</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.account}}</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/premise/', row.id]"></tr>
|
||||
</table>
|
||||
|
@ -13,7 +13,8 @@ export class MyPremisesComponent implements OnInit {
|
||||
|
||||
premises: Premise[]
|
||||
dataSource: MatTableDataSource<Premise>
|
||||
displayedColumns: string[] = [ "description", "street", "zip", "city" ]
|
||||
displayedColumns: string[] = [ "description", "street", "zip", "city", "account" ]
|
||||
|
||||
|
||||
constructor(private premiseService: PremiseService, private messageService: MessageService) { }
|
||||
|
||||
|
@ -9,31 +9,58 @@
|
||||
</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div>
|
||||
<form (ngSubmit)="savePremise()">
|
||||
<div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Beschreibung</mat-label>
|
||||
<input matInput name="description" [(ngModel)]="premise.description"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Strasse</mat-label>
|
||||
<input matInput name="street" [(ngModel)]="premise.street"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>PLZ</mat-label>
|
||||
<input matInput name="zip" [(ngModel)]="premise.zip"/>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Ort</mat-label>
|
||||
<input matInput name="city" [(ngModel)]="premise.city"/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel (opened)="collapseDetails = true"
|
||||
(closed)="collapseDetails = false">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
Details
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<form (ngSubmit)="savePremise()">
|
||||
<div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Beschreibung</mat-label>
|
||||
<input matInput name="description" [(ngModel)]="premise.description"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Strasse</mat-label>
|
||||
<input matInput name="street" [(ngModel)]="premise.street"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>PLZ</mat-label>
|
||||
<input matInput name="zip" [(ngModel)]="premise.zip"/>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Ort</mat-label>
|
||||
<input matInput name="city" [(ngModel)]="premise.city"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Betriebskostenkonto</mat-label>
|
||||
<input matInput name="street" [(ngModel)]="premise.account"/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
|
||||
</form>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel (opened)="collapseOverheadAccount = true"
|
||||
(closed)="collapseOverheadAccount = false">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
Betriebskostenkonto
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<app-account #incomeAccountComponent [selectedAccountId]="overheadAccountId" [shallBeRentPayment]="false"></app-account>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</section>
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { PremiseService } from '../data-object-service';
|
||||
import { Premise } from '../data-objects';
|
||||
import { AccountService, PremiseService } from '../data-object-service';
|
||||
import { Account, NULL_Premise, Premise } from '../data-objects';
|
||||
import { MessageService } from '../message.service';
|
||||
|
||||
@Component({
|
||||
@ -12,18 +12,19 @@ import { MessageService } from '../message.service';
|
||||
})
|
||||
export class PremiseDetailsComponent implements OnInit {
|
||||
|
||||
collapseDetails: boolean = false
|
||||
collapseOverheadAccount: boolean = false
|
||||
|
||||
@ViewChild('submitButton') submitButton: MatButton
|
||||
|
||||
premise: Premise = {
|
||||
id: 0,
|
||||
description: '',
|
||||
street: '',
|
||||
zip: '',
|
||||
city: ''
|
||||
}
|
||||
premise: Premise = NULL_Premise
|
||||
|
||||
overheadAccount: Account
|
||||
overheadAccountId: number
|
||||
|
||||
constructor(
|
||||
private premiseService: PremiseService,
|
||||
private accountService: AccountService,
|
||||
private messageService: MessageService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
@ -34,6 +35,8 @@ export class PremiseDetailsComponent implements OnInit {
|
||||
const id = +this.route.snapshot.paramMap.get('id')
|
||||
if (id != 0) {
|
||||
this.premise = await this.premiseService.getPremise(id)
|
||||
this.overheadAccount = await this.accountService.getAccount(this.premise.account)
|
||||
this.overheadAccountId = this.overheadAccount.id
|
||||
}
|
||||
} catch (err) {
|
||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||
|
Reference in New Issue
Block a user