more details pages
This commit is contained in:
@ -27,7 +27,7 @@
|
||||
<td mat-cell *matCellDef="let element">{{element.flat.flat_no}}</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/flat/', row.id]"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/flat/', row.flat.id]"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
@ -17,7 +17,7 @@ interface DN_Flat {
|
||||
export class MyFlatsComponent implements OnInit {
|
||||
flats: Flat[]
|
||||
premises: Premise[]
|
||||
dnFlats: DN_Flat[]
|
||||
dnFlats: DN_Flat[] = []
|
||||
|
||||
dataSource: MatTableDataSource<DN_Flat>
|
||||
displayedColumns: string[] = ["description", "premise", "area", "flat_no"]
|
||||
@ -39,20 +39,18 @@ export class MyFlatsComponent implements OnInit {
|
||||
|
||||
const premisesDict = new Map<number, Premise>()
|
||||
for (let p of this.premises) {
|
||||
this.messageService.add(`p2pd: ${p.id}`)
|
||||
premisesDict.set(p.id, p)
|
||||
}
|
||||
this.messageService.add(`premisesDict: ${ JSON.stringify(premisesDict, undefined, 4) }`)
|
||||
for (let f of this.flats) {
|
||||
this.dnFlats.push({
|
||||
flat: f,
|
||||
premise: premisesDict.get(f.premise)
|
||||
})
|
||||
}
|
||||
this.messageService.add(`dnFlats: { JSON.stringify(this.dnFlats, undefined, 4) }`)
|
||||
|
||||
this.dataSource = new MatTableDataSource<DN_Flat>(this.dnFlats)
|
||||
} catch (err) {
|
||||
// throw err
|
||||
this.messageService.add(`Error in getFlats: ${ JSON.stringify(err, undefined, 4) }`)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user