add new pages
This commit is contained in:
@ -0,0 +1,25 @@
|
||||
<section class="mat-typography">
|
||||
<mat-card class="defaultCard">
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
Meine Büros
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div>
|
||||
<table mat-table [dataSource]="dataSource" #zftable>
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.description}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="premise">
|
||||
<th mat-header-cell *matHeaderCellDef>Haus</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.premise}}</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/commercialunit/', row.id]"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</section>
|
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MyCommercialUnitsComponent } from './my-commercial-units.component';
|
||||
|
||||
describe('MyCommercialUnitsComponent', () => {
|
||||
let component: MyCommercialUnitsComponent;
|
||||
let fixture: ComponentFixture<MyCommercialUnitsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MyCommercialUnitsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MyCommercialUnitsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,37 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MessageService } from '../message.service';
|
||||
import { CommercialPremiseService } from '../data-object-service';
|
||||
import { CommercialPremise } from '../data-objects';
|
||||
import { MatTableDataSource } from '@angular/material/table'
|
||||
|
||||
@Component({
|
||||
selector: 'app-my-commercial-units',
|
||||
templateUrl: './my-commercial-units.component.html',
|
||||
styleUrls: ['./my-commercial-units.component.css']
|
||||
})
|
||||
export class MyCommercialUnitsComponent implements OnInit {
|
||||
|
||||
commercialPremises: CommercialPremise[]
|
||||
dataSource: MatTableDataSource<CommercialPremise>
|
||||
displayedColumns: string[] = ["description", "premise"]
|
||||
|
||||
constructor(private commercialPremiseService: CommercialPremiseService, private messageService: MessageService) { }
|
||||
|
||||
async getCommercialPremises(): Promise<void> {
|
||||
try {
|
||||
this.messageService.add("Trying to load commercialPremises")
|
||||
this.commercialPremises = await this.commercialPremiseService.getCommercialPremises()
|
||||
this.messageService.add("CommercialPremises loaded")
|
||||
|
||||
this.dataSource = new MatTableDataSource<CommercialPremise>(this.commercialPremises)
|
||||
} catch (err) {
|
||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.messageService.add("MyCommercialUnitsComponent.ngOnInit")
|
||||
this.getCommercialPremises()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user