fix premise account stuff

This commit is contained in:
Wolfgang Hottgenroth 2021-11-09 10:02:53 +01:00
parent 28e505f570
commit 3c97fb3582
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F
3 changed files with 12 additions and 6 deletions

View File

@ -40,7 +40,7 @@
<input matInput name="city" [(ngModel)]="premise.city"/>
</mat-form-field>
</div><div>
<mat-form-field appearance="outline">
<mat-form-field appearance="outline" *ngIf="premise.account">
<mat-label>Betriebskostenkonto</mat-label>
<input matInput name="street" [(ngModel)]="premise.account"/>
</mat-form-field>

View File

@ -50,6 +50,12 @@ export class PremiseDetailsComponent implements OnInit {
this.messageService.add(JSON.stringify(this.premise, undefined, 4))
if (this.premise.id == 0) {
this.messageService.add("about to insert new premise")
this.overheadAccount = {
"id": 0,
"description": `overhead_account_${this.premise.description}`
}
this.overheadAccount = await this.accountService.postAccount(this.overheadAccount)
this.premise.account = this.overheadAccount.id
this.premise = await this.premiseService.postPremise(this.premise)
this.messageService.add(`Successfully added premises with id ${this.premise.id}`)
} else {

View File

@ -68,18 +68,18 @@
<input matInput name="iban" [(ngModel)]="tenant.iban"/>
</mat-form-field>
</div>
<!--
<div>
<mat-form-field appearance="outline">
<mat-form-field appearance="outline" *ngIf="tenant.account">
<mat-label>Account ID</mat-label>
<input matInput name="account_id" [readonly]="true" [ngModel]="account.id"/>
<input matInput name="account_id" [readonly]="true" [ngModel]="tenant.account"/>
</mat-form-field>
<!--
<mat-form-field appearance="outline">
<mat-label>Account Description</mat-label>
<input matInput name="account_desc" [readonly]="true" [ngModel]="account.description"/>
</mat-form-field>
</div>
-->
</div>
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
</form>
</div>