tenant details form

This commit is contained in:
2021-08-30 19:00:27 +02:00
parent 829aefc514
commit af0e4ffd74
10 changed files with 250 additions and 3 deletions

View File

@ -0,0 +1,57 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { TenantService } from '../data-object-service';
import { Tenant } from '../data-objects';
import { MessageService } from '../message.service';
import { Location } from '@angular/common'
@Component({
selector: 'app-tenant-details',
templateUrl: './tenant-details.component.html',
styleUrls: ['./tenant-details.component.css']
})
export class TenantDetailsComponent implements OnInit {
tenant: Tenant = {
id: 0,
salutation: '',
firstname: '',
lastname: '',
address1: '',
address2: '',
address3: '',
zip: '',
city: '',
phone1: '',
phone2: '',
iban: '',
account: 0
}
constructor(
private tenantService: TenantService,
private messageService: MessageService,
private route: ActivatedRoute,
private location: Location
) { }
async getTenant(): Promise<void> {
try {
const id = +this.route.snapshot.paramMap.get('id')
this.tenant = await this.tenantService.getTenant(id)
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
}
updateTenant() {
this.messageService.add("updateTenant")
this.messageService.add(JSON.stringify(this.tenant, undefined, 4))
}
ngOnInit(): void {
this.getTenant()
}
}