changes for details

This commit is contained in:
2021-09-01 17:58:49 +02:00
parent 5099e4ae63
commit 13c9cb4d96
16 changed files with 347 additions and 22 deletions

View File

@ -70,7 +70,7 @@
<input matInput name="account_desc" [readonly]="true" [ngModel]="account.description"/>
</mat-form-field>
</div>
<button type="submit" mat-raised-button color="primary">Speichern</button>
<button #submitButton type="submit" mat-raised-button color="primary">Speichern</button>
</form>
</div>
</mat-card-content>

View File

@ -1,9 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AccountService, TenantService } from '../data-object-service';
import { Account, Tenant } from '../data-objects';
import { MessageService } from '../message.service';
import { Location } from '@angular/common'
import { MatButton } from '@angular/material/button';
@Component({
selector: 'app-tenant-details',
@ -33,13 +33,14 @@ export class TenantDetailsComponent implements OnInit {
description: ''
}
@ViewChild('submitButton') submitButton: MatButton
constructor(
private tenantService: TenantService,
private accountService: AccountService,
private messageService: MessageService,
private route: ActivatedRoute,
private location: Location
private router: Router
) { }
async getTenant(): Promise<void> {
@ -55,6 +56,7 @@ export class TenantDetailsComponent implements OnInit {
}
async saveTenant() {
this.submitButton.disabled = true
this.messageService.add("saveTenant")
this.messageService.add(JSON.stringify(this.tenant, undefined, 4))
if (this.tenant.id == 0) {
@ -70,6 +72,7 @@ export class TenantDetailsComponent implements OnInit {
} else {
this.messageService.add("about to update existing tenant")
}
this.router.navigate(['/tenants'])
}
ngOnInit(): void {