tenant details form
This commit is contained in:
57
ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts
Normal file
57
ui/hv2-ui/src/app/tenant-details/tenant-details.component.ts
Normal 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()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user