<ng-container *ngFor="let hazard of hazardInfo | getObjectKeys">
<nova-accordion-item *ngIf="hazardInfo[hazard].length"
[isActive]="true">
<div accordion-item-head fxLayoutWrap>
<div novaTrunc fxFlex="100" fxFlex.sm="100">
<nova-icon-text *ngIf="hazard === 'assetHazards'"
[icon]="'icon-triangles_three'" [text]="
('details.assetHazards'|sgTranslatePipe) +' (
'+hazardInfo.assetHazards.length+' )'"></nova-icon-text>
<nova-icon-text *ngIf="hazard === 'propertyHazards'"
[icon]="'icon-office'" [text]="
('details.propertyHazards'|sgTranslatePipe) +' (
'+hazardInfo.propertyHazards.length+' )'"></nova-icon-text>
<nova-icon-text *ngIf="hazard === 'spaceHazards'" [icon]="'icon-square_opening'" [text]="('details.spaceHazards'|sgTranslatePipe) +' ( '+hazardInfo.spaceHazards.length+' )'"></nova-icon-text>
</div>
</div>
<div accordion-item-body fxLayoutWrap>
<workorder-ehs-hazard-table fxFlexFill [data]="hazardInfo[hazard]"></workorder-ehs-hazard-table>
</div>
</nova-accordion-item>
</ng-container>
public getOrderType(): string {
if (this.selectedOrder.assets && this.selectedOrder.assets.length) {
return 'asset';
} else if (this.selectedOrder.property && (this.selectedOrder.space &&
this.selectedOrder.space.hasOwnProperty('id'))) {
return 'space';
} else if (this.selectedOrder.property) {
return 'property';
}
}
I have 3 types of order which is decided by the set of conditions , the list is ordered as below Asset order: Asset, Space, Property |
Space order: Space, Asset, Property |
Property order: Property, Space, Assets |
How to achieve this using pipes or any other efficient way